detailsPage.vue 43 KB

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