|
@@ -4,47 +4,28 @@
|
|
|
<span> {{ editStateComputed ? '编辑账号' : '新增账号' }} </span>
|
|
|
</div>
|
|
|
<a-form ref="formRef" :model="form" @submit-success="handleSubmit">
|
|
|
- <a-form-item
|
|
|
- label="用户账号"
|
|
|
- field="username"
|
|
|
+ <a-form-item label="用户账号" field="username"
|
|
|
:rules="[{ required: true, message: '请输入用户账号' }, { validator: changeKeyName }]"
|
|
|
- :validate-trigger="['change', 'input', 'blur']"
|
|
|
- >
|
|
|
+ :validate-trigger="['change', 'input', 'blur']">
|
|
|
<a-input v-model="form.username" :disabled="editStateComputed" placeholder="请输入用户账号" />
|
|
|
</a-form-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
- field="password"
|
|
|
- label="登陆密码"
|
|
|
+
|
|
|
+ <a-form-item field="password" label="登陆密码"
|
|
|
:rules="[{ required: !form.passwordState, message: '请输入登录密码' }, { validator: changeKeyPassword }]"
|
|
|
- :validate-trigger="['change', 'input']"
|
|
|
- >
|
|
|
- <a-input-password
|
|
|
- v-model="form.password"
|
|
|
- :disabled="editStateComputed && form.passwordState"
|
|
|
- placeholder="请输入登录密码"
|
|
|
- />
|
|
|
- <a
|
|
|
- v-if="form.id"
|
|
|
- class="edit-password"
|
|
|
- @click="
|
|
|
- () => {
|
|
|
- form.password = ''
|
|
|
- form.passwordState = !form.passwordState
|
|
|
- }
|
|
|
- "
|
|
|
- >修改密码</a
|
|
|
- >
|
|
|
+ :validate-trigger="['change', 'input']">
|
|
|
+ <a-input-password v-model="form.password" :disabled="editStateComputed && form.passwordState"
|
|
|
+ placeholder="请输入登录密码" />
|
|
|
+ <a v-if="form.id" class="edit-password" @click="() => {
|
|
|
+ form.password = ''
|
|
|
+ form.passwordState = !form.passwordState
|
|
|
+ }
|
|
|
+ ">修改密码</a>
|
|
|
</a-form-item>
|
|
|
-
|
|
|
|
|
|
- <a-form-item
|
|
|
- field="name"
|
|
|
- label="用户姓名"
|
|
|
- :rules="[{ required: true, message: '请输入用户姓名' }]"
|
|
|
- :validate-trigger="['change', 'input', 'blur']"
|
|
|
- >
|
|
|
- <a-input v-model="form.name" placeholder="请输入用户姓名" />
|
|
|
+
|
|
|
+ <a-form-item field="name" label="用户姓名" :rules="[{ required: true, message: '请输入用户姓名' }]"
|
|
|
+ :validate-trigger="['change', 'input', 'blur']">
|
|
|
+ <a-input v-model="form.name" placeholder="请输入用户姓名" />
|
|
|
</a-form-item>
|
|
|
|
|
|
<!-- <a-form-item
|
|
@@ -57,7 +38,14 @@
|
|
|
</a-form-item> -->
|
|
|
|
|
|
<a-form-item field="state" label="账号状态" :rules="[{ required: true, message: '请选择账号状态' }]">
|
|
|
- <a-switch v-model="form.state" checked-value="1" unchecked-value="0" />
|
|
|
+ <a-switch v-model="form.state" checked-value="1" unchecked-value="0">
|
|
|
+ <template #checked>
|
|
|
+ 禁用
|
|
|
+ </template>
|
|
|
+ <template #unchecked>
|
|
|
+ 启用
|
|
|
+ </template>
|
|
|
+ </a-switch>
|
|
|
</a-form-item>
|
|
|
<a-form-item>
|
|
|
<a-button @click="evSwitch">取消</a-button>
|
|
@@ -69,12 +57,12 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
+<script setup>
|
|
|
import { ref, computed, onMounted } from 'vue'
|
|
|
import { systemFindRoleList, userAdd, updateUserItem } from '@/api/path/system.api.js'
|
|
|
import { Message, Notification } from '@arco-design/web-vue'
|
|
|
import { encryptByDES } from '@/utils/crypto'
|
|
|
-
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
data: Object
|
|
|
})
|
|
@@ -87,7 +75,7 @@ const evSwitch = () => {
|
|
|
emit('returnMain')
|
|
|
}
|
|
|
|
|
|
-const editStateComputed = computed(()=>{
|
|
|
+const editStateComputed = computed(() => {
|
|
|
return Boolean(props.data.id)
|
|
|
})
|
|
|
|
|
@@ -148,9 +136,9 @@ const changeKeyName = async (value, cb) => {
|
|
|
} else {
|
|
|
cb(value ? rgxText : '')
|
|
|
}
|
|
|
-}
|
|
|
-const changeKeyPassword = async (value, cb) => {
|
|
|
- if(form.value.passwordState) {
|
|
|
+}
|
|
|
+const changeKeyPassword = async (value, cb) => {
|
|
|
+ if (form.value.passwordState) {
|
|
|
cb()
|
|
|
return
|
|
|
}
|
|
@@ -159,7 +147,7 @@ const changeKeyPassword = async (value, cb) => {
|
|
|
if (rgx.test(value)) {
|
|
|
cb()
|
|
|
} else {
|
|
|
- cb(value? rgxText : '')
|
|
|
+ cb(value ? rgxText : '')
|
|
|
}
|
|
|
}
|
|
|
onMounted(() => {
|
|
@@ -175,9 +163,11 @@ defineExpose({
|
|
|
margin-bottom: 2rem;
|
|
|
.fn-headTitleDiv();
|
|
|
}
|
|
|
+
|
|
|
.arco-input-wrapper {
|
|
|
width: 20rem;
|
|
|
}
|
|
|
+
|
|
|
.ant-form-item {
|
|
|
width: 20rem;
|
|
|
}
|
|
@@ -185,11 +175,13 @@ defineExpose({
|
|
|
.operations {
|
|
|
display: flex;
|
|
|
}
|
|
|
+
|
|
|
.edit-password {
|
|
|
font-size: 13px;
|
|
|
// color: @blue_0;
|
|
|
margin-left: 1rem;
|
|
|
white-space: nowrap;
|
|
|
+
|
|
|
// position: absolute;
|
|
|
&:hover {
|
|
|
// color: @blue_2;
|