index.vue 14 KB

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