对比新文件 |
| | |
| | | import request from '/@/utils/request'; |
| | | |
| | | export function dutyApi() { |
| | | return { |
| | | // v1 |
| | | getDutyList: (data: any) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/position/page/list`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | addDuty: (data: any) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/position/add`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | modDuty: (data: any) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/position/mod`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | delDuty: (data: any) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/position/del`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | }, |
| | | getAllList: (data: any) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL + `/position/list`, |
| | | method: 'post', |
| | | data: data |
| | | }); |
| | | } |
| | | // getAllUser: () => { |
| | | // return request({ |
| | | // url: import.meta.env.VITE_API_URL + `/account/list`, |
| | | // method: 'get' |
| | | // }); |
| | | // } |
| | | }; |
| | | } |
| | |
| | | // 工伤申报详情 |
| | | seeAccidentManagementSystem: (params: number) => { |
| | | return request({ |
| | | url: import.meta.env.VITE_API_URL_OUT + `workInjuryDeclaration/info/${params}`, |
| | | url: import.meta.env.VITE_API_URL_OUT + `/workInjuryDeclaration/info/${params}`, |
| | | method: 'get' |
| | | }); |
| | | }, |
| | |
| | | :disabled="disabled" |
| | | :props="propse" |
| | | :data="newTreeList" |
| | | check-strictly |
| | | class="w100" |
| | | placeholder="请选择" |
| | | /> |
| | |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="申报人部门" placeholder="请选择" prop="declareDepartmentId"> |
| | | <el-tree-select v-model="ruleForm.declareDepartmentId" :disabled="disabled" |
| | | <el-tree-select v-model="ruleForm.declareDepartmentId" :disabled="disabled" check-strictly |
| | | :data="newTreeList" :props="propse" class="w100" placeholder="请选择" /> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | <el-tree-select |
| | | v-model="ruleForm.responsibleDepartment" |
| | | :data="data" class="w100" |
| | | check-strictly |
| | | placeholder="请选择"/> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '生巡检指标修改成功', |
| | | message: '巡检指标修改成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowInspectTargetDialog = false; |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-add-user-container"> |
| | | <el-dialog :title="title" v-model="isShowUserDialog" width="769px"> |
| | | <el-form :model="dutyForm" size="default" ref="dutyRef" :rules="dutyFormRules" label-width="90px"> |
| | | <el-row :gutter="35"> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="职务名称" prop="positionName"> |
| | | <el-input v-model.trim="dutyForm.positionName" placeholder="请输入职务名称" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="职务编号" prop="positionCode"> |
| | | <el-input v-model.trim="dutyForm.positionCode" placeholder="请输入职务编号" clearable></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="isShowUserDialog = !isShowUserDialog" size="default">取 消</el-button> |
| | | <el-button type="primary" v-throttle @click="onSubmit" size="default">确 定</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { reactive, toRefs, onMounted, defineComponent, ref } from 'vue'; |
| | | import { ElMessageBox, ElMessage } from 'element-plus'; |
| | | import { dutyApi } from '/@/api/systemManage/duty'; |
| | | |
| | | // 定义接口来定义对象的类型 |
| | | interface DeptData {} |
| | | interface roleData {} |
| | | interface sexData {} |
| | | interface UserState { |
| | | title: string; |
| | | disabled: boolean; |
| | | isShowUserDialog: boolean; |
| | | dutyForm: { |
| | | positionName:string; |
| | | positionCode:string |
| | | }; |
| | | dutyFormRules:{} |
| | | } |
| | | |
| | | export default defineComponent({ |
| | | name: 'dutyDialog', |
| | | setup(props, context) { |
| | | const dutyRef = ref() |
| | | const state = reactive<UserState>({ |
| | | title: '', |
| | | disabled: false, |
| | | isShowUserDialog: false, |
| | | dutyForm: { |
| | | positionName: '', |
| | | positionCode: '' |
| | | }, |
| | | dutyFormRules:{ |
| | | positionName: [{ required: true, message: '请填写职务名称', trigger: 'blur' }], |
| | | positionCode: [{ required: true, message: '请填写职务编号', trigger: 'blur' }] |
| | | } |
| | | }); |
| | | // 打开弹窗 |
| | | const openDialog = (type: string, value: any) => { |
| | | state.isShowUserDialog = true; |
| | | if (type === '新增') { |
| | | state.disabled = false |
| | | state.title = '新增职务'; |
| | | state.dutyForm = { |
| | | positionName: '', |
| | | positionCode: '' |
| | | }; |
| | | } else { |
| | | state.disabled = true |
| | | state.title = '修改职务'; |
| | | state.dutyForm = JSON.parse(JSON.stringify(value)); |
| | | } |
| | | }; |
| | | |
| | | // 新增修改 |
| | | const onSubmit = async () => { |
| | | dutyRef.value.validate(async (valid:Boolean) => { |
| | | if(valid){ |
| | | if (state.title === '新增职务') { |
| | | let res = await dutyApi().addDuty(state.dutyForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '职务新增成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowUserDialog = false; |
| | | context.emit('getDutyList') |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } else { |
| | | let res = await dutyApi().modDuty(state.dutyForm); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '职务修改成功', |
| | | duration: 2000 |
| | | }); |
| | | state.isShowUserDialog = false; |
| | | context.emit('getDutyList') |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | } |
| | | }else{ |
| | | ElMessage({ |
| | | type:'warning', |
| | | message:'请完善基本信息' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | }; |
| | | |
| | | // 页面加载时 |
| | | onMounted(() => {}); |
| | | return { |
| | | dutyRef, |
| | | openDialog, |
| | | onSubmit, |
| | | ...toRefs(state) |
| | | }; |
| | | } |
| | | }); |
| | | </script> |
对比新文件 |
| | |
| | | <template> |
| | | <div class="system-user-container"> |
| | | <el-card shadow="hover"> |
| | | <div class="system-user-search mb15"> |
| | | <el-input size="default" v-model.trim="listQuery.searchParams.positionName" placeholder="请输入职务名称" style="max-width: 180px;margin-left: 10px;margin-right: 10px"> </el-input> |
| | | <el-button size="default" type="primary" class="ml10" @click="initDutyTableData"> |
| | | <el-icon> |
| | | <ele-Search /> |
| | | </el-icon> |
| | | 查询 |
| | | </el-button> |
| | | <el-button size="default" type="success" class="ml10" @click="onOpenUserDialog('新增', '')"> |
| | | <el-icon> |
| | | <ele-FolderAdd /> |
| | | </el-icon> |
| | | 新增职务 |
| | | </el-button> |
| | | </div> |
| | | <el-table :data="data" style="width: 100%"> |
| | | <el-table-column type="index" label="序号" width="60" align="center"/> |
| | | <el-table-column prop="positionName" label="职务名称" show-overflow-tooltip align="center"></el-table-column> |
| | | <el-table-column prop="createBy" label="创建人" show-overflow-tooltip align="center"></el-table-column> |
| | | <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip align="center"></el-table-column> |
| | | <el-table-column label="操作" width="100" align="center"> |
| | | <template #default="scope"> |
| | | <el-button :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onOpenUserDialog('修改', scope.row)">修改</el-button> |
| | | <el-button style="color: red" :disabled="scope.row.userName === 'admin'" size="small" text type="primary" @click="onRowDel(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <br /> |
| | | <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="page-position" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="listQuery.pageIndex" background v-model:page-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination> |
| | | <br /> |
| | | <br /> |
| | | </el-card> |
| | | <duty-dialog ref="dutyRef" @getDutyList="initDutyTableData" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue'; |
| | | import { ElMessageBox, ElMessage } from 'element-plus'; |
| | | import dutyDialog from './component/dutyDialog.vue'; |
| | | import { dutyApi } from '/@/api/systemManage/duty'; |
| | | import { departmentApi } from '/@/api/systemManage/department'; |
| | | import { useRoleApi } from '/@/api/systemManage/role'; |
| | | |
| | | // 定义接口来定义对象的类型 |
| | | interface TableDataRow { |
| | | name: string; |
| | | info: string; |
| | | createTime: string; |
| | | } |
| | | interface TableDataState { |
| | | data: Array<TableDataRow>; |
| | | total: number; |
| | | loading: boolean; |
| | | listQuery: { |
| | | searchParams: { |
| | | positionName: string | null |
| | | positionCode: string | null |
| | | }; |
| | | pageIndex: number; |
| | | pageSize: number; |
| | | } |
| | | } |
| | | |
| | | export default defineComponent({ |
| | | name: 'systemDuty', |
| | | components: { dutyDialog }, |
| | | setup() { |
| | | const dutyRef = ref(); |
| | | const state = reactive<TableDataState>({ |
| | | data: [], |
| | | total: 0, |
| | | loading: false, |
| | | listQuery: { |
| | | searchParams: { |
| | | positionName: '', |
| | | positionCode: '' |
| | | }, |
| | | pageIndex: 1, |
| | | pageSize: 10 |
| | | } |
| | | }); |
| | | // 初始化表格数据 |
| | | const initDutyTableData = async () => { |
| | | let res = await dutyApi().getDutyList(state.listQuery); |
| | | if (res.data.code === '200') { |
| | | console.log(res.data.data,'res.data.data') |
| | | state.data = JSON.parse(JSON.stringify(res.data.data)); |
| | | state.total = res.data.total; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | |
| | | // 打开新增修改职务弹窗 |
| | | const onOpenUserDialog = (type: string, value: any) => { |
| | | dutyRef.value.openDialog(type, value); |
| | | }; |
| | | |
| | | // 删除用户 |
| | | const onRowDel = (row: TableDataRow) => { |
| | | ElMessageBox.confirm(`此操作将永久删除该职务:“${row.positionName}”,是否继续?`, '提示', { |
| | | confirmButtonText: '确认', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }) |
| | | .then(async () => { |
| | | let res = await dutyApi().delDuty({ positionId: row.positionId }); |
| | | if (res.data.code === '200') { |
| | | ElMessage({ |
| | | type: 'success', |
| | | duration: 2000, |
| | | message: '删除成功' |
| | | }); |
| | | await initDutyTableData(); |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleSizeChange = (val: number) => { |
| | | state.listQuery.pageSize = val; |
| | | initDutyTableData(); |
| | | }; |
| | | // 分页改变 |
| | | const onHandleCurrentChange = (val: number) => { |
| | | state.listQuery.pageIndex = val; |
| | | initDutyTableData(); |
| | | }; |
| | | // 页面加载时 |
| | | onMounted(() => { |
| | | let a = { name: 1, c: { name: 1 } }; |
| | | let b = Object.assign({}, a); |
| | | b.c.name = 2; |
| | | initDutyTableData(); |
| | | }); |
| | | return { |
| | | dutyRef, |
| | | onOpenUserDialog, |
| | | onRowDel, |
| | | onHandleSizeChange, |
| | | initDutyTableData, |
| | | onHandleCurrentChange, |
| | | ...toRefs(state) |
| | | }; |
| | | } |
| | | }); |
| | | </script> |
| | | <style scoped> |
| | | :deep(.el-textarea.is-disabled .el-textarea__inner) { |
| | | background-color: var(--el-card-bg-color); |
| | | color: var(--el-input-text-color, var(--el-text-color-regular)); |
| | | } |
| | | :deep(.el-input.is-disabled .el-input__inner) { |
| | | color: var(--el-input-text-color, var(--el-text-color-regular)); |
| | | } |
| | | :deep(.el-input.is-disabled .el-input__wrapper) { |
| | | background-color: var(--el-card-bg-color); |
| | | } |
| | | </style> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="职务" prop="positionId"> |
| | | <el-select v-model="userForm.positionId" placeholder="请选择" clearable class="w100"> |
| | | <el-option v-for="item in dutyData" :key="item.positionId" :label="item.positionName" :value="item.positionId"> </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20"> |
| | | <el-form-item label="手机号" prop="phone"> |
| | | <el-input v-model.trim="userForm.phone" placeholder="请输入手机号" clearable></el-input> |
| | | </el-form-item> |
| | |
| | | // 定义接口来定义对象的类型 |
| | | interface DeptData {} |
| | | interface roleData {} |
| | | interface dutyData {} |
| | | interface sexData {} |
| | | interface UserState { |
| | | title: string; |
| | |
| | | realName: string; |
| | | roleId: number | null; |
| | | depId: number | null; |
| | | positionId: number | null; |
| | | phone: string; |
| | | email: string; |
| | | gender: number | null; |
| | | positionId: number | null; |
| | | password: string; |
| | | expireTime: string; |
| | | status: number; |
| | |
| | | }, |
| | | departmentData: Array<DeptData>; |
| | | roleData: Array<roleData>; |
| | | dutyData: Array<dutyData>; |
| | | sexList: Array<sexData>; |
| | | } |
| | | |
| | |
| | | identify: '', |
| | | gender: null, // 性别 |
| | | password: '', // 账户密码 |
| | | positionId: 1, // 岗位 |
| | | positionId: null, // 岗位 |
| | | expireTime: '', // 账户过期 |
| | | status: 1 // 用户状态 |
| | | }, |
| | |
| | | realName: [{ required: true, message: '请填写真实姓名', trigger: 'blur' }], |
| | | roleId: [{ required: true, message: '请选择用户角色', trigger: 'change' }], |
| | | depId: [{ required: true, message: '请选择部门', trigger: 'change' }], |
| | | positionId: [{ required: true, message: '请选择职务', trigger: 'change' }], |
| | | phone: [{ required: true, message: '请填写手机号', trigger: 'blur' }], |
| | | gender: [{ required: true, message: '请选择性别', trigger: 'change' }], |
| | | expireTime: [{ required: true, message: '请输入账户过期时间', trigger: 'blur' }], |
| | |
| | | }, |
| | | departmentData: [], // 部门数据 |
| | | roleData: [], //角色数据 |
| | | dutyData:[], //职务数据 |
| | | sexList: [ |
| | | { id: 1, name: '男' }, |
| | | { id: 0, name: '女' } |
| | | ] |
| | | }); |
| | | // 打开弹窗 |
| | | const openDialog = (type: string, value: any, departmentList: [], roleList: []) => { |
| | | const openDialog = (type: string, value: any, departmentList: [], roleList: [], dutyList:[]) => { |
| | | state.isShowUserDialog = true; |
| | | state.departmentData = departmentList; |
| | | state.roleData = roleList; |
| | | state.dutyData = dutyList |
| | | if (type === '新增') { |
| | | state.disabled = false |
| | | state.title = '新增用户'; |
| | |
| | | phone: '', |
| | | email: '', |
| | | identify: '', |
| | | positionId: 1, |
| | | positionId: null, |
| | | gender: null, |
| | | password: '', |
| | | expireTime: '', |
| | |
| | | <el-tag type="success" v-else-if="scope.row.gender == 0">女</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="role.roleName" label="关联角色" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="positionId" label="职务" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | {{ parseNumber(scope.row.positionId) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="department.depName" label="部门" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="phone" label="手机号" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="email" label="邮箱" show-overflow-tooltip></el-table-column> |
| | |
| | | import { ElMessageBox, ElMessage } from 'element-plus'; |
| | | import userDialog from '/@/views/system/user/component/userDialog.vue'; |
| | | import { userApi } from '/@/api/systemManage/user'; |
| | | import { dutyApi } from '/@/api/systemManage/duty'; |
| | | import { departmentApi } from '/@/api/systemManage/department'; |
| | | import { useRoleApi } from '/@/api/systemManage/role'; |
| | | |
| | |
| | | }; |
| | | departmentList: []; |
| | | roleList: []; |
| | | dutyList: []; |
| | | props:{} |
| | | } |
| | | |
| | |
| | | }, |
| | | departmentList: [], |
| | | roleList: [], |
| | | dutyList: [], |
| | | props: { |
| | | label: 'depName', |
| | | value: 'depId', |
| | |
| | | } |
| | | }; |
| | | |
| | | // 回显职务信息 |
| | | const parseNumber = (value: number) => { |
| | | return state.dutyList.find((i) => i.positionId === value)?.positionName; |
| | | }; |
| | | const getDepartmentData = async () => { |
| | | let res = await departmentApi().getDepartmentList(); |
| | | if (res.data.code === '200') { |
| | |
| | | } |
| | | }; |
| | | |
| | | const getDutyData = async () => { |
| | | let res = await dutyApi().getAllList({positionName: '',positionCode: ''}); |
| | | if (res.data.code === '200') { |
| | | state.dutyList = res.data.data; |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | // 打开新增修改用户弹窗 |
| | | const onOpenUserDialog = (type: string, value: any) => { |
| | | userRef.value.openDialog(type, value, state.departmentList, state.roleList); |
| | | userRef.value.openDialog(type, value, state.departmentList, state.roleList, state.dutyList); |
| | | }; |
| | | |
| | | // 删除用户 |
| | |
| | | initUserTableData(); |
| | | getDepartmentData(); |
| | | getRoleData(); |
| | | getDutyData() |
| | | }); |
| | | return { |
| | | userRef, |
| | | onOpenUserDialog, |
| | | onRowDel, |
| | | parseNumber, |
| | | onHandleSizeChange, |
| | | initUserTableData, |
| | | onHandleCurrentChange, |