detailsPage.vue 50 KB

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