index.vue 14 KB

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