index.vue 9.6 KB

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