detailsPage.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  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. <el-button v-if="detailData.id" type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  9. @click="backToList(1)">返回审核列表
  10. </el-button>
  11. </div>
  12. <div class="add-customer-btn">
  13. <el-button class="el-button--small-yh" style="margin-right: 10px" type="primary" size="small" :disabled="form.status>0"
  14. @click="confirmEdit" v-if="optionForm.disabled === true">编辑
  15. </el-button>
  16. <el-dropdown style="margin-right: 10px">
  17. <el-button type="primary" size="small">
  18. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  19. </el-button>
  20. <el-dropdown-menu slot="dropdown">
  21. <el-dropdown-item @click.native="pleaseCheck" :disabled="form.status>0">请核数据</el-dropdown-item>
  22. <el-dropdown-item @click.native="checkScheduleDialog = true,checkId = form.id">审核进度</el-dropdown-item>
  23. <el-dropdown-item @click.native="repealCancel" :disabled="form.status === 0 || !form.status" v-if="!detailData.id">撤销请核</el-dropdown-item>
  24. <!-- <el-dropdown-item @click.native="changeApproveOpen">特殊审批</el-dropdown-item>-->
  25. </el-dropdown-menu>
  26. </el-dropdown>
  27. <el-button class="el-button--small-yh" type="primary" size="small" :disabled="form.status>0"
  28. @click="editCustomer">保存数据
  29. </el-button>
  30. </div>
  31. </div>
  32. <trade-card title="基础资料" style="margin-top: 50px">
  33. <avue-form :option="optionForm" v-model="form" ref="form">
  34. <template slot="purchaseCompanyId" slot-scope="scope">
  35. <crop-select v-model="form.purchaseCompanyId" @getCorpData="(row)=>{getGSData(row,['form','purchaseCompanyName'])}" :disabled="scope.disabled"
  36. corpType="KH"/>
  37. </template>
  38. </avue-form>
  39. </trade-card>
  40. <trade-card title="箱信息">
  41. <avue-crud
  42. :option="option"
  43. :data="dataList"
  44. v-model="formTwo"
  45. ref="crud"
  46. :key="key"
  47. :before-open="beforeOpen"
  48. :upload-delete="uploadDelete"
  49. @row-save="rowSave"
  50. @row-update="rowUpdate"
  51. @resetColumn="resetColumnTwo('crud','option','optionBack',236.1)"
  52. @saveColumn="saveColumnTwo('crud','option','optionBack',236.1)">
  53. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  54. <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
  55. @click="$refs.crud.rowEdit(row,index)">编辑
  56. </el-button>
  57. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  58. @click="rowDel(row,index,'MX')">删除
  59. </el-button>
  60. </template>
  61. <template slot="addressForm" slot-scope="scope">
  62. <port-info v-model="formTwo.addressId" type="id" :disabled="scope.disabled" @balabalaTow="balabala"/>
  63. </template>
  64. <!-- <template slot="boxMakingCompanyForm" slot-scope="scope">-->
  65. <!-- <crop-select v-model="formTwo.boxMakingCompanyId" :disabled="scope.disabled" :refresh="false"-->
  66. <!-- @getCorpData="(row)=>{getGSData(row,['formTwo','boxMakingCompany'])}" corpType="GS"/>-->
  67. <!-- </template>-->
  68. <template slot="menuLeft" slot-scope="scope">
  69. <el-button :disabled="option.disabled" type="success" size="small" icon="el-icon-bottom" @click="importBox">
  70. 导入
  71. </el-button>
  72. <el-button class="el-icon-download" type="info" size="small" :disabled="!form.id" @click="openReport">报表打印</el-button>
  73. </template>
  74. </avue-crud>
  75. </trade-card>
  76. <!-- 报表-->
  77. <report-dialog
  78. :switchDialog="switchDialog"
  79. :reportId="form.id"
  80. reportName="卖箱"
  81. @onClose="onClose()"
  82. />
  83. <!-- 费用信息组件-->
  84. <box-cost v-model="dataListTwo" ref="boxCost" @resetTrigger="resetTrigger"></box-cost>
  85. <trade-card title="附件明细">
  86. <c-upload
  87. basic
  88. :data="tradingBoxFilesList"
  89. :disabled="disabled"
  90. deleteUrl="/api/blade-box-tube/tradingBoxFiles/remove"
  91. :enumerationValue="236.3"
  92. display
  93. />
  94. </trade-card>
  95. <el-dialog title="导入箱档案" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
  96. v-dialog-drag>
  97. <avue-form v-if="excelBox" :option="excelOption" v-model="excelForm" table-loading="excelLoading"
  98. :upload-before="uploadBefore" :upload-after="uploadAfter">
  99. <template slot="excelTemplate">
  100. <el-button type="primary" @click="derivation">
  101. 点击下载<i class="el-icon-download el-icon--right"></i>
  102. </el-button>
  103. </template>
  104. </avue-form>
  105. <p style="text-align: center;color: #DC0505">
  106. 温馨提示 第一次导入时请先下载模板
  107. </p>
  108. </el-dialog>
  109. <el-dialog
  110. append-to-body
  111. title="审批进度"
  112. class="el-dialogDeep"
  113. :visible.sync="checkScheduleDialog"
  114. width="40%"
  115. :close-on-click-modal="false"
  116. :destroy-on-close="true"
  117. :close-on-press-escape="false"
  118. v-dialog-drag
  119. >
  120. <check-schedule
  121. :checkId="checkId"
  122. :batchNo="batchNo"
  123. @choceScheduleFun="choceScheduleFun"
  124. ></check-schedule>
  125. </el-dialog>
  126. </div>
  127. </template>
  128. <script>
  129. import {
  130. detail,
  131. submit,
  132. tradingBoxFiles,
  133. selectArchivesList,
  134. tradingBoxItem,
  135. tradingBoxFees,
  136. pleaseCheck,
  137. repealCancel
  138. } from "@/api/boxManagement/buyContainer";
  139. import checkSchedule from "@/components/check/checkSchedule";
  140. import {selectByName} from "@/api/boxManagement";
  141. import reportDialog from "@/components/report-dialog/main.vue";
  142. import {getToken} from "@/util/auth";
  143. import {itemDetails} from "@/api/boxManagement/leaseIn";
  144. export default {
  145. name: "detailsPage",
  146. props: {
  147. onLoad: Object,
  148. detailData: Object
  149. },
  150. components:{checkSchedule,reportDialog},
  151. data() {
  152. return {
  153. switchDialog: false,
  154. excelBox: false,
  155. excelOption: {
  156. submitBtn: false,
  157. emptyBtn: false,
  158. column: [
  159. {
  160. label: "模板下载",
  161. prop: "excelTemplate",
  162. formslot: true,
  163. span: 24
  164. },
  165. {
  166. label: "模板上传",
  167. prop: "excelFile",
  168. type: "upload",
  169. drag: true,
  170. loadText: "模板上传中,请稍等",
  171. span: 24,
  172. propsHttp: {
  173. res: "data"
  174. },
  175. tip: "请上传 .xls,.xlsx 标准格式文件",
  176. action: "/api/blade-box-tube/tradingBoxRent/import-tradingBox-info"
  177. }
  178. ]
  179. },
  180. excelForm: {},
  181. key: 0,
  182. checkScheduleDialog: false,
  183. checkId: '',
  184. batchNo: '',
  185. breakConfiguration: {
  186. multipleChoices: false,
  187. multiple: false,
  188. disabled: false,
  189. searchShow: true,
  190. collapseTags: false,
  191. clearable: true,
  192. placeholder: "请点击右边按钮选择",
  193. dicData: []
  194. },
  195. form: {},
  196. formTwo: {},
  197. optionForm: {
  198. menuBtn: false,
  199. span: 6,
  200. column: [{
  201. label: '系统号',
  202. prop: 'sysNo',
  203. disabled: true
  204. },{
  205. label: '箱数',
  206. prop: 'boxNumber',
  207. disabled: true
  208. }, {
  209. label: '合同号',
  210. prop: 'contractNo',
  211. rules: [{
  212. required: true,
  213. message: " ",
  214. trigger: "blur"
  215. }]
  216. }, {
  217. label: '卖出公司',
  218. prop: 'purchaseCompanyId',
  219. rules: [{
  220. required: true,
  221. message: " ",
  222. trigger: "blur"
  223. }]
  224. }, {
  225. label: '卖出日期',
  226. prop: 'purchaseDate',
  227. type: "date",
  228. format: "yyyy-MM-dd",
  229. valueFormat: "yyyy-MM-dd HH:mm:ss",
  230. rules: [{
  231. required: true,
  232. message: " ",
  233. trigger: "blur"
  234. }]
  235. }, {
  236. label: '备注',
  237. prop: 'remarks',
  238. type: 'textarea',
  239. minRows: 1,
  240. span: 18
  241. }]
  242. },
  243. option: {},
  244. optionBack: {
  245. align: 'center',
  246. index: true,
  247. addBtnText: "录入明细",
  248. refreshBtn: false,
  249. dialogDrag: true,
  250. addBtn: true,
  251. span: 8,
  252. addRowBtn: false,
  253. cellBtn: false,
  254. editBtn: false,
  255. delBtn: false,
  256. menuWidth: 140,
  257. height:500,
  258. dialogTop: 25,
  259. dialogWidth: "80%",
  260. showSummary: true,
  261. sumColumnList: [{
  262. name: 'amount',
  263. type: 'sum',
  264. decimals: 2
  265. },{
  266. name: 'emptyWeight',
  267. type: 'sum',
  268. decimals: 2
  269. },{
  270. name: 'grossWeight',
  271. type: 'sum',
  272. decimals: 2
  273. },{
  274. name: 'tare',
  275. type: 'sum',
  276. decimals: 2
  277. },{
  278. name: 'loadingWeight',
  279. type: 'sum',
  280. decimals: 2
  281. },{
  282. name: 'volume',
  283. type: 'sum',
  284. decimals: 2
  285. }],
  286. column: [{
  287. label: '箱号',
  288. prop: 'code',
  289. width: 100,
  290. overHidden: true,
  291. filterable: true,
  292. remote: true,
  293. type: "select",
  294. dicUrl: "/api/blade-box-tube/archives/selectArchivesList?boxSource=购买&size=10&current=1&code={{key}}",
  295. props: {
  296. label: "code",
  297. value: "code"
  298. },
  299. rules: [{
  300. required: true,
  301. message: " ",
  302. trigger: "blur"
  303. }]
  304. }, {
  305. label: '币别',
  306. prop: 'currency',
  307. width: 100,
  308. overHidden: true,
  309. filterable: true,
  310. type: "select",
  311. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  312. props: {
  313. label: "dictValue",
  314. value: "dictKey"
  315. },
  316. rules: [{
  317. required: true,
  318. message: " ",
  319. trigger: "blur"
  320. }]
  321. }, {
  322. label: '金额',
  323. prop: 'amount',
  324. type: 'number',
  325. controls: false,
  326. overHidden: true,
  327. width: 100,
  328. rules: [{
  329. required: true,
  330. message: " ",
  331. trigger: "blur"
  332. }]
  333. }, {
  334. label: '箱类型',
  335. prop: 'boxTypeId',
  336. width: 100,
  337. overHidden: true,
  338. filterable: true,
  339. type: 'select',
  340. props: {
  341. label: 'name',
  342. value: 'id'
  343. },
  344. dicUrl: '/api/blade-client/container/listMessage'
  345. }, {
  346. label: '最新地点',
  347. prop: 'address',
  348. overHidden: true,
  349. formProp: 'addressId',
  350. width: 100,
  351. rules: [{
  352. required: true,
  353. message: " ",
  354. trigger: "blur"
  355. }]
  356. }, {
  357. label: '最新日期',
  358. prop: 'newDate',
  359. overHidden: true,
  360. width: 100,
  361. type: "date",
  362. format: "yyyy-MM-dd",
  363. valueFormat: "yyyy-MM-dd HH:mm:ss",
  364. rules: [{
  365. required: true,
  366. message: " ",
  367. trigger: "blur"
  368. }]
  369. }, {
  370. label: '箱来源',
  371. prop: 'boxSource',
  372. width: 100,
  373. overHidden: true,
  374. filterable: true,
  375. type: 'select',
  376. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
  377. props: {
  378. label: "dictValue",
  379. value: "dictKey"
  380. },
  381. rules: [{
  382. required: true,
  383. message: " ",
  384. trigger: "blur"
  385. }]
  386. }, {
  387. label: '箱状态',
  388. prop: 'boxStatus',
  389. width: 100,
  390. overHidden: true,
  391. filterable: true,
  392. type: 'select',
  393. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  394. props: {
  395. label: "dictValue",
  396. value: "dictKey"
  397. },
  398. rules: [{
  399. required: true,
  400. message: " ",
  401. trigger: "blur"
  402. }]
  403. }, {
  404. label: '空重(kg)',
  405. prop: 'emptyWeight',
  406. type: 'number',
  407. overHidden: true,
  408. controls: false,
  409. width: 100,
  410. rules: [{
  411. required: true,
  412. message: " ",
  413. trigger: "blur"
  414. }]
  415. }, {
  416. label: '毛重(kg)',
  417. prop: 'grossWeight',
  418. type: 'number',
  419. overHidden: true,
  420. controls: false,
  421. width: 100,
  422. rules: [{
  423. required: true,
  424. message: " ",
  425. trigger: "blur"
  426. }]
  427. }, {
  428. label: '皮重(kg)',
  429. prop: 'tare',
  430. overHidden: true,
  431. type: 'number',
  432. controls: false,
  433. width: 100
  434. }, {
  435. label: '装载重量(kg)',
  436. prop: 'loadingWeight',
  437. type: 'number',
  438. overHidden: true,
  439. controls: false,
  440. width: 100
  441. }, {
  442. label: '容积(m³)',
  443. prop: 'volume',
  444. type: 'number',
  445. overHidden: true,
  446. controls: false,
  447. width: 100
  448. }, {
  449. label: '状态',
  450. prop: 'status',
  451. width: 100,
  452. overHidden: true,
  453. filterable: true,
  454. type: 'select',
  455. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
  456. props: {
  457. label: "dictValue",
  458. value: "dictKey"
  459. }
  460. }, {
  461. label: '造箱公司',
  462. prop: 'boxMakingCompany',
  463. overHidden: true,
  464. width: 100,
  465. rules: [{
  466. required: true,
  467. message: " ",
  468. trigger: "blur"
  469. }]
  470. }, {
  471. label: '造箱日期',
  472. prop: 'boxMakingDate',
  473. width: 100,
  474. overHidden: true,
  475. type: "date",
  476. format: "yyyy-MM-dd",
  477. valueFormat: "yyyy-MM-dd HH:mm:ss",
  478. rules: [{
  479. required: true,
  480. message: " ",
  481. trigger: "blur"
  482. }]
  483. }, {
  484. label: '起租日期',
  485. prop: 'leaseCommencementDate',
  486. width: 100,
  487. overHidden: true,
  488. type: "date",
  489. format: "yyyy-MM-dd",
  490. valueFormat: "yyyy-MM-dd HH:mm:ss",
  491. rules: [{
  492. required: true,
  493. message: " ",
  494. trigger: "blur"
  495. }]
  496. }, {
  497. label: '箱龄',
  498. prop: 'boxAge',
  499. type: 'number',
  500. controls: false,
  501. overHidden: true,
  502. width: 100,
  503. rules: [{
  504. required: true,
  505. message: " ",
  506. trigger: "blur"
  507. }]
  508. }, {
  509. label: '照片',
  510. prop: 'tradingBoxFilesList',
  511. width: 200,
  512. overHidden: true,
  513. type: 'upload',
  514. span: 24,
  515. listType: 'picture-card',
  516. tip: '只能上传jpg/png文件,且不超过500kb',
  517. propsHttp: {
  518. url: 'link',
  519. name: 'originalName',
  520. res: 'data'
  521. },
  522. action: '/api/blade-resource/oss/endpoint/put-file'
  523. }, {
  524. label: '备注',
  525. prop: 'remarks',
  526. overHidden: true,
  527. type: 'textarea',
  528. minRows: 3,
  529. span: 24,
  530. width: 200
  531. }]
  532. },
  533. dataList: [],
  534. dataListTwo:[],
  535. tradingBoxFilesList: [],
  536. disabled: false,
  537. costData:{}
  538. }
  539. },
  540. async created() {
  541. this.option = await this.getColumnData(this.getColumnName(236.1), this.optionBack);
  542. selectByName("卖箱费").then(res => {
  543. this.costData = res.data.data
  544. })
  545. //下拉箱号带出对应信息
  546. this.findObject(this.option.column, "code").change = ({value, column}) => {
  547. selectArchivesList({code: value}).then(res => {
  548. for (let item of res.data.data) {
  549. if (value == item.code) {
  550. this.formTwo = {
  551. boxTypeId: item.typeId,
  552. boxType: item.name,
  553. boxSource: item.boxSource,
  554. boxStatus: item.boxStatus,
  555. emptyWeight: item.emptyWeight,
  556. grossWeight: item.gorssWeight,
  557. boxMakingCompany: item.boxMakingCompany,
  558. tare: item.tare,
  559. loadingWeight: item.loadingWeight,
  560. volume: item.volume,
  561. address:item.address,
  562. addressId:item.addressId,
  563. newDate:item.newDate,
  564. boxMakingDate:item.boxMakingDate,
  565. leaseCommencementDate:item.leaseCommencementDate,
  566. boxAge:item.boxAge
  567. }
  568. }
  569. }
  570. })
  571. }
  572. this.key++
  573. if (this.onLoad.id && this.detailData.id) {
  574. this.refresh(this.onLoad.id,true)
  575. }else if (this.onLoad.id){
  576. this.refresh(this.onLoad.id,true)
  577. }
  578. },
  579. methods: {
  580. // 报表
  581. openReport() {
  582. this.switchDialog = !this.switchDialog;
  583. },
  584. // 报表关闭
  585. onClose(val) {
  586. this.switchDialog = val;
  587. },
  588. uploadBefore(file, done, loading) {
  589. loading = true;
  590. done();
  591. },
  592. derivation() {
  593. window.open(`/api/blade-box-tube/tradingBoxRent/export-tradingBox-info?${this.website.tokenHeader}=${getToken()}`);
  594. },
  595. uploadAfter(res, done, loading, column) {
  596. this.excelBox = false;
  597. if (typeof res.message === "string") return
  598. for (let item of this.dataList) {
  599. for (let li of res.tradingBoxItemList) {
  600. if (item.code === li.code) {
  601. return this.$message.error(`箱号:${item.code}重复!`);
  602. }
  603. }
  604. }
  605. this.dataList = this.dataList.concat(res.tradingBoxItemList)
  606. this.dataListTwo = this.dataListTwo.concat(res.tradingBoxFeesList)
  607. this.$message.success("导入成功!");
  608. loading = false;
  609. done();
  610. },
  611. importBox() {
  612. this.findObject(this.excelOption.column, "excelFile").data = {
  613. corpId: this.form.purchaseCompanyId,
  614. corpName: this.form.purchaseCompanyName,
  615. billType: "SELL"
  616. }
  617. this.excelBox = true
  618. },
  619. confirmEdit() {
  620. if (this.form.status > 0) {
  621. //基础资料
  622. this.$set(this.optionForm, "disabled", true)
  623. //箱信息
  624. this.$set(this.option, "disabled", true)
  625. this.$set(this.option, "addBtn", false)
  626. this.$set(this.option, "menu", false)
  627. //费用信息
  628. this.$set(this.$refs.boxCost.option,"disabled",true)
  629. this.$set(this.$refs.boxCost.option,"addBtn",false)
  630. this.$set(this.$refs.boxCost.option,"menu",false)
  631. //附件和顶部按钮
  632. this.disabled = true
  633. } else {
  634. //基础资料
  635. this.$set(this.optionForm, "disabled", false)
  636. //箱信息
  637. this.$set(this.option, "disabled", false)
  638. this.$set(this.option, "addBtn", true)
  639. this.$set(this.option, "menu", true)
  640. //费用信息
  641. this.$set(this.$refs.boxCost.option,"disabled",false)
  642. this.$set(this.$refs.boxCost.option,"addBtn",true)
  643. this.$set(this.$refs.boxCost.option,"menu",true)
  644. //附件和顶部按钮
  645. this.disabled = false
  646. }
  647. },
  648. // 明细删除
  649. rowDel(row, index, type) {
  650. this.$confirm("确定将选择数据删除?", {
  651. confirmButtonText: "确定",
  652. cancelButtonText: "取消",
  653. type: "warning"
  654. }).then(() => {
  655. if (row.id) {
  656. tradingBoxItem(row.id).then(res => {
  657. if (res.data.success) {
  658. this.$message.success("操作成功!");
  659. this.dataList.splice(index, 1);
  660. if (this.dataListTwo.length > 0) {
  661. for (let item in this.dataListTwo) {
  662. if (this.dataListTwo[item].code == row.code) {
  663. if (this.dataListTwo[item].autoGenerate == 1) {
  664. if (this.dataListTwo[item].id) {
  665. tradingBoxFees(this.dataListTwo[item].id).then(res => {
  666. if (res.data.success) {
  667. this.dataListTwo.splice(index, 1);
  668. }
  669. });
  670. } else {
  671. this.dataListTwo.splice(Number(item), 1);
  672. }
  673. }
  674. }
  675. }
  676. }
  677. }
  678. });
  679. } else {
  680. this.dataList.splice(index, 1);
  681. this.$message.success("操作成功!");
  682. if (this.dataListTwo.length > 0) {
  683. for (let item in this.dataListTwo) {
  684. if (this.dataListTwo[item].code == row.code) {
  685. if (this.dataListTwo[item].autoGenerate == 1) {
  686. this.dataListTwo.splice(Number(item), 1);
  687. }
  688. }
  689. }
  690. }
  691. }
  692. }
  693. )
  694. ;
  695. },
  696. balabala(val) {
  697. if (val === null) {
  698. this.formTwo.address = ''
  699. } else {
  700. this.formTwo.address = val.name
  701. }
  702. },
  703. //选择费用名称
  704. selectValue(value) {
  705. this.formThree.itemName = value.cname
  706. },
  707. //撤销
  708. repealCancel(){
  709. this.$confirm("您确定撤回此次申请吗?", {
  710. confirmButtonText: "确定",
  711. cancelButtonText: "取消",
  712. type: "warning"
  713. }).then(() => {
  714. const data = {
  715. id : this.form.id,
  716. pageLabel:"卖箱",
  717. checkFlag: 1,
  718. }
  719. repealCancel(data).then(res => {
  720. this.$message.success('撤回成功')
  721. this.refresh(this.form.id)
  722. })
  723. })
  724. },
  725. // 请核
  726. pleaseCheck() {
  727. this.$confirm("您确定提交请核申请吗?", {
  728. confirmButtonText: "确定",
  729. cancelButtonText: "取消",
  730. type: "warning"
  731. }).then(() => {
  732. this.$refs["form"].validate((valid,done) => {
  733. done()
  734. if (valid) {
  735. if (this.dataList.length === 0) {
  736. return this.$message.error("箱信息不能为空")
  737. }
  738. if (this.$refs.boxCost.dataList.length === 0) {
  739. return this.$message.error("费用信息不能为空")
  740. }else {
  741. for (let item of this.$refs.boxCost.dataList){
  742. if (!item.id){
  743. return this.$message.error("费用信息未保存")
  744. }
  745. }
  746. }
  747. let data = {
  748. ...this.form,
  749. tradingBoxItemsList: this.dataList,
  750. tradingBoxFeesList: this.dataListTwo,
  751. tradingBoxFilesList: this.tradingBoxFilesList,
  752. type: "SELL"
  753. }
  754. const loading = this.$loading({
  755. lock: true,
  756. text: '加载中',
  757. spinner: 'el-icon-loading',
  758. background: 'rgba(255,255,255,0.7)'
  759. });
  760. submit(data).then(res => {
  761. const data = {
  762. id: res.data.data.id,
  763. url: '/boxManagement/buyContainer/index',
  764. pageStatus: "this.$store.getters.domSaleStatus",
  765. pageLabel: "卖箱",
  766. checkFlag: 2,
  767. }
  768. pleaseCheck({
  769. ...data,
  770. type: "SELL"
  771. }).then(rest => {
  772. loading.close();
  773. this.$message.success('请核成功')
  774. this.refresh(res.data.data.id)
  775. }).catch(()=>{
  776. loading.close();
  777. })
  778. }).catch(()=>{
  779. loading.close();
  780. })
  781. }
  782. });
  783. })
  784. },
  785. //审核关闭
  786. choceScheduleFun(){
  787. this.checkScheduleDialog = false
  788. },
  789. refresh(id,type) {
  790. const loading = this.$loading({
  791. lock: true,
  792. text: '加载中',
  793. spinner: 'el-icon-loading',
  794. background: 'rgba(255,255,255,0.7)'
  795. });
  796. detail({id: id}).then(res => {
  797. this.form = res.data.data
  798. this.dataList = res.data.data.tradingBoxItemsList
  799. this.dataListTwo = res.data.data.tradingBoxFeesList
  800. this.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  801. delete this.form.tradingBoxItemsList
  802. delete this.form.tradingBoxFeesList
  803. delete this.form.tradingBoxFilesList
  804. this.$refs.boxCost.code = this.form.code
  805. loading.close();
  806. if (type) {
  807. //基础资料
  808. this.$set(this.optionForm, "disabled", true)
  809. //箱信息
  810. this.$set(this.option, "disabled", true)
  811. this.$set(this.option, "addBtn", false)
  812. this.$set(this.option, "menu", false)
  813. //费用信息
  814. this.$set(this.$refs.boxCost.option, "disabled", true)
  815. this.$set(this.$refs.boxCost.option, "addBtn", false)
  816. this.$set(this.$refs.boxCost.option, "menu", false)
  817. //附件和顶部按钮
  818. this.disabled = true
  819. }else {
  820. if (this.form.status > 0) {
  821. //基础资料
  822. this.$set(this.optionForm, "disabled", true)
  823. //箱信息
  824. this.$set(this.option, "disabled", true)
  825. this.$set(this.option, "addBtn", false)
  826. this.$set(this.option, "menu", false)
  827. //费用信息
  828. this.$set(this.$refs.boxCost.option, "disabled", true)
  829. this.$set(this.$refs.boxCost.option, "addBtn", false)
  830. this.$set(this.$refs.boxCost.option,"menu",false)
  831. //附件和顶部按钮
  832. this.disabled = true
  833. } else {
  834. //基础资料
  835. this.$set(this.optionForm, "disabled", false)
  836. //箱信息
  837. this.$set(this.option, "disabled", false)
  838. this.$set(this.option, "addBtn", true)
  839. this.$set(this.option, "menu", true)
  840. //费用信息
  841. this.$set(this.$refs.boxCost.option, "disabled", false)
  842. this.$set(this.$refs.boxCost.option, "addBtn", true)
  843. this.$set(this.$refs.boxCost.option, "menu", true)
  844. //附件和顶部按钮
  845. this.disabled = false
  846. }
  847. }
  848. })
  849. },
  850. //新增修改
  851. editCustomer() {
  852. this.$refs["form"].validate((valid,done) => {
  853. done()
  854. if (valid) {
  855. let data = {
  856. ...this.form,
  857. tradingBoxItemsList: this.dataList,
  858. tradingBoxFeesList: this.dataListTwo,
  859. tradingBoxFilesList: this.tradingBoxFilesList,
  860. type: "SELL"
  861. }
  862. const loading = this.$loading({
  863. lock: true,
  864. text: '加载中',
  865. spinner: 'el-icon-loading',
  866. background: 'rgba(255,255,255,0.7)'
  867. });
  868. submit(data).then(res => {
  869. if (this.form.id) {
  870. this.$message.success("修改成功")
  871. } else {
  872. this.$message.success("新增成功")
  873. }
  874. loading.close();
  875. this.refresh(res.data.data.id)
  876. }).catch(()=>{
  877. loading.close();
  878. })
  879. }
  880. });
  881. },
  882. //打开表单前
  883. beforeOpen(done,type){
  884. if (type === "add"){
  885. this.formTwo.boxSource = this.$refs.crud.DIC.boxSource.length === 0?"":this.$refs.crud.DIC.boxSource[0].dictKey
  886. this.formTwo.status = this.$refs.crud.DIC.status.length === 0?"":this.$refs.crud.DIC.status.length>1?this.$refs.crud.DIC.status[2].dictKey:this.$refs.crud.DIC.status[0].dictKey
  887. }
  888. if(['view','edit'].includes(type)){
  889. itemDetails({id:this.formTwo.id,type: "SELL"}).then(res=>{
  890. if (this.formTwo.tradingBoxFilesList.length === 0){
  891. this.formTwo.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  892. }
  893. })
  894. // 查看和编辑逻辑
  895. }
  896. done();
  897. },
  898. rowSave(form,done,loading) {
  899. let result = this.dataList.some((item) => {
  900. if (item.code == form.code) {
  901. return true
  902. }
  903. })
  904. if (result === true) {
  905. this.$message.error("已存在此箱号");
  906. return loading();
  907. }
  908. done(form)
  909. this.getWorkDicts("currency").then(res => {
  910. for (let item of res.data.data){
  911. if (item.dictValue == form.currency){
  912. form.exchangeRate = item.remark
  913. }
  914. }
  915. this.dataListTwo.push({
  916. corpId: this.form.purchaseCompanyId,
  917. corpName: this.form.purchaseCompanyName,
  918. code: form.code,
  919. itemId: this.costData.id,
  920. itemName: this.costData.cname,
  921. currency: form.currency,
  922. price: form.amount,
  923. quantity: 1,
  924. autoGenerate: 1,
  925. feesType:1,
  926. exchangeRate:form.exchangeRate || 1,
  927. amount: form.amount,
  928. })
  929. });
  930. },
  931. rowUpdate(form, index, done, loading) {
  932. form.boxType = form.$boxTypeId
  933. done(form)
  934. this.getWorkDicts("currency").then(res => {
  935. for (let item of res.data.data){
  936. if (item.dictValue == form.currency){
  937. form.exchangeRate = item.remark
  938. }
  939. }
  940. if (this.dataListTwo.length > 0) {
  941. for (let item in this.dataListTwo) {
  942. if (this.dataListTwo[item].code == form.code) {
  943. if (this.dataListTwo[item].autoGenerate == 1) {
  944. this.dataListTwo.splice(Number(item), 1, {
  945. ...this.dataListTwo[item],
  946. corpId: this.form.purchaseCompanyId,
  947. corpName: this.form.purchaseCompanyName,
  948. code: form.code,
  949. currency: form.currency,
  950. price: form.amount,
  951. exchangeRate:form.exchangeRate || 1,
  952. amount: form.amount
  953. })
  954. this.key++
  955. }
  956. }
  957. }
  958. }
  959. });
  960. },
  961. //删除图片
  962. uploadDelete(file, column) {
  963. return new Promise((resolve, reject) => {
  964. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  965. confirmButtonText: '确定',
  966. cancelButtonText: '取消',
  967. type: 'warning'
  968. }).then(() => {
  969. if (this.formTwo.tradingBoxFilesList[file.uid].id) {
  970. tradingBoxFiles(this.formTwo.tradingBoxFilesList[file.uid].id).then(res => {
  971. this.$message({
  972. type: 'success',
  973. message: '删除成功!'
  974. });
  975. resolve();
  976. })
  977. } else {
  978. resolve();
  979. }
  980. }).catch(()=>{
  981. reject();
  982. this.$message({
  983. type: "info",
  984. message: "已取消删除"
  985. });
  986. })
  987. })
  988. },
  989. getGSData(row,type) {
  990. this[type[0]][type[1]] = row.cname
  991. },
  992. backToList(type) {
  993. if (type == 0){
  994. if (this.detailData.id){
  995. this.$router.push({
  996. path: '/boxManagement/sellingContainers/index'
  997. });
  998. }
  999. this.$emit("backToList",type);
  1000. }else if (type == 1){
  1001. this.$router.push({
  1002. path: '/approveData/index'
  1003. });
  1004. this.$emit("backToList",type);
  1005. }
  1006. },
  1007. //自定义列保存
  1008. async saveColumnTwo(ref, option, optionBack, code) {
  1009. /**
  1010. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1011. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1012. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1013. */
  1014. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1015. if (inSave) {
  1016. this.$message.success("保存成功");
  1017. //关闭窗口
  1018. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1019. }
  1020. },
  1021. resetTrigger(){
  1022. if (this.optionForm.disabled == true) {
  1023. if (this.form.status > 0) {
  1024. //基础资料
  1025. this.$set(this.optionForm, "disabled", true)
  1026. //箱信息
  1027. this.$set(this.option, "disabled", true)
  1028. this.$set(this.option, "addBtn", false)
  1029. this.$set(this.option, "menu", false)
  1030. //费用信息
  1031. this.$set(this.$refs.boxCost.option, "disabled", true)
  1032. this.$set(this.$refs.boxCost.option, "addBtn", false)
  1033. this.$set(this.$refs.boxCost.option,"menu",false)
  1034. //附件和顶部按钮
  1035. this.disabled = true
  1036. } else {
  1037. //基础资料
  1038. this.$set(this.optionForm, "disabled", false)
  1039. //箱信息
  1040. this.$set(this.option, "disabled", false)
  1041. this.$set(this.option, "addBtn", true)
  1042. this.$set(this.option, "menu", true)
  1043. //费用信息
  1044. this.$set(this.$refs.boxCost.option, "disabled", false)
  1045. this.$set(this.$refs.boxCost.option, "addBtn", true)
  1046. this.$set(this.$refs.boxCost.option, "menu", true)
  1047. //附件和顶部按钮
  1048. this.disabled = false
  1049. }
  1050. }else {
  1051. //基础资料
  1052. this.$set(this.optionForm, "disabled", false)
  1053. //箱信息
  1054. this.$set(this.option, "disabled", false)
  1055. this.$set(this.option, "addBtn", true)
  1056. this.$set(this.option, "menu", true)
  1057. //费用信息
  1058. this.$set(this.$refs.boxCost.option, "disabled", false)
  1059. this.$set(this.$refs.boxCost.option, "addBtn", true)
  1060. this.$set(this.$refs.boxCost.option, "menu", true)
  1061. //附件和顶部按钮
  1062. this.disabled = false
  1063. }
  1064. },
  1065. //自定义列重置
  1066. async resetColumnTwo(ref, option, optionBack, code) {
  1067. this[option] = this[optionBack];
  1068. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1069. if (inSave) {
  1070. this.resetTrigger()
  1071. this.$message.success("重置成功");
  1072. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1073. }
  1074. }
  1075. }
  1076. }
  1077. </script>
  1078. <style scoped>
  1079. ::v-deep .el-form-item {
  1080. margin-bottom: 8px;
  1081. }
  1082. </style>