|
@@ -1,11 +1,13 @@
|
|
|
-// isAccountExist
|
|
|
-import { roleSelectListApi, checkUserApi } from '/@/api/system/system';
|
|
|
+// isAccountExist checkUserApi
|
|
|
+import { roleSelectListApi } from '/@/api/system/system';
|
|
|
import { BasicColumn } from '/@/components/Table';
|
|
|
import { FormSchema } from '/@/components/Table';
|
|
|
+import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
import { h } from 'vue';
|
|
|
// import { Switch } from 'ant-design-vue';
|
|
|
import { Time } from '/@/components/Time';
|
|
|
-import { isBoolean } from '/@/utils/is';
|
|
|
+// import { isBoolean } from '/@/utils/is';
|
|
|
+const { t } = useI18n();
|
|
|
|
|
|
export const columns: BasicColumn[] = [
|
|
|
{
|
|
@@ -71,6 +73,7 @@ export const accountFormSchema: FormSchema[] = [
|
|
|
field: 'userName',
|
|
|
label: '用户名',
|
|
|
component: 'Input',
|
|
|
+ required: true,
|
|
|
// helpMessage: ['本字段演示异步验证', '不能输入带有admin的用户名'],
|
|
|
// rules: [
|
|
|
// {
|
|
@@ -101,12 +104,13 @@ export const accountFormSchema: FormSchema[] = [
|
|
|
label: '角色',
|
|
|
field: 'roleId',
|
|
|
component: 'ApiSelect',
|
|
|
+ // component: 'ApiRadioGroup',
|
|
|
componentProps: {
|
|
|
api: roleSelectListApi,
|
|
|
labelField: 'roleName',
|
|
|
valueField: 'roleId',
|
|
|
},
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
},
|
|
|
// {
|
|
|
// field: 'dept',
|
|
@@ -133,44 +137,78 @@ export const accountFormSchema: FormSchema[] = [
|
|
|
field: 'phone',
|
|
|
label: '手机号',
|
|
|
component: 'Input',
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
helpMessage: ['验证提示', '手机号需在指房宝APP注册后才可新增'],
|
|
|
- itemProps: {
|
|
|
- validateTrigger: 'blur',
|
|
|
- },
|
|
|
rules: [
|
|
|
{
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
message: '请输入手机号',
|
|
|
},
|
|
|
{
|
|
|
- validator(_, value) {
|
|
|
- return new Promise(async (resolve, reject) => {
|
|
|
- try {
|
|
|
- const res = await checkUserApi({
|
|
|
- phone: value || '',
|
|
|
- });
|
|
|
+ required: true,
|
|
|
+ // @ts-ignore
|
|
|
+ validator: async (rule, value) => {
|
|
|
+ const reg_tel =
|
|
|
+ /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
|
|
+ // var reg = /\S+@\S+\.\S+/;
|
|
|
+ if (!value) {
|
|
|
+ /* eslint-disable-next-line */
|
|
|
|
|
|
- isBoolean(res) && res ? resolve() : reject('用户不存在');
|
|
|
- } catch (error) {
|
|
|
- reject(error.message || '用户不存在');
|
|
|
- }
|
|
|
- });
|
|
|
+ return Promise.reject(t('common.phone'));
|
|
|
+ }
|
|
|
+ if (!reg_tel.test(value)) {
|
|
|
+ /* eslint-disable-next-line */
|
|
|
+ return Promise.reject(t('common.phoneError'));
|
|
|
+ }
|
|
|
+ return Promise.resolve();
|
|
|
},
|
|
|
+ trigger: 'change',
|
|
|
},
|
|
|
+ // {
|
|
|
+ // validator(_, value) {
|
|
|
+ // return new Promise(async (resolve, reject) => {
|
|
|
+ // try {
|
|
|
+ // const res = await checkUserApi({
|
|
|
+ // phone: value || '',
|
|
|
+ // });
|
|
|
+
|
|
|
+ // isBoolean(res) && res ? resolve() : reject('用户不存在');
|
|
|
+ // } catch (error) {
|
|
|
+ // reject(error.message || '用户不存在');
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // },
|
|
|
+ // },
|
|
|
],
|
|
|
},
|
|
|
-
|
|
|
+ {
|
|
|
+ field: 'rec_status',
|
|
|
+ label: '状态',
|
|
|
+ component: 'RadioGroup',
|
|
|
+ required: true,
|
|
|
+ defaultValue: 1,
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: 1,
|
|
|
+ label: '正常',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: 0,
|
|
|
+ label: '禁用',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ },
|
|
|
// {
|
|
|
// label: '邮箱',
|
|
|
// field: 'email',
|
|
|
// component: 'Input',
|
|
|
// required: true,
|
|
|
// },
|
|
|
-
|
|
|
- {
|
|
|
- label: '备注',
|
|
|
- field: 'remark',
|
|
|
- component: 'InputTextArea',
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // label: '备注',
|
|
|
+ // field: 'remark',
|
|
|
+ // component: 'InputTextArea',
|
|
|
+ // },
|
|
|
];
|