detailsPage.vue 43 KB

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