index.vue 13 KB

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