<template> <div :class="[isLable ? '' : 'card-margin']"> <el-card class="box-card" :class="[isFieldLabelVisible ? '' : 'field-margin', isShowCard ? '' : 'is-show-card']" > <c-col v-if="refVisiable" :span="24"> <el-form-item :label="`${argadr.title}`+'参考号'" :prop="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.ref`" :labelWidth="isFieldLabelVisible ? '120px' : '0px'"> <c-input :disabled="disabledRef" v-model.trim="modelRef" :placeholder="'请输入' + `${argadr.title}` + '参考号'" maxlength="16" show-word-limit @blur="handleRefBlur" @input="handleInput" ></c-input> </el-form-item> </c-col> <c-col v-if="!noExtkey" :span="24"> <c-col> <el-form-item :label="isFieldLabelVisible ? (`${argadr.title}${!editExtLabel ? ' ID' : ''}`) : ''" :prop="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.extkey`" style="width: 100%" :rules="[ {required: requiredExtkey, message: '必输项', trigger:['blur','change'] }, {validator: validateExtkey, trigger:['blur'] } ]" :labelWidth="isFieldLabelVisible ? '120px' : '0px'" > <c-fullbox> <c-input v-model.trim="modelExtkey" placeholder="" maxlength="16" :disabled="disabledExtkey" :customModifykey="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.extkey`" clearable @keyup.enter.native="showPtapDialog()" @blur="handleExtkeyBlur" @clear="clear" @input="extkeyInput" @change="extkeyChange" > </c-input> <template slot="footer"> <c-button style="margin:0 10px 0 10px;padding: 0 12px;" size="small" type="primary" icon="el-icon-search" :disabled="disabledExtkey" @click="showPtapDialog()"> </c-button> <el-button style="margin:0 0" size="small" type="primary" :disabled="disabledDetailTrn" @click="showDetail()" > Details </el-button> </template> </c-fullbox> </el-form-item> </c-col> </c-col> <!-- 地址名称 --> <template v-if="!onlySearch"> <c-col v-if="isAdrblk || !haveAdrLabel" :span="24"> <el-form-item :label="haveAdrLabel ? adrKeyLabelShow: ''" :prop="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.${adrKey}`" :labelWidth="isFieldLabelVisible ? '120px' : '0px'" > <!-- :rules="!isCheckInCompontent ? [ { required: requiredNam, message: '必输项' }, { validator: validatorAdrKey, trigger: ['blur', 'change'] } ] : []" --> <c-mul-row-input type="textarea" :rows="4" :cols="35" :autosize="{minRows: 4, maxRows: 4}" :charmod="charmod" :showTip="false" v-model="modelAdrKey" placeholder="" :disabled="noEditNameAndAddress && (disabled || isDisabled || (!!modelInr))" :isCheckInCompontent="isCheckInCompontent" :isRequired="requiredNam" :isEn="isEn" @blur="hanldeAdrBlur" :customModifykey="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.${adrKey}`" @checkFalse="handleCheckFalse" > </c-mul-row-input> </el-form-item> </c-col> <!-- 显示名称/地址字段(4栏) --> <template v-else> <c-col :span="24"> <el-form-item :label="isFieldLabelVisible ? (isEnLabel ? 'Name' : '名称') : ''" :prop="isEn ? `${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.ennam` : `${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.cnnam` " :labelWidth="isFieldLabelVisible ? '120px' : '0px'" > <!-- :rules="!isCheckInCompontent ? [{required: requiredNam, message: isEn ? 'Required Field' : '必输项',trigger:['blur','change'] }] : []" --> <!-- :disabled="disabled || (!!model[argadr.grp][argadr.rol].pts.extkey&&!noExtkey)" --> <c-mul-row-input type="textarea" :rows="2" :cols="70" :autosize="{minRows: 1, maxRows: 2}" :charmod="charmod" :showTip="false" v-model="tempName" placeholder="" :disabled="noEditNameAndAddress && (disabled || isDisabled || (!!modelInr))" :customModifykey="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.${isEn ? 'ennam' :'cnnam'}`" :isCheckInCompontent="isCheckInCompontent" :isRequired="requiredNam" :isEn="isEn" @checkFalse="handleCheckFalse" @blur="handleFocus('nam')" > </c-mul-row-input> </el-form-item> </c-col> <c-col :span="24"> <el-form-item v-if="isAdrVisible" :label="isFieldLabelVisible ? (isEnLabel ? 'Address' : '地址') : ''" :prop="isEn ? `${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.enadr` : `${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.cnadr` " :labelWidth="isFieldLabelVisible ? '120px' : '0px'" > <!-- :rules="!isCheckInCompontent ? [{required: requiredAdrblk, message: isEn ? 'Required Field' : '必输项',trigger:['blur','change']}] : []" --> <!-- :disabled="disabled || (!!model[argadr.grp][argadr.rol].pts.extkey&&!noExtkey)" --> <c-mul-row-input type="textarea" :rows="rows" :cols="cols" :autosize="autosize" :charmod="charmod" :showTip="false" v-model="tempAdr" placeholder="" :disabled="noEditNameAndAddress && (disabled || isDisabled || (!!modelInr))" :customModifykey="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.${isEn ? 'enadr' :'cnadr'}`" :isRequired="requiredAdrblk" :isEn="isEn" @blur="handleFocus('adr')" @checkFalse="handleCheckFalse" ></c-mul-row-input> </el-form-item> </c-col> </template> </template> </el-card> <!-- 弹窗 --> <el-dialog v-dialogDrag width="64%" :visible.sync="dialogTableVisible" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" v-if="dialogTableVisible" :modal-append-to-body="false" :append-to-body="true" > <div slot="title" style="font-size: 16px;color: black;position: realtive;"> {{ dialogTitle }} <!-- 关闭按钮 --> <div class="close-btn" @click="handleCloseDialogTable"><i class="el-icon-close"></i></div> </div> <div v-if="!tableLoading && tableList.length === 0">暂无数据</div> <div v-else style="width: 100%;height: 100%;"> <el-table id='tableRef' height="calc(100% - 32px)" style="width: 100%;" v-loading="tableLoading" :data="tableList" @row-dblclick="dbClickRow" :before-close="beforeClose"> <el-table-column v-for="(item,key) in tableColumn" :key="key" :prop="item.prop" :render-header="renderheader" :label="item.label"> </el-table-column> </el-table> <el-pagination class="eContainer-pagination" layout="prev, pager, next, jumper, ->, sizes, total" :page-sizes="pageSizes" :page-size="pageSize" :current-page="currentPage" :total="total" @size-change="sizeChange" @current-change="currentChange" ></el-pagination> </div> </el-dialog> <!-- 临时地址保函名称和地址的 --> <el-dialog v-dialogDrag width="64%" custom-class="temp-rol" :visible.sync="tempRolVisible" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" v-if="tempRolVisible" > <div slot="title" style="font-size: 16px;color: black;position: realtive;"> 临时角色信息 <!-- 关闭按钮 --> <!-- <div class="close-btn" @click="handletempRolClose"><i class="el-icon-close"></i></div> --> </div> <div> <el-form ref="tempForm" :model="tempFormData" :rules="tempRolRules" :validate-on-rule-change="false"> <el-form-item :label="isEn ? 'Name' : '名称'" prop="name" label-width="95px"> <c-mul-row-input type="textarea" :rows="2" :cols="70" v-model="tempFormData.name" placeholder="请输入" :isCheckInCompontent="false" :showTip="false" ></c-mul-row-input> </el-form-item> <el-form-item :label="isEn ? 'Address' : '地址'" prop="address" label-width="95px" > <c-mul-row-input type="textarea" :rows="2" :cols="70" v-model="tempFormData.address" placeholder="请输入" :isCheckInCompontent="false" :showTip="false" ></c-mul-row-input> </el-form-item> </el-form> </div> <span slot="footer" class="dialog-footer"> <el-button type="default" @click="handletempRolClose">取消</el-button> <el-button type="primary" @click="buildTemp" v-if="!modelPtainr">创建临时地址</el-button> <el-button type="primary" @click="tempSure">确 定</el-button> </span> </el-dialog> <!-- 点击详情按钮 --> <el-dialog v-dialogDrag width="64%" title="详情查看" custom-class="temp-rol" :visible.sync="detailVisible" :close-on-click-modal="false" :close-on-press-escape="false" v-if="detailVisible" > <el-form :model="detailFormData" label-width="95px"> <c-col :span="24"> <c-col :span="12" style="padding-right: 10px"> <c-col :span="24"> <el-form-item label="客户编号"> <el-input v-model="detailFormData.ptaptyextkey" disabled></el-input> </el-form-item> </c-col> <c-col :span="24"> <el-form-item label="中文名称"> <el-input type="textarea" v-model="detailFormData.cnnam" disabled></el-input> </el-form-item> </c-col> <c-col :span="24"> <el-form-item label="中文地址"> <el-input type="textarea" v-model="detailFormData.cnadr" disabled></el-input> </el-form-item> </c-col> </c-col> <c-col :span="12" style="padding-left: 10px"> <c-col :span="24"> <!-- :prop="`${argadr.grp}.${argadr.rol}.pts.ref`" --> <el-form-item label="参考号"> <c-input :disabled="disabledRef" v-model="detailFormData.ref" :customModifykey="`${formatExtCodesToStr}${argadr.grp}.${argadr.rol}.pts.ref`" placeholder="请输入参考号" maxlength="16" show-word-limit @blur="handleRefBlur" @input="handleInput" ></c-input> </el-form-item> </c-col> <c-col :span="24"> <el-form-item label="英文名称"> <el-input type="textarea" v-model="detailFormData.ennam" disabled></el-input> </el-form-item> </c-col> <c-col :span="24"> <el-form-item label="英文地址"> <el-input type="textarea" v-model="detailFormData.enadr" disabled></el-input> </el-form-item> </c-col> </c-col> </c-col> </el-form> <span slot="footer" class="dialog-footer"> <el-button v-if="!disabledRef && !isInDisplay" type="primary" @click="saveRef">保存</el-button> </span> </el-dialog> </div> </template> <script> import { columnMap } from "./ptapColumn.js"; import { getPtaTableDtat, getPtsptaByInr, getTempExtkey } from "~/service/business/common"; import commonFunctions from '~/mixin/commonFunctions.js'; import commonDepend from '~/mixin/commonDepend.js' import _ from 'lodash' // 机构信息模块 export default { inject: ["root"], mixins: [commonFunctions,commonDepend], props: { // isDisabled: { // type: Boolean, // default: false // }, model: { type: Object, default: () => {} }, argadr: { type: Object, default: function() { return { title: "", //角色名称 rol: "", //角色 extCodes: [], //model和grp中间模型字段支持0个或无数个 grp: "" //所属模块 }; } }, ptytyp: { // 决定弹框的表头--客户类型 type: String }, typflg: { // 生成临时客户的客户类型 type: String, default: 'C' }, bchinr: { type: String }, disabled: { //地址名称是否灰显 type: Boolean, default: false }, isLable:{ type: Boolean, default: true }, noEditNameAndAddress:{ //国内修改受益人地址名称亮显 type:Boolean, default:true }, disabledRef: { //ref是否灰显 (true:参考号处灰显) type: Boolean, default: false }, disabledExtkey: { //extkey是否灰显(true:申请人处灰显) type: Boolean, default: false }, disabledDetailTrn: { //detail是否灰显(true:Detail处灰显) type: Boolean, default: false }, isAdrblk: { //false:申请人参考号/申请人/申请人名称/申请人地址 true:申请人参考号/申请人/名称地址 type: Boolean, default: true }, // 表示地址名称字段的取值的key,默认取地址名称, 部分取值为nam adrKey: { type: String, default: "adrblk" }, adrKeyLabel: { type: String, //default: '名称及地址' }, onlySearch: { //是否只展示extkey(true:textarea不显示) type: Boolean, default: false }, refVisiable: { //true:参考号不显示,确定ref框放入详情后面需要删除 type: Boolean, default: false }, noExtkey: { //true:extkey不显示 type: Boolean, default: false }, //不显示地址栏(4栏) isAdrVisible: { type: Boolean, default: true }, editExtLabel: { //自定义ID label(false:申请人id) type: Boolean, default: true }, haveAdrLabel: { //false:textarea无lable type: Boolean, default: true }, rows: { type: Number, default: 4 }, cols: { type: Number, default: 70 }, autosize: { type: Object, default: () => { return { minRows: 1, maxRows: 4 } } }, //选择语言的种类 chooseLanguage:{ type: String, default:"" }, // extkey必填星号*是否显示 requiredExtkey: { type: Boolean, default: false }, // 名称必填星号*是否显示 requiredNam: { type: Boolean, default: false }, // 地址必填星号*是否显示 requiredAdrblk: { type: Boolean, default: false }, //国际保函角色label不显示 isFieldLabelVisible: { type: Boolean, default: true }, isShowCard: { type: Boolean, default: true }, isCheckInCompontent: { type: Boolean, default: true } }, computed: { // 额外字段处理成字符串 formatExtCodesToStr() { if (this.argadr.extCodes && this.argadr.extCodes.length > 0) { return this.argadr.extCodes.join('.') + '.' } else { return '' } }, // 简化字段写法 formatCodes () { let extCodes = this.argadr.extCodes || [] return [...extCodes, this.argadr.grp, this.argadr.rol, 'pts'] }, // ref的计算属性 modelRef: { get() { let codesList = [...this.formatCodes, 'ref'] return _.get(this.model, codesList) }, set(val) { let codesList = [...this.formatCodes, 'ref'] _.set(this.model, codesList, val) } }, // extkey的计算属性 modelExtkey: { get() { let codesList = [...this.formatCodes, 'extkey'] return _.get(this.model, codesList) }, set(val) { let codesList = [...this.formatCodes, 'extkey'] _.set(this.model, codesList, val) } }, // adrkey的计算属性 modelAdrKey: { get() { let codesList = [...this.formatCodes, this.adrKey] return _.get(this.model, codesList) }, set(val) { let codesList = [...this.formatCodes, this.adrKey] _.set(this.model, codesList, val) } }, modelInr: { get() { let codesList = [...this.formatCodes, 'inr'] return _.get(this.model, codesList) }, set(val) { let codesList = [...this.formatCodes, 'inr'] _.set(this.model, codesList, val) } }, modelPtainr: { get() { let codesList = [...this.formatCodes, 'ptainr'] return _.get(this.model, codesList) }, set(val) { let codesList = [...this.formatCodes, 'ptainr'] _.set(this.model, codesList, val) } }, tempAdr:{ set(val){ let codesList = null if(this.isEn){ codesList = [...this.formatCodes, 'enadr'] }else{ codesList = [...this.formatCodes, 'cnadr'] } _.set(this.model, codesList, val) }, get(){ let codesList = null if(this.isEn){ codesList = [...this.formatCodes, 'enadr'] }else{ codesList = [...this.formatCodes, 'cnadr'] } return _.get(this.model, codesList) } }, tempName:{ set(val){ let codesList = null if(this.isEn){ codesList = [...this.formatCodes, 'ennam'] }else{ codesList = [...this.formatCodes, 'cnnam'] } _.set(this.model, codesList, val) }, get(){ let codesList = null if(this.isEn){ codesList = [...this.formatCodes, 'ennam'] }else{ codesList = [...this.formatCodes, 'cnnam'] } return _.get(this.model, codesList) } }, //组件使用的语言 useLanguage () { if(this.chooseLanguage !== ''){ return this.chooseLanguage }else{ let extCodes = this.argadr.extCodes || [] let codesList = [...extCodes, this.argadr.grp, 'rec', 'giduil'] if(_.get(this.model, codesList)){ return _.get(this.model, codesList) } } return 'EN' }, isEn () { return (this.useLanguage === 'CN') ? false : true }, charmod () { return this.isEn ? 1 : 0 }, adrKeyLabelShow(){ if(this.adrKeyLabel){ return this.adrKeyLabel }else{ if(this.isEn){ return "" }else{ return "名称地址" } } }, isEnLabel(){ //根据交易码获取label的国际化 let trnName = ''; if (this.root.trnName) { trnName = this.root.trnName.toUpperCase(); } if (trnName.startsWith('GI') || trnName.startsWith('GE') || trnName.startsWith('GC') || trnName.startsWith('GF')) { return true; } else { return false; } } }, data() { return { dialogTitle: "", // 弹框标题 dialogTableVisible: false, // 控制弹框的展示和隐藏 tableLoading: false, total: 0, isDisabled: false, currentPage: 1, // 页数 pageSizes: [5, 10, 20, 30, 40, 50, 100], pageSize: 5, // 条数 tableList: [], inputValue: "", tableColumn: [], // 临时地址相关(名称和地址) tempRolVisible: false, tempFormData: { name: '', address: '' }, markExtkey: '', //控制详情弹框 detailVisible:false, isChangeRef: false, //详情数据 detailFormData:{ ptaptyextkey:'', cnnam:'', cnadr:'', ennam:'', enadr:'', ref:'' }, tempRolRules:{ name:[ { validator: (rule, value, callback) => { if (this.tempFormData.name && this.tempFormData.address) { if(this.tempFormData.name.length + this.tempFormData.address.length > 141) { callback(new Error('名址总长度不能超过140')) } else { callback() } } else { callback() } }, }, { required: false, message: '请输入名称', trigger: 'blur' }, ], address: [ // { // validator: (rule, value, callback) => { // if (this.tempFormData.name && this.tempFormData.address) { // if(this.tempFormData.name.length + this.tempFormData.address.length > 141) { // callback(new Error("名址总长度不能超过140")) // } // } else{ // callback() // } // }, // trigger: 'blur' // }, ], }, // 地址组件是否检验成功 isCheckFalse: false, // 初始化只执行一次的标识 isOnce: false, // 是否触发校验(客户号的有效性) isCheckPtainr: false }; }, watch:{ model:{ deep:true, handler(val,oldVal){ const extKeyValue = this.modelExtkey; // 一旦执行就不会再次执行 if (!this.isOnce) { this.isOnce = true this.markExtkey = extKeyValue } } } }, mounted () { this.$nextTick(() => { const extKeyValue = this.modelExtkey; if (extKeyValue) { this.markExtkey = extKeyValue } }) }, methods: { validateExtkey(rule, value, callback) { if (value !== '' && !this.modelPtainr && this.isCheckPtainr) { callback(new Error('无效的客户号')); } else { callback() } }, validatorAdrKey (rule, value, callback) { if (value && /[\u4E00-\u9FA5]/g.test(value)) { callback(new Error('不能包含中文!')) } else { callback() } }, handleRefBlur () { this.$emit('blurRef') }, // 表头 头部换行,以 / 作为换行标志 renderheader(h, { column, $index }) { return h("span", {}, [ h("span", {}, column.label.split("/")[0]), h("br"), h("span", {}, column.label.split("/")[1]) ]); }, async showPtapDialog() { if (this.tableLoading || this.dialogTableVisible) { return } const value = this.modelExtkey; // 分层取值 await this.getTableData(value); if (this.total == 1) { this.dbClickRow(this.tableList[0]); } else { // 设置弹框标题 this.dialogTitle = `${this.argadr.title}详情`; this.dialogTableVisible = true; this.tableColumn = columnMap['C']; this.$nextTick(()=>{ this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) } }, showDetail(){ this.detailVisible=true //给详情弹框赋值 this.detailFormData.ptaptyextkey=this.modelExtkey this.detailFormData.cnnam = _.get(this.model, [...this.formatCodes, 'cnnam']) this.detailFormData.cnadr = _.get(this.model, [...this.formatCodes, 'cnadr']) this.detailFormData.ennam = _.get(this.model, [...this.formatCodes, 'ennam']) this.detailFormData.enadr = _.get(this.model, [...this.formatCodes, 'enadr']) this.detailFormData.ref = _.get(this.model, [...this.formatCodes, 'ref']) }, sizeChange(num){ this.pageSize = num; const value = this.modelExtkey; this.getTableData(value); }, currentChange(num) { this.currentPage = num; const value = this.modelExtkey; this.getTableData(value); }, // 获取弹框内的table数据 async getTableData(value) { return new Promise(async (resolve) => { this.tableLoading = true; this.tableList = []; // 获取table的表格数据 let params = { ptytyp: this.ptytyp, extkey: value || "", bchinr: this.bchinr, pageNum: this.currentPage, pageSize: this.pageSize }; const loading = this.loading(); const res = await getPtaTableDtat(params, this.moduleRouter()); loading.close(); if (res.respCode == SUCCESS) { if (res.data && res.data.list) { this.total = res.data.total; this.tableList = res.data.list.map(it => ({ ...it, // 添加新key将Party Number和Address Number换行 partyNumberAndAdressNumber: `${it.ptaptyextkey || ""}\n${it.ptaobjkey || ""}`, bchbranchAndBchbchname: `${it.bchbranch || ""}\n${it.bchbchname || ""}`, adrnam1AndPtanam1: `${it.adrnam1 || ""}\n${it.ptanam1 || ""}`, adradr1AndAdrstr1: `${it.adradr1 || ""}\n${it.adrstr1 || ""}`, adrstr2Andadrloccty: `${it.adrstr2 || ""}\n${it.adrloccty || ""}`, adrloczipAndadrloctxt: `${it.adrloczip || ""}\n${it.adrloctxt || ""}` })); resolve(this.tableList) } } this.tableLoading = false; //接口掉完变成false }) }, async dbClickRow(row, column, event) { let params = { inr: row.ptainr, rol: this.argadr.rol }; const response = await getPtsptaByInr(params, this.moduleRouter()); if (response.respCode == SUCCESS) { // 回填数据 if(this.argadr.title == "Obligor"){ this.$alert(`额度占用主体变更为: ${row.ptaobjkey}客户`, '提示', { confirmButtonText: '确定' }); } let language = this.useLanguage // 此字段为了回调中判断extkey字段是否被修改 let isChangeExtkey = true if (this.modelExtkey !== row.ptaobjkey) { isChangeExtkey = false this.modelExtkey = row.ptaobjkey; // 这是textarea--extkey } // 备份的extkey this.markExtkey = row.ptaobjkey _.set(this.model, [...this.formatCodes, 'ptainr'], row.ptainr) _.set(this.model, [...this.formatCodes, 'ptyinr'], response.data.ptyinr) // 名址分开的名称取值逻辑修改 _.set(this.model, [...this.formatCodes, 'nam'], language==='CN' ? response.data.cnnam : response.data.ennam) _.set(this.model, [...this.formatCodes, 'ptynam1'], response.data.cnnam) _.set(this.model, [...this.formatCodes, 'rol'], this.argadr.rol.toUpperCase()) if (!this.onlySearch) { _.set(this.model, [...this.formatCodes, 'ennam'], response.data.ennam) _.set(this.model, [...this.formatCodes, 'enadr'], response.data.enadr) _.set(this.model, [...this.formatCodes, 'cnnam'], response.data.cnnam) _.set(this.model, [...this.formatCodes, 'cnadr'], response.data.cnadr) _.set(this.model, [...this.formatCodes, 'adrblk'], response.data.ennamadr) } // 此处为了回填数据时回调 this.$emit('handleChange',{ rowData: row, isChangeExtkey: isChangeExtkey }) this.isDisabled = true // warning提示相关 this.handleShowWarning(response) this.isCheckPtainr = true this.$nextTick(()=>{ this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) } this.modifyPtap() this.dialogTableVisible = false; }, modifyPtap(){ let pts = _.get(this.model, [...this.formatCodes]) this.customAddModify(pts, 'extkey') if(this.isAdrblk){ if(this.adrKey =='adrblk'){ this.customAddModify(pts, 'adrblk') }else{ this.customAddModify(pts,'nam') } }else{ if(this.isEn){ this.customAddModify(pts, 'ennam') this.customAddModify(pts, 'enadr') }else{ this.customAddModify(pts,'cnnam') this.customAddModify(pts, 'cnadr') } } }, handleShowWarning (response) { if (response.warnList && response.warnList.length) { let curWarnList = this.root.model.warnList || [] response.warnList.map((resItem) => { if (resItem.message) { let hasFlag = curWarnList.some((item) => { return item.key === resItem.key }) if (hasFlag) { curWarnList.forEach((item) => { if (item.key === resItem.key) { if (item.message !== resItem.message) { Object.assign(item, resItem) // item = { // ...item, // ...resItem // } } return; } }) } else { curWarnList.push(resItem) } } else { let ind = curWarnList.findIndex((item) => { return item.key === resItem.key }) if (ind > -1) { curWarnList.splice(ind, 1) } } }) this.$set(this.root.model, 'warnList', curWarnList) // 判断是否存在未读的warning,不存在则不弹出弹框,存在即弹出 let isHasNoRead = false if (curWarnList && curWarnList.length > 0) { isHasNoRead = curWarnList.some((item) => { return item.readFlag === 'N' }) } if (isHasNoRead) { this.$store.commit('updateWarningVisible', true) } } }, handleCloseDialogTable () { this.dialogTableVisible = false; if (!this.onlySearch) { if (this.isAdrblk || !this.haveAdrLabel) { let adrblk = _.get(this.model, [...this.formatCodes, this.adrKey]) if (adrblk) { this.modelExtkey = this.markExtkey } } else { let nam = ''; if (this.isEn) { nam = _.get(this.model, [...this.formatCodes, 'ennam']); } else { nam = _.get(this.model, [...this.formatCodes, 'cnnam']); } let adr = ''; if (this.isEn) { adr = _.get(this.model, [...this.formatCodes, 'enadr']); } else { adr = _.get(this.model, [...this.formatCodes, 'cnadr']); } if ((this.isAdrVisible && nam && adr) || (!this.isAdrVisible && nam)) { this.modelExtkey = this.markExtkey } } } // 弹框关闭时校验客户号 this.isCheckPtainr = true this.$nextTick(()=>{ this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) }, beforeClose(done) { this.dialogTableVisible = false; this.currentPage = 1; done(); }, // 地址失去焦点 hanldeAdrBlur (e) { console.log('=====', e) //更新名称地址 let ptainr = _.get(this.model, [...this.formatCodes, 'ptainr']); if (ptainr !== '') { let extkey = this.model[this.argadr.grp][this.argadr.rol].pts.extkey || ''; if (extkey.startsWith('9999') || extkey.startsWith('Temp')) { this.queryTempExtkey(1, true) this.modifyPtap() } return } if (this.root && this.root.codes && !this.root.codes[`${this.argadr.grp}_${this.argadr.rol}_isCheckFalse`]) { return; } let curVal = e.target.value if (!curVal) { return } this.$confirm("是否创建一个临时地址编号?", "提示", { closeOnClickModal:false, closeOnPressEscape:false, distinguishCancelAndClose:true, confirmButtonText: "是", cancelButtonText: "否", cancelButtonClass: 'btn-custom-cancel', type: "warning", }).then(() => { this.queryTempExtkey(1, true) this.modifyPtap() }).catch((action) => { if (action === 'cancel') { this.queryTempExtkey(1, false) this.modifyPtap() } if(action == 'close'){ _.set(this.model, [...this.formatCodes, this.adrKey], '') } }); }, // 获取临时生成的地址的extkey;paramsType为标识组件类型,1:标识只有地址;2:标识有地址和名称 async queryTempExtkey (paramsType, flg) { let language = this.useLanguage let params = { rol: this.argadr.rol, flg, typflg: this.typflg, language, ptainr: _.get(this.model, [...this.formatCodes, 'ptainr']) } if (paramsType === 1) { params = { ...params, adrblk: _.get(this.model, [...this.formatCodes, this.adrKey]) } } else { params = { ...params, namelc: this.tempFormData.name, adrelc: this.tempFormData.address, } } const loading = this.loading(); let res = await getTempExtkey(params, this.moduleRouter()) loading.close(); if (res.respCode == SUCCESS) { this.modelExtkey = res.data.extkey this.$nextTick(()=>{ this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) // 备份的extkey this.markExtkey = res.data.extkey _.set(this.model, [...this.formatCodes, 'rol'], res.data.rol.toUpperCase()) _.set(this.model, [...this.formatCodes, 'ptainr'], res.data.ptainr) _.set(this.model, [...this.formatCodes, 'ptyinr'], res.data.ptyinr) _.set(this.model, [...this.formatCodes, 'nam'], res.data.nam) _.set(this.model, [...this.formatCodes, 'adrblk'], res.data.pts.adrblk) _.set(this.model, [...this.formatCodes, 'cnnam'], res.data.pts.cnnam) _.set(this.model, [...this.formatCodes, 'cnadr'], res.data.pts.cnadr) _.set(this.model, [...this.formatCodes, 'ennam'], res.data.pts.ennam) _.set(this.model, [...this.formatCodes, 'enadr'], res.data.pts.enadr) //置灰名址 this.isDisabled = true; // 此处为了回填数据时回调 this.$emit('handleChange',{ rowData: res.data }) } else { this.modelExtkey = '' this.$message.error(res.respMsg) } }, // extkey输入框失焦 handleExtkeyBlur (e) { let extkey = this.modelExtkey if (extkey && extkey !== this.markExtkey) { this.showPtapDialog() } }, // 地址和名称的两栏聚焦 handleFocus (type) { switch (type) { case 'nam': this.tempRolVisible = true this.tempFormData.address = this.isEn ? _.get(this.model, [...this.formatCodes, 'enadr']) : _.get(this.model, [...this.formatCodes, 'cnadr']) this.tempFormData.name = this.isEn ? _.get(this.model, [...this.formatCodes, 'ennam']) : _.get(this.model, [...this.formatCodes, 'cnnam']); break; case 'adr': this.tempRolVisible = true this.tempFormData.name = this.isEn ? _.get(this.model, [...this.formatCodes, 'ennam']) : _.get(this.model, [...this.formatCodes, 'cnnam']); this.tempFormData.address = this.isEn ? _.get(this.model, [...this.formatCodes, 'enadr']) : _.get(this.model, [...this.formatCodes, 'cnadr']) break; default: return; } }, handletempRolClose () { this.tempRolVisible = false if (!_.get(this.model, [...this.formatCodes, 'ptainr'])) { this.tempFormData.name = '' this.tempFormData.address = '' if (!this.onlySearch) { if (this.isAdrblk || !this.haveAdrLabel) { _.set(this.model, [...this.formatCodes, this.adrKey], '') } else { this.tempName = '' this.tempAdr = '' } } } this.$nextTick(()=>{ this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) }, buildTemp () { this.$refs['tempForm'].validate((validStatic) => { if (validStatic) { this.queryTempExtkey(2, true) this.tempRolVisible = false } }) this.modifyPtap() }, // 点击确定 tempSure () { this.$refs['tempForm'].validate((validStatic) => { if (validStatic) { this.queryTempExtkey(2, false) this.tempRolVisible = false } }) this.modifyPtap() this.$nextTick(()=>{ this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) }, clear () { this.$emit('clear') this.handleDeleteCurWarning() this.$nextTick(()=>{ this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) }, handleDeleteCurWarning() { this.root.model.warnList.map((item, index) => { let curRole = item.id ? item.id.substring(item.id.indexOf('.') + 1) : '' if (curRole === this.argadr.rol) { this.root.model.warnList.splice(index, 1) } }) }, //判断名称和地址是否灰显 (C 或者 B) nameAndAddressDisabled(){ let extkey = this.modelExtkey || ''; if (extkey === '' || extkey.startsWith('9999') || extkey.startsWith('Temp')) { return false; } return true; }, //extkey清空时 extkeyInput(){ if (!this.modelExtkey) { _.set(this.model, [...this.formatCodes, 'nam'], '') _.set(this.model, [...this.formatCodes, 'ennam'], '') _.set(this.model, [...this.formatCodes, 'enadr'], '') _.set(this.model, [...this.formatCodes, 'cnnam'], '') _.set(this.model, [...this.formatCodes, 'cnadr'], '') _.set(this.model, [...this.formatCodes, 'adrblk'], '') _.set(this.model, [...this.formatCodes, 'ptainr'], '') _.set(this.model, [...this.formatCodes, 'ptyinr'], '') this.markExtkey = '' this.isDisabled = false // 内容被清空,触发清空事件 this.clear() } this.isCheckPtainr = false }, extkeyChange () { this.modifyPtap() }, handleInput(){ this.$emit('handleInput') this.isChangeRef = true }, saveRef(){ // 打开弹框并且修改过参考号才给其添加modifySet和markSet if (this.isChangeRef) { let pts = _.get(this.model, [...this.formatCodes]) this.customAddModify(pts, 'ref') } _.set(this.model, [...this.formatCodes, 'ref'], this.detailFormData.ref) this.detailVisible=false this.$emit('saveRef') this.$nextTick(() => { this.root.$refs['modelForm'].validateField([`${this.formatExtCodesToStr}${this.argadr.grp}.${this.argadr.rol}.pts.extkey`]); }) }, // 地址输入框组件是否检验成功 handleCheckFalse (flag) { console.log('checkFalse===>', flag) this.$set(this.root.codes, `${this.argadr.grp}_${this.argadr.rol}_isCheckFalse`, flag) } }, }; </script> <style scoped lang="less"> ::v-deep .el-dialog__body { height: calc(100% - 55px) } .el-table .cell { white-space: pre-wrap; } ::v-deep .temp-rol { .el-dialog__body { height: calc(100% - 120px); .el-form-item--small .el-form-item__label { width: 95px!important; } } } .close-btn { width: 20px; height: 20px; position: absolute; top: 20px; right: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; } .close-btn:hover { background: rgba(0, 0, 0, .1) } .box-card { margin-bottom: 10px; /deep/ .el-form-item--mini.el-form-item, .el-form-item--small.el-form-item { margin-bottom: 10px; } /deep/ .el-card__body { padding: 10px 10px 10px 0px; } } .is-show-card { border: none!important; box-shadow: none!important; margin-bottom: 0!important; /deep/ .el-card__body { padding: 0!important; } } ::v-deep .el-input--suffix .el-input__inner{ padding-right: 15px; } .el-dialog__body .el-form{ padding: 30px 40px 0px 0px; } .field-margin { /deep/ .el-form-item__content { margin-left: 10px!important; } } .card-margin { /deep/ .box-card { margin-left: 120px; } } </style>