index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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: 5,
  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. filterable: true,
  102. remote: true,
  103. props: {
  104. label: 'cname',
  105. value: 'id'
  106. },
  107. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=GYS',
  108. },{
  109. label: '结算日期',
  110. prop: "settlementDate",
  111. searchProp:"settlementDateList",
  112. search: true,
  113. overHidden: true,
  114. type: "date",
  115. searchOrder:2,
  116. width: 100,
  117. searchRange: true,
  118. unlinkPanels: true,
  119. searchDefaultTime: ["00:00:00", "23:59:59"],
  120. format: "yyyy-MM-dd",
  121. valueFormat: "yyyy-MM-dd HH:mm:ss"
  122. }, {
  123. label: '账户',
  124. prop: "accountName",
  125. search: true,
  126. overHidden: true,
  127. type: "select",
  128. props: {
  129. label: 'cname',
  130. value: 'id',
  131. res:'data.records'
  132. },
  133. dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
  134. // dicFormatter: (res => {
  135. // return res.data.records
  136. // }),
  137. }, {
  138. label: '金额',
  139. prop: "amount",
  140. // search: true,
  141. overHidden: true,
  142. }, {
  143. label: '状态',
  144. prop: "financeStatus",
  145. search: true,
  146. overHidden: true,
  147. type:'select',
  148. dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_Status",
  149. props: {
  150. label: "dictValue",
  151. value: "dictKey"
  152. }
  153. }, {
  154. label: "制单时间",
  155. prop: "createTime",
  156. // searchProp: "createTimeList",
  157. type: "date",
  158. overHidden: true,
  159. width: 100,
  160. searchRange: true,
  161. searchDefaultTime: ["00:00:00", "23:59:59"],
  162. format: "yyyy-MM-dd",
  163. valueFormat: "yyyy-MM-dd HH:mm:ss"
  164. },
  165. // {
  166. // label: "创建人",
  167. // prop: "createUserName",
  168. // searchProp: "createUser",
  169. // overHidden: true,
  170. // width: 100,
  171. // filterable: true,
  172. // remote: true,
  173. // type: "select",
  174. // dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  175. // props: {
  176. // label: "account",
  177. // value: "id",
  178. // res: 'data.records'
  179. // }
  180. // }, {
  181. // label: "修改人",
  182. // prop: "updateUserName",
  183. // searchProp: "updateUser",
  184. // overHidden: true,
  185. // width: 100,
  186. // filterable: true,
  187. // remote: true,
  188. // type: "select",
  189. // dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  190. // props: {
  191. // label: "account",
  192. // value: "id",
  193. // res: 'data.records'
  194. // }
  195. // },
  196. // {
  197. // label: "更新日期",
  198. // prop: "updateTime",
  199. // searchProp: "updateTimeList",
  200. // type: "date",
  201. // overHidden: true,
  202. // width: 100,
  203. // searchRange: true,
  204. // searchDefaultTime: ["00:00:00", "23:59:59"],
  205. // format: "yyyy-MM-dd",
  206. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  207. // }
  208. ]
  209. }
  210. }
  211. },
  212. async created() {
  213. this.option = await this.getColumnData(this.getColumnName(266), this.optionList);
  214. this.key++
  215. let i = 0;
  216. this.option.column.forEach(item => {
  217. if (item.search) i++
  218. })
  219. if (i % 3 !== 0) {
  220. const num = 3 - Number(i % 3)
  221. this.option.searchMenuSpan = num * 8;
  222. this.option.searchMenuPosition = "right";
  223. }
  224. },
  225. methods: {
  226. check(row) {
  227. this.form = row
  228. this.detailsOpen = true
  229. },
  230. backToList(type) {
  231. this.form = {}
  232. this.detailsOpen = false
  233. if (type === 0) {
  234. this.detailData = {}
  235. }
  236. this.onLoad(this.page, this.search)
  237. },
  238. //刷新
  239. refreshChange() {
  240. this.onLoad(this.page, this.search)
  241. },
  242. rowDel(form, index) {
  243. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  244. confirmButtonText: '确定',
  245. cancelButtonText: '取消',
  246. type: 'warning'
  247. }).then(() => {
  248. remove({ids:form.id}).then(res => {
  249. this.$message({
  250. type: 'success',
  251. message: '删除成功!'
  252. });
  253. this.dataList.splice(index, 1);
  254. this.onLoad(this.page)
  255. })
  256. }).catch(() => {
  257. });
  258. },
  259. searchChange(params, done) {
  260. this.page.currentPage = 1;
  261. done();
  262. this.onLoad(this.page, params)
  263. },
  264. onLoad(page, params = {}) {
  265. console.log(params);
  266. console.log(this.search);
  267. this.search.accountId = this.search.accountName
  268. params = {
  269. ...params,
  270. current: page.currentPage,
  271. size: page.pageSize,
  272. billType: "FK",
  273. dc:'c',
  274. ...Object.assign(params, this.search)
  275. }
  276. this.loading = true
  277. getList(params).then(res => {
  278. this.dataList = res.data.data.records
  279. this.page.total = res.data.data.total
  280. this.loading = false
  281. }).finally(() => {
  282. this.loading = false
  283. })
  284. },
  285. //自定义列保存
  286. async saveColumnTwo(ref, option, optionBack, code) {
  287. /**
  288. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  289. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  290. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  291. */
  292. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  293. if (inSave) {
  294. this.$message.success("保存成功");
  295. //关闭窗口
  296. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  297. }
  298. },
  299. //自定义列重置
  300. async resetColumnTwo(ref, option, optionBack, code) {
  301. this[option] = this[optionBack];
  302. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  303. if (inSave) {
  304. this.$message.success("重置成功");
  305. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  306. }
  307. }
  308. }
  309. }
  310. </script>
  311. <style scoped>
  312. </style>