detailsPage.vue 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList(0)">返回列表
  7. </el-button>
  8. <el-button v-if="detailData.id" type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  9. @click="backToList(1)">返回审核列表
  10. </el-button>
  11. </div>
  12. <div class="add-customer-btn">
  13. <el-button class="el-button--small-yh" style="margin-right: 10px" type="primary" size="small" :disabled="form.status>0"
  14. @click="confirmEdit" v-if="optionForm.disabled === true">编辑
  15. </el-button>
  16. <el-dropdown style="margin-right: 10px">
  17. <el-button type="primary" size="small">
  18. 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
  19. </el-button>
  20. <el-dropdown-menu slot="dropdown">
  21. <el-dropdown-item @click.native="pleaseCheck" :disabled="form.status>0">请核数据</el-dropdown-item>
  22. <el-dropdown-item @click.native="checkScheduleDialog = true,checkId = form.id">审核进度</el-dropdown-item>
  23. <el-dropdown-item @click.native="repealCancel" :disabled="form.status === 0 || !form.status" v-if="!detailData.id">撤销请核</el-dropdown-item>
  24. <el-dropdown-item @click.native="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. :table-loading="loading"
  48. :search.sync="search"
  49. :page.sync="page"
  50. @on-load="xiangpage"
  51. @search-change="searchChange"
  52. @search-reset="resetChange"
  53. ref="crud"
  54. :key="key"
  55. :before-open="beforeOpen"
  56. :upload-delete="uploadDelete"
  57. @row-save="rowSave"
  58. @row-update="rowUpdate"
  59. @selection-change="selectionChange"
  60. @resetColumn="resetColumnTwo('crud','option','optionBack',245.1)"
  61. @saveColumn="saveColumnTwo('crud','option','optionBack',245.1)">
  62. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  63. <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
  64. @click="xiangbianji(row,index)">编辑
  65. </el-button>
  66. <el-button icon="el-icon-delete" :size="size" :disabled="disabled || row.count > 0" :type="type"
  67. @click="rowDel(row,index,'MX')">删除
  68. </el-button>
  69. </template>
  70. <template slot-scope="{ row }" slot="status">
  71. <span v-for="item in $refs.crud.DIC.status" :style="{color: item.colour}" v-if="item.dictKey == row.status">{{item.dictValue}}</span>
  72. </template>
  73. <template slot="addressForm" slot-scope="scope">
  74. <port-info v-model="formTwo.addressId" type="id" :disabled="scope.disabled" @balabalaTow="(val)=>{balabala(val,['formTwo','address'])}"/>
  75. </template>
  76. <!-- <template slot="boxMakingCompanyForm" slot-scope="scope">-->
  77. <!-- <crop-select v-model="formTwo.boxMakingCompanyId" :disabled="scope.disabled" :refresh="false"-->
  78. <!-- @getCorpData="(row)=>{getGSData(row,['formTwo','boxMakingCompany'])}" corpType="GS"/>-->
  79. <!-- </template>-->
  80. <template slot="menuLeft" slot-scope="scope">
  81. <el-button type="primary" size="small" @click="rowaddfun">录入明细</el-button>
  82. <el-button
  83. :disabled="selectionList.length === 0 || option.disabled || (selectionList.findIndex(function(item){return item.status == '录入'}) == -1?true:false)"
  84. type="primary" size="small"
  85. @click="statusUpdate('0','起租')">起租
  86. </el-button>
  87. <el-button
  88. :disabled="selectionList.length === 0 || option.disabled || (selectionList.findIndex(function(item){return item.status == '待使用'}) == -1?true:false)"
  89. type="primary" size="small"
  90. @click="statusUpdate('1','退租')">退租
  91. </el-button>
  92. <el-button
  93. :disabled="selectionList.length === 0 || option.disabled || (selectionList.findIndex(function(item){return item.status == '退租'}) == -1?true:false)"
  94. type="primary" size="small"
  95. @click="statusUpdate('1','撤销退租')">撤销退租
  96. </el-button>
  97. <el-button
  98. :disabled="selectionList.length === 0 || option.disabled || (selectionList.findIndex(function(item){return item.status == '待使用'}) == -1?true:false)"
  99. type="primary" size="small"
  100. @click="statusUpdate('2','计算租金')">计算租金
  101. </el-button>
  102. <el-button
  103. :disabled="selectionList.length === 0 || option.disabled || (selectionList.findIndex(function(item){return item.status == '待使用' && item.count > 0}) == -1?true:false)"
  104. type="primary" size="small"
  105. @click="statusUpdate('3','撤销租金')">撤销租金
  106. </el-button>
  107. <el-button :disabled="option.disabled" type="success" size="small" icon="el-icon-bottom"
  108. @click="importBox">导入
  109. </el-button>
  110. <el-button class="el-icon-download" type="info" size="small" :disabled="!form.id" @click="openReport">
  111. 报表打印
  112. </el-button>
  113. <el-button style="margin-left: 0" type="success" size="small"
  114. :disabled="storeUp || selectionList.length === 0"
  115. @click="stockpiling()">堆存
  116. </el-button>
  117. </template>
  118. </avue-crud>
  119. </trade-card>
  120. <!-- 报表-->
  121. <report-dialog
  122. :switchDialog="switchDialog"
  123. :reportId="form.id"
  124. reportName="租入"
  125. @onClose="onClose()"
  126. />
  127. <!-- 费用信息组件-->
  128. <box-cost v-model="dataListTwo" :id="form.id" :printingIsDisabled="false" type="ZR" activeName="second" :codeValue="245.2" ref="boxCost"
  129. @resetTrigger="resetTrigger"></box-cost>
  130. <trade-card title="附件明细">
  131. <c-upload
  132. basic
  133. :data="tradingBoxFilesList"
  134. :disabled="disabled"
  135. deleteUrl="/api/blade-box-tube/tradingBoxFiles/remove"
  136. :enumerationValue="245.3"
  137. display
  138. />
  139. </trade-card>
  140. <el-dialog
  141. :title="title"
  142. :visible.sync="dialogVisible"
  143. :append-to-body="true"
  144. :destroy-on-close="true"
  145. :close-on-click-modal="false"
  146. v-if="dialogVisible"
  147. width="60%">
  148. <span>
  149. <avue-form v-if="title == '堆存'" :option="optionStateTwoTwo" v-model="formState" ref="formState">
  150. <template slot="addressId" slot-scope="scope">
  151. <port-info v-model="formState.addressId" type="id" :disabled="scope.disabled"
  152. @balabalaTow="(val)=>{balabala(val,['formState','address'])}"/>
  153. </template>
  154. <template slot="purchaseCompanyId" slot-scope="scope">
  155. <crop-select v-model="formState.purchaseCompanyId"
  156. @getCorpData="(row)=>{getGSData(row,['formState','purchaseCompanyName'])}"
  157. :disabled="scope.disabled"
  158. corpType="KH"/>
  159. </template>
  160. </avue-form>
  161. <avue-form v-else :option="optionState" v-model="formState" ref="formState">
  162. <template slot="addressId" slot-scope="scope">
  163. <port-info v-model="formState.addressId" type="id" :disabled="scope.disabled"
  164. @balabalaTow="(val)=>{balabala(val,['formState','address'])}"/>
  165. </template>
  166. </avue-form>
  167. </span>
  168. <span slot="footer" class="dialog-footer">
  169. <el-button @click="dialogVisible = false">取 消</el-button>
  170. <el-button type="primary" :disabled="disabledVisible" @click="confirmChange">确 定</el-button>
  171. </span>
  172. </el-dialog>
  173. <el-dialog title="导入箱档案" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
  174. v-dialog-drag>
  175. <avue-form v-if="excelBox" :option="excelOption" v-model="excelForm" table-loading="excelLoading"
  176. :upload-before="uploadBefore" :upload-after="uploadAfter">
  177. <template slot="excelTemplate">
  178. <el-button type="primary" @click="derivation">
  179. 点击下载<i class="el-icon-download el-icon--right"></i>
  180. </el-button>
  181. </template>
  182. </avue-form>
  183. <p style="text-align: center;color: #DC0505">
  184. 温馨提示 第一次导入时请先下载模板
  185. </p>
  186. </el-dialog>
  187. <el-dialog
  188. append-to-body
  189. title="审批进度"
  190. class="el-dialogDeep"
  191. :visible.sync="checkScheduleDialog"
  192. width="40%"
  193. :close-on-click-modal="false"
  194. :destroy-on-close="true"
  195. :close-on-press-escape="false"
  196. v-dialog-drag
  197. >
  198. <check-schedule
  199. :checkId="checkId"
  200. :batchNo="batchNo"
  201. @choceScheduleFun="choceScheduleFun"
  202. ></check-schedule>
  203. </el-dialog>
  204. <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
  205. :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
  206. <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
  207. </check>
  208. </el-dialog>
  209. </div>
  210. </template>
  211. <script>
  212. import {
  213. detail,
  214. submit,
  215. tradingBoxFiles,
  216. selectArchivesList,
  217. tradingBoxItem,
  218. tradingBoxFees,
  219. pleaseCheck,
  220. repealCancel,
  221. statusUpdate, calculateRent, revokeRent, itemDetails, revokeRentingOut, detList, getList, tradingBoxItemSubmitRent
  222. } from "@/api/boxManagement/leaseIn/index.js";
  223. import checkSchedule from "@/components/check/checkSchedule";
  224. import {selectByName} from "@/api/boxManagement";
  225. import {getToken} from "@/util/auth";
  226. import {dateFormat, defaultDate} from "@/util/date";
  227. import reportDialog from "@/components/report-dialog/main.vue";
  228. import {generateStack} from "@/api/boxManagement/exportShipment";
  229. import check from "@/components/check/check.vue";
  230. export default {
  231. name: "detailsPage",
  232. props: {
  233. onLoad: Object,
  234. detailData: Object
  235. },
  236. components:{
  237. checkSchedule,reportDialog,check
  238. },
  239. data() {
  240. return {
  241. // 箱管理编辑暂存的箱号
  242. ZCcode:null,
  243. // 分页
  244. page: {
  245. pageSize: 20,
  246. currentPage: 1,
  247. total: 0,
  248. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 2000]
  249. },
  250. checkData: {},
  251. checkDialog: false,
  252. switchDialog:false,
  253. loading:false,
  254. excelOption: {
  255. submitBtn: false,
  256. emptyBtn: false,
  257. column: [
  258. {
  259. label: "模板下载",
  260. prop: "excelTemplate",
  261. formslot: true,
  262. span: 24
  263. },
  264. {
  265. label: "模板上传",
  266. prop: "excelFile",
  267. type: "upload",
  268. drag: true,
  269. loadText: "模板上传中,请稍等",
  270. span: 24,
  271. propsHttp: {
  272. res: "data"
  273. },
  274. tip: "请上传 .xls,.xlsx 标准格式文件",
  275. action: "/api/blade-box-tube/tradingBoxRent/import-tradingBox-info"
  276. }
  277. ]
  278. },
  279. excelForm:{},
  280. title: '',
  281. dialogVisible: false,
  282. excelBox: false,
  283. formSearch: {},
  284. optionState: {},
  285. formState: {},
  286. storeUp:true,
  287. selectionList: [],
  288. optionStateTwoTwo: {
  289. menuBtn: false,
  290. span: 12,
  291. column: [{
  292. label: '堆存地点',
  293. prop: 'addressId',
  294. rules: [{
  295. required: true,
  296. message: " ",
  297. trigger: "blur"
  298. }]
  299. }, {
  300. label: '付费对象',
  301. prop: 'purchaseCompanyId',
  302. rules: [{
  303. required: true,
  304. message: " ",
  305. trigger: "blur"
  306. }]
  307. },{
  308. label: '堆存日期',
  309. prop: 'rentDate',
  310. width: 100,
  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. },
  321. optionStateTwo: {
  322. menuBtn: false,
  323. span: 24,
  324. column: [{
  325. label: '起租日期',
  326. prop: 'rentDate',
  327. width: 100,
  328. search: true,
  329. overHidden: true,
  330. type: "date",
  331. format: "yyyy-MM-dd",
  332. valueFormat: "yyyy-MM-dd HH:mm:ss",
  333. rules: [{
  334. required: true,
  335. message: " ",
  336. trigger: "blur"
  337. }]
  338. }]
  339. },
  340. optionStateFour: {
  341. menuBtn: false,
  342. span: 12,
  343. column: [{
  344. label: '起始日期',
  345. prop: 'rentStartDate',
  346. width: 100,
  347. type: "date",
  348. format: "yyyy-MM-dd",
  349. valueFormat: "yyyy-MM-dd HH:mm:ss",
  350. rules: [{
  351. required: true,
  352. message: " ",
  353. trigger: "blur"
  354. }]
  355. },{
  356. label: '结束日期',
  357. prop: 'rentCalculationDate',
  358. width: 100,
  359. type: "date",
  360. format: "yyyy-MM-dd",
  361. valueFormat: "yyyy-MM-dd HH:mm:ss",
  362. rules: [{
  363. required: true,
  364. message: " ",
  365. trigger: "blur"
  366. }]
  367. }]
  368. },
  369. optionStateThree: {
  370. menuBtn: false,
  371. span: 12,
  372. column: [{
  373. label: '地点',
  374. prop: 'addressId',
  375. rules: [{
  376. required: true,
  377. message: " ",
  378. trigger: "blur"
  379. }]
  380. }, {
  381. label: '退租日期',
  382. prop: 'rentDate',
  383. width: 100,
  384. search: true,
  385. overHidden: true,
  386. type: "date",
  387. format: "yyyy-MM-dd",
  388. valueFormat: "yyyy-MM-dd HH:mm:ss",
  389. rules: [{
  390. required: true,
  391. message: " ",
  392. trigger: "blur"
  393. }]
  394. }]
  395. },
  396. key: 0,
  397. checkScheduleDialog: false,
  398. checkId: '',
  399. batchNo: '',
  400. breakConfiguration: {
  401. multipleChoices: false,
  402. multiple: false,
  403. disabled: false,
  404. searchShow: true,
  405. collapseTags: false,
  406. clearable: true,
  407. placeholder: "请点击右边按钮选择",
  408. dicData: []
  409. },
  410. form: {},
  411. formTwo: {},
  412. search: {},
  413. optionForm: {
  414. menuBtn: false,
  415. span: 6,
  416. column: [{
  417. label: '系统号',
  418. prop: 'sysNo',
  419. disabled: true
  420. }, {
  421. label: '合同号',
  422. prop: 'contractNo',
  423. rules: [{
  424. required: true,
  425. message: " ",
  426. trigger: "blur"
  427. }]
  428. }, {
  429. label: '箱数',
  430. prop: 'boxNumber',
  431. width: 170,
  432. rules: [{
  433. required: true,
  434. message: " ",
  435. trigger: "blur"
  436. }]
  437. }, {
  438. label: '客户',
  439. prop: 'purchaseCompanyId',
  440. rules: [{
  441. required: true,
  442. message: " ",
  443. trigger: "blur"
  444. }]
  445. }, {
  446. label: '合同生效日期',
  447. prop: 'effectiveDate',
  448. type: "date",
  449. format: "yyyy-MM-dd",
  450. labelWidth:100,
  451. valueFormat: "yyyy-MM-dd HH:mm:ss",
  452. rules: [{
  453. required: true,
  454. message: " ",
  455. trigger: "blur"
  456. }]
  457. }, {
  458. label: '合同失效日期',
  459. prop: 'expiryDate',
  460. type: "date",
  461. format: "yyyy-MM-dd",
  462. labelWidth:100,
  463. valueFormat: "yyyy-MM-dd HH:mm:ss",
  464. rules: [{
  465. required: true,
  466. message: " ",
  467. trigger: "blur"
  468. }]
  469. }, {
  470. label: '备注',
  471. prop: 'remarks',
  472. type: 'textarea',
  473. minRows: 1,
  474. span: 12
  475. }]
  476. },
  477. option: {},
  478. optionBack: {
  479. align: 'center',
  480. index: true,
  481. addBtnText: "录入明细",
  482. refreshBtn: false,
  483. dialogDrag: true,
  484. addBtn: false,
  485. span: 8,
  486. height:600,
  487. selection: true,
  488. addRowBtn: false,
  489. cellBtn: false,
  490. editBtn: false,
  491. delBtn: false,
  492. searchMenuPosition: "right",
  493. searchSpan: 8,
  494. searchIcon: true,
  495. searchIndex: 2,
  496. menuWidth: 140,
  497. dialogTop: 25,
  498. dialogWidth: "80%",
  499. // showSummary: true,
  500. reserveSelection:true,
  501. sumColumnList: [{
  502. name: 'emptyWeight',
  503. type: 'sum',
  504. decimals: 2
  505. },{
  506. name: 'grossWeight',
  507. type: 'sum',
  508. decimals: 2
  509. },{
  510. name: 'tare',
  511. type: 'sum',
  512. decimals: 2
  513. },{
  514. name: 'loadingWeight',
  515. type: 'sum',
  516. decimals: 2
  517. },{
  518. name: 'volume',
  519. type: 'sum',
  520. decimals: 2
  521. }],
  522. column: [{
  523. label: '箱号',
  524. prop: 'code',
  525. width: 100,
  526. overHidden: true,
  527. search: true,
  528. // filterable: true,
  529. // remote: true,
  530. // allowCreate: true,
  531. // type: "select",
  532. // dicUrl: "/api/blade-box-tube/archives/selectArchivesList?size=10&current=1&code={{key}}",
  533. // props: {
  534. // label: "code",
  535. // value: "code"
  536. // },
  537. rules: [{
  538. required: true,
  539. message: " ",
  540. trigger: "blur"
  541. }]
  542. }, {
  543. label: '状态',
  544. prop: 'status',
  545. width: 100,
  546. overHidden: true,
  547. filterable: true,
  548. disabled: true,
  549. search: true,
  550. type: 'select',
  551. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
  552. props: {
  553. label: "dictValue",
  554. value: "dictKey"
  555. }
  556. }, {
  557. label: '币别',
  558. prop: 'currency',
  559. width: 100,
  560. overHidden: true,
  561. filterable: true,
  562. type: "select",
  563. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  564. props: {
  565. label: "dictValue",
  566. value: "dictKey"
  567. },
  568. rules: [{
  569. required: true,
  570. message: " ",
  571. trigger: "blur"
  572. }]
  573. }, {
  574. label: '超期租金/天',
  575. prop: 'price',
  576. type: 'number',
  577. controls: false,
  578. overHidden: true,
  579. width: 100,
  580. rules: [{
  581. required: true,
  582. message: " ",
  583. trigger: "blur"
  584. }]
  585. }, {
  586. label: '超期金额',
  587. prop: 'overdueAmount',
  588. type: 'number',
  589. controls: false,
  590. overHidden: true,
  591. disabled: true,
  592. width: 100
  593. }, {
  594. label: '天数',
  595. prop: 'overdueDays',
  596. type: 'number',
  597. controls: false,
  598. overHidden: true,
  599. width: 100,
  600. rules: [{
  601. required: true,
  602. message: " ",
  603. trigger: "blur"
  604. }]
  605. }, {
  606. label: '租金金额',
  607. prop: 'amount',
  608. type: 'number',
  609. controls: false,
  610. overHidden: true,
  611. width: 100,
  612. rules: [{
  613. required: true,
  614. message: " ",
  615. trigger: "blur"
  616. }]
  617. }, {
  618. label: '起租日期',
  619. prop: 'leaseCommencementDate',
  620. searchProp: 'leaseCommencementDateList',
  621. overHidden: true,
  622. search: true,
  623. disabled: false,
  624. searchRange: true,
  625. searchDefaultTime: ["00:00:00", "23:59:59"],
  626. type: "date",
  627. format: "yyyy-MM-dd",
  628. valueFormat: "yyyy-MM-dd HH:mm:ss",
  629. width: 100,
  630. }, {
  631. label: '退租日期',
  632. prop: 'rentingOutDate',
  633. searchProp: 'rentingOutDateList',
  634. overHidden: true,
  635. search: true,
  636. searchRange: true,
  637. searchDefaultTime: ["00:00:00", "23:59:59"],
  638. type: "date",
  639. display: false,
  640. format: "yyyy-MM-dd",
  641. valueFormat: "yyyy-MM-dd HH:mm:ss",
  642. width: 100,
  643. }, {
  644. label: '当前租金期间',
  645. prop: 'rentEndDate',
  646. searchProp: 'rentEndDateList',
  647. overHidden: true,
  648. search: true,
  649. searchRange: true,
  650. searchDefaultTime: ["00:00:00", "23:59:59"],
  651. display: false,
  652. searchLabelWidth:100,
  653. type: "date",
  654. format: "yyyy-MM-dd",
  655. valueFormat: "yyyy-MM-dd HH:mm:ss",
  656. width: 160
  657. }, {
  658. label: '箱类型',
  659. prop: 'boxTypeId',
  660. width: 100,
  661. search: true,
  662. overHidden: true,
  663. filterable: true,
  664. type: 'select',
  665. props: {
  666. label: 'name',
  667. value: 'id'
  668. },
  669. dicUrl: '/api/blade-client/container/listMessage',
  670. rules: [{
  671. required: true,
  672. message: " ",
  673. trigger: "blur"
  674. }]
  675. }, {
  676. label: '最新地点',
  677. prop: 'address',
  678. overHidden: true,
  679. formProp: 'addressId',
  680. width: 100,
  681. rules: [{
  682. required: true,
  683. message: " ",
  684. trigger: "blur"
  685. }]
  686. }, {
  687. label: '最新日期',
  688. prop: 'newDate',
  689. overHidden: true,
  690. width: 100,
  691. type: "date",
  692. format: "yyyy-MM-dd",
  693. valueFormat: "yyyy-MM-dd HH:mm:ss",
  694. rules: [{
  695. required: true,
  696. message: " ",
  697. trigger: "blur"
  698. }]
  699. }, {
  700. label: '堆存状态',
  701. prop: 'stackingStatus',
  702. display:false,
  703. overHidden: true,
  704. width: 100
  705. }, {
  706. label: '堆存时间',
  707. prop: 'stackingDate',
  708. width: 100,
  709. overHidden: true,
  710. type: "date",
  711. display:false,
  712. format: "yyyy-MM-dd",
  713. valueFormat: "yyyy-MM-dd HH:mm:ss"
  714. }, {
  715. label: '箱来源',
  716. prop: 'boxSource',
  717. width: 100,
  718. overHidden: true,
  719. filterable: true,
  720. type: 'select',
  721. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
  722. props: {
  723. label: "dictValue",
  724. value: "dictKey"
  725. },
  726. rules: [{
  727. required: true,
  728. message: " ",
  729. trigger: "blur"
  730. }]
  731. }, {
  732. label: '箱状态',
  733. prop: 'boxStatus',
  734. width: 100,
  735. overHidden: true,
  736. filterable: true,
  737. type: 'select',
  738. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  739. props: {
  740. label: "dictValue",
  741. value: "dictKey"
  742. },
  743. rules: [{
  744. required: true,
  745. message: " ",
  746. trigger: "blur"
  747. }]
  748. }, {
  749. label: '空重(kg)',
  750. prop: 'emptyWeight',
  751. type: 'number',
  752. overHidden: true,
  753. controls: false,
  754. width: 100,
  755. rules: [{
  756. required: true,
  757. message: " ",
  758. trigger: "blur"
  759. }]
  760. }, {
  761. label: '毛重(kg)',
  762. prop: 'grossWeight',
  763. type: 'number',
  764. overHidden: true,
  765. controls: false,
  766. width: 100,
  767. rules: [{
  768. required: true,
  769. message: " ",
  770. trigger: "blur"
  771. }]
  772. }, {
  773. label: '皮重(kg)',
  774. prop: 'tare',
  775. overHidden: true,
  776. type: 'number',
  777. controls: false,
  778. width: 100
  779. }, {
  780. label: '装载重量(kg)',
  781. prop: 'loadingWeight',
  782. type: 'number',
  783. overHidden: true,
  784. controls: false,
  785. width: 100
  786. }, {
  787. label: '容积(m³)',
  788. prop: 'volume',
  789. type: 'number',
  790. overHidden: true,
  791. controls: false,
  792. width: 100
  793. }, {
  794. label: '造箱公司',
  795. prop: 'boxMakingCompany',
  796. overHidden: true,
  797. width: 100,
  798. rules: [{
  799. required: true,
  800. message: " ",
  801. trigger: "blur"
  802. }]
  803. }, {
  804. label: '造箱日期',
  805. prop: 'boxMakingDate',
  806. width: 100,
  807. overHidden: true,
  808. type: "date",
  809. format: "yyyy-MM-dd",
  810. valueFormat: "yyyy-MM-dd HH:mm:ss",
  811. rules: [{
  812. required: true,
  813. message: " ",
  814. trigger: "blur"
  815. }]
  816. }, {
  817. label: '箱来源日期',
  818. prop: 'leaseCommencementDate',
  819. width: 100,
  820. overHidden: true,
  821. type: "date",
  822. format: "yyyy-MM-dd",
  823. valueFormat: "yyyy-MM-dd HH:mm:ss"
  824. }, {
  825. label: '箱龄',
  826. prop: 'boxAge',
  827. type: 'number',
  828. controls: false,
  829. overHidden: true,
  830. width: 100,
  831. rules: [{
  832. required: true,
  833. message: " ",
  834. trigger: "blur"
  835. }]
  836. }, {
  837. label: '照片',
  838. prop: 'tradingBoxFilesList',
  839. width: 200,
  840. overHidden: true,
  841. type: 'upload',
  842. span: 24,
  843. showColumn:false,
  844. hide:true,
  845. listType: 'picture-card',
  846. tip: '只能上传jpg/png文件,且不超过500kb',
  847. propsHttp: {
  848. url: 'link',
  849. name: 'originalName',
  850. res: 'data'
  851. },
  852. action: '/api/blade-resource/oss/endpoint/put-file'
  853. }, {
  854. label: '备注',
  855. prop: 'remarks',
  856. overHidden: true,
  857. type: 'textarea',
  858. minRows: 3,
  859. span: 24,
  860. width: 200
  861. }]
  862. },
  863. dataList: [],
  864. dataListTwo:[],
  865. tradingBoxFilesList: [],
  866. disabled: false,
  867. disabledVisible: false,
  868. costData:{},
  869. // 保存数据的次数
  870. baocunindex:0
  871. }
  872. },
  873. async created() {
  874. this.option = await this.getColumnData(this.getColumnName(245.1), this.optionBack);
  875. selectByName("买箱费").then(res => {
  876. this.costData = res.data.data
  877. })
  878. //下拉箱号带出对应信息
  879. // this.findObject(this.option.column, "code").change = ({value, column}) => {
  880. // selectArchivesList({code: value}).then(res => {
  881. // for (let item of res.data.data) {
  882. // if (value == item.code) {
  883. // this.formTwo = {
  884. // boxSource: item.boxSource,
  885. // boxStatus: item.boxStatus,
  886. // emptyWeight: item.emptyWeight,
  887. // grossWeight: item.gorssWeight,
  888. // tare: item.tare,
  889. // loadingWeight: item.loadingWeight,
  890. // volume: item.volume,
  891. // }
  892. // }
  893. // }
  894. // })
  895. // }
  896. this.key++
  897. if (this.onLoad.id && this.detailData.id) {
  898. this.refresh(this.onLoad.id, true)
  899. } else if (this.onLoad.id) {
  900. this.refresh(this.onLoad.id, true)
  901. }
  902. },
  903. methods: {
  904. //关闭审核
  905. choceCheckFun() {
  906. this.checkDialog = false;
  907. },
  908. //堆存
  909. stockpiling() {
  910. this.title = "堆存"
  911. const date = new Date();
  912. this.formState.rentDate = dateFormat(date, "yyyy-MM-dd") + " 00:00:00"
  913. this.dialogVisible = true
  914. },
  915. // 报表
  916. openReport() {
  917. this.switchDialog = !this.switchDialog;
  918. },
  919. // 报表关闭
  920. onClose(val) {
  921. this.switchDialog = val;
  922. },
  923. importBox() {
  924. if (!this.form.id) {
  925. this.$message.error('请先保存数据')
  926. return
  927. }
  928. this.findObject(this.excelOption.column, "excelFile").data = {
  929. pid:this.form.id
  930. }
  931. this.excelBox = true
  932. },
  933. derivation() {
  934. window.open(`/api/blade-box-tube/tradingBoxRent/export-tradingBox-info?${this.website.tokenHeader}=${getToken()}`);
  935. },
  936. uploadBefore(file, done, loading) {
  937. loading = true;
  938. done();
  939. },
  940. uploadAfter(res, done, loading, column) {
  941. this.excelBox = false;
  942. if (typeof res.message === "string") return
  943. for (let item of this.dataList){
  944. for (let li of res){
  945. if (item.code === li.code){
  946. return this.$message.error(`箱号:${item.code}重复!`);
  947. }
  948. }
  949. }
  950. this.dataList = this.dataList.concat(res)
  951. this.$message.success("导入成功!");
  952. this.baocunindex = 1
  953. loading = false;
  954. done();
  955. },
  956. statusUpdate(status, type) {
  957. if (this.form.id) {
  958. this.title = type
  959. if (type === '起租') {
  960. this.optionState = this.optionStateTwo
  961. } else if (type === '计算租金') {
  962. this.optionState = this.optionStateFour
  963. for (let item of this.selectionList) {
  964. if (!Number(item.price) || Number(item.price) < 0){
  965. return this.$message.error('超期租金/天,不能不能为0或不能为负')
  966. }
  967. for (let li of this.selectionList) {
  968. if (item.rentEndDate !== li.rentEndDate) {
  969. return this.$message.error(`${item.code} - ${item.rentEndDate},当前租金期间不相同,禁止选择`)
  970. }
  971. }
  972. }
  973. const date = new Date(this.selectionList[0].rentEndDate?this.selectionList[0].rentEndDate:new Date());
  974. const endDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);
  975. this.formState.rentStartDate = this.selectionList[0].rentEndDate
  976. this.formState.rentCalculationDate = dateFormat(endDate, "yyyy-MM-dd") + " 23:59:59"
  977. if (this.selectionList[0].rentEndDate){
  978. let curDate = new Date(this.selectionList[0].rentEndDate);
  979. let endDateTime = new Date((curDate/1000+86400)*1000)
  980. this.formState.rentStartDate = dateFormat(endDateTime, "yyyy-MM-dd") + " 00:00:00"
  981. const endDateTwo = new Date(endDateTime.getFullYear(), endDateTime.getMonth() + 1, 0);
  982. this.formState.rentCalculationDate = dateFormat(endDateTwo, "yyyy-MM-dd") + " 23:59:59"
  983. }
  984. }else if(type === '撤销租金'){
  985. return this.$confirm('此操作将撤销租金并删除费用, 是否继续?', '提示', {
  986. confirmButtonText: '确定',
  987. cancelButtonText: '取消',
  988. type: 'warning'
  989. }).then(() => {
  990. revokeRent({
  991. ...this.form,
  992. tradingBoxItemsList:this.selectionList
  993. }).then(res => {
  994. this.$message.success("操作成功")
  995. this.formState = {}
  996. this.refresh(this.form.id)
  997. })
  998. }).catch(() => {
  999. this.$message({
  1000. type: 'info',
  1001. message: '已取消删除'
  1002. });
  1003. });
  1004. } else if (type === '撤销退租'){
  1005. return this.$confirm('此操作将撤销退租并删除费用, 是否继续?', '提示', {
  1006. confirmButtonText: '确定',
  1007. cancelButtonText: '取消',
  1008. type: 'warning'
  1009. }).then(() => {
  1010. revokeRentingOut({
  1011. ...this.form,
  1012. tradingBoxItemsList:this.selectionList
  1013. }).then(res => {
  1014. this.$message.success("操作成功")
  1015. this.formState = {}
  1016. this.refresh(this.form.id)
  1017. })
  1018. }).catch(() => {
  1019. this.$message({
  1020. type: 'info',
  1021. message: '已取消删除'
  1022. });
  1023. });
  1024. } else {
  1025. this.optionState = this.optionStateThree
  1026. this.formState.rentDate = dateFormat(new Date(), "yyyy-MM-dd") + " 23:59:59"
  1027. }
  1028. this.dialogVisible = true
  1029. } else {
  1030. this.$message.error('请保存后操作')
  1031. }
  1032. },
  1033. confirmChange() {
  1034. if (this.title == "堆存") {
  1035. this.$refs["formState"].validate((valid, done) => {
  1036. done()
  1037. if (valid) {
  1038. let data = {
  1039. ...this.form,
  1040. type: "DCF",
  1041. source: "ZR",
  1042. ...this.formState,
  1043. // tradingBoxItemsList: this.dataList,
  1044. tradingBoxItemsList: this.selectionList,
  1045. }
  1046. // data.tradingBoxItemsList.forEach(item=> delete item.id)
  1047. delete data.id
  1048. const loading = this.$loading({
  1049. lock: true,
  1050. text: '加载中',
  1051. spinner: 'el-icon-loading',
  1052. background: 'rgba(255,255,255,0.7)'
  1053. });
  1054. generateStack(data).then(res => {
  1055. this.$message.success("生成堆存成功")
  1056. this.baocunindex = 1
  1057. this.dialogVisible = false
  1058. this.disabledVisible = false
  1059. this.formState = {}
  1060. this.selectionList = []
  1061. loading.close();
  1062. this.refresh(this.form.id)
  1063. }).catch(() => {
  1064. loading.close();
  1065. })
  1066. }
  1067. })
  1068. } else {
  1069. this.$refs["formState"].validate((valid, done) => {
  1070. done()
  1071. if (valid) {
  1072. if (this.title === "起租" || this.title === "退租") {
  1073. if (this.title === "退租") {
  1074. if (Number(new Date(this.selectionList[0].rentEndDate)) > Number(new Date(this.formState.rentDate))) {
  1075. return this.$message.error("退租日期不能小于当前租金期间")
  1076. }
  1077. }
  1078. this.disabledVisible = true
  1079. statusUpdate({
  1080. ...this.form,
  1081. ...this.formState,
  1082. tradingBoxItemsList: this.selectionList,
  1083. rentType: this.title === "起租" ? 1 : 2
  1084. }).then(res => {
  1085. this.$message.success("操作成功")
  1086. this.dialogVisible = false
  1087. this.disabledVisible = false
  1088. this.formState = {}
  1089. this.refresh(this.form.id)
  1090. }).catch(() => {
  1091. this.disabledVisible = false
  1092. })
  1093. }else {
  1094. if (this.title === "计算租金"){
  1095. if (Number(new Date(this.selectionList[0].leaseCommencementDate)) > Number(new Date(this.formState.rentStartDate))) {
  1096. return this.$message.error("起始日期不能小于起租日期")
  1097. }
  1098. this.disabledVisible = true
  1099. calculateRent({
  1100. ...this.form,
  1101. ...this.formState,
  1102. tradingBoxItemsList:this.selectionList
  1103. }).then(res => {
  1104. this.$message.success("操作成功")
  1105. this.dialogVisible = false
  1106. this.disabledVisible = false
  1107. this.formState = {}
  1108. this.refresh(this.form.id)
  1109. }).catch(() => {
  1110. this.disabledVisible = false
  1111. })
  1112. }
  1113. }
  1114. }
  1115. })
  1116. }
  1117. },
  1118. selectionChange(list) {
  1119. this.selectionList = list
  1120. for (let item of list){
  1121. if (item.status == '待使用' && item.stockpilingStatus == '1'){
  1122. this.storeUp = false
  1123. }else {
  1124. return this.storeUp = true
  1125. }
  1126. }
  1127. },
  1128. confirmEdit() {
  1129. if (this.form.status > 0) {
  1130. //基础资料
  1131. this.$set(this.optionForm, "disabled", true)
  1132. //箱信息
  1133. // this.$set(this.option, "disabled", true)
  1134. this.$set(this.option, "addBtn", false)
  1135. this.$set(this.option, "menu", false)
  1136. //费用信息
  1137. this.$set(this.$refs.boxCost.option, "disabled", true)
  1138. this.$set(this.$refs.boxCost.option,"addBtn",false)
  1139. this.$set(this.$refs.boxCost.option,"menu",false)
  1140. //附件和顶部按钮
  1141. this.disabled = true
  1142. } else {
  1143. //基础资料
  1144. this.$set(this.optionForm, "disabled", false)
  1145. //箱信息
  1146. this.$set(this.option, "disabled", false)
  1147. // this.$set(this.option, "addBtn", true)
  1148. this.$set(this.option, "menu", true)
  1149. //费用信息
  1150. this.$set(this.$refs.boxCost.option,"disabled",false)
  1151. // this.$set(this.$refs.boxCost.option,"addBtn",true)
  1152. this.$set(this.$refs.boxCost.option,"menu",true)
  1153. //附件和顶部按钮
  1154. this.disabled = false
  1155. }
  1156. this.key++
  1157. },
  1158. // 明细删除
  1159. rowDel(row, index, type) {
  1160. this.$confirm("确定将选择数据删除?", {
  1161. confirmButtonText: "确定",
  1162. cancelButtonText: "取消",
  1163. type: "warning"
  1164. }).then(() => {
  1165. if (row.id) {
  1166. tradingBoxItem(row.id).then(res => {
  1167. if (res.data.success) {
  1168. this.$message.success("操作成功!");
  1169. this.dataList.splice(index, 1);
  1170. if (this.dataListTwo.length > 0) {
  1171. for (let item in this.dataListTwo) {
  1172. if (this.dataListTwo[item].code == row.code) {
  1173. if (this.dataListTwo[item].autoGenerate == 1) {
  1174. if (this.dataListTwo[item].id) {
  1175. tradingBoxFees(this.dataListTwo[item].id).then(res => {
  1176. if (res.data.success) {
  1177. this.dataListTwo.splice(index, 1);
  1178. }
  1179. });
  1180. } else {
  1181. this.dataListTwo.splice(Number(item), 1);
  1182. }
  1183. }
  1184. }
  1185. }
  1186. }
  1187. }
  1188. });
  1189. } else {
  1190. this.dataList.splice(index, 1);
  1191. this.$message.success("操作成功!");
  1192. if (this.dataListTwo.length > 0) {
  1193. for (let item in this.dataListTwo) {
  1194. if (this.dataListTwo[item].code == row.code) {
  1195. if (this.dataListTwo[item].autoGenerate == 1) {
  1196. this.dataListTwo.splice(Number(item), 1);
  1197. }
  1198. }
  1199. }
  1200. }
  1201. }
  1202. }
  1203. )
  1204. ;
  1205. },
  1206. //撤销
  1207. repealCancel(){
  1208. this.$confirm("您确定撤回此次申请吗?", {
  1209. confirmButtonText: "确定",
  1210. cancelButtonText: "取消",
  1211. type: "warning"
  1212. }).then(() => {
  1213. const data = {
  1214. id : this.form.id,
  1215. pageLabel:"租入",
  1216. checkFlag: 3,
  1217. }
  1218. const loading = this.$loading({
  1219. lock: true,
  1220. text: '加载中',
  1221. spinner: 'el-icon-loading',
  1222. background: 'rgba(255,255,255,0.7)'
  1223. });
  1224. repealCancel(data).then(res => {
  1225. loading.close();
  1226. this.$message.success('撤回成功')
  1227. this.refresh(this.form.id)
  1228. }).catch(()=>{
  1229. loading.close();
  1230. })
  1231. })
  1232. },
  1233. // 请核
  1234. pleaseCheck() {
  1235. this.$confirm("您确定提交请核申请吗?", {
  1236. confirmButtonText: "确定",
  1237. cancelButtonText: "取消",
  1238. type: "warning"
  1239. }).then(() => {
  1240. this.$refs["form"].validate((valid,done) => {
  1241. done()
  1242. if (valid) {
  1243. if (this.dataList.length === 0) {
  1244. return this.$message.error("箱信息不能为空")
  1245. }
  1246. if (this.$refs.boxCost.dataList.length === 0) {
  1247. return this.$message.error("费用信息不能为空")
  1248. }else {
  1249. for (let item of this.$refs.boxCost.dataList){
  1250. if (!item.id){
  1251. return this.$message.error("费用信息未保存")
  1252. }
  1253. }
  1254. }
  1255. let data = {
  1256. ...this.form,
  1257. tradingBoxItemsList: this.dataList,
  1258. tradingBoxFeesList: this.dataListTwo,
  1259. tradingBoxFilesList: this.tradingBoxFilesList,
  1260. type: "ZR"
  1261. }
  1262. const loading = this.$loading({
  1263. lock: true,
  1264. text: '加载中',
  1265. spinner: 'el-icon-loading',
  1266. background: 'rgba(255,255,255,0.7)'
  1267. });
  1268. submit(data).then(res => {
  1269. const data = {
  1270. id: res.data.data.id,
  1271. url: '/boxManagement/leaseIn/index',
  1272. pageStatus: "this.$store.getters.domSaleStatus",
  1273. pageLabel: "租入",
  1274. checkFlag: 3,
  1275. }
  1276. pleaseCheck({
  1277. ...data,
  1278. type: "ZR"
  1279. }).then(rest => {
  1280. loading.close();
  1281. this.$message.success('请核成功')
  1282. this.refresh(res.data.data.id)
  1283. }).catch(()=>{
  1284. loading.close();
  1285. })
  1286. }).catch(()=>{
  1287. loading.close();
  1288. })
  1289. }
  1290. });
  1291. })
  1292. },
  1293. //审核关闭
  1294. choceScheduleFun(){
  1295. this.checkScheduleDialog = false
  1296. },
  1297. resetChange(item){
  1298. this.queryDetails()
  1299. },
  1300. searchChange(params, done) {
  1301. for (let item of this.dataList){
  1302. if (!item.id){
  1303. this.$confirm('有未保存明细继续搜索会清空未保存数据?', '提示', {
  1304. confirmButtonText: '确定',
  1305. cancelButtonText: '取消',
  1306. type: 'warning'
  1307. }).then(() => {
  1308. done();
  1309. return this.queryDetails(params)
  1310. })
  1311. }
  1312. }
  1313. done();
  1314. this.queryDetails(params)
  1315. },
  1316. // 箱信息的分页
  1317. xiangpage(page,params = {}){
  1318. this.queryDetails()
  1319. },
  1320. // 获取箱信息数据
  1321. queryDetails(params = {}) {
  1322. params = {
  1323. ...params,
  1324. type: "ZR",
  1325. ...Object.assign(params, this.search)
  1326. }
  1327. this.loading = true
  1328. detList({
  1329. ...params,
  1330. current: this.page.currentPage,
  1331. size: this.page.pageSize,
  1332. pid:this.form.id?this.form.id:this.onLoad.id
  1333. }).then(res=>{
  1334. this.page.total = res.data.data.total
  1335. this.dataList = res.data.data.records
  1336. this.loading = false
  1337. }).finally(() => {
  1338. this.loading = false
  1339. }).catch(()=>{
  1340. this.loading = false
  1341. })
  1342. },
  1343. refresh(id,type) {
  1344. const loading = this.$loading({
  1345. lock: true,
  1346. text: '加载中',
  1347. spinner: 'el-icon-loading',
  1348. background: 'rgba(255,255,255,0.7)'
  1349. });
  1350. this.queryDetails()
  1351. detail({id: id}).then(res => {
  1352. this.form = res.data.data
  1353. this.dataList = res.data.data.tradingBoxItemsList
  1354. this.dataListTwo = res.data.data.tradingBoxFeesList
  1355. this.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  1356. delete this.form.tradingBoxItemsList
  1357. delete this.form.tradingBoxFeesList
  1358. delete this.form.tradingBoxFilesList
  1359. this.$refs.boxCost.code = this.form.code
  1360. loading.close();
  1361. if (type) {
  1362. //基础资料
  1363. this.$set(this.optionForm, "disabled", true)
  1364. //箱信息
  1365. // this.$set(this.option, "disabled", true)
  1366. this.$set(this.option, "addBtn", false)
  1367. this.$set(this.option, "menu", false)
  1368. //费用信息
  1369. this.$set(this.$refs.boxCost.option, "disabled", true)
  1370. this.$set(this.$refs.boxCost.option, "addBtn", false)
  1371. this.$set(this.$refs.boxCost.option, "menu", false)
  1372. //附件和顶部按钮
  1373. this.disabled = true
  1374. }else {
  1375. if (this.form.status > 0) {
  1376. //基础资料
  1377. this.$set(this.optionForm, "disabled", true)
  1378. //箱信息
  1379. // this.$set(this.option, "disabled", true)
  1380. this.$set(this.option, "addBtn", false)
  1381. this.$set(this.option, "menu", false)
  1382. //费用信息
  1383. this.$set(this.$refs.boxCost.option, "disabled", true)
  1384. this.$set(this.$refs.boxCost.option, "addBtn", false)
  1385. this.$set(this.$refs.boxCost.option,"menu",false)
  1386. //附件和顶部按钮
  1387. this.disabled = true
  1388. } else {
  1389. //基础资料
  1390. this.$set(this.optionForm, "disabled", false)
  1391. //箱信息
  1392. this.$set(this.option, "disabled", false)
  1393. // this.$set(this.option, "addBtn", true)
  1394. this.$set(this.option, "menu", true)
  1395. //费用信息
  1396. this.$set(this.$refs.boxCost.option, "disabled", false)
  1397. // this.$set(this.$refs.boxCost.option, "addBtn", true)
  1398. this.$set(this.$refs.boxCost.option, "menu", true)
  1399. //附件和顶部按钮
  1400. this.disabled = false
  1401. }
  1402. }
  1403. this.key++
  1404. })
  1405. },
  1406. //新增修改
  1407. editCustomer() {
  1408. this.$refs["form"].validate((valid,done) => {
  1409. done()
  1410. if (valid) {
  1411. let data = {
  1412. ...this.form,
  1413. // tradingBoxItemsList: this.dataList,
  1414. // tradingBoxFeesList: this.dataListTwo,
  1415. tradingBoxFilesList: this.tradingBoxFilesList,
  1416. type: "ZR"
  1417. }
  1418. const loading = this.$loading({
  1419. lock: true,
  1420. text: '加载中',
  1421. spinner: 'el-icon-loading',
  1422. background: 'rgba(255,255,255,0.7)'
  1423. });
  1424. submit(data).then(res => {
  1425. if (this.form.id) {
  1426. this.$message.success("修改成功")
  1427. } else {
  1428. this.$message.success("新增成功")
  1429. }
  1430. this.baocunindex = 0
  1431. loading.close();
  1432. this.refresh(res.data.data.id)
  1433. }).catch(()=>{
  1434. loading.close();
  1435. })
  1436. }
  1437. });
  1438. },
  1439. // 箱信息添加
  1440. rowaddfun(){
  1441. this.$refs["form"].validate((valid,done) => {
  1442. if (valid) {
  1443. const idp = this.form.id?this.form.id:this.onLoad.id
  1444. if (!idp) {
  1445. return this.$message.warning('请先填写保存数据');
  1446. }else {
  1447. this.$refs.crud.rowAdd()
  1448. }
  1449. }else {
  1450. return this.$message.warning('请先填写基础信息');
  1451. }
  1452. })
  1453. },
  1454. // 箱信息的添加
  1455. rowSave(form,done,loading) {
  1456. let result = this.dataList.some((item) => {
  1457. if (item.code == form.code) {
  1458. return true
  1459. }
  1460. })
  1461. if (result === true) {
  1462. this.$message.error("已存在此箱号");
  1463. return loading();
  1464. }
  1465. form.boxType = form.$boxTypeId
  1466. this.tradingBoxItemSubmitRentfun(form)
  1467. // 费用的保存
  1468. const obj = {
  1469. // 费用名称id
  1470. itemId:'1636526426121347073',
  1471. itemName: "租金",
  1472. // 客户id
  1473. corpId:this.form.purchaseCompanyId,
  1474. corpName: this.form.purchaseCompanyName,
  1475. // 排序
  1476. sort:1,
  1477. // 数量
  1478. quantity:1,
  1479. // 单价
  1480. price:form.amount,
  1481. // 金额
  1482. amount: form.amount,
  1483. // 币别
  1484. currency:form.currency,
  1485. // 1.应收 2.应付
  1486. feesType: 2,
  1487. // 箱号
  1488. code: form.code,
  1489. // 业务类型
  1490. billType: "",
  1491. // 是否自动生成(0否1是)
  1492. autoGenerate:1,
  1493. // 是否手动录入
  1494. identifier:0,
  1495. pid: form.pid,
  1496. remarks:form.remarks,
  1497. }
  1498. this.$refs.boxCost.data_two.push(obj)
  1499. this.$refs.boxCost.tradingBoxFeesSubmitfun(obj)
  1500. done(form)
  1501. },
  1502. // 箱编辑弹窗接口
  1503. xiangbianji(row,index){
  1504. // 暂存箱号
  1505. this.ZCcode = row.code
  1506. this.$refs.crud.rowEdit(row,index)
  1507. },
  1508. // 箱信息的编辑
  1509. rowUpdate(form, index, done, loading) {
  1510. form.boxType = form.$boxTypeId
  1511. this.tradingBoxItemSubmitRentfun(form)
  1512. // 费用的更改
  1513. for(let index in this.$refs.boxCost.data_two) {
  1514. if (this.ZCcode == this.$refs.boxCost.data_two[index].code){
  1515. this.$refs.boxCost.data_two[index] = {
  1516. id:this.$refs.boxCost.data_two[index].id,
  1517. // 费用名称id
  1518. itemId:'1636526426121347073',
  1519. itemName: "租金",
  1520. // 客户id
  1521. corpId:this.form.purchaseCompanyId,
  1522. corpName: this.form.purchaseCompanyName,
  1523. // 排序
  1524. sort:1,
  1525. // 数量
  1526. quantity:1,
  1527. // 单价
  1528. price:form.amount,
  1529. // 金额
  1530. amount: form.amount,
  1531. // 币别
  1532. currency:form.currency,
  1533. // 1.应收 2.应付
  1534. feesType: 2,
  1535. // 箱号
  1536. code: form.code,
  1537. // 业务类型
  1538. billType: "",
  1539. // 是否自动生成(0否1是)
  1540. autoGenerate:1,
  1541. // 是否手动录入
  1542. identifier:0,
  1543. pid: form.pid,
  1544. remarks:form.remarks,
  1545. }
  1546. this.$refs.boxCost.tradingBoxFeesSubmitfun(this.$refs.boxCost.data_two[index])
  1547. break;
  1548. }
  1549. }
  1550. done(form)
  1551. },
  1552. // 箱信息的添加和保存
  1553. tradingBoxItemSubmitRentfun(form){
  1554. tradingBoxItemSubmitRent({
  1555. ...form,
  1556. pid:this.form.id?this.form.id:this.onLoad.id
  1557. }).then(res=>{
  1558. this.$message.success("操作成功!");
  1559. this.baocunindex = 1
  1560. this.queryDetails()
  1561. })
  1562. },
  1563. //打开表单前
  1564. beforeOpen(done,type){
  1565. if (this.formTwo.count > 0){
  1566. this.findObject(this.option.column, "price").disabled = true
  1567. // this.findObject(this.option.column, "amount").disabled = true
  1568. }else {
  1569. this.findObject(this.option.column, "price").disabled = false
  1570. // this.findObject(this.option.column, "amount").disabled = false
  1571. }
  1572. if(['view','edit'].includes(type)){
  1573. itemDetails({id:this.formTwo.id,type: "ZR"}).then(res=>{
  1574. if (this.formTwo.tradingBoxFilesList.length === 0){
  1575. this.formTwo.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  1576. }
  1577. })
  1578. // 查看和编辑逻辑
  1579. }
  1580. done();
  1581. },
  1582. //删除图片
  1583. uploadDelete(file, column) {
  1584. return new Promise((resolve, reject) => {
  1585. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  1586. confirmButtonText: '确定',
  1587. cancelButtonText: '取消',
  1588. type: 'warning'
  1589. }).then(() => {
  1590. if (this.formTwo.tradingBoxFilesList[file.uid].id) {
  1591. tradingBoxFiles(this.formTwo.tradingBoxFilesList[file.uid].id).then(res => {
  1592. this.$message({
  1593. type: 'success',
  1594. message: '删除成功!'
  1595. });
  1596. resolve();
  1597. })
  1598. } else {
  1599. resolve();
  1600. }
  1601. }).catch(()=>{
  1602. reject();
  1603. this.$message({
  1604. type: "info",
  1605. message: "已取消删除"
  1606. });
  1607. })
  1608. })
  1609. },
  1610. getGSData(row,type) {
  1611. this[type[0]][type[1]] = row.cname
  1612. },
  1613. balabala(row,type) {
  1614. this[type[0]][type[1]] = row.name
  1615. },
  1616. backToList(type) {
  1617. if (type == 0){
  1618. console.log(this.baocunindex,1246)
  1619. if (this.baocunindex != 0) {
  1620. return this.$message.warning('请先填写保存数据');
  1621. }
  1622. if (this.detailData.id){
  1623. this.$router.push({
  1624. path: '/boxManagement/buyContainer/index'
  1625. });
  1626. }
  1627. this.$emit("backToList",type);
  1628. }else if (type == 1){
  1629. this.$router.push({
  1630. path: '/approveData/index'
  1631. });
  1632. this.$emit("backToList",type);
  1633. }
  1634. },
  1635. //自定义列保存
  1636. async saveColumnTwo(ref, option, optionBack, code) {
  1637. /**
  1638. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  1639. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  1640. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  1641. */
  1642. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  1643. if (inSave) {
  1644. this.$message.success("保存成功");
  1645. this.$nextTick(() => {
  1646. this.$refs.crud.doLayout()
  1647. })
  1648. //关闭窗口
  1649. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1650. }
  1651. },
  1652. resetTrigger(){
  1653. if (this.optionForm.disabled == true) {
  1654. if (this.form.status > 0) {
  1655. //基础资料
  1656. this.$set(this.optionForm, "disabled", true)
  1657. //箱信息
  1658. // this.$set(this.option, "disabled", true)
  1659. this.$set(this.option, "addBtn", false)
  1660. this.$set(this.option, "menu", false)
  1661. //费用信息
  1662. this.$set(this.$refs.boxCost.option, "disabled", true)
  1663. this.$set(this.$refs.boxCost.option, "addBtn", false)
  1664. this.$set(this.$refs.boxCost.option,"menu",false)
  1665. //附件和顶部按钮
  1666. this.disabled = true
  1667. } else {
  1668. //基础资料
  1669. this.$set(this.optionForm, "disabled", false)
  1670. //箱信息
  1671. this.$set(this.option, "disabled", false)
  1672. // this.$set(this.option, "addBtn", true)
  1673. this.$set(this.option, "menu", true)
  1674. //费用信息
  1675. this.$set(this.$refs.boxCost.option, "disabled", false)
  1676. // this.$set(this.$refs.boxCost.option, "addBtn", true)
  1677. this.$set(this.$refs.boxCost.option, "menu", true)
  1678. //附件和顶部按钮
  1679. this.disabled = false
  1680. }
  1681. }else {
  1682. //基础资料
  1683. this.$set(this.optionForm, "disabled", false)
  1684. //箱信息
  1685. this.$set(this.option, "disabled", false)
  1686. // this.$set(this.option, "addBtn", true)
  1687. this.$set(this.option, "menu", true)
  1688. //费用信息
  1689. this.$set(this.$refs.boxCost.option, "disabled", false)
  1690. // this.$set(this.$refs.boxCost.option, "addBtn", true)
  1691. this.$set(this.$refs.boxCost.option, "menu", true)
  1692. //附件和顶部按钮
  1693. this.disabled = false
  1694. }
  1695. this.$nextTick(() => {
  1696. this.$refs.crud.doLayout()
  1697. })
  1698. this.key++
  1699. },
  1700. //自定义列重置
  1701. async resetColumnTwo(ref, option, optionBack, code) {
  1702. this[option] = this[optionBack];
  1703. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  1704. if (inSave) {
  1705. this.resetTrigger()
  1706. this.$message.success("重置成功");
  1707. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  1708. }
  1709. }
  1710. }
  1711. }
  1712. </script>
  1713. <style scoped>
  1714. ::v-deep .el-form-item {
  1715. margin-bottom: 8px;
  1716. }
  1717. </style>