✨ 组织类型接业务字典,并支持多所属组织与MK再提交
组织管理类型改为 organization_type;用户所属组织支持多选;提交MK前保留原审批状态以识别通过后再提交。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -89,13 +89,22 @@ export async function resolveMkTemplateCode(dictName, list) {
|
|||||||
return String(templateCode);
|
return String(templateCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否属于「审核通过后再提交」需要新建表单实例的状态
|
||||||
|
*/
|
||||||
|
export function isMkApprovedStatus(bizType, approvalStatus) {
|
||||||
|
const conf = MK_BIZ[bizType];
|
||||||
|
if (!conf) return false;
|
||||||
|
return (conf.approved || []).includes(approvalStatus);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交 MK 审核流
|
* 提交 MK 审核流
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
* @param {string} options.bizType 业务类型
|
* @param {string} options.bizType 业务类型
|
||||||
* @param {string|number} options.bizId 业务主键(后端据此生成/复用 formInstanceId)
|
* @param {string|number} options.bizId 业务主键(后端据此生成/复用 formInstanceId)
|
||||||
* @param {string} [options.subjectName] 标题后缀
|
* @param {string} [options.subjectName] 标题后缀
|
||||||
* @param {string} [options.approvalStatus] 当前审批状态(驳回态会先 delete;通过态强制新建实例)
|
* @param {string} [options.approvalStatus] 提交前的审批状态(须在业务 submit 改状态前取值;通过态强制新建实例)
|
||||||
*/
|
*/
|
||||||
export async function submitMkApprovalFlow({
|
export async function submitMkApprovalFlow({
|
||||||
bizType,
|
bizType,
|
||||||
@@ -115,7 +124,7 @@ export async function submitMkApprovalFlow({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const bizIdText = String(bizId);
|
const bizIdText = String(bizId);
|
||||||
const forceNewFormInstance = (conf.approved || []).includes(approvalStatus);
|
const forceNewFormInstance = isMkApprovedStatus(bizType, approvalStatus);
|
||||||
// 审核通过后再提交必须新建流程;其余场景已有有效实例则跳过
|
// 审核通过后再提交必须新建流程;其余场景已有有效实例则跳过
|
||||||
if (!forceNewFormInstance) {
|
if (!forceNewFormInstance) {
|
||||||
const existsRes = await hasMkProcessInstance({ bizId: bizIdText });
|
const existsRes = await hasMkProcessInstance({ bizId: bizIdText });
|
||||||
|
|||||||
@@ -1872,6 +1872,7 @@ export default {
|
|||||||
submitCreate(action) {
|
submitCreate(action) {
|
||||||
if (this.submitAction || !this.validateBase(action)) return;
|
if (this.submitAction || !this.validateBase(action)) return;
|
||||||
this.submitAction = action;
|
this.submitAction = action;
|
||||||
|
const previousApprovalStatus = this.form.approvalStatus || '';
|
||||||
const submit = {
|
const submit = {
|
||||||
...this.normalizeSubmit(),
|
...this.normalizeSubmit(),
|
||||||
contractStage: action === 'formal' ? 'temporary' : 'draft',
|
contractStage: action === 'formal' ? 'temporary' : 'draft',
|
||||||
@@ -1892,7 +1893,7 @@ export default {
|
|||||||
bizType: 'contract-manage',
|
bizType: 'contract-manage',
|
||||||
bizId: id,
|
bizId: id,
|
||||||
subjectName: saved.contractName || submit.contractName || '',
|
subjectName: saved.contractName || submit.contractName || '',
|
||||||
approvalStatus: saved.approvalStatus || submit.approvalStatus || '',
|
approvalStatus: previousApprovalStatus || saved.approvalStatus || submit.approvalStatus || '',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1907,7 +1907,8 @@ export default {
|
|||||||
const data = res.data?.data || {};
|
const data = res.data?.data || {};
|
||||||
const id = data.id || this.form.id;
|
const id = data.id || this.form.id;
|
||||||
const name = data.projectName || this.form.projectName || '';
|
const name = data.projectName || this.form.projectName || '';
|
||||||
const status = data.approvalStatus || this.form.approvalStatus || '';
|
// 必须用提交前状态:业务 submit 后可能已变成 reviewing,导致无法识别「通过后再提交」
|
||||||
|
const status = this.form.approvalStatus || data.approvalStatus || '';
|
||||||
if (!id) {
|
if (!id) {
|
||||||
this.$message.success('操作成功!');
|
this.$message.success('操作成功!');
|
||||||
this.closeProjectForm();
|
this.closeProjectForm();
|
||||||
|
|||||||
@@ -341,12 +341,13 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const id = this.unwrapData(await api.save(this.payload()));
|
const id = this.unwrapData(await api.save(this.payload()));
|
||||||
this.form.id = id;
|
this.form.id = id;
|
||||||
|
const previousApprovalStatus = this.form.approvalStatus || '';
|
||||||
await api.submit({ id: this.form.id });
|
await api.submit({ id: this.form.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'bill-payment',
|
bizType: 'bill-payment',
|
||||||
bizId: this.form.id,
|
bizId: this.form.id,
|
||||||
subjectName: this.form.paymentNo || this.form.billNo || '',
|
subjectName: this.form.paymentNo || this.form.billNo || '',
|
||||||
approvalStatus: this.form.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
|||||||
@@ -121,12 +121,13 @@ export default {
|
|||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
await api.submit({ id: row.id });
|
await api.submit({ id: row.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'bill-payment',
|
bizType: 'bill-payment',
|
||||||
bizId: row.id,
|
bizId: row.id,
|
||||||
subjectName: row.paymentNo || row.billNo || '',
|
subjectName: row.paymentNo || row.billNo || '',
|
||||||
approvalStatus: row.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
|
|||||||
@@ -1194,12 +1194,13 @@ export default {
|
|||||||
}
|
}
|
||||||
const saved = await this.saveDraft();
|
const saved = await this.saveDraft();
|
||||||
if (!saved) return;
|
if (!saved) return;
|
||||||
|
const previousApprovalStatus = this.form.approvalStatus || '';
|
||||||
await api.submit({ id: this.form.id });
|
await api.submit({ id: this.form.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'invoice-application',
|
bizType: 'invoice-application',
|
||||||
bizId: this.form.id,
|
bizId: this.form.id,
|
||||||
subjectName: this.form.applicationNo || '',
|
subjectName: this.form.applicationNo || '',
|
||||||
approvalStatus: this.form.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
|||||||
@@ -344,12 +344,13 @@ export default {
|
|||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
await api.submit({ id: row.id });
|
await api.submit({ id: row.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'invoice-application',
|
bizType: 'invoice-application',
|
||||||
bizId: row.id,
|
bizId: row.id,
|
||||||
subjectName: row.applicationNo || '',
|
subjectName: row.applicationNo || '',
|
||||||
approvalStatus: row.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
|
|||||||
@@ -766,12 +766,13 @@ export default {
|
|||||||
async submitForm() {
|
async submitForm() {
|
||||||
const saved = await this.saveDraft();
|
const saved = await this.saveDraft();
|
||||||
if (!saved) return;
|
if (!saved) return;
|
||||||
|
const previousApprovalStatus = this.form.approvalStatus || '';
|
||||||
await api.submit({ id: this.form.id });
|
await api.submit({ id: this.form.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'invoice-receipt',
|
bizType: 'invoice-receipt',
|
||||||
bizId: this.form.id,
|
bizId: this.form.id,
|
||||||
subjectName: this.form.invoiceNo || '',
|
subjectName: this.form.invoiceNo || '',
|
||||||
approvalStatus: this.form.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
|||||||
@@ -309,12 +309,13 @@ export default {
|
|||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
await api.submit({ id: row.id });
|
await api.submit({ id: row.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'invoice-receipt',
|
bizType: 'invoice-receipt',
|
||||||
bizId: row.id,
|
bizId: row.id,
|
||||||
subjectName: row.invoiceNo || '',
|
subjectName: row.invoiceNo || '',
|
||||||
approvalStatus: row.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
|
|||||||
@@ -2632,12 +2632,13 @@ export default {
|
|||||||
// 提交前静默保存,避免同时弹出「保存成功」与材料缺失 toast
|
// 提交前静默保存,避免同时弹出「保存成功」与材料缺失 toast
|
||||||
const saved = await this.saveDraft({ showSuccess: false });
|
const saved = await this.saveDraft({ showSuccess: false });
|
||||||
if (!saved) return;
|
if (!saved) return;
|
||||||
|
const previousApprovalStatus = this.form.approvalStatus || '';
|
||||||
await api.submit({ id: this.form.id });
|
await api.submit({ id: this.form.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'payment-application',
|
bizType: 'payment-application',
|
||||||
bizId: this.form.id,
|
bizId: this.form.id,
|
||||||
subjectName: this.form.paymentNo || '',
|
subjectName: this.form.paymentNo || '',
|
||||||
approvalStatus: this.form.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
|||||||
@@ -364,12 +364,13 @@ export default {
|
|||||||
this.loadTable();
|
this.loadTable();
|
||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
await api.submit({ id: row.id });
|
await api.submit({ id: row.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'payment-application',
|
bizType: 'payment-application',
|
||||||
bizId: row.id,
|
bizId: row.id,
|
||||||
subjectName: row.paymentNo || '',
|
subjectName: row.paymentNo || '',
|
||||||
approvalStatus: row.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
|
|||||||
@@ -1601,12 +1601,13 @@ export default {
|
|||||||
await this.loadDetail();
|
await this.loadDetail();
|
||||||
await this.persistPendingAdjustments();
|
await this.persistPendingAdjustments();
|
||||||
if (shouldSubmit) {
|
if (shouldSubmit) {
|
||||||
|
const previousApprovalStatus = this.form.approvalStatus || '';
|
||||||
await submit({ id: this.form.id });
|
await submit({ id: this.form.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'pre-settlement',
|
bizType: 'pre-settlement',
|
||||||
bizId: this.form.id,
|
bizId: this.form.id,
|
||||||
subjectName: this.form.preSettlementNo || this.form.contractName || '',
|
subjectName: this.form.preSettlementNo || this.form.contractName || '',
|
||||||
approvalStatus: this.form.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('审批流程已发起');
|
this.$message.success('审批流程已发起');
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
|
|||||||
@@ -349,12 +349,13 @@ export default {
|
|||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' });
|
await this.$confirm('提交后来源预结算将保持锁定,确认提交?', '提示', { type: 'warning' });
|
||||||
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
await api.submit({ id: row.id });
|
await api.submit({ id: row.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'formal-settlement',
|
bizType: 'formal-settlement',
|
||||||
bizId: row.id,
|
bizId: row.id,
|
||||||
subjectName: row.formalSettlementNo || '',
|
subjectName: row.formalSettlementNo || '',
|
||||||
approvalStatus: row.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
|
|||||||
@@ -641,12 +641,13 @@ export default {
|
|||||||
downloadFile(data, `预结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
|
downloadFile(data, `预结算单${this.$dayjs().format('YYYY-MM-DD HH-mm-ss')}.xlsx`);
|
||||||
},
|
},
|
||||||
async handleSubmit(row) {
|
async handleSubmit(row) {
|
||||||
|
const previousApprovalStatus = row.approvalStatus || '';
|
||||||
await submit({ id: row.id });
|
await submit({ id: row.id });
|
||||||
await submitMkApprovalFlow({
|
await submitMkApprovalFlow({
|
||||||
bizType: 'pre-settlement',
|
bizType: 'pre-settlement',
|
||||||
bizId: row.id,
|
bizId: row.id,
|
||||||
subjectName: row.preSettlementNo || '',
|
subjectName: row.preSettlementNo || '',
|
||||||
approvalStatus: row.approvalStatus || '',
|
approvalStatus: previousApprovalStatus,
|
||||||
});
|
});
|
||||||
this.$message.success('提交成功');
|
this.$message.success('提交成功');
|
||||||
this.loadTable();
|
this.loadTable();
|
||||||
|
|||||||
+76
-31
@@ -48,7 +48,7 @@
|
|||||||
</el-link>
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
<template #deptCategory="{ row }">
|
<template #deptCategory="{ row }">
|
||||||
<el-tag>{{ getDeptCategoryLabel(row.deptCategory) }}</el-tag>
|
<el-tag>{{ row.deptCategoryName || getDeptCategoryLabel(row.deptCategory) }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #status="{ row }">
|
<template #status="{ row }">
|
||||||
<el-tag :type="Number(row.status) === 1 ? 'success' : 'info'" class="status-text">
|
<el-tag :type="Number(row.status) === 1 ? 'success' : 'info'" class="status-text">
|
||||||
@@ -181,18 +181,21 @@ import {
|
|||||||
clearNonTopDept,
|
clearNonTopDept,
|
||||||
} from '@/api/system/dept';
|
} from '@/api/system/dept';
|
||||||
import { getLeaderList } from '@/api/system/user';
|
import { getLeaderList } from '@/api/system/user';
|
||||||
|
import { getDictionary } from '@/api/system/dictbiz';
|
||||||
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
|
import { getList as getCustomerArchiveList } from '@/api/vehicle/customer-archive';
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import website from '@/config/website';
|
import website from '@/config/website';
|
||||||
import func from '@/utils/func';
|
import func from '@/utils/func';
|
||||||
|
|
||||||
const escapeRegExp = value => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
const escapeRegExp = value => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
|
const ORGANIZATION_TYPE_DICT_CODE = 'organization_type';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {},
|
form: {},
|
||||||
leaderOptions: [],
|
leaderOptions: [],
|
||||||
|
organizationTypeOptions: [],
|
||||||
parentDeptCode: '',
|
parentDeptCode: '',
|
||||||
parentDept: null,
|
parentDept: null,
|
||||||
carrierDialogVisible: false,
|
carrierDialogVisible: false,
|
||||||
@@ -315,6 +318,31 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '金蝶部门代码',
|
||||||
|
prop: 'kingdeeDeptCode',
|
||||||
|
minWidth: 140,
|
||||||
|
order: 65,
|
||||||
|
maxlength: 64,
|
||||||
|
showWordLimit: true,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
const code = String(value || '').trim();
|
||||||
|
if (!code) {
|
||||||
|
callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (code.length > 64) {
|
||||||
|
callback(new Error('金蝶部门代码不能超过64个字符'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
},
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: '组织简称',
|
label: '组织简称',
|
||||||
prop: 'shortName',
|
prop: 'shortName',
|
||||||
@@ -336,14 +364,7 @@ export default {
|
|||||||
{
|
{
|
||||||
label: '组织类型',
|
label: '组织类型',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
dicData: [
|
dicData: [],
|
||||||
{ label: '一级集团', value: 1 },
|
|
||||||
{ label: '二级事业部', value: 2 },
|
|
||||||
{ label: '部门', value: 3 },
|
|
||||||
{ label: '三级分公司', value: 4 },
|
|
||||||
{ label: '物流园区', value: 5 },
|
|
||||||
{ label: '承运商', value: 6 },
|
|
||||||
],
|
|
||||||
dataType: 'number',
|
dataType: 'number',
|
||||||
minWidth: 120,
|
minWidth: 120,
|
||||||
order: 90,
|
order: 90,
|
||||||
@@ -486,6 +507,7 @@ export default {
|
|||||||
// ignore storage errors
|
// ignore storage errors
|
||||||
}
|
}
|
||||||
this.loadLeaderOptions();
|
this.loadLeaderOptions();
|
||||||
|
this.loadOrganizationTypeOptions();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['userInfo', 'permission']),
|
...mapGetters(['userInfo', 'permission']),
|
||||||
@@ -725,30 +747,52 @@ export default {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
loadOrganizationTypeOptions() {
|
||||||
|
return getDictionary({ code: ORGANIZATION_TYPE_DICT_CODE }).then(res => {
|
||||||
|
const list = res.data.data || [];
|
||||||
|
this.organizationTypeOptions = list
|
||||||
|
.map(item => ({
|
||||||
|
label: item.dictValue,
|
||||||
|
value: Number(item.dictKey),
|
||||||
|
}))
|
||||||
|
.filter(item => item.label && !Number.isNaN(item.value));
|
||||||
|
this.resetDeptCategoryOptions();
|
||||||
|
// 字典异步返回后触发表格组织类型标签重绘
|
||||||
|
if (Array.isArray(this.data) && this.data.length) {
|
||||||
|
this.data = [...this.data];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
resetDeptCategoryOptions() {
|
||||||
|
const categoryColumn = this.findColumn(this.option.column, 'deptCategory');
|
||||||
|
if (!categoryColumn) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
categoryColumn.dicData = [...this.organizationTypeOptions];
|
||||||
|
},
|
||||||
|
filterOrganizationTypeOptions(values) {
|
||||||
|
const valueSet = new Set(values.map(Number));
|
||||||
|
return this.organizationTypeOptions.filter(item => valueSet.has(Number(item.value)));
|
||||||
|
},
|
||||||
updateDeptCategoryOptions() {
|
updateDeptCategoryOptions() {
|
||||||
const categoryColumn = this.findColumn(this.option.column, 'deptCategory');
|
const categoryColumn = this.findColumn(this.option.column, 'deptCategory');
|
||||||
const parent = this.parentDept;
|
const parent = this.parentDept;
|
||||||
if (!parent) return;
|
if (!parent || !categoryColumn) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let dicData = [];
|
let dicData = [];
|
||||||
if (this.isRootDept(parent)) {
|
if (this.isRootDept(parent)) {
|
||||||
dicData =
|
dicData =
|
||||||
parent.deptName === '外部组织'
|
parent.deptName === '外部组织'
|
||||||
? [{ label: '承运商', value: 6 }]
|
? this.filterOrganizationTypeOptions([6])
|
||||||
: [{ label: '集团', value: 1 }];
|
: this.filterOrganizationTypeOptions([1]);
|
||||||
} else if (Number(parent.deptCategory) === 1) {
|
} else if (Number(parent.deptCategory) === 1) {
|
||||||
dicData = [
|
dicData = this.filterOrganizationTypeOptions([2, 3]);
|
||||||
{ label: '事业部', value: 2 },
|
|
||||||
{ label: '部门', value: 3 },
|
|
||||||
];
|
|
||||||
} else if ([2, 3].includes(Number(parent.deptCategory))) {
|
} else if ([2, 3].includes(Number(parent.deptCategory))) {
|
||||||
dicData = [
|
dicData = this.filterOrganizationTypeOptions([4, 5, 6]);
|
||||||
{ label: '分公司', value: 4 },
|
|
||||||
{ label: '物流园区', value: 5 },
|
|
||||||
{ label: '承运商', value: 6 },
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
categoryColumn.dicData = dicData;
|
categoryColumn.dicData = dicData;
|
||||||
if (!dicData.some(item => item.value === Number(this.form.deptCategory))) {
|
if (!dicData.some(item => Number(item.value) === Number(this.form.deptCategory))) {
|
||||||
this.form.deptCategory = dicData[0]?.value;
|
this.form.deptCategory = dicData[0]?.value;
|
||||||
}
|
}
|
||||||
if (Number(this.form.deptCategory) === 6) {
|
if (Number(this.form.deptCategory) === 6) {
|
||||||
@@ -816,15 +860,13 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
getDeptCategoryLabel(deptCategory) {
|
getDeptCategoryLabel(deptCategory) {
|
||||||
const categoryMap = {
|
if (deptCategory === null || deptCategory === undefined || deptCategory === '') {
|
||||||
1: '集团',
|
return '-';
|
||||||
2: '事业部',
|
}
|
||||||
3: '部门',
|
const matched = this.organizationTypeOptions.find(
|
||||||
4: '分公司',
|
item => Number(item.value) === Number(deptCategory)
|
||||||
5: '物流园区',
|
);
|
||||||
6: '承运商',
|
return matched?.label || '-';
|
||||||
};
|
|
||||||
return categoryMap[Number(deptCategory)] || '-';
|
|
||||||
},
|
},
|
||||||
getLeaderValue(leaderId, field) {
|
getLeaderValue(leaderId, field) {
|
||||||
// func.split 空值时返回 '',需兼容为数组,避免表格 formatter 渲染崩溃导致列错位
|
// func.split 空值时返回 '',需兼容为数组,避免表格 formatter 渲染崩溃导致列错位
|
||||||
@@ -861,6 +903,7 @@ export default {
|
|||||||
rowSave(row, done, loading) {
|
rowSave(row, done, loading) {
|
||||||
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
|
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
|
||||||
row.deptCode = String(row.deptCode || '').trim();
|
row.deptCode = String(row.deptCode || '').trim();
|
||||||
|
row.kingdeeDeptCode = String(row.kingdeeDeptCode || '').trim();
|
||||||
row.leaderId = func.join(row.leaderId);
|
row.leaderId = func.join(row.leaderId);
|
||||||
this.normalizeTopParent(row);
|
this.normalizeTopParent(row);
|
||||||
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
|
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
|
||||||
@@ -891,6 +934,7 @@ export default {
|
|||||||
rowUpdate(row, index, done, loading) {
|
rowUpdate(row, index, done, loading) {
|
||||||
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
|
row.tenantId = row.tenantId || this.userInfo.tenantId || website.tenantId;
|
||||||
row.deptCode = String(row.deptCode || '').trim();
|
row.deptCode = String(row.deptCode || '').trim();
|
||||||
|
row.kingdeeDeptCode = String(row.kingdeeDeptCode || '').trim();
|
||||||
row.leaderId = func.join(row.leaderId);
|
row.leaderId = func.join(row.leaderId);
|
||||||
this.normalizeTopParent(row);
|
this.normalizeTopParent(row);
|
||||||
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
|
if (Number(row.deptCategory) === 6 && !row.carrierCustomerId) {
|
||||||
@@ -1026,6 +1070,7 @@ export default {
|
|||||||
const column = this.findColumn(this.option.column, 'parentId');
|
const column = this.findColumn(this.option.column, 'parentId');
|
||||||
column.value = '';
|
column.value = '';
|
||||||
column.addDisabled = false;
|
column.addDisabled = false;
|
||||||
|
this.resetDeptCategoryOptions();
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
currentChange(currentPage) {
|
currentChange(currentPage) {
|
||||||
|
|||||||
+69
-12
@@ -178,7 +178,14 @@
|
|||||||
<el-tag>{{ row.roleName }}</el-tag>
|
<el-tag>{{ row.roleName }}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
<template #deptName="{ row }">
|
<template #deptName="{ row }">
|
||||||
<el-tag>{{ row.deptName }}</el-tag>
|
<template v-if="formatDeptNames(row.deptName).length">
|
||||||
|
<el-tag
|
||||||
|
v-for="name in formatDeptNames(row.deptName)"
|
||||||
|
:key="name"
|
||||||
|
class="user-dept-tag"
|
||||||
|
>{{ name }}</el-tag>
|
||||||
|
</template>
|
||||||
|
<span v-else>-</span>
|
||||||
</template>
|
</template>
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
|
|
||||||
@@ -214,11 +221,25 @@
|
|||||||
<el-col :span="6"><el-form-item label="邮箱"><el-input v-model="form.email" /></el-form-item></el-col>
|
<el-col :span="6"><el-form-item label="邮箱"><el-input v-model="form.email" /></el-form-item></el-col>
|
||||||
<el-col :span="6"><el-form-item label="性别"><el-select v-model="form.sex"><el-option label="男" :value="1" /><el-option label="女" :value="2" /><el-option label="未知" :value="3" /></el-select></el-form-item></el-col>
|
<el-col :span="6"><el-form-item label="性别"><el-select v-model="form.sex"><el-option label="男" :value="1" /><el-option label="女" :value="2" /><el-option label="未知" :value="3" /></el-select></el-form-item></el-col>
|
||||||
<el-col :span="6"><el-form-item label="岗位" prop="postId"><el-tree-select v-model="form.postId" :data="postList" :props="{ label: 'postName', value: 'id' }" check-strictly /></el-form-item></el-col>
|
<el-col :span="6"><el-form-item label="岗位" prop="postId"><el-tree-select v-model="form.postId" :data="postList" :props="{ label: 'postName', value: 'id' }" check-strictly /></el-form-item></el-col>
|
||||||
<el-col :span="6"><el-form-item label="所属组织" prop="deptId"><el-cascader v-model="deptCascaderValue" :options="permissionDeptTree" :props="deptCascaderProps" clearable filterable placeholder="请选择 所属组织" /></el-form-item></el-col>
|
<el-col :span="12">
|
||||||
|
<el-form-item label="所属组织" prop="deptId">
|
||||||
|
<el-cascader
|
||||||
|
v-model="deptCascaderValue"
|
||||||
|
:options="permissionDeptTree"
|
||||||
|
:props="deptCascaderProps"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
collapse-tags
|
||||||
|
collapse-tags-tooltip
|
||||||
|
placeholder="请选择所属组织(可多选)"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
<el-col :span="6"><el-form-item label="工号"><el-input v-model="form.code" /></el-form-item></el-col>
|
<el-col :span="6"><el-form-item label="工号"><el-input v-model="form.code" /></el-form-item></el-col>
|
||||||
<el-col :span="6"><el-form-item label="人员类别"><el-select v-model="form.personCategory"><el-option label="内部员工" :value="1" /><el-option label="承运商" :value="2" /></el-select></el-form-item></el-col>
|
<el-col :span="6"><el-form-item label="人员类别"><el-select v-model="form.personCategory"><el-option label="内部员工" :value="1" /><el-option label="承运商" :value="2" /></el-select></el-form-item></el-col>
|
||||||
<el-col :span="18"><el-form-item label="数据权限范围"><el-radio-group v-model="form.dataScopeRange"><el-radio :value="1">仅所属组织</el-radio><el-radio :value="2">全部组织</el-radio><el-radio :value="3">自定义</el-radio></el-radio-group></el-form-item></el-col>
|
<el-col :span="18"><el-form-item label="数据权限范围"><el-radio-group v-model="form.dataScopeRange"><el-radio :value="1">仅所属组织</el-radio><el-radio :value="2">全部组织</el-radio><el-radio :value="3">自定义</el-radio></el-radio-group></el-form-item></el-col>
|
||||||
<el-col :span="18" :offset="6"><el-form-item label="数据层级范围"><el-radio-group v-model="form.dataLevelRange"><el-radio :value="1">包含下级</el-radio><el-radio :value="2">仅本级</el-radio></el-radio-group></el-form-item></el-col>
|
<el-col :span="18"><el-form-item label="数据层级范围"><el-radio-group v-model="form.dataLevelRange"><el-radio :value="1">包含下级</el-radio><el-radio :value="2">仅本级</el-radio></el-radio-group></el-form-item></el-col>
|
||||||
<el-col :span="24"><el-form-item label="备注"><el-input v-model="form.remark" type="textarea" :rows="2" maxlength="200" show-word-limit /></el-form-item></el-col>
|
<el-col :span="24"><el-form-item label="备注"><el-input v-model="form.remark" type="textarea" :rows="2" maxlength="200" show-word-limit /></el-form-item></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -505,7 +526,24 @@ export default {
|
|||||||
password: [{ required: true, validator: validateLoginPassword, trigger: 'blur' }],
|
password: [{ required: true, validator: validateLoginPassword, trigger: 'blur' }],
|
||||||
realName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
realName: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
||||||
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
|
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
|
||||||
deptId: [{ required: true, message: '请选择所属组织', trigger: 'change' }],
|
deptId: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
const ids = Array.isArray(value)
|
||||||
|
? value.filter(item => item !== undefined && item !== null && item !== '')
|
||||||
|
: value
|
||||||
|
? String(value).split(',').filter(Boolean)
|
||||||
|
: [];
|
||||||
|
if (!ids.length) {
|
||||||
|
callback(new Error('请选择所属组织'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
callback();
|
||||||
|
},
|
||||||
|
trigger: 'change',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
excelForm: {},
|
excelForm: {},
|
||||||
excelOption: excelOption,
|
excelOption: excelOption,
|
||||||
@@ -561,31 +599,36 @@ export default {
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
// 所属组织级联配置:checkStrictly 为 true 时任意一级都可选择
|
// 所属组织级联配置:多选,checkStrictly 为 true 时任意一级都可选择
|
||||||
deptCascaderProps() {
|
deptCascaderProps() {
|
||||||
return {
|
return {
|
||||||
label: 'title',
|
label: 'title',
|
||||||
value: 'id',
|
value: 'id',
|
||||||
children: 'children',
|
children: 'children',
|
||||||
emitPath: false,
|
emitPath: false,
|
||||||
|
multiple: true,
|
||||||
checkStrictly: true,
|
checkStrictly: true,
|
||||||
expandTrigger: 'click',
|
expandTrigger: 'click',
|
||||||
leaf: data => !data.children || data.children.length === 0,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
// 所属组织为单选级联:form.deptId 为数组(提交时 join),级联返回单个 id 值
|
// 所属组织多选级联:form.deptId 为 id 数组(提交时 join)
|
||||||
deptCascaderValue: {
|
deptCascaderValue: {
|
||||||
get() {
|
get() {
|
||||||
const ids = Array.isArray(this.form.deptId)
|
const ids = Array.isArray(this.form.deptId)
|
||||||
? this.form.deptId
|
? this.form.deptId
|
||||||
: this.form.deptId
|
: this.form.deptId
|
||||||
? [this.form.deptId]
|
? String(this.form.deptId).split(',').filter(Boolean)
|
||||||
: [];
|
: [];
|
||||||
const id = ids.find(item => item !== undefined && item !== null && item !== '');
|
return ids
|
||||||
return id === undefined ? '' : id;
|
.filter(item => item !== undefined && item !== null && item !== '')
|
||||||
|
.map(item => (typeof item === 'number' ? item : String(item)));
|
||||||
},
|
},
|
||||||
set(value) {
|
set(value) {
|
||||||
this.form.deptId = value ? [value] : [];
|
this.form.deptId = Array.isArray(value)
|
||||||
|
? value.filter(item => item !== undefined && item !== null && item !== '')
|
||||||
|
: value
|
||||||
|
? [value]
|
||||||
|
: [];
|
||||||
this.$refs.userFormRef?.validateField('deptId');
|
this.$refs.userFormRef?.validateField('deptId');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -844,6 +887,15 @@ export default {
|
|||||||
handleCustomerSelection(rows) {
|
handleCustomerSelection(rows) {
|
||||||
this.form.customerIds = rows.map(row => row.id);
|
this.form.customerIds = rows.map(row => row.id);
|
||||||
},
|
},
|
||||||
|
formatDeptNames(deptName) {
|
||||||
|
if (!deptName) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return String(deptName)
|
||||||
|
.split(',')
|
||||||
|
.map(item => item.trim())
|
||||||
|
.filter(Boolean);
|
||||||
|
},
|
||||||
openUserDialog(mode, row = {}) {
|
openUserDialog(mode, row = {}) {
|
||||||
this.userDialogMode = mode;
|
this.userDialogMode = mode;
|
||||||
if (mode === 'add') {
|
if (mode === 'add') {
|
||||||
@@ -872,9 +924,10 @@ export default {
|
|||||||
}
|
}
|
||||||
getUser(row.id).then(res => {
|
getUser(row.id).then(res => {
|
||||||
const user = res.data.data;
|
const user = res.data.data;
|
||||||
|
const deptIds = func.split(user.deptId || '');
|
||||||
this.form = {
|
this.form = {
|
||||||
...user,
|
...user,
|
||||||
deptId: func.split(user.deptId || ''),
|
deptId: Array.isArray(deptIds) ? deptIds : [],
|
||||||
postId: func.split(user.postId || '')[0] || '',
|
postId: func.split(user.postId || '')[0] || '',
|
||||||
roleId: func.join(user.roleId || ''),
|
roleId: func.join(user.roleId || ''),
|
||||||
dataScopeDeptIds: user.dataScopeDeptIds || [],
|
dataScopeDeptIds: user.dataScopeDeptIds || [],
|
||||||
@@ -1416,6 +1469,10 @@ export default {
|
|||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-dept-tag + .user-dept-tag {
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
.avue-dialog .el-form-item__label {
|
.avue-dialog .el-form-item__label {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user