diff --git a/src/api/base/site.js b/src/api/base/site.js
index 8fe0161..83fd788 100644
--- a/src/api/base/site.js
+++ b/src/api/base/site.js
@@ -69,8 +69,14 @@ export const getUserAccessProjectInfoList = data => createAPI(`/base/getUserAcce
export const getSiteList = data => createAPI(`/base/getSiteList`,'post',data)
export const getDepartmentList = data => createAPI(`/base/getDepartmentList`,'post',data)
+export const saveDepartment = data => createAPI(`/base/saveDepartment`,'post',data)
+export const updateDepartment = data => createAPI(`/base/updateDepartment`,'post',data)
+export const deleteDepartment = data => createAPI(`/base/deleteDepartment`,'post',data)
export const getPostList = data => createAPI(`/base/getPostList`,'post',data)
+export const savePost = data => createAPI(`/base/savePost`,'post',data)
+export const updatePost = data => createAPI(`/base/updatePost`,'post',data)
+export const deletePost = data => createAPI(`/base/deletePost`,'post',data)
export const searchAccessRoleList = data => createAPI(`/base/searchAccessRoleList`,'post',data)
diff --git a/src/views/modules/sys/user.vue b/src/views/modules/sys/user.vue
index 6261e42..e1dc0dd 100644
--- a/src/views/modules/sys/user.vue
+++ b/src/views/modules/sys/user.vue
@@ -40,6 +40,8 @@
@click="roleAuthorize()"
> {{ buttons.roleAuthorization || '岗位授权' }}
+ 部门管理
+ 岗位管理
取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 新增
+
+
+
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 保存
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 新增
+
+
+
+
+
+
+
+
+ 编辑
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 保存
+
+
+
@@ -721,8 +827,9 @@ import {
} from "@/api/sysLanguage.js"
import {
getBUList,
- getDepartmentList,
- getPostList,
+ getDepartmentList, saveDepartment, updateDepartment, deleteDepartment,
+ getPostList, savePost, updatePost, deletePost,
+ getSiteDataActive,
saveAccessSiteForSite,
searchAccessSiteListBySite
} from '../../../api/base/site'
@@ -896,6 +1003,29 @@ export default {
siteList: [],
selectSitList: [],
selectUser: {},
+ siteOptions: [],
+ // 部门管理
+ departmentDialogVisible: false,
+ deptQuery: { site: '', departmentNo: '', departmentName: '' },
+ departmentList: [],
+ deptFormVisible: false,
+ deptFormTitle: '新增部门',
+ deptForm: { site: '', departmentNo: '', departmentName: '', isEdit: false },
+ deptFormRules: {
+ departmentNo: [{ required: true, message: '请输入部门编码', trigger: 'blur' }],
+ departmentName: [{ required: true, message: '请输入部门名称', trigger: 'blur' }],
+ },
+ // 岗位管理
+ postDialogVisible: false,
+ postQuery: { site: '', postNo: '', postName: '' },
+ postList: [],
+ postFormVisible: false,
+ postFormTitle: '新增岗位',
+ postForm: { site: '', postNo: '', postName: '', isEdit: false },
+ postFormRules: {
+ postNo: [{ required: true, message: '请输入岗位编码', trigger: 'blur' }],
+ postName: [{ required: true, message: '请输入岗位名称', trigger: 'blur' }],
+ },
pageIndex: 1,
pageSize: 20,
totalPage: 0,
@@ -1556,10 +1686,10 @@ export default {
},
// 新增 / 修改
addOrUpdateHandle(id) {
+ this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
- this.addOrUpdateVisible = true
},
// 删除
deleteHandle(row) {
@@ -1636,6 +1766,136 @@ export default {
return { 'background-color': '#E8F7F6', cursor: 'pointer' };
}
},
+
+ // ===== 部门管理 =====
+ openDepartmentDialog () {
+ this.deptQuery = { site: this.$store.state.user.site, departmentNo: '', departmentName: '' }
+ this.departmentDialogVisible = true
+ this.loadSiteOptions()
+ },
+ loadDepartmentList () {
+ getDepartmentList({ site: this.deptQuery.site }).then(({ data }) => {
+ if (data && data.code === 0) {
+ let list = data.rows || []
+ if (this.deptQuery.departmentNo) {
+ list = list.filter(r => r.departmentNo && r.departmentNo.toLowerCase().includes(this.deptQuery.departmentNo.toLowerCase()))
+ }
+ if (this.deptQuery.departmentName) {
+ list = list.filter(r => r.departmentName && r.departmentName.toLowerCase().includes(this.deptQuery.departmentName.toLowerCase()))
+ }
+ this.departmentList = list
+ }
+ })
+ },
+ openAddDept () {
+ this.deptFormTitle = '新增部门'
+ this.deptForm = { site: this.deptQuery.site || this.$store.state.user.site, departmentNo: '', departmentName: '', isEdit: false }
+ this.deptFormVisible = true
+ this.$nextTick(() => { this.$refs.deptFormRef && this.$refs.deptFormRef.clearValidate() })
+ },
+ openEditDept (row) {
+ this.deptFormTitle = '编辑部门'
+ this.deptForm = { site: row.site, departmentNo: row.departmentNo, departmentName: row.departmentName, isEdit: true }
+ this.deptFormVisible = true
+ this.$nextTick(() => { this.$refs.deptFormRef && this.$refs.deptFormRef.clearValidate() })
+ },
+ saveDeptForm () {
+ this.$refs.deptFormRef.validate(valid => {
+ if (!valid) return
+ const api = this.deptForm.isEdit ? updateDepartment : saveDepartment
+ api({ site: this.deptForm.site, departmentNo: this.deptForm.departmentNo, departmentName: this.deptForm.departmentName }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success('操作成功')
+ this.deptFormVisible = false
+ this.loadDepartmentList()
+ } else {
+ this.$message.error(data.msg || '操作失败')
+ }
+ })
+ })
+ },
+ deleteDept (row) {
+ this.$confirm(`确认删除部门【${row.departmentName}】?`, '删除确认', { type: 'warning' }).then(() => {
+ deleteDepartment({ site: row.site, departmentNo: row.departmentNo }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success('删除成功')
+ this.loadDepartmentList()
+ } else {
+ this.$message.error(data.msg || '删除失败')
+ }
+ })
+ }).catch(() => {})
+ },
+
+ // ===== 岗位管理 =====
+ openPostDialog () {
+ this.postQuery = { site: this.$store.state.user.site, postNo: '', postName: '' }
+ this.postDialogVisible = true
+ this.loadSiteOptions()
+ },
+ loadPostList () {
+ getPostList({ site: this.postQuery.site }).then(({ data }) => {
+ if (data && data.code === 0) {
+ let list = data.rows || []
+ if (this.postQuery.postNo) {
+ list = list.filter(r => r.postNo && r.postNo.toLowerCase().includes(this.postQuery.postNo.toLowerCase()))
+ }
+ if (this.postQuery.postName) {
+ list = list.filter(r => r.postName && r.postName.toLowerCase().includes(this.postQuery.postName.toLowerCase()))
+ }
+ this.postList = list
+ }
+ })
+ },
+ openAddPost () {
+ this.postFormTitle = '新增岗位'
+ this.postForm = { site: this.postQuery.site || this.$store.state.user.site, postNo: '', postName: '', isEdit: false }
+ this.postFormVisible = true
+ this.$nextTick(() => { this.$refs.postFormRef && this.$refs.postFormRef.clearValidate() })
+ },
+ openEditPost (row) {
+ this.postFormTitle = '编辑岗位'
+ this.postForm = { site: row.site, postNo: row.postNo, postName: row.postName, isEdit: true }
+ this.postFormVisible = true
+ this.$nextTick(() => { this.$refs.postFormRef && this.$refs.postFormRef.clearValidate() })
+ },
+ savePostForm () {
+ this.$refs.postFormRef.validate(valid => {
+ if (!valid) return
+ const api = this.postForm.isEdit ? updatePost : savePost
+ api({ site: this.postForm.site, postNo: this.postForm.postNo, postName: this.postForm.postName }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success('操作成功')
+ this.postFormVisible = false
+ this.loadPostList()
+ } else {
+ this.$message.error(data.msg || '操作失败')
+ }
+ })
+ })
+ },
+ deletePost (row) {
+ this.$confirm(`确认删除岗位【${row.postName}】?`, '删除确认', { type: 'warning' }).then(() => {
+ deletePost({ site: row.site, postNo: row.postNo }).then(({ data }) => {
+ if (data && data.code === 0) {
+ this.$message.success('删除成功')
+ this.loadPostList()
+ } else {
+ this.$message.error(data.msg || '删除失败')
+ }
+ })
+ }).catch(() => {})
+ },
+
+ // 加载工厂选项
+ loadSiteOptions () {
+ if (this.siteOptions.length > 0) return
+ getSiteDataActive({}).then(({ data }) => {
+ if (data && data.success) {
+ this.siteOptions = data.rows || []
+ }
+ })
+ },
},
created() {
this.getFunctionButtonList()