detailsPage.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  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="changeApproveOpen">特殊审批</el-dropdown-item>-->
  25. </el-dropdown-menu>
  26. </el-dropdown>
  27. <el-button class="el-button--small-yh" type="primary" size="small" :disabled="form.status>0"
  28. @click="editCustomer">
  29. 保存数据
  30. </el-button>
  31. </div>
  32. </div>
  33. <trade-card title="基础资料" style="margin-top: 50px">
  34. <avue-form :option="optionForm" v-model="form" ref="form">
  35. <template slot="purchaseCompanyId" slot-scope="scope">
  36. <crop-select v-model="form.purchaseCompanyId" @getCorpData="(row)=>{getGSData(row,['form','purchaseCompanyName'])}" :disabled="scope.disabled"
  37. corpType="KH"/>
  38. </template>
  39. </avue-form>
  40. </trade-card>
  41. <trade-card title="箱信息">
  42. <avue-crud
  43. :option="option"
  44. :data="dataList"
  45. v-model="formTwo"
  46. ref="crud"
  47. :key="key"
  48. :before-open="beforeOpen"
  49. :upload-delete="uploadDelete"
  50. @row-save="rowSave"
  51. @row-update="rowUpdate"
  52. @resetColumn="resetColumnTwo('crud','option','optionBack',235.1)"
  53. @saveColumn="saveColumnTwo('crud','option','optionBack',235.1)">
  54. <template slot-scope="{type,size,row,index,disabled}" slot="menu">
  55. <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
  56. @click="$refs.crud.rowEdit(row,index)">编辑
  57. </el-button>
  58. <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
  59. @click="rowDel(row,index,'MX')">删除
  60. </el-button>
  61. </template>
  62. <template slot="addressForm" slot-scope="scope">
  63. <port-info v-model="formTwo.addressId" type="id" :disabled="scope.disabled" @balabalaTow="balabala"/>
  64. </template>
  65. <!-- <template slot="boxMakingCompanyForm" slot-scope="scope">-->
  66. <!-- <crop-select v-model="formTwo.boxMakingCompanyId" :disabled="scope.disabled" :refresh="false"-->
  67. <!-- @getCorpData="(row)=>{getGSData(row,['formTwo','boxMakingCompany'])}" corpType="GS"/>-->
  68. <!-- </template>-->
  69. </avue-crud>
  70. </trade-card>
  71. <!-- 费用信息组件-->
  72. <box-cost v-model="dataListTwo" activeName="second" ref="boxCost" @resetTrigger="resetTrigger"></box-cost>
  73. <trade-card title="附件明细">
  74. <c-upload
  75. basic
  76. :data="tradingBoxFilesList"
  77. :disabled="disabled"
  78. deleteUrl="/api/blade-box-tube/tradingBoxFiles/remove"
  79. :enumerationValue="235.3"
  80. display
  81. />
  82. </trade-card>
  83. <el-dialog
  84. append-to-body
  85. title="审批进度"
  86. class="el-dialogDeep"
  87. :visible.sync="checkScheduleDialog"
  88. width="40%"
  89. :close-on-click-modal="false"
  90. :destroy-on-close="true"
  91. :close-on-press-escape="false"
  92. v-dialog-drag
  93. >
  94. <check-schedule
  95. :checkId="checkId"
  96. :batchNo="batchNo"
  97. @choceScheduleFun="choceScheduleFun"
  98. ></check-schedule>
  99. </el-dialog>
  100. </div>
  101. </template>
  102. <script>
  103. import {
  104. detail,
  105. submit,
  106. tradingBoxFiles,
  107. selectArchivesList,
  108. tradingBoxItem,
  109. tradingBoxFees,
  110. pleaseCheck,
  111. repealCancel
  112. } from "@/api/boxManagement/buyContainer";
  113. import checkSchedule from "@/components/check/checkSchedule";
  114. import {selectByName} from "@/api/boxManagement";
  115. export default {
  116. name: "detailsPage",
  117. props: {
  118. onLoad: Object,
  119. detailData: Object
  120. },
  121. components:{checkSchedule},
  122. data() {
  123. return {
  124. key: 0,
  125. checkScheduleDialog: false,
  126. checkId: '',
  127. batchNo: '',
  128. breakConfiguration: {
  129. multipleChoices: false,
  130. multiple: false,
  131. disabled: false,
  132. searchShow: true,
  133. collapseTags: false,
  134. clearable: true,
  135. placeholder: "请点击右边按钮选择",
  136. dicData: []
  137. },
  138. form: {},
  139. formTwo: {},
  140. optionForm: {
  141. menuBtn: false,
  142. span: 6,
  143. column: [{
  144. label: '系统号',
  145. prop: 'sysNo',
  146. disabled: true
  147. }, {
  148. label: '合同号',
  149. prop: 'contractNo',
  150. rules: [{
  151. required: true,
  152. message: " ",
  153. trigger: "blur"
  154. }]
  155. }, {
  156. label: '买入公司',
  157. prop: 'purchaseCompanyId',
  158. rules: [{
  159. required: true,
  160. message: " ",
  161. trigger: "blur"
  162. }]
  163. }, {
  164. label: '买入日期',
  165. prop: 'purchaseDate',
  166. type: "date",
  167. format: "yyyy-MM-dd",
  168. valueFormat: "yyyy-MM-dd HH:mm:ss",
  169. rules: [{
  170. required: true,
  171. message: " ",
  172. trigger: "blur"
  173. }]
  174. }, {
  175. label: '备注',
  176. prop: 'remarks',
  177. type: 'textarea',
  178. minRows: 3,
  179. span: 24
  180. }]
  181. },
  182. option: {},
  183. optionBack: {
  184. align: 'center',
  185. index: true,
  186. addBtnText: "录入明细",
  187. refreshBtn: false,
  188. addBtn: true,
  189. span: 8,
  190. addRowBtn: false,
  191. cellBtn: false,
  192. editBtn: false,
  193. delBtn: false,
  194. menuWidth: 140,
  195. dialogTop: 25,
  196. dialogWidth: "80%",
  197. showSummary: true,
  198. sumColumnList: [{
  199. name: 'amount',
  200. type: 'sum',
  201. decimals: 2
  202. },{
  203. name: 'emptyWeight',
  204. type: 'sum',
  205. decimals: 2
  206. },{
  207. name: 'grossWeight',
  208. type: 'sum',
  209. decimals: 2
  210. },{
  211. name: 'tare',
  212. type: 'sum',
  213. decimals: 2
  214. },{
  215. name: 'loadingWeight',
  216. type: 'sum',
  217. decimals: 2
  218. },{
  219. name: 'volume',
  220. type: 'sum',
  221. decimals: 2
  222. }],
  223. column: [{
  224. label: '箱号',
  225. prop: 'code',
  226. width: 100,
  227. overHidden: true,
  228. filterable: true,
  229. remote: true,
  230. allowCreate: true,
  231. type: "select",
  232. dicUrl: "/api/blade-box-tube/archives/selectArchivesList?size=10&current=1&code={{key}}",
  233. props: {
  234. label: "code",
  235. value: "code"
  236. },
  237. rules: [{
  238. required: true,
  239. message: " ",
  240. trigger: "blur"
  241. }]
  242. }, {
  243. label: '币别',
  244. prop: 'currency',
  245. width: 100,
  246. overHidden: true,
  247. filterable: true,
  248. type: "select",
  249. dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
  250. props: {
  251. label: "dictValue",
  252. value: "dictKey"
  253. },
  254. rules: [{
  255. required: true,
  256. message: " ",
  257. trigger: "blur"
  258. }]
  259. }, {
  260. label: '金额',
  261. prop: 'amount',
  262. type: 'number',
  263. controls: false,
  264. overHidden: true,
  265. width: 100,
  266. rules: [{
  267. required: true,
  268. message: " ",
  269. trigger: "blur"
  270. }]
  271. }, {
  272. label: '箱类型',
  273. prop: 'boxTypeId',
  274. width: 100,
  275. overHidden: true,
  276. filterable: true,
  277. type: 'select',
  278. props: {
  279. label: 'name',
  280. value: 'id'
  281. },
  282. dicUrl: '/api/blade-client/container/listMessage'
  283. }, {
  284. label: '最新地点',
  285. prop: 'address',
  286. overHidden: true,
  287. formProp: 'addressId',
  288. width: 100,
  289. rules: [{
  290. required: true,
  291. message: " ",
  292. trigger: "blur"
  293. }]
  294. }, {
  295. label: '最新日期',
  296. prop: 'newDate',
  297. overHidden: true,
  298. width: 100,
  299. type: "date",
  300. format: "yyyy-MM-dd",
  301. valueFormat: "yyyy-MM-dd HH:mm:ss",
  302. rules: [{
  303. required: true,
  304. message: " ",
  305. trigger: "blur"
  306. }]
  307. }, {
  308. label: '箱来源',
  309. prop: 'boxSource',
  310. width: 100,
  311. overHidden: true,
  312. filterable: true,
  313. type: 'select',
  314. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
  315. props: {
  316. label: "dictValue",
  317. value: "dictKey"
  318. },
  319. rules: [{
  320. required: true,
  321. message: " ",
  322. trigger: "blur"
  323. }]
  324. }, {
  325. label: '箱状态',
  326. prop: 'boxStatus',
  327. width: 100,
  328. overHidden: true,
  329. filterable: true,
  330. type: 'select',
  331. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
  332. props: {
  333. label: "dictValue",
  334. value: "dictKey"
  335. },
  336. rules: [{
  337. required: true,
  338. message: " ",
  339. trigger: "blur"
  340. }]
  341. }, {
  342. label: '空重(kg)',
  343. prop: 'emptyWeight',
  344. type: 'number',
  345. overHidden: true,
  346. controls: false,
  347. width: 100,
  348. rules: [{
  349. required: true,
  350. message: " ",
  351. trigger: "blur"
  352. }]
  353. }, {
  354. label: '毛重(kg)',
  355. prop: 'grossWeight',
  356. type: 'number',
  357. overHidden: true,
  358. controls: false,
  359. width: 100,
  360. rules: [{
  361. required: true,
  362. message: " ",
  363. trigger: "blur"
  364. }]
  365. }, {
  366. label: '皮重(kg)',
  367. prop: 'tare',
  368. overHidden: true,
  369. type: 'number',
  370. controls: false,
  371. width: 100
  372. }, {
  373. label: '装载重量(kg)',
  374. prop: 'loadingWeight',
  375. type: 'number',
  376. overHidden: true,
  377. controls: false,
  378. width: 100
  379. }, {
  380. label: '容积(m³)',
  381. prop: 'volume',
  382. type: 'number',
  383. overHidden: true,
  384. controls: false,
  385. width: 100
  386. }, {
  387. label: '状态',
  388. prop: 'status',
  389. width: 100,
  390. overHidden: true,
  391. filterable: true,
  392. type: 'select',
  393. dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
  394. props: {
  395. label: "dictValue",
  396. value: "dictKey"
  397. }
  398. }, {
  399. label: '造箱公司',
  400. prop: 'boxMakingCompany',
  401. overHidden: true,
  402. width: 100,
  403. rules: [{
  404. required: true,
  405. message: " ",
  406. trigger: "blur"
  407. }]
  408. }, {
  409. label: '造箱日期',
  410. prop: 'boxMakingDate',
  411. width: 100,
  412. overHidden: true,
  413. type: "date",
  414. format: "yyyy-MM-dd",
  415. valueFormat: "yyyy-MM-dd HH:mm:ss",
  416. rules: [{
  417. required: true,
  418. message: " ",
  419. trigger: "blur"
  420. }]
  421. }, {
  422. label: '箱来源日期',
  423. prop: 'leaseCommencementDate',
  424. width: 100,
  425. overHidden: true,
  426. type: "date",
  427. format: "yyyy-MM-dd",
  428. valueFormat: "yyyy-MM-dd HH:mm:ss",
  429. rules: [{
  430. required: true,
  431. message: " ",
  432. trigger: "blur"
  433. }]
  434. }, {
  435. label: '箱龄',
  436. prop: 'boxAge',
  437. type: 'number',
  438. controls: false,
  439. overHidden: true,
  440. width: 100,
  441. rules: [{
  442. required: true,
  443. message: " ",
  444. trigger: "blur"
  445. }]
  446. }, {
  447. label: '照片',
  448. prop: 'tradingBoxFilesList',
  449. width: 200,
  450. overHidden: true,
  451. type: 'upload',
  452. span: 24,
  453. listType: 'picture-card',
  454. tip: '只能上传jpg/png文件,且不超过500kb',
  455. propsHttp: {
  456. url: 'link',
  457. name: 'originalName',
  458. res: 'data'
  459. },
  460. action: '/api/blade-resource/oss/endpoint/put-file'
  461. }, {
  462. label: '备注',
  463. prop: 'remarks',
  464. overHidden: true,
  465. type: 'textarea',
  466. minRows: 3,
  467. span: 24,
  468. width: 200
  469. }]
  470. },
  471. dataList: [],
  472. dataListTwo:[],
  473. tradingBoxFilesList: [],
  474. disabled: false,
  475. costData:{}
  476. }
  477. },
  478. async created() {
  479. this.option = await this.getColumnData(this.getColumnName(235.1), this.optionBack);
  480. selectByName("买箱费").then(res => {
  481. this.costData = res.data.data
  482. })
  483. //下拉箱号带出对应信息
  484. // this.findObject(this.option.column, "code").change = ({value, column}) => {
  485. // selectArchivesList({code: value}).then(res => {
  486. // for (let item of res.data.data) {
  487. // if (value == item.code) {
  488. // this.formTwo = {
  489. // boxSource: item.boxSource,
  490. // boxStatus: item.boxStatus,
  491. // emptyWeight: item.emptyWeight,
  492. // grossWeight: item.gorssWeight,
  493. // tare: item.tare,
  494. // loadingWeight: item.loadingWeight,
  495. // volume: item.volume,
  496. // }
  497. // }
  498. // }
  499. // })
  500. // }
  501. this.key++
  502. if (this.onLoad.id && this.detailData.id) {
  503. this.refresh(this.onLoad.id,true)
  504. }else if (this.onLoad.id){
  505. this.refresh(this.onLoad.id,true)
  506. }
  507. },
  508. methods: {
  509. confirmEdit() {
  510. if (this.form.status > 0) {
  511. //基础资料
  512. this.$set(this.optionForm, "disabled", true)
  513. //箱信息
  514. this.$set(this.option, "disabled", true)
  515. this.$set(this.option, "addBtn", false)
  516. this.$set(this.option, "menu", false)
  517. //费用信息
  518. this.$set(this.$refs.boxCost.option,"disabled",true)
  519. this.$set(this.$refs.boxCost.option,"addBtn",false)
  520. this.$set(this.$refs.boxCost.option,"menu",false)
  521. //附件和顶部按钮
  522. this.disabled = true
  523. } else {
  524. //基础资料
  525. this.$set(this.optionForm, "disabled", false)
  526. //箱信息
  527. this.$set(this.option, "disabled", false)
  528. this.$set(this.option, "addBtn", true)
  529. this.$set(this.option, "menu", true)
  530. //费用信息
  531. this.$set(this.$refs.boxCost.option,"disabled",false)
  532. this.$set(this.$refs.boxCost.option,"addBtn",true)
  533. this.$set(this.$refs.boxCost.option,"menu",true)
  534. //附件和顶部按钮
  535. this.disabled = false
  536. }
  537. },
  538. // 明细删除
  539. rowDel(row, index, type) {
  540. this.$confirm("确定将选择数据删除?", {
  541. confirmButtonText: "确定",
  542. cancelButtonText: "取消",
  543. type: "warning"
  544. }).then(() => {
  545. if (row.id) {
  546. tradingBoxItem(row.id).then(res => {
  547. if (res.data.success) {
  548. this.$message.success("操作成功!");
  549. this.dataList.splice(index, 1);
  550. if (this.dataListTwo.length > 0) {
  551. for (let item in this.dataListTwo) {
  552. if (this.dataListTwo[item].code == row.code) {
  553. if (this.dataListTwo[item].autoGenerate == 1) {
  554. if (this.dataListTwo[item].id) {
  555. tradingBoxFees(this.dataListTwo[item].id).then(res => {
  556. if (res.data.success) {
  557. this.dataListTwo.splice(index, 1);
  558. }
  559. });
  560. } else {
  561. this.dataListTwo.splice(Number(item), 1);
  562. }
  563. }
  564. }
  565. }
  566. }
  567. }
  568. });
  569. } else {
  570. this.dataList.splice(index, 1);
  571. this.$message.success("操作成功!");
  572. if (this.dataListTwo.length > 0) {
  573. for (let item in this.dataListTwo) {
  574. if (this.dataListTwo[item].code == row.code) {
  575. if (this.dataListTwo[item].autoGenerate == 1) {
  576. this.dataListTwo.splice(Number(item), 1);
  577. }
  578. }
  579. }
  580. }
  581. }
  582. }
  583. )
  584. ;
  585. },
  586. balabala(val) {
  587. if (val === null) {
  588. this.formTwo.address = ''
  589. } else {
  590. this.formTwo.address = val.name
  591. }
  592. },
  593. //选择费用名称
  594. selectValue(value) {
  595. this.formThree.itemName = value.cname
  596. },
  597. //撤销
  598. repealCancel(){
  599. this.$confirm("您确定撤回此次申请吗?", {
  600. confirmButtonText: "确定",
  601. cancelButtonText: "取消",
  602. type: "warning"
  603. }).then(() => {
  604. const data = {
  605. id : this.form.id,
  606. pageLabel:"买箱",
  607. checkFlag: 1,
  608. }
  609. const loading = this.$loading({
  610. lock: true,
  611. text: '加载中',
  612. spinner: 'el-icon-loading',
  613. background: 'rgba(255,255,255,0.7)'
  614. });
  615. repealCancel(data).then(res => {
  616. loading.close();
  617. this.$message.success('撤回成功')
  618. this.refresh(this.form.id)
  619. }).catch(()=>{
  620. loading.close();
  621. })
  622. })
  623. },
  624. // 请核
  625. pleaseCheck() {
  626. this.$confirm("您确定提交请核申请吗?", {
  627. confirmButtonText: "确定",
  628. cancelButtonText: "取消",
  629. type: "warning"
  630. }).then(() => {
  631. this.$refs["form"].validate((valid,done) => {
  632. done()
  633. if (valid) {
  634. if (this.dataList.length === 0) {
  635. return this.$message.error("箱信息不能为空")
  636. }
  637. if (this.$refs.boxCost.dataList.length === 0) {
  638. return this.$message.error("费用信息不能为空")
  639. }else {
  640. for (let item of this.$refs.boxCost.dataList){
  641. if (!item.id){
  642. return this.$message.error("费用信息未保存")
  643. }
  644. }
  645. }
  646. let data = {
  647. ...this.form,
  648. tradingBoxItemsList: this.dataList,
  649. tradingBoxFeesList: this.dataListTwo,
  650. tradingBoxFilesList: this.tradingBoxFilesList,
  651. type: "BUY"
  652. }
  653. const loading = this.$loading({
  654. lock: true,
  655. text: '加载中',
  656. spinner: 'el-icon-loading',
  657. background: 'rgba(255,255,255,0.7)'
  658. });
  659. submit(data).then(res => {
  660. const data = {
  661. id: res.data.data.id,
  662. url: '/boxManagement/buyContainer/index',
  663. pageStatus: "this.$store.getters.domSaleStatus",
  664. pageLabel: "买箱",
  665. checkFlag: 1,
  666. }
  667. pleaseCheck({
  668. ...data,
  669. type: "BUY"
  670. }).then(rest => {
  671. loading.close();
  672. this.$message.success('请核成功')
  673. this.refresh(res.data.data.id)
  674. }).catch(()=>{
  675. loading.close();
  676. })
  677. }).catch(()=>{
  678. loading.close();
  679. })
  680. }
  681. });
  682. })
  683. },
  684. //审核关闭
  685. choceScheduleFun(){
  686. this.checkScheduleDialog = false
  687. },
  688. refresh(id,type) {
  689. const loading = this.$loading({
  690. lock: true,
  691. text: '加载中',
  692. spinner: 'el-icon-loading',
  693. background: 'rgba(255,255,255,0.7)'
  694. });
  695. detail({id: id}).then(res => {
  696. this.form = res.data.data
  697. this.dataList = res.data.data.tradingBoxItemsList
  698. this.dataListTwo = res.data.data.tradingBoxFeesList
  699. this.tradingBoxFilesList = res.data.data.tradingBoxFilesList
  700. delete this.form.tradingBoxItemsList
  701. delete this.form.tradingBoxFeesList
  702. delete this.form.tradingBoxFilesList
  703. loading.close();
  704. if (type) {
  705. //基础资料
  706. this.$set(this.optionForm, "disabled", true)
  707. //箱信息
  708. this.$set(this.option, "disabled", true)
  709. this.$set(this.option, "addBtn", false)
  710. this.$set(this.option, "menu", false)
  711. //费用信息
  712. this.$set(this.$refs.boxCost.option, "disabled", true)
  713. this.$set(this.$refs.boxCost.option, "addBtn", false)
  714. this.$set(this.$refs.boxCost.option, "menu", false)
  715. //附件和顶部按钮
  716. this.disabled = true
  717. }else {
  718. if (this.form.status > 0) {
  719. //基础资料
  720. this.$set(this.optionForm, "disabled", true)
  721. //箱信息
  722. this.$set(this.option, "disabled", true)
  723. this.$set(this.option, "addBtn", false)
  724. this.$set(this.option, "menu", false)
  725. //费用信息
  726. this.$set(this.$refs.boxCost.option, "disabled", true)
  727. this.$set(this.$refs.boxCost.option, "addBtn", false)
  728. this.$set(this.$refs.boxCost.option,"menu",false)
  729. //附件和顶部按钮
  730. this.disabled = true
  731. } else {
  732. //基础资料
  733. this.$set(this.optionForm, "disabled", false)
  734. //箱信息
  735. this.$set(this.option, "disabled", false)
  736. this.$set(this.option, "addBtn", true)
  737. this.$set(this.option, "menu", true)
  738. //费用信息
  739. this.$set(this.$refs.boxCost.option, "disabled", false)
  740. this.$set(this.$refs.boxCost.option, "addBtn", true)
  741. this.$set(this.$refs.boxCost.option, "menu", true)
  742. //附件和顶部按钮
  743. this.disabled = false
  744. }
  745. }
  746. })
  747. },
  748. //新增修改
  749. editCustomer() {
  750. this.$refs["form"].validate((valid,done) => {
  751. done()
  752. if (valid) {
  753. let data = {
  754. ...this.form,
  755. tradingBoxItemsList: this.dataList,
  756. tradingBoxFeesList: this.dataListTwo,
  757. tradingBoxFilesList: this.tradingBoxFilesList,
  758. type: "BUY"
  759. }
  760. const loading = this.$loading({
  761. lock: true,
  762. text: '加载中',
  763. spinner: 'el-icon-loading',
  764. background: 'rgba(255,255,255,0.7)'
  765. });
  766. submit(data).then(res => {
  767. if (this.form.id) {
  768. this.$message.success("修改成功")
  769. } else {
  770. this.$message.success("新增成功")
  771. }
  772. loading.close();
  773. this.refresh(res.data.data.id)
  774. }).catch(()=>{
  775. loading.close();
  776. })
  777. }
  778. });
  779. },
  780. rowSave(form,done,loading) {
  781. let result = this.dataList.some((item) => {
  782. if (item.code == form.code) {
  783. return true
  784. }
  785. })
  786. if (result === true) {
  787. this.$message.error("已存在此箱号");
  788. return loading();
  789. }
  790. done(form)
  791. this.getWorkDicts("currency").then(res => {
  792. for (let item of res.data.data){
  793. if (item.dictValue == form.currency){
  794. form.exchangeRate = item.remark
  795. }
  796. }
  797. this.dataListTwo.push({
  798. corpId: this.form.purchaseCompanyId,
  799. corpName: this.form.purchaseCompanyName,
  800. code: form.code,
  801. itemId: this.costData.id,
  802. itemName: this.costData.cname,
  803. currency: form.currency,
  804. price: form.amount,
  805. quantity: 1,
  806. autoGenerate: 1,
  807. exchangeRate:form.exchangeRate || 1,
  808. feesType:2,
  809. amount: form.amount,
  810. })
  811. });
  812. },
  813. rowUpdate(form, index, done, loading) {
  814. form.boxType = form.$boxTypeId
  815. done(form)
  816. this.getWorkDicts("currency").then(res => {
  817. for (let item of res.data.data){
  818. if (item.dictValue == form.currency){
  819. form.exchangeRate = item.remark
  820. }
  821. }
  822. if (this.dataListTwo.length > 0) {
  823. for (let item in this.dataListTwo) {
  824. if (this.dataListTwo[item].code == form.code) {
  825. if (this.dataListTwo[item].autoGenerate == 1) {
  826. this.dataListTwo.splice(Number(item), 1, {
  827. ...this.dataListTwo[item],
  828. corpId: this.form.purchaseCompanyId,
  829. corpName: this.form.purchaseCompanyName,
  830. code: form.code,
  831. currency: form.currency,
  832. price: form.amount,
  833. exchangeRate:form.exchangeRate || 1,
  834. amount: form.amount
  835. })
  836. this.key++
  837. }
  838. }
  839. }
  840. }
  841. });
  842. },
  843. //打开表单前
  844. beforeOpen(done,type){
  845. if (type === "add"){
  846. this.formTwo.boxSource = this.$refs.crud.DIC.boxSource.length === 0?"":this.$refs.crud.DIC.boxSource[0].dictKey
  847. this.formTwo.status = this.$refs.crud.DIC.status.length === 0?"":this.$refs.crud.DIC.status[0].dictKey
  848. }
  849. done();
  850. },
  851. //删除图片
  852. uploadDelete(file, column) {
  853. return new Promise((resolve, reject) => {
  854. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  855. confirmButtonText: '确定',
  856. cancelButtonText: '取消',
  857. type: 'warning'
  858. }).then(() => {
  859. if (this.formTwo.tradingBoxFilesList[file.uid].id) {
  860. tradingBoxFiles(this.formTwo.tradingBoxFilesList[file.uid].id).then(res => {
  861. this.$message({
  862. type: 'success',
  863. message: '删除成功!'
  864. });
  865. resolve();
  866. })
  867. } else {
  868. resolve();
  869. }
  870. }).catch(()=>{
  871. reject();
  872. this.$message({
  873. type: "info",
  874. message: "已取消删除"
  875. });
  876. })
  877. })
  878. },
  879. getGSData(row,type) {
  880. this[type[0]][type[1]] = row.cname
  881. },
  882. backToList(type) {
  883. if (type == 0){
  884. if (this.detailData.id){
  885. this.$router.push({
  886. path: '/boxManagement/buyContainer/index'
  887. });
  888. }
  889. this.$emit("backToList",type);
  890. }else if (type == 1){
  891. this.$router.push({
  892. path: '/approveData/index'
  893. });
  894. this.$emit("backToList",type);
  895. }
  896. },
  897. //自定义列保存
  898. async saveColumnTwo(ref, option, optionBack, code) {
  899. /**
  900. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  901. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  902. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  903. */
  904. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  905. if (inSave) {
  906. this.$message.success("保存成功");
  907. //关闭窗口
  908. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  909. }
  910. },
  911. resetTrigger(){
  912. if (this.optionForm.disabled == true) {
  913. if (this.form.status > 0) {
  914. //基础资料
  915. this.$set(this.optionForm, "disabled", true)
  916. //箱信息
  917. this.$set(this.option, "disabled", true)
  918. this.$set(this.option, "addBtn", false)
  919. this.$set(this.option, "menu", false)
  920. //费用信息
  921. this.$set(this.$refs.boxCost.option, "disabled", true)
  922. this.$set(this.$refs.boxCost.option, "addBtn", false)
  923. this.$set(this.$refs.boxCost.option,"menu",false)
  924. //附件和顶部按钮
  925. this.disabled = true
  926. } else {
  927. //基础资料
  928. this.$set(this.optionForm, "disabled", false)
  929. //箱信息
  930. this.$set(this.option, "disabled", false)
  931. this.$set(this.option, "addBtn", true)
  932. this.$set(this.option, "menu", true)
  933. //费用信息
  934. this.$set(this.$refs.boxCost.option, "disabled", false)
  935. this.$set(this.$refs.boxCost.option, "addBtn", true)
  936. this.$set(this.$refs.boxCost.option, "menu", true)
  937. //附件和顶部按钮
  938. this.disabled = false
  939. }
  940. }else {
  941. //基础资料
  942. this.$set(this.optionForm, "disabled", false)
  943. //箱信息
  944. this.$set(this.option, "disabled", false)
  945. this.$set(this.option, "addBtn", true)
  946. this.$set(this.option, "menu", true)
  947. //费用信息
  948. this.$set(this.$refs.boxCost.option, "disabled", false)
  949. this.$set(this.$refs.boxCost.option, "addBtn", true)
  950. this.$set(this.$refs.boxCost.option, "menu", true)
  951. //附件和顶部按钮
  952. this.disabled = false
  953. }
  954. },
  955. //自定义列重置
  956. async resetColumnTwo(ref, option, optionBack, code) {
  957. this[option] = this[optionBack];
  958. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  959. if (inSave) {
  960. this.resetTrigger()
  961. this.$message.success("重置成功");
  962. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  963. }
  964. }
  965. }
  966. }
  967. </script>
  968. <style scoped>
  969. ::v-deep .el-form-item {
  970. margin-bottom: 8px;
  971. }
  972. </style>