# mock base api | # mock base api | ||||
VITE_APP_GLOB_BASE_API_MOCK = '/api-mock' | VITE_APP_GLOB_BASE_API_MOCK = '/api-mock' | ||||
VITE_AUTHORITY = 'http://192.168.11.11:8090' | |||||
#VITE_AUTHORITY = 'https://login-test.t-aaron.com' | |||||
#VITE_AUTHORITY = 'http://192.168.11.11:8090' | |||||
VITE_AUTHORITY = 'https://login-test.t-aaron.com' | |||||
VITE_CLIENT_ID = 'tuoheng-pilot-admin' | VITE_CLIENT_ID = 'tuoheng-pilot-admin' | ||||
VITE_CLIENT_SECRET = 'WB0CZ1c6bZLiYP6jLtDFsA==' | VITE_CLIENT_SECRET = 'WB0CZ1c6bZLiYP6jLtDFsA==' |
method: 'delete' | method: 'delete' | ||||
}) | }) | ||||
} | } | ||||
/** | |||||
* 更改状态 | |||||
* @returns | |||||
*/ | |||||
export function changeUserStatus(data) { | |||||
return request({ | |||||
url: '/user/status', | |||||
method: 'put', | |||||
data | |||||
}) | |||||
} |
text: true, | text: true, | ||||
onClick: editHandle.bind(null, row, 'update') | 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' | auth: 'task:all:edit' | ||||
}, | }, | ||||
{ | { | ||||
onPositiveClick: deleteData.bind(null, row.id) | onPositiveClick: deleteData.bind(null, row.id) | ||||
}, | }, | ||||
auth: 'task:all:delete', | auth: 'task:all:delete', | ||||
show: row.status < 16 && row.inspectionType === 1, | |||||
show: row.status < 16 && row.inspectionType === 1 && roleType.value === 1, | |||||
ButtonProps: { | ButtonProps: { | ||||
text: true, | text: true, | ||||
type: 'primary' | type: 'primary' |
<n-form-item :label="item.label" :path="item.key"> | <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-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-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> | </n-form-item> | ||||
</template> | </template> | ||||
</n-form> | </n-form> |
import { isPhone } from '@/utils/is.js' | import { isPhone } from '@/utils/is.js' | ||||
import { getRoleAll } from '@/api/system/role' | import { getRoleAll } from '@/api/system/role' | ||||
const roleOptions = ref([]) | const roleOptions = ref([]) | ||||
const TYPE_OPTIONS = [ | |||||
{ value: 1, label: '是' }, | |||||
{ value: 2, label: '否' } | |||||
] | |||||
export const form = reactive({ | export const form = reactive({ | ||||
userForm: { | userForm: { | ||||
realname: null, | realname: null, | ||||
mobile: null, | mobile: null, | ||||
roleId: null, | roleId: null, | ||||
username: null, | username: null, | ||||
password: null | |||||
password: null, | |||||
type: 1 | |||||
}, | }, | ||||
userRules: { | userRules: { | ||||
realname: [{ required: true, message: '请输入姓名', trigger: 'blur' }], | realname: [{ required: true, message: '请输入姓名', trigger: 'blur' }], | ||||
], | ], | ||||
roleId: [{ required: true, type: 'number', message: '请选择身份', trigger: 'blur' }], | roleId: [{ required: true, type: 'number', message: '请选择身份', trigger: 'blur' }], | ||||
username: [{ required: true, message: '账号为英文和数字', pattern: /^[a-zA-Z0-9]+$/, 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: [ | formItem: [ | ||||
{ type: 'input', key: 'realname', label: '姓名', props: { maxlength: '5', placeholder: '请输入姓名', clearable: true }}, | { type: 'input', key: 'realname', label: '姓名', props: { maxlength: '5', placeholder: '请输入姓名', clearable: true }}, | ||||
{ type: 'input', key: 'mobile', label: '联系电话', props: { maxlength: '20', 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: 'select', key: 'roleId', label: '身份选择', props: { options: roleOptions, clearable: true }}, | ||||
{ type: 'input', key: 'username', label: '帐号', props: { maxlength: '20', placeholder: '请输入帐号', 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() { | export const getRoleOptions = async function() { |
import TableTags from '@/components/DataTable/tools/Tags.vue' | import TableTags from '@/components/DataTable/tools/Tags.vue' | ||||
import TableSwitch from '@/components/DataTable/tools/Switch.vue' | import TableSwitch from '@/components/DataTable/tools/Switch.vue' | ||||
import TableAction from '@/components/DataTable/tools/Action.vue' | import TableAction from '@/components/DataTable/tools/Action.vue' | ||||
import { userUpdate } from '@/api/system/user.js' | |||||
import { changeUserStatus } from '@/api/system/user.js' | |||||
import { getRoleAll } from '@/api/system/role' | import { getRoleAll } from '@/api/system/role' | ||||
const roleOptions = ref([]) | const roleOptions = ref([]) | ||||
// 设置状态 | // 设置状态 | ||||
function changeStatus(row) { | function changeStatus(row) { | ||||
userUpdate({ id: row.data.id, status: row.value }).then(res => { | |||||
changeUserStatus({ id: row.data.id, status: row.value }).then(res => { | |||||
if (res.code === 0) { | if (res.code === 0) { | ||||
handleSearch() | handleSearch() | ||||
} | } |