wangting
2025-01-16 18c43123b51a1688ab4ae01fe3d171c7d92e619b
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<template>
  <!--文件列表-->
  <div style="height: 100%">
    <avue-crud ref="dataTable"
               v-model="form"
               :data="tableList"
               :option="option"
               :page.sync="pageType"
               :table-loading="loading"
               @row-click="rowClickChange"
               @selection-change="selectChange">
      <!--top区域按钮-->
      <template slot="menuLeft" slot-scope="scope">
        <dynamic-button :butttonList="componentVO.buttons" :selectList="selectList" LocationType="top"
                        type="table"></dynamic-button>
      </template>
 
      <!--menu区域按钮-->
      <template slot="menu" slot-scope="scope">
        <dynamic-button :butttonList="componentVO.buttons" :scope="scope" :selectList="selectList" LocationType="menu"
                        type="table"></dynamic-button>
      </template>
    </avue-crud>
  </div>
</template>
 
<script>
import {validatenull} from "@/util/validate";
 
export default {
  name: "list",
  props: {
    componentVO: {
      type: Object,
      default: {}
    },
    inDialog: {
      type: Boolean,
      default: false
    },
    areasName: {
      type: String,
      default: ''//westArea导航区
    },
    sourceData: {
      //菜单源数据或者弹窗时按钮所属区域的上一区域选中数据
      type: Object,
      default: {}
    },
    paramVOS: {
      type: Object,
      default: {}
    },
    isShow: {
      //所在区域是否已显示,针对tab和collapse
      type: Boolean,
      default: true
    },
    dataStore: {
      //弹窗时按钮所属区域选中数据
      type: Array,
      default: []
    }
  },
  data() {
    return {
      parentHeight: '100%',//当前组件根节点元素高度
      form: {},
      loading: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 50,
      },
      simplePage: {
        currentPage: 1,
        total: 100,
        pagerCount: 4,
        layout: "prev, pager, next"
      },
      //表格数据
      tableList: [],
      option: {
        index: true,
        addBtn: false,
        editBtn: false,
        delBtn: true,
        selection: true,
        tip: false,
        height: '100%',
        calcHeight: 15,
        indexFixed: false,
        menuFixed: false,
        searchMenuSpan: 12,
        searchShow: false,
        column: [{
          field:'name',
          title:'文件名称',
          width:250
        },{
          field:'fileSize',
          title:'大小',
          width:80,
          templet:function(d){
            if(!d.fileSize || d.fileSize == null || d.fileSize*1 == 0 || isNaN(d.fileSize*1) ){
              return "未知大小";
            }else{
              //原始大小是B
              var filesize = d.fileSize*1;
              if(filesize>1024*1024*1024*1024){
                return parseInt(filesize/(1024*1024*1024*1024)) + "TB";
              }else if(filesize> 1024*1024*1024){
                return parseInt(filesize/(1024*1024*1024)) + "GB";
              }else if(filesize> 1024*1024){
                return parseInt(filesize/(1024*1024)) + "MB";
              }else if(filesize> 1024){
                return parseInt(filesize/1024) + "KB";
              }else {
                return filesize + "B";
              }
            }
          }
        },{
          field:'secretGradeText',
          title:'密级',
          hidden:(!configData.controlSecret),
          width:60
        },{
          field:'fileDocClassifyName',
          title:'文档类型',
          width:160
        },{
          field:'creator',
          title:'上传人/时间',
          width:210,
          templet:function(d){
            return d.creator + "(" + $webUtil.formateDateTimeNoSecond(d.createTime) + ")";
          }
        }],
      },
      selectList: [],
    }
  },
  computed: {
    pageType() {
      return this.areasName === 'westArea' ? this.simplePage : this.page;
    }
  },
  methods: {
    rowClickChange(row) {
      this.$refs.dataTable.toggleRowSelection(row);
    },
    selectChange(row) {
      this.selectList = row;
    }
  }
}
</script>
 
<style scoped>
 
</style>