Browse Source

新建用户增加用户类型选择

pull/110/head
余菲 1 year ago
parent
commit
d53f3d9786
3 changed files with 17 additions and 6 deletions
  1. +2
    -2
      src/views/task-manage/tools/table.js
  2. +5
    -0
      src/views/user-manage/components/UserModal.vue
  3. +10
    -4
      src/views/user-manage/tools/form.js

+ 2
- 2
src/views/task-manage/tools/table.js View File

@@ -134,7 +134,7 @@ const data = reactive({
text: true,
onClick: editHandle.bind(null, row, 'update')
},
show: row.status < 11 && row.inspectionType === 1,
show: row.status < 11 && row.inspectionType === 1 && roleType.value === 1,
auth: 'task:all:edit'
},
{
@@ -145,7 +145,7 @@ const data = reactive({
onPositiveClick: deleteData.bind(null, row.id)
},
auth: 'task:all:delete',
show: row.status < 16 && row.inspectionType === 1,
show: row.status < 16 && row.inspectionType === 1 && roleType.value === 1,
ButtonProps: {
text: true,
type: 'primary'

+ 5
- 0
src/views/user-manage/components/UserModal.vue View File

@@ -19,6 +19,11 @@
<n-form-item :label="item.label" :path="item.key">
<n-input v-if="item.type === 'input'" v-model:value="userForm[item.key]" :disabled="item.key==='username' && modelTyle ==='update'" v-bind="item.props" />
<n-select v-if="item.type === 'select'" v-model:value="userForm[item.key]" v-bind="item.props" />
<n-radio-group v-if="item.type === 'radio'" v-model:value="userForm[item.key]" :name="item.key">
<n-space>
<n-radio v-for="(cItem,cIndex) in item.options" :key="`${item.key}_${cIndex}`" :value="cItem.value"> {{ cItem.label }}</n-radio>
</n-space>
</n-radio-group>
</n-form-item>
</template>
</n-form>

+ 10
- 4
src/views/user-manage/tools/form.js View File

@@ -2,14 +2,18 @@ import { reactive, ref } from 'vue'
import { isPhone } from '@/utils/is.js'
import { getRoleAll } from '@/api/system/role'
const roleOptions = ref([])

const TYPE_OPTIONS = [
{ value: 1, label: '是' },
{ value: 2, label: '否' }
]
export const form = reactive({
userForm: {
realname: null,
mobile: null,
roleId: null,
username: null,
password: null
password: null,
type: 1
},
userRules: {
realname: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
@@ -19,14 +23,16 @@ export const form = reactive({
],
roleId: [{ required: true, type: 'number', message: '请选择身份', trigger: 'blur' }],
username: [{ required: true, message: '账号为英文和数字', pattern: /^[a-zA-Z0-9]+$/, trigger: 'blur' }],
password: [{ required: true, message: '密码为6到20位的大小写英文和数字组成的', pattern: /^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$)([^\u4e00-\u9fa5\s]){6,20}$/, trigger: 'blur' }]
password: [{ required: true, message: '密码为6到20位的大小写英文和数字组成的', pattern: /^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$)([^\u4e00-\u9fa5\s]){6,20}$/, trigger: 'blur' }],
type: [{ required: true, type: 'number', message: '请选择是否为管理员', trigger: 'blur' }]
},
formItem: [
{ type: 'input', key: 'realname', label: '姓名', props: { maxlength: '5', placeholder: '请输入姓名', clearable: true }},
{ type: 'input', key: 'mobile', label: '联系电话', props: { maxlength: '20', placeholder: '请输入联系电话', clearable: true }},
{ type: 'select', key: 'roleId', label: '身份选择', props: { options: roleOptions, clearable: true }},
{ type: 'input', key: 'username', label: '帐号', props: { maxlength: '20', placeholder: '请输入帐号', clearable: true }},
{ type: 'input', key: 'password', label: '初始密码', props: { maxlength: '20', placeholder: '请输入初始密码', clearable: true }}
{ type: 'input', key: 'password', label: '初始密码', props: { maxlength: '20', placeholder: '请输入初始密码', clearable: true }},
{ type: 'radio', key: 'type', label: '管理员', options: TYPE_OPTIONS }
]
})
export const getRoleOptions = async function() {

Loading…
Cancel
Save