|
|
|
@ -736,7 +736,7 @@ |
|
|
|
<el-form :inline="true" label-position="top" :model="operatorData"> |
|
|
|
<el-form-item :label="'所属角色'"> |
|
|
|
<el-select v-model="operatorData.roleId" placeholder="请选择" style="width: 120px" @change="getOperatorList2"> |
|
|
|
<el-option v-for="i in roleList" :key="i.roleId" :label="i.roleName" :value="i.roleId"> |
|
|
|
<el-option v-for="i in operatorRoleList" :key="i.roleId" :label="i.roleName" :value="i.roleId"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
@ -858,6 +858,8 @@ import { |
|
|
|
searchPartAttributeDetails, // 查询物料属性模板 |
|
|
|
getEamPropertiesItemByItemNo, |
|
|
|
getCollectorDataByItem, |
|
|
|
getResponsibleOperatorList, |
|
|
|
getMhmResponsibleRoleList, |
|
|
|
} from '@/api/qc/qc.js' |
|
|
|
import { |
|
|
|
getTableDefaultListLanguage, |
|
|
|
@ -900,6 +902,12 @@ export default { |
|
|
|
} |
|
|
|
return this.tableData.slice(start, end) |
|
|
|
}, |
|
|
|
operatorRoleList() { |
|
|
|
if (this.operatorData.flag === '2' && this.detailData.buNo === '04-MHM') { |
|
|
|
return this.mhmRoleList |
|
|
|
} |
|
|
|
return this.roleList |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
detailData: { |
|
|
|
@ -2239,6 +2247,8 @@ export default { |
|
|
|
authFile: false, |
|
|
|
menuId: this.$route.meta.menuId, |
|
|
|
roleList: [], |
|
|
|
mhmRoleList: [], |
|
|
|
defaultCollaborativeRoleName: 'FAI操作员', |
|
|
|
operatorList: [], |
|
|
|
operatorData: { |
|
|
|
flag: '', |
|
|
|
@ -2529,132 +2539,163 @@ export default { |
|
|
|
getOperatorList() { |
|
|
|
this.operatorData.flag = '1' |
|
|
|
this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo |
|
|
|
const tempDataList = ( |
|
|
|
this.detailData.operator == null ? '' : this.detailData.operator |
|
|
|
).split(';') |
|
|
|
this.$nextTick(() => this.$refs.operatorTable.clearSelection()) |
|
|
|
this.setDefaultCollaborativeRole(() => { |
|
|
|
this.fetchCollaborativeOperatorData(tempDataList, true) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
isMhmResponsibleBu() { |
|
|
|
return this.detailData.buNo === '04-MHM' |
|
|
|
}, |
|
|
|
|
|
|
|
setDefaultCollaborativeRole(callback) { |
|
|
|
const apply = () => { |
|
|
|
if (this.roleList.length > 0) { |
|
|
|
let filterList = this.roleList.filter( |
|
|
|
(item) => item.roleName === '机修人员' |
|
|
|
const roleName = this.isMhmResponsibleBu() ? this.defaultCollaborativeRoleName : '系统管理员' |
|
|
|
const match = this.roleList.find((item) => item.roleName === roleName) |
|
|
|
const roleId = match ? match.roleId : this.roleList[0].roleId |
|
|
|
this.$set( |
|
|
|
this.operatorData, |
|
|
|
'roleId', |
|
|
|
roleId != null && roleId !== '' ? Number(roleId) : '' |
|
|
|
) |
|
|
|
if (filterList.length > 0) { |
|
|
|
this.operatorData.roleId = filterList[0].roleId |
|
|
|
} else { |
|
|
|
this.operatorData.roleId = this.roleList[0].roleId |
|
|
|
this.$set(this.operatorData, 'roleId', '') |
|
|
|
} |
|
|
|
callback && callback() |
|
|
|
} |
|
|
|
if (this.roleList.length > 0) { |
|
|
|
apply() |
|
|
|
} else { |
|
|
|
this.operatorData.roleId = '' |
|
|
|
getUserRoleList().then(({ data }) => { |
|
|
|
this.roleList = data && data.code === 0 ? data.rows || [] : [] |
|
|
|
apply() |
|
|
|
}) |
|
|
|
} |
|
|
|
// 先清空缓存选中 |
|
|
|
this.$nextTick(() => this.$refs.operatorTable.clearSelection()) |
|
|
|
// 拿到选中的人员编号 |
|
|
|
let tempDataList = ( |
|
|
|
this.detailData.operator == null ? '' : this.detailData.operator |
|
|
|
).split(';') |
|
|
|
}, |
|
|
|
|
|
|
|
fetchCollaborativeOperatorData(tempDataList, showDialog) { |
|
|
|
this.operatorData.roleName = '' |
|
|
|
getOperatorList(this.operatorData).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.operatorList = data.rows |
|
|
|
this.operatorList.forEach((val) => { |
|
|
|
// 回显选中 |
|
|
|
if (tempDataList.includes(val.adminID)) { |
|
|
|
this.$nextTick(() => |
|
|
|
this.$refs.operatorTable.toggleRowSelection(val, true) |
|
|
|
) |
|
|
|
} |
|
|
|
}) |
|
|
|
if (showDialog) { |
|
|
|
this.operatorModelFlag = true |
|
|
|
} else { |
|
|
|
} |
|
|
|
} else if (showDialog) { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.operatorList = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取责任人员列表 |
|
|
|
getResponsiblePersonList() { |
|
|
|
this.operatorData.flag = '2' |
|
|
|
this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo |
|
|
|
if (this.roleList.length > 0) { |
|
|
|
let filterList = this.roleList.filter( |
|
|
|
(item) => item.roleName === '机修人员' |
|
|
|
) |
|
|
|
if (filterList.length > 0) { |
|
|
|
this.operatorData.roleId = filterList[0].roleId |
|
|
|
} else { |
|
|
|
this.operatorData.roleId = this.roleList[0].roleId |
|
|
|
loadMhmRoleList(callback) { |
|
|
|
if (this.mhmRoleList.length > 0) { |
|
|
|
callback && callback() |
|
|
|
return |
|
|
|
} |
|
|
|
getMhmResponsibleRoleList({}).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.mhmRoleList = data.rows || [] |
|
|
|
} |
|
|
|
callback && callback() |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
fetchResponsibleOperatorData(tempDataList, showDialog) { |
|
|
|
let request |
|
|
|
if (this.isMhmResponsibleBu()) { |
|
|
|
this.operatorData.roleName = '' |
|
|
|
request = getResponsibleOperatorList(this.operatorData) |
|
|
|
} else { |
|
|
|
this.operatorData.roleId = '' |
|
|
|
request = getOperatorList(this.operatorData) |
|
|
|
} |
|
|
|
// 先清空缓存选中 |
|
|
|
this.$nextTick(() => this.$refs.operatorTable.clearSelection()) |
|
|
|
// 拿到选中的人员编号 |
|
|
|
let tempDataList = ( |
|
|
|
this.detailData.responsiblePerson == null |
|
|
|
? '' |
|
|
|
: this.detailData.responsiblePerson |
|
|
|
).split(';') |
|
|
|
getOperatorList(this.operatorData).then(({ data }) => { |
|
|
|
request.then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.operatorList = data.rows |
|
|
|
this.operatorList.forEach((val) => { |
|
|
|
// 回显选中 |
|
|
|
if (tempDataList.includes(val.adminID)) { |
|
|
|
this.$nextTick(() => |
|
|
|
this.$refs.operatorTable.toggleRowSelection(val, true) |
|
|
|
) |
|
|
|
} |
|
|
|
}) |
|
|
|
if (showDialog) { |
|
|
|
this.operatorModelFlag = true |
|
|
|
} else { |
|
|
|
} |
|
|
|
} else if (showDialog) { |
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.operatorList = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取责任人员列表 |
|
|
|
getResponsiblePersonList() { |
|
|
|
this.operatorData.flag = '2' |
|
|
|
this.operatorData.bu = this.detailData.site + '_' + this.detailData.buNo |
|
|
|
const tempDataList = ( |
|
|
|
this.detailData.responsiblePerson == null |
|
|
|
? '' |
|
|
|
: this.detailData.responsiblePerson |
|
|
|
).split(';') |
|
|
|
this.$nextTick(() => this.$refs.operatorTable.clearSelection()) |
|
|
|
const openDialog = () => { |
|
|
|
this.fetchResponsibleOperatorData(tempDataList, true) |
|
|
|
} |
|
|
|
if (this.isMhmResponsibleBu()) { |
|
|
|
this.loadMhmRoleList(() => { |
|
|
|
this.operatorData.roleId = '' |
|
|
|
openDialog() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
if (this.roleList.length > 0) { |
|
|
|
let filterList = this.roleList.filter( |
|
|
|
(item) => item.roleName === '机修人员' |
|
|
|
) |
|
|
|
if (filterList.length > 0) { |
|
|
|
this.operatorData.roleId = filterList[0].roleId |
|
|
|
} else { |
|
|
|
this.operatorData.roleId = this.roleList[0].roleId |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.operatorData.roleId = '' |
|
|
|
} |
|
|
|
openDialog() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 查询机修人员列表 |
|
|
|
getOperatorList2() { |
|
|
|
if (this.operatorData.flag === '1') { |
|
|
|
// 拿到选中的人员编号 |
|
|
|
let tempDataList = ( |
|
|
|
this.detailData.operator == null ? '' : this.detailData.operator |
|
|
|
).split(';') |
|
|
|
getOperatorList(this.operatorData).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.operatorList = data.rows |
|
|
|
this.operatorList.forEach((val) => { |
|
|
|
// 回显选中的部门 |
|
|
|
if (tempDataList.includes(val.adminID)) { |
|
|
|
this.$nextTick(() => |
|
|
|
this.$refs.operatorTable.toggleRowSelection(val, true) |
|
|
|
) |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.operatorList = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
this.fetchCollaborativeOperatorData(tempDataList, false) |
|
|
|
} else { |
|
|
|
// 拿到选中的人员编号 |
|
|
|
let tempDataList = ( |
|
|
|
this.detailData.responsiblePerson == null |
|
|
|
? '' |
|
|
|
: this.detailData.responsiblePerson |
|
|
|
).split(';') |
|
|
|
getOperatorList(this.operatorData).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.operatorList = data.rows |
|
|
|
this.operatorList.forEach((val) => { |
|
|
|
// 回显选中的部门 |
|
|
|
if (tempDataList.includes(val.adminID)) { |
|
|
|
this.$nextTick(() => |
|
|
|
this.$refs.operatorTable.toggleRowSelection(val, true) |
|
|
|
) |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.operatorList = [] |
|
|
|
} |
|
|
|
}) |
|
|
|
this.fetchResponsibleOperatorData(tempDataList, false) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|