billDetails.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. ref="crud"
  6. v-model="form"
  7. :page.sync="page"
  8. :search.sync="search"
  9. :table-loading="loading"
  10. :cell-style="cellStyle"
  11. @search-change="searchChange"
  12. @search-reset="searchReset"
  13. @selection-change="selectionChange"
  14. @current-change="currentChange"
  15. @size-change="sizeChange"
  16. @refresh-change="refreshChange"
  17. :row-style="rowStyle"
  18. @on-load="onLoad"
  19. @saveColumn="saveColumn"
  20. @resetColumn="resetColumn"
  21. @search-criteria-switch="searchCriteriaSwitch"
  22. >
  23. <template slot="corpIdSearch">
  24. <select-component
  25. v-model="search.corpId"
  26. :configuration="configuration"
  27. ></select-component>
  28. </template>
  29. <template slot="costTypeSearch">
  30. <breakdown-select
  31. v-model="search.costType"
  32. :configuration="breakConfiguration"
  33. ></breakdown-select>
  34. </template>
  35. <template slot-scope="scope" slot="corpId">
  36. <span>{{ scope.row.corpName }}</span>
  37. </template>
  38. <template slot-scope="scope" slot="costType">
  39. <span>{{ scope.row.itemName }}</span>
  40. </template>
  41. <template slot-scope="scope" slot="billType">
  42. <span>{{ scope.row.billType == "申请"?"付费":"收费" }}</span>
  43. </template>
  44. <template slot-scope="scope" slot="menu">
  45. <el-button
  46. type="text"
  47. icon="el-icon-delete"
  48. size="small"
  49. :disabled="scope.row.billType === '申请' || scope.row.settlementAmount != 0"
  50. @click.stop=""
  51. >删除
  52. </el-button>
  53. </template>
  54. </avue-crud>
  55. </basic-container>
  56. </template>
  57. <script>
  58. import option from "./configuration/mainList.json";
  59. import { getBillList } from "@/api/financialManagement/paymentRequest";
  60. import _ from "lodash";
  61. export default {
  62. data() {
  63. return {
  64. loading : false,
  65. form: {},
  66. search:{},
  67. detailData:{},
  68. option: {},
  69. parentId:0,
  70. dataList: [],
  71. page: {
  72. pageSize: 10,
  73. pagerCount: 5,
  74. total: 0,
  75. },
  76. query:{},
  77. configuration:{
  78. multipleChoices:false,
  79. multiple:false,
  80. disabled:false,
  81. searchShow:true,
  82. collapseTags:false,
  83. clearable:true,
  84. placeholder:'请点击右边按钮选择',
  85. dicData:[]
  86. },
  87. breakConfiguration:{
  88. multipleChoices:false,
  89. multiple:false,
  90. disabled:false,
  91. searchShow:true,
  92. collapseTags:false,
  93. clearable:true,
  94. placeholder:'请点击右边按钮选择',
  95. dicData:[]
  96. },
  97. }
  98. },
  99. async created() {
  100. this.option = await this.getColumnData(this.getColumnName(60), option);
  101. },
  102. mounted() {
  103. // option.height = window.innerHeight - 200 ;
  104. },
  105. methods: {
  106. rowStyle(data){
  107. if(_.subtract(data.row.settlementAmount, data.row.amount) < 0){
  108. return {
  109. color: "rgba(220,0,0,0.56)"
  110. }
  111. }
  112. },
  113. //新单打开
  114. addReceipt(row){
  115. console.log(1)
  116. },
  117. //编辑打开
  118. editOpen(row){
  119. console.log(1)
  120. },
  121. searchReset() {
  122. console.log('1')
  123. },
  124. selectionChange() {
  125. console.log('1')
  126. },
  127. sizeChange() {
  128. console.log('1')
  129. },
  130. currentChange(val) {
  131. this.page.currentPage = val
  132. },
  133. refreshChange(params) {
  134. this.onLoad(this.page,params);
  135. },
  136. //点击搜索按钮触发
  137. searchChange(params, done) {
  138. this.query = params;
  139. this.page.currentPage = 1;
  140. this.onLoad(this.page, params);
  141. done()
  142. },
  143. paramsAdjustment(params) {
  144. params = Object.assign({}, this.search);
  145. if (params.createTime && params.createTime.length !==0 ) { //合同
  146. params.createStartDate = params.createTime[0]+ " " + "00:00:00";
  147. params.createEndDate = params.createTime[1] + " " + "23:59:59";
  148. this.$delete(params,'createTime')
  149. }
  150. return params
  151. },
  152. onLoad(page, params = {}) {
  153. this.loading = true;
  154. params = this.paramsAdjustment(params)
  155. getBillList(page.currentPage, page.pageSize,params).then(res=>{
  156. this.dataList = res.data.data.records
  157. this.page.total = res.data.data.total
  158. if (this.page.total) {
  159. this.option.height = window.innerHeight - 240;
  160. }
  161. }).finally(()=>{
  162. this.loading = false;
  163. })
  164. },
  165. searchCriteriaSwitch(type){
  166. if (type){
  167. this.option.height = this.option.height - 96
  168. }else {
  169. this.option.height = this.option.height + 96
  170. }
  171. this.$refs.crud.getTableHeight()
  172. },
  173. cellStyle() {
  174. return "padding:0;height:40px;";
  175. },
  176. //列保存触发
  177. async saveColumn() {
  178. const inSave = await this.saveColumnData(
  179. this.getColumnName(60),
  180. this.option
  181. );
  182. if (inSave) {
  183. this.$message.success("保存成功");
  184. //关闭窗口
  185. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  186. }
  187. },
  188. async resetColumn() {
  189. const inSave = await this.delColumnData(
  190. this.getColumnName(60),
  191. option
  192. );
  193. if (inSave) {
  194. this.$message.success("重置成功");
  195. this.option = option;
  196. //关闭窗口
  197. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  198. }
  199. },
  200. }
  201. }
  202. </script>
  203. <style scoped>
  204. </style>