|
@@ -6,7 +6,7 @@
|
|
|
placement="right"
|
|
|
:closable="true"
|
|
|
@close="handleCancel"
|
|
|
- :visible="visible"
|
|
|
+ v-model:open="visible"
|
|
|
style="height: 100%; overflow: auto; padding-bottom: 53px"
|
|
|
>
|
|
|
<template #title>
|
|
@@ -19,55 +19,41 @@
|
|
|
</template>
|
|
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
- <a-form :ref="formRef" :model="model">
|
|
|
- <a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input placeholder="请输入用户账号" v-decorator.trim="['username', validatorRules.username]" :disabled="!!model.id" />
|
|
|
+ <a-form :ref="formRef" :model="model" :rules="formRules">
|
|
|
+ <a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol" name="username">
|
|
|
+ <a-input placeholder="请输入用户账号" :disabled="!!model.id" />
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input placeholder="请输入用户姓名" v-decorator.trim="['realname', validatorRules.realname]" />
|
|
|
+ <a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" name="realname">
|
|
|
+ <a-input placeholder="请输入用户姓名" name="realname" />
|
|
|
</a-form-item>
|
|
|
<template v-if="!model.id">
|
|
|
- <a-form-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input type="password" autocomplete="new-password" placeholder="请输入登录密码" v-decorator="['password', validatorRules.password]" />
|
|
|
+ <a-form-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol" name="password">
|
|
|
+ <a-input type="password" autocomplete="new-password" placeholder="请输入登录密码" />
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="确认密码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input
|
|
|
- type="password"
|
|
|
- @blur="handleConfirmBlur"
|
|
|
- placeholder="请重新输入登录密码"
|
|
|
- v-decorator="['confirmpassword', validatorRules.confirmpassword]"
|
|
|
- />
|
|
|
+ <a-form-item label="确认密码" :labelCol="labelCol" :wrapperCol="wrapperCol" name="confirmpassword">
|
|
|
+ <a-input type="password" @blur="handleConfirmBlur" placeholder="请重新输入登录密码" />
|
|
|
</a-form-item>
|
|
|
</template>
|
|
|
<template v-if="siteCode === dictSiteCode">
|
|
|
- <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-radio-group v-decorator="['sex', { rules: [{ required: true, message: '请选择性别!' }] }]">
|
|
|
+ <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol" name="sex">
|
|
|
+ <a-radio-group>
|
|
|
<a-radio :value="1">男</a-radio>
|
|
|
<a-radio :value="2">女</a-radio>
|
|
|
</a-radio-group>
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="工作手机" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input
|
|
|
- placeholder="请输入手机号码"
|
|
|
- v-decorator="['phone', { rules: [{ required: true, message: '请输入工作手机!' }, { validator: validatePhone }] }]"
|
|
|
- />
|
|
|
+ <a-form-item label="工作手机" :labelCol="labelCol" :wrapperCol="wrapperCol" name="phone">
|
|
|
+ <a-input placeholder="请输入手机号码" />
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="企业邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input
|
|
|
- placeholder="请输入邮箱"
|
|
|
- v-decorator="['email', { rules: [{ required: true, message: '请输入企业邮箱!' }, { validator: validateEmail }] }]"
|
|
|
- />
|
|
|
+ <a-form-item label="企业邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol" name="email">
|
|
|
+ <a-input placeholder="请输入邮箱" />
|
|
|
</a-form-item>
|
|
|
</template>
|
|
|
<template v-if="siteCode !== dictSiteCode">
|
|
|
- <a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input placeholder="请输入手机号码" v-decorator="['phone', validatorRules.phone]" />
|
|
|
+ <a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol" name="phone">
|
|
|
+ <a-input placeholder="请输入手机号码" />
|
|
|
</a-form-item>
|
|
|
- <a-form-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
- <a-input
|
|
|
- placeholder="请输入邮箱"
|
|
|
- v-decorator="['email', { rules: [{ type: 'email', message: '请输入正确的邮箱地址', required: isMasterAccount }] }]"
|
|
|
- />
|
|
|
+ <a-form-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol" name="email">
|
|
|
+ <a-input placeholder="请输入邮箱" />
|
|
|
</a-form-item>
|
|
|
</template>
|
|
|
<a-form-item label="头像" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
@@ -83,7 +69,7 @@
|
|
|
</a-drawer>
|
|
|
</template>
|
|
|
|
|
|
-<script lang="ts" setup name="EnterpriseUserModal">
|
|
|
+<script lang="ts" setup>
|
|
|
// 引入搜索部门弹出框的组件
|
|
|
import enterpriseDepartWindow from './EnterpriseDepartWindow.vue';
|
|
|
|
|
@@ -94,6 +80,7 @@
|
|
|
import { nextTick, onBeforeMount, reactive, ref } from 'vue';
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
import pick from 'lodash.pick';
|
|
|
+ import type { FormInstance } from 'ant-design-vue';
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
const isMasterAccount = ref(false);
|
|
@@ -103,7 +90,7 @@
|
|
|
const confirmDirty = ref(false);
|
|
|
const modalWidth = ref(800);
|
|
|
let drawerWidth = ref(700);
|
|
|
- const formRef = ref();
|
|
|
+ const formRef = ref<FormInstance>();
|
|
|
const queryParam = reactive({ username: userStore.getUserInfo.username });
|
|
|
let selectedDepartKeys = reactive([]);
|
|
|
let checkedDepartKeys = reactive([]);
|
|
@@ -114,68 +101,48 @@
|
|
|
const disableSubmit = ref(false);
|
|
|
const userDepartModel = reactive({ userId: '', departIdList: [] }); // 保存SysUserDepart的用户部门中间表数据需要的对象
|
|
|
const dateFormat = ref('YYYY-MM-DD');
|
|
|
- const validatorRules = reactive({
|
|
|
- username: {
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入用户账号!',
|
|
|
- },
|
|
|
- {
|
|
|
- validator: validateUsername,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- password: {
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
|
|
|
- message: '密码由8位数字、大小写字母和特殊符号组成!',
|
|
|
- },
|
|
|
- {
|
|
|
- validator: validateToNextPassword,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- confirmpassword: {
|
|
|
- rules: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请重新输入登录密码!',
|
|
|
- },
|
|
|
- {
|
|
|
- validator: compareToFirstPassword,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- realname: { rules: [{ required: true, message: '请输入用户名称!' }] },
|
|
|
- phone: { rules: [{ validator: validatePhone }] },
|
|
|
- email: {
|
|
|
- rules: [
|
|
|
- {
|
|
|
- validator: validateEmail,
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
+ const formRules = reactive({
|
|
|
+ username: [
|
|
|
+ { required: true, message: '请输入用户账号', trigger: 'blur' },
|
|
|
+ {
|
|
|
+ validator: validateUsername,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ password: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
|
|
|
+ message: '密码由8位数字、大小写字母和特殊符号组成!',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ validator: validateToNextPassword,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ confirmpassword: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请重新输入登录密码!',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ validator: compareToFirstPassword,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ realname: [{ required: true, message: '请输入用户名称!' }],
|
|
|
+ phone: [{ validator: validatePhone }],
|
|
|
+ email: [
|
|
|
+ {
|
|
|
+ validator: validateEmail,
|
|
|
+ },
|
|
|
+ ],
|
|
|
roles: {},
|
|
|
- // sex:{initialValue:((!model.sex)?"": (model.sex+""))}
|
|
|
- // workNo: {
|
|
|
- // rules: [
|
|
|
- // { required: true, message: '请输入工号' },
|
|
|
- // { validator: validateWorkNo }
|
|
|
- // ]
|
|
|
- // },
|
|
|
- telephone: {
|
|
|
- rules: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确的座机号码' }],
|
|
|
- },
|
|
|
+ telephone: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确的座机号码' }],
|
|
|
});
|
|
|
|
|
|
let departIdShow = ref(false);
|
|
|
const departIds = reactive([]);
|
|
|
- const title = '操作';
|
|
|
+ const title = ref('操作');
|
|
|
const visible = ref(false);
|
|
|
- let model = reactive({ userIdentity: '' });
|
|
|
+ let model = reactive({ userIdentity: '', id: '', tenantId: '' });
|
|
|
let roleList = reactive([]);
|
|
|
const selectedRole = ref([]);
|
|
|
const labelCol = reactive({
|
|
@@ -205,6 +172,7 @@
|
|
|
syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName', //同步用户到工作流
|
|
|
queryTenantList: '/sys/tenant/queryList',
|
|
|
};
|
|
|
+ const emit = defineEmits(['ok', 'close']);
|
|
|
|
|
|
onBeforeMount(() => {
|
|
|
initTenantList();
|
|
@@ -273,7 +241,6 @@
|
|
|
initialRoleList();
|
|
|
checkedDepartNameString.value = '';
|
|
|
|
|
|
- formRef.value.resetFields();
|
|
|
if (record.hasOwnProperty('id')) {
|
|
|
loadUserRoles(record.id);
|
|
|
setTimeout(() => {
|
|
@@ -283,7 +250,7 @@
|
|
|
userId.value = record.id;
|
|
|
model = Object.assign({}, record);
|
|
|
nextTick(() => {
|
|
|
- formRef.value.setFieldsValue(pick(model, 'username', 'sex', 'realname', 'email', 'phone', 'activitiSync', 'telephone', 'post'));
|
|
|
+ // formRef.value.setFieldsValue(pick(model, 'username', 'sex', 'realname', 'email', 'phone', 'activitiSync', 'telephone', 'post'));
|
|
|
});
|
|
|
visible.value = true;
|
|
|
//身份为上级显示负责部门,否则不显示
|
|
@@ -305,7 +272,7 @@
|
|
|
}
|
|
|
|
|
|
function close() {
|
|
|
- $emit('close');
|
|
|
+ emit('close');
|
|
|
visible.value = false;
|
|
|
disableSubmit.value = false;
|
|
|
selectedRole.value = [];
|
|
@@ -482,21 +449,6 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- // validateWorkNo(rule, value, callback){
|
|
|
- // var params = {
|
|
|
- // tableName: 'sys_user',
|
|
|
- // fieldName: 'work_no',
|
|
|
- // fieldVal: value,
|
|
|
- // dataId: userId
|
|
|
- // };
|
|
|
- // duplicateCheck(params).then((res) => {
|
|
|
- // if (res.success) {
|
|
|
- // callback()
|
|
|
- // } else {
|
|
|
- // callback("工号已存在!")
|
|
|
- // }
|
|
|
- // })
|
|
|
- // },
|
|
|
function handleConfirmBlur(e) {
|
|
|
const value = e.target.value;
|
|
|
confirmDirty.value = confirmDirty.value || !!value;
|
|
@@ -597,6 +549,7 @@
|
|
|
|
|
|
defineExpose({
|
|
|
add,
|
|
|
+ title,
|
|
|
});
|
|
|
</script>
|
|
|
|