|
@@ -216,6 +216,61 @@ function getLoginPower() {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+// 根据当前登录人员判断查询结果和权限
|
|
|
+function getLoginPermission() {
|
|
|
+ technicianController.value = false
|
|
|
+ qualityController.value = false
|
|
|
+ getResultList()
|
|
|
+ if (useUserStore().user.userId == 1) {
|
|
|
+ queryParams.value.consultDepartment = ""
|
|
|
+ technicianController.value = true
|
|
|
+ qualityController.value = true
|
|
|
+ editable.value = true
|
|
|
+ getList()
|
|
|
+ } else {
|
|
|
+ // 判断是否有查看全部的权限
|
|
|
+ getListByUserId({ userId: useUserStore().user.userId }).then(res => {
|
|
|
+ let roleNames = res.data.map(item => item.roleKey)
|
|
|
+ technicianController.value = false
|
|
|
+ qualityController.value = false
|
|
|
+ console.log(roleNames)
|
|
|
+ let index = roleNames.findIndex(item => item == 'technicanResponser')
|
|
|
+ if (auth.hasPermi('business:consult:searchAll')) {
|
|
|
+ // 是否有一个只能查看全部的权限
|
|
|
+ technicianController.value = true
|
|
|
+ qualityController.value = true
|
|
|
+ editable.value = false
|
|
|
+ queryParams.value.consultDepartment = "-1"
|
|
|
+ } else {
|
|
|
+ if (index >= 0 && res.data[index].perms.findIndex(item => item == 'business:consult:list') > -1) {
|
|
|
+ queryParams.value.flag = true
|
|
|
+ } else {
|
|
|
+ queryParams.value.flag = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 判断是否有技术权限
|
|
|
+ // 判断是否有品管权限
|
|
|
+ if (roleNames.includes('technician')) {
|
|
|
+ editable.value = true
|
|
|
+ technicianController.value = true
|
|
|
+ queryParams.value.consultDepartment = "0"
|
|
|
+ }
|
|
|
+ if (roleNames.includes('quality_control_officer')) {
|
|
|
+ editable.value = true
|
|
|
+ qualityController.value = true
|
|
|
+ queryParams.value.consultDepartment = "1"
|
|
|
+ }
|
|
|
+ if (roleNames.includes("technician") && roleNames.includes("quality_control_officer")) {
|
|
|
+ editable.value = true
|
|
|
+ queryParams.value.consultDepartment = "-1"
|
|
|
+ }
|
|
|
+ // 查询
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
function handleChangeStatus(data) {
|
|
|
console.log(data)
|
|
|
if (data.consultResultId != 0) {
|
|
@@ -302,6 +357,6 @@ const handleSetStatus = (type, data) => {
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- getLoginPower();
|
|
|
+ getLoginPermission();
|
|
|
});
|
|
|
</script>
|