index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  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', 356)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 356)" :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="GYS" :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/purchaseService/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: 'goodsName',
  138. disabled: true,
  139. width: 200,
  140. overHidden: true,
  141. props: {
  142. label: 'cname',
  143. value: 'cname'
  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: 'brandName',
  154. disabled: true,
  155. width: 100,
  156. overHidden: true,
  157. props: {
  158. label: 'cname',
  159. value: 'cname'
  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: "customerName",
  242. search: true,
  243. overHidden: true,
  244. type: 'select',
  245. filterable:true,
  246. remote:true,
  247. props: {
  248. label: 'cname',
  249. value: 'cname',
  250. res: 'data.records'
  251. },
  252. dicUrl: '/api/blade-sales-part/corpsDesc/list?current=1&size=20&corpType=GYS&cname={{key}}',
  253. }, {
  254. label: '仓库',
  255. prop: "storageName",
  256. search: true,
  257. overHidden: true,
  258. type: 'select',
  259. props: {
  260. label: 'cname',
  261. value: 'cname'
  262. },
  263. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  264. }
  265. // , {
  266. // label: '商品种类',
  267. // prop: "numberRows",
  268. // overHidden: true,
  269. // }
  270. , {
  271. label: "退货数量",
  272. prop: "sendTotalNum",
  273. search: false,
  274. overHidden: true,
  275. // width: 120,
  276. },
  277. // {
  278. // label: "实际数量",
  279. // prop: "sendTotalNum",
  280. // search: false,
  281. // overHidden: true,
  282. // // width: 120,
  283. // },
  284. {
  285. label: '状态',
  286. prop: "statusName",
  287. search: true,
  288. overHidden: true,
  289. type: 'select',
  290. dicUrl: "/api/blade-system/dict-biz/dictionary?code=outbound_work_order_status",
  291. props: {
  292. label: "dictValue",
  293. value: "dictKey"
  294. }
  295. }, {
  296. label: '业务日期',
  297. prop: "businesDate",
  298. overHidden: true,
  299. searchProp: "businesDateList",
  300. type: "date",
  301. search: true,
  302. width: 100,
  303. searchRange: true,
  304. searchDefaultTime: ["00:00:00", "23:59:59"],
  305. format: "yyyy-MM-dd",
  306. valueFormat: "yyyy-MM-dd HH:mm:ss"
  307. }, {
  308. label: '库管',
  309. prop: "stockClerkName",
  310. type: 'select',
  311. search: true,
  312. props: {
  313. label: 'realName',
  314. value: 'realName'
  315. },
  316. dicUrl: '/api/blade-user/stockClerkList',
  317. overHidden: true,
  318. }, {
  319. label: "制单人",
  320. prop: "createUserName",
  321. searchProp: "createUser",
  322. overHidden: true,
  323. width: 100,
  324. filterable: true,
  325. remote: true,
  326. type: "select",
  327. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  328. props: {
  329. label: "account",
  330. value: "account",
  331. res: 'data.records'
  332. }
  333. }, {
  334. label: "制单日期",
  335. prop: "createTime",
  336. searchProp: "createTimeList",
  337. type: "date",
  338. overHidden: true,
  339. width: 100,
  340. searchRange: true,
  341. searchDefaultTime: ["00:00:00", "23:59:59"],
  342. format: "yyyy-MM-dd",
  343. valueFormat: "yyyy-MM-dd HH:mm:ss"
  344. }, {
  345. label: "更新人",
  346. prop: "updateUserName",
  347. searchProp: "updateUser",
  348. overHidden: true,
  349. width: 100,
  350. filterable: true,
  351. remote: true,
  352. type: "select",
  353. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  354. props: {
  355. label: "account",
  356. value: "account",
  357. res: 'data.records'
  358. }
  359. }, {
  360. label: "更新日期",
  361. prop: "updateTime",
  362. searchProp: "updateTimeList",
  363. type: "date",
  364. overHidden: true,
  365. width: 100,
  366. searchRange: true,
  367. searchDefaultTime: ["00:00:00", "23:59:59"],
  368. format: "yyyy-MM-dd",
  369. valueFormat: "yyyy-MM-dd HH:mm:ss"
  370. }]
  371. }
  372. }
  373. },
  374. async created() {
  375. // 状态字段获取
  376. this.getWorkDicts("outbound_work_order_status").then(res => {
  377. this.statusNameData = res.data.data
  378. });
  379. this.option = await this.getColumnData(this.getColumnName(356), this.optionList);
  380. this.key++
  381. let i = 0;
  382. this.option.column.forEach(item => {
  383. if (item.search) i++
  384. })
  385. if (i % 3 !== 0) {
  386. const num = 3 - Number(i % 3)
  387. this.option.searchMenuSpan = num * 8;
  388. this.option.searchMenuPosition = "right";
  389. }
  390. if (this.$route.query.id) {
  391. this.detailData = {
  392. id: this.$route.query.id
  393. };
  394. this.detailsOpen = true;
  395. }
  396. console.log(this.$route.query);
  397. },
  398. activated() {
  399. if (this.$route.query.id) {
  400. this.detailData = {
  401. id: this.$route.query.id
  402. };
  403. this.detailsOpen = true;
  404. }
  405. },
  406. methods: {
  407. check(row) {
  408. this.form = row
  409. this.detailsOpen = true
  410. },
  411. backToList(type) {
  412. this.form = {}
  413. this.detailsOpen = false
  414. if (type === 0) {
  415. this.detailData = {}
  416. }
  417. this.onLoad(this.page, this.search)
  418. },
  419. //刷新
  420. refreshChange() {
  421. this.onLoad(this.page, this.search)
  422. },
  423. rowDel(form, index) {
  424. console.log(form);
  425. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  426. confirmButtonText: '确定',
  427. cancelButtonText: '取消',
  428. type: 'warning'
  429. }).then(() => {
  430. remove(form.id).then(res => {
  431. this.$message({
  432. type: 'success',
  433. message: '删除成功!'
  434. });
  435. this.dataList.splice(index, 1);
  436. this.onLoad(this.page)
  437. })
  438. }).catch(() => {
  439. });
  440. },
  441. searchChange(params, done) {
  442. this.page.currentPage = 1
  443. done();
  444. this.onLoad(this.page, params)
  445. },
  446. onLoad(page, params = {}) {
  447. console.log(params);
  448. var obj2 = this.deepClone(this.search)
  449. params = {
  450. ...params,
  451. current: page.currentPage,
  452. size: page.pageSize,
  453. bizTypeName: "TKFHGD",
  454. ...Object.assign(params, this.search)
  455. }
  456. this.loading = true
  457. this.dataList.forEach(item => {
  458. this.$refs.crud.toggleRowExpansion(item, false);
  459. });
  460. getList(params).then(res => {
  461. if (res.data.data.records) {
  462. res.data.data.records.forEach(e => {
  463. e.itemLoading = true;
  464. });
  465. }
  466. this.dataList = res.data.data.records
  467. this.page.total = res.data.data.total
  468. this.$nextTick(() => {
  469. this.$refs.crud.doLayout()
  470. this.$refs.crud.dicInit()
  471. })
  472. this.loading = false
  473. }).finally(() => {
  474. this.loading = false
  475. this.search=obj2
  476. })
  477. },
  478. editOpen(row, status) {
  479. this.form = row
  480. this.detailData = {
  481. id: row.id,
  482. status: status
  483. };
  484. this.detailsOpen = true;
  485. },
  486. expandChange(row) {
  487. if (!row.itemData) {
  488. getDetails({ id: row.id })
  489. .then(res => {
  490. this.dataList[row.$index].itemData = res.data.data.shipItemsList;
  491. })
  492. .finally(() => {
  493. this.dataList[row.$index].itemLoading = false;
  494. });
  495. }
  496. },
  497. // 发货按钮
  498. deliverGoods(row) {
  499. // 获取运输类型
  500. getWorkDicts("deliveryMethod").then(res => {
  501. this.courierTypeList = res.data.data;
  502. })
  503. // 获取快递公司
  504. getWorkDicts("tyre_express_company").then(res => {
  505. this.courierList = res.data.data;
  506. })
  507. this.dialogForm = row
  508. this.dialogVisible = true
  509. },
  510. courierTypeChange() {
  511. this.dialogForm.courierCorporation = null
  512. },
  513. // 发货
  514. confirmShipment() {
  515. for (let courierCompanies of this.courierList) {
  516. if (courierCompanies.dictValue === this.dialogForm.logisticsCorpName) {
  517. this.dialogForm.logisticsCorpId = courierCompanies.dictKey
  518. break
  519. }
  520. }
  521. const requestBody = {
  522. id : this.dialogForm.id,
  523. logisticsCorpId : this.dialogForm.logisticsCorpId,
  524. logisticsCorpName : this.dialogForm.logisticsCorpName,
  525. shipType : this.dialogForm.shipType,
  526. expressNo : this.dialogForm.expressNo
  527. }
  528. shipments(requestBody).then(res => {
  529. console.log(res)
  530. this.$message.success("发货成功");
  531. this.dialogVisible = false;
  532. })
  533. },
  534. //自定义列保存
  535. async saveColumnTwo(ref, option, optionBack, code) {
  536. /**
  537. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  538. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  539. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  540. */
  541. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  542. if (inSave) {
  543. this.$message.success("保存成功");
  544. //关闭窗口
  545. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  546. }
  547. },
  548. //自定义列重置
  549. async resetColumnTwo(ref, option, optionBack, code) {
  550. this[option] = this[optionBack];
  551. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  552. if (inSave) {
  553. this.$message.success("重置成功");
  554. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  555. }
  556. }
  557. }
  558. }
  559. </script>
  560. <style scoped>
  561. .bottomBox {
  562. padding: 3px 6px;
  563. border-radius: 12px;
  564. color: #fff;
  565. font-size: 10px;
  566. }
  567. </style>