detailsPage.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
  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. align: "center",
  305. addBtn: false,
  306. addBtnText: "录入明细",
  307. refreshBtn: false,
  308. editBtn: false,
  309. delBtn: false,
  310. border: true,
  311. menuWidth: 160,
  312. stripe: true,
  313. span: 8,
  314. index: true,
  315. menu: true,
  316. dialogTop: 25,
  317. disabled: false,
  318. dialogWidth: "80%",
  319. showSummary: true,
  320. saveBtn:false, // 表格弹窗保存按钮
  321. cancelBtn:false, // 行内查看取消按钮
  322. cellBtn:true, // 行编辑
  323. sumColumnList: [
  324. {
  325. name: 'sendNum',
  326. type: 'sum',
  327. }, {
  328. name: 'goodsNum',
  329. type: 'sum',
  330. }
  331. ],
  332. column: [{
  333. label: '轮胎名称',
  334. prop: 'goodsId',
  335. width: 200,
  336. overHidden: true,
  337. disabled: false,
  338. filterable: true,
  339. type: 'select',
  340. props: {
  341. label: 'cname',
  342. value: 'id'
  343. },
  344. dicUrl: '/api/blade-sales-part/goodsDesc/goodsListAll'
  345. },
  346. // {
  347. // label: "价格",
  348. // prop: "price",
  349. // disabled: false,
  350. // ovrHidden: true,
  351. // rules: [{
  352. // required: true,
  353. // message: " ",
  354. // trigger: "blur"
  355. // }, {
  356. // validator: (rule, value, callback) => {
  357. // if (value < 0) {
  358. // callback(new Error("单价不能小于0"));
  359. // } else {
  360. // callback();
  361. // }
  362. // },
  363. // trigger: "blur"
  364. // }]
  365. // },
  366. {
  367. label: "实际数量",
  368. prop: "sendNum",
  369. width:100,
  370. cell: true,
  371. disabled: false,
  372. overHidden: true,
  373. rules: [{
  374. required: true,
  375. message: " ",
  376. trigger: "blur"
  377. },
  378. {
  379. validator: (rule, value, callback) => {
  380. if (value < 0) {
  381. callback(new Error("实际数量不能小于0"));
  382. } else {
  383. callback();
  384. }
  385. },
  386. trigger: "blur"
  387. }]
  388. }, {
  389. label: "批次号",
  390. cell:true,
  391. width:120,
  392. prop: "dot",
  393. type: "select",
  394. disabled: false,
  395. allowCreate: true,
  396. filterable: true,
  397. dicData: [],
  398. props: {
  399. label: "dot",
  400. value: "dot"
  401. },
  402. overHidden: true
  403. }, {
  404. label: '物料编码',
  405. prop: 'goodsNo',
  406. overHidden: true,
  407. disabled: false,
  408. width: 140
  409. }, {
  410. label: "品牌",
  411. prop: 'brandId',
  412. width: 100,
  413. overHidden: true,
  414. disabled: false,
  415. type: 'select',
  416. props: {
  417. label: 'cname',
  418. value: 'id'
  419. },
  420. dicUrl: '/api/blade-sales-part/brandDesc/listAll?type=PP'
  421. }, {
  422. label: "规格型号",
  423. prop: "propertyName",
  424. overHidden: true,
  425. disabled: false,
  426. // rules: [{
  427. // required: true,
  428. // message: " ",
  429. // trigger: "blur"
  430. // }]
  431. }, {
  432. label: "花纹",
  433. prop: "pattern",
  434. disabled: false,
  435. overHidden: true
  436. }, {
  437. label: "轮胎描述",
  438. prop: "goodsDescription",
  439. disabled: false,
  440. overHidden: true
  441. }, {
  442. label: "单位",
  443. prop: 'units',
  444. type: "select",
  445. disabled: false,
  446. props: {
  447. label: "dictValue",
  448. value: "dictValue"
  449. },
  450. dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit"
  451. }, {
  452. label: "入库数量",
  453. prop: "goodsNum",
  454. disabled: true,
  455. ovrHidden: true,
  456. }, {
  457. label: "备注",
  458. cell:true,
  459. prop: "remarks",
  460. width:150,
  461. span: 16,
  462. disabled: false,
  463. overHidde: true
  464. }]
  465. },
  466. optionPaymentDetails: {},
  467. optionPaymentDetailsBack: {
  468. align: "center",
  469. addBtn: false,
  470. refreshBtn: false,
  471. editBtn: false,
  472. delBtn: false,
  473. border: true,
  474. menuWidth: 120,
  475. stripe: true,
  476. index: true,
  477. menu: false,
  478. column: [
  479. {
  480. label: "入库单号",
  481. prop: "billno",
  482. disabled: true
  483. },
  484. {
  485. label: "来源单号",
  486. prop: "ordNo",
  487. disabled: true
  488. },
  489. // {
  490. // label: "业务来源",
  491. // prop: "stockTime",
  492. // type: "date",
  493. // searchRange: true,
  494. // searchDefaultTime: [
  495. // "00:00:00",
  496. // "23:59:59"
  497. // ],
  498. // format: "yyyy-MM-dd",
  499. // valueFormat: "yyyy-MM-dd HH:mm:ss",
  500. // overHidden: true
  501. // },
  502. {
  503. label: "地址",
  504. prop: "recAddress",
  505. overHidden: true,
  506. },
  507. {
  508. prop: "contacts",
  509. label: "联系人",
  510. overHidden: true
  511. },
  512. {
  513. prop: "phone",
  514. label: "电话",
  515. overHidden: true
  516. },
  517. {
  518. prop: "remarks",
  519. label: "备注",
  520. disabled: false,
  521. overHidden: true
  522. }
  523. ]
  524. },
  525. optionOutboundRecords: {},
  526. optionOutboundRecordsBack: {
  527. align: "center",
  528. addBtn: false,
  529. refreshBtn: false,
  530. editBtn: false,
  531. delBtn: false,
  532. border: true,
  533. menuWidth: 120,
  534. index: true,
  535. stripe: true,
  536. menu: false,
  537. column: [{
  538. prop: "operatorName",
  539. label: "操作人",
  540. overHidden: true,
  541. showColumn: false,
  542. width: 120,
  543. }, {
  544. prop: "operateStatus",
  545. label: "状态",
  546. overHidden: true,
  547. }, {
  548. prop: "operateTime",
  549. label: "时间",
  550. overHidden: true,
  551. searchDefaultTime: ["00:00:00", "23:59:59"],
  552. format: "yyyy-MM-dd",
  553. valueFormat: "yyyy-MM-dd HH:mm:ss",
  554. }]
  555. }
  556. }
  557. },
  558. props: {
  559. onLoad: Object,
  560. detailData: Object
  561. },
  562. async created() {
  563. this.findObject(this.optionContactsBack.column, "goodsId").change = ({ value, column }) => {
  564. console.log(value);
  565. this.values = value
  566. console.log('this.formContacts.goodsId', this.formContacts.goodsId);
  567. if (this.formContacts.goodsId !== value) {
  568. dotListAll({
  569. storageId: this.form.storageId,
  570. goodsId: this.formContacts.goodsId
  571. }).then(res => { this.formContacts.price = res.data.data[0].inventoryCostPrice, console.log(res) })
  572. goodsDetail({ id: value, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  573. console.log(this.form.storageId);
  574. this.formContacts.goodsNo = res.data.data.code
  575. this.formContacts.brandId = res.data.data.brandId
  576. this.formContacts.brandName = res.data.data.brandName
  577. this.formContacts.propertyName = res.data.data.specificationAndModel
  578. this.formContacts.pattern = res.data.data.brandItem
  579. this.formContacts.goodsDescription = res.data.data.goodsDescription
  580. this.formContacts.units = res.data.data.unit
  581. this.findObject(this.optionContacts.column, "goodsNum").disabled = true
  582. if (res.data.data.whether == 0) {
  583. this.findObject(this.optionContacts.column, "dot").disabled = true
  584. } else {
  585. this.findObject(this.optionContacts.column, "dot").disabled = false
  586. dotList({
  587. storageId: this.form.storageId,
  588. goodsId: this.formContacts.goodsId
  589. }).then(res => {
  590. console.log('dot', res);
  591. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  592. })
  593. }
  594. })
  595. }
  596. }
  597. this.optionContacts = await this.getColumnData(this.getColumnName(274.1), this.optionContactsBack);
  598. this.findObject(this.optionContacts.column, "goodsId").change = ({ value, column }) => {
  599. console.log(value);
  600. console.log(this.form.storageId);
  601. this.values = value
  602. if (this.formContacts.goodsId !== value) {
  603. dotListAll({
  604. storageId: this.form.storageId,
  605. goodsId: this.formContacts.goodsId
  606. }).then(res => { this.formContacts.price = res.data.data[0].inventoryCostPrice })
  607. goodsDetail({ id: value, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  608. this.formContacts.goodsNo = res.data.data.code
  609. this.formContacts.brandId = res.data.data.brandId
  610. this.formContacts.brandName = res.data.data.brandName
  611. this.formContacts.propertyName = res.data.data.specificationAndModel
  612. this.formContacts.pattern = res.data.data.brandItem
  613. this.formContacts.goodsDescription = res.data.data.goodsDescription
  614. this.formContacts.units = res.data.data.unit
  615. this.findObject(this.optionContacts.column, "goodsNum").disabled = true
  616. if (res.data.data.whether == 0) {
  617. this.findObject(this.optionContacts.column, "dot").disabled = true
  618. } else {
  619. this.findObject(this.optionContacts.column, "dot").disabled = false
  620. dotList({
  621. storageId: this.form.storageId,
  622. goodsId: this.formContacts.goodsId
  623. }).then(res => {
  624. console.log('567');
  625. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  626. })
  627. }
  628. })
  629. }
  630. }
  631. this.optionPaymentDetails = await this.getColumnData(this.getColumnName(274.2), this.optionPaymentDetailsBack);
  632. this.optionOutboundRecords = await this.getColumnData(this.getColumnName(274.3), this.optionOutboundRecordsBack);
  633. this.key++
  634. this.isButton = true
  635. if (this.onLoad.id && this.detailData.id) {
  636. this.refresh(this.onLoad.id, true)
  637. this.$set(this.optionForm, 'disabled', true)
  638. this.$set(this.optionContactsBack, 'disabled', true)
  639. } else if (this.onLoad.id) {
  640. console.log(2);
  641. this.refresh(this.onLoad.id, true)
  642. }
  643. if (!this.form.id) {
  644. this.isEdit = true
  645. // this.$set(this.optionContactsBack, "addBtn", false)
  646. this['optionContacts'] = this['optionContactsBack'];
  647. this.delColumnData(this.getColumnName('269.1'), this['optionContactsBack']);
  648. }
  649. if (!this.onLoad.id) {
  650. this.isrowAdd = false
  651. this.isEdit = false
  652. // this.$set(this.optionForm,'disabled',false)
  653. // this.$set(this.optionContacts,'disabled',false)
  654. }
  655. if (this.detailData.id) {
  656. this.refresh()
  657. }
  658. this.$store.commit("DOMIO_IN_DETAIL");
  659. },
  660. components: {
  661. reportDialog
  662. },
  663. activated(){
  664. this.$store.commit("DOMIO_IN_DETAIL");
  665. },
  666. methods: {
  667. rowAdd(row, score) {
  668. console.log(123214);
  669. this.optionContactsBack.column.forEach(its => {
  670. if (its.prop == 'goodsNum' || its.prop == 'goodsNo' || its.prop == 'brandId' || its.prop == 'propertyName' || its.prop == 'pattern' || its.prop == 'goodsDescription' || its.prop == 'units') {
  671. this.$set(its, 'disabled', true)
  672. } else {
  673. this.$set(its, 'disabled', false)
  674. }
  675. })
  676. this.$refs.formContacts.rowAdd()
  677. },
  678. derivation() {
  679. window.open(
  680. `/api/blade-sales-part/ship/export-item?${this.website.tokenHeader
  681. }=${getToken()}`
  682. );
  683. },
  684. uploadAfter(res, done, loading, column) {
  685. if (res instanceof Array) {
  686. this.form.shipItemsList = this.form.shipItemsList.concat(res)
  687. }
  688. this.excelBox = false;
  689. loading = false;
  690. done();
  691. },
  692. uploadBefore(file, done, loading) {
  693. done();
  694. loading = true;
  695. },
  696. //撤销
  697. revoke() {
  698. this.$refs["form"].validate((valid, done) => {
  699. done();
  700. if (valid) {
  701. const loading = this.$loading({
  702. lock: true,
  703. text: '加载中',
  704. spinner: 'el-icon-loading',
  705. background: 'rgba(255,255,255,0.7)'
  706. });
  707. revoke({
  708. ...this.form,
  709. bizTypeName: "SHGD"
  710. }).then(res => {
  711. this.$message.success("撤销成功");
  712. this.refresh(res.data.data.id)
  713. loading.close();
  714. }).finally(() => {
  715. loading.close();
  716. });
  717. }
  718. })
  719. },
  720. //编辑
  721. confirmEditing() {
  722. this.isButton = false
  723. if (this.form.statusName == '待入库' || this.form.statusName == '已撤销') {
  724. this.isEdit = false
  725. this.isrowAdd = false
  726. this.$set(this.optionForm, 'disabled', false)
  727. this.$set(this.optionContacts, 'disabled', false)
  728. this.optionForm.column.forEach(item => {
  729. if (item.prop == 'remarks' || item.prop == 'createTime' || item.prop == 'stockClerkId' || item.prop == 'storageId') {
  730. this.$set(item, 'disabled', false)
  731. } else {
  732. this.$set(item, 'disabled', true)
  733. }
  734. })
  735. this.optionContacts.column.forEach(item => {
  736. if (item.prop == 'remarks' || item.prop == 'dot' || item.prop == 'sendNum') {
  737. this.$set(item, 'disabled', false)
  738. } else {
  739. this.$set(item, 'disabled', true)
  740. }
  741. })
  742. if (this.form.billno.substring(0, 4) == 'TKSH') {
  743. // this.isEdit = true
  744. this.isEdits = true
  745. this.isrowAdd = true
  746. this.optionContacts.column.forEach(item => {
  747. if (item.prop == 'remarks' || item.prop == 'sendNum' || item.prop == 'price' || item.prop == 'dot') {
  748. this.$set(item, 'disabled', false)
  749. } else {
  750. this.$set(item, 'disabled', true)
  751. }
  752. })
  753. }
  754. } else if (this.form.statusName == '已入库') {
  755. this.$set(this.optionForm, 'disabled', false)
  756. this.$set(this.optionContactsBack, 'disabled', false)
  757. this.optionForm.column.forEach(item => {
  758. if (item.prop == 'remarks') {
  759. this.$set(item, 'disabled', false)
  760. } else {
  761. this.$set(item, 'disabled', true)
  762. }
  763. })
  764. this.optionContactsBack.column.forEach(item => {
  765. if (item.prop == 'remarks') {
  766. this.$set(item, 'disabled', false)
  767. } else {
  768. this.$set(item, 'disabled', true)
  769. }
  770. })
  771. }
  772. console.log(this.form.shipItemsList[0].goodsId);
  773. goodsDetail({ id: this.form.shipItemsList[0].goodsId, stock: this.form.storageId ? this.form.storageId : '' }).then(res => {
  774. if (res.data.data.whether == 0) {
  775. this.findObject(this.optionContacts.column, "dot").disabled = true
  776. } else {
  777. this.findObject(this.optionContacts.column, "dot").disabled = false
  778. dotList({
  779. storageId: this.form.storageId,
  780. goodsId: this.formContacts.goodsId
  781. }).then(res => {
  782. console.log('567');
  783. this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
  784. })
  785. }
  786. })
  787. },
  788. complete() {
  789. this.$refs["form"].validate((valid, done) => {
  790. done();
  791. if (valid) {
  792. const loading = this.$loading({
  793. lock: true,
  794. text: '加载中',
  795. spinner: 'el-icon-loading',
  796. background: 'rgba(255,255,255,0.7)'
  797. });
  798. this.form.customerName = this.form.$customerId
  799. submit({
  800. ...this.form,
  801. bizTypeName: "SHGD"
  802. }).then(res => {
  803. warehousingComplete({
  804. ...this.form,
  805. bizTypeName: "SHGD"
  806. }).then(res => {
  807. this.refresh(res.data.data.id)
  808. this.$set(this.optionForm, 'disabled', true)
  809. this.$set(this.optionContactsBack, 'disabled', true)
  810. this.isEdit = true
  811. this.$message.success("入库完成");
  812. loading.close();
  813. }).finally(() => {
  814. loading.close();
  815. });
  816. })
  817. }
  818. })
  819. },
  820. //修改提交触发
  821. editCustomer() {
  822. if (this.form.shipItemsList.length == 0) {
  823. return this.$message.warning('请明细不能为空')
  824. }
  825. this.$refs["form"].validate((valid, done) => {
  826. done();
  827. if (valid) {
  828. const loading = this.$loading({
  829. lock: true,
  830. text: '加载中',
  831. spinner: 'el-icon-loading',
  832. background: 'rgba(255,255,255,0.7)'
  833. });
  834. this.form.customerName = this.form.$customerId
  835. this.form.shipItemsList.map(item=>{
  836. item.$cellEdit = false
  837. })
  838. submit({
  839. ...this.form,
  840. bizTypeName: "SHGD",
  841. filesList:this.filesList
  842. }).then(res => {
  843. this.$message.success("保存成功");
  844. this.refresh(res.data.data.id);
  845. loading.close();
  846. }).finally(() => {
  847. loading.close();
  848. });
  849. } else {
  850. return false;
  851. }
  852. });
  853. },
  854. refresh(id, type) {
  855. const loading = this.$loading({
  856. lock: true,
  857. text: '加载中',
  858. spinner: 'el-icon-loading',
  859. background: 'rgba(255,255,255,0.7)'
  860. })
  861. if (!this.detailData.id) {
  862. getDetails({ id: id }).then(res => {
  863. this.form = res.data.data
  864. this.filesList = res.data.data.filesList
  865. loading.close();
  866. }).catch(() => {
  867. loading.close();
  868. })
  869. } else {
  870. getDetails({ id: this.detailData.id }).then(res => {
  871. this.form = res.data.data
  872. this.filesList = res.data.data.filesList
  873. loading.close();
  874. }).catch(() => {
  875. loading.close();
  876. })
  877. }
  878. },
  879. // 获取业务对象
  880. corpsDescListAllfun(corpType){
  881. corpsDescListAll({corpType}).then(res=>{
  882. this.optionForm.column[0].dicData = res.data.data
  883. })
  884. },
  885. //编辑
  886. rowEdit(row, index) {
  887. console.log(row, index,887);
  888. if (row.$cellEdit) {
  889. this.$set(row,'$cellEdit',false)
  890. }else {
  891. this.$set(row,'$cellEdit',true)
  892. }
  893. // this.confirmEditing()
  894. dotList({
  895. storageId: this.form.storageId,
  896. goodsId: row.goodsId
  897. }).then(res => {
  898. this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
  899. // console.log(this.dicData)
  900. })
  901. // this.$refs.formContacts.rowEdit(row, index)
  902. },
  903. rowDelBox(row, index) {
  904. this.$confirm("确定将选择数据删除?", {
  905. confirmButtonText: "确定",
  906. cancelButtonText: "取消",
  907. type: "warning"
  908. }).then(() => {
  909. if (row.id) {
  910. tradingBox(row.id).then(res => {
  911. this.form.shipItemsList.splice(index, 1);
  912. this.$message.success("操作成功!");
  913. });
  914. } else {
  915. this.form.shipItemsList.splice(index, 1);
  916. this.$message.success("操作成功!");
  917. }
  918. }
  919. );
  920. },
  921. rowSave(form, done, loading) {
  922. console.log(form)
  923. done(form)
  924. },
  925. // 更新数据后确定触发该事件
  926. rowUpdate(form, index, done, loading) {
  927. console.log(form)
  928. done(form);
  929. },
  930. handlePrint() {
  931. this.switchDialog = !this.switchDialog;
  932. },
  933. onClose(val) {
  934. this.switchDialog = val;
  935. },
  936. //自定义列保存
  937. async saveColumnTwo(ref, option, optionBack, code) {
  938. /**
  939. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  940. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  941. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  942. */
  943. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  944. if (inSave) {
  945. this.$message.success("保存成功");
  946. //关闭窗口b
  947. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  948. }
  949. },
  950. //自定义列重置
  951. async resetColumnTwo(ref, option, optionBack, code) {
  952. this[option] = this[optionBack];
  953. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  954. if (inSave) {
  955. this.$message.success("重置成功");
  956. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  957. }
  958. },
  959. backToList(type) {
  960. this.$emit("backToList", type);
  961. }
  962. }
  963. }
  964. </script>
  965. <style lang="scss" scoped>
  966. ::v-deep .el-form-item {
  967. margin-bottom: 8px !important;
  968. }
  969. </style>