index.vue 14 KB

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