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', 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: "statusName",
  106. searchOrder:2,
  107. width: 100,
  108. search: true,
  109. type: 'select',
  110. overHidden: true,
  111. searchValue:'待处理',
  112. dicData: [{
  113. label: '待处理',
  114. value: '待处理'
  115. }, {
  116. label: '已派工',
  117. value: '已派工'
  118. },{
  119. label: '未完成',
  120. value: '未完成'
  121. }, {
  122. label: '已完成',
  123. value: '已完成'
  124. }],
  125. }, {
  126. label: '业务对象',
  127. prop: "customerName",
  128. search: true,
  129. width: 140,
  130. type: 'select',
  131. overHidden: true,
  132. props: {
  133. label: 'cname',
  134. value: 'id'
  135. },
  136. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  137. }
  138. // , {
  139. // label: "商品种类",
  140. // prop: "corpId",
  141. // width: 100,
  142. // overHidden: true,
  143. // }
  144. , {
  145. label: '业务来源',
  146. prop: "bsType",
  147. width: 100,
  148. overHidden: true,
  149. },
  150. {
  151. label: '来源公司',
  152. prop: "sourceCompanyName",
  153. search: true,
  154. width: 100,
  155. overHidden: true,
  156. type: 'select',
  157. props: {
  158. label: 'fullName',
  159. value: 'fullName'
  160. },
  161. dicUrl: '/api/blade-system/dept/top-list'
  162. },
  163. {
  164. label: '发货仓库',
  165. prop: "storageName",
  166. width: 100,
  167. search: true,
  168. overHidden: true,
  169. cell:false,
  170. type: 'select',
  171. props: {
  172. label: 'cname',
  173. value: 'cname'
  174. },
  175. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  176. },
  177. {
  178. label: '库管',
  179. prop: "stockClerkId",
  180. width: 100,
  181. cell:false,
  182. overHidden: true,
  183. type: 'select',
  184. props: {
  185. label: 'realName',
  186. value: 'id'
  187. },
  188. dicUrl: '/api/blade-user/stockClerkList',
  189. },
  190. {
  191. label: '收货地址',
  192. prop: "recAddress",
  193. width: 200,
  194. overHidden: true,
  195. },
  196. {
  197. label: '销售数量',
  198. prop: "goodsTotalNum",
  199. width: 100,
  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(271), 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(271), 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: "FHRW",
  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(271), 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>