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
| <template>
| <div class="law-enforcement">
| <!-- table表格展示 -->
| <MyTable :tableData="list" :tableOption="tableOption" :totalNum="totalNum" @getCurrentPage="getCurrentPage"
| @openDialog="changeDialog">
| <template #operation="{info}">
| <div class="btn">
| <!-- 操作区域 -->
| <!-- {{getData(info)}} -->
| <span @click="dataView(info)">查看</span>
| </div>
| </template>
| </MyTable>
| <!-- 弹窗 -->
| <div class="dialog">
| <el-dialog v-if="visible" :visible.async="visible" title="问题登记" width="60%" :before-close="handleClose">
| <MyView :viewData=showData />
| </el-dialog>
| </div>
| </div>
| </template>
| <script>
| import MyTable from '@/components/Table'
| import MyView from './components/dataView'
| export default {
| components: {
| MyTable, MyView
| },
| data() {
| return {
| list: [
| {
| name: '张三',
| sex: '男',
| age: '23',
| 'min-width': '10',
| },
| {
| name: '张四',
| sex: '男',
| age: '23',
| 'min-width': '10',
| },
| {
| name: '丸小儿',
| sex: '女',
| age: '11',
| 'min-width': '10',
| },
| ],
| tableOption: {
| group: [
| {
| label: '姓名',
| type: 'text',
| prop: 'name',
| },
| {
| label: '年龄',
| type: 'text',
| prop: 'age',
| },
| {
| label: '性别',
| type: 'text',
| prop: 'sex',
| },
| {
| label: '操作',
| type: 'operation',
| prop: 'operation',
| children: [
| {
| operationName: '查看',
| mykey: 'look',
| },
| {
| operationName: '修改',
| mykey: 'update',
| }
| ]
| },
| ]
| },
| visible: false,
| totalNum: '',
| showData: {},
| }
| },
| created() {
| this.totalNum = this.list.length;
| },
| methods: {
| // 关闭对话框
| handleClose(done) {
| this.$confirm('确认关闭?')
| .then(_ => {
| this.visible = false;
| done();
| })
| .catch(_ => { });
| },
| // 获取操作结果
| changeDialog({ index, mykey }) {
| console.log(index, mykey);
| this.showData = this.list[index];
| this.visible = true;
| },
| // 数据展示
| dataView(data) {
| console.log(data);
| },
| // 获取当前页数据
| getCurrentPage(current) {
| console.log(current);
| }
| }
| }
| </script>
| <style lang="scss" scoped>
|
| </style>
|
|