diff --git a/src/assets/css/common.scss b/src/assets/css/common.scss index 5167958..e5770b4 100644 --- a/src/assets/css/common.scss +++ b/src/assets/css/common.scss @@ -115,7 +115,6 @@ * { box-sizing: border-box; - font-size: 14px; &:not(dd,dl,dt) { margin: 0; diff --git a/src/assets/js/asyncRouter.js b/src/assets/js/asyncRouter.js index 353ebe9..0e4c9a7 100644 --- a/src/assets/js/asyncRouter.js +++ b/src/assets/js/asyncRouter.js @@ -78,6 +78,38 @@ export default [ meta: { title: "组织机构", isSubMenu: false }, component: "enterprise_management/department/index", }, + { + path: "/enterprise_management/post", + meta: { title: "岗位管理", isSubMenu: false }, + component: "enterprise_management/post/index", + }, + { + path: "/enterprise_management/user", + meta: { title: "用户管理", isSubMenu: false }, + component: "children", + children: [ + { + path: "", + component: "enterprise_management/user/index", + }, + { + path: "/enterprise_management/user/add", + meta: { + title: "新增", + activeMenu: "/enterprise_management/user", + }, + component: "enterprise_management/user/add", + }, + { + path: "/enterprise_management/user/edit", + meta: { + title: "修改", + activeMenu: "/enterprise_management/user", + }, + component: "enterprise_management/user/add", + }, + ], + }, ], }, { diff --git a/src/assets/js/data_dictionary.js b/src/assets/js/data_dictionary.js index 1691e6c..caec7db 100644 --- a/src/assets/js/data_dictionary.js +++ b/src/assets/js/data_dictionary.js @@ -68,6 +68,76 @@ export const layoutFnGetRiskLevel = async () => { }); return ref(resData.list); }; +// 部门级别 +export const layoutFnGetDepartmentLevel = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "4a661fa8aedc4d158c9cddaa9d2ec47e", + }); + return ref(resData.list); +}; +// 民族 +export const layoutFnGetNation = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "0a0e406f27f74ee698fe9979d25f62dd", + }); + return ref(resData.list); +}; +// 性别 +export const layoutFnGetSex = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "21501808bbc344d593fbf9ccfe6c4531", + }); + return ref(resData.list); +}; +// 政治面貌 +export const layoutFnGetPoliticalLandscape = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "6351efdd12dc4730952e5d195718e252", + }); + return ref(resData.list); +}; +// 文化程度 +export const layoutFnGetDegreeOfEducation = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "d7d80f08d73a4accbccf4fd3d8d1d867", + }); + return ref(resData.list); +}; +// 人员类型 +export const layoutFnGetPersonnelType = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "0b62f92b0b624aab8e89a77304a64d5e", + }); + return ref(resData.list); +}; +// 职务 +export const layoutFnGetDuties = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "09e36ac01e9540f8bc84eab1c1a78754", + }); + return ref(resData.list); +}; +// 职称 +export const layoutFnGetProfessionalTitle = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "945a6b10e59946078b500f0fbafa8679", + }); + return ref(resData.list); +}; +// 工种 +export const layoutFnGetJobType = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "55484e491a5e442d839c4595380713ec", + }); + return ref(resData.list); +}; +// 在职情况 +export const layoutFnGetEmploymentSituation = async () => { + const resData = await getLevels({ + DICTIONARIES_ID: "548764b5d4bf4bd7a18ef88274ef49e4", + }); + return ref(resData.list); +}; // 部门树 export const layoutFnGetDepartmentTree = async () => { const resData = await getDepartmentTree(); diff --git a/src/assets/js/useListData.js b/src/assets/js/useListData.js index 73ae914..28a9c91 100644 --- a/src/assets/js/useListData.js +++ b/src/assets/js/useListData.js @@ -3,11 +3,12 @@ import { getDataType } from "@/assets/js/utils.js"; /** * @param api {Function} 接口函数 - * @param options {Object?: {callbackFn, otherParams, immediate, usePagination}} 配置项 - * @param options.callbackFn {Function?} 回调函数 + * @param options {Object?: {callbackFn, otherParams, immediate, usePagination, key}} 配置项 + * @param options.callbackFn {Function?} 回调函数(返回值为后台返回的所有数据) * @param options.otherParams {Object?} 其它接口参数 * @param options.immediate {Boolean?} 是否立即执行接口函数(默认是) * @param options.usePagination {Boolean?} 是否使用分页(默认是) + * @param options.key {String?} 返回的存放数组的key(默认varList) * @return {Object} 返回对象包含以下属性:list 表格数据,pagination 分页数据,searchForm 搜索表单数据,tableRef 表格实例,fnGetData 获取数据函数,fnResetPagination 重置分页函数 */ @@ -19,8 +20,11 @@ export default function useListData(api, options = {}) { throw new Error("options.immediate必须是一个布尔值"); if (options.usePagination && getDataType(options.usePagination) !== "Boolean") throw new Error("options.usePagination必须是一个布尔值"); + if (options.key && getDataType(options.key) !== "String") + throw new Error("options.key必须是一个字符串"); const immediate = options.immediate ?? true; const usePagination = options.usePagination ?? true; + const key = options.key ?? "varList"; if (!immediate && options.otherParams) throw new Error("options.otherParams只有在immediate为true时才有效"); if ( @@ -51,9 +55,9 @@ export default function useListData(api, options = {}) { ...(options.otherParams || {}), ...(getDataType(otherParams) === "Object" ? otherParams : {}), }); - list.value = resData.varList; + list.value = resData[key]; pagination.value.total = resData.page.totalResult; - options.callbackFn && options.callbackFn(list.value); + options.callbackFn && options.callbackFn(resData); }; immediate && fnGetData().then(); const fnResetPagination = async (otherParams) => { diff --git a/src/assets/js/utils.js b/src/assets/js/utils.js index 89536b2..d81037e 100644 --- a/src/assets/js/utils.js +++ b/src/assets/js/utils.js @@ -318,3 +318,40 @@ export function translationStatus(status, list) { } } } + +/** + * @description 根据身份证号获取出生日期和性别 + * @param {String} idCard 身份证号 + * @return {Object} 出生日期和性别 date sex + **/ +export function idCardGetDateAndGender(idCard) { + const reg = + /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; + let sex = ""; + let date = ""; + if (reg.test(idCard)) { + const org_birthday = idCard.substring(6, 14); + const org_gender = idCard.substring(16, 17); + const birthday = + org_birthday.substring(0, 4) + + "-" + + org_birthday.substring(4, 6) + + "-" + + org_birthday.substring(6, 8); + const birthdays = new Date(birthday.replace(/-/g, "/")); + const Month = birthdays.getMonth() + 1; + let MonthDate; + const DayDate = birthdays.getDate(); + let Day; + if (Month < 10) MonthDate = "0" + Month; + else MonthDate = Month; + if (DayDate < 10) Day = "0" + DayDate; + else Day = DayDate; + sex = + org_gender % 2 === 1 + ? "998f8531a6254c2eab5c825fa2d9896f" + : "fdd532d9def447cdb68af3a938f6f05c"; + date = birthdays.getFullYear() + "-" + MonthDate + "-" + Day; + } + return { sex, date }; +} diff --git a/src/components/department/index.vue b/src/components/department/index.vue index 0ad91a5..0306cc7 100644 --- a/src/components/department/index.vue +++ b/src/components/department/index.vue @@ -6,6 +6,7 @@ :props="{ children: 'nodes', label: 'name', + disabled: '', }" :render-after-expand="false" accordion @@ -50,16 +51,10 @@ const props = defineProps({ type: Boolean, default: true, }, - rootDisable: { - type: String, - default: "Y", - }, }); const emits = defineEmits(["update:modelValue"]); const modelValue = useVModel(props, "modelValue", emits); -const departmentTree = await layoutFnGetDepartmentTree({ - ROOT_DISABLE: props.rootDisable, -}); +const departmentTree = await layoutFnGetDepartmentTree(); diff --git a/src/components/department_tree/index.vue b/src/components/department_tree/index.vue new file mode 100644 index 0000000..e922050 --- /dev/null +++ b/src/components/department_tree/index.vue @@ -0,0 +1,65 @@ + + + + + + + + diff --git a/src/views/confined_space/ledger/components/import_file.vue b/src/components/import_file/index.vue similarity index 74% rename from src/views/confined_space/ledger/components/import_file.vue rename to src/components/import_file/index.vue index 41ef4fd..3ea7cd8 100644 --- a/src/views/confined_space/ledger/components/import_file.vue +++ b/src/components/import_file/index.vue @@ -1,5 +1,5 @@ - + @@ -16,21 +16,32 @@ + + diff --git a/src/request/data_dictionary.js b/src/request/data_dictionary.js index 5e86a7c..2a458cf 100644 --- a/src/request/data_dictionary.js +++ b/src/request/data_dictionary.js @@ -36,3 +36,9 @@ export const getDepartmentTree = (params) => loading: false, ...params, }); +// 获取岗位 +export const getPostListAll = (params) => + post("/post/listAll", { + loading: false, + ...params, + }); diff --git a/src/request/department.js b/src/request/department.js deleted file mode 100644 index e6a7632..0000000 --- a/src/request/department.js +++ /dev/null @@ -1,5 +0,0 @@ -import { post } from "@/request/axios.js"; - -export const getDepartmentList = (params) => post("/department/list", params); // 组织机构列表 -export const setDepartmentDelete = (params) => - post("/department/delete", params); // 组织机构删除 diff --git a/src/request/enterprise_management.js b/src/request/enterprise_management.js index 7e6fe3b..7129288 100644 --- a/src/request/enterprise_management.js +++ b/src/request/enterprise_management.js @@ -12,3 +12,30 @@ export const setIndustryQualificationsAdd = (params) => post("/qualifications/add", params); // 行业资质添加 export const setIndustryQualificationsEdit = (params) => post("/qualifications/edit", params); // 行业资质修改 +export const getDepartmentList = (params) => post("/department/list", params); // 组织机构列表 +export const getDepartmentView = (params) => post("/department/goEdit", params); // 组织机构查看 +export const setDepartmentDelete = (params) => + post("/department/delete", params); // 组织机构删除 +export const setDepartmentAdd = (params) => post("/department/add", params); // 组织机构添加 +export const setDepartmentEdit = (params) => post("/department/edit", params); // 组织机构修改 +export const getPostList = (params) => post("/post/list", params); // 岗位管理列表 +export const getPostView = (params) => post("/post/goEdit", params); // 岗位管理查看 +export const setPostDelete = (params) => post("/post/delete", params); // 岗位管理删除 +export const setPostAdd = (params) => upload("/post/add", params); // 岗位管理添加 +export const setPostEdit = (params) => upload("/post/edit", params); // 岗位管理修改 +export const getUserList = (params) => post("/user/list", params); // 用户管理列表 +export const setUserDelete = (params) => post("/user/deleteUser", params); // 用户管理删除 +export const setUserResetPassword = (params) => + post("/corpinfo/resetPwd", params); // 用户管理重置密码 +export const getUserScheduling = (params) => + post("/shiftworkrules/listAll", params); // 用户管理获取排班 +export const setUserImport = (params) => upload("/user/readExcel2", params); // 用户管理导入 +export const setUserLearnersImport = (params) => + upload("/user/readExcel3", params); // 用户管理在线学习人员导入 +export const getUserInfo = (params) => post("/user/goAddUser", params); // 用户管理添加获取信息 +export const getUserCurrentShiftList = (params) => + post("/shiftworkperiod/listPeriods", params); // 用户管理当前班次列表 +export const getUserScheduleView = (params) => + post("/shiftworkperiod/getWorkDate", params); // 用户管理查看排班表 +export const setDictionaryDelete = (params) => + post("/dictionariesCorp/delete", params); // 数据字典删除 diff --git a/src/views/confined_space/ledger/components/add.vue b/src/views/confined_space/ledger/components/add.vue index 4a51976..7890a0b 100644 --- a/src/views/confined_space/ledger/components/add.vue +++ b/src/views/confined_space/ledger/components/add.vue @@ -65,7 +65,13 @@ - + diff --git a/src/views/confined_space/ledger/index.vue b/src/views/confined_space/ledger/index.vue index 830ba5e..2228d4a 100644 --- a/src/views/confined_space/ledger/index.vue +++ b/src/views/confined_space/ledger/index.vue @@ -22,9 +22,7 @@ - - 导入 - + 导入 @@ -81,9 +79,10 @@ - { + data.importDialogVisible = !data.importDialogVisible; +}; +const fnSubmitImport = async (formData) => { + const resData = await setLedgerImport(formData); + ElMessage.success(resData.msg); + fnImportDialogChangeShow(); + fnResetPagination(); +}; diff --git a/src/views/enterprise_management/department/components/add.vue b/src/views/enterprise_management/department/components/add.vue new file mode 100644 index 0000000..f879b83 --- /dev/null +++ b/src/views/enterprise_management/department/components/add.vue @@ -0,0 +1,168 @@ + + + + + {{ parentName }} + + + + + + + + + + + + + + + + + + + + + + + + 是 + 否 + + + + + + + + + + + 确认 + 关闭 + + + + + + + diff --git a/src/views/enterprise_management/department/index.vue b/src/views/enterprise_management/department/index.vue index 3adb25c..e25be04 100644 --- a/src/views/enterprise_management/department/index.vue +++ b/src/views/enterprise_management/department/index.vue @@ -3,21 +3,19 @@ - - @@ -67,6 +65,7 @@ type="primary" text link + v-if="buttonJurisdiction.edit" @click="fnAddOrEdit(row.DEPARTMENT_ID, 'edit')" > 编辑 @@ -75,6 +74,7 @@ type="primary" text link + v-if="buttonJurisdiction.del" @click="fnDelete(row.DEPARTMENT_ID, row.NAME)" > 删除 @@ -82,10 +82,15 @@ - - + + 新增 + 返回 @@ -95,6 +100,14 @@ v-model:visible="data.structuralDiagramVisible" :tree-data="data.treeData" /> + @@ -103,15 +116,18 @@ import { serialNumber } from "@/assets/js/utils.js"; import useListData from "@/assets/js/useListData.js"; import { getDepartmentList, + getDepartmentView, setDepartmentDelete, -} from "@/request/department.js"; -import { layoutFnGetDepartmentTree } from "@/assets/js/data_dictionary.js"; -import { reactive, ref, watch } from "vue"; +} from "@/request/enterprise_management.js"; +import { nextTick, reactive, ref } from "vue"; import { onBeforeRouteUpdate, useRoute, useRouter } from "vue-router"; import { ArrowRight } from "@element-plus/icons-vue"; import { debounce } from "throttle-debounce"; import { ElMessage, ElMessageBox } from "element-plus"; import StructuralDiagram from "./components/structural_diagram.vue"; +import LayoutDepartmentTree from "@/components/department_tree/index.vue"; +import Add from "./components/add.vue"; +import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js"; const router = useRouter(); const route = useRoute(); @@ -119,8 +135,6 @@ const parentIdDefault = "0"; const parentNameDefault = "(无)此项为顶级部门"; const DEPARTMENT_ID = ref(route.query.DEPARTMENT_ID || parentIdDefault); const DEPARTMENT_NAME = ref(route.query.DEPARTMENT_NAME || parentNameDefault); -const treeRef = ref(null); -const filterText = ref(""); const { list, pagination, fnGetData, fnResetPagination } = useListData( getDepartmentList, { @@ -131,20 +145,25 @@ const { list, pagination, fnGetData, fnResetPagination } = useListData( ); const data = reactive({ treeData: [], + refreshTreeData: false, structuralDiagramVisible: false, + addOrEditDialog: { + visible: false, + type: "", + form: { + NAME: "", + LEVEL: "", + DEP_ORDER: "", + HEADMAN: "", + TEL: "", + FUNCTIONS: "", + BZ: "", + ISSUPERVISE: "0", + checkedIds: [], + }, + }, }); -watch(filterText, (val) => { - treeRef.value.filter(val); -}); -const fnFilterNode = (value, data) => { - if (!value) return true; - return data.name.includes(value); -}; -const fnGetTreeData = async () => { - const treeData = await layoutFnGetDepartmentTree(); - data.treeData = treeData.value; -}; -fnGetTreeData(); +const buttonJurisdiction = await useButtonJurisdiction("department"); const fnGetDataTransfer = () => { fnGetData({ DEPARTMENT_ID: DEPARTMENT_ID.value, @@ -160,13 +179,30 @@ onBeforeRouteUpdate((to) => { DEPARTMENT_NAME.value = to.query.DEPARTMENT_NAME || parentNameDefault; fnResetPaginationTransfer(); }); +const fnAddOrEdit = async (DEPARTMENT_ID, type) => { + data.addOrEditDialog.visible = true; + await nextTick(); + data.addOrEditDialog.type = type; + if (type === "edit") { + const resData = await getDepartmentView({ + DEPARTMENT_ID, + }); + data.addOrEditDialog.form = resData.pd; + data.addOrEditDialog.form.checkedIds = resData.varlist.map( + (item) => item.SUB_DEPARTMENT_ID + ); + } +}; const fnDelete = debounce( 1000, async (DEPARTMENT_ID, NAME) => { - await ElMessageBox.confirm(`确定要删除[${NAME}]吗?`, { type: "warning" }); + await ElMessageBox.confirm(`确定要删除【${NAME}】吗?`, { + type: "warning", + }); await setDepartmentDelete({ DEPARTMENT_ID }); ElMessage.success("删除成功"); - await fnResetPaginationTransfer(); + fnResetPaginationTransfer(); + data.refreshTreeData = true; }, { atBegin: true } ); diff --git a/src/views/enterprise_management/industry_qualifications/add.vue b/src/views/enterprise_management/industry_qualifications/add.vue index 8bd36e8..7d6ac21 100644 --- a/src/views/enterprise_management/industry_qualifications/add.vue +++ b/src/views/enterprise_management/industry_qualifications/add.vue @@ -20,7 +20,13 @@ - + 暂无图片 @@ -139,7 +140,7 @@ import { import { useRouter } from "vue-router"; import useListData from "@/assets/js/useListData.js"; -const FILE_URL = import.meta.env.VITE_FILE_URL; +const VITE_FILE_URL = import.meta.env.VITE_FILE_URL; const router = useRouter(); const { list, pagination, searchForm, fnGetData, fnResetPagination } = useListData(getIndustryQualificationsList); @@ -161,7 +162,7 @@ const fnDelete = debounce( await ElMessageBox.confirm("确定要删除吗?", { type: "warning" }); await setIndustryQualificationsDelete({ QUALIFICATIONS_ID }); ElMessage.success("删除成功"); - await fnResetPaginationTransfer(); + fnResetPaginationTransfer(); }, { atBegin: true } ); diff --git a/src/views/enterprise_management/post/components/add.vue b/src/views/enterprise_management/post/components/add.vue new file mode 100644 index 0000000..0745447 --- /dev/null +++ b/src/views/enterprise_management/post/components/add.vue @@ -0,0 +1,117 @@ + + + + + {{ departmentName }} + + + + + + + + + + 启用 + 禁用 + + + + + + + + 确认 + 关闭 + + + + + + + diff --git a/src/views/enterprise_management/post/index.vue b/src/views/enterprise_management/post/index.vue new file mode 100644 index 0000000..6c72592 --- /dev/null +++ b/src/views/enterprise_management/post/index.vue @@ -0,0 +1,194 @@ + + + + + + + + + + + + {{ serialNumber(pagination, $index) }} + + + + + + + 启用 + 禁用 + + + + + + + + + + 暂无图片 + + 预览 + + + + + + + 编辑 + + + 删除 + + + + + + 新增 + + + + + + + + + + + + + diff --git a/src/views/enterprise_management/user/add.vue b/src/views/enterprise_management/user/add.vue new file mode 100644 index 0000000..e5b6549 --- /dev/null +++ b/src/views/enterprise_management/user/add.vue @@ -0,0 +1,747 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 当前班状 + + + + + + + + + + {{ item.period.WORKSTATUS === "1" ? "上班" : "休班" }} + + + + + + + + + + + + + 是 + 否 + + + + + + + 是 + 否 + + + + + + + 是 + 否 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + * 图像格式:JPEG、JPG、PNG、BMP + + + * 图像大小:不超过3M。 + + + * + 图像分辨率:大于32×32像素,小于4096×4096像素,人脸占比不低于64×64像素。 + + + (如无合适照片请该人员登陆秦安APP中进行人脸照片采集) + + + + + + + + + + + + + + + + + 保存 + + + + + + + + diff --git a/src/views/enterprise_management/user/components/scheduling.vue b/src/views/enterprise_management/user/components/scheduling.vue new file mode 100644 index 0000000..4bd567a --- /dev/null +++ b/src/views/enterprise_management/user/components/scheduling.vue @@ -0,0 +1,93 @@ + + + + + {{ date }} + + + 上个月 + + + 今天 + + + 下个月 + + + + + + + {{ data.day.split("-").slice(2).join() }} + + + + 上班 + + 休班 + + + + + + + + + 取消 + + + + + + + diff --git a/src/views/enterprise_management/user/index.vue b/src/views/enterprise_management/user/index.vue new file mode 100644 index 0000000..cab6ddf --- /dev/null +++ b/src/views/enterprise_management/user/index.vue @@ -0,0 +1,291 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + + + 重置 + + + + + + + 导入 + + + 在线学习人员导入 + + + + + + + + + {{ serialNumber(pagination, $index) }} + + + + + + + + + + + {{ row.SHIFTDUTYONENAME }}-{{ row.SHIFTDUTYTWONAME }} + + 全班 + + + + + + 重置密码 + + + 排班表 + + + 编辑 + + + 删除 + + + + + + 新增 + + + + + + + + + + + + + +