diff --git a/src/App.vue b/src/App.vue index 2ba7568..d39ce61 100644 --- a/src/App.vue +++ b/src/App.vue @@ -476,4 +476,38 @@ ul { ul li { list-style-type: none; } + +h2 { + font-size: 24px; +} + +.h1, +.h2, +.h3, +h1, +h2, +h3 { + margin-top: 20px; + margin-bottom: 10px; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + font-weight: 100; +} + +h3, +h4, +h5 { + margin-top: 5px; + font-weight: 600; +} + +h3 { + font-size: 16px; +} \ No newline at end of file diff --git a/src/api/staff/aStaffApi.js b/src/api/staff/aStaffApi.js new file mode 100644 index 0000000..ec7186e --- /dev/null +++ b/src/api/staff/aStaffApi.js @@ -0,0 +1,132 @@ +import request from '@/utils/request' + +// 查询员工信息 +export function queryStaffInfos(params) { + return new Promise((resolve, reject) => { + request({ + url: '/query.staff.infos', + method: 'get', + params + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 重置员工密码 +export function resetStaffPwd(data) { + return new Promise((resolve, reject) => { + request({ + url: '/user.resetStaffPwd', + method: 'post', + data + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 修改员工信息 +export function modifyStaff(data) { + return new Promise((resolve, reject) => { + request({ + url: '/user.staff.modify', + method: 'post', + data + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 删除员工 +export function deleteStaff(data) { + return new Promise((resolve, reject) => { + request({ + url: '/user.staff.delete', + method: 'post', + data + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 获取组织列表 +export function listOrgs(params) { + return new Promise((resolve, reject) => { + request({ + url: '/org.listOrgs', + method: 'get', + params + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 获取字典数据 +export function getDict(dictName, dictType) { + return new Promise((resolve, reject) => { + request({ + url: '/dict.getDict', + method: 'get', + params: { dictName, dictType } + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 上传文件 +export function uploadImage(data) { + return new Promise((resolve, reject) => { + request({ + url: '/uploadImage', + method: 'post', + data, + headers: { + 'Content-Type': 'multipart/form-data' + } + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '上传文件失败')) + } + }).catch(error => { + reject(error) + }) + }) +} \ No newline at end of file diff --git a/src/api/staff/aStaffDetailApi.js b/src/api/staff/aStaffDetailApi.js new file mode 100644 index 0000000..fad02f5 --- /dev/null +++ b/src/api/staff/aStaffDetailApi.js @@ -0,0 +1,216 @@ +import request from '@/utils/request' + +// 获取员工信息 +export function getStaffInfo(params) { + return new Promise((resolve, reject) => { + request({ + url: '/query.staff.infos', + method: 'get', + params + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 获取员工组织信息 +export function getStaffOrgs(params) { + return new Promise((resolve, reject) => { + request({ + url: '/user.listStaffOrgs', + method: 'get', + params + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 获取员工角色信息 +export function getStaffRoles(params) { + return new Promise((resolve, reject) => { + request({ + url: '/user.listStaffRoles', + method: 'get', + params + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 获取员工权限信息 +export function getStaffPrivileges(params) { + return new Promise((resolve, reject) => { + request({ + url: '/query.user.privilege', + method: 'get', + params + }).then(response => { + const res = response.data + + resolve(res) + + }).catch(error => { + reject(error) + }) + }) +} + +// 获取员工关联小区 +export function listStaffCommunities(params) { + return new Promise((resolve, reject) => { + request({ + url: '/role.listAStaffCommunity', + method: 'get', + params + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '获取员工小区失败')) + } + }).catch(error => { + reject(error) + }) + }) +} + +// 重置员工密码 +export function resetStaffPassword(data) { + return new Promise((resolve, reject) => { + request({ + url: '/user.resetStaffPwd', + method: 'post', + data + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '重置密码失败')) + } + }).catch(error => { + reject(error) + }) + }) +} + +// 更新员工信息 +export function updateStaff(data) { + return new Promise((resolve, reject) => { + request({ + url: '/user.staff.modify', + method: 'post', + data + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '更新员工信息失败')) + } + }).catch(error => { + reject(error) + }) + }) +} + +// 获取字典数据 +export function getDict(dictType, dictCd) { + return new Promise((resolve, reject) => { + request({ + url: '/dict/getDict', + method: 'get', + params: { + dictType, + dictCd + } + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '获取字典数据失败')) + } + }).catch(error => { + reject(error) + }) + }) +} + +// 获取待关联小区列表 +export function listWaitStaffCommunities(params) { + return new Promise((resolve, reject) => { + request({ + url: '/role.listWaitAStaffCommunity', + method: 'get', + params + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '获取待关联小区失败')) + } + }).catch(error => { + reject(error) + }) + }) +} + +// 保存员工小区关联 +export function saveStaffCommunity(data) { + return new Promise((resolve, reject) => { + request({ + url: '/role.saveStaffCommunity', + method: 'post', + data + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '保存员工小区失败')) + } + }).catch(error => { + reject(error) + }) + }) +} + +// 删除员工小区关联 +export function deleteStaffCommunity(data) { + return new Promise((resolve, reject) => { + request({ + url: '/role.deleteStaffCommunity', + method: 'post', + data + }).then(response => { + const res = response.data + if (res.code === 0) { + resolve(res) + } else { + reject(new Error(res.msg || '删除员工小区失败')) + } + }).catch(error => { + reject(error) + }) + }) +} \ No newline at end of file diff --git a/src/components/staff/aStaffDetailCommunitys.vue b/src/components/staff/aStaffDetailCommunitys.vue new file mode 100644 index 0000000..760643f --- /dev/null +++ b/src/components/staff/aStaffDetailCommunitys.vue @@ -0,0 +1,119 @@ + + + + diff --git a/src/components/staff/addAStaffCommunity.vue b/src/components/staff/addAStaffCommunity.vue new file mode 100644 index 0000000..4908f2e --- /dev/null +++ b/src/components/staff/addAStaffCommunity.vue @@ -0,0 +1,138 @@ + + + + diff --git a/src/components/staff/deleteAStaffCommunity.vue b/src/components/staff/deleteAStaffCommunity.vue new file mode 100644 index 0000000..9538b28 --- /dev/null +++ b/src/components/staff/deleteAStaffCommunity.vue @@ -0,0 +1,73 @@ + + + + + +{ + "en": { + "deleteAStaffCommunity": { + "confirmOperation": "Confirm Your Operation", + "confirmDelete": "Are you sure you want to delete this community?", + "cancel": "Cancel", + "confirm": "Confirm Delete", + "deleteSuccess": "Community deleted successfully", + "deleteError": "Failed to delete community" + } + }, + "zh": { + "deleteAStaffCommunity": { + "confirmOperation": "请确认您的操作", + "confirmDelete": "确定删除隶属小区?", + "cancel": "点错了", + "confirm": "确认删除", + "deleteSuccess": "小区删除成功", + "deleteError": "小区删除失败" + } + } +} + \ No newline at end of file diff --git a/src/components/staff/deleteStaff.vue b/src/components/staff/deleteStaff.vue index 85bd1b6..8ca2cf6 100644 --- a/src/components/staff/deleteStaff.vue +++ b/src/components/staff/deleteStaff.vue @@ -1,60 +1,60 @@ - - \ No newline at end of file +} + diff --git a/src/components/staff/editStaff.vue b/src/components/staff/editStaff.vue index 8e7c0d1..c502646 100644 --- a/src/components/staff/editStaff.vue +++ b/src/components/staff/editStaff.vue @@ -1,191 +1,200 @@ - - \ No newline at end of file +} + diff --git a/src/components/staff/resetStaffPwd.vue b/src/components/staff/resetStaffPwd.vue index 2ffa080..28230c2 100644 --- a/src/components/staff/resetStaffPwd.vue +++ b/src/components/staff/resetStaffPwd.vue @@ -1,66 +1,71 @@ - - \ No newline at end of file +} + diff --git a/src/components/staff/staffDetailOrgPrivilege.vue b/src/components/staff/staffDetailOrgPrivilege.vue new file mode 100644 index 0000000..9028bb4 --- /dev/null +++ b/src/components/staff/staffDetailOrgPrivilege.vue @@ -0,0 +1,158 @@ + + + + diff --git a/src/i18n/index.js b/src/i18n/index.js index a59d50b..6bfbb19 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -112,6 +112,8 @@ import { messages as supplierTypeManageMessages } from '../views/scm/supplierTyp import { messages as supplierManageMessages } from '../views/scm/supplierManageLang' import { messages as supplierCouponMessages } from '../views/scm/supplierCouponLang' import { messages as supplierCouponBuyMessages } from '../views/scm/supplierCouponBuyLang' +import { messages as aStaffMessages } from '../views/staff/aStaffLang' +import { messages as aStaffDetailMessages } from '../views/staff/aStaffDetailLang' Vue.use(VueI18n) @@ -228,6 +230,8 @@ const messages = { ...supplierManageMessages.en, ...supplierCouponMessages.en, ...supplierCouponBuyMessages.en, + ...aStaffMessages.en, + ...aStaffDetailMessages.en, }, zh: { ...loginMessages.zh, @@ -340,6 +344,8 @@ const messages = { ...supplierManageMessages.zh, ...supplierCouponMessages.zh, ...supplierCouponBuyMessages.zh, + ...aStaffMessages.zh, + ...aStaffDetailMessages.zh, } } diff --git a/src/main.js b/src/main.js index 2eb3119..b1e87a8 100644 --- a/src/main.js +++ b/src/main.js @@ -5,11 +5,23 @@ import ElementUI from 'element-ui' import 'element-ui/lib/theme-chalk/index.css' import i18n from './i18n' -Vue.prototype.hasPrivilege = function(privilegeCode) { - // 这里实现你的权限检查逻辑 - // 例如从 Vuex store 或本地存储中获取用户权限列表 - const userPrivileges = [] - return userPrivileges.includes(privilegeCode) +Vue.prototype.hasPrivilege = function(_privaleges) { + // 确保 _privaleges 是数组,如果不是则转换为数组 + const privilegesToCheck = Array.isArray(_privaleges) ? _privaleges : [_privaleges]; + + // 从本地存储获取用户权限 + let userPrivileges = localStorage.getItem('hc_staff_privilege'); + + // 如果存在用户权限,则转换为数组 + if (userPrivileges) { + userPrivileges = userPrivileges.split(','); + } else { + // 如果没有权限数据,直接返回 false + return false; + } + + // 检查用户是否有任一所需权限 + return privilegesToCheck.some(item => userPrivileges.includes(item)); } Vue.prototype.toDoc = function(url) { window.open('http://www.homecommunity.cn/'+url, '_blank') diff --git a/src/router/index.js b/src/router/index.js index bec7722..ad062e2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -542,10 +542,20 @@ const routes = [ component: () => import('@/views/scm/supplierCouponList.vue') }, { - path:'/pages/scm/supplierCouponBuy', - name:'/pages/scm/supplierCouponBuy', + path: '/pages/scm/supplierCouponBuy', + name: '/pages/scm/supplierCouponBuy', component: () => import('@/views/scm/supplierCouponBuyList.vue') - }, + }, + { + path: '/pages/staff/aStaff', + name: '/pages/staff/aStaff', + component: () => import('@/views/staff/aStaffList.vue') + }, + { + path: '/views/staff/aStaffDetail', + name: '/views/staff/aStaffDetail', + component: () => import('@/views/staff/aStaffDetailList.vue') + }, // 其他子路由可以在这里添加 ] }, diff --git a/src/views/scm/supplierCouponBuyLang.js b/src/views/scm/supplierCouponBuyLang.js index 5198cda..38811b7 100644 --- a/src/views/scm/supplierCouponBuyLang.js +++ b/src/views/scm/supplierCouponBuyLang.js @@ -27,9 +27,6 @@ export const messages = { remark: 'Remark' }, fetchError: 'Failed to fetch coupon purchase records' - }, - common: { - search: 'Search' } }, zh: { @@ -60,9 +57,6 @@ export const messages = { remark: '备注' }, fetchError: '获取优惠券购买记录失败' - }, - common: { - search: '查询' } } } \ No newline at end of file diff --git a/src/views/staff/aStaffDetailLang.js b/src/views/staff/aStaffDetailLang.js new file mode 100644 index 0000000..dbcdb48 --- /dev/null +++ b/src/views/staff/aStaffDetailLang.js @@ -0,0 +1,130 @@ +export const messages = { + en: { + aStaffDetailList: { + staffInfo: 'Staff Information', + back: 'Back', + edit: 'Edit', + resetPwd: 'Reset Password', + staffId: 'Staff ID', + userName: 'Name', + idCard: 'ID Card', + tel: 'Phone', + sex: 'Gender', + male: 'Male', + female: 'Female', + address: 'Address', + orgPrivilege: 'Organization Privilege', + community: 'Community', + loadError: 'Failed to load staff information', + resetSuccess: 'Password reset successful', + editSuccess: 'Staff information updated', + addCommunitySuccess: 'Community added successfully', + deleteCommunitySuccess: 'Community removed successfully' + }, + "staffDetailOrgPrivilege": { + "relatedOrg": "Related Organization", + "org": "Organization", + "position": "Position", + "relatedRole": "Related Roles", + "staffPrivilege": "Staff Privileges", + "loadOrgsError": "Failed to load organizations", + "loadRolesError": "Failed to load roles", + "loadPrivilegesError": "Failed to load privileges" + }, + "aStaffDetailCommunitys": { + "relateCommunity": "Relate Community", + "staffName": "Staff Name", + "staffId": "Staff ID", + "communityId": "Community ID", + "communityName": "Community Name", + "operation": "Operation", + "delete": "Delete", + "loadError": "Failed to load community data" + }, + "addAStaffCommunity": { + "community": "Community", + "searchPlaceholder": "Enter community name", + "communityId": "Community ID", + "communityName": "Community Name", + "communityAddress": "Community Address", + "cancel": "Cancel", + "submit": "Submit", + "loadError": "Failed to load community data", + "selectCommunity": "Please select at least one community", + "addSuccess": "Community added successfully", + "addError": "Failed to add community" + }, + "deleteAStaffCommunity": { + "confirmOperation": "Confirm Your Operation", + "confirmDelete": "Are you sure you want to delete this community?", + "cancel": "Cancel", + "confirm": "Confirm Delete", + "deleteSuccess": "Community deleted successfully", + "deleteError": "Failed to delete community" + } + }, + zh: { + aStaffDetailList: { + staffInfo: '员工信息', + back: '返回', + edit: '修改', + resetPwd: '重置密码', + staffId: '编号', + userName: '名称', + idCard: '身份证', + tel: '手机', + sex: '性别', + male: '男', + female: '女', + address: '住址', + orgPrivilege: '组织权限', + community: '小区', + loadError: '加载员工信息失败', + resetSuccess: '密码重置成功', + editSuccess: '员工信息修改成功', + addCommunitySuccess: '小区关联成功', + deleteCommunitySuccess: '小区删除成功' + }, + "staffDetailOrgPrivilege": { + "relatedOrg": "关联组织", + "org": "组织", + "position": "岗位", + "relatedRole": "关联角色", + "staffPrivilege": "员工权限", + "loadOrgsError": "加载组织失败", + "loadRolesError": "加载角色失败", + "loadPrivilegesError": "加载权限失败" + }, + "aStaffDetailCommunitys": { + "relateCommunity": "关联小区", + "staffName": "员工名称", + "staffId": "员工编号", + "communityId": "小区编号", + "communityName": "小区名称", + "operation": "操作", + "delete": "删除", + "loadError": "加载小区数据失败" + }, + "addAStaffCommunity": { + "community": "小区", + "searchPlaceholder": "输入小区名称", + "communityId": "小区ID", + "communityName": "小区名称", + "communityAddress": "小区地址", + "cancel": "取消", + "submit": "提交", + "loadError": "加载小区数据失败", + "selectCommunity": "请至少选择一个小区", + "addSuccess": "小区关联成功", + "addError": "小区关联失败" + }, + "deleteAStaffCommunity": { + "confirmOperation": "请确认您的操作", + "confirmDelete": "确定删除隶属小区?", + "cancel": "点错了", + "confirm": "确认删除", + "deleteSuccess": "小区删除成功", + "deleteError": "小区删除失败" + } + } +} \ No newline at end of file diff --git a/src/views/staff/aStaffDetailList.vue b/src/views/staff/aStaffDetailList.vue new file mode 100644 index 0000000..7f4fbcc --- /dev/null +++ b/src/views/staff/aStaffDetailList.vue @@ -0,0 +1,203 @@ + + + + + \ No newline at end of file diff --git a/src/views/staff/aStaffLang.js b/src/views/staff/aStaffLang.js new file mode 100644 index 0000000..723a644 --- /dev/null +++ b/src/views/staff/aStaffLang.js @@ -0,0 +1,86 @@ +export const messages = { + en: { + staff: { + searchConditions: 'Search Conditions', + staffIdPlaceholder: 'Enter Staff ID', + staffNamePlaceholder: 'Enter Staff Name', + phonePlaceholder: 'Enter Phone Number', + search: 'Search', + staffInfo: 'Staff Information', + add: 'Add', + staffId: 'Staff ID', + name: 'Name', + phone: 'Phone', + relatedOrg: 'Related Organization', + position: 'Position', + idCard: 'ID Card', + address: 'Address', + gender: 'Gender', + male: 'Male', + female: 'Female', + operations: 'Operations', + edit: 'Edit', + resetPwd: 'Reset Password', + delete: 'Delete', + details: 'Details', + tip: 'Tip: The default password for new employees is 123456. After assigning roles and permissions to the community and associating roles with employees, they can log in.', + confirmOperation: 'Please confirm your operation', + confirmReset: 'Are you sure to reset the password?', + confirmResetPassword: 'Are you sure to reset the password?', + cancel: 'Cancel', + confirmResetBtn: 'Confirm Reset', + editStaff: 'Edit Staff', + requiredName: 'Required, enter staff name', + requiredPosition: 'Required, select position', + optionalIdCard: 'Optional, enter ID card', + requiredPhone: 'Required, enter phone number', + requiredGender: 'Required, select gender', + requiredAddress: 'Required, enter address', + uploadPhoto: 'Upload Photo', + confirmDelete: 'Are you sure to delete? Before deleting an employee, please confirm that the employee has completed the relevant approval process. After deletion, the relevant process cannot continue. Please operate with caution!', + confirmDeleteBtn: 'Confirm Delete' + } + }, + zh: { + staff: { + searchConditions: '查询条件', + staffIdPlaceholder: '请输入员工ID', + staffNamePlaceholder: '请输入员工名称', + phonePlaceholder: '请输入手机号', + search: '查询', + staffInfo: '员工信息', + add: '添加', + staffId: '员工编号', + name: '名称', + phone: '手机号', + relatedOrg: '关联组织', + position: '岗位', + idCard: '身份证', + address: '地址', + gender: '性别', + male: '男', + female: '女', + operations: '操作', + edit: '修改', + resetPwd: '重置密码', + delete: '删除', + details: '详情', + tip: '温馨提示:新添加员工默认密码为123456,角色权限分配小区并且角色关联员工后可登录', + confirmOperation: '请确认您的操作', + confirmReset: '确认是否重置密码', + confirmResetPassword: '确认是否重置密码', + cancel: '点错了', + confirmResetBtn: '确认重置', + editStaff: '修改员工', + requiredName: '必填,请填写员工名称', + requiredPosition: '必填,请选择岗位', + optionalIdCard: '可选,请填写身份证', + requiredPhone: '必填,请填写手机号码', + requiredGender: '必填,请选择员工性别', + requiredAddress: '必填,请填写家庭住址', + uploadPhoto: '上传照片', + confirmDelete: '确认是否删除,删除员工前请确认员工已完成相关审批流程,删除后相关流程将无法继续进行,请慎重操作!', + confirmDeleteBtn: '确认删除' + } + } +} \ No newline at end of file diff --git a/src/views/staff/aStaffList.vue b/src/views/staff/aStaffList.vue new file mode 100644 index 0000000..c6b2ea1 --- /dev/null +++ b/src/views/staff/aStaffList.vue @@ -0,0 +1,209 @@ + + + + + \ No newline at end of file