田源
2024-03-18 58dea2b63641f930bad79a8b5a4c66b860967b88
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
  <!--表格基础按钮-->
  <div v-if="type === 'table'">
    <!--top展示表格上方区域 menu展示表格操作栏区域 -->
    <el-button v-for="item in basicButtonList.top"
               v-if="LocationType === 'top'"
               :key="item.oid" :icon="item.icon"
               :type="item.paramVOS.buttonType || 'primary'" plain
               size="small"
               @click="buttonClick(item)">
      {{ item.name }}
    </el-button>
 
    <el-button v-for="item in basicButtonList.menu"
               v-if="LocationType === 'menu'"
               :key="item.oid" :icon="item.paramVOS.icon"
               :type="item.paramVOS.buttonType || 'primary'" plain
               size="small"
               @click="buttonClick(item,scope)">
      {{ item.name }}
    </el-button>
<!--    <dynamic-form :title="formName" :visible.sync="visible"></dynamic-form>-->
  </div>
</template>
 
<script>
import func from "@/util/func";
import {validatenull} from "@/util/validate";
 
export default {
  name: "dynamic-button",
  props: {
    type: {
      type: String
    },
    LocationType: {
      type: String,
    },
    scope:{
      type:Object,
    },
    butttonList:{
      type:Array
    }
  },
  data() {
    return {
      visible: false,
      formName: '',
    }
  },
  computed: {
    basicButtonList() {
      // const basicColumn = this.butttonList.filter(item => item.id !== 'launchworkflow'); // 首先过滤出来基础表单事件的按钮
      const basicColumn = this.butttonList;
      if (this.type === 'table') {
        const top = basicColumn.filter(item => item.paramVOS.location === 'top' || func.isEmpty(item.paramVOS.location)); // 过滤出来表格上面区域展示的按钮
        const menu = basicColumn.filter(item => item.paramVOS.location === 'menu'); // 过滤出来操作栏展示的按钮
        return {
          top: top,
          menu: menu
        }
      }
    }
  },
  methods: {
    buttonClick(item) {
      this.$emit('buttonClick',this.scope,item)
    }
  }
}
</script>
 
<style scoped>
 
</style>