index.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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" @selection-change="selectionChange" @on-load="onLoad" @search-change="searchChange"
  6. @row-del="rowDel" @refresh-change="refreshChange" @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 271)"
  7. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 271)" :page.sync="page">
  8. <template slot-scope="{type,size,row,index}" slot="menu">
  9. <!--<el-button icon="el-icon-view" :size="size" :type="type" @click="check(row)">查看</el-button>-->
  10. <el-button icon="el-icon-delete" :disabled="row.statusName === '已派工'" :size="size" :type="type"
  11. @click="$refs.crud.rowDel(row, index)">删除
  12. </el-button>
  13. </template>
  14. <template slot="corpNameSearch">
  15. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  16. </template>
  17. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  18. <!-- <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>-->
  19. <!-- <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>-->
  20. <el-button type="success" icon="el-icon-finished" size="small" @click="dispatching"
  21. :disabled="selectionList.length <= 0">派工
  22. </el-button>
  23. </template>
  24. </avue-crud>
  25. </basic-container>
  26. <!--<detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>-->
  27. </div>
  28. </template>
  29. <script>
  30. import { getList, remove, outboundWorkOrder } from "@/api/tirePartsMall/salesManagement/outboundTask";
  31. import da from "element-ui/src/locale/lang/da";
  32. // import detailsPage from "./detailsPage"
  33. export default {
  34. name: "index",
  35. components: {
  36. // detailsPage
  37. },
  38. data() {
  39. return {
  40. detailsOpen: false,
  41. loading: false,
  42. search: {},
  43. form: {},
  44. dataList: [],
  45. selectionList: [],
  46. detailData: {},
  47. page: {
  48. pageSize: 20,
  49. currentPage: 1,
  50. total: 0,
  51. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  52. },
  53. key: 0,
  54. option: {},
  55. optionList: {
  56. selection: true,
  57. viewBtn: false,
  58. editBtn: false,
  59. delBtn: false,
  60. addBtn: false,
  61. menu: true,
  62. index: true,
  63. span: 8,
  64. border: true,
  65. height: "auto",
  66. searchMenuPosition: "right",
  67. align: "center",
  68. size: "small",
  69. menuWidth: 80,
  70. searchSpan: 8,
  71. searchIcon: true,
  72. searchIndex: 2,
  73. highlightCurrentRow: true,
  74. dialogWidth: "70%",
  75. summaryText: "合计",
  76. // showSummary: true,
  77. // sumColumnList: [],
  78. column: [{
  79. label: '销售单号',
  80. prop: "ordNo",
  81. search: true,
  82. width: 140,
  83. overHidden: true,
  84. }, {
  85. label: '业务对象',
  86. prop: "customerName",
  87. search: true,
  88. width: 140,
  89. overHidden: true,
  90. }
  91. // , {
  92. // label: "商品种类",
  93. // prop: "corpId",
  94. // width: 100,
  95. // overHidden: true,
  96. // }
  97. , {
  98. label: '业务来源',
  99. prop: "bsType",
  100. width: 100,
  101. overHidden: true,
  102. },
  103. {
  104. label: '来源公司',
  105. prop: "sourceCompanyId",
  106. width: 100,
  107. overHidden: true,
  108. },
  109. {
  110. label: '发货仓库',
  111. prop: "storageName",
  112. width: 100,
  113. overHidden: true,
  114. },
  115. // {
  116. // label: '发货库管',
  117. // prop: "bsType",
  118. // width: 100,
  119. // overHidden: true,
  120. // },
  121. {
  122. label: '收货地址',
  123. prop: "recAddress",
  124. width: 200,
  125. overHidden: true,
  126. },
  127. {
  128. label: '销售数量',
  129. prop: "goodsTotalNum",
  130. width: 100,
  131. overHidden: true,
  132. },
  133. {
  134. label: '发货数量',
  135. prop: "goodsTotalShipNum",
  136. width: 100,
  137. overHidden: true,
  138. },
  139. {
  140. label: '联系人',
  141. prop: "contacts",
  142. width: 100,
  143. overHidden: true,
  144. }, {
  145. label: '电话',
  146. prop: "phone",
  147. width: 100,
  148. overHidden: true,
  149. }, {
  150. label: '状态',
  151. prop: "statusName",
  152. width: 100,
  153. overHidden: true,
  154. }, {
  155. label: '备注',
  156. prop: "remarks",
  157. width: 200,
  158. overHidden: true,
  159. }, {
  160. label: '业务日期',
  161. prop: "createTime",
  162. searchProp: "createTimeList",
  163. type: "date",
  164. overHidden: true,
  165. search: true,
  166. width: 100,
  167. searchRange: true,
  168. searchDefaultTime: ["00:00:00", "23:59:59"],
  169. format: "yyyy-MM-dd",
  170. valueFormat: "yyyy-MM-dd HH:mm:ss"
  171. }]
  172. }
  173. }
  174. },
  175. async created() {
  176. this.option = await this.getColumnData(this.getColumnName(271), this.optionList);
  177. this.key++
  178. let i = 0;
  179. this.option.column.forEach(item => {
  180. if (item.search) i++
  181. })
  182. if (i % 3 !== 0) {
  183. const num = 3 - Number(i % 3)
  184. this.option.searchMenuSpan = num * 8;
  185. this.option.searchMenuPosition = "right";
  186. }
  187. this.option.selectable = (row, index) => {
  188. return row.statusName === "待处理";
  189. }
  190. },
  191. methods: {
  192. selectionChange(list) {
  193. this.selectionList = list
  194. },
  195. dispatching() {
  196. this.$confirm('是否确认派工?', '提示', {
  197. confirmButtonText: '确定',
  198. cancelButtonText: '取消',
  199. type: 'warning'
  200. }).then(() => {
  201. let data = []
  202. for (let item of this.selectionList) {
  203. data.push(item.id)
  204. }
  205. this.loading = true; // Show the loading spinner
  206. outboundWorkOrder(data.join(',')).then(res => {
  207. this.$message({
  208. type: 'success',
  209. message: '生成成功!'
  210. });
  211. this.onLoad(this.page)
  212. }).finally(() => {
  213. this.loading = false; // Hide the loading spinner
  214. });
  215. })
  216. },
  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. //刷新
  230. refreshChange() {
  231. this.onLoad(this.page, this.search)
  232. },
  233. rowDel(form, index) {
  234. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  235. confirmButtonText: '确定',
  236. cancelButtonText: '取消',
  237. type: 'warning'
  238. }).then(() => {
  239. remove(form.id).then(res => {
  240. this.$message({
  241. type: 'success',
  242. message: '删除成功!'
  243. });
  244. this.dataList.splice(index, 1);
  245. this.onLoad(this.page)
  246. })
  247. }).catch(() => {
  248. });
  249. },
  250. searchChange(params, done) {
  251. done();
  252. this.onLoad(this.page, params)
  253. },
  254. onLoad(page, params = {}) {
  255. params = {
  256. ...params,
  257. current: page.currentPage,
  258. size: page.pageSize,
  259. bizTypeName: "FHRW",
  260. ...Object.assign(params, this.search)
  261. }
  262. this.loading = true
  263. getList(params).then(res => {
  264. this.dataList = res.data.data.records
  265. this.page.total = res.data.data.total
  266. this.loading = false
  267. }).finally(() => {
  268. this.loading = false
  269. })
  270. },
  271. //自定义列保存
  272. async saveColumnTwo(ref, option, optionBack, code) {
  273. /**
  274. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  275. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  276. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  277. */
  278. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  279. if (inSave) {
  280. this.$message.success("保存成功");
  281. //关闭窗口
  282. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  283. }
  284. },
  285. //自定义列重置
  286. async resetColumnTwo(ref, option, optionBack, code) {
  287. this[option] = this[optionBack];
  288. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  289. if (inSave) {
  290. this.$message.success("重置成功");
  291. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  292. }
  293. }
  294. }
  295. }
  296. </script>
  297. <style scoped></style>