|
@@ -24,7 +24,7 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="手机号" align="center" prop="phone" />
|
|
<el-table-column label="手机号" align="center" prop="phone" />
|
|
|
<el-table-column label="自定义登录名" align="center" prop="customLoginName" />
|
|
<el-table-column label="自定义登录名" align="center" prop="customLoginName" />
|
|
|
- <el-table-column label="部门" align="center" prop="" />
|
|
|
|
|
|
|
+ <el-table-column label="部门" align="center" prop="deptName" />
|
|
|
<el-table-column label="采购角色" align="center" prop="roleName" />
|
|
<el-table-column label="采购角色" align="center" prop="roleName" />
|
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
@@ -79,11 +79,12 @@
|
|
|
<el-tree-select
|
|
<el-tree-select
|
|
|
v-model="form.deptId"
|
|
v-model="form.deptId"
|
|
|
:data="customerDeptList"
|
|
:data="customerDeptList"
|
|
|
- :props="{ value: 'id', label: 'deptName', children: 'children' }"
|
|
|
|
|
- value-key="id"
|
|
|
|
|
|
|
+ :props="{ value: 'deptId', label: 'deptName', children: 'children' }"
|
|
|
|
|
+ value-key="deptId"
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
check-strictly
|
|
check-strictly
|
|
|
:render-after-expand="false"
|
|
:render-after-expand="false"
|
|
|
|
|
+ @change="handleDeptChange"
|
|
|
filterable
|
|
filterable
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
/>
|
|
/>
|
|
@@ -98,7 +99,9 @@
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-form-item label="采购角色" prop="roleId">
|
|
<el-form-item label="采购角色" prop="roleId">
|
|
|
- <el-input v-model="form.roleId" placeholder="请输入采购角色" />
|
|
|
|
|
|
|
+ <el-select v-model="form.roleId" placeholder="请选择采购角色" clearable filterable style="width: 100%" @change="handleRoleChange">
|
|
|
|
|
+ <el-option v-for="role in roleOptions" :key="role.roleId" :label="role.roleName" :value="role.roleId" />
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
@@ -124,7 +127,7 @@
|
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="24">
|
|
<el-col :span="24">
|
|
|
<el-form-item label="详细地址" prop="codeArr">
|
|
<el-form-item label="详细地址" prop="codeArr">
|
|
|
- <el-cascader v-model="codeArr" :options="regionData" placeholder="请选择" @change="handleChange" style="width: 100%"></el-cascader>
|
|
|
|
|
|
|
+ <el-cascader v-model="codeArr" :options="regionOptions" placeholder="请选择" @change="handleChange" style="width: 100%"></el-cascader>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item prop="addressDetail">
|
|
<el-form-item prop="addressDetail">
|
|
|
<el-input v-model="form.addressDetail" type="textarea" :rows="3" placeholder="请输入详细地址" style="width: 100%" />
|
|
<el-input v-model="form.addressDetail" type="textarea" :rows="3" placeholder="请输入详细地址" style="width: 100%" />
|
|
@@ -153,12 +156,16 @@ import {
|
|
|
import { CustomerContactVO, CustomerContactQuery, CustomerContactForm } from '@/api/customer/customerFile/customerContact/types';
|
|
import { CustomerContactVO, CustomerContactQuery, CustomerContactForm } from '@/api/customer/customerFile/customerContact/types';
|
|
|
import { listCustomerDept, getCustomerDept } from '@/api/customer/customerFile/customerDept';
|
|
import { listCustomerDept, getCustomerDept } from '@/api/customer/customerFile/customerDept';
|
|
|
import { CustomerDeptVO, CustomerDeptQuery } from '@/api/customer/customerFile/customerDept/types';
|
|
import { CustomerDeptVO, CustomerDeptQuery } from '@/api/customer/customerFile/customerDept/types';
|
|
|
|
|
+import { listRole } from '@/api/system/role';
|
|
|
|
|
+import type { RoleVO } from '@/api/system/role/types';
|
|
|
import { regionData } from 'element-china-area-data';
|
|
import { regionData } from 'element-china-area-data';
|
|
|
// 接收父组件传递的props
|
|
// 接收父组件传递的props
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
|
customerId?: string;
|
|
customerId?: string;
|
|
|
customerNo?: string;
|
|
customerNo?: string;
|
|
|
}>();
|
|
}>();
|
|
|
|
|
+
|
|
|
|
|
+const regionOptions = regionData as any;
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { sys_platform_yes_no, sys_user_sex, sys_normal_disable } = toRefs<any>(
|
|
const { sys_platform_yes_no, sys_user_sex, sys_normal_disable } = toRefs<any>(
|
|
|
proxy?.useDict('sys_platform_yes_no', 'sys_user_sex', 'sys_normal_disable')
|
|
proxy?.useDict('sys_platform_yes_no', 'sys_user_sex', 'sys_normal_disable')
|
|
@@ -182,6 +189,8 @@ const dialog = reactive<DialogOption>({
|
|
|
title: ''
|
|
title: ''
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const roleOptions = ref<RoleVO[]>([]);
|
|
|
|
|
+
|
|
|
const initFormData: CustomerContactForm = {
|
|
const initFormData: CustomerContactForm = {
|
|
|
id: undefined,
|
|
id: undefined,
|
|
|
customerId: undefined,
|
|
customerId: undefined,
|
|
@@ -228,7 +237,10 @@ const data = reactive<PageData<CustomerContactForm, CustomerContactQuery>>({
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
|
contactName: [{ required: true, message: '联系人姓名不能为空', trigger: 'blur' }],
|
|
contactName: [{ required: true, message: '联系人姓名不能为空', trigger: 'blur' }],
|
|
|
- phone: [{ required: true, message: '手机号码不能为空', trigger: 'blur' }]
|
|
|
|
|
|
|
+ phone: [
|
|
|
|
|
+ { required: true, message: '手机号码不能为空', trigger: 'blur' },
|
|
|
|
|
+ { pattern: /^1[3-9]\d{9}$/ as RegExp, message: '请输入正确的手机号格式', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -247,6 +259,34 @@ const getList = async () => {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+/** 加载角色列表 */
|
|
|
|
|
+const loadRoleOptions = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res: any = await listRole({
|
|
|
|
|
+ pageNum: 1,
|
|
|
|
|
+ pageSize: 9999,
|
|
|
|
|
+ roleName: '',
|
|
|
|
|
+ roleKey: '',
|
|
|
|
|
+ status: ''
|
|
|
|
|
+ } as any);
|
|
|
|
|
+
|
|
|
|
|
+ roleOptions.value = res?.rows || res?.data?.rows || res?.data || [];
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('加载角色列表失败:', error);
|
|
|
|
|
+ roleOptions.value = [];
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleDeptChange = (deptId: string | number) => {
|
|
|
|
|
+ const dept = customerDeptList.value.find((d) => d.deptId === deptId);
|
|
|
|
|
+ form.value.deptName = dept?.deptName;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleRoleChange = (roleId: string | number) => {
|
|
|
|
|
+ const role = roleOptions.value.find((r) => r.roleId === roleId);
|
|
|
|
|
+ form.value.roleName = role?.roleName;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
/** 加载客户部门列表 */
|
|
/** 加载客户部门列表 */
|
|
|
const loadCustomerDeptList = async () => {
|
|
const loadCustomerDeptList = async () => {
|
|
|
if (!props.customerId) return;
|
|
if (!props.customerId) return;
|
|
@@ -399,6 +439,7 @@ onMounted(() => {
|
|
|
if (props.customerId) {
|
|
if (props.customerId) {
|
|
|
queryParams.value.customerId = props.customerId;
|
|
queryParams.value.customerId = props.customerId;
|
|
|
}
|
|
}
|
|
|
|
|
+ loadRoleOptions();
|
|
|
getList();
|
|
getList();
|
|
|
});
|
|
});
|
|
|
|
|
|