|
|
@@ -30,7 +30,7 @@ const [BaseForm, baseFormApi] = useVbenForm({
|
|
|
showDefaultActions: false,
|
|
|
// 所有表单项共用,可单独在表单内覆盖
|
|
|
commonConfig: {
|
|
|
- labelWidth: 120,
|
|
|
+ labelWidth: 130,
|
|
|
// 所有表单项
|
|
|
componentProps: {
|
|
|
class: 'w-full',
|
|
|
@@ -50,6 +50,20 @@ const [BaseForm, baseFormApi] = useVbenForm({
|
|
|
// { title: '用户联系手机号', field: 'userscontactphone' },
|
|
|
// { title: '用户联系邮箱', field: 'userscontactemail' },
|
|
|
// { title: '用户联系地址', field: 'userscontactaddress' },
|
|
|
+ // { title: '备注', field: 'usersbz' },
|
|
|
+ // { title: '用户微信openid', field: 'usersopenid' },
|
|
|
+ // { title: '用户是否实名', field: 'usersauthstatus' },
|
|
|
+ // { title: '用户创建时间', field: 'usersdate' },
|
|
|
+ // { title: '用户类型', field: 'userstype' },
|
|
|
+ // { title: '法人代表电话(座机)', field: 'usersfrdbdh' },
|
|
|
+ // { title: '法人代表手机号', field: 'usersfrdbsjh' },
|
|
|
+ // { title: '销售手机号', field: 'usersxssjh' },
|
|
|
+ // { title: '销售电话(座机)', field: 'usersxsdh' },
|
|
|
+ // { title: '社会统一企业代码', field: 'usersshtyxydm' },
|
|
|
+ // { title: '企业注册地', field: 'userszcd' },
|
|
|
+ // { title: '传真', field: 'userscz' },
|
|
|
+ // { title: '备注', field: 'usersbz' },
|
|
|
+
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'usersname',
|
|
|
@@ -65,20 +79,14 @@ const [BaseForm, baseFormApi] = useVbenForm({
|
|
|
fieldName: 'usersnature',
|
|
|
label: '用户性质',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户性质',
|
|
|
+ placeholder: '请选择用户性质',
|
|
|
allowClear: true,
|
|
|
options: [
|
|
|
- {
|
|
|
- label: '用户',
|
|
|
- value: '用户',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '渠道',
|
|
|
- value: '渠道',
|
|
|
- },
|
|
|
+ { label: '用户', value: '用户' },
|
|
|
+ { label: '渠道', value: '渠道' },
|
|
|
],
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户性质' }),
|
|
|
+ rules: z.string().min(1, { message: '请选择用户性质' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Select',
|
|
|
@@ -86,132 +94,197 @@ const [BaseForm, baseFormApi] = useVbenForm({
|
|
|
label: '用户类型',
|
|
|
defaultValue: '个人',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户类型',
|
|
|
+ placeholder: '请选择用户类型',
|
|
|
allowClear: true,
|
|
|
options: [
|
|
|
- {
|
|
|
- label: '个人',
|
|
|
- value: '个人',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '企业',
|
|
|
- value: '企业',
|
|
|
- },
|
|
|
+ { label: '个人', value: '个人' },
|
|
|
+ { label: '企业', value: '企业' },
|
|
|
],
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户类型' }),
|
|
|
+ rules: z.string().min(1, { message: '请选择用户类型' }),
|
|
|
},
|
|
|
+ // 个人用户显示身份证号
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'usersidcardnumber',
|
|
|
- label: '用户身份证号码',
|
|
|
+ label: '身份证号码',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户身份证号码',
|
|
|
+ placeholder: '请输入身份证号码',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户身份证号码' }),
|
|
|
+ rules: z.string().min(1, { message: '请输入身份证号码' }),
|
|
|
dependencies: {
|
|
|
if(values) {
|
|
|
- return values.userstype && values.userstype === '个人';
|
|
|
+ return values.userstype === '个人';
|
|
|
},
|
|
|
triggerFields: ['userstype'],
|
|
|
},
|
|
|
},
|
|
|
+ // 企业用户显示的字段
|
|
|
{
|
|
|
component: 'Input',
|
|
|
- fieldName: 'usersidcardnumber',
|
|
|
- label: '纳税人识别号',
|
|
|
+ fieldName: 'usersshtyxydm',
|
|
|
+ label: '统一社会信用代码',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入统一社会信用代码',
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ rules: z.string().min(1, { message: '请输入统一社会信用代码' }),
|
|
|
+ dependencies: {
|
|
|
+ if(values) {
|
|
|
+ return values.userstype === '企业';
|
|
|
+ },
|
|
|
+ triggerFields: ['userstype'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'userszcd',
|
|
|
+ label: '企业注册地',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入纳税人识别号',
|
|
|
+ placeholder: '请输入企业注册地',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入纳税人识别号' }),
|
|
|
dependencies: {
|
|
|
if(values) {
|
|
|
- return values.userstype && values.userstype === '企业';
|
|
|
+ return values.userstype === '企业';
|
|
|
},
|
|
|
triggerFields: ['userstype'],
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
+ fieldName: 'usersfrdbdh',
|
|
|
+ label: '法人代表电话(座机)',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入法人代表电话',
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ dependencies: {
|
|
|
+ if(values) {
|
|
|
+ return values.userstype === '企业';
|
|
|
+ },
|
|
|
+ triggerFields: ['userstype'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'usersfrdbsjh',
|
|
|
+ label: '法人代表手机号',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入法人代表手机号',
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ dependencies: {
|
|
|
+ if(values) {
|
|
|
+ return values.userstype === '企业';
|
|
|
+ },
|
|
|
+ triggerFields: ['userstype'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ // 通用字段
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
fieldName: 'usersbankname',
|
|
|
- label: '用户开户银行名称',
|
|
|
+ label: '开户银行名称',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户开户银行名称',
|
|
|
+ placeholder: '请输入开户银行名称',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户开户银行名称' }),
|
|
|
+ rules: z.string().min(1, { message: '请输入开户银行名称' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'usersbanknumber',
|
|
|
- label: '用户开户银行账号',
|
|
|
+ label: '开户银行账号',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户开户银行账号',
|
|
|
+ placeholder: '请输入开户银行账号',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户开户银行账号' }),
|
|
|
+ rules: z.string().min(1, { message: '请输入开户银行账号' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'usersphone',
|
|
|
- label: '用户手机号',
|
|
|
+ label: '手机号',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户手机号',
|
|
|
+ placeholder: '请输入手机号',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户手机号' }),
|
|
|
+ rules: z.string().min(1, { message: '请输入手机号' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'usersemail',
|
|
|
- label: '用户邮箱',
|
|
|
+ label: '邮箱',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户邮箱',
|
|
|
+ placeholder: '请输入邮箱',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户邮箱' }),
|
|
|
+ rules: z.string().email({ message: '请输入正确的邮箱格式' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'usersaddress',
|
|
|
- label: '用户地址',
|
|
|
+ label: '地址',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户地址',
|
|
|
+ placeholder: '请输入地址',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户地址' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'userscontactphone',
|
|
|
- label: '用户联系手机号',
|
|
|
+ label: '联系手机号',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户联系手机号',
|
|
|
+ placeholder: '请输入联系手机号',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户联系手机号' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'userscontactemail',
|
|
|
- label: '用户联系邮箱',
|
|
|
+ label: '联系邮箱',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户联系邮箱',
|
|
|
+ placeholder: '请输入联系邮箱',
|
|
|
allowClear: true,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户联系邮箱' }),
|
|
|
+ rules: z.string().email({ message: '请输入正确的邮箱格式' }),
|
|
|
},
|
|
|
{
|
|
|
component: 'Input',
|
|
|
fieldName: 'userscontactaddress',
|
|
|
- label: '用户联系地址',
|
|
|
+ label: '联系地址',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入联系地址',
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'userscz',
|
|
|
+ label: '传真',
|
|
|
+ componentProps: {
|
|
|
+ placeholder: '请输入传真',
|
|
|
+ allowClear: true,
|
|
|
+ },
|
|
|
+ dependencies: {
|
|
|
+ if(values) {
|
|
|
+ return values.userstype === '企业';
|
|
|
+ },
|
|
|
+ triggerFields: ['userstype'],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ component: 'Input',
|
|
|
+ fieldName: 'usersbz',
|
|
|
+ label: '备注',
|
|
|
componentProps: {
|
|
|
- placeholder: '请输入用户联系地址',
|
|
|
+ placeholder: '请输入备注',
|
|
|
allowClear: true,
|
|
|
+ type: 'textarea',
|
|
|
+ rows: 4,
|
|
|
},
|
|
|
- rules: z.string().min(1, { message: '请输入用户联系地址' }),
|
|
|
},
|
|
|
],
|
|
|
});
|
|
|
@@ -223,20 +296,20 @@ const [Modal, modalApi] = useVbenModal({
|
|
|
},
|
|
|
async onConfirm() {
|
|
|
// 校验输入的数据
|
|
|
+ const formValues = await baseFormApi.getValues();
|
|
|
const validate = await baseFormApi.validate();
|
|
|
if (!validate.valid) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- // 调用新增或编辑接口
|
|
|
const apiMap = {
|
|
|
- create: () => addCustomerApi(validate.values as CustomerEntity),
|
|
|
+ create: () => addCustomerApi(formValues as unknown as CustomerEntity),
|
|
|
edit: () =>
|
|
|
editCustomerApi({
|
|
|
- ...validate.values,
|
|
|
+ ...formValues,
|
|
|
'usersid.value': data.value.row.usersid,
|
|
|
- } as any),
|
|
|
+ } as unknown as CustomerEntity),
|
|
|
};
|
|
|
|
|
|
if (formType.value === 'detail') {
|