detailsPage.vue 40 KB

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