| | |
| | | } |
| | | return request({ |
| | | url: '/system/user/profile/updatePwd', |
| | | method: 'put', |
| | | params: data |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | |
| | | <el-dropdown @command="handleCommand" class="right-menu-item hover-effect" trigger="click"> |
| | | <div class="avatar-wrapper"> |
| | | <img :src="userStore.avatar" class="user-avatar" /> |
| | | <!-- <el-icon><caret-bottom /></el-icon>--> |
| | | <el-icon><caret-bottom /></el-icon> |
| | | </div> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <!-- <router-link to="/user/profile">--> |
| | | <!-- <el-dropdown-item>个人中心</el-dropdown-item>--> |
| | | <!-- </router-link>--> |
| | | <router-link to="/user/profile"> |
| | | <el-dropdown-item>个人中心</el-dropdown-item> |
| | | </router-link> |
| | | <!-- <el-dropdown-item command="setLayout" v-if="settingsStore.showSettings">--> |
| | | <!-- <span>布局设置</span>--> |
| | | <!-- </el-dropdown-item>--> |
| | | <!-- <el-dropdown-item command="password">--> |
| | | <!-- <span>修改密码</span>--> |
| | | <!-- </el-dropdown-item>--> |
| | | <el-dropdown-item command="logout"> |
| | | <span>退出登录</span> |
| | |
| | | import useAppStore from '@/store/modules/app' |
| | | import useUserStore from '@/store/modules/user' |
| | | import useSettingsStore from '@/store/modules/settings' |
| | | |
| | | import resetPwd from "@/views/system/user/profile/resetPwd"; |
| | | const appStore = useAppStore() |
| | | const userStore = useUserStore() |
| | | const settingsStore = useSettingsStore() |
| | |
| | | switch (command) { |
| | | case "setLayout": |
| | | setLayout(); |
| | | break; |
| | | case "password": |
| | | editPsd(); |
| | | break; |
| | | case "logout": |
| | | logout(); |
| | |
| | | }).catch(() => { }); |
| | | } |
| | | |
| | | function editPsd() { |
| | | reviewRef.value.openDialog('pwd',userInfo.value) |
| | | } |
| | | |
| | | const emits = defineEmits(['setLayout']) |
| | | function setLayout() { |
| | | emits('setLayout'); |
| | |
| | | size="default" |
| | | ref="formRef" |
| | | :rules="state.formRules" |
| | | label-width="150px" |
| | | label-width="160px" |
| | | > |
| | | <template v-for="(item, index) in config.formItems" :key="index"> |
| | | <el-divider v-if="item.type === 'divider'" content-position="left">{{item.content}}</el-divider> |
| | |
| | | title: '', |
| | | formData: {}, |
| | | formRules: {}, |
| | | // 文件上传相关 |
| | | uploadUrl: props.uploadConfig.uploadUrl, |
| | | header: { |
| | | Authorization: getToken() |
| | | }, |
| | | fileLists: {}, // 存储各上传字段的文件列表 |
| | | // 数据列表 |
| | | fileLists: {}, |
| | | companyList: [], |
| | | deptList: [], |
| | | userList: [], |
| | |
| | | dialogImageUrl: '' |
| | | }) |
| | | |
| | | // 初始化表单数据 |
| | | const initFormData = () => { |
| | | const formData = {} |
| | | state.fileLists = {} |
| | | |
| | | // 初始化普通表单项 |
| | | props.config.formItems?.forEach(item => { |
| | | // 对于多选选择框,默认值为空数组 |
| | | |
| | | if (item.type === 'select' && item.multiple) { |
| | | formData[item.prop] = Array.isArray(item.defaultValue) ? item.defaultValue : [] |
| | | } else { |
| | | formData[item.prop] = item.defaultValue !== undefined ? item.defaultValue : null |
| | | } |
| | | |
| | | // 初始化文件上传字段的文件列表 |
| | | if (item.type === 'upload') { |
| | | state.fileLists[item.prop] = [] |
| | | } |
| | | }) |
| | | |
| | | // 初始化表单规则 |
| | | const formRules = {} |
| | | props.config.formItems?.forEach(item => { |
| | | if (item.rules) { |
| | | formRules[item.prop] = item.rules |
| | | } |
| | | |
| | | // 为文件上传字段添加自定义验证规则 |
| | | if (item.type === 'upload' && item.required) { |
| | | formRules[item.prop] = formRules[item.prop] || [] |
| | | formRules[item.prop].push({ |
| | |
| | | }) |
| | | } |
| | | |
| | | // 为多选选择框添加自定义验证规则 |
| | | if (item.type === 'select' && item.multiple && item.required) { |
| | | formRules[item.prop] = formRules[item.prop] || [] |
| | | formRules[item.prop].push({ |
| | |
| | | state.formRules = formRules |
| | | } |
| | | |
| | | // 获取选项数据 |
| | | const getOptions = (options) => { |
| | | if (!options) return [] |
| | | |
| | | // 如果是函数,执行函数获取选项 |
| | | if (typeof options === 'function') { |
| | | return options() |
| | | } |
| | | |
| | | // 如果是数组,直接返回 |
| | | if (Array.isArray(options)) { |
| | | return options |
| | | } |
| | |
| | | const getCascaderOptions = (item) => { |
| | | if (!item.options) return [] |
| | | |
| | | // 如果是函数,执行函数获取选项 |
| | | if (typeof item.options === 'function') { |
| | | return item.options() |
| | | } |
| | | |
| | | // 如果是数组,直接返回 |
| | | if (Array.isArray(item.options)) { |
| | | return item.options |
| | | } |
| | | |
| | | // 如果是响应式引用 |
| | | if (item.options && typeof item.options === 'object' && 'value' in item.options) { |
| | | return item.options.value |
| | | } |
| | |
| | | return [] |
| | | } |
| | | |
| | | // 文件上传前的校验 |
| | | const beforeUpload = (rawFile, item) => { |
| | | const maxSize = item.maxSize || 5 |
| | | if (rawFile.size / 1024 / 1024 > maxSize) { |
| | |
| | | return true |
| | | } |
| | | |
| | | // 文件上传成功处理 |
| | | const handleUploadSuccess = (res, uploadFile, prop) => { |
| | | if (res.code === 200) { |
| | | ElMessage.success('上传成功') |
| | | } else { |
| | | // 上传失败,移除文件 |
| | | state.fileLists[prop] = state.fileLists[prop].filter(file => file.uid !== uploadFile.uid) |
| | | ElMessage.warning(res.message || '文件上传失败') |
| | | } |
| | |
| | | }).join(',') |
| | | } |
| | | |
| | | // 文件移除处理 |
| | | const handleRemove = async (file, uploadFiles, prop) => { |
| | | try { |
| | | if(file.uid){ |
| | |
| | | state.dialogVisible = true |
| | | } |
| | | |
| | | // 超出文件数量限制提示 |
| | | const showTip = () => { |
| | | ElMessage.warning('超出文件上传数量') |
| | | } |
| | | |
| | | // 处理事件 |
| | | const handleEvent = async (eventName, value) => { |
| | | try { |
| | | if (eventName === 'getUserListByRole' && props.dataLoader.getUserListByRole) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 打开对话框 |
| | | const openDialog = async (type, initialData) => { |
| | | state.title = type === 'add' ? '新增' : type === 'edit' ? '编辑' : type === 'rectify' ? '整改' : '查看' |
| | | // 初始化表单数据 |
| | | |
| | | initFormData() |
| | | // 加载初始数据 |
| | | |
| | | try { |
| | | if (props.dataLoader.loadInitialData) { |
| | | const initialData = await props.dataLoader.loadInitialData(id) |
| | |
| | | console.error('无初始数据:', error) |
| | | } |
| | | |
| | | // 如果有初始数据,填充表单 |
| | | if (initialData) { |
| | | Object.keys(state.formData).forEach(key => { |
| | | if (key in initialData) { |
| | | // 对于多选字段,确保值是数组 |
| | | |
| | | const item = props.config.formItems.find(i => i.prop === key) |
| | | if (item && item.type === 'select' && item.multiple) { |
| | | state.formData[key] = Array.isArray(initialData[key]) ? initialData[key] : (initialData[key] ? [initialData[key]] : []) |
| | |
| | | } |
| | | }) |
| | | state.formData.id = initialData.id || null |
| | | // 初始化文件上传字段的文件列表 |
| | | |
| | | props.config.formItems?.forEach(item => { |
| | | if (item.type === 'upload' && initialData[item.prop]) { |
| | | state.fileLists[item.prop] = [{ |
| | |
| | | try { |
| | | const valid = await formRef.value.validate() |
| | | if (valid) { |
| | | // 准备提交数据 |
| | | |
| | | const submitData = { ...state.formData } |
| | | |
| | | // 对于多选字段,如果是空数组则转为null(根据后端需求) |
| | | props.config.formItems?.forEach(item => { |
| | | if (item.type === 'select' && item.multiple && |
| | | Array.isArray(submitData[item.prop]) && |
| | |
| | | } |
| | | }) |
| | | |
| | | // 触发提交事件 |
| | | emit('submit', submitData, state.title) |
| | | } |
| | | } catch (error) { |
| | |
| | | } |
| | | } |
| | | |
| | | // 关闭对话框 |
| | | |
| | | const closeDialog = () => { |
| | | formRef.value.clearValidate() |
| | | formRef.value.resetFields() |
| | | dialogVisible.value = false |
| | | } |
| | | |
| | | // 暴露方法给父组件 |
| | | |
| | | defineExpose({ |
| | | openDialog, |
| | | closeDialog |
| | | }) |
| | | |
| | | // 初始化 |
| | | |
| | | initFormData() |
| | | </script> |
| | | |
| | |
| | | margin-top: 7px; |
| | | } |
| | | |
| | | // 多选选择框样式调整 |
| | | |
| | | :deep(.el-select__tags) { |
| | | white-space: nowrap; |
| | | overflow: hidden; |
| | |
| | | hazardLevel: null, |
| | | reformDeptId: null, |
| | | reformUserId: null, |
| | | state: null |
| | | state: null, |
| | | hazardsType: 3 |
| | | }, |
| | | dataList: [], |
| | | deptList: [], |
| | |
| | | sourceList: [ |
| | | { |
| | | id: 1, |
| | | name: '日常排查' |
| | | name: '综合检查' |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '综合性排查' |
| | | name: '部门检查' |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '专业性排查' |
| | | name: '实验室自查' |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: '季节性排查' |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: '重点时段及节假日前排查' |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: '外聘专家诊断式排查' |
| | | }, |
| | | { |
| | | id: 7, |
| | | name: '其他' |
| | | name: '专项检查' |
| | | } |
| | | ], |
| | | levelList: [ |
| | |
| | | hazardLevel: null, |
| | | reformDeptId: null, |
| | | reformUserId: null, |
| | | state: null |
| | | state: null, |
| | | hazardsType: 3 |
| | | } |
| | | await getList() |
| | | } |
| | |
| | | hazardLevel: null, |
| | | reformDeptId: null, |
| | | reformUserId: null, |
| | | state: null |
| | | state: null, |
| | | hazardsType: 2 |
| | | }, |
| | | dataList: [], |
| | | deptList: [], |
| | |
| | | sourceList: [ |
| | | { |
| | | id: 1, |
| | | name: '日常排查' |
| | | name: '综合检查' |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '综合性排查' |
| | | name: '部门检查' |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '专业性排查' |
| | | name: '实验室自查' |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: '季节性排查' |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: '重点时段及节假日前排查' |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: '外聘专家诊断式排查' |
| | | }, |
| | | { |
| | | id: 7, |
| | | name: '其他' |
| | | name: '专项检查' |
| | | } |
| | | ], |
| | | levelList: [ |
| | |
| | | hazardLevel: null, |
| | | reformDeptId: null, |
| | | reformUserId: null, |
| | | state: null |
| | | state: null, |
| | | hazardsType: 2 |
| | | } |
| | | await getList() |
| | | } |
| | |
| | | plain |
| | | icon="Plus" |
| | | @click="openDialog('add',{})" |
| | | v-if="isAuthority" |
| | | >新增</el-button> |
| | | </el-form-item> |
| | | <el-form-item label="隐患名称:" > |
| | |
| | | hazardSource: null, |
| | | hazardLevel: null, |
| | | reformDeptId: null, |
| | | reformUserId: null |
| | | reformUserId: null, |
| | | hazardsType: 1 |
| | | }, |
| | | dataList: [], |
| | | deptList: [], |
| | |
| | | sourceList: [ |
| | | { |
| | | id: 1, |
| | | name: '日常排查' |
| | | name: '综合检查' |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '综合性排查' |
| | | name: '部门检查' |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '专业性排查' |
| | | name: '实验室自查' |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: '季节性排查' |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: '重点时段及节假日前排查' |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: '外聘专家诊断式排查' |
| | | }, |
| | | { |
| | | id: 7, |
| | | name: '其他' |
| | | name: '专项检查' |
| | | } |
| | | ], |
| | | levelList: [ |
| | |
| | | return res.code === 200 ? res.data : [] |
| | | } |
| | | }, |
| | | api: {} |
| | | api: {}, |
| | | isAuthority: false |
| | | }); |
| | | |
| | | const { queryParams, total, dataList, deptList, userList, formConfig, dataLoader, api, sourceList, levelList } = toRefs(state); |
| | | const { queryParams, total, dataList, deptList, userList, formConfig, dataLoader, api, sourceList, levelList, isAuthority } = toRefs(state) |
| | | const userStore = useUserStore() |
| | | onMounted(async ()=>{ |
| | | await getList() |
| | | await getDeptList() |
| | | await getUserList() |
| | | if(userStore.roles.includes('admin') || userStore.roles.includes('sys_admin') || userStore.roles.includes('place_safety_officer')){ |
| | | state.isAuthority = true |
| | | }else{ |
| | | state.isAuthority = false |
| | | } |
| | | }) |
| | | |
| | | onUnmounted(()=>{ |
| | |
| | | hazardSource: null, |
| | | hazardLevel: null, |
| | | reformDeptId: null, |
| | | reformUserId: null |
| | | reformUserId: null, |
| | | hazardsType: 1 |
| | | } |
| | | await getList() |
| | | } |
| | |
| | | auto-complete="off" |
| | | placeholder="密码" |
| | | @keyup.enter="handleLogin" |
| | | show-password |
| | | > |
| | | <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template> |
| | | </el-input> |
| | |
| | | <!-- </el-select>--> |
| | | <el-cascader v-model="queryParams.researchGroup" placeholder="请选择" :options="deptList" :show-all-levels="false" :props="{value: 'deptId',label: 'deptName',children: 'children',emitPath: false,checkStrictly: true}"/> |
| | | </el-form-item> |
| | | <el-form-item label="参加检查人员:" > |
| | | <el-select v-model="queryParams.searchCheckUserId" placeholder="请选择" clearable> |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | | :value="item.userId"> |
| | | </el-option> |
| | | </el-select> |
| | | <el-form-item label="参加检查人员" > |
| | | <el-input v-model.trim="queryParams.checkUser" placeholder="参加检查人员"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="检查类型:" > |
| | | <el-form-item label="检查类型" > |
| | | <el-select v-model="queryParams.checkType" placeholder="请选择" clearable> |
| | | <el-option |
| | | v-for="item in checkTypeList" |
| | |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="隐患:" > |
| | | <el-form-item label="隐患" > |
| | | <el-select v-model="queryParams.haveMainHazard" placeholder="请选择" clearable> |
| | | <el-option :key="1" label="有" :value="1"></el-option> |
| | | <el-option :key="0" label="无" :value="0"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="检查日期:" > |
| | | <el-form-item label="检查日期" > |
| | | <el-date-picker |
| | | v-model="checkDate" |
| | | type="daterange" |
| | |
| | | <el-table-column prop="checkDate" align="center" label="检查时间"/> |
| | | <el-table-column prop="checkPlace" align="center" label="检查地点"/> |
| | | <el-table-column prop="checkRoom" align="center" label="检查房间号"/> |
| | | <el-table-column prop="enactmentDate" align="center" label="参加检查人员"> |
| | | <el-table-column prop="checkUser" align="center" label="参加检查人员"/> |
| | | <el-table-column prop="researchGroupName" align="center" label="被检查部门/研究组"> |
| | | <template #default="scope"> |
| | | {{scope.row.dailySafetyInspectionUsers.map(i=>i.checkUser).join('、')}} |
| | | {{ scope.row.dailySafetyInspectionDepts.filter(item=>item.deptName && item.deptName !== '').map(i=>i.deptName).join('、') }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="researchGroupName" align="center" label="被检查部门/研究组"/> |
| | | <el-table-column prop="checkContent" align="center" label="检查内容"/> |
| | | <el-table-column label="操作" align="center"> |
| | | <template #default="scope"> |
| | |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | researchGroup: null, |
| | | searchCheckUserId: null, |
| | | checkUser: '', |
| | | checkType: null, |
| | | haveMainHazard: null, |
| | | checkBeginDate: '', |
| | | checkEndDate: '' |
| | | }, |
| | | originDeptList: [], |
| | | dataList: [], |
| | | deptList: [], |
| | | safetyDeptList: [], |
| | | userList: [], |
| | | checkTypeList: [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | label: '参加检查人员', |
| | | prop: 'dailySafetyInspectionUsers', |
| | | type: 'select', |
| | | multiple: true, |
| | | filterable: true, |
| | | rules: [{ required: true, message: '请选择人员', trigger: 'change' }], |
| | | options: () => { |
| | | return state.userList.map(user => ({ |
| | | value: user.userId, |
| | | label: user.nickName |
| | | })) |
| | | } |
| | | prop: 'checkUser', |
| | | type: 'text', |
| | | rules: [{ required: true, message: '请输入人员', trigger: 'blur' }], |
| | | }, |
| | | { |
| | | label: '检查地点', |
| | |
| | | }, |
| | | { |
| | | label: '被检查部门/研究组', |
| | | prop: 'researchGroup', |
| | | prop: 'dailySafetyInspectionDepts', |
| | | type: 'cascader', |
| | | showAllLevels: false, |
| | | props: { |
| | |
| | | label: 'deptName', |
| | | children: 'children', |
| | | emitPath: false, |
| | | checkStrictly: true |
| | | checkStrictly: true, |
| | | multiple: true |
| | | }, |
| | | rules: [{ required: true, message: '请选择部门', trigger: 'blur' }], |
| | | options: () => state.deptList |
| | | options: () => state.safetyDeptList |
| | | }, |
| | | { |
| | | label: '检查类型', |
| | |
| | | }, |
| | | { |
| | | label: '复查人员', |
| | | prop: 'reCheckUserId', |
| | | type: 'select', |
| | | rules: [{ required: true, message: '请选择复查人员', trigger: 'blur' }], |
| | | options: () => { |
| | | return state.userList.map(user => ({ |
| | | value: user.userId, |
| | | label: user.nickName |
| | | })) |
| | | } |
| | | prop: 'reCheckUser', |
| | | type: 'text', |
| | | rules: [{ required: true, message: '请输入复查人员', trigger: 'blur' }] |
| | | }, |
| | | { |
| | | label: '复查时间', |
| | |
| | | }) |
| | | |
| | | function getDeptList() { |
| | | listDept({safety: '1'}).then(response => { |
| | | listDept().then(response => { |
| | | state.originDeptList = response.data |
| | | state.deptList = proxy.handleTree(response.data, "deptId") |
| | | }); |
| | | state.safetyDeptList = proxy.handleTree(response.data.filter(item=>item.safety == '1'), "deptId") |
| | | }) |
| | | } |
| | | |
| | | function getUserList() { |
| | |
| | | |
| | | const downloadFile = async (val)=>{ |
| | | let tableData = val |
| | | tableData.checkNames = val.dailySafetyInspectionUsers.map(item=>item.checkUser).join('、') |
| | | try { |
| | | generateWordDocument('/dailyCheckSheet.docx', tableData, '日常安全检查记录表.docx'); |
| | | } catch (error){ |
| | |
| | | } |
| | | |
| | | const openDialog = (type, value) => { |
| | | let initalData = JSON.parse(JSON.stringify(value)) |
| | | if(type == 'edit' || type == 'view'){ |
| | | initalData.dailySafetyInspectionUsers = value.dailySafetyInspectionUsers.map(i=>i.checkUserId) |
| | | } |
| | | const initalData = JSON.parse(JSON.stringify(value)) |
| | | dialogRef.value.openDialog(type, initalData) |
| | | } |
| | | |
| | |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | researchGroup: null, |
| | | searchCheckUserId: null, |
| | | checkUser: '', |
| | | checkType: null, |
| | | haveMainHazard: null, |
| | | checkBeginDate: '', |
| | |
| | | |
| | | const handleSubmit = async (data, type) => { |
| | | const params = JSON.parse(JSON.stringify(data)) |
| | | params.dailySafetyInspectionUsers = params.dailySafetyInspectionUsers.map(item=>{ |
| | | console.log(state.originDeptList,'ori') |
| | | params.dailySafetyInspectionDepts = params.dailySafetyInspectionDepts.map(i=>{ |
| | | return { |
| | | checkUserId: item, |
| | | checkUser: state.userList.find(i=>i.userId == item)?.nickName, |
| | | dailySafetyInspectionId: params.id |
| | | deptId: i, |
| | | deptName: state.originDeptList.find(item=>item.deptId == i)?.deptName |
| | | } |
| | | }) |
| | | params.reCheckUser = state.userList.find(i=>i.userId == params.reCheckUserId)?.nickName |
| | | // params.reCheckUser = state.userList.find(i=>i.userId == params.reCheckUserId)?.nickName |
| | | // 调用API保存数据 |
| | | if (type === '新增') { |
| | | delete params.id |
| | |
| | | >批量取消授权</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="Close" |
| | | @click="handleClose" |
| | | >关闭</el-button> |
| | |
| | | <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="姓名" prop="nickName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="状态" align="center" prop="status"> |
| | |
| | | <el-table @row-click="clickRow" ref="refTable" :data="userList" @selection-change="handleSelectionChange" height="260px"> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="姓名" prop="nickName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="状态" align="center" prop="status"> |
| | |
| | | <el-form :model="form" label-width="80px"> |
| | | <el-row> |
| | | <el-col :span="8" :offset="2"> |
| | | <el-form-item label="用户昵称" prop="nickName"> |
| | | <el-form-item label="姓名" prop="nickName"> |
| | | <el-input v-model="form.nickName" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <!--用户数据--> |
| | | <el-col :span="20" :xs="24"> |
| | | <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="姓名" prop="nickName"> |
| | | <el-input |
| | | v-model="queryParams.nickName" |
| | | placeholder="请输入用户姓名" |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="用户名称" prop="userName"> |
| | | <el-input |
| | | v-model="queryParams.userName" |
| | |
| | | <el-table-column type="selection" width="50" align="center" /> |
| | | <el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" /> |
| | | <el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="姓名" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" /> |
| | | <el-table-column label="状态" align="center" key="status" v-if="columns[5].visible"> |
| | |
| | | <el-form :model="form" :rules="rules" ref="userRef" label-width="80px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="用户昵称" prop="nickName"> |
| | | <el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" /> |
| | | <el-form-item label="姓名" prop="nickName"> |
| | | <el-input v-model="form.nickName" placeholder="请输入姓名" maxlength="30" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | |
| | | const columns = ref([ |
| | | { key: 0, label: `用户编号`, visible: true }, |
| | | { key: 1, label: `用户名称`, visible: true }, |
| | | { key: 2, label: `用户昵称`, visible: true }, |
| | | { key: 2, label: `姓名`, visible: true }, |
| | | { key: 3, label: `部门`, visible: true }, |
| | | { key: 4, label: `手机号码`, visible: true }, |
| | | { key: 5, label: `状态`, visible: true }, |
| | |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | nickName: undefined, |
| | | userName: undefined, |
| | | phonenumber: undefined, |
| | | status: undefined, |
| | |
| | | }, |
| | | rules: { |
| | | userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }], |
| | | nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], |
| | | nickName: [{ required: true, message: "姓名不能为空", trigger: "blur" }], |
| | | password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }], |
| | | email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }], |
| | | phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }] |
| | |
| | | |
| | | <script setup> |
| | | import { updateUserPwd } from "@/api/system/user"; |
| | | |
| | | import useUserStore from "@/store/modules/user"; |
| | | const userStore = useUserStore() |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const user = reactive({ |
| | |
| | | proxy.$refs.pwdRef.validate(valid => { |
| | | if (valid) { |
| | | updateUserPwd(user.oldPassword, user.newPassword).then(response => { |
| | | proxy.$modal.msgSuccess("修改成功"); |
| | | if(response.code == 200){ |
| | | proxy.$modal.msgSuccess("密码修改成功,需重新登录"); |
| | | setTimeout(()=>{ |
| | | userStore.logOut().then(() => { |
| | | location.href = '/index'; |
| | | }) |
| | | },2000) |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | |
| | | <template> |
| | | <el-form ref="userRef" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="用户昵称" prop="nickName"> |
| | | <el-form-item label="姓名" prop="nickName"> |
| | | <el-input v-model="form.nickName" maxlength="30" /> |
| | | </el-form-item> |
| | | <el-form-item label="手机号码" prop="phonenumber"> |
| | |
| | | |
| | | const form = ref({}); |
| | | const rules = ref({ |
| | | nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }], |
| | | email: [{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }], |
| | | nickName: [{ required: true, message: "姓名不能为空", trigger: "blur" }], |
| | | // email: [{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }], |
| | | phonenumber: [{ required: true, message: "手机号码不能为空", trigger: "blur" }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }], |
| | | }); |
| | | |