detailsPage.vue 40 KB

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