Selaa lähdekoodia

调整安全检查

luojun 2 vuotta sitten
vanhempi
commit
19f651ceb2
1 muutettua tiedostoa jossa 38 lisäystä ja 9 poistoa
  1. 38 9
      src/views/check/index.vue

+ 38 - 9
src/views/check/index.vue

@@ -283,6 +283,7 @@
           <el-table-column label="操作">
             <template slot-scope="r">
               <el-button
+              v-if="eqOrg(r.row)"
                 size="mini"
                 type="text"
                 icon="el-icon-edit-outline"
@@ -291,6 +292,7 @@
                 >修改</el-button
               >
               <el-button
+              v-if="eqOrg2(r.row)"
                 size="mini"
                 type="text"
                 icon="el-icon-delete"
@@ -340,7 +342,7 @@
 <script>
 import DialogDistribute from "./distribute.vue";
 import OrgTree from "@/components/orgTree";
-import { mapState, mapMutations } from "vuex";
+import { mapState, mapMutations,mapGetters } from "vuex";
 import DialogEdit from "./dialog.edit";
 import * as api from "@/api/safetycheck/plan";
 import { statusOptions, getLabel } from "@/views/commonOption";
@@ -410,9 +412,28 @@ export default {
   watch: {},
   computed: {
     ...mapState([]),
+    ...mapGetters(["orgId", "orgName"]),
   },
   methods: {
     ...mapMutations([]),
+    
+    //判断是否跟当前用户同机构
+    eqOrg(row) {
+      // console.log(row.planCreateOrgId,"row.planCreateOrgId");
+      // console.log(this.orgId,"this.orgId");
+      if (row != null && row != undefined && row.planOfOrgId == this.orgId) {
+        return true;
+      }
+      return true;
+    },
+    eqOrg2(row) {
+      // console.log(row.planCreateOrgId,"row.planCreateOrgId");
+      // console.log(this.orgId,"this.orgId");
+      if (row != null && row != undefined && row.planCreateOrgId == this.orgId&& row.planOfOrgId == this.orgId) {
+        return true;
+      }
+      return false;
+    },
         //已完成下发的计划不显示下发按钮
     checkCanPublish(row) {
       // console.log(row.planOfOrgType == "1","row.planOfOrgType")
@@ -495,18 +516,26 @@ export default {
       this.$refs.dialogDistribute.show(row);
     },
     async onDel(id, name) {
+
       this.$modal
         .confirm('是否确认删除名称为"' + name + '"的数据项?')
-        .then(function () {
-          return api.delelte(id);
-        })
         .then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
+          // 用户点击了确认按钮
+          console.log("执行操作...");
+          this.loading = true;
+          api.delelte(id).then(() => {
+            this.getList();
+            this.loading = false;
+            this.$modal.msgSuccess("删除成功");
+            
+          }).catch(()=>{
+            this.loading = false;
+          });
         })
-        .catch(() => {});
-      // await api.delelte(id);
-      // this.getList();
+        .catch(() => {
+          // 用户点击了取消按钮
+          console.log("取消操作...");
+        });
     },
     // 多选框选中数据
     handleSelectionChange(selection) {