detailsPage.vue 55 KB

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