index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  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" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @expand-change="expandChange" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 270)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 270)" :page.sync="page">
  9. <template slot-scope="{ row }" slot="expand">
  10. <avue-crud :data="row.itemData" :option="itemOption" :table-loading="row.itemLoading" :cell-style="cellStyle"
  11. class="itemTable"></avue-crud>
  12. </template>
  13. <template slot-scope="{type,size,row,index}" slot="menu">
  14. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  15. <el-button :size="size" :disabled="row.status !== '待出库' && row.item >= 1" :type="type"
  16. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  17. <!-- <el-button :size="size" :type="type"-->
  18. <!-- @click="deliverGoods(row)">发货</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. </template>
  27. <template slot-scope="{ row, index }" slot="billno">
  28. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 1)">{{ row.billno }}
  29. </span>
  30. </template>
  31. <template slot-scope="{ row, index }" slot="ordNo">
  32. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
  33. </span>
  34. </template>
  35. <template slot-scope="{ row, index }" slot="statusName">
  36. <span v-for="item in statusNameData"
  37. :style="{background: item.colour}"
  38. class="bottomBox"
  39. v-if="item.dictKey == row.statusName">
  40. {{ item.dictValue }}
  41. </span>
  42. </template>
  43. </avue-crud>
  44. </basic-container>
  45. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  46. <el-dialog
  47. title="发货"
  48. :visible.sync="dialogVisible"
  49. append-to-body
  50. close-on-click-modal
  51. close-on-press-escape
  52. width="40%">
  53. <div class="elForm">
  54. <el-form :model="dialogForm" label-position="right">
  55. <el-col :span="24">
  56. <el-form-item label="收货人姓名:" label-width="100px">
  57. <span>{{ dialogForm.contacts }}</span>
  58. </el-form-item>
  59. <el-form-item label="收货人电话:" label-width="100px">
  60. <span>{{ dialogForm.phone }}</span>
  61. </el-form-item>
  62. <el-form-item label="收货人地址:" label-width="100px">
  63. <span>{{ dialogForm.recAddress }}</span>
  64. </el-form-item>
  65. </el-col>
  66. <el-form-item label="配送方式" label-width="100px">
  67. <el-select v-model="dialogForm.shipType" @change="courierTypeChange" style="width: 90%;" placeholder="请选择运输类型">
  68. <el-option
  69. v-for="item in courierTypeList"
  70. :key="item.dictKey"
  71. :label="item.dictValue"
  72. :value="item.dictValue">
  73. </el-option>
  74. </el-select>
  75. </el-form-item>
  76. <el-form-item label="货运公司" label-width="100px">
  77. <el-select v-model="dialogForm.logisticsCorpName" filterable allow-create default-first-option style="width: 90%;" placeholder="请选择货运公司">
  78. <el-option
  79. v-for="item in courierList"
  80. :key="item.dictKey"
  81. :label="item.dictValue"
  82. :value="item.dictValue">
  83. </el-option>
  84. </el-select>
  85. </el-form-item>
  86. <el-form-item label="货运单号" label-width="100px">
  87. <el-input v-model="dialogForm.expressNo" style="width: 90%;" placeholder="请输入货运单号"></el-input>
  88. </el-form-item>
  89. </el-form>
  90. </div>
  91. <span slot="footer" class="dialog-footer">
  92. <el-button size="small" @click="dialogVisible = false">取 消</el-button>
  93. <el-button size="small" type="primary" @click="confirmShipment">确认发货</el-button>
  94. </span>
  95. </el-dialog>
  96. </div>
  97. </template>
  98. <script>
  99. import { getList, remove, getGoodsInfo, getDetails, shipments } from "@/api/tirePartsMall/salesManagement/outboundWorkOrder";
  100. import detailsPage from "./detailsPage"
  101. import {getWorkDicts} from "../../../../api/system/dictbiz";
  102. export default {
  103. name: "index",
  104. components: {
  105. detailsPage
  106. },
  107. data() {
  108. return {
  109. statusNameData:[], // 状态字典
  110. dialogVisible: false,
  111. dialogForm: {},
  112. courierTypeList: [],
  113. courierList: [],
  114. detailsOpen: false,
  115. loading: false,
  116. search: {
  117. statusName:'待出库'
  118. },
  119. form: {},
  120. dataList: [],
  121. detailData: {},
  122. page: {
  123. pageSize: 20,
  124. currentPage: 1,
  125. total: 0,
  126. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  127. },
  128. key: 0,
  129. itemOption: {
  130. align: "center",
  131. header: false,
  132. border: true,
  133. menu: false,
  134. column: [
  135. {
  136. label: '商品名称',
  137. prop: 'goodsId',
  138. disabled: true,
  139. width: 200,
  140. overHidden: true,
  141. props: {
  142. label: 'cname',
  143. value: 'id'
  144. },
  145. dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll'
  146. }, {
  147. label: '商品编码',
  148. disabled: true,
  149. prop: 'goodsNo',
  150. width: 100
  151. }, {
  152. label: '品牌',
  153. prop: 'brandId',
  154. disabled: true,
  155. width: 100,
  156. overHidden: true,
  157. props: {
  158. label: 'cname',
  159. value: 'id'
  160. },
  161. dicUrl: '/api/blade-sales-part/brandDesc/listAll?type=PP&enableOrNot=1'
  162. }, {
  163. label: '规格型号',
  164. prop: 'propertyName',
  165. disabled: true,
  166. width: 100
  167. }, {
  168. label: '花纹',
  169. prop: 'pattern',
  170. disabled: true,
  171. width: 100
  172. }, {
  173. label: '商品描述',
  174. prop: 'goodsDescription',
  175. disabled: true,
  176. }, {
  177. label: '批次号',
  178. prop: 'dot',
  179. type: 'select',
  180. disabled: true,
  181. dicData: [],
  182. props: {
  183. label: "dot",
  184. value: "dot"
  185. },
  186. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  187. }
  188. ]
  189. },
  190. option: {},
  191. optionList: {
  192. viewBtn: false,
  193. editBtn: false,
  194. delBtn: false,
  195. addBtn: false,
  196. index: true,
  197. span: 8,
  198. border: true,
  199. height: "auto",
  200. searchMenuPosition: "right",
  201. align: "center",
  202. size: "small",
  203. menuWidth: 100,
  204. searchSpan: 8,
  205. searchIcon: true,
  206. searchIndex: 2,
  207. highlightCurrentRow: true,
  208. expand: true,
  209. expandWidth: 60,
  210. dialogWidth: "70%",
  211. summaryText: "合计",
  212. showSummary: true,
  213. sumColumnList: [{
  214. name: "goodsTotalNum",
  215. type: "sum",
  216. decimals: 0
  217. }],
  218. column: [{
  219. label: '出库单号',
  220. prop: "billno",
  221. search: true,
  222. overHidden: true,
  223. }, {
  224. label: '来源单号',
  225. prop: "ordNo",
  226. search: true,
  227. overHidden: true,
  228. }, {
  229. label: "业务来源",
  230. prop: "bsType",
  231. search: true,
  232. overHidden: true,
  233. type: 'select',
  234. dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_Source",
  235. props: {
  236. label: "dictValue",
  237. value: "dictKey"
  238. }
  239. }, {
  240. label: '业务对象',
  241. prop: "customerId",
  242. search: true,
  243. overHidden: true,
  244. type: 'select',
  245. props: {
  246. label: 'cname',
  247. value: 'id'
  248. },
  249. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  250. }, {
  251. label: '仓库',
  252. prop: "storageId",
  253. search: true,
  254. overHidden: true,
  255. type: 'select',
  256. props: {
  257. label: 'cname',
  258. value: 'id'
  259. },
  260. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  261. }
  262. // , {
  263. // label: '商品种类',
  264. // prop: "numberRows",
  265. // overHidden: true,
  266. // }
  267. , {
  268. label: "订单数量",
  269. prop: "goodsTotalNum",
  270. search: false,
  271. overHidden: true,
  272. // width: 120,
  273. }, {
  274. label: "实际数量",
  275. prop: "sendTotalNum",
  276. search: false,
  277. overHidden: true,
  278. // width: 120,
  279. }, {
  280. label: '状态',
  281. prop: "statusName",
  282. search: true,
  283. overHidden: true,
  284. type: 'select',
  285. dicUrl: "/api/blade-system/dict-biz/dictionary?code=outbound_work_order_status",
  286. props: {
  287. label: "dictValue",
  288. value: "dictKey"
  289. }
  290. }, {
  291. label: '业务日期',
  292. prop: "businesDate",
  293. overHidden: true,
  294. searchProp: "businesDateList",
  295. type: "date",
  296. overHidden: true,
  297. search: true,
  298. width: 100,
  299. searchRange: true,
  300. searchDefaultTime: ["00:00:00", "23:59:59"],
  301. format: "yyyy-MM-dd",
  302. valueFormat: "yyyy-MM-dd HH:mm:ss"
  303. }, {
  304. label: '库管',
  305. prop: "stockClerkId",
  306. type: 'select',
  307. search: true,
  308. props: {
  309. label: 'realName',
  310. value: 'id'
  311. },
  312. dicUrl: '/api/blade-user/stockClerkList',
  313. overHidden: true,
  314. }, {
  315. label: "制单人",
  316. prop: "createUserName",
  317. searchProp: "createUser",
  318. overHidden: true,
  319. width: 100,
  320. filterable: true,
  321. remote: true,
  322. type: "select",
  323. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  324. props: {
  325. label: "account",
  326. value: "id",
  327. res: 'data.records'
  328. }
  329. }, {
  330. label: "制单日期",
  331. prop: "createTime",
  332. searchProp: "createTimeList",
  333. type: "date",
  334. overHidden: true,
  335. width: 100,
  336. searchRange: true,
  337. searchDefaultTime: ["00:00:00", "23:59:59"],
  338. format: "yyyy-MM-dd",
  339. valueFormat: "yyyy-MM-dd HH:mm:ss"
  340. }, {
  341. label: "更新人",
  342. prop: "updateUserName",
  343. searchProp: "updateUser",
  344. overHidden: true,
  345. width: 100,
  346. filterable: true,
  347. remote: true,
  348. type: "select",
  349. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  350. props: {
  351. label: "account",
  352. value: "id",
  353. res: 'data.records'
  354. }
  355. }, {
  356. label: "更新日期",
  357. prop: "updateTime",
  358. searchProp: "updateTimeList",
  359. type: "date",
  360. overHidden: true,
  361. width: 100,
  362. searchRange: true,
  363. searchDefaultTime: ["00:00:00", "23:59:59"],
  364. format: "yyyy-MM-dd",
  365. valueFormat: "yyyy-MM-dd HH:mm:ss"
  366. }]
  367. }
  368. }
  369. },
  370. async created() {
  371. // 状态字段获取
  372. this.getWorkDicts("outbound_work_order_status").then(res => {
  373. this.statusNameData = res.data.data
  374. });
  375. this.option = await this.getColumnData(this.getColumnName(270), this.optionList);
  376. this.key++
  377. let i = 0;
  378. this.option.column.forEach(item => {
  379. if (item.search) i++
  380. })
  381. if (i % 3 !== 0) {
  382. const num = 3 - Number(i % 3)
  383. this.option.searchMenuSpan = num * 8;
  384. this.option.searchMenuPosition = "right";
  385. }
  386. if (this.$route.query.id) {
  387. this.detailData = {
  388. id: this.$route.query.id
  389. };
  390. this.detailsOpen = true;
  391. }
  392. console.log(this.$route.query);
  393. },
  394. activated() {
  395. if (this.$route.query.id) {
  396. this.detailData = {
  397. id: this.$route.query.id
  398. };
  399. this.detailsOpen = true;
  400. }
  401. },
  402. methods: {
  403. check(row) {
  404. this.form = row
  405. this.detailsOpen = true
  406. },
  407. backToList(type) {
  408. this.form = {}
  409. this.detailsOpen = false
  410. if (type === 0) {
  411. this.detailData = {}
  412. }
  413. this.onLoad(this.page, this.search)
  414. },
  415. //刷新
  416. refreshChange() {
  417. this.onLoad(this.page, this.search)
  418. },
  419. rowDel(form, index) {
  420. console.log(form);
  421. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  422. confirmButtonText: '确定',
  423. cancelButtonText: '取消',
  424. type: 'warning'
  425. }).then(() => {
  426. remove(form.id).then(res => {
  427. this.$message({
  428. type: 'success',
  429. message: '删除成功!'
  430. });
  431. this.dataList.splice(index, 1);
  432. this.onLoad(this.page)
  433. })
  434. }).catch(() => {
  435. });
  436. },
  437. searchChange(params, done) {
  438. this.page.currentPage = 1
  439. done();
  440. this.onLoad(this.page, params)
  441. },
  442. onLoad(page, params = {}) {
  443. console.log(params);
  444. var obj2 = this.deepClone(this.search)
  445. params = {
  446. ...params,
  447. current: page.currentPage,
  448. size: page.pageSize,
  449. bizTypeName: "FHGD",
  450. ...Object.assign(params, this.search)
  451. }
  452. this.loading = true
  453. this.dataList.forEach(item => {
  454. this.$refs.crud.toggleRowExpansion(item, false);
  455. });
  456. getList(params).then(res => {
  457. if (res.data.data.records) {
  458. res.data.data.records.forEach(e => {
  459. e.itemLoading = true;
  460. });
  461. }
  462. this.dataList = res.data.data.records
  463. this.page.total = res.data.data.total
  464. this.$nextTick(() => {
  465. this.$refs.crud.doLayout()
  466. })
  467. this.loading = false
  468. }).finally(() => {
  469. // if(this.search.statusName==''){
  470. // this.search.statusName='待出库'
  471. // }
  472. this.search=obj2
  473. console.log(this.search)
  474. this.loading = false
  475. })
  476. },
  477. editOpen(row, status) {
  478. this.form = row
  479. this.detailData = {
  480. id: row.id,
  481. status: status
  482. };
  483. this.detailsOpen = true;
  484. },
  485. expandChange(row) {
  486. if (!row.itemData) {
  487. getDetails({ id: row.id })
  488. .then(res => {
  489. this.dataList[row.$index].itemData = res.data.data.shipItemsList;
  490. })
  491. .finally(() => {
  492. this.dataList[row.$index].itemLoading = false;
  493. });
  494. }
  495. },
  496. // 发货按钮
  497. deliverGoods(row) {
  498. // 获取运输类型
  499. getWorkDicts("deliveryMethod").then(res => {
  500. this.courierTypeList = res.data.data;
  501. })
  502. // 获取快递公司
  503. getWorkDicts("tyre_express_company").then(res => {
  504. this.courierList = res.data.data;
  505. })
  506. this.dialogForm = row
  507. this.dialogVisible = true
  508. },
  509. courierTypeChange() {
  510. this.dialogForm.courierCorporation = null
  511. },
  512. // 发货
  513. confirmShipment() {
  514. for (let courierCompanies of this.courierList) {
  515. if (courierCompanies.dictValue === this.dialogForm.logisticsCorpName) {
  516. this.dialogForm.logisticsCorpId = courierCompanies.dictKey
  517. break
  518. }
  519. }
  520. const requestBody = {
  521. id : this.dialogForm.id,
  522. logisticsCorpId : this.dialogForm.logisticsCorpId,
  523. logisticsCorpName : this.dialogForm.logisticsCorpName,
  524. shipType : this.dialogForm.shipType,
  525. expressNo : this.dialogForm.expressNo
  526. }
  527. shipments(requestBody).then(res => {
  528. console.log(res)
  529. this.$message.success("发货成功");
  530. this.dialogVisible = false;
  531. })
  532. },
  533. //自定义列保存
  534. async saveColumnTwo(ref, option, optionBack, code) {
  535. /**
  536. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  537. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  538. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  539. */
  540. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  541. if (inSave) {
  542. this.$message.success("保存成功");
  543. //关闭窗口
  544. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  545. }
  546. },
  547. //自定义列重置
  548. async resetColumnTwo(ref, option, optionBack, code) {
  549. this[option] = this[optionBack];
  550. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  551. if (inSave) {
  552. this.$message.success("重置成功");
  553. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  554. }
  555. }
  556. }
  557. }
  558. </script>
  559. <style scoped>
  560. .bottomBox {
  561. padding: 3px 6px;
  562. border-radius: 12px;
  563. color: #fff;
  564. font-size: 10px;
  565. }
  566. </style>