detailsPage.vue 42 KB

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