detailsPage.vue 44 KB

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