index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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',269)"
  17. @saveColumn="saveColumnTwo('crud','option','optionList',269)"
  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" @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/tirePartsMall/salesManagement/saleOrder";
  37. import detailsPage from "./detailsPage"
  38. export default {
  39. name: "index",
  40. components: {
  41. detailsPage
  42. },
  43. data() {
  44. return {
  45. detailsOpen: false,
  46. loading: false,
  47. search: {},
  48. form: {},
  49. dataList: [],
  50. detailData: {},
  51. page: {
  52. pageSize: 20,
  53. currentPage: 1,
  54. total: 0,
  55. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  56. },
  57. key: 0,
  58. option: {},
  59. optionList: {
  60. viewBtn: false,
  61. editBtn: false,
  62. delBtn: false,
  63. addBtn: false,
  64. index: true,
  65. span: 8,
  66. border: true,
  67. height: "auto",
  68. searchMenuPosition: "right",
  69. align: "center",
  70. size: "small",
  71. menuWidth: 100,
  72. searchSpan: 8,
  73. searchIcon: true,
  74. searchIndex: 2,
  75. highlightCurrentRow: true,
  76. dialogWidth: "70%",
  77. summaryText: "合计",
  78. showSummary: true,
  79. sumColumnList:[],
  80. column: [{
  81. label: '销售单号',
  82. prop: "ordNo",
  83. search: true,
  84. overHidden: true,
  85. }, {
  86. label: '来源单号',
  87. prop: "srcOrdNo",
  88. search: true,
  89. overHidden: true,
  90. },
  91. {
  92. label: "业务来源",
  93. prop: "businessSource",
  94. overHidden: true,
  95. }, {
  96. label: '所属公司',
  97. prop: "salesCompanyName",
  98. overHidden: true,
  99. }, {
  100. label: '业务对象',
  101. prop: "customerId",
  102. search: true,
  103. overHidden: true,
  104. type: 'select',
  105. props: {
  106. label: 'cname',
  107. value: 'id'
  108. },
  109. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  110. }, {
  111. label: '仓库',
  112. prop: "storageId",
  113. search: true,
  114. overHidden: true,
  115. type: 'select',
  116. props: {
  117. label: 'cname',
  118. value: 'id'
  119. },
  120. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  121. }, {
  122. label: '行数',
  123. prop: "numberRows",
  124. overHidden: true,
  125. }, {
  126. label: '数量',
  127. prop: "goodsTotalNum",
  128. overHidden: true,
  129. }, {
  130. label: '金额',
  131. prop: "totalMoney",
  132. overHidden: true,
  133. }, {
  134. label: '状态',
  135. prop: "status",
  136. overHidden: true,
  137. }, {
  138. label: '应结日期',
  139. prop: "dueDate",
  140. overHidden: true,
  141. }, {
  142. label: "制单人",
  143. prop: "createUserName",
  144. searchProp: "createUser",
  145. overHidden: true,
  146. width: 100,
  147. filterable: true,
  148. remote: true,
  149. type: "select",
  150. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  151. props: {
  152. label: "account",
  153. value: "id",
  154. res: 'data.records'
  155. }
  156. }, {
  157. label: "制单日期",
  158. prop: "createTime",
  159. searchProp: "createTimeList",
  160. type: "date",
  161. overHidden: true,
  162. width: 100,
  163. searchRange: true,
  164. searchDefaultTime: ["00:00:00", "23:59:59"],
  165. format: "yyyy-MM-dd",
  166. valueFormat: "yyyy-MM-dd HH:mm:ss"
  167. }, {
  168. label: "更新人",
  169. prop: "updateUserName",
  170. searchProp: "updateUser",
  171. overHidden: true,
  172. width: 100,
  173. filterable: true,
  174. remote: true,
  175. type: "select",
  176. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  177. props: {
  178. label: "account",
  179. value: "id",
  180. res: 'data.records'
  181. }
  182. }, {
  183. label: "更新日期",
  184. prop: "updateTime",
  185. searchProp: "updateTimeList",
  186. type: "date",
  187. overHidden: true,
  188. width: 100,
  189. searchRange: true,
  190. searchDefaultTime: ["00:00:00", "23:59:59"],
  191. format: "yyyy-MM-dd",
  192. valueFormat: "yyyy-MM-dd HH:mm:ss"
  193. }]
  194. }
  195. }
  196. },
  197. async created() {
  198. this.option = await this.getColumnData(this.getColumnName(269), this.optionList);
  199. this.key++
  200. let i = 0;
  201. this.option.column.forEach(item => {
  202. if (item.search) i++
  203. })
  204. if (i % 3 !== 0) {
  205. const num = 3 - Number(i % 3)
  206. this.option.searchMenuSpan = num * 8;
  207. this.option.searchMenuPosition = "right";
  208. }
  209. },
  210. methods: {
  211. check(row) {
  212. this.form = row
  213. this.detailsOpen = true
  214. },
  215. backToList(type) {
  216. this.form = {}
  217. this.detailsOpen = false
  218. if (type === 0) {
  219. this.detailData = {}
  220. }
  221. this.onLoad(this.page, this.search)
  222. },
  223. //刷新
  224. refreshChange() {
  225. this.onLoad(this.page, this.search)
  226. },
  227. rowDel(form, index) {
  228. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  229. confirmButtonText: '确定',
  230. cancelButtonText: '取消',
  231. type: 'warning'
  232. }).then(() => {
  233. remove(form.id).then(res => {
  234. this.$message({
  235. type: 'success',
  236. message: '删除成功!'
  237. });
  238. this.dataList.splice(index, 1);
  239. this.onLoad(this.page)
  240. })
  241. }).catch(() => {
  242. });
  243. },
  244. searchChange(params, done) {
  245. done();
  246. this.onLoad(this.page, params)
  247. },
  248. onLoad(page, params = {}) {
  249. params = {
  250. ...params,
  251. current: page.currentPage,
  252. size: page.pageSize,
  253. bsType: "XS",
  254. ...Object.assign(params, this.search)
  255. }
  256. this.loading = true
  257. getList(params).then(res => {
  258. this.dataList = res.data.data.records
  259. this.page.total = res.data.data.total
  260. this.loading = false
  261. }).finally(() => {
  262. this.loading = false
  263. })
  264. },
  265. //自定义列保存
  266. async saveColumnTwo(ref, option, optionBack, code) {
  267. /**
  268. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  269. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  270. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  271. */
  272. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  273. if (inSave) {
  274. this.$message.success("保存成功");
  275. //关闭窗口
  276. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  277. }
  278. },
  279. //自定义列重置
  280. async resetColumnTwo(ref, option, optionBack, code) {
  281. this[option] = this[optionBack];
  282. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  283. if (inSave) {
  284. this.$message.success("重置成功");
  285. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  286. }
  287. }
  288. }
  289. }
  290. </script>
  291. <style scoped>
  292. </style>