detailsPage.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList(0)">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <!-- <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
  11. <!-- @click="confirmEditing">编辑-->
  12. <!-- </el-button>-->
  13. <el-button
  14. class="el-button--small-yh"
  15. type="primary"
  16. size="small"
  17. @click="editCustomer">保存数据
  18. </el-button>
  19. <el-button
  20. class="el-button--small-yh"
  21. type="success"
  22. size="small"
  23. v-if="form.statusName == '待入库'"
  24. @click="complete">入库完成
  25. </el-button>
  26. </div>
  27. </div>
  28. <div style="margin-top: 50px">
  29. <trade-card title="基础信息">
  30. <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
  31. </trade-card>
  32. <trade-card title="明细信息">
  33. <el-tabs v-model="activeName" type="card">
  34. <el-tab-pane label="出库明细" name="sale_detail">
  35. <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts" :data="form.shipItemsList"
  36. :key="key"
  37. @row-save="rowSave"
  38. @row-update="rowUpdate"
  39. @resetColumn="resetColumnTwo('formContacts','optionContacts','optionContactsBack',274.1)"
  40. @saveColumn="saveColumnTwo('formContacts','optionContacts','optionContactsBack',274.1)">
  41. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  42. <el-button
  43. :size="size" :disabled="disabled" :type="type"
  44. :icon="row.$cellEdit?'el-icon-plus':'el-icon-edit'"
  45. @click="$refs.formContacts.rowEdit(row,index)"
  46. >编辑
  47. </el-button>
  48. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  49. @click="rowDelBox(row,index)">删除
  50. </el-button>
  51. </template>
  52. </avue-crud>
  53. </el-tab-pane>
  54. <el-tab-pane label="订单信息" name="payment_details">
  55. <avue-crud :option="optionPaymentDetails" v-model="formContacts" ref="payment_details"
  56. :data="form.shipVOList"
  57. :key="key"
  58. @resetColumn="resetColumnTwo('payment_details','optionPaymentDetails','optionPaymentDetailsBack',274.2)"
  59. @saveColumn="saveColumnTwo('payment_details','optionPaymentDetails','optionPaymentDetailsBack',274.2)">
  60. </avue-crud>
  61. </el-tab-pane>
  62. <el-tab-pane label="历史记录" name="outbound_records">
  63. <avue-crud :option="optionOutboundRecords" v-model="formContacts" ref="outbound_records"
  64. :data="form.historyList"
  65. :key="key"
  66. @resetColumn="resetColumnTwo('outbound_records','optionOutboundRecords','optionOutboundRecordsBack',274.3)"
  67. @saveColumn="saveColumnTwo('outbound_records','optionOutboundRecords','optionOutboundRecordsBack',274.3)">
  68. </avue-crud>
  69. </el-tab-pane>
  70. </el-tabs>
  71. </trade-card>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. import {getDetails, tradingBox, submit, warehousingComplete} from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  77. import {dateFormat} from "@/util/date";
  78. export default {
  79. name: "detailsPage",
  80. data() {
  81. return {
  82. activeName: "sale_detail",
  83. disabled: false,
  84. form: {
  85. shipItemsList: [],
  86. shipVOList: [],
  87. historyList: []
  88. },
  89. key: 0,
  90. optionForm: {
  91. disabled: false,
  92. menuBtn: false,
  93. labelWidth: 100,
  94. columnBtn: false,
  95. span: 8,
  96. column: [
  97. {
  98. label: "入库单号",
  99. prop: "ordNo",
  100. rules: [
  101. {
  102. required: true,
  103. message: " ",
  104. trigger: "blur"
  105. }
  106. ],
  107. },
  108. {
  109. label: "来源单号",
  110. prop: "srcOrdNo"
  111. }, {
  112. label: "业务对象",
  113. prop: "customerId",
  114. type: 'select',
  115. props: {
  116. label: 'cname',
  117. value: 'id'
  118. },
  119. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=GYS',
  120. rules: [
  121. {
  122. required: true,
  123. message: " ",
  124. trigger: "blur"
  125. }
  126. ]
  127. }, {
  128. label: "仓库",
  129. prop: "storageId",
  130. search: true,
  131. overHidden: true,
  132. type: 'select',
  133. dicUrl: "/api/blade-sales-part/storageDesc/listAll",
  134. props: {
  135. label: 'cname',
  136. value: 'id'
  137. },
  138. rules: [
  139. {
  140. required: true,
  141. message: " ",
  142. trigger: "blur"
  143. }
  144. ]
  145. }, {
  146. label: "商品数量",
  147. prop: "goodsTotalNum",
  148. search: false,
  149. overHidden: true,
  150. // width: 120,
  151. rules: [
  152. {
  153. required: true,
  154. message: " ",
  155. trigger: "blur"
  156. }
  157. ]
  158. }, {
  159. label: "业务日期",
  160. prop: "createTime",
  161. type: "datetime",
  162. value: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
  163. format: "yyyy-MM-dd HH:mm",
  164. valueFormat: "yyyy-MM-dd HH:mm:ss",
  165. rules: [
  166. {
  167. required: true,
  168. message: "",
  169. trigger: "blur"
  170. }
  171. ]
  172. }, {
  173. label: '库管',
  174. prop: "stockClerkId",
  175. type: 'select',
  176. props: {
  177. label: 'realName',
  178. value: 'id'
  179. },
  180. dicUrl: '/api/blade-user/stockClerkList',
  181. rules: [{
  182. required: true,
  183. message: " ",
  184. trigger: "blur"
  185. }]
  186. }, {
  187. label: '备注',
  188. prop: "remarks",
  189. type: 'textarea',
  190. span: 16,
  191. minRows: 1
  192. }
  193. ]
  194. },
  195. formContacts: {},
  196. optionContacts: {},
  197. optionContactsBack: {
  198. align: "center",
  199. addBtn: true,
  200. addBtnText: "录入明细",
  201. refreshBtn: false,
  202. editBtn: false,
  203. delBtn: false,
  204. border: true,
  205. menuWidth: 120,
  206. stripe: true,
  207. index: true,
  208. menu: true,
  209. dialogTop: 25,
  210. dialogWidth: "80%",
  211. column: [{
  212. label: '物料编码',
  213. prop: 'goodsNo',
  214. width: 100
  215. }, {
  216. label: '商品名称',
  217. prop: 'goodsId',
  218. width: 200,
  219. overHidden: true,
  220. filterable: true,
  221. type: 'select',
  222. props: {
  223. label: 'cname',
  224. value: 'id'
  225. },
  226. dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll'
  227. }, {
  228. label: "品牌",
  229. prop: 'brandId',
  230. width: 100,
  231. overHidden: true,
  232. type: 'select',
  233. props: {
  234. label: 'cname',
  235. value: 'id'
  236. },
  237. dicUrl: '/api/blade-sales-part/brandDesc/listAll'
  238. }, {
  239. label: "规格型号",
  240. prop: "propertyName",
  241. overHidden: true,
  242. rules: [{
  243. required: true,
  244. message: " ",
  245. trigger: "blur"
  246. }]
  247. }, {
  248. label: "花纹",
  249. prop: "pattern",
  250. overHidden: true
  251. }, {
  252. label: "商品描述",
  253. prop: "goodsDescription",
  254. overHidden: true
  255. }, {
  256. label: "批次号",
  257. prop: "dot",
  258. overHidden: true
  259. }, {
  260. label: "单位",
  261. prop: 'units',
  262. type: "select",
  263. props: {
  264. label: "dictValue",
  265. value: "dictValue"
  266. },
  267. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit"
  268. }, {
  269. label: "单价",
  270. prop: "price",
  271. ovrHidden: true,
  272. rules: [{
  273. required: true,
  274. message: " ",
  275. trigger: "blur"
  276. }]
  277. }, {
  278. label: "入库数量",
  279. prop: "goodsNum",
  280. ovrHidden: true
  281. }, {
  282. label: "实际数量",
  283. prop: "sendNum",
  284. overHidden: true,
  285. }, {
  286. label: "备注",
  287. prop: "remarks",
  288. overHidde: true
  289. }]
  290. },
  291. optionPaymentDetails: {},
  292. optionPaymentDetailsBack: {
  293. align: "center",
  294. addBtn: false,
  295. refreshBtn: false,
  296. editBtn: false,
  297. delBtn: false,
  298. border: true,
  299. menuWidth: 120,
  300. stripe: true,
  301. index: true,
  302. menu: false,
  303. column: [
  304. {
  305. label: "入库单号",
  306. prop: "billno",
  307. disabled: true
  308. },
  309. {
  310. label: "来源单号",
  311. prop: "ordNo",
  312. disabled: true
  313. },
  314. {
  315. label: "业务来源",
  316. prop: "stockTime",
  317. type: "date",
  318. searchRange: true,
  319. searchDefaultTime: [
  320. "00:00:00",
  321. "23:59:59"
  322. ],
  323. format: "yyyy-MM-dd",
  324. valueFormat: "yyyy-MM-dd HH:mm:ss",
  325. overHidden: true
  326. },
  327. {
  328. prop: "itemId",
  329. label: "地址",
  330. type: "select",
  331. props: {
  332. label: "cname",
  333. value: "id"
  334. },
  335. dicData: [],
  336. overHidden: true,
  337. filterable: true,
  338. rules: [
  339. {
  340. required: true,
  341. message: "请选择",
  342. trigger: "blur"
  343. }
  344. ]
  345. },
  346. {
  347. prop: "length",
  348. label: "联系人",
  349. overHidden: true
  350. },
  351. {
  352. prop: "thickness",
  353. label: "电话",
  354. overHidden: true
  355. },
  356. {
  357. prop: "remarks",
  358. label: "备注",
  359. overHidden: true,
  360. cell: true
  361. }
  362. ]
  363. },
  364. optionOutboundRecords: {},
  365. optionOutboundRecordsBack: {
  366. align: "center",
  367. addBtn: false,
  368. refreshBtn: false,
  369. editBtn: false,
  370. delBtn: false,
  371. border: true,
  372. menuWidth: 120,
  373. index: true,
  374. stripe: true,
  375. menu: false,
  376. column: [{
  377. prop: "operatorName",
  378. label: "操作人",
  379. overHidden: true,
  380. showColumn: false,
  381. width: 120,
  382. }, {
  383. prop: "operateStatus",
  384. label: "状态",
  385. overHidden: true,
  386. }, {
  387. prop: "operateTime",
  388. label: "时间",
  389. overHidden: true,
  390. searchDefaultTime: ["00:00:00", "23:59:59"],
  391. format: "yyyy-MM-dd",
  392. valueFormat: "yyyy-MM-dd HH:mm:ss",
  393. }]
  394. }
  395. }
  396. },
  397. props: {
  398. onLoad: Object,
  399. detailData: Object
  400. },
  401. async created() {
  402. this.optionContacts = await this.getColumnData(this.getColumnName(274.1), this.optionContactsBack);
  403. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(274.2), this.optionPaymentDetailsBack);
  404. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(274.3), this.optionOutboundRecordsBack);
  405. this.key++
  406. if (this.onLoad.id && this.detailData.id) {
  407. this.refresh(this.onLoad.id, true)
  408. } else if (this.onLoad.id) {
  409. this.refresh(this.onLoad.id, true)
  410. }
  411. },
  412. methods: {
  413. complete() {
  414. this.$refs["form"].validate((valid, done) => {
  415. done();
  416. if (valid) {
  417. const loading = this.$loading({
  418. lock: true,
  419. text: '加载中',
  420. spinner: 'el-icon-loading',
  421. background: 'rgba(255,255,255,0.7)'
  422. });
  423. warehousingComplete({
  424. ...this.form,
  425. bizTypeName: "SHGD"
  426. }).then(res => {
  427. this.$message.success("保存成功");
  428. this.refresh(res.data.data.id)
  429. loading.close();
  430. }).finally(() => {
  431. loading.close();
  432. });
  433. }
  434. })
  435. },
  436. //修改提交触发
  437. editCustomer() {
  438. if (this.form.shipItemsList.length == 0){
  439. return this.$message.warning('请明细不能为空')
  440. }
  441. this.$refs["form"].validate((valid, done) => {
  442. done();
  443. if (valid) {
  444. const loading = this.$loading({
  445. lock: true,
  446. text: '加载中',
  447. spinner: 'el-icon-loading',
  448. background: 'rgba(255,255,255,0.7)'
  449. });
  450. submit({
  451. ...this.form,
  452. bizTypeName: "SHGD"
  453. }).then(res => {
  454. this.$message.success("保存成功");
  455. this.refresh(res.data.data.id);
  456. loading.close();
  457. }).finally(() => {
  458. loading.close();
  459. });
  460. } else {
  461. return false;
  462. }
  463. });
  464. },
  465. refresh(id, type) {
  466. const loading = this.$loading({
  467. lock: true,
  468. text: '加载中',
  469. spinner: 'el-icon-loading',
  470. background: 'rgba(255,255,255,0.7)'
  471. })
  472. getDetails({id: id}).then(res => {
  473. this.form = res.data.data
  474. loading.close();
  475. }).catch(() => {
  476. loading.close();
  477. })
  478. },
  479. rowDelBox(row, index) {
  480. this.$confirm("确定将选择数据删除?", {
  481. confirmButtonText: "确定",
  482. cancelButtonText: "取消",
  483. type: "warning"
  484. }).then(() => {
  485. if (row.id) {
  486. tradingBox(row.id).then(res => {
  487. this.form.shipItemsList.splice(index, 1);
  488. this.$message.success("操作成功!");
  489. });
  490. } else {
  491. this.form.shipItemsList.splice(index, 1);
  492. this.$message.success("操作成功!");
  493. }
  494. }
  495. )
  496. ;
  497. },
  498. rowSave(form, done, loading) {
  499. console.log(form)
  500. done(form)
  501. },
  502. rowUpdate(form, index, done, loading) {
  503. console.log(form)
  504. done(form);
  505. },
  506. //自定义列保存
  507. async saveColumnTwo(ref, option, optionBack, code) {
  508. /**
  509. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  510. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  511. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  512. */
  513. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  514. if (inSave) {
  515. this.$message.success("保存成功");
  516. //关闭窗口b
  517. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  518. }
  519. },
  520. //自定义列重置
  521. async resetColumnTwo(ref, option, optionBack, code) {
  522. this[option] = this[optionBack];
  523. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  524. if (inSave) {
  525. this.$message.success("重置成功");
  526. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  527. }
  528. },
  529. backToList(type) {
  530. this.$emit("backToList", type);
  531. }
  532. }
  533. }
  534. </script>
  535. <style lang="scss" scoped>
  536. ::v-deep .el-form-item {
  537. margin-bottom: 8px !important;
  538. }
  539. </style>