detailsPage.vue 41 KB

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