detailsPage.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  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="form.id"
  11. @click="confirmEditing">编辑
  12. </el-button>
  13. <el-button class="el-button--small-yh" type="primary" size="small" v-if="form.statusName != '已入库'"
  14. @click="editCustomer">保存数据
  15. </el-button>
  16. <el-button class="el-button--small-yh" type="success" size="small"
  17. v-if="form.statusName == '待入库' || form.statusName == '已撤销'" @click="complete">入库完成
  18. </el-button>
  19. <el-button class="el-button--small-yh" type="success" size="small" v-if="form.statusName == '已入库'"
  20. @click="revoke">撤销入库
  21. </el-button>
  22. </div>
  23. </div>
  24. <div style="margin-top: 50px">
  25. <trade-card title="基础信息">
  26. <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
  27. </trade-card>
  28. <trade-card title="明细信息">
  29. <el-tabs v-model="activeName" type="card">
  30. <el-tab-pane label="入库明细" name="sale_detail">
  31. <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts"
  32. :data="form.shipItemsList" :key="key" @row-save="rowSave" @row-update="rowUpdate"
  33. @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 274.1)"
  34. @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 274.1)">
  35. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  36. <el-button :size="size" :disabled="disabled" :type="type"
  37. :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
  38. @click="rowEdit(row, index)">编辑
  39. </el-button>
  40. <el-button icon="el-icon-delete" :size="size" :disabled="disabled || form.statusName == '已入库'" :type="type"
  41. @click="rowDelBox(row, index)">删除
  42. </el-button>
  43. </template>
  44. <template slot-scope="{scope,row}" slot="menuLeft">
  45. <el-button type="primary" icon="el-icon-plus" size="small"
  46. @click="rowAdd(row,score)" :disabled="isrowAdd">添加轮胎</el-button>
  47. <el-button type="success" size="small" icon="el-icon-bottom" @click="excelBox = true">导入
  48. </el-button>
  49. <el-button type="primary" icon="el-icon-printer" size="small"
  50. @click="handlePrint">打印</el-button>
  51. </template>
  52. </avue-crud>
  53. </el-tab-pane>
  54. <el-tab-pane label="采购信息" name="payment_details">
  55. <avue-crud :option="optionPaymentDetails" ref="payment_details" :data="form.shipVOList" :key="key"
  56. @resetColumn="resetColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 274.2)"
  57. @saveColumn="saveColumnTwo('payment_details', 'optionPaymentDetails', 'optionPaymentDetailsBack', 274.2)">
  58. </avue-crud>
  59. </el-tab-pane>
  60. <el-tab-pane label="历史记录" name="outbound_records">
  61. <avue-crud :option="optionOutboundRecords" ref="outbound_records" :data="form.historyList"
  62. :key="key"
  63. @resetColumn="resetColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 274.3)"
  64. @saveColumn="saveColumnTwo('outbound_records', 'optionOutboundRecords', 'optionOutboundRecordsBack', 274.3)">
  65. </avue-crud>
  66. </el-tab-pane>
  67. </el-tabs>
  68. </trade-card>
  69. <report-dialog :switchDialog="switchDialog" :reportId="form.id" @onClose="onClose()"></report-dialog>
  70. </div>
  71. <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px"
  72. :close-on-click-modal="false" v-dialog-drag>
  73. <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore"
  74. :upload-after="uploadAfter">
  75. <template slot="excelTemplate">
  76. <el-button type="primary" @click="derivation">
  77. 点击下载<i class="el-icon-download el-icon--right"></i>
  78. </el-button>
  79. </template>
  80. </avue-form>
  81. <p style="text-align: center;color: #DC0505">
  82. 温馨提示 第一次导入时请先下载模板
  83. </p>
  84. </el-dialog>
  85. </div>
  86. </template>
  87. <script>
  88. import {
  89. getDetails,
  90. tradingBox,
  91. submit,
  92. warehousingComplete,
  93. revoke,
  94. goodsDetail,
  95. dotList,
  96. getWarehouseKeeper
  97. } from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  98. import { dateFormat } from "@/util/date";
  99. import { getToken } from "@/util/auth";
  100. import { getMenu } from "@/api/system/menu";
  101. import reportDialog from "@/components/report-dialog/main";
  102. export default {
  103. name: "detailsPage",
  104. data() {
  105. return {
  106. switchDialog: false,
  107. activeName: "sale_detail",
  108. disabled: false,
  109. isrowAdd:true,
  110. excelBox: false,
  111. excelOption: {
  112. submitBtn: false,
  113. emptyBtn: false,
  114. column: [
  115. {
  116. label: "模板下载",
  117. prop: "excelTemplate",
  118. formslot: true,
  119. span: 24
  120. },
  121. {
  122. label: "导入明细",
  123. prop: "excelFile",
  124. type: "upload",
  125. drag: true,
  126. loadText: "上传中,请稍等",
  127. accept: '.xls,.xlsx',
  128. span: 24,
  129. propsHttp: {
  130. res: "data"
  131. },
  132. tip: "请上传 .xls,.xlsx 标准格式文件",
  133. action: "/api/blade-sales-part/ship/import-item"
  134. }
  135. ]
  136. },
  137. excelForm: {},
  138. form: {
  139. shipItemsList: [],
  140. shipVOList: [],
  141. historyList: []
  142. },
  143. key: 0,
  144. optionForm: {
  145. disabled: false,
  146. menuBtn: false,
  147. labelWidth: 100,
  148. columnBtn: false,
  149. span: 8,
  150. column: [
  151. {
  152. label: "业务对象",
  153. prop: "customerId",
  154. disabled:false,
  155. type: 'select',
  156. props: {
  157. label: 'cname',
  158. value: 'id'
  159. },
  160. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=GYS',
  161. rules: [
  162. {
  163. required: true,
  164. message: " ",
  165. trigger: "blur"
  166. }
  167. ]
  168. },
  169. {
  170. label: "仓库",
  171. prop: "storageId",
  172. search: true,
  173. overHidden: true,
  174. type: 'select',
  175. dicUrl: "/api/blade-sales-part/storageDesc/listAll",
  176. disabled:false,
  177. props: {
  178. label: 'cname',
  179. value: 'id'
  180. },
  181. rules: [
  182. {
  183. required: true,
  184. message: " ",
  185. trigger: "blur"
  186. }
  187. ],
  188. // change:(data)=>{
  189. // // console.log(this.$refs);
  190. // getWarehouseKeeper({salesCompanyId:this.form.storageId}).then((res)=>{
  191. // console.log(res.data.data);
  192. // this.form.stockClerkId = res.data.data[0].id
  193. // })
  194. // }
  195. },
  196. {
  197. label: '库管',
  198. prop: "stockClerkId",
  199. type: 'select',
  200. disabled:false,
  201. props: {
  202. label: 'realName',
  203. value: 'id'
  204. },
  205. dicUrl: '/api/blade-user/stockClerkList',
  206. rules: [{
  207. required: true,
  208. message: " ",
  209. trigger: "blur"
  210. }]
  211. },
  212. {
  213. label: "轮胎数量",
  214. prop: "goodsTotalNum",
  215. search: false,
  216. overHidden: true,
  217. disabled:false,
  218. // width: 120,
  219. // rules: [
  220. // {
  221. // required: true,
  222. // message: " ",
  223. // trigger: "blur"
  224. // }
  225. // ]
  226. },
  227. {
  228. label: "业务日期",
  229. prop: "createTime",
  230. disabled:false,
  231. type: "datetime",
  232. value: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
  233. format: "yyyy-MM-dd HH:mm",
  234. valueFormat: "yyyy-MM-dd HH:mm:ss",
  235. rules: [
  236. {
  237. required: true,
  238. message: "",
  239. trigger: "blur"
  240. }
  241. ]
  242. },
  243. {
  244. label: "入库单号",
  245. prop: "billno",
  246. disabled:false,
  247. },
  248. {
  249. label: "来源单号",
  250. prop: "ordNo",
  251. disabled:false,
  252. }, {
  253. label: '备注',
  254. disabled:false,
  255. prop: "remarks",
  256. type: 'textarea',
  257. span: 16,
  258. minRows: 1
  259. }
  260. ]
  261. },
  262. formContacts: {},
  263. optionContacts: {},
  264. optionContactsBack: {
  265. align: "center",
  266. addBtn: false,
  267. addBtnText: "录入明细",
  268. refreshBtn: false,
  269. editBtn: false,
  270. delBtn: false,
  271. border: true,
  272. menuWidth: 120,
  273. stripe: true,
  274. index: true,
  275. menu: true,
  276. dialogTop: 25,
  277. disabled:false,
  278. dialogWidth: "80%",
  279. column: [{
  280. label: '轮胎名称',
  281. prop: 'goodsId',
  282. width: 200,
  283. overHidden: true,
  284. disabled:false,
  285. filterable: true,
  286. type: 'select',
  287. props: {
  288. label: 'cname',
  289. value: 'id'
  290. },
  291. dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll'
  292. }, {
  293. label: '物料编码',
  294. prop: 'goodsNo',
  295. overHidden: true,
  296. disabled:false,
  297. width: 140
  298. }, {
  299. label: "品牌",
  300. prop: 'brandId',
  301. width: 100,
  302. overHidden: true,
  303. disabled:false,
  304. type: 'select',
  305. props: {
  306. label: 'cname',
  307. value: 'id'
  308. },
  309. dicUrl: '/api/blade-sales-part/brandDesc/listAll'
  310. }, {
  311. label: "规格型号",
  312. prop: "propertyName",
  313. overHidden: true,
  314. disabled:false,
  315. rules: [{
  316. required: true,
  317. message: " ",
  318. trigger: "blur"
  319. }]
  320. }, {
  321. label: "花纹",
  322. prop: "pattern",
  323. disabled:false,
  324. overHidden: true
  325. }, {
  326. label: "轮胎描述",
  327. prop: "goodsDescription",
  328. disabled:false,
  329. overHidden: true
  330. }, {
  331. label: "批次号",
  332. prop: "dot",
  333. type: "select",
  334. disabled: false,
  335. allowCreate: true,
  336. filterable: true,
  337. dicData: [],
  338. props: {
  339. label: "dot",
  340. value: "dot"
  341. },
  342. overHidden: true
  343. }, {
  344. label: "单位",
  345. prop: 'units',
  346. type: "select",
  347. disabled:false,
  348. props: {
  349. label: "dictValue",
  350. value: "dictValue"
  351. },
  352. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit"
  353. }, {
  354. label: "单价",
  355. prop: "price",
  356. disabled:false,
  357. ovrHidden: true,
  358. rules: [{
  359. required: true,
  360. message: " ",
  361. trigger: "blur"
  362. }]
  363. }, {
  364. label: "入库数量",
  365. prop: "goodsNum",
  366. disabled: true,
  367. ovrHidden: true,
  368. }, {
  369. label: "实际数量",
  370. prop: "sendNum",
  371. disabled:false,
  372. overHidden: true,
  373. rules: [{
  374. required: true,
  375. message: " ",
  376. trigger: "blur"
  377. }]
  378. }, {
  379. label: "备注",
  380. prop: "remarks",
  381. disabled:false,
  382. overHidde: true
  383. }]
  384. },
  385. optionPaymentDetails: {},
  386. optionPaymentDetailsBack: {
  387. align: "center",
  388. addBtn: false,
  389. refreshBtn: false,
  390. editBtn: false,
  391. delBtn: false,
  392. border: true,
  393. menuWidth: 120,
  394. stripe: true,
  395. index: true,
  396. menu: false,
  397. column: [
  398. {
  399. label: "入库单号",
  400. prop: "billno",
  401. disabled: true
  402. },
  403. {
  404. label: "来源单号",
  405. prop: "ordNo",
  406. disabled: true
  407. },
  408. {
  409. label: "业务来源",
  410. prop: "stockTime",
  411. type: "date",
  412. searchRange: true,
  413. searchDefaultTime: [
  414. "00:00:00",
  415. "23:59:59"
  416. ],
  417. format: "yyyy-MM-dd",
  418. valueFormat: "yyyy-MM-dd HH:mm:ss",
  419. overHidden: true
  420. },
  421. {
  422. prop: "itemId",
  423. label: "地址",
  424. type: "select",
  425. props: {
  426. label: "cname",
  427. value: "id"
  428. },
  429. dicData: [],
  430. overHidden: true,
  431. filterable: true,
  432. rules: [
  433. {
  434. required: true,
  435. message: "请选择",
  436. trigger: "blur"
  437. }
  438. ]
  439. },
  440. {
  441. prop: "length",
  442. label: "联系人",
  443. overHidden: true
  444. },
  445. {
  446. prop: "thickness",
  447. label: "电话",
  448. overHidden: true
  449. },
  450. {
  451. prop: "remarks",
  452. label: "备注",
  453. disabled:false,
  454. overHidden: true,
  455. cell: true
  456. }
  457. ]
  458. },
  459. optionOutboundRecords: {},
  460. optionOutboundRecordsBack: {
  461. align: "center",
  462. addBtn: false,
  463. refreshBtn: false,
  464. editBtn: false,
  465. delBtn: false,
  466. border: true,
  467. menuWidth: 120,
  468. index: true,
  469. stripe: true,
  470. menu: false,
  471. column: [{
  472. prop: "operatorName",
  473. label: "操作人",
  474. overHidden: true,
  475. showColumn: false,
  476. width: 120,
  477. }, {
  478. prop: "operateStatus",
  479. label: "状态",
  480. overHidden: true,
  481. }, {
  482. prop: "operateTime",
  483. label: "时间",
  484. overHidden: true,
  485. searchDefaultTime: ["00:00:00", "23:59:59"],
  486. format: "yyyy-MM-dd",
  487. valueFormat: "yyyy-MM-dd HH:mm:ss",
  488. }]
  489. }
  490. }
  491. },
  492. props: {
  493. onLoad: Object,
  494. detailData: Object
  495. },
  496. async created() {
  497. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  498. console.log(value);
  499. console.log('this.formContacts.goodsId',this.formContacts.goodsId);
  500. if (this.formContacts.goodsId !== value) {
  501. goodsDetail({ id: value }).then(res => {
  502. this.formContacts.goodsNo = res.data.data.code
  503. this.formContacts.brandId = res.data.data.brandId
  504. this.formContacts.brandName = res.data.data.brandName
  505. this.formContacts.propertyName = res.data.data.specificationAndModel
  506. this.formContacts.pattern = res.data.data.brandItem
  507. this.formContacts.goodsDescription = res.data.data.goodsDescription
  508. this.formContacts.units = res.data.data.unit
  509. this.findObject(this.optionContacts.column, "goodsNum").disabled = true
  510. if (res.data.data.whether == 0) {
  511. this.findObject(this.optionContacts.column, "dot").disabled = true
  512. } else {
  513. this.findObject(this.optionContacts.column, "dot").disabled = false
  514. dotList({
  515. storageId: this.form.storageId,
  516. goodsId: this.formContacts.goodsId
  517. }).then(res => {
  518. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  519. })
  520. }
  521. })
  522. }
  523. }
  524. this.optionContacts = await this.getColumnData(this.getColumnName(274.1), this.optionContactsBack);
  525. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  526. console.log(value);
  527. console.log('this.formContacts.goodsId',this.formContacts.goodsId);
  528. if (this.formContacts.goodsId !== value) {
  529. goodsDetail({ id: value }).then(res => {
  530. this.formContacts.goodsNo = res.data.data.code
  531. this.formContacts.brandId = res.data.data.brandId
  532. this.formContacts.brandName = res.data.data.brandName
  533. this.formContacts.propertyName = res.data.data.specificationAndModel
  534. this.formContacts.pattern = res.data.data.brandItem
  535. this.formContacts.goodsDescription = res.data.data.goodsDescription
  536. this.formContacts.units = res.data.data.unit
  537. this.findObject(this.optionContacts.column, "goodsNum").disabled = true
  538. if (res.data.data.whether == 0) {
  539. this.findObject(this.optionContacts.column, "dot").disabled = true
  540. } else {
  541. this.findObject(this.optionContacts.column, "dot").disabled = false
  542. dotList({
  543. storageId: this.form.storageId,
  544. goodsId: this.formContacts.goodsId
  545. }).then(res => {
  546. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  547. })
  548. }
  549. })
  550. }
  551. }
  552. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(274.2), this.optionPaymentDetailsBack);
  553. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(274.3), this.optionOutboundRecordsBack);
  554. this.key++
  555. if (this.onLoad.id && this.detailData.id) {
  556. this.refresh(this.onLoad.id, true)
  557. this.$set(this.optionForm,'disabled',true)
  558. this.$set(this.optionContactsBack,'disabled',true)
  559. } else if (this.onLoad.id) {
  560. console.log(2);
  561. this.refresh(this.onLoad.id, true)
  562. }
  563. if(!this.onLoad.id){
  564. console.log(3);
  565. this.isrowAdd= false
  566. // this.$set(this.optionForm,'disabled',false)
  567. // this.$set(this.optionContacts,'disabled',false)
  568. }
  569. if (!this.form.id) {
  570. console.log('这是一还是二');
  571. // this.$set(this.optionContactsBack, "addBtn", false)
  572. this['optionContacts'] = this['optionContactsBack'];
  573. this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  574. }
  575. },
  576. components: {
  577. reportDialog
  578. },
  579. methods: {
  580. rowAdd(row,score){
  581. console.log(123214);
  582. this.optionContactsBack.column.forEach(its => {
  583. if (its.prop == 'goodsNum') {
  584. this.$set(its,'disabled',true)
  585. } else {
  586. this.$set(its,'disabled',false)
  587. }
  588. })
  589. this.$refs.formContacts.rowAdd()
  590. },
  591. derivation() {
  592. window.open(
  593. `/api/blade-sales-part/ship/export-item?${this.website.tokenHeader
  594. }=${getToken()}`
  595. );
  596. },
  597. uploadAfter(res, done, loading, column) {
  598. if (res instanceof Array) {
  599. this.form.shipItemsList = this.form.shipItemsList.concat(res)
  600. }
  601. this.excelBox = false;
  602. loading = false;
  603. done();
  604. },
  605. uploadBefore(file, done, loading) {
  606. done();
  607. loading = true;
  608. },
  609. //撤销
  610. revoke() {
  611. this.$refs["form"].validate((valid, done) => {
  612. done();
  613. if (valid) {
  614. const loading = this.$loading({
  615. lock: true,
  616. text: '加载中',
  617. spinner: 'el-icon-loading',
  618. background: 'rgba(255,255,255,0.7)'
  619. });
  620. revoke({
  621. ...this.form,
  622. bizTypeName: "SHGD"
  623. }).then(res => {
  624. this.$message.success("撤销成功");
  625. this.refresh(res.data.data.id)
  626. loading.close();
  627. }).finally(() => {
  628. loading.close();
  629. });
  630. }
  631. })
  632. },
  633. //编辑
  634. confirmEditing(){
  635. if(this.form.statusName == '待入库'){
  636. this.isrowAdd = false
  637. this.$set(this.optionForm,'disabled',false)
  638. this.$set(this.optionContacts,'disabled',false)
  639. this.optionForm.column.forEach(item=>{
  640. if(item.prop == 'remarks' || item.prop == 'createTime' || item.prop == 'stockClerkId'){
  641. this.$set(item,'disabled',false)
  642. }else{
  643. this.$set(item,'disabled',true)
  644. }
  645. })
  646. this.optionContacts.column.forEach(item=>{
  647. if(item.prop == 'remarks'){
  648. this.$set(item,'disabled',false)
  649. }else{
  650. this.$set(item,'disabled',true)
  651. }
  652. })
  653. }else if(this.form.statusName == '已入库'){
  654. this.$set(this.optionForm,'disabled',false)
  655. this.$set(this.optionContactsBack,'disabled',false)
  656. this.optionForm.column.forEach(item=>{
  657. if(item.prop == 'remarks'){
  658. this.$set(item,'disabled',false)
  659. }else{
  660. this.$set(item,'disabled',true)
  661. }
  662. })
  663. this.optionContactsBack.column.forEach(item=>{
  664. if(item.prop == 'remarks'){
  665. this.$set(item,'disabled',false)
  666. }else{
  667. this.$set(item,'disabled',true)
  668. }
  669. })
  670. }
  671. },
  672. complete() {
  673. this.$refs["form"].validate((valid, done) => {
  674. done();
  675. if (valid) {
  676. const loading = this.$loading({
  677. lock: true,
  678. text: '加载中',
  679. spinner: 'el-icon-loading',
  680. background: 'rgba(255,255,255,0.7)'
  681. });
  682. warehousingComplete({
  683. ...this.form,
  684. bizTypeName: "SHGD"
  685. }).then(res => {
  686. this.$message.success("保存成功");
  687. this.refresh(res.data.data.id)
  688. loading.close();
  689. }).finally(() => {
  690. loading.close();
  691. });
  692. }
  693. })
  694. },
  695. //修改提交触发
  696. editCustomer() {
  697. if (this.form.shipItemsList.length == 0) {
  698. return this.$message.warning('请明细不能为空')
  699. }
  700. this.$refs["form"].validate((valid, done) => {
  701. done();
  702. if (valid) {
  703. const loading = this.$loading({
  704. lock: true,
  705. text: '加载中',
  706. spinner: 'el-icon-loading',
  707. background: 'rgba(255,255,255,0.7)'
  708. });
  709. this.form.customerName=this.form.$customerId
  710. submit({
  711. ...this.form,
  712. bizTypeName: "SHGD"
  713. }).then(res => {
  714. this.$message.success("保存成功");
  715. this.refresh(res.data.data.id);
  716. loading.close();
  717. }).finally(() => {
  718. loading.close();
  719. });
  720. } else {
  721. return false;
  722. }
  723. });
  724. },
  725. refresh(id, type) {
  726. const loading = this.$loading({
  727. lock: true,
  728. text: '加载中',
  729. spinner: 'el-icon-loading',
  730. background: 'rgba(255,255,255,0.7)'
  731. })
  732. getDetails({ id: id }).then(res => {
  733. this.form = res.data.data
  734. loading.close();
  735. }).catch(() => {
  736. loading.close();
  737. })
  738. },
  739. //编辑
  740. rowEdit(row,index){
  741. console.log(row,index);
  742. this.confirmEditing()
  743. this.$refs.formContacts.rowEdit(row,index)
  744. },
  745. rowDelBox(row, index) {
  746. this.$confirm("确定将选择数据删除?", {
  747. confirmButtonText: "确定",
  748. cancelButtonText: "取消",
  749. type: "warning"
  750. }).then(() => {
  751. if (row.id) {
  752. tradingBox(row.id).then(res => {
  753. this.form.shipItemsList.splice(index, 1);
  754. this.$message.success("操作成功!");
  755. });
  756. } else {
  757. this.form.shipItemsList.splice(index, 1);
  758. this.$message.success("操作成功!");
  759. }
  760. }
  761. );
  762. },
  763. rowSave(form, done, loading) {
  764. console.log(form)
  765. done(form)
  766. },
  767. rowUpdate(form, index, done, loading) {
  768. console.log(form)
  769. done(form);
  770. },
  771. handlePrint() {
  772. this.switchDialog = !this.switchDialog;
  773. },
  774. onClose(val) {
  775. this.switchDialog = val;
  776. },
  777. //自定义列保存
  778. async saveColumnTwo(ref, option, optionBack, code) {
  779. /**
  780. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  781. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  782. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  783. */
  784. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  785. if (inSave) {
  786. this.$message.success("保存成功");
  787. //关闭窗口b
  788. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  789. }
  790. },
  791. //自定义列重置
  792. async resetColumnTwo(ref, option, optionBack, code) {
  793. this[option] = this[optionBack];
  794. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  795. if (inSave) {
  796. this.$message.success("重置成功");
  797. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  798. }
  799. },
  800. backToList(type) {
  801. this.$emit("backToList", type);
  802. }
  803. }
  804. }
  805. </script>
  806. <style lang="scss" scoped>
  807. ::v-deep .el-form-item {
  808. margin-bottom: 8px !important;
  809. }
  810. </style>