detailsPage.vue 40 KB

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