调试mk
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<basic-container class="customer-archive-page">
|
||||
<basic-container class="customer-archive-page" :class="{ 'is-public-view': isPublicViewPage }">
|
||||
<avue-crud
|
||||
v-if="!isArchivePage"
|
||||
:option="option"
|
||||
@@ -913,7 +913,7 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<div class="archive-form__footer">
|
||||
<div class="archive-form__footer" v-if="!isPublicViewPage">
|
||||
<!-- 次要:独立页返回 / 只读关闭 / 弹窗取消 -->
|
||||
<el-button @click="closeArchive">{{ readonly ? '关闭' : '取消' }}</el-button>
|
||||
<el-button type="primary" plain v-if="!readonly" @click="saveArchive">保存</el-button>
|
||||
@@ -1482,7 +1482,9 @@ import { ElCascader } from 'element-plus';
|
||||
import {
|
||||
getList,
|
||||
getDetail,
|
||||
getPublicDetail,
|
||||
getChangeRecordList,
|
||||
getPublicChangeRecordList,
|
||||
submit,
|
||||
submitApproval,
|
||||
withdrawApproval,
|
||||
@@ -1498,6 +1500,7 @@ import {
|
||||
getDetail as getCreditScoreQuantificationDetail,
|
||||
} from '@/api/vehicle/credit-score-quantification';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { processSubmit } from '@/api/system/business-process';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { getLazyTree } from '@/api/base/region';
|
||||
import { exportBlob } from '@/api/common';
|
||||
@@ -1989,6 +1992,18 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
if (this.isPublicViewPage) {
|
||||
this.readonly = true;
|
||||
const id = this.$route.query.id;
|
||||
if (!id) {
|
||||
this.archiveBox = true;
|
||||
this.$message.error('缺少客商ID');
|
||||
return;
|
||||
}
|
||||
this.openArchive({ id }, true);
|
||||
this.bindMkParentHeight();
|
||||
return;
|
||||
}
|
||||
this.initDeptTree();
|
||||
this.initRegionOptions();
|
||||
this.initBusinessDictionaries();
|
||||
@@ -1997,6 +2012,10 @@ export default {
|
||||
const readonly = this.$route.query.view === '1' || this.$route.query.view === 'true';
|
||||
this.openArchive(this.$route.query.id ? { id: this.$route.query.id } : null, readonly);
|
||||
}
|
||||
this.bindMkParentHeight();
|
||||
},
|
||||
mounted() {
|
||||
this.notifyMkParentHeight();
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['permission', 'userInfo']),
|
||||
@@ -2010,7 +2029,18 @@ export default {
|
||||
};
|
||||
},
|
||||
isArchivePage() {
|
||||
return this.$route.path === '/vehicle/customer-archive/form';
|
||||
return (
|
||||
this.$route.path === '/vehicle/customer-archive/form' || this.isPublicViewPage
|
||||
);
|
||||
},
|
||||
isPublicViewPage() {
|
||||
return this.$route.path === '/vehicle/customer-archive/public-view';
|
||||
},
|
||||
isMkEmbed() {
|
||||
const isMk = this.$route.query.isMk;
|
||||
return (
|
||||
this.isPublicViewPage || isMk === '1' || isMk === 1 || isMk === 'true'
|
||||
);
|
||||
},
|
||||
archiveContainer() {
|
||||
return 'div';
|
||||
@@ -2190,6 +2220,67 @@ export default {
|
||||
hasPermission(code) {
|
||||
return this.isAdmin || this.validData(this.permission[code], false);
|
||||
},
|
||||
bindMkParentHeight() {
|
||||
if (!this.isMkEmbed) return;
|
||||
document.addEventListener(
|
||||
'DOMContentLoaded',
|
||||
function () {
|
||||
var tbody = document.body;
|
||||
var height = tbody.clientHeight;
|
||||
// 如需动态改变表单高度,可以直接发送此postMessage
|
||||
window.parent.postMessage({ height: height }, '*');
|
||||
},
|
||||
false
|
||||
);
|
||||
},
|
||||
notifyMkParentHeight() {
|
||||
if (!this.isMkEmbed) return;
|
||||
this.$nextTick(() => {
|
||||
var tbody = document.body;
|
||||
var height = tbody.clientHeight;
|
||||
// 如需动态改变表单高度,可以直接发送此postMessage
|
||||
window.parent.postMessage({ height: height }, '*');
|
||||
});
|
||||
},
|
||||
mergeSelectOptions(target, values) {
|
||||
const list = Array.isArray(values) ? values : values ? [values] : [];
|
||||
list.forEach(value => {
|
||||
if (value === undefined || value === null || value === '') return;
|
||||
if (!this[target].some(item => String(item.value) === String(value))) {
|
||||
this[target].push({ label: String(value), value });
|
||||
}
|
||||
});
|
||||
},
|
||||
ensurePublicViewOptions(archive = {}) {
|
||||
this.mergeSelectOptions('customerNatureOptions', archive.customerNature);
|
||||
this.mergeSelectOptions('customerTypeOptions', archive.customerType);
|
||||
this.mergeSelectOptions('businessScopeOptions', archive.businessScope);
|
||||
this.mergeSelectOptions(
|
||||
'qualificationTypeOptions',
|
||||
(this.qualificationFiles || []).map(item => item.type)
|
||||
);
|
||||
const deptId = Array.isArray(archive.deptId) ? archive.deptId[0] : archive.deptId;
|
||||
if (deptId && archive.deptName) {
|
||||
this.deptTree = [
|
||||
{
|
||||
label: archive.deptName,
|
||||
value: String(deptId),
|
||||
children: [],
|
||||
},
|
||||
];
|
||||
this.deptOptions = this.flattenDept(this.deptTree);
|
||||
}
|
||||
(archive.scores || []).forEach(score => {
|
||||
if (!score.quantificationId) return;
|
||||
const id = String(score.quantificationId);
|
||||
if (!this.scoreQuantificationOptions.some(item => String(item.id) === id)) {
|
||||
this.scoreQuantificationOptions.push({
|
||||
id,
|
||||
name: score.quantificationName || score.name || id,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
// 检测输入框文本是否溢出,仅溢出时才允许 tooltip 显示完整地址
|
||||
checkOverflow(refName, flag) {
|
||||
const inst = this.$refs[refName];
|
||||
@@ -2278,7 +2369,8 @@ export default {
|
||||
loadChangeRecords() {
|
||||
if (!this.archiveForm.id) return;
|
||||
const page = this.changeRecordPage;
|
||||
getChangeRecordList(this.archiveForm.id, page.currentPage, page.pageSize).then(res => {
|
||||
const requestList = this.isPublicViewPage ? getPublicChangeRecordList : getChangeRecordList;
|
||||
requestList(this.archiveForm.id, page.currentPage, page.pageSize).then(res => {
|
||||
const data = res.data.data || {};
|
||||
page.records = this.replaceNegativeOneWithBlank(data.records || []);
|
||||
page.total = Number(data.total || 0);
|
||||
@@ -3890,6 +3982,7 @@ export default {
|
||||
});
|
||||
},
|
||||
closeArchive() {
|
||||
if (this.isPublicViewPage) return;
|
||||
this.$router.push('/vehicle/customer-archive');
|
||||
},
|
||||
openArchive(row, readonly = false) {
|
||||
@@ -3898,7 +3991,9 @@ export default {
|
||||
this.resetDetailPagination();
|
||||
this.resetChangeRecordPage();
|
||||
if (row && row.id) {
|
||||
getDetail(row.id).then(res => {
|
||||
const requestDetail = this.isPublicViewPage ? getPublicDetail : getDetail;
|
||||
requestDetail(row.id)
|
||||
.then(res => {
|
||||
const archive = this.normalizeDetail(res.data.data);
|
||||
this.archiveForm = readonly ? this.replaceNegativeOneWithBlank(archive) : archive;
|
||||
this.originalAccessType = this.archiveForm.accessType || '';
|
||||
@@ -3912,9 +4007,15 @@ export default {
|
||||
this.qualificationUploadFiles = [];
|
||||
this.ocrQualificationUploadFiles = [];
|
||||
this.selectedQualificationFiles = [];
|
||||
if (this.isPublicViewPage) this.ensurePublicViewOptions(this.archiveForm);
|
||||
this.archiveBox = true;
|
||||
this.notifyMkParentHeight();
|
||||
this.loadChangeRecords();
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
this.archiveBox = true;
|
||||
if (this.isPublicViewPage) this.$message.error('客商信息加载失败');
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.archiveForm = this.emptyArchive();
|
||||
@@ -3924,6 +4025,7 @@ export default {
|
||||
this.ocrQualificationUploadFiles = [];
|
||||
this.selectedQualificationFiles = [];
|
||||
this.archiveBox = true;
|
||||
this.notifyMkParentHeight();
|
||||
},
|
||||
resetArchive() {
|
||||
this.readonly = false;
|
||||
@@ -4078,14 +4180,47 @@ export default {
|
||||
this.$message({ type: 'success', message: '保存成功,请在列表提交审批' });
|
||||
return;
|
||||
}
|
||||
submitApproval(id).then(() => {
|
||||
this.closeArchive();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '提交成功!' });
|
||||
});
|
||||
const fullName =
|
||||
(data && typeof data === 'object' ? data.fullName : '') ||
|
||||
archive.fullName ||
|
||||
this.archiveForm.fullName ||
|
||||
'';
|
||||
this.submitMkApprovalFlow(id, fullName)
|
||||
.then(() => submitApproval(id))
|
||||
.then(() => {
|
||||
this.closeArchive();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '提交成功!' });
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 提交 MK 审核流:templateCode 取业务字典 mk_template 中「提交审核流」的键值
|
||||
* 提交人手机号由后端从用户表读取真实值(前端接口会脱敏)
|
||||
*/
|
||||
async submitMkApprovalFlow(formInstanceId, subjectName = '') {
|
||||
const templateCode = await this.resolveMkTemplateCode('提交审核流');
|
||||
const subject = subjectName
|
||||
? `客商准入审批:${subjectName}`
|
||||
: `客商准入审批:${formInstanceId}`;
|
||||
return processSubmit({
|
||||
templateCode,
|
||||
formInstanceId: String(formInstanceId),
|
||||
subject,
|
||||
});
|
||||
},
|
||||
async resolveMkTemplateCode(dictName = '提交审核流') {
|
||||
const res = await getDictionary({ code: 'mk_template' });
|
||||
const list = res?.data?.data || [];
|
||||
const matched = list.find(item => String(item.dictValue || '').trim() === dictName);
|
||||
const templateCode = matched?.dictKey;
|
||||
if (!templateCode) {
|
||||
this.$message.warning(`未配置业务字典 mk_template「${dictName}」,无法提交审核流`);
|
||||
return Promise.reject(new Error(`未配置业务字典 mk_template「${dictName}」`));
|
||||
}
|
||||
return String(templateCode);
|
||||
},
|
||||
addScore() {
|
||||
this.scoreRecordIndex = -1;
|
||||
this.currentScore = this.normalizeScore({});
|
||||
@@ -4676,6 +4811,7 @@ export default {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(() => this.submitMkApprovalFlow(row.id, archive.fullName || row.fullName))
|
||||
.then(() => submitApproval(row.id))
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
@@ -5348,6 +5484,12 @@ export default {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.customer-archive-page.is-public-view {
|
||||
:deep(.archive-page-form .archive-form__footer) {
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.archive-page-form {
|
||||
min-height: 100%;
|
||||
margin-bottom: 60px;
|
||||
|
||||
Reference in New Issue
Block a user