detailsPage.vue 57 KB

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