Merge remote-tracking branch 'refs/remotes/origin/master' into feature/bfi-api-rate
# Conflicts: # pnpm-lock.yaml # src/axios.js # src/views/settlement/formal-settlement.vue # src/views/vehicle/customer-archive.vue
This commit is contained in:
@@ -161,9 +161,21 @@
|
||||
>
|
||||
复评
|
||||
</el-link>
|
||||
<el-link
|
||||
type="primary"
|
||||
v-if="
|
||||
mkEnabled &&
|
||||
hasPermission('customer_archive_approve') &&
|
||||
row.approvalStatus === 'reviewing'
|
||||
"
|
||||
@click="handleMkAudit(row)"
|
||||
>
|
||||
审核
|
||||
</el-link>
|
||||
<el-link
|
||||
type="success"
|
||||
v-if="
|
||||
!mkEnabled &&
|
||||
hasPermission('customer_archive_approve') &&
|
||||
row.approvalStatus === 'reviewing' &&
|
||||
row.reviewStatus === '已完成'
|
||||
@@ -174,7 +186,11 @@
|
||||
</el-link>
|
||||
<el-link
|
||||
type="warning"
|
||||
v-if="hasPermission('customer_archive_reject') && row.approvalStatus === 'reviewing'"
|
||||
v-if="
|
||||
!mkEnabled &&
|
||||
hasPermission('customer_archive_reject') &&
|
||||
row.approvalStatus === 'reviewing'
|
||||
"
|
||||
@click="handleReject(row)"
|
||||
>
|
||||
审核不通过
|
||||
@@ -404,7 +420,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="所在地区" prop="registeredDetailAddress" required>
|
||||
<el-form-item label="所在地区" prop="registeredRegionName" required>
|
||||
<div class="archive-form__address">
|
||||
<el-cascader
|
||||
ref="registeredRegionCascader"
|
||||
@@ -1544,12 +1560,13 @@ import {
|
||||
getDetail as getCreditScoreQuantificationDetail,
|
||||
} from '@/api/vehicle/credit-score-quantification';
|
||||
import { getDictionary } from '@/api/system/dictbiz';
|
||||
import { submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import { getMKApprovalUrl } from '@/api/system/business-process';
|
||||
import { loadMkEnabled, submitMkApprovalFlow } from '@/utils/mk-approval';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { getLazyTree } from '@/api/base/region';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { downloadFileByUrl, downloadXls } from '@/utils/util';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { getToken, isAdministrator } from '@/utils/auth';
|
||||
import { getUploadHeaders } from '@/utils/upload';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import { ArrowRight } from '@element-plus/icons-vue';
|
||||
@@ -1565,6 +1582,10 @@ import SectionCard from '@/components/section-card/main.vue';
|
||||
import PdfPreview from '@/components/pdf-preview/main.vue';
|
||||
import ChangeRecordDetailDialog from '@/components/change-record-detail-dialog/main.vue';
|
||||
|
||||
const customerArchiveListRoute = '/vehicle/customer-archive';
|
||||
const customerArchiveFormRoute = '/vehicle/customer-archive/form';
|
||||
const customerArchiveListRefreshKey = 'customer-archive-list-refresh';
|
||||
|
||||
const createTimeRangeMap = {
|
||||
createTimeRange: ['createTimeStart', 'createTimeEnd'],
|
||||
};
|
||||
@@ -1631,19 +1652,6 @@ export default {
|
||||
}
|
||||
callback();
|
||||
};
|
||||
const validateRegisteredAddress = (rule, value, callback) => {
|
||||
const regionName = (this.archiveForm.registeredRegionName || '').trim();
|
||||
const detailAddress = String(value || '').trim();
|
||||
if (!regionName) {
|
||||
callback(new Error('请选择省市区'));
|
||||
} else if (!detailAddress) {
|
||||
callback(new Error('请输入详细地址'));
|
||||
} else if (detailAddress.length > 255) {
|
||||
callback(new Error('详细地址最多255个字符'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
@@ -1665,6 +1673,8 @@ export default {
|
||||
readonly: false,
|
||||
reviewMode: false,
|
||||
listActivated: false,
|
||||
// 表单页实例标记:创建时按路由落定,避免 keep-alive 缓存后随全局 $route 翻转
|
||||
isFormPageInstance: false,
|
||||
originalAccessType: '',
|
||||
activeTab: 'scores',
|
||||
archiveForm: this.emptyArchive(),
|
||||
@@ -1775,6 +1785,8 @@ export default {
|
||||
approved: { label: '审核通过', type: 'success' },
|
||||
rejected: { label: '审核不通过', type: 'danger' },
|
||||
},
|
||||
/** 业务字典 mk_template「开启MK」=1 */
|
||||
mkEnabled: false,
|
||||
formRules: {
|
||||
customerCode: [{ max: 20, message: '客商编号最多20个字符', trigger: 'blur' }],
|
||||
fullName: [{ required: true, message: '请输入客商名称', trigger: 'blur' }],
|
||||
@@ -1797,8 +1809,10 @@ export default {
|
||||
registeredCapital: [{ validator: validateNonNegative, trigger: 'blur' }],
|
||||
maxCreditLimit: [{ validator: validateNonNegative, trigger: 'blur' }],
|
||||
applyCreditLimit: [{ validator: validateNonNegative, trigger: 'blur' }],
|
||||
registeredRegionName: [{ required: true, message: '请选择省市区', trigger: 'change' }],
|
||||
registeredDetailAddress: [
|
||||
{ validator: validateRegisteredAddress, trigger: ['change', 'blur'] },
|
||||
{ required: true, message: '请输入详细地址', trigger: 'blur' },
|
||||
{ max: 255, message: '详细地址最多255个字符', trigger: 'blur' },
|
||||
],
|
||||
businessScope: [
|
||||
{
|
||||
@@ -2041,6 +2055,24 @@ export default {
|
||||
],
|
||||
clearable: true,
|
||||
},
|
||||
{
|
||||
label: '创建人',
|
||||
prop: 'createUserName',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
minWidth: 120,
|
||||
},
|
||||
{
|
||||
label: '创建时间',
|
||||
prop: 'createTime',
|
||||
sortable: true,
|
||||
type: 'datetime',
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
minWidth: 170,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -2057,9 +2089,11 @@ export default {
|
||||
this.openArchive({ id }, true);
|
||||
return;
|
||||
}
|
||||
this.isFormPageInstance = this.$route.path === customerArchiveFormRoute;
|
||||
this.initDeptTree();
|
||||
this.initRegionOptions();
|
||||
this.initBusinessDictionaries();
|
||||
this.initMkEnabled();
|
||||
this.initScoreQuantificationOptions();
|
||||
if (this.isArchivePage) {
|
||||
this.reviewMode = this.$route.query.review === '1';
|
||||
@@ -2069,7 +2103,13 @@ export default {
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
if (this.isArchivePage || this.isPublicViewPage) return;
|
||||
if (this.isFormPageInstance || this.isPublicViewPage) return;
|
||||
if (sessionStorage.getItem(customerArchiveListRefreshKey)) {
|
||||
sessionStorage.removeItem(customerArchiveListRefreshKey);
|
||||
this.onLoad(this.page, this.query);
|
||||
this.listActivated = true;
|
||||
return;
|
||||
}
|
||||
if (!this.listActivated) {
|
||||
this.listActivated = true;
|
||||
return;
|
||||
@@ -2080,7 +2120,7 @@ export default {
|
||||
...mapGetters(['permission', 'userInfo']),
|
||||
isAdmin() {
|
||||
const authority = this.userInfo.authority || '';
|
||||
return authority.includes('admin');
|
||||
return isAdministrator(this.userInfo);
|
||||
},
|
||||
kingdeeLocked() {
|
||||
return this.archiveForm.kingdeeStatus === 'exist';
|
||||
@@ -2091,9 +2131,7 @@ export default {
|
||||
};
|
||||
},
|
||||
isArchivePage() {
|
||||
return (
|
||||
this.$route.path === '/vehicle/customer-archive/form' || this.isPublicViewPage
|
||||
);
|
||||
return this.isFormPageInstance || this.isPublicViewPage;
|
||||
},
|
||||
isPublicViewPage() {
|
||||
return (
|
||||
@@ -2282,6 +2320,16 @@ export default {
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
$route(to, from) {
|
||||
if (this.isFormPageInstance || this.isPublicViewPage) return;
|
||||
if (
|
||||
to.path === customerArchiveListRoute &&
|
||||
from?.path?.includes('/customer-archive/form')
|
||||
) {
|
||||
sessionStorage.removeItem(customerArchiveListRefreshKey);
|
||||
this.onLoad(this.page, this.query);
|
||||
}
|
||||
},
|
||||
'archiveForm.unifiedCreditCode'(val) {
|
||||
this.handleKingdeeCreditCodeChange(val);
|
||||
},
|
||||
@@ -2293,6 +2341,9 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
markCustomerArchiveListNeedRefresh() {
|
||||
sessionStorage.setItem(customerArchiveListRefreshKey, '1');
|
||||
},
|
||||
hasPermission(code) {
|
||||
return this.isAdmin || this.validData(this.permission[code], false);
|
||||
},
|
||||
@@ -3017,12 +3068,12 @@ export default {
|
||||
handleRegisteredRegionChange(value) {
|
||||
if (!value || !value.length) {
|
||||
this.archiveForm.registeredRegionName = '';
|
||||
this.$refs.archiveForm?.validateField('registeredDetailAddress');
|
||||
this.$refs.archiveForm?.validateField('registeredRegionName');
|
||||
return;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.archiveForm.registeredRegionName = this.getRegisteredRegionLabels(value).join('');
|
||||
this.$refs.archiveForm?.validateField('registeredDetailAddress');
|
||||
this.$refs.archiveForm?.validateField('registeredRegionName');
|
||||
});
|
||||
},
|
||||
handleInvoiceRegisteredRegionChange(value) {
|
||||
@@ -3053,6 +3104,15 @@ export default {
|
||||
this.sortQualificationFiles();
|
||||
});
|
||||
},
|
||||
initMkEnabled() {
|
||||
loadMkEnabled()
|
||||
.then(enabled => {
|
||||
this.mkEnabled = !!enabled;
|
||||
})
|
||||
.catch(() => {
|
||||
this.mkEnabled = false;
|
||||
});
|
||||
},
|
||||
initScoreQuantificationOptions() {
|
||||
this.scoreQuantificationLoading = true;
|
||||
return getCreditScoreQuantificationList(1, 9999, { status: 1 })
|
||||
@@ -4152,27 +4212,28 @@ export default {
|
||||
openArchivePage(row) {
|
||||
const isEdit = Boolean(row?.id);
|
||||
this.$router.push({
|
||||
path: '/vehicle/customer-archive/form',
|
||||
path: customerArchiveFormRoute,
|
||||
query: isEdit ? { id: row.id, name: '编辑客商档案' } : { name: '新增客商档案' },
|
||||
});
|
||||
},
|
||||
viewArchive(row) {
|
||||
this.$router.push({
|
||||
path: '/vehicle/customer-archive/form',
|
||||
path: customerArchiveFormRoute,
|
||||
query: { id: row.id, name: '查看客商档案', view: '1' },
|
||||
});
|
||||
},
|
||||
openReview(row) {
|
||||
this.$router.push({
|
||||
path: '/vehicle/customer-archive/form',
|
||||
path: customerArchiveFormRoute,
|
||||
query: { id: row.id, name: '客商复评', review: '1' },
|
||||
});
|
||||
},
|
||||
closeArchive() {
|
||||
if (this.isPublicViewPage) return;
|
||||
this.archiveBox = false;
|
||||
this.markCustomerArchiveListNeedRefresh();
|
||||
this.$router.$avueRouter?.closeTag?.();
|
||||
this.$router.push('/vehicle/customer-archive');
|
||||
this.$router.push(customerArchiveListRoute);
|
||||
},
|
||||
openArchive(row, readonly = false) {
|
||||
this.readonly = readonly;
|
||||
@@ -4370,30 +4431,37 @@ export default {
|
||||
// 仅提交时落变更记录;保存不记录
|
||||
archive.recordChange = true;
|
||||
if (!this.validateScoreForApproval(archive)) return;
|
||||
submit(archive).then(res => {
|
||||
const data = res.data.data;
|
||||
const id = (data && typeof data === 'object' ? data.id : data) || this.archiveForm.id;
|
||||
if (!id) {
|
||||
this.closeArchive();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '保存成功,请在列表提交审批' });
|
||||
return;
|
||||
}
|
||||
const fullName =
|
||||
(data && typeof data === 'object' ? data.fullName : '') ||
|
||||
archive.fullName ||
|
||||
this.archiveForm.fullName ||
|
||||
'';
|
||||
this.submitCustomerApproval(
|
||||
id,
|
||||
fullName,
|
||||
archive.approvalStatus || this.archiveForm.approvalStatus
|
||||
).then(() => {
|
||||
this.closeArchive();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '提交成功!' });
|
||||
});
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '提交中',
|
||||
background: 'rgba(255, 255, 255, 0.7)',
|
||||
});
|
||||
submit(archive)
|
||||
.then(res => {
|
||||
const data = res.data.data;
|
||||
const id = (data && typeof data === 'object' ? data.id : data) || this.archiveForm.id;
|
||||
if (!id) {
|
||||
this.closeArchive();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '保存成功,请在列表提交审批' });
|
||||
return;
|
||||
}
|
||||
const fullName =
|
||||
(data && typeof data === 'object' ? data.fullName : '') ||
|
||||
archive.fullName ||
|
||||
this.archiveForm.fullName ||
|
||||
'';
|
||||
return this.submitCustomerApproval(
|
||||
id,
|
||||
fullName,
|
||||
archive.approvalStatus || this.archiveForm.approvalStatus
|
||||
).then(() => {
|
||||
this.closeArchive();
|
||||
this.onLoad(this.page);
|
||||
this.$message({ type: 'success', message: '提交成功!' });
|
||||
});
|
||||
})
|
||||
.finally(() => loading.close());
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -4402,7 +4470,7 @@ export default {
|
||||
submitCustomerApproval(id, fullName = '', approvalStatus = '') {
|
||||
return submitMkApprovalFlow({
|
||||
bizType: 'customer-archive',
|
||||
formInstanceId: id,
|
||||
bizId: id,
|
||||
subjectName: fullName,
|
||||
approvalStatus,
|
||||
}).then(() => submitApproval(id));
|
||||
@@ -5092,6 +5160,24 @@ export default {
|
||||
this.$message({ type: 'success', message: '已撤回至草稿状态!' });
|
||||
});
|
||||
},
|
||||
handleMkAudit(row) {
|
||||
if (!row?.id) {
|
||||
this.$message.warning('客商ID为空,无法打开审核页');
|
||||
return;
|
||||
}
|
||||
getMKApprovalUrl({ bizId: String(row.id) })
|
||||
.then(res => {
|
||||
const url = res?.data?.data;
|
||||
if (!url) {
|
||||
this.$message.error('获取审核跳转地址失败');
|
||||
return;
|
||||
}
|
||||
window.open(url, '_blank');
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.error('获取审核跳转地址失败');
|
||||
});
|
||||
},
|
||||
handleApprove(row) {
|
||||
this.$confirm('是否确认审核通过?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
|
||||
Reference in New Issue
Block a user