jinlin
2024-02-26 6f0714843341b168573ad0272069f7af2d3d2b87
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<template>
  <el-table-column fixed="right" :label="$t('handle')" header-align="center" align="center" :width="width" v-slot="{ row }">
    <slot :row="row"></slot>
    <zt-table-button v-if="isCanView(row)" type="default" @click="table.viewHandle(row)">{{ $t('view') }}</zt-table-button>
  <zt-table-button v-if="isCanEidt(row) && $hasPermission(editPerm) " type="primary" @click="table.editHandle(row)">{{ $t('update') }}</zt-table-button>
  <zt-table-button v-if="isCanDelete(row) && $hasPermission(deletePerm)" type="danger" @click="table.deleteHandle(row)">{{ $t('delete') }}</zt-table-button>
  </el-table-column>
</template>
<script>
  export default {
    name: 'ZtTableColumnHandle',
    props: {
      table: Object,
      width: {
        type: String,
        default: '110'
      },
      editPerm: String,
      deletePerm: String,
      hasView: {
        type: [Boolean, Function],
        default: true
      },
      hasEdit: {
        type: [Boolean, Function],
        default: true
      },
      hasDelete: {
        type: [Boolean, Function],
        default: true
      }
    },
    data() {
      return {
      }
    },
    computed: {
    },
    methods: {
      isCanView(row) {
        return typeof this.hasView === 'boolean' ? this.hasView : this.hasView(row)
      },
      isCanEidt(row) {
        if(row.flowInfo && row.flowInfo.bizId){
          return false
        }else {
          return typeof this.hasEdit === 'boolean' ? this.hasEdit : this.hasEdit(row)
        }
      },
      isCanDelete(row) {
        if(row.flowInfo && row.flowInfo.bizId){
          return false
        }else {
          return typeof this.hasDelete === 'boolean' ? this.hasDelete : this.hasDelete(row)
        }
      }
    }
  }
</script>
<style lang="scss" scoped>
 
</style>