|
|
@@ -154,7 +154,10 @@
|
|
|
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
|
- <el-button @click="onGrant" v-if="isRegister && info.status != 3" v-hasPermi="['core:safetycheck:grant']"
|
|
|
+ <el-button
|
|
|
+ @click="onGrant"
|
|
|
+ v-if="showGrantBtn"
|
|
|
+ v-hasPermi="['core:safetycheck:grant']"
|
|
|
>授权</el-button
|
|
|
>
|
|
|
<el-button @click="onSave" v-if="showSaveBtn">保存</el-button>
|
|
|
@@ -182,7 +185,7 @@ import SelectPoint from "../../ruleManager/dialog.select.point.vue";
|
|
|
import imgUpload from "@/components/ImageUpload/index.vue";
|
|
|
import UserSelector from "@/components/userSelector/index.vue";
|
|
|
import { getLabel } from "@/views/commonOption.js";
|
|
|
-import {hasPermission} from '@/directive/permission/hasPermiEx.js'
|
|
|
+import { hasPermission } from "@/directive/permission/hasPermiEx.js";
|
|
|
export default {
|
|
|
name: "safetyCheckRegister",
|
|
|
data() {
|
|
|
@@ -205,9 +208,23 @@ export default {
|
|
|
return r;
|
|
|
},
|
|
|
|
|
|
- showSaveBtn(){
|
|
|
- return this.isRegister() && this.info.status!=3 && (hasPermission(['core:safetycheck:register']) || this.info.grantUserId==this.userId)
|
|
|
- }
|
|
|
+ showSaveBtn() {
|
|
|
+ return (
|
|
|
+ this.isRegister() &&
|
|
|
+ this.info.status != 3 &&
|
|
|
+ (hasPermission(["core:safetycheck:register"]) ||
|
|
|
+ this.info.grantUserId == this.userId)
|
|
|
+ );
|
|
|
+ },
|
|
|
+ showGrantBtn() {
|
|
|
+ let userRoleIds = this.roleList.map((r) => r.roleId);
|
|
|
+ let taskRoleIds = this.info.checkRoles.map((r) => r.id);
|
|
|
+ return (
|
|
|
+ this.isRegister() &&
|
|
|
+ this.info.status != 3 &&
|
|
|
+ userRoleIds.find((ur) => taskRoleIds.includes(ur))
|
|
|
+ );
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
let id = this.$route.params.taskId;
|
|
|
@@ -230,7 +247,7 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- let userRoleIds = this.roleList.map((r) => r.roleId + "");
|
|
|
+ let userRoleIds = this.roleList.map((r) => r.roleId);
|
|
|
let taskRoleIds = r.data.checkRoles.map((r) => r.id);
|
|
|
|
|
|
if (
|