|
|
|
|
@ -124,12 +124,12 @@
|
|
|
|
|
<!-- </el-form-item>-->
|
|
|
|
|
<!-- </el-col>-->
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="项目类型" prop="projectTypeId">
|
|
|
|
|
<el-form-item label="销售项目类型" prop="projectTypeId">
|
|
|
|
|
<el-cascader
|
|
|
|
|
v-model="form.projectTypeId"
|
|
|
|
|
:options="projectTypeOptions"
|
|
|
|
|
:props="{ value: 'projectTypeId', label: 'typeName', children: 'children', emitPath: false }"
|
|
|
|
|
placeholder="请选择项目类型"
|
|
|
|
|
placeholder="请选择销售项目类型"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
@ -346,9 +346,9 @@ const getUserSelectList = async () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const projectTypeOptions = ref<ProjectTypeVO[]>([]);
|
|
|
|
|
// 保存原始的项目类型列表(扁平结构),用于查找 parentId
|
|
|
|
|
// 保存原始的销售项目类型列表(扁平结构),用于查找 parentId
|
|
|
|
|
const projectTypeList = ref<ProjectTypeVO[]>([]);
|
|
|
|
|
/** 查询项目类型列表 */
|
|
|
|
|
/** 查询销售项目类型列表 */
|
|
|
|
|
const getProjectTypeList = async () => {
|
|
|
|
|
const params = { } as any;
|
|
|
|
|
const res = await listProjectType(params);
|
|
|
|
|
@ -357,7 +357,7 @@ const getProjectTypeList = async () => {
|
|
|
|
|
projectTypeOptions.value = proxy?.handleTree<ProjectTypeVO>(res.data, 'projectTypeId', 'parentId') || [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 项目类型父级ID -> 项目类别 映射 */
|
|
|
|
|
/** 销售项目类型父级ID -> 项目类别 映射 */
|
|
|
|
|
function mapProjectCategoryByParentId(parentId: string | number | undefined): string | undefined {
|
|
|
|
|
const parentIdStr = parentId === undefined || parentId === null ? '' : String(parentId);
|
|
|
|
|
const categoryMap: Record<string, string> = {
|
|
|
|
|
@ -368,7 +368,7 @@ function mapProjectCategoryByParentId(parentId: string | number | undefined): st
|
|
|
|
|
return categoryMap[parentIdStr];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 根据项目类型自动回填项目类别(仅新增模式) */
|
|
|
|
|
/** 根据销售项目类型自动回填项目类别(仅新增模式) */
|
|
|
|
|
function syncProjectCategoryByProjectType(projectTypeId: string | number | undefined): void {
|
|
|
|
|
const mappedCategory = projectTypeId
|
|
|
|
|
? mapProjectCategoryByParentId(
|
|
|
|
|
@ -424,7 +424,7 @@ const data = reactive<{ form: ProjectInfoFormEx; rules: any }>({
|
|
|
|
|
projectCode: [{ required: true, message: '项目编号不能为空', trigger: 'blur' }],
|
|
|
|
|
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
|
|
|
|
businessDirection: [{ required: true, message: '业务方向不能为空', trigger: 'change' }],
|
|
|
|
|
projectTypeId: [{ required: true, message: '项目类型不能为空', trigger: 'change' }],
|
|
|
|
|
projectTypeId: [{ required: true, message: '销售项目类型不能为空', trigger: 'change' }],
|
|
|
|
|
deptId: [{ required: true, message: '部门不能为空', trigger: 'change' }],
|
|
|
|
|
managerId: [{ required: true, message: '项目经理不能为空', trigger: 'change' }],
|
|
|
|
|
deputyId: [{ required: true, message: '分管副总不能为空', trigger: 'change' }],
|
|
|
|
|
|