index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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',267)"
  17. @saveColumn="saveColumnTwo('crud','option','optionList',267)"
  18. :page.sync="page">
  19. <template slot-scope="{type,size,row,index}" slot="menu">
  20. <el-button :size="size" :type="type" @click="check(row)">查看</el-button>
  21. <el-button :size="size" :type="type" :disabled="row.financeStatus == '已付款' || item>=1" @click="$refs.crud.rowDel(row,index)">删除</el-button>
  22. </template>
  23. <template slot="corpNameSearch">
  24. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  25. </template>
  26. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  27. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>
  28. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  29. </template>
  30. </avue-crud>
  31. </basic-container>
  32. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  33. </div>
  34. </template>
  35. <script>
  36. // import {getList, remove} from "@/api/oceanShipping/maritimeExport/index.js";
  37. import {getList, remove} from "@/api/collectionSettlement/index.js";
  38. import detailsPage from "./detailsPage"
  39. export default {
  40. name: "index",
  41. components: {
  42. detailsPage
  43. },
  44. data() {
  45. return {
  46. detailsOpen: false,
  47. loading: false,
  48. search: {},
  49. form: {},
  50. dataList: [],
  51. detailData: {},
  52. page: {
  53. pageSize: 20,
  54. currentPage: 1,
  55. total: 0,
  56. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  57. },
  58. key: 0,
  59. option: {},
  60. optionList: {
  61. viewBtn: false,
  62. editBtn: false,
  63. delBtn: false,
  64. addBtn: false,
  65. index: true,
  66. span: 8,
  67. border: true,
  68. height: "auto",
  69. searchMenuPosition: "right",
  70. align: "center",
  71. size: "small",
  72. menuWidth: 100,
  73. searchSpan: 8,
  74. searchIcon: true,
  75. searchIndex: 2,
  76. highlightCurrentRow: true,
  77. dialogWidth: "70%",
  78. column: [{
  79. label: '系统编号',
  80. prop: "sysNo",
  81. search: true,
  82. overHidden: true,
  83. }, {
  84. label: '订单号',
  85. prop: "contractNumber",
  86. search: true,
  87. overHidden: true,
  88. }, {
  89. label: "客户名称",
  90. prop: "corpId",
  91. search: true,
  92. props: {
  93. label: 'cname',
  94. value: 'id'
  95. },
  96. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=KH&enableOrNot=0',
  97. }, {
  98. label: "所属公司名称",
  99. prop: "salesCompanyId",
  100. search: true,
  101. }, {
  102. label: '收付款状态',
  103. prop: "financeStatus",
  104. search: true,
  105. overHidden: true,
  106. }, {
  107. label: '收款账户',
  108. prop: "accountName",
  109. search: true,
  110. overHidden: true,
  111. props: {
  112. label: 'cname',
  113. value: 'id'
  114. },
  115. dicUrl: '/api/blade-sales-part/accountManagement/list?enableOrNot=1&cname={{key}}&billType=HYCK',
  116. }, {
  117. label: '人民币金额',
  118. prop: "amount",
  119. search: true,
  120. overHidden: true,
  121. }, {
  122. label: '经办人名称',
  123. prop: "handledByName",
  124. search: true,
  125. overHidden: true,
  126. props: {
  127. label: "name",
  128. value: "id"
  129. },
  130. dicUrl: "/api/blade-user/client/gainUser",
  131. }, {
  132. label: "结算日期",
  133. prop: "settlementDate",
  134. searchProp: "createTimeList",
  135. type: "date",
  136. overHidden: true,
  137. width: 100,
  138. searchRange: true,
  139. searchDefaultTime: ["00:00:00", "23:59:59"],
  140. format: "yyyy-MM-dd",
  141. valueFormat: "yyyy-MM-dd HH:mm:ss"
  142. },
  143. // {
  144. // label: "应结日期",
  145. // prop: "dueDate",
  146. // searchProp: "updateTimeList",
  147. // type: "date",
  148. // overHidden: true,
  149. // width: 100,
  150. // searchRange: true,
  151. // searchDefaultTime: ["00:00:00", "23:59:59"],
  152. // format: "yyyy-MM-dd",
  153. // valueFormat: "yyyy-MM-dd HH:mm:ss"
  154. // }
  155. ]
  156. }
  157. }
  158. },
  159. async created() {
  160. this.option = await this.getColumnData(this.getColumnName(267), this.optionList);
  161. this.key++
  162. let i = 0;
  163. this.option.column.forEach(item => {
  164. if (item.search) i++
  165. })
  166. if (i % 3 !== 0) {
  167. const num = 3 - Number(i % 3)
  168. this.option.searchMenuSpan = num * 8;
  169. this.option.searchMenuPosition = "right";
  170. }
  171. },
  172. // 解决AVue表格错位问题
  173. activated () {
  174. this.$nextTick(() => {
  175. this.$refs.crud.doLayout()
  176. })
  177. },
  178. methods: {
  179. check(row) {
  180. this.form = row
  181. this.detailsOpen = true
  182. },
  183. backToList(type) {
  184. this.form = {}
  185. this.detailsOpen = false
  186. if (type === 0) {
  187. this.detailData = {}
  188. }
  189. this.onLoad(this.page, this.search)
  190. },
  191. //刷新
  192. refreshChange() {
  193. this.onLoad(this.page, this.search)
  194. },
  195. rowDel(form, index) {
  196. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  197. confirmButtonText: '确定',
  198. cancelButtonText: '取消',
  199. type: 'warning'
  200. }).then(() => {
  201. remove({ids:form.id}).then(res => {
  202. this.$message({
  203. type: 'success',
  204. message: '删除成功!'
  205. });
  206. this.dataList.splice(index, 1);
  207. this.onLoad(this.page)
  208. })
  209. }).catch(() => {
  210. });
  211. },
  212. searchChange(params, done) {
  213. done();
  214. this.onLoad(this.page, params)
  215. },
  216. onLoad(page, params = {}) {
  217. params = {
  218. ...params,
  219. current: page.currentPage,
  220. size: page.pageSize,
  221. billType: "HYCK",
  222. dc:'d',
  223. ...Object.assign(params, this.search)
  224. }
  225. this.loading = true
  226. getList(params).then(res => {
  227. this.dataList = res.data.data.records
  228. this.page.total = res.data.data.total
  229. this.loading = false
  230. }).finally(() => {
  231. this.loading = false
  232. })
  233. },
  234. //自定义列保存
  235. async saveColumnTwo(ref, option, optionBack, code) {
  236. /**
  237. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  238. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  239. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  240. */
  241. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  242. if (inSave) {
  243. this.$message.success("保存成功");
  244. //关闭窗口
  245. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  246. }
  247. },
  248. //自定义列重置
  249. async resetColumnTwo(ref, option, optionBack, code) {
  250. this[option] = this[optionBack];
  251. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  252. if (inSave) {
  253. this.$message.success("重置成功");
  254. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  255. }
  256. }
  257. }
  258. }
  259. </script>
  260. <style scoped>
  261. </style>