分支自 SuZhouGuanHong/TaiYuanTaiZhong

PCS
dengjunjie
2023-12-13 113d1d4262d8f9e78a9d92123713c41669ad6c87
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
 
<template>
  <div class="c-group">
    <div class="item item1">
      <i class="el-icon-warning"></i>
      <div>提示信息</div>
    </div>
    <div class="item item4">
      <i class="el-icon-success"></i>
      <div>成功信息</div>
    </div>
    <div class="item item2">
      <i class="el-icon-error"></i>
      <div>异常信息</div>
    </div>
    <div class="item item3">
      <i class="el-icon-info"></i>
      <div>警告信息</div>
    </div>
    <div class="item item4">
      <i class="el-icon-success"></i>
      <div>成功信息</div>
    </div>
    <div class="item item5">
      <i class="el-icon-question"></i>
      <div>未知信息</div>
    </div>
    <div class="item item6">
      <i class="el-icon-remove"></i>
      <div>还没想好</div>
    </div>
  </div>
  <div class="container">
    <div style="margin-top: 15px">
      <el-tabs type="border-card" style="min-height: 230px; box-shadow: none">
        <el-tab-pane>
          <template #label>
            <span><i class="el-icon-date"></i> 表1 </span>
          </template>
          <div class="header">
            <div class="text">双击表编辑</div>
            <div class="btns">
              <el-button type="primary" size="mini" plain @click="clear"
                >清空表</el-button
              >
              <el-button type="primary" size="mini" plain @click="del"
                >删除行</el-button
              >
              <el-button type="primary" size="mini" plain @click="add"
                >添加行</el-button
              >
              <el-button type="primary" size="mini" plain @click="getRows"
                >获取选中的行</el-button
              >
            </div>
          </div>
 
          <vol-table
            ref="table"
            :columns="columns"
            :max-height="200"
            :index="true"
            :tableData="tableData"
            :paginationHide="true"
          ></vol-table>
        </el-tab-pane>
        <el-tab-pane :lazy="true" label="消息中心">表2</el-tab-pane>
        <el-tab-pane :lazy="true" label="角色管理">表3</el-tab-pane>
        <el-tab-pane :lazy="true" label="定时任务补偿">表4</el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>
<script>
import VolTable from "@/components/basic/VolTable.vue";
 
export default {
  components: { VolTable },
  methods: {
    del() {
      let rows = this.$refs.table.getSelected();
      if (rows.length == 0) {
        return this.$message.error("请先选中行");
      }
      this.$refs.table.delRow();
    },
    clear() {
      this.tableData.splice(0);
    },
    add() {
      this.tableData.push({});
    },
    getRows() {
      let rows = this.$refs.table.getSelected();
      if (rows.length == 0) {
        return this.$Message.error("请先选中行1");
      }
      this.$Message.info("当前选中的行数据:" + JSON.stringify(rows));
    },
  },
  created() {},
  data() {
    return {
      text: "",
      tableData: [
        //表数据
        {
          ExpertId: 276,
          ExpertName: "起名太麻烦",
          UserName: "13888888882",
          UserTrueName: "月穿潭底水無痕 ",
          AuditStatus: 1,
          Enable: 1,
          ReallyName: "月穿潭底水無痕 ",
          CreateDate: "2018-09-18 17:45:54",
        },
        {
          ExpertId: 276,
          ExpertName: "取名难好难",
 
          UserName: "13888888883",
          UserTrueName: "乌拉圭 ",
          AuditStatus: 2,
          Enable: 0,
          ReallyName: "月穿潭底水無痕 ",
          CreateDate: "2018-09-18 17:45:54",
        },
      ],
      columns: [
        //表配置
        {
          field: "ExpertId", //数据库表字段,必须和数据库一样,并且大小写一样
          title: "主键ID", //表头显示的名称
          type: "int", //数据类型
          isKey: true, //是否为主键字段
          width: 80, //表格宽度
          hidden: true, //是否显示
          readonly: true, //是否只读(功能未启用)
          require: true, //是否必填(功能未启用)
          align: "left", //文字显示位置
        },
        {
          field: "ExpertName",
          title: "名称",
          width: 150,
          align: "left",
          edit: { type: "text" },
          sortable: true, //是否排序(目前第一个字段为排序字段,其他字段排序开发中)
        },
        {
          field: "UserName",
          title: "申请人帐号",
          width: 120,
          hidden: true, //是否显示
          edit: { type: "text" },
          align: "left",
        },
        {
          field: "UserTrueName",
          title: "申请人",
 
          width: 120,
          align: "left",
          click: (row, column) => {
            //单元格点击事亻
            this.$message.error("此单元格没有设置为可以编辑");
          },
          formatter: (row) => {
            //对单元格的数据格式化处理
            return row.UserTrueName;
          },
        },
        {
          field: "AuditStatus",
          title: "审核状态",
          type: "int",
          bind: {
            //如果后面返回的数据为数据源的数据,请配置此bind属性,可以从后台字典数据源加载,也只以直接写上
            key: "audit",
            data: [
              { key: "0", value: "审核中" },
              { key: "1", value: "审核通过" },
              { key: "2", value: "审核未通过" },
            ],
          },
          width: 120,
          align: "left",
        },
        {
          field: "Enable",
          title: "是否启用",
          type: "byte",
          bind: { key: "enable", data: [] }, //此处值为data空数据,自行从后台字典数据源加载
          width: 80,
          require: true,
          align: "left",
          edit: { type: "switch" },
        },
        {
          field: "CreateDate",
          title: "创建时间",
          type: "datetime",
          width: 150,
          readonly: true,
          align: "left",
          edit: { type: "datetime" },
          sortable: true,
        },
        {
          field: "ReallyName",
          title: "真实姓名",
 
          width: 120,
          click: (row, column) => {
            //单元格点击事亻
            let msg =
              "此处可以自己自定格式显示内容,此单元格原始值是:【" +
              row.ReallyName +
              "】";
            this.$message.error(msg);
          },
          formatter: (row, column) => {
            //对单元格的数据格式化处理
            return "<a style='color:rgb(15, 132, 255);'>点我</a>";
          },
          align: "left",
        },
        {
          field: "Creator",
          title: "创建人",
 
          width: 130,
          hidden: true,
          align: "left",
        },
      ],
    };
  },
};
</script>
<style lang="less" scoped>
.container {
  background: white;
 
  border-top: 10px solid #eee;
}
.header {
  display: flex;
  margin-bottom: 10px;
  .text {
    line-height: 30px;
    border-bottom: 2px solid #607d8b;
    font-size: 16px;
    /* color: #FF9800; */
    font-weight: 500;
  }
  .btns {
    flex: 1;
    text-align: right;
  }
}
.c-group {
  margin-top: 15px;
  border-top: 10px solid #eee;
  padding: 15px 0;
  display: flex;
  .item {
    flex: 1;
    text-align: center;
    i {
      border-radius: 50%;
      font-size: 60px;
      margin-bottom: 7px;
    }
  }
  .item1 {
    i {
      color: #409eff;
      border: 1px solid #3498ff;
    }
  }
  .item2 {
    i {
      color: red;
      border: 1px solid red;
    }
  }
  .item3 {
    i {
      color: rgb(0 0 0 / 60%);
      border: 1px solid rgb(0 0 0 / 60%);
    }
  }
  .item4 {
    i {
      color: #15c322;
      border: 1px solid #15c322;
    }
  }
  .item5 {
    i {
      color: #409eff;
      border: 1px solid #409eff;
    }
  }
  .item6 {
    i {
      color: #ff00d4;
      border: 1px solid #ff00d4;
    }
  }
}
</style>