index.vue 14 KB

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