|
|
@@ -8,7 +8,11 @@
|
|
|
:label-width="80"
|
|
|
>
|
|
|
<el-form-item label="登录账号" prop="username">
|
|
|
- <el-input placeholder="请输入登录账号" v-model="formParams.username" />
|
|
|
+ <el-input
|
|
|
+ placeholder="请输入登录账号"
|
|
|
+ v-model="formParams.username"
|
|
|
+ :disabled="!isAddUser"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="所属部门" prop="deptId">
|
|
|
<el-select v-model="formParams.deptId" placeholder="请选择组织" class="protocal-select">
|
|
|
@@ -20,7 +24,7 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item> -->
|
|
|
- <el-form-item v-if="props.title === '添加用户'" label="密码" prop="password">
|
|
|
+ <el-form-item v-if="isAddUser" label="密码" prop="password">
|
|
|
<el-input
|
|
|
type="password"
|
|
|
show-password-on="mousedown"
|
|
|
@@ -29,7 +33,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
- v-if="props.title === '添加用户'"
|
|
|
+ v-if="isAddUser"
|
|
|
label="确认密码"
|
|
|
:prop="!formParams.username ? 'passwordRe' : ''"
|
|
|
>
|
|
|
@@ -75,7 +79,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
- import { ref, onMounted } from 'vue';
|
|
|
+ import { ref, onMounted, computed } from 'vue';
|
|
|
import { FormRules, ElMessage } from 'element-plus';
|
|
|
import { useDictionary } from '@/hooks/web/useDictionary';
|
|
|
import { userInfo } from '@/api/system/user';
|
|
|
@@ -173,6 +177,10 @@
|
|
|
|
|
|
const formParams = ref<UserType>(defaultValueRef());
|
|
|
|
|
|
+ const isAddUser = computed(() => {
|
|
|
+ return props.title === '添加用户';
|
|
|
+ });
|
|
|
+
|
|
|
async function openDrawer(username?) {
|
|
|
const postListRes = await postList();
|
|
|
postDataList.value = postListRes;
|
|
|
@@ -206,7 +214,7 @@
|
|
|
return message.error('两次密码不一致');
|
|
|
}
|
|
|
// const msg = params.username ? '编辑成功' : '添加成功';
|
|
|
- if (props.title === '添加用户') {
|
|
|
+ if (isAddUser.value) {
|
|
|
const addData = {
|
|
|
password: formParams.value.password,
|
|
|
deptId: formParams.value.deptId,
|
|
|
@@ -225,6 +233,7 @@
|
|
|
emit('change');
|
|
|
handleReset();
|
|
|
closeDrawer();
|
|
|
+ ElMessage.success('添加成功');
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
ElMessage.error(error);
|
|
|
@@ -250,6 +259,7 @@
|
|
|
emit('change');
|
|
|
handleReset();
|
|
|
closeDrawer();
|
|
|
+ ElMessage.success('修改成功');
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
ElMessage.error(error);
|