detailsPage.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239
  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="balabala"/>
  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. }, {
  444. label: '最新地点',
  445. prop: 'address',
  446. overHidden: true,
  447. formProp: 'addressId',
  448. width: 100,
  449. rules: [{
  450. required: true,
  451. message: " ",
  452. trigger: "blur"
  453. }]
  454. }, {
  455. label: '最新日期',
  456. prop: 'newDate',
  457. overHidden: true,
  458. width: 100,
  459. type: "date",
  460. format: "yyyy-MM-dd",
  461. valueFormat: "yyyy-MM-dd HH:mm:ss",
  462. rules: [{
  463. required: true,
  464. message: " ",
  465. trigger: "blur"
  466. }]
  467. }, {
  468. label: '箱来源',
  469. prop: 'boxSource',
  470. width: 100,
  471. overHidden: true,
  472. filterable: true,
  473. type: 'select',
  474. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
  475. props: {
  476. label: "dictValue",
  477. value: "dictKey"
  478. },
  479. rules: [{
  480. required: true,
  481. message: " ",
  482. trigger: "blur"
  483. }]
  484. }, {
  485. label: '箱状态',
  486. prop: 'boxStatus',
  487. width: 100,
  488. overHidden: true,
  489. filterable: true,
  490. type: 'select',
  491. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  492. props: {
  493. label: "dictValue",
  494. value: "dictKey"
  495. },
  496. rules: [{
  497. required: true,
  498. message: " ",
  499. trigger: "blur"
  500. }]
  501. }, {
  502. label: '堆存状态',
  503. prop: 'stackingStatus',
  504. display:false,
  505. overHidden: true,
  506. width: 100
  507. }, {
  508. label: '堆存时间',
  509. prop: 'stackingDate',
  510. width: 100,
  511. overHidden: true,
  512. type: "date",
  513. display:false,
  514. format: "yyyy-MM-dd",
  515. valueFormat: "yyyy-MM-dd HH:mm:ss"
  516. }, {
  517. label: '空重(kg)',
  518. prop: 'emptyWeight',
  519. type: 'number',
  520. overHidden: true,
  521. controls: false,
  522. width: 100,
  523. rules: [{
  524. required: true,
  525. message: " ",
  526. trigger: "blur"
  527. }]
  528. }, {
  529. label: '毛重(kg)',
  530. prop: 'grossWeight',
  531. type: 'number',
  532. overHidden: true,
  533. controls: false,
  534. width: 100,
  535. rules: [{
  536. required: true,
  537. message: " ",
  538. trigger: "blur"
  539. }]
  540. }, {
  541. label: '皮重(kg)',
  542. prop: 'tare',
  543. overHidden: true,
  544. type: 'number',
  545. controls: false,
  546. width: 100
  547. }, {
  548. label: '装载重量(kg)',
  549. prop: 'loadingWeight',
  550. type: 'number',
  551. overHidden: true,
  552. controls: false,
  553. width: 100
  554. }, {
  555. label: '容积(m³)',
  556. prop: 'volume',
  557. type: 'number',
  558. overHidden: true,
  559. controls: false,
  560. width: 100
  561. }, {
  562. label: '造箱公司',
  563. prop: 'boxMakingCompany',
  564. overHidden: true,
  565. width: 100,
  566. rules: [{
  567. required: true,
  568. message: " ",
  569. trigger: "blur"
  570. }]
  571. }, {
  572. label: '造箱日期',
  573. prop: 'boxMakingDate',
  574. width: 100,
  575. overHidden: true,
  576. type: "date",
  577. format: "yyyy-MM-dd",
  578. valueFormat: "yyyy-MM-dd HH:mm:ss",
  579. rules: [{
  580. required: true,
  581. message: " ",
  582. trigger: "blur"
  583. }]
  584. }, {
  585. label: '箱来源日期',
  586. prop: 'leaseCommencementDate',
  587. width: 100,
  588. overHidden: true,
  589. type: "date",
  590. format: "yyyy-MM-dd",
  591. valueFormat: "yyyy-MM-dd HH:mm:ss",
  592. rules: [{
  593. required: true,
  594. message: " ",
  595. trigger: "blur"
  596. }]
  597. }, {
  598. label: '箱龄',
  599. prop: 'boxAge',
  600. type: 'number',
  601. controls: false,
  602. overHidden: true,
  603. width: 100,
  604. rules: [{
  605. required: true,
  606. message: " ",
  607. trigger: "blur"
  608. }]
  609. }, {
  610. label: '照片',
  611. prop: 'tradingBoxFilesList',
  612. width: 200,
  613. overHidden: true,
  614. type: 'upload',
  615. span: 24,
  616. listType: 'picture-card',
  617. tip: '只能上传jpg/png文件,且不超过500kb',
  618. propsHttp: {
  619. url: 'link',
  620. name: 'originalName',
  621. res: 'data'
  622. },
  623. action: '/api/blade-resource/oss/endpoint/put-file'
  624. }, {
  625. label: '备注',
  626. prop: 'remarks',
  627. overHidden: true,
  628. type: 'textarea',
  629. minRows: 3,
  630. span: 24,
  631. width: 200
  632. }]
  633. },
  634. dataList: [],
  635. dataListTwo: [],
  636. tradingBoxFilesList: [],
  637. selectionList: [],
  638. disabled: false,
  639. costData: {}
  640. }
  641. },
  642. async created() {
  643. this.option = await this.getColumnData(this.getColumnName(235.1), this.optionBack);
  644. selectByName("买箱费").then(res => {
  645. this.costData = res.data.data
  646. })
  647. //下拉箱号带出对应信息
  648. // this.findObject(this.option.column, "code").change = ({value, column}) => {
  649. // selectArchivesList({code: value}).then(res => {
  650. // for (let item of res.data.data) {
  651. // if (value == item.code) {
  652. // this.formTwo = {
  653. // boxSource: item.boxSource,
  654. // boxStatus: item.boxStatus,
  655. // emptyWeight: item.emptyWeight,
  656. // grossWeight: item.gorssWeight,
  657. // tare: item.tare,
  658. // loadingWeight: item.loadingWeight,
  659. // volume: item.volume,
  660. // }
  661. // }
  662. // }
  663. // })
  664. // }
  665. this.key++
  666. if (this.onLoad.id && this.detailData.id) {
  667. this.refresh(this.onLoad.id,true)
  668. }else if (this.onLoad.id){
  669. this.refresh(this.onLoad.id,true)
  670. }
  671. },
  672. methods: {
  673. //关闭审核
  674. choceCheckFun() {
  675. this.checkDialog = false;
  676. },
  677. // 报表
  678. openReport() {
  679. this.switchDialog = !this.switchDialog;
  680. },
  681. //堆存
  682. stockpiling() {
  683. this.title = "堆存"
  684. const date = new Date();
  685. this.formState.rentDate = dateFormat(date, "yyyy-MM-dd") + " 00:00:00"
  686. this.dialogVisible = true
  687. },
  688. // 报表关闭
  689. onClose(val) {
  690. this.switchDialog = val;
  691. },
  692. importBox() {
  693. this.findObject(this.excelOption.column, "excelFile").data = {
  694. corpId: this.form.purchaseCompanyId,
  695. corpName: this.form.purchaseCompanyName,
  696. billType: "BUY"
  697. }
  698. this.excelBox = true
  699. },
  700. uploadBefore(file, done, loading) {
  701. loading = true;
  702. done();
  703. },
  704. uploadAfter(res, done, loading, column) {
  705. this.excelBox = false;
  706. if (typeof res.message === "string") return
  707. for (let item of this.dataList) {
  708. for (let li of res.tradingBoxItemList) {
  709. if (item.code === li.code) {
  710. return this.$message.error(`箱号:${item.code}重复!`);
  711. }
  712. }
  713. }
  714. this.dataList = this.dataList.concat(res.tradingBoxItemList)
  715. this.dataListTwo = this.dataListTwo.concat(res.tradingBoxFeesList)
  716. this.$message.success("导入成功!");
  717. loading = false;
  718. done();
  719. },
  720. derivation() {
  721. window.open(`/api/blade-box-tube/tradingBoxRent/export-tradingBox-info?${this.website.tokenHeader}=${getToken()}`);
  722. },
  723. confirmEdit() {
  724. if (this.form.status > 0) {
  725. //基础资料
  726. this.$set(this.optionForm, "disabled", true)
  727. //箱信息
  728. this.$set(this.option, "disabled", true)
  729. this.$set(this.option, "addBtn", false)
  730. this.$set(this.option, "menu", false)
  731. //费用信息
  732. this.$set(this.$refs.boxCost.option, "disabled", true)
  733. this.$set(this.$refs.boxCost.option,"addBtn",false)
  734. this.$set(this.$refs.boxCost.option,"menu",false)
  735. //附件和顶部按钮
  736. this.disabled = true
  737. } else {
  738. //基础资料
  739. this.$set(this.optionForm, "disabled", false)
  740. //箱信息
  741. this.$set(this.option, "disabled", false)
  742. this.$set(this.option, "addBtn", true)
  743. this.$set(this.option, "menu", true)
  744. //费用信息
  745. this.$set(this.$refs.boxCost.option,"disabled",false)
  746. this.$set(this.$refs.boxCost.option,"addBtn",true)
  747. this.$set(this.$refs.boxCost.option,"menu",true)
  748. //附件和顶部按钮
  749. this.disabled = false
  750. }
  751. this.key++
  752. },
  753. // 明细删除
  754. rowDel(row, index, type) {
  755. this.$confirm("确定将选择数据删除?", {
  756. confirmButtonText: "确定",
  757. cancelButtonText: "取消",
  758. type: "warning"
  759. }).then(() => {
  760. if (row.id) {
  761. tradingBoxItem(row.id).then(res => {
  762. if (res.data.success) {
  763. this.$message.success("操作成功!");
  764. this.dataList.splice(index, 1);
  765. if (this.dataListTwo.length > 0) {
  766. for (let item in this.dataListTwo) {
  767. if (this.dataListTwo[item].code == row.code) {
  768. if (this.dataListTwo[item].autoGenerate == 1) {
  769. if (this.dataListTwo[item].id) {
  770. tradingBoxFees(this.dataListTwo[item].id).then(res => {
  771. if (res.data.success) {
  772. this.dataListTwo.splice(index, 1);
  773. }
  774. });
  775. } else {
  776. this.dataListTwo.splice(Number(item), 1);
  777. }
  778. }
  779. }
  780. }
  781. }
  782. }
  783. });
  784. } else {
  785. this.dataList.splice(index, 1);
  786. this.$message.success("操作成功!");
  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. this.dataListTwo.splice(Number(item), 1);
  792. }
  793. }
  794. }
  795. }
  796. }
  797. }
  798. )
  799. ;
  800. },
  801. balabala(val) {
  802. if (val === null) {
  803. this.formTwo.address = ''
  804. } else {
  805. this.formTwo.address = val.name
  806. }
  807. },
  808. //选择费用名称
  809. selectValue(value) {
  810. this.formThree.itemName = value.cname
  811. },
  812. //撤销
  813. repealCancel(){
  814. this.$confirm("您确定撤回此次申请吗?", {
  815. confirmButtonText: "确定",
  816. cancelButtonText: "取消",
  817. type: "warning"
  818. }).then(() => {
  819. const data = {
  820. id : this.form.id,
  821. pageLabel:"买箱",
  822. checkFlag: 1,
  823. }
  824. const loading = this.$loading({
  825. lock: true,
  826. text: '加载中',
  827. spinner: 'el-icon-loading',
  828. background: 'rgba(255,255,255,0.7)'
  829. });
  830. repealCancel(data).then(res => {
  831. loading.close();
  832. this.$message.success('撤回成功')
  833. this.refresh(this.form.id)
  834. }).catch(()=>{
  835. loading.close();
  836. })
  837. })
  838. },
  839. // 请核
  840. pleaseCheck() {
  841. this.$confirm("您确定提交请核申请吗?", {
  842. confirmButtonText: "确定",
  843. cancelButtonText: "取消",
  844. type: "warning"
  845. }).then(() => {
  846. this.$refs["form"].validate((valid,done) => {
  847. done()
  848. if (valid) {
  849. if (this.dataList.length === 0) {
  850. return this.$message.error("箱信息不能为空")
  851. }
  852. if (this.$refs.boxCost.dataList.length === 0) {
  853. return this.$message.error("费用信息不能为空")
  854. }else {
  855. for (let item of this.$refs.boxCost.dataList){
  856. if (!item.id){
  857. return this.$message.error("费用信息未保存")
  858. }
  859. }
  860. }
  861. let data = {
  862. ...this.form,
  863. tradingBoxItemsList: this.dataList,
  864. tradingBoxFeesList: this.dataListTwo,
  865. tradingBoxFilesList: this.tradingBoxFilesList,
  866. type: "BUY"
  867. }
  868. const loading = this.$loading({
  869. lock: true,
  870. text: '加载中',
  871. spinner: 'el-icon-loading',
  872. background: 'rgba(255,255,255,0.7)'
  873. });
  874. submit(data).then(res => {
  875. const data = {
  876. id: res.data.data.id,
  877. url: '/boxManagement/buyContainer/index',
  878. pageStatus: "this.$store.getters.domSaleStatus",
  879. pageLabel: "买箱",
  880. checkFlag: 1,
  881. }
  882. pleaseCheck({
  883. ...data,
  884. type: "BUY"
  885. }).then(rest => {
  886. loading.close();
  887. this.$message.success('请核成功')
  888. this.refresh(res.data.data.id)
  889. }).catch(()=>{
  890. loading.close();
  891. })
  892. }).catch(()=>{
  893. loading.close();
  894. })
  895. }
  896. });
  897. })
  898. },
  899. //审核关闭
  900. choceScheduleFun(){
  901. this.checkScheduleDialog = false
  902. },
  903. refresh(id,type) {
  904. const loading = this.$loading({
  905. lock: true,
  906. text: '加载中',
  907. spinner: 'el-icon-loading',
  908. background: 'rgba(255,255,255,0.7)'
  909. });
  910. detail({id: id}).then(res => {
  911. this.form = res.data.data
  912. this.dataList = res.data.data.tradingBoxItemsList
  913. this.dataListTwo = res.data.data.tradingBoxFeesList
  914. this.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  915. delete this.form.tradingBoxItemsList
  916. delete this.form.tradingBoxFeesList
  917. delete this.form.tradingBoxFilesList
  918. this.$refs.boxCost.code = this.form.code
  919. loading.close();
  920. if (type) {
  921. //基础资料
  922. this.$set(this.optionForm, "disabled", true)
  923. //箱信息
  924. this.$set(this.option, "disabled", true)
  925. this.$set(this.option, "addBtn", false)
  926. this.$set(this.option, "menu", false)
  927. //费用信息
  928. this.$set(this.$refs.boxCost.option, "disabled", true)
  929. this.$set(this.$refs.boxCost.option, "addBtn", false)
  930. this.$set(this.$refs.boxCost.option, "menu", false)
  931. //附件和顶部按钮
  932. this.disabled = true
  933. }else {
  934. if (this.form.status > 0) {
  935. //基础资料
  936. this.$set(this.optionForm, "disabled", true)
  937. //箱信息
  938. this.$set(this.option, "disabled", true)
  939. this.$set(this.option, "addBtn", false)
  940. this.$set(this.option, "menu", false)
  941. //费用信息
  942. this.$set(this.$refs.boxCost.option, "disabled", true)
  943. this.$set(this.$refs.boxCost.option, "addBtn", false)
  944. this.$set(this.$refs.boxCost.option,"menu",false)
  945. //附件和顶部按钮
  946. this.disabled = true
  947. } else {
  948. //基础资料
  949. this.$set(this.optionForm, "disabled", false)
  950. //箱信息
  951. this.$set(this.option, "disabled", false)
  952. this.$set(this.option, "addBtn", true)
  953. this.$set(this.option, "menu", true)
  954. //费用信息
  955. this.$set(this.$refs.boxCost.option, "disabled", false)
  956. this.$set(this.$refs.boxCost.option, "addBtn", true)
  957. this.$set(this.$refs.boxCost.option, "menu", true)
  958. //附件和顶部按钮
  959. this.disabled = false
  960. }
  961. }
  962. })
  963. },
  964. //新增修改
  965. editCustomer() {
  966. this.$refs["form"].validate((valid,done) => {
  967. done()
  968. if (valid) {
  969. let data = {
  970. ...this.form,
  971. tradingBoxItemsList: this.dataList,
  972. tradingBoxFeesList: this.dataListTwo,
  973. tradingBoxFilesList: this.tradingBoxFilesList,
  974. type: "BUY"
  975. }
  976. const loading = this.$loading({
  977. lock: true,
  978. text: '加载中',
  979. spinner: 'el-icon-loading',
  980. background: 'rgba(255,255,255,0.7)'
  981. });
  982. submit(data).then(res => {
  983. if (this.form.id) {
  984. this.$message.success("修改成功")
  985. } else {
  986. this.$message.success("新增成功")
  987. }
  988. loading.close();
  989. this.refresh(res.data.data.id)
  990. }).catch(()=>{
  991. loading.close();
  992. })
  993. }
  994. });
  995. },
  996. rowSave(form,done,loading) {
  997. let result = this.dataList.some((item) => {
  998. if (item.code == form.code) {
  999. return true
  1000. }
  1001. })
  1002. if (result === true) {
  1003. this.$message.error("已存在此箱号");
  1004. return loading();
  1005. }
  1006. done(form)
  1007. getParities({
  1008. currency: form.currency,
  1009. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00"
  1010. }).then(res => {
  1011. form.exchangeRate = res.data.data.receiptsParities
  1012. this.dataListTwo.push({
  1013. corpId: this.form.purchaseCompanyId,
  1014. corpName: this.form.purchaseCompanyName,
  1015. code: form.code,
  1016. itemId: this.costData.id,
  1017. itemName: this.costData.cname,
  1018. currency: form.currency,
  1019. price: form.amount,
  1020. quantity: 1,
  1021. autoGenerate: 1,
  1022. exchangeRate: form.exchangeRate || 1,
  1023. feesType: 2,
  1024. amount: form.amount,
  1025. })
  1026. })
  1027. },
  1028. rowUpdate(form, index, done, loading) {
  1029. form.boxType = form.$boxTypeId
  1030. done(form)
  1031. getParities({
  1032. currency: form.currency,
  1033. businesDate: dateFormat(new Date(), "yyyy-MM-dd") + " 00:00:00"
  1034. }).then(res => {
  1035. form.exchangeRate = res.data.data.receiptsParities
  1036. if (this.dataListTwo.length > 0) {
  1037. for (let item in this.dataListTwo) {
  1038. if (this.dataListTwo[item].code == form.code) {
  1039. if (this.dataListTwo[item].autoGenerate == 1) {
  1040. this.dataListTwo.splice(Number(item), 1, {
  1041. ...this.dataListTwo[item],
  1042. corpId: this.form.purchaseCompanyId,
  1043. corpName: this.form.purchaseCompanyName,
  1044. code: form.code,
  1045. currency: form.currency,
  1046. price: form.amount,
  1047. exchangeRate: form.exchangeRate || 1,
  1048. amount: form.amount
  1049. })
  1050. this.key++
  1051. }
  1052. }
  1053. }
  1054. }
  1055. })
  1056. },
  1057. selectionChange(list) {
  1058. this.selectionList = list
  1059. },
  1060. //打开表单前
  1061. beforeOpen(done, type) {
  1062. if (type === "add") {
  1063. this.formTwo.boxSource = this.$refs.crud.DIC.boxSource.length === 0 ? "" : this.$refs.crud.DIC.boxSource[0].dictKey
  1064. this.formTwo.status = this.$refs.crud.DIC.status.length === 0 ? "" : this.$refs.crud.DIC.status[0].dictKey
  1065. }
  1066. if (['view', 'edit'].includes(type)) {
  1067. itemDetails({id: this.formTwo.id, type: "BUY"}).then(res => {
  1068. if (this.formTwo.tradingBoxFilesList.length === 0) {
  1069. this.formTwo.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  1070. }
  1071. })
  1072. // 查看和编辑逻辑
  1073. }
  1074. done();
  1075. },
  1076. //删除图片
  1077. uploadDelete(file, column) {
  1078. return new Promise((resolve, reject) => {
  1079. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  1080. confirmButtonText: '确定',
  1081. cancelButtonText: '取消',
  1082. type: 'warning'
  1083. }).then(() => {
  1084. if (this.formTwo.tradingBoxFilesList[file.uid].id) {
  1085. tradingBoxFiles(this.formTwo.tradingBoxFilesList[file.uid].id).then(res => {
  1086. this.$message({
  1087. type: 'success',
  1088. message: '删除成功!'
  1089. });
  1090. resolve();
  1091. })
  1092. } else {
  1093. resolve();
  1094. }
  1095. }).catch(() => {
  1096. reject();
  1097. this.$message({
  1098. type: "info",
  1099. message: "已取消删除"
  1100. });
  1101. })
  1102. })
  1103. },
  1104. confirmChange() {
  1105. if (this.title == "堆存") {
  1106. this.$refs["formState"].validate((valid, done) => {
  1107. done()
  1108. if (valid) {
  1109. let data = {
  1110. ...this.form,
  1111. type: "DCF",
  1112. source: "BUY",
  1113. ...this.formState,
  1114. // tradingBoxItemsList: this.dataList,
  1115. tradingBoxItemsList: this.selectionList,
  1116. }
  1117. // data.tradingBoxItemsList.forEach(item=> delete item.id)
  1118. delete data.id
  1119. const loading = this.$loading({
  1120. lock: true,
  1121. text: '加载中',
  1122. spinner: 'el-icon-loading',
  1123. background: 'rgba(255,255,255,0.7)'
  1124. });
  1125. generateStack(data).then(res => {
  1126. this.$message.success("生成堆存成功")
  1127. this.dialogVisible = false
  1128. this.disabledVisible = false
  1129. this.formState = {}
  1130. this.selectionList = []
  1131. loading.close();
  1132. this.refresh(this.form.id)
  1133. }).catch(() => {
  1134. loading.close();
  1135. })
  1136. }
  1137. })
  1138. }
  1139. },
  1140. getGSData(row, type) {
  1141. this[type[0]][type[1]] = row.cname
  1142. },
  1143. backToList(type) {
  1144. if (type == 0) {
  1145. if (this.detailData.id) {
  1146. this.$router.push({
  1147. path: '/boxManagement/buyContainer/index'
  1148. });
  1149. }
  1150. this.$emit("backToList",type);
  1151. }else if (type == 1){
  1152. this.$router.push({
  1153. path: '/approveData/index'
  1154. });
  1155. this.$emit("backToList",type);
  1156. }
  1157. },
  1158. //自定义列保存
  1159. async saveColumnTwo(ref, option, optionBack, code) {
  1160. /**
  1161. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1162. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1163. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1164. */
  1165. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1166. if (inSave) {
  1167. this.$message.success("保存成功");
  1168. //关闭窗口
  1169. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1170. }
  1171. },
  1172. resetTrigger(){
  1173. if (this.optionForm.disabled == true) {
  1174. if (this.form.status > 0) {
  1175. //基础资料
  1176. this.$set(this.optionForm, "disabled", true)
  1177. //箱信息
  1178. this.$set(this.option, "disabled", true)
  1179. this.$set(this.option, "addBtn", false)
  1180. this.$set(this.option, "menu", false)
  1181. //费用信息
  1182. this.$set(this.$refs.boxCost.option, "disabled", true)
  1183. this.$set(this.$refs.boxCost.option, "addBtn", false)
  1184. this.$set(this.$refs.boxCost.option,"menu",false)
  1185. //附件和顶部按钮
  1186. this.disabled = true
  1187. } else {
  1188. //基础资料
  1189. this.$set(this.optionForm, "disabled", false)
  1190. //箱信息
  1191. this.$set(this.option, "disabled", false)
  1192. this.$set(this.option, "addBtn", true)
  1193. this.$set(this.option, "menu", true)
  1194. //费用信息
  1195. this.$set(this.$refs.boxCost.option, "disabled", false)
  1196. this.$set(this.$refs.boxCost.option, "addBtn", true)
  1197. this.$set(this.$refs.boxCost.option, "menu", true)
  1198. //附件和顶部按钮
  1199. this.disabled = false
  1200. }
  1201. }else {
  1202. //基础资料
  1203. this.$set(this.optionForm, "disabled", false)
  1204. //箱信息
  1205. this.$set(this.option, "disabled", false)
  1206. this.$set(this.option, "addBtn", true)
  1207. this.$set(this.option, "menu", true)
  1208. //费用信息
  1209. this.$set(this.$refs.boxCost.option, "disabled", false)
  1210. this.$set(this.$refs.boxCost.option, "addBtn", true)
  1211. this.$set(this.$refs.boxCost.option, "menu", true)
  1212. //附件和顶部按钮
  1213. this.disabled = false
  1214. }
  1215. },
  1216. //自定义列重置
  1217. async resetColumnTwo(ref, option, optionBack, code) {
  1218. this[option] = this[optionBack];
  1219. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1220. if (inSave) {
  1221. this.resetTrigger()
  1222. this.$message.success("重置成功");
  1223. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1224. }
  1225. }
  1226. }
  1227. }
  1228. </script>
  1229. <style scoped>
  1230. ::v-deep .el-form-item {
  1231. margin-bottom: 8px;
  1232. }
  1233. </style>