index.vue 9.2 KB

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