detailsPage.vue 51 KB

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