index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 276)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 276)" :page.sync="page"
  9. @row-update="rowUpdate">
  10. <template slot-scope="{type,size,row,index}" slot="menu" >
  11. <!--<el-button icon="el-icon-view" :size="size" :type="type" @click="check(row)">查看</el-button>-->
  12. <el-button type="text" size="small" :disabled="Number(row.sendTotalNum) == Number(row.goodsTotalNum)" @click="rowCell(row, index)">{{ row.$cellEdit ? '保存' : '修改' }}
  13. </el-button>
  14. <el-button style="color: red" type="text" size="small" v-if="row.statusName == '已派工'" @click="shipRevokeWorkOrderfun(row, index)">撤销派工
  15. </el-button>
  16. <!-- <el-button :disabled="row.statusName === '已派工'" :size="size" :type="type"
  17. @click="$refs.crud.rowDel(row, index)">删除
  18. </el-button> -->
  19. </template>
  20. <template slot="corpNameSearch">
  21. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  22. </template>
  23. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  24. <!-- <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>-->
  25. <!-- <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>-->
  26. <el-button type="success" icon="el-icon-finished" size="small" @click="dispatching"
  27. :disabled="selectionList.length <= 0">派工
  28. </el-button>
  29. <!--<el-button type="success" icon="el-icon-finished" size="small" @click="shipRevokeWorkOrderfun"-->
  30. <!-- :disabled="selectionList.length <= 0">撤销派工-->
  31. <!--</el-button>-->
  32. </template>
  33. </avue-crud>
  34. </basic-container>
  35. <!--<detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>-->
  36. </div>
  37. </template>
  38. <script>
  39. import {
  40. getList,
  41. remove,
  42. outboundWorkOrder,
  43. typeSave,
  44. generateWarehousing,
  45. shipRevokeWorkOrder
  46. } from "@/api/tirePartsMall/salesManagement/outboundTask";
  47. import da from "element-ui/src/locale/lang/da";
  48. // import detailsPage from "./detailsPage"
  49. export default {
  50. name: "index",
  51. components: {
  52. // detailsPage
  53. },
  54. data() {
  55. return {
  56. detailsOpen: false,
  57. loading: false,
  58. search: {},
  59. form: {},
  60. dataList: [],
  61. selectionList: [],
  62. detailData: {},
  63. page: {
  64. pageSize: 20,
  65. currentPage: 1,
  66. total: 0,
  67. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  68. },
  69. key: 0,
  70. option: {},
  71. optionList: {
  72. selection: true,
  73. viewBtn: false,
  74. editBtn: false,
  75. celBtn: true,
  76. delBtn: false,
  77. addBtn: false,
  78. menu: true,
  79. index: true,
  80. span: 8,
  81. border: true,
  82. height: "auto",
  83. searchMenuPosition: "right",
  84. align: "center",
  85. size: "small",
  86. menuWidth: 100,
  87. searchSpan: 8,
  88. searchIcon: true,
  89. searchIndex: 2,
  90. highlightCurrentRow: true,
  91. dialogWidth: "70%",
  92. summaryText: "合计",
  93. showSummary: true,
  94. sumColumnList: [ {
  95. name: 'goodsTotalNum',
  96. type: 'sum',
  97. }, {
  98. name: 'sendTotalNum',
  99. type: 'sum',
  100. },],
  101. column: [{
  102. label: '采购单号',
  103. prop: "ordNo",
  104. search: true,
  105. searchOrder:1,
  106. width: 140,
  107. overHidden: true,
  108. }, {
  109. label: '状态',
  110. prop: "statusName",
  111. searchOrder:2,
  112. width: 100,
  113. search: true,
  114. type: 'select',
  115. overHidden: true,
  116. dicData: [{
  117. label: '待处理',
  118. value: '待处理'
  119. }, {
  120. label: '已派工',
  121. value: '已派工'
  122. }, {
  123. label: '未完成',
  124. value: '未完成'
  125. }, {
  126. label: '已完成',
  127. value: '已完成'
  128. }],
  129. }, {
  130. label: '业务对象',
  131. prop: "customerName",
  132. search: true,
  133. width: 140,
  134. type: 'select',
  135. overHidden: true,
  136. props: {
  137. label: 'cname',
  138. value: 'id'
  139. },
  140. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=GYS&enableOrNot=1',
  141. }
  142. // , {
  143. // label: "商品种类",
  144. // prop: "corpId",
  145. // width: 100,
  146. // overHidden: true,
  147. // }
  148. ,
  149. // {
  150. // label: '业务来源',
  151. // prop: "bsType",
  152. // width: 100,
  153. // overHidden: true,
  154. // },
  155. // {
  156. // label: '来源公司',
  157. // prop: "sourceCompanyName",
  158. // search: true,
  159. // width: 100,
  160. // overHidden: true,
  161. // type: 'select',
  162. // props: {
  163. // label: 'fullName',
  164. // value: 'fullName'
  165. // },
  166. // dicUrl: '/api/blade-system/dept/top-list'
  167. // },
  168. {
  169. label: '收货仓库',
  170. prop: "storageName",
  171. width: 100,
  172. search: true,
  173. overHidden: true,
  174. cell:false,
  175. type: 'select',
  176. props: {
  177. label: 'cname',
  178. value: 'cname'
  179. },
  180. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  181. },
  182. {
  183. label: '库管',
  184. prop: "stockClerkId",
  185. width: 100,
  186. cell:false,
  187. overHidden: true,
  188. type: 'select',
  189. props: {
  190. label: 'realName',
  191. value: 'id'
  192. },
  193. dicUrl: '/api/blade-user/stockClerkList',
  194. },
  195. {
  196. label: '收货地址',
  197. prop: "recAddress",
  198. width: 200,
  199. overHidden: true,
  200. },
  201. {
  202. label: '采购数量',
  203. prop: "goodsTotalNum",
  204. width: 100,
  205. overHidden: true,
  206. },
  207. {
  208. label: '收货数量',
  209. prop: "sendTotalNum",
  210. width: 100,
  211. overHidden: true,
  212. },
  213. {
  214. label: '联系人',
  215. prop: "contacts",
  216. width: 100,
  217. overHidden: true,
  218. }, {
  219. label: '电话',
  220. prop: "phone",
  221. width: 100,
  222. overHidden: true,
  223. }, {
  224. label: '备注',
  225. prop: "remarks",
  226. width: 200,
  227. cell:false,
  228. overHidden: true,
  229. }, {
  230. label: '业务日期',
  231. prop: "businesDate",
  232. searchProp: "businesDateList",
  233. type: "date",
  234. overHidden: true,
  235. search: true,
  236. width: 100,
  237. searchRange: true,
  238. searchDefaultTime: ["00:00:00", "23:59:59"],
  239. format: "yyyy-MM-dd",
  240. valueFormat: "yyyy-MM-dd HH:mm:ss"
  241. }]
  242. }
  243. }
  244. },
  245. async created() {
  246. this.option = await this.getColumnData(this.getColumnName(276), this.optionList);
  247. this.key++
  248. let i = 0;
  249. this.option.column.forEach(item => {
  250. if (item.search) i++
  251. })
  252. if (i % 3 !== 0) {
  253. const num = 3 - Number(i % 3)
  254. this.option.searchMenuSpan = num * 8;
  255. this.option.searchMenuPosition = "right";
  256. }
  257. this.option = await this.getColumnData(this.getColumnName(276), this.optionList);
  258. this.option.selectable = (row, index) => {
  259. return Number(row.sendTotalNum) !== Number(row.goodsTotalNum);
  260. }
  261. },
  262. methods: {
  263. selectionChange(list) {
  264. console.log(list);
  265. this.selectionList = list
  266. },
  267. // 撤销派工
  268. shipRevokeWorkOrderfun(row){
  269. this.$confirm('是否要撤销派工?', '提示', {
  270. confirmButtonText: '确定',
  271. cancelButtonText: '取消',
  272. type: 'warning'
  273. }).then(()=>{
  274. // this.loading = true; // Show the loading spinner
  275. shipRevokeWorkOrder(row.id).then(res=>{
  276. console.log(res,273)
  277. this.$message({
  278. type: 'success',
  279. message: '撤销派工成功!'
  280. });
  281. this.onLoad(this.page)
  282. })
  283. })
  284. },
  285. dispatching() {
  286. this.$confirm('是否确认派工?', '提示', {
  287. confirmButtonText: '确定',
  288. cancelButtonText: '取消',
  289. type: 'warning'
  290. }).then(() => {
  291. let data = []
  292. for (let item of this.selectionList) {
  293. data.push(item.id)
  294. }
  295. this.loading = true; // Show the loading spinner
  296. generateWarehousing(data.join(',')).then(res => {
  297. this.$message({
  298. type: 'success',
  299. message: '生成成功!'
  300. });
  301. this.onLoad(this.page)
  302. }).finally(() => {
  303. this.loading = false; // Hide the loading spinner
  304. });
  305. })
  306. },
  307. check(row) {
  308. this.form = row
  309. this.detailsOpen = true
  310. },
  311. backToList(type) {
  312. this.form = {}
  313. this.detailsOpen = false
  314. if (type === 0) {
  315. this.detailData = {}
  316. }
  317. this.onLoad(this.page, this.search)
  318. },
  319. //列表更新
  320. rowUpdate(form, index, done) {
  321. console.log(form);
  322. typeSave(form).then(res => {
  323. this.$message({type: "success", message: form.id ? "修改成功!" : "新增成功!"});
  324. // this.page.currentPage = 1;
  325. // this.onLoad(this.page);
  326. //成功关闭此页面回到列表页
  327. // this.backToList()
  328. })
  329. done()
  330. },
  331. //刷新
  332. refreshChange() {
  333. this.onLoad(this.page, this.search)
  334. },
  335. rowCell(row,index){
  336. this.findObject(this.option.column, "storageName").cell = true
  337. this.findObject(this.optionList.column, "storageName").cell = true
  338. this.findObject(this.option.column, "stockClerkId").cell = true
  339. this.findObject(this.optionList.column, "stockClerkId").cell = true
  340. this.findObject(this.option.column, "remarks").cell = true
  341. this.findObject(this.optionList.column, "remarks").cell = true
  342. this.$refs.crud.rowCell(row, index)
  343. },
  344. rowDel(form, index) {
  345. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  346. confirmButtonText: '确定',
  347. cancelButtonText: '取消',
  348. type: 'warning'
  349. }).then(() => {
  350. remove(form.id).then(res => {
  351. this.$message({
  352. type: 'success',
  353. message: '删除成功!'
  354. });
  355. this.dataList.splice(index, 1);
  356. this.onLoad(this.page)
  357. })
  358. }).catch(() => {
  359. });
  360. },
  361. searchChange(params, done) {
  362. console.log(params);
  363. done();
  364. this.onLoad(this.page, params)
  365. },
  366. onLoad(page, params = {}) {
  367. params = {
  368. // ...params,
  369. current: page.currentPage,
  370. size: page.pageSize,
  371. bizTypeName: "SHRW",
  372. statusName:'待处理',
  373. ...Object.assign(params, this.search),
  374. customerName : params.$customerName
  375. }
  376. console.log(params);
  377. this.loading = true
  378. getList(params).then(res => {
  379. this.dataList = res.data.data.records
  380. this.page.total = res.data.data.total
  381. this.loading = false
  382. }).finally(() => {
  383. this.loading = false
  384. })
  385. },
  386. //自定义列保存
  387. async saveColumnTwo(ref, option, optionBack, code) {
  388. console.log(2132);
  389. /**
  390. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  391. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  392. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  393. */
  394. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  395. // this.option = await this.getColumnData(this.getColumnName(271), this.optionList);
  396. if (inSave) {
  397. this.$message.success("保存成功");
  398. //关闭窗口
  399. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  400. }
  401. },
  402. //自定义列重置
  403. async resetColumnTwo(ref, option, optionBack, code) {
  404. console.log(this[option]);
  405. console.log(this[optionBack]);
  406. this[option] = this[optionBack];
  407. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  408. if (inSave) {
  409. this.$message.success("重置成功");
  410. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  411. }
  412. this.option.selectable = (row, index) => {
  413. return Number(row.sendTotalNum) !== Number(row.goodsTotalNum);
  414. }
  415. }
  416. }
  417. }
  418. </script>
  419. <style scoped></style>