detailsPage.vue 36 KB

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