index.vue 17 KB

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