detailsPage.vue 34 KB

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