detailsPage.vue 16 KB

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