puzhibing
6 天以前 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06
culture/src/views/pedigree-chart/index.vue
@@ -81,7 +81,9 @@
        <el-table-column label="操作" width="250">
          <template slot-scope="scope">
            <el-button style="margin-right: 10px" type="text" @click="handleDetail(scope.row)">详情</el-button>
            <el-button style="margin-right: 10px" type="text" v-if="Number(roleType) == 1" @click="handleDetail(scope.row)">编辑</el-button>
            <el-button style="margin-right: 10px" type="text"
              v-if="canEdit(scope.row)"
              @click="handleEdit(scope.row)">编辑</el-button>
            <!-- 菌种超级管理员 -->
            <el-button type="text" v-if="Number(roleType) == 1" @click="handleDelete(scope.row)">删除</el-button>
          </template>
@@ -113,6 +115,7 @@
      tableData: [],
      total: 0,
      roleType: JSON.parse(sessionStorage.getItem('userInfo')).roleType || 1,  // 1.超级管理员 2.审批人 3.工程师 4.实验员
      currentUserName: JSON.parse(sessionStorage.getItem('userInfo')).nickName || '',
      // 模拟数据
      mockListData: [],
      mockDraftData: [],
@@ -121,10 +124,8 @@
      currentApprovalData: null,
    };
  },
  created() {
  activated() {
    this.getTableData();
  },
  mounted() {
    this.fetchTeamList()
  },
  methods: {
@@ -223,7 +224,14 @@
      // 实现撤销审批逻辑
    },
    handleEdit(row) {
      // 实现编辑逻辑
      const path = row.generationType == 1 ? '/strain/add-pedigree' : '/strain/add-progenitor';
      this.$router.push({ path, query: { id: row.id, mode: 'edit', status: row.status } });
    },
    canEdit(row) {
      if (Number(this.roleType) === 1) return true;
      return Number(this.roleType) === 3
        && Number(row.status) === 1
        && row.createBy === this.currentUserName;
    },
    handleDelete(row) {
      // 实现删除逻辑