billDetails.vue 5.5 KB

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