|
|
|
@ -40,6 +40,8 @@ |
|
|
|
@click="roleAuthorize()" |
|
|
|
> {{ buttons.roleAuthorization || '岗位授权' }} |
|
|
|
</el-button> |
|
|
|
<el-button type="primary" @click="openDepartmentDialog">部门管理</el-button> |
|
|
|
<el-button type="primary" @click="openPostDialog">岗位管理</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-table |
|
|
|
@ -697,6 +699,110 @@ |
|
|
|
<el-button @click="projectRoleFlag = false" type="primary">取消</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 部门管理弹框 --> |
|
|
|
<el-dialog title="部门管理" :close-on-click-modal="false" v-drag :visible.sync="departmentDialogVisible" width="750px" @open="loadDepartmentList"> |
|
|
|
<el-form :inline="true" size="small" style="margin-bottom:8px;"> |
|
|
|
<el-form-item label="工厂"> |
|
|
|
<el-select v-model="deptQuery.site" placeholder="请选择工厂" style="width:120px" @change="loadDepartmentList"> |
|
|
|
<el-option v-for="s in siteOptions" :key="s.siteID" :label="s.siteName" :value="s.siteID"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="部门编码"> |
|
|
|
<el-input v-model="deptQuery.departmentNo" clearable placeholder="部门编码" style="width:120px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="部门名称"> |
|
|
|
<el-input v-model="deptQuery.departmentName" clearable placeholder="部门名称" style="width:120px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" icon="el-icon-search" @click="loadDepartmentList">查询</el-button> |
|
|
|
<el-button type="primary" icon="el-icon-plus" @click="openAddDept">新增</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-table :data="departmentList" border size="small" height="340"> |
|
|
|
<el-table-column prop="site" label="工厂" align="center" width="80"></el-table-column> |
|
|
|
<el-table-column prop="departmentNo" label="部门编码" align="center" width="140"></el-table-column> |
|
|
|
<el-table-column prop="departmentName" label="部门名称" align="left" min-width="160"></el-table-column> |
|
|
|
<el-table-column label="操作" align="center" width="120" fixed="right"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" @click="openEditDept(scope.row)">编辑</a> |
|
|
|
<a type="text" size="small" style="color:#F56C6C" @click="deleteDept(scope.row)">删除</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<!-- 新增/编辑部门内嵌表单 --> |
|
|
|
<el-dialog :title="deptFormTitle" :close-on-click-modal="false" :visible.sync="deptFormVisible" width="240px" append-to-body> |
|
|
|
<el-form :model="deptForm" :rules="deptFormRules" label-position="top" ref="deptFormRef" label-width="80px"> |
|
|
|
<el-form-item label="工厂"> |
|
|
|
<el-select v-model="deptForm.site" style="width:100%"> |
|
|
|
<el-option v-for="s in siteOptions" :key="s.siteID" :label="s.siteName" :value="s.siteID"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="部门编码" prop="departmentNo"> |
|
|
|
<el-input v-model="deptForm.departmentNo" :disabled="deptForm.isEdit" clearable></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="部门名称" prop="departmentName"> |
|
|
|
<el-input v-model="deptForm.departmentName" clearable></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<span slot="footer"> |
|
|
|
<el-button @click="deptFormVisible = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="saveDeptForm">保存</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 岗位管理弹框 --> |
|
|
|
<el-dialog title="岗位管理" :close-on-click-modal="false" v-drag :visible.sync="postDialogVisible" width="750px" @open="loadPostList"> |
|
|
|
<el-form :inline="true" size="small" style="margin-bottom:8px;"> |
|
|
|
<el-form-item label="工厂"> |
|
|
|
<el-select v-model="postQuery.site" placeholder="请选择工厂" style="width:120px" @change="loadPostList"> |
|
|
|
<el-option v-for="s in siteOptions" :key="s.siteID" :label="s.siteName" :value="s.siteID"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="岗位编码"> |
|
|
|
<el-input v-model="postQuery.postNo" clearable placeholder="岗位编码" style="width:120px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="岗位名称"> |
|
|
|
<el-input v-model="postQuery.postName" clearable placeholder="岗位名称" style="width:120px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button type="primary" icon="el-icon-search" @click="loadPostList">查询</el-button> |
|
|
|
<el-button type="primary" icon="el-icon-plus" @click="openAddPost">新增</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<el-table :data="postList" border size="small" height="340"> |
|
|
|
<el-table-column prop="site" label="工厂" align="center" width="80"></el-table-column> |
|
|
|
<el-table-column prop="postNo" label="岗位编码" align="center" width="140"></el-table-column> |
|
|
|
<el-table-column prop="postName" label="岗位名称" align="left" min-width="160"></el-table-column> |
|
|
|
<el-table-column label="操作" align="center" width="120" fixed="right"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<a type="text" size="small" @click="openEditPost(scope.row)">编辑</a> |
|
|
|
<a type="text" size="small" style="color:#F56C6C" @click="deletePost(scope.row)">删除</a> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<!-- 新增/编辑岗位内嵌表单 --> |
|
|
|
<el-dialog :title="postFormTitle" :close-on-click-modal="false" :visible.sync="postFormVisible" width="240px" append-to-body> |
|
|
|
<el-form :model="postForm" :rules="postFormRules" label-position="top" ref="postFormRef" label-width="80px"> |
|
|
|
<el-form-item label="工厂"> |
|
|
|
<el-select v-model="postForm.site" style="width:100%"> |
|
|
|
<el-option v-for="s in siteOptions" :key="s.siteID" :label="s.siteName" :value="s.siteID"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="岗位编码" prop="postNo"> |
|
|
|
<el-input v-model="postForm.postNo" :disabled="postForm.isEdit" clearable></el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="岗位名称" prop="postName"> |
|
|
|
<el-input v-model="postForm.postName" clearable></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<span slot="footer"> |
|
|
|
<el-button @click="postFormVisible = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="savePostForm">保存</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -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() |
|
|
|
|