detailsPage.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045
  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. if (this.$route.query.srcId) {
  681. this.refresh(this.$route.query.srcId)
  682. }
  683. this.$store.commit("DOMIO_IN_DETAIL");
  684. },
  685. components: {
  686. reportDialog
  687. },
  688. activated() {
  689. this.$store.commit("DOMIO_IN_DETAIL");
  690. },
  691. methods: {
  692. rowAdd(row, score) {
  693. console.log(123214);
  694. this.optionContactsBack.column.forEach(its => {
  695. if (its.prop == 'goodsNum' || its.prop == 'goodsNo' || its.prop == 'brandId' || its.prop == 'propertyName' || its.prop == 'pattern' || its.prop == 'goodsDescription' || its.prop == 'units') {
  696. this.$set(its, 'disabled', true)
  697. } else {
  698. this.$set(its, 'disabled', false)
  699. }
  700. })
  701. this.$refs.formContacts.rowAdd()
  702. },
  703. derivation() {
  704. window.open(
  705. `/api/blade-sales-part/ship/export-item?${this.website.tokenHeader
  706. }=${getToken()}`
  707. );
  708. },
  709. uploadAfter(res, done, loading, column) {
  710. if (res instanceof Array) {
  711. this.form.shipItemsList = this.form.shipItemsList.concat(res)
  712. }
  713. this.excelBox = false;
  714. loading = false;
  715. done();
  716. },
  717. uploadBefore(file, done, loading) {
  718. done();
  719. loading = true;
  720. },
  721. //撤销
  722. revoke() {
  723. this.$refs["form"].validate((valid, done) => {
  724. console.log(valid, 'valid')
  725. done();
  726. if (valid) {
  727. const loading = this.$loading({
  728. lock: true,
  729. text: '加载中',
  730. spinner: 'el-icon-loading',
  731. background: 'rgba(255,255,255,0.7)'
  732. });
  733. revoke({
  734. ...this.form,
  735. bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD"
  736. }).then(res => {
  737. this.$message.success("撤销成功");
  738. this.refresh(res.data.data.id)
  739. loading.close();
  740. }).finally(() => {
  741. loading.close();
  742. });
  743. }
  744. })
  745. },
  746. //编辑
  747. confirmEditing() {
  748. this.isButton = false
  749. if (this.form.statusName == '待入库' || this.form.statusName == '已撤销') {
  750. this.isEdit = false
  751. this.isrowAdd = false
  752. this.$set(this.optionForm, 'disabled', false)
  753. this.$set(this.optionContacts, 'disabled', false)
  754. this.optionForm.column.forEach(item => {
  755. if (item.prop == 'remarks' || item.prop == 'createTime' || item.prop == 'stockClerkId' || item.prop == 'storageId') {
  756. this.$set(item, 'disabled', false)
  757. } else {
  758. this.$set(item, 'disabled', true)
  759. }
  760. })
  761. this.optionContacts.column.forEach(item => {
  762. if (item.prop == 'remarks' || item.prop == 'dot' || item.prop == 'sendNum') {
  763. this.$set(item, 'disabled', false)
  764. } else {
  765. this.$set(item, 'disabled', true)
  766. }
  767. })
  768. if (this.form.billno.substring(0, 4) == 'TKSH') {
  769. // this.isEdit = true
  770. this.isEdits = true
  771. this.isrowAdd = true
  772. this.optionContacts.column.forEach(item => {
  773. if (item.prop == 'remarks' || item.prop == 'sendNum' || item.prop == 'price' || item.prop == 'dot') {
  774. this.$set(item, 'disabled', false)
  775. } else {
  776. this.$set(item, 'disabled', true)
  777. }
  778. })
  779. }
  780. } else if (this.form.statusName == '已入库') {
  781. this.$set(this.optionForm, 'disabled', false)
  782. this.$set(this.optionContactsBack, 'disabled', false)
  783. this.optionForm.column.forEach(item => {
  784. if (item.prop == 'remarks') {
  785. this.$set(item, 'disabled', false)
  786. } else {
  787. this.$set(item, 'disabled', true)
  788. }
  789. })
  790. this.optionContactsBack.column.forEach(item => {
  791. if (item.prop == 'remarks') {
  792. this.$set(item, 'disabled', false)
  793. } else {
  794. this.$set(item, 'disabled', true)
  795. }
  796. })
  797. }
  798. console.log(this.form.shipItemsList[0].goodsId);
  799. goodsDetail({ id: this.form.shipItemsList[0].goodsId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  800. if (res.data.data.whether == 0) {
  801. this.findObject(this.optionContacts.column, "dot").disabled = true
  802. } else {
  803. this.findObject(this.optionContacts.column, "dot").disabled = false
  804. dotList({
  805. storageId: this.form.storageId,
  806. goodsId: this.formContacts.goodsId
  807. }).then(res => {
  808. console.log('567');
  809. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  810. })
  811. }
  812. })
  813. },
  814. complete() {
  815. this.$refs["form"].validate((valid, done) => {
  816. done();
  817. if (valid) {
  818. const loading = this.$loading({
  819. lock: true,
  820. text: '加载中',
  821. spinner: 'el-icon-loading',
  822. background: 'rgba(255,255,255,0.7)'
  823. });
  824. this.form.customerName = this.form.$customerId
  825. submit({
  826. ...this.form,
  827. bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD"
  828. }).then(res => {
  829. warehousingComplete({
  830. ...this.form,
  831. bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD"
  832. }).then(res => {
  833. this.refresh(res.data.data.id)
  834. this.$set(this.optionForm, 'disabled', true)
  835. this.$set(this.optionContactsBack, 'disabled', true)
  836. this.isEdit = true
  837. this.$message.success("入库完成");
  838. loading.close();
  839. }).finally(() => {
  840. loading.close();
  841. });
  842. })
  843. }
  844. })
  845. },
  846. //修改提交触发
  847. editCustomer() {
  848. if (this.form.shipItemsList.length == 0) {
  849. return this.$message.warning('请明细不能为空')
  850. }
  851. this.$refs["form"].validate((valid, done) => {
  852. done();
  853. if (valid) {
  854. const loading = this.$loading({
  855. lock: true,
  856. text: '加载中',
  857. spinner: 'el-icon-loading',
  858. background: 'rgba(255,255,255,0.7)'
  859. });
  860. this.form.customerName = this.form.$customerId
  861. this.form.shipItemsList.map(item => {
  862. item.$cellEdit = false
  863. })
  864. submit({
  865. ...this.form,
  866. bizTypeName: this.form.id ? this.form.bizTypeName : "SHGD",
  867. filesList: this.filesList
  868. }).then(res => {
  869. this.$message.success("保存成功");
  870. this.refresh(res.data.data.id);
  871. loading.close();
  872. }).finally(() => {
  873. loading.close();
  874. });
  875. } else {
  876. return false;
  877. }
  878. });
  879. },
  880. refresh(id, type) {
  881. const loading = this.$loading({
  882. lock: true,
  883. text: '加载中',
  884. spinner: 'el-icon-loading',
  885. background: 'rgba(255,255,255,0.7)'
  886. })
  887. if (!this.detailData.id) {
  888. getDetails({ id: id }).then(res => {
  889. this.form = res.data.data
  890. this.filesList = res.data.data.filesList
  891. loading.close();
  892. }).catch(() => {
  893. loading.close();
  894. })
  895. } else {
  896. getDetails({ id: this.detailData.id }).then(res => {
  897. this.form = res.data.data
  898. this.filesList = res.data.data.filesList
  899. loading.close();
  900. }).catch(() => {
  901. loading.close();
  902. })
  903. }
  904. },
  905. // 获取业务对象
  906. corpsDescListAllfun(corpType) {
  907. corpsDescListAll({ corpType }).then(res => {
  908. this.optionForm.column[0].dicData = res.data.data
  909. })
  910. },
  911. //编辑
  912. rowEdit(row, index) {
  913. if (row.$cellEdit) {
  914. this.$set(row, '$cellEdit', false)
  915. } else {
  916. this.$set(row, '$cellEdit', true)
  917. }
  918. // this.confirmEditing()
  919. dotList({
  920. storageId: this.form.storageId,
  921. goodsId: row.goodsId
  922. }).then(res => {
  923. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  924. // console.log(this.dicData)
  925. })
  926. console.log(this.optionContacts, 802)
  927. // this.$refs.formContacts.rowEdit(row, index)
  928. },
  929. rowDelBox(row, index) {
  930. this.$confirm("确定将选择数据删除?", {
  931. confirmButtonText: "确定",
  932. cancelButtonText: "取消",
  933. type: "warning"
  934. }).then(() => {
  935. if (row.id) {
  936. tradingBox(row.id).then(res => {
  937. this.form.shipItemsList.splice(index, 1);
  938. this.$message.success("操作成功!");
  939. });
  940. } else {
  941. this.form.shipItemsList.splice(index, 1);
  942. this.$message.success("操作成功!");
  943. }
  944. }
  945. );
  946. },
  947. // 明细信息多选
  948. selectionContacts(list) {
  949. this.selectionMultilist = list
  950. },
  951. // 一键删除
  952. batchDelete() {
  953. if (this.selectionMultilist.length == 0) {
  954. return this.$message.warning('请选择要删除的数据')
  955. }
  956. this.$confirm("确定将选择数据删除?", {
  957. confirmButtonText: "确定",
  958. cancelButtonText: "取消",
  959. type: "warning"
  960. }).then(() => {
  961. let multiList = this.selectionMultilist
  962. let arr = this.form.shipItemsList
  963. // 获取有id 的数据
  964. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  965. let arrIds = itemsWithId.map(item => item.id) // 获取id 数据
  966. // 把选中的删除掉
  967. multiList.forEach((item) => {
  968. for (let index in arr) {
  969. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  970. arr.splice(Number(index), 1)
  971. }
  972. }
  973. })
  974. // 有id 的处理
  975. if (itemsWithId.length != 0) {
  976. tradingBox(arrIds.join(',')).then(res => {
  977. this.$message.success("操作成功!");
  978. });
  979. }
  980. })
  981. },
  982. rowSave(form, done, loading) {
  983. console.log(form)
  984. done(form)
  985. },
  986. // 更新数据后确定触发该事件
  987. rowUpdate(form, index, done, loading) {
  988. console.log(form)
  989. done(form);
  990. },
  991. handlePrint() {
  992. this.switchDialog = !this.switchDialog;
  993. },
  994. onClose(val) {
  995. this.switchDialog = val;
  996. },
  997. //自定义列保存
  998. async saveColumnTwo(ref, option, optionBack, code) {
  999. /**
  1000. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1001. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1002. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1003. */
  1004. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1005. if (inSave) {
  1006. this.$message.success("保存成功");
  1007. //关闭窗口b
  1008. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1009. }
  1010. },
  1011. //自定义列重置
  1012. async resetColumnTwo(ref, option, optionBack, code) {
  1013. this[option] = this[optionBack];
  1014. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1015. if (inSave) {
  1016. this.$message.success("重置成功");
  1017. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1018. }
  1019. },
  1020. backToList(type) {
  1021. this.$emit("backToList", type);
  1022. }
  1023. }
  1024. }
  1025. </script>
  1026. <style lang="scss" scoped>
  1027. ::v-deep .el-form-item {
  1028. margin-bottom: 8px !important;
  1029. }
  1030. </style>