1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072 |
- <template>
- <div>
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList(0)">返回列表
- </el-button>
- <el-button v-if="detailData.id" type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList(1)">返回审核列表
- </el-button>
- </div>
- <div class="add-customer-btn">
- <el-button class="el-button--small-yh" style="margin-right: 10px" type="primary" size="small" :disabled="form.status>0"
- @click="confirmEdit" v-if="optionForm.disabled === true">编辑
- </el-button>
- <el-dropdown style="margin-right: 10px">
- <el-button type="primary" size="small">
- 审核处理<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item @click.native="pleaseCheck" :disabled="form.status>0">请核数据</el-dropdown-item>
- <el-dropdown-item @click.native="checkScheduleDialog = true,checkId = form.id">审核进度</el-dropdown-item>
- <el-dropdown-item @click.native="repealCancel" :disabled="form.status === 0 || !form.status" v-if="!detailData.id">撤销请核</el-dropdown-item>
- <!-- <el-dropdown-item @click.native="changeApproveOpen">特殊审批</el-dropdown-item>-->
- </el-dropdown-menu>
- </el-dropdown>
- <el-button class="el-button--small-yh" type="primary" size="small" :disabled="form.status>0"
- @click="editCustomer">
- 保存数据
- </el-button>
- </div>
- </div>
- <trade-card title="基础资料" style="margin-top: 50px">
- <avue-form :option="optionForm" v-model="form" ref="form">
- <template slot="purchaseCompanyId" slot-scope="scope">
- <crop-select v-model="form.purchaseCompanyId" @getCorpData="(row)=>{getGSData(row,['form','purchaseCompanyName'])}" :disabled="scope.disabled"
- corpType="KH"/>
- </template>
- </avue-form>
- </trade-card>
- <trade-card title="箱信息">
- <avue-crud
- :option="option"
- :data="dataList"
- v-model="formTwo"
- ref="crud"
- :key="key"
- :before-open="beforeOpen"
- :upload-delete="uploadDelete"
- @row-save="rowSave"
- @row-update="rowUpdate"
- @resetColumn="resetColumnTwo('crud','option','optionBack',235.1)"
- @saveColumn="saveColumnTwo('crud','option','optionBack',235.1)">
- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
- <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
- @click="$refs.crud.rowEdit(row,index)">编辑
- </el-button>
- <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
- @click="rowDel(row,index,'MX')">删除
- </el-button>
- </template>
- <template slot="addressForm" slot-scope="scope">
- <port-info v-model="formTwo.addressId" type="id" :disabled="scope.disabled" @balabalaTow="balabala"/>
- </template>
- <!-- <template slot="boxMakingCompanyForm" slot-scope="scope">-->
- <!-- <crop-select v-model="formTwo.boxMakingCompanyId" :disabled="scope.disabled" :refresh="false"-->
- <!-- @getCorpData="(row)=>{getGSData(row,['formTwo','boxMakingCompany'])}" corpType="GS"/>-->
- <!-- </template>-->
- <template slot="menuLeft" slot-scope="scope">
- <el-button :disabled="option.disabled" type="success" size="small" icon="el-icon-bottom" @click="importBox">
- 导入
- </el-button>
- <el-button class="el-icon-download" type="info" size="small" :disabled="!form.id" @click="openReport">报表打印</el-button>
- </template>
- </avue-crud>
- </trade-card>
- <!-- 报表-->
- <report-dialog
- :switchDialog="switchDialog"
- :reportId="form.id"
- reportName="买箱"
- @onClose="onClose()"
- />
- <!-- 费用信息组件-->
- <box-cost v-model="dataListTwo" activeName="second" ref="boxCost" @resetTrigger="resetTrigger"></box-cost>
- <trade-card title="附件明细">
- <c-upload
- basic
- :data="tradingBoxFilesList"
- :disabled="disabled"
- deleteUrl="/api/blade-box-tube/tradingBoxFiles/remove"
- :enumerationValue="235.3"
- display
- />
- </trade-card>
- <el-dialog title="导入箱档案" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
- v-dialog-drag>
- <avue-form v-if="excelBox" :option="excelOption" v-model="excelForm" table-loading="excelLoading"
- :upload-before="uploadBefore" :upload-after="uploadAfter">
- <template slot="excelTemplate">
- <el-button type="primary" @click="derivation">
- 点击下载<i class="el-icon-download el-icon--right"></i>
- </el-button>
- </template>
- </avue-form>
- <p style="text-align: center;color: #DC0505">
- 温馨提示 第一次导入时请先下载模板
- </p>
- </el-dialog>
- <el-dialog
- append-to-body
- title="审批进度"
- class="el-dialogDeep"
- :visible.sync="checkScheduleDialog"
- width="40%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- v-dialog-drag
- >
- <check-schedule
- :checkId="checkId"
- :batchNo="batchNo"
- @choceScheduleFun="choceScheduleFun"
- ></check-schedule>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- detail,
- submit,
- tradingBoxFiles,
- selectArchivesList,
- tradingBoxItem,
- tradingBoxFees,
- pleaseCheck,
- repealCancel
- } from "@/api/boxManagement/buyContainer";
- import reportDialog from "@/components/report-dialog/main";
- import checkSchedule from "@/components/check/checkSchedule";
- import {selectByName} from "@/api/boxManagement";
- import {getToken} from "@/util/auth";
- export default {
- name: "detailsPage",
- props: {
- onLoad: Object,
- detailData: Object
- },
- components:{checkSchedule,reportDialog},
- data() {
- return {
- key: 0,
- switchDialog: false,
- excelBox: false,
- excelOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: "模板下载",
- prop: "excelTemplate",
- formslot: true,
- span: 24
- },
- {
- label: "模板上传",
- prop: "excelFile",
- type: "upload",
- drag: true,
- loadText: "模板上传中,请稍等",
- span: 24,
- propsHttp: {
- res: "data"
- },
- tip: "请上传 .xls,.xlsx 标准格式文件",
- action: "/api/blade-box-tube/tradingBoxRent/import-tradingBox-info"
- }
- ]
- },
- excelForm: {},
- checkScheduleDialog: false,
- checkId: '',
- batchNo: '',
- breakConfiguration: {
- multipleChoices: false,
- multiple: false,
- disabled: false,
- searchShow: true,
- collapseTags: false,
- clearable: true,
- placeholder: "请点击右边按钮选择",
- dicData: []
- },
- form: {},
- formTwo: {},
- optionForm: {
- menuBtn: false,
- span: 6,
- column: [{
- label: '系统号',
- prop: 'sysNo',
- disabled: true
- }, {
- label: '合同号',
- prop: 'contractNo',
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '买入公司',
- prop: 'purchaseCompanyId',
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '买入日期',
- prop: 'purchaseDate',
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '备注',
- prop: 'remarks',
- type: 'textarea',
- minRows: 3,
- span: 24
- }]
- },
- option: {},
- optionBack: {
- align: 'center',
- index: true,
- addBtnText: "录入明细",
- refreshBtn: false,
- addBtn: true,
- span: 8,
- addRowBtn: false,
- cellBtn: false,
- editBtn: false,
- delBtn: false,
- menuWidth: 140,
- dialogTop: 25,
- dialogWidth: "80%",
- showSummary: true,
- sumColumnList: [{
- name: 'amount',
- type: 'sum',
- decimals: 2
- },{
- name: 'emptyWeight',
- type: 'sum',
- decimals: 2
- },{
- name: 'grossWeight',
- type: 'sum',
- decimals: 2
- },{
- name: 'tare',
- type: 'sum',
- decimals: 2
- },{
- name: 'loadingWeight',
- type: 'sum',
- decimals: 2
- },{
- name: 'volume',
- type: 'sum',
- decimals: 2
- }],
- column: [{
- label: '箱号',
- prop: 'code',
- width: 100,
- overHidden: true,
- // filterable: true,
- // remote: true,
- // allowCreate: true,
- // type: "select",
- // dicUrl: "/api/blade-box-tube/archives/selectArchivesList?size=10¤t=1&code={{key}}",
- // props: {
- // label: "code",
- // value: "code"
- // },
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '币别',
- prop: 'currency',
- width: 100,
- overHidden: true,
- filterable: true,
- type: "select",
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '金额',
- prop: 'amount',
- type: 'number',
- controls: false,
- overHidden: true,
- width: 100,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '箱类型',
- prop: 'boxTypeId',
- width: 100,
- overHidden: true,
- filterable: true,
- type: 'select',
- props: {
- label: 'name',
- value: 'id'
- },
- dicUrl: '/api/blade-client/container/listMessage'
- }, {
- label: '最新地点',
- prop: 'address',
- overHidden: true,
- formProp: 'addressId',
- width: 100,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '最新日期',
- prop: 'newDate',
- overHidden: true,
- width: 100,
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '箱来源',
- prop: 'boxSource',
- width: 100,
- overHidden: true,
- filterable: true,
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '箱状态',
- prop: 'boxStatus',
- width: 100,
- overHidden: true,
- filterable: true,
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '空重(kg)',
- prop: 'emptyWeight',
- type: 'number',
- overHidden: true,
- controls: false,
- width: 100,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '毛重(kg)',
- prop: 'grossWeight',
- type: 'number',
- overHidden: true,
- controls: false,
- width: 100,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '皮重(kg)',
- prop: 'tare',
- overHidden: true,
- type: 'number',
- controls: false,
- width: 100
- }, {
- label: '装载重量(kg)',
- prop: 'loadingWeight',
- type: 'number',
- overHidden: true,
- controls: false,
- width: 100
- }, {
- label: '容积(m³)',
- prop: 'volume',
- type: 'number',
- overHidden: true,
- controls: false,
- width: 100
- }, {
- label: '状态',
- prop: 'status',
- width: 100,
- overHidden: true,
- filterable: true,
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
- props: {
- label: "dictValue",
- value: "dictKey"
- }
- }, {
- label: '造箱公司',
- prop: 'boxMakingCompany',
- overHidden: true,
- width: 100,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '造箱日期',
- prop: 'boxMakingDate',
- width: 100,
- overHidden: true,
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '箱来源日期',
- prop: 'leaseCommencementDate',
- width: 100,
- overHidden: true,
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '箱龄',
- prop: 'boxAge',
- type: 'number',
- controls: false,
- overHidden: true,
- width: 100,
- rules: [{
- required: true,
- message: " ",
- trigger: "blur"
- }]
- }, {
- label: '照片',
- prop: 'tradingBoxFilesList',
- width: 200,
- overHidden: true,
- type: 'upload',
- span: 24,
- listType: 'picture-card',
- tip: '只能上传jpg/png文件,且不超过500kb',
- propsHttp: {
- url: 'link',
- name: 'originalName',
- res: 'data'
- },
- action: '/api/blade-resource/oss/endpoint/put-file'
- }, {
- label: '备注',
- prop: 'remarks',
- overHidden: true,
- type: 'textarea',
- minRows: 3,
- span: 24,
- width: 200
- }]
- },
- dataList: [],
- dataListTwo:[],
- tradingBoxFilesList: [],
- disabled: false,
- costData:{}
- }
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(235.1), this.optionBack);
- selectByName("买箱费").then(res => {
- this.costData = res.data.data
- })
- //下拉箱号带出对应信息
- // this.findObject(this.option.column, "code").change = ({value, column}) => {
- // selectArchivesList({code: value}).then(res => {
- // for (let item of res.data.data) {
- // if (value == item.code) {
- // this.formTwo = {
- // boxSource: item.boxSource,
- // boxStatus: item.boxStatus,
- // emptyWeight: item.emptyWeight,
- // grossWeight: item.gorssWeight,
- // tare: item.tare,
- // loadingWeight: item.loadingWeight,
- // volume: item.volume,
- // }
- // }
- // }
- // })
- // }
- this.key++
- if (this.onLoad.id && this.detailData.id) {
- this.refresh(this.onLoad.id,true)
- }else if (this.onLoad.id){
- this.refresh(this.onLoad.id,true)
- }
- },
- methods: {
- // 报表
- openReport() {
- this.switchDialog = !this.switchDialog;
- },
- // 报表关闭
- onClose(val) {
- this.switchDialog = val;
- },
- importBox() {
- this.findObject(this.excelOption.column, "excelFile").data = {
- corpId: this.form.purchaseCompanyId,
- corpName: this.form.purchaseCompanyName,
- billType: "BUY"
- }
- this.excelBox = true
- },
- uploadBefore(file, done, loading) {
- loading = true;
- done();
- },
- uploadAfter(res, done, loading, column) {
- this.excelBox = false;
- if (typeof res.message === "string") return
- for (let item of this.dataList) {
- for (let li of res.tradingBoxItemList) {
- if (item.code === li.code) {
- return this.$message.error(`箱号:${item.code}重复!`);
- }
- }
- }
- this.dataList = this.dataList.concat(res.tradingBoxItemList)
- this.dataListTwo = this.dataListTwo.concat(res.tradingBoxFeesList)
- this.$message.success("导入成功!");
- loading = false;
- done();
- },
- derivation() {
- window.open(`/api/blade-box-tube/tradingBoxRent/export-tradingBox-info?${this.website.tokenHeader}=${getToken()}`);
- },
- confirmEdit() {
- if (this.form.status > 0) {
- //基础资料
- this.$set(this.optionForm, "disabled", true)
- //箱信息
- this.$set(this.option, "disabled", true)
- this.$set(this.option, "addBtn", false)
- this.$set(this.option, "menu", false)
- //费用信息
- this.$set(this.$refs.boxCost.option, "disabled", true)
- this.$set(this.$refs.boxCost.option,"addBtn",false)
- this.$set(this.$refs.boxCost.option,"menu",false)
- //附件和顶部按钮
- this.disabled = true
- } else {
- //基础资料
- this.$set(this.optionForm, "disabled", false)
- //箱信息
- this.$set(this.option, "disabled", false)
- this.$set(this.option, "addBtn", true)
- this.$set(this.option, "menu", true)
- //费用信息
- this.$set(this.$refs.boxCost.option,"disabled",false)
- this.$set(this.$refs.boxCost.option,"addBtn",true)
- this.$set(this.$refs.boxCost.option,"menu",true)
- //附件和顶部按钮
- this.disabled = false
- }
- },
- // 明细删除
- rowDel(row, index, type) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- tradingBoxItem(row.id).then(res => {
- if (res.data.success) {
- this.$message.success("操作成功!");
- this.dataList.splice(index, 1);
- if (this.dataListTwo.length > 0) {
- for (let item in this.dataListTwo) {
- if (this.dataListTwo[item].code == row.code) {
- if (this.dataListTwo[item].autoGenerate == 1) {
- if (this.dataListTwo[item].id) {
- tradingBoxFees(this.dataListTwo[item].id).then(res => {
- if (res.data.success) {
- this.dataListTwo.splice(index, 1);
- }
- });
- } else {
- this.dataListTwo.splice(Number(item), 1);
- }
- }
- }
- }
- }
- }
- });
- } else {
- this.dataList.splice(index, 1);
- this.$message.success("操作成功!");
- if (this.dataListTwo.length > 0) {
- for (let item in this.dataListTwo) {
- if (this.dataListTwo[item].code == row.code) {
- if (this.dataListTwo[item].autoGenerate == 1) {
- this.dataListTwo.splice(Number(item), 1);
- }
- }
- }
- }
- }
- }
- )
- ;
- },
- balabala(val) {
- if (val === null) {
- this.formTwo.address = ''
- } else {
- this.formTwo.address = val.name
- }
- },
- //选择费用名称
- selectValue(value) {
- this.formThree.itemName = value.cname
- },
- //撤销
- repealCancel(){
- this.$confirm("您确定撤回此次申请吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- const data = {
- id : this.form.id,
- pageLabel:"买箱",
- checkFlag: 1,
- }
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- repealCancel(data).then(res => {
- loading.close();
- this.$message.success('撤回成功')
- this.refresh(this.form.id)
- }).catch(()=>{
- loading.close();
- })
- })
- },
- // 请核
- pleaseCheck() {
- this.$confirm("您确定提交请核申请吗?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$refs["form"].validate((valid,done) => {
- done()
- if (valid) {
- if (this.dataList.length === 0) {
- return this.$message.error("箱信息不能为空")
- }
- if (this.$refs.boxCost.dataList.length === 0) {
- return this.$message.error("费用信息不能为空")
- }else {
- for (let item of this.$refs.boxCost.dataList){
- if (!item.id){
- return this.$message.error("费用信息未保存")
- }
- }
- }
- let data = {
- ...this.form,
- tradingBoxItemsList: this.dataList,
- tradingBoxFeesList: this.dataListTwo,
- tradingBoxFilesList: this.tradingBoxFilesList,
- type: "BUY"
- }
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- submit(data).then(res => {
- const data = {
- id: res.data.data.id,
- url: '/boxManagement/buyContainer/index',
- pageStatus: "this.$store.getters.domSaleStatus",
- pageLabel: "买箱",
- checkFlag: 1,
- }
- pleaseCheck({
- ...data,
- type: "BUY"
- }).then(rest => {
- loading.close();
- this.$message.success('请核成功')
- this.refresh(res.data.data.id)
- }).catch(()=>{
- loading.close();
- })
- }).catch(()=>{
- loading.close();
- })
- }
- });
- })
- },
- //审核关闭
- choceScheduleFun(){
- this.checkScheduleDialog = false
- },
- refresh(id,type) {
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- detail({id: id}).then(res => {
- this.form = res.data.data
- this.dataList = res.data.data.tradingBoxItemsList
- this.dataListTwo = res.data.data.tradingBoxFeesList
- this.tradingBoxFilesList = res.data.data.tradingBoxFilesList
- delete this.form.tradingBoxItemsList
- delete this.form.tradingBoxFeesList
- delete this.form.tradingBoxFilesList
- loading.close();
- if (type) {
- //基础资料
- this.$set(this.optionForm, "disabled", true)
- //箱信息
- this.$set(this.option, "disabled", true)
- this.$set(this.option, "addBtn", false)
- this.$set(this.option, "menu", false)
- //费用信息
- this.$set(this.$refs.boxCost.option, "disabled", true)
- this.$set(this.$refs.boxCost.option, "addBtn", false)
- this.$set(this.$refs.boxCost.option, "menu", false)
- //附件和顶部按钮
- this.disabled = true
- }else {
- if (this.form.status > 0) {
- //基础资料
- this.$set(this.optionForm, "disabled", true)
- //箱信息
- this.$set(this.option, "disabled", true)
- this.$set(this.option, "addBtn", false)
- this.$set(this.option, "menu", false)
- //费用信息
- this.$set(this.$refs.boxCost.option, "disabled", true)
- this.$set(this.$refs.boxCost.option, "addBtn", false)
- this.$set(this.$refs.boxCost.option,"menu",false)
- //附件和顶部按钮
- this.disabled = true
- } else {
- //基础资料
- this.$set(this.optionForm, "disabled", false)
- //箱信息
- this.$set(this.option, "disabled", false)
- this.$set(this.option, "addBtn", true)
- this.$set(this.option, "menu", true)
- //费用信息
- this.$set(this.$refs.boxCost.option, "disabled", false)
- this.$set(this.$refs.boxCost.option, "addBtn", true)
- this.$set(this.$refs.boxCost.option, "menu", true)
- //附件和顶部按钮
- this.disabled = false
- }
- }
- })
- },
- //新增修改
- editCustomer() {
- this.$refs["form"].validate((valid,done) => {
- done()
- if (valid) {
- let data = {
- ...this.form,
- tradingBoxItemsList: this.dataList,
- tradingBoxFeesList: this.dataListTwo,
- tradingBoxFilesList: this.tradingBoxFilesList,
- type: "BUY"
- }
- const loading = this.$loading({
- lock: true,
- text: '加载中',
- spinner: 'el-icon-loading',
- background: 'rgba(255,255,255,0.7)'
- });
- submit(data).then(res => {
- if (this.form.id) {
- this.$message.success("修改成功")
- } else {
- this.$message.success("新增成功")
- }
- loading.close();
- this.refresh(res.data.data.id)
- }).catch(()=>{
- loading.close();
- })
- }
- });
- },
- rowSave(form,done,loading) {
- let result = this.dataList.some((item) => {
- if (item.code == form.code) {
- return true
- }
- })
- if (result === true) {
- this.$message.error("已存在此箱号");
- return loading();
- }
- done(form)
- this.getWorkDicts("currency").then(res => {
- for (let item of res.data.data){
- if (item.dictValue == form.currency){
- form.exchangeRate = item.remark
- }
- }
- this.dataListTwo.push({
- corpId: this.form.purchaseCompanyId,
- corpName: this.form.purchaseCompanyName,
- code: form.code,
- itemId: this.costData.id,
- itemName: this.costData.cname,
- currency: form.currency,
- price: form.amount,
- quantity: 1,
- autoGenerate: 1,
- exchangeRate:form.exchangeRate || 1,
- feesType:2,
- amount: form.amount,
- })
- });
- },
- rowUpdate(form, index, done, loading) {
- form.boxType = form.$boxTypeId
- done(form)
- this.getWorkDicts("currency").then(res => {
- for (let item of res.data.data){
- if (item.dictValue == form.currency){
- form.exchangeRate = item.remark
- }
- }
- if (this.dataListTwo.length > 0) {
- for (let item in this.dataListTwo) {
- if (this.dataListTwo[item].code == form.code) {
- if (this.dataListTwo[item].autoGenerate == 1) {
- this.dataListTwo.splice(Number(item), 1, {
- ...this.dataListTwo[item],
- corpId: this.form.purchaseCompanyId,
- corpName: this.form.purchaseCompanyName,
- code: form.code,
- currency: form.currency,
- price: form.amount,
- exchangeRate:form.exchangeRate || 1,
- amount: form.amount
- })
- this.key++
- }
- }
- }
- }
- });
- },
- //打开表单前
- beforeOpen(done,type){
- if (type === "add"){
- this.formTwo.boxSource = this.$refs.crud.DIC.boxSource.length === 0?"":this.$refs.crud.DIC.boxSource[0].dictKey
- this.formTwo.status = this.$refs.crud.DIC.status.length === 0?"":this.$refs.crud.DIC.status[0].dictKey
- }
- done();
- },
- //删除图片
- uploadDelete(file, column) {
- return new Promise((resolve, reject) => {
- this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- if (this.formTwo.tradingBoxFilesList[file.uid].id) {
- tradingBoxFiles(this.formTwo.tradingBoxFilesList[file.uid].id).then(res => {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- resolve();
- })
- } else {
- resolve();
- }
- }).catch(()=>{
- reject();
- this.$message({
- type: "info",
- message: "已取消删除"
- });
- })
- })
- },
- getGSData(row,type) {
- this[type[0]][type[1]] = row.cname
- },
- backToList(type) {
- if (type == 0){
- if (this.detailData.id){
- this.$router.push({
- path: '/boxManagement/buyContainer/index'
- });
- }
- this.$emit("backToList",type);
- }else if (type == 1){
- this.$router.push({
- path: '/approveData/index'
- });
- this.$emit("backToList",type);
- }
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- resetTrigger(){
- if (this.optionForm.disabled == true) {
- if (this.form.status > 0) {
- //基础资料
- this.$set(this.optionForm, "disabled", true)
- //箱信息
- this.$set(this.option, "disabled", true)
- this.$set(this.option, "addBtn", false)
- this.$set(this.option, "menu", false)
- //费用信息
- this.$set(this.$refs.boxCost.option, "disabled", true)
- this.$set(this.$refs.boxCost.option, "addBtn", false)
- this.$set(this.$refs.boxCost.option,"menu",false)
- //附件和顶部按钮
- this.disabled = true
- } else {
- //基础资料
- this.$set(this.optionForm, "disabled", false)
- //箱信息
- this.$set(this.option, "disabled", false)
- this.$set(this.option, "addBtn", true)
- this.$set(this.option, "menu", true)
- //费用信息
- this.$set(this.$refs.boxCost.option, "disabled", false)
- this.$set(this.$refs.boxCost.option, "addBtn", true)
- this.$set(this.$refs.boxCost.option, "menu", true)
- //附件和顶部按钮
- this.disabled = false
- }
- }else {
- //基础资料
- this.$set(this.optionForm, "disabled", false)
- //箱信息
- this.$set(this.option, "disabled", false)
- this.$set(this.option, "addBtn", true)
- this.$set(this.option, "menu", true)
- //费用信息
- this.$set(this.$refs.boxCost.option, "disabled", false)
- this.$set(this.$refs.boxCost.option, "addBtn", true)
- this.$set(this.$refs.boxCost.option, "menu", true)
- //附件和顶部按钮
- this.disabled = false
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.resetTrigger()
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- }
- }
- }
- </script>
- <style scoped>
- ::v-deep .el-form-item {
- margin-bottom: 8px;
- }
- </style>
|