调试mk
This commit is contained in:
@@ -62,6 +62,17 @@ export const getPublicChangeRecordList = (customerId, current, size) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const postPublicProcessMessage = data => {
|
||||||
|
return request({
|
||||||
|
url: '/blade-transport/customer-archive/public/process-message',
|
||||||
|
method: 'post',
|
||||||
|
meta: {
|
||||||
|
isToken: false,
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export const submit = row => {
|
export const submit = row => {
|
||||||
return request({
|
return request({
|
||||||
url: '/blade-transport/customer-archive/submit',
|
url: '/blade-transport/customer-archive/submit',
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div ref="page" class="customer-archive-public-view">
|
<div ref="page" class="customer-archive-public-view">
|
||||||
<customer-archive />
|
<customer-archive ref="archive" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CustomerArchive from './customer-archive.vue';
|
import CustomerArchive from './customer-archive.vue';
|
||||||
|
import { postPublicProcessMessage } from '@/api/vehicle/customer-archive';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CustomerArchivePublicView',
|
name: 'CustomerArchivePublicView',
|
||||||
@@ -14,7 +15,9 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.handleIframeHeight = () => this.sendIframeHeight();
|
this.handleIframeHeight = () => this.sendIframeHeight();
|
||||||
|
this.handleProcessMessage = event => this.onProcessMessage(event);
|
||||||
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
|
document.addEventListener('DOMContentLoaded', this.handleIframeHeight, false);
|
||||||
|
window.addEventListener('message', this.handleProcessMessage);
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.documentElement.classList.add('mk-iframe-page');
|
document.documentElement.classList.add('mk-iframe-page');
|
||||||
@@ -36,6 +39,7 @@ export default {
|
|||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
|
document.removeEventListener('DOMContentLoaded', this.handleIframeHeight, false);
|
||||||
window.removeEventListener('load', this.handleIframeHeight);
|
window.removeEventListener('load', this.handleIframeHeight);
|
||||||
|
window.removeEventListener('message', this.handleProcessMessage);
|
||||||
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
|
(this.mkHeightTimers || []).forEach(timer => clearTimeout(timer));
|
||||||
if (this.mkHeightObserver) {
|
if (this.mkHeightObserver) {
|
||||||
this.mkHeightObserver.disconnect();
|
this.mkHeightObserver.disconnect();
|
||||||
@@ -55,6 +59,82 @@ export default {
|
|||||||
window.parent.postMessage({ height: height }, '*');
|
window.parent.postMessage({ height: height }, '*');
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
onProcessMessage(event) {
|
||||||
|
const data = event && event.data;
|
||||||
|
if (!data || typeof data !== 'object') return;
|
||||||
|
if (data.height && !data.status && !data.type) return;
|
||||||
|
if (data.type === 'formValues' || data.type === 'afterSubmit') return;
|
||||||
|
console.log('客商公开页收到流程消息:', data);
|
||||||
|
const formValues = data.formValues;
|
||||||
|
if (data.status === 'submit') {
|
||||||
|
this.submitData(formValues);
|
||||||
|
} else if (data.status === 'save') {
|
||||||
|
this.saveData(formValues);
|
||||||
|
}
|
||||||
|
if (data.type === 'getFormValues') {
|
||||||
|
window.parent.postMessage({ type: 'formValues', formData: this.buildFormData() }, '*');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitData(lbpmFormValues) {
|
||||||
|
const formData = this.buildFormData();
|
||||||
|
this.postFormData('submit', lbpmFormValues, formData);
|
||||||
|
if (!lbpmFormValues) return;
|
||||||
|
const parameters = Object.assign({}, lbpmFormValues, {
|
||||||
|
loginName: this.getLoginName(lbpmFormValues),
|
||||||
|
formInstanceId: this.getFormId(),
|
||||||
|
subject: formData.subject,
|
||||||
|
});
|
||||||
|
window.parent.postMessage(
|
||||||
|
{
|
||||||
|
type: 'afterSubmit',
|
||||||
|
success: true,
|
||||||
|
parameters,
|
||||||
|
},
|
||||||
|
'*'
|
||||||
|
);
|
||||||
|
},
|
||||||
|
saveData(lbpmFormValues) {
|
||||||
|
this.postFormData('save', lbpmFormValues, this.buildFormData());
|
||||||
|
},
|
||||||
|
postFormData(status, formValues, formData) {
|
||||||
|
const payload = {
|
||||||
|
status,
|
||||||
|
formValues: formValues || {},
|
||||||
|
formData,
|
||||||
|
};
|
||||||
|
console.log('客商公开页提交流程数据:', payload);
|
||||||
|
postPublicProcessMessage(payload).catch(error => {
|
||||||
|
console.error('客商公开页提交流程数据失败:', error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
buildFormData() {
|
||||||
|
const archive = this.getArchiveForm();
|
||||||
|
return {
|
||||||
|
...archive,
|
||||||
|
subject: archive.fullName || archive.shortName || '',
|
||||||
|
formInstanceId: this.getFormId(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
getArchiveForm() {
|
||||||
|
const archive = this.$refs.archive && this.$refs.archive.archiveForm;
|
||||||
|
if (!archive) return {};
|
||||||
|
try {
|
||||||
|
return JSON.parse(JSON.stringify(archive));
|
||||||
|
} catch (error) {
|
||||||
|
return { ...archive };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getFormId() {
|
||||||
|
return this.$route.query.id || this.getArchiveForm().id || '';
|
||||||
|
},
|
||||||
|
getLoginName(formValues = {}) {
|
||||||
|
return (
|
||||||
|
formValues.loginName ||
|
||||||
|
this.$route.query.loginName ||
|
||||||
|
this.$route.query.submitIdentity ||
|
||||||
|
''
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2001,7 +2001,6 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.openArchive({ id }, true);
|
this.openArchive({ id }, true);
|
||||||
this.bindMkParentHeight();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.initDeptTree();
|
this.initDeptTree();
|
||||||
@@ -2012,10 +2011,6 @@ export default {
|
|||||||
const readonly = this.$route.query.view === '1' || this.$route.query.view === 'true';
|
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.openArchive(this.$route.query.id ? { id: this.$route.query.id } : null, readonly);
|
||||||
}
|
}
|
||||||
this.bindMkParentHeight();
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.notifyMkParentHeight();
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['permission', 'userInfo']),
|
...mapGetters(['permission', 'userInfo']),
|
||||||
@@ -2036,12 +2031,6 @@ export default {
|
|||||||
isPublicViewPage() {
|
isPublicViewPage() {
|
||||||
return this.$route.path === '/vehicle/customer-archive/public-view';
|
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() {
|
archiveContainer() {
|
||||||
return 'div';
|
return 'div';
|
||||||
},
|
},
|
||||||
@@ -2220,28 +2209,6 @@ export default {
|
|||||||
hasPermission(code) {
|
hasPermission(code) {
|
||||||
return this.isAdmin || this.validData(this.permission[code], false);
|
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) {
|
mergeSelectOptions(target, values) {
|
||||||
const list = Array.isArray(values) ? values : values ? [values] : [];
|
const list = Array.isArray(values) ? values : values ? [values] : [];
|
||||||
list.forEach(value => {
|
list.forEach(value => {
|
||||||
@@ -3983,6 +3950,8 @@ export default {
|
|||||||
},
|
},
|
||||||
closeArchive() {
|
closeArchive() {
|
||||||
if (this.isPublicViewPage) return;
|
if (this.isPublicViewPage) return;
|
||||||
|
this.archiveBox = false;
|
||||||
|
this.$router.$avueRouter?.closeTag?.();
|
||||||
this.$router.push('/vehicle/customer-archive');
|
this.$router.push('/vehicle/customer-archive');
|
||||||
},
|
},
|
||||||
openArchive(row, readonly = false) {
|
openArchive(row, readonly = false) {
|
||||||
@@ -4009,7 +3978,6 @@ export default {
|
|||||||
this.selectedQualificationFiles = [];
|
this.selectedQualificationFiles = [];
|
||||||
if (this.isPublicViewPage) this.ensurePublicViewOptions(this.archiveForm);
|
if (this.isPublicViewPage) this.ensurePublicViewOptions(this.archiveForm);
|
||||||
this.archiveBox = true;
|
this.archiveBox = true;
|
||||||
this.notifyMkParentHeight();
|
|
||||||
this.loadChangeRecords();
|
this.loadChangeRecords();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -4025,7 +3993,6 @@ export default {
|
|||||||
this.ocrQualificationUploadFiles = [];
|
this.ocrQualificationUploadFiles = [];
|
||||||
this.selectedQualificationFiles = [];
|
this.selectedQualificationFiles = [];
|
||||||
this.archiveBox = true;
|
this.archiveBox = true;
|
||||||
this.notifyMkParentHeight();
|
|
||||||
},
|
},
|
||||||
resetArchive() {
|
resetArchive() {
|
||||||
this.readonly = false;
|
this.readonly = false;
|
||||||
@@ -4185,16 +4152,20 @@ export default {
|
|||||||
archive.fullName ||
|
archive.fullName ||
|
||||||
this.archiveForm.fullName ||
|
this.archiveForm.fullName ||
|
||||||
'';
|
'';
|
||||||
this.submitMkApprovalFlow(id, fullName)
|
this.submitCustomerApproval(id, fullName).then(() => {
|
||||||
.then(() => submitApproval(id))
|
this.closeArchive();
|
||||||
.then(() => {
|
this.onLoad(this.page);
|
||||||
this.closeArchive();
|
this.$message({ type: 'success', message: '提交成功!' });
|
||||||
this.onLoad(this.page);
|
});
|
||||||
this.$message({ type: 'success', message: '提交成功!' });
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 列表 / 新增 / 编辑提交共用:提交 MK 审核流并更新客商审批状态
|
||||||
|
*/
|
||||||
|
submitCustomerApproval(id, fullName = '') {
|
||||||
|
return this.submitMkApprovalFlow(id, fullName).then(() => submitApproval(id));
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 提交 MK 审核流:templateCode 取业务字典 mk_template 中「提交审核流」的键值
|
* 提交 MK 审核流:templateCode 取业务字典 mk_template 中「提交审核流」的键值
|
||||||
* 提交人手机号由后端从用户表读取真实值(前端接口会脱敏)
|
* 提交人手机号由后端从用户表读取真实值(前端接口会脱敏)
|
||||||
@@ -4811,8 +4782,7 @@ export default {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
})
|
})
|
||||||
.then(() => this.submitMkApprovalFlow(row.id, archive.fullName || row.fullName))
|
.then(() => this.submitCustomerApproval(row.id, archive.fullName || row.fullName))
|
||||||
.then(() => submitApproval(row.id))
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.onLoad(this.page);
|
this.onLoad(this.page);
|
||||||
this.$message({ type: 'success', message: '提交成功!' });
|
this.$message({ type: 'success', message: '提交成功!' });
|
||||||
|
|||||||
Reference in New Issue
Block a user