index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud
  5. :option="option"
  6. :search.sync="search"
  7. v-model="form"
  8. :table-loading="loading"
  9. :data="dataList"
  10. ref="crud"
  11. :key="key"
  12. @on-load="onLoad"
  13. @search-change="searchChange"
  14. @row-del="rowDel"
  15. @refresh-change="refreshChange"
  16. @resetColumn="resetColumnTwo('crud','option','optionList',266)"
  17. @saveColumn="saveColumnTwo('crud','option','optionList',266)"
  18. :page.sync="page">
  19. <template slot-scope="{ row, index }" slot="sysNo">
  20. <span style="color: #409EFF;cursor: pointer" @click.stop="check(row)">{{ row.sysNo }}
  21. </span>
  22. </template>
  23. <template slot-scope="{ row, index }" slot="corpId">
  24. <span style="color: #409EFF;cursor: pointer" @click.stop="check(row)">{{ row.corpName }}
  25. </span>
  26. </template>
  27. <template slot-scope="{type,size,row,index}" slot="menu">
  28. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  29. <el-button :size="size" :disabled="row.financeStatus == '已付款' || item>=1" :type="type" @click="$refs.crud.rowDel(row,index)">删除</el-button>
  30. </template>
  31. <template slot="corpNameSearch">
  32. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  33. </template>
  34. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  35. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>
  36. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  37. </template>
  38. </avue-crud>
  39. </basic-container>
  40. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  41. </div>
  42. </template>
  43. <script>
  44. import {getList, remove} from "@/api/collectionSettlement/index.js";
  45. import detailsPage from "./detailsPage"
  46. export default {
  47. name: "index",
  48. components: {
  49. detailsPage
  50. },
  51. data() {
  52. return {
  53. detailsOpen: false,
  54. loading: false,
  55. search: {},
  56. form: {},
  57. dataList: [],
  58. detailData: {},
  59. page: {
  60. pageSize: 20,
  61. currentPage: 1,
  62. total: 0,
  63. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  64. },
  65. key: 0,
  66. option: {},
  67. optionList: {
  68. viewBtn: false,
  69. editBtn: false,
  70. delBtn: false,
  71. addBtn: false,
  72. index: true,
  73. span: 8,
  74. border: true,
  75. height: "auto",
  76. searchMenuPosition: "right",
  77. align: "center",
  78. size: "small",
  79. menuWidth: 50,
  80. searchSpan: 8,
  81. searchIcon: true,
  82. searchIndex: 2,
  83. highlightCurrentRow: true,
  84. dialogWidth: "70%",
  85. column: [{
  86. label: '单据编号',
  87. prop: "sysNo",
  88. search: true,
  89. overHidden: true,
  90. }, {
  91. label: '合同号',
  92. prop: "contractNumber",
  93. search: true,
  94. overHidden: true,
  95. }, {
  96. label: "供应商",
  97. prop: "corpId",
  98. searchOrder:1,
  99. search: true,
  100. type: "select",
  101. props: {
  102. label: 'cname',
  103. value: 'id'
  104. },
  105. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=GYS&enableOrNot=1',
  106. }, {
  107. label: '账户',
  108. prop: "accountName",
  109. search: true,
  110. overHidden: true,
  111. type: "select",
  112. props: {
  113. label: 'cname',
  114. value: 'id',
  115. res:'data.records'
  116. },
  117. dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
  118. // dicFormatter: (res => {
  119. // return res.data.records
  120. // }),
  121. }, {
  122. label: '金额',
  123. prop: "amount",
  124. // search: true,
  125. overHidden: true,
  126. }, {
  127. label: '状态',
  128. prop: "financeStatus",
  129. search: true,
  130. overHidden: true,
  131. type:'select',
  132. dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_Status",
  133. props: {
  134. label: "dictValue",
  135. value: "dictKey"
  136. }
  137. },{
  138. label: '结算日期',
  139. prop: "settlementDate",
  140. searchProp:"settlementDateList",
  141. search: true,
  142. overHidden: true,
  143. type: "date",
  144. searchOrder:2,
  145. width: 100,
  146. searchRange: true,
  147. searchDefaultTime: ["00:00:00", "23:59:59"],
  148. format: "yyyy-MM-dd",
  149. valueFormat: "yyyy-MM-dd HH:mm:ss"
  150. }, {
  151. label: "制单时间",
  152. prop: "createTime",
  153. // searchProp: "createTimeList",
  154. type: "date",
  155. overHidden: true,
  156. width: 100,
  157. searchRange: true,
  158. searchDefaultTime: ["00:00:00", "23:59:59"],
  159. format: "yyyy-MM-dd",
  160. valueFormat: "yyyy-MM-dd HH:mm:ss"
  161. },
  162. // {
  163. // label: "创建人",
  164. // prop: "createUserName",
  165. // searchProp: "createUser",
  166. // overHidden: true,
  167. // width: 100,
  168. // filterable: true,
  169. // remote: true,
  170. // type: "select",
  171. // dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  172. // props: {
  173. // label: "account",
  174. // value: "id",
  175. // res: 'data.records'
  176. // }
  177. // }, {
  178. // label: "修改人",
  179. // prop: "updateUserName",
  180. // searchProp: "updateUser",
  181. // overHidden: true,
  182. // width: 100,
  183. // filterable: true,
  184. // remote: true,
  185. // type: "select",
  186. // dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  187. // props: {
  188. // label: "account",
  189. // value: "id",
  190. // res: 'data.records'
  191. // }
  192. // },
  193. // {
  194. // label: "更新日期",
  195. // prop: "updateTime",
  196. // searchProp: "updateTimeList",
  197. // type: "date",
  198. // overHidden: true,
  199. // width: 100,
  200. // searchRange: true,
  201. // searchDefaultTime: ["00:00:00", "23:59:59"],
  202. // format: "yyyy-MM-dd",
  203. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  204. // }
  205. ]
  206. }
  207. }
  208. },
  209. async created() {
  210. this.option = await this.getColumnData(this.getColumnName(266), this.optionList);
  211. this.key++
  212. let i = 0;
  213. this.option.column.forEach(item => {
  214. if (item.search) i++
  215. })
  216. if (i % 3 !== 0) {
  217. const num = 3 - Number(i % 3)
  218. this.option.searchMenuSpan = num * 8;
  219. this.option.searchMenuPosition = "right";
  220. }
  221. },
  222. methods: {
  223. check(row) {
  224. this.form = row
  225. this.detailsOpen = true
  226. },
  227. backToList(type) {
  228. this.form = {}
  229. this.detailsOpen = false
  230. if (type === 0) {
  231. this.detailData = {}
  232. }
  233. this.onLoad(this.page, this.search)
  234. },
  235. //刷新
  236. refreshChange() {
  237. this.onLoad(this.page, this.search)
  238. },
  239. rowDel(form, index) {
  240. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  241. confirmButtonText: '确定',
  242. cancelButtonText: '取消',
  243. type: 'warning'
  244. }).then(() => {
  245. remove({ids:form.id}).then(res => {
  246. this.$message({
  247. type: 'success',
  248. message: '删除成功!'
  249. });
  250. this.dataList.splice(index, 1);
  251. this.onLoad(this.page)
  252. })
  253. }).catch(() => {
  254. });
  255. },
  256. searchChange(params, done) {
  257. done();
  258. this.onLoad(this.page, params)
  259. },
  260. onLoad(page, params = {}) {
  261. console.log(params);
  262. console.log(this.search);
  263. this.search.accountId = this.search.accountName
  264. params = {
  265. ...params,
  266. current: page.currentPage,
  267. size: page.pageSize,
  268. billType: "FK",
  269. dc:'c',
  270. ...Object.assign(params, this.search)
  271. }
  272. this.loading = true
  273. getList(params).then(res => {
  274. this.dataList = res.data.data.records
  275. this.page.total = res.data.data.total
  276. this.loading = false
  277. }).finally(() => {
  278. this.loading = false
  279. })
  280. },
  281. //自定义列保存
  282. async saveColumnTwo(ref, option, optionBack, code) {
  283. /**
  284. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  285. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  286. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  287. */
  288. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  289. if (inSave) {
  290. this.$message.success("保存成功");
  291. //关闭窗口
  292. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  293. }
  294. },
  295. //自定义列重置
  296. async resetColumnTwo(ref, option, optionBack, code) {
  297. this[option] = this[optionBack];
  298. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  299. if (inSave) {
  300. this.$message.success("重置成功");
  301. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  302. }
  303. }
  304. }
  305. }
  306. </script>
  307. <style scoped>
  308. </style>