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
| <template>
| <!--代办任务-->
| <basic-containers :key="loadKey">
| <div>
| <avue-crud
| ref="crud"
| :data="data"
| :option="options"
| :page.sync="pages"
| :search.sync="searchParams"
| :table-loading="loading"
| @search-change="handleSearch"
| @search-reset="handleReset"
| @current-change="currentChange"
| @size-change="sizeChange">
| <template slot="title" slot-scope="{row}">
| <el-link type="primary" @click="linkClickHandler(row)">{{ row.title }}</el-link>
| </template>
| </avue-crud>
| </div>
| </basic-containers>
| </template>
|
| <script>
| export default {
| name: "UndoTaskPortlet",
| data() {
| return {
| loadKey:0,
| data: [],
| options: {
| height: 'auto',
| calcHeight:210,
| addBtn: false,
| editBtn: false,
| delBtn: false,
| index: true,
| border: true,
| menu: false,
| refreshBtn: false,
| searchIcon: true,
| searchShow: true,
| menuWidth: 120,
| menuAlign: "center",
| column: [
| {
| label: "类型",
| prop: "msgClassifyText",
| sortable: true,
| width: 100,
| },
| {
| label: "消息标题",
| prop: "title",
| search:true,
| minWidth: 400,
| sortable: true,
| searchSpan:6,
| overHidden: true,
| slot:true,
| },
| {
| label: "发送时间",
| prop: "sendTime",
| width: 130,
| type:'datetime',
| overHidden: true,
| format:'yyyy-MM-dd HH:mm',
| sortable:true,
| slot: true
| },
| {
| label: '工号',
| prop: "sendUserCode",
| searchLabelWidth: 100,
| search:true,
| sortable: true,
| searchSpan:6,
| width: 130,
| },
| {
| label: "发送人姓名",
| prop: "sendUserName",
| searchLabelWidth: 100,
| search:true,
| searchSpan:6,
| sort: true,
| width: 130,
| },
| {
| label: "内容",
| overHidden:true,
| prop: "msgContent",
| minWidth: 300
| },
| ]
| },
| pages: {
| currentPage: 1,
| pageSize: 15,
| pageSizes: [15, 25, 45, 60, 100],
| total: 0,
| layout: "prev,pager,next,jumper,sizes,total",
| },
| loading: false,
| searchParams: {
| pageNum: 1,
| pageSize: 15,
| },
| };
| },
| created() {
| this.getTableList();
| },
| mounted() {
| window.addEventListener('resize', this.handleResize); // 获取用户缩放事件
| },
| beforeDestroy() {
| window.removeEventListener('resize', this.handleResize); // 销毁绑定的方法
| },
| methods: {
| // 强制修改容器key值
| handleResize() {
| this.loadKey += 1;
| },
|
| // 初始化根据分辨率来决定页面初始多少条数据
| createdPageSize(){
| let windowHeight = window.outerHeight;
| if(windowHeight > 1350) this.homeTable.pages.pageSize = 25;
| if(windowHeight > 1350) this.searchParams.pageSize = 25;
| },
|
| getTableList() {
| this.createdPageSize(); // 判断页面分辨率
|
| getList(this.searchParams).then(res => {
| if (res && res.success) {
| this.homeTable.data = res.data;
| this.homeTable.pages.total = res.total;
| }
| });
| },
|
| linkClickHandler(row){
| if(row.msgLink != null && row.msgLink != ''){
| var link = row.msgLink.replace("inner:","").replace("?","").split("&");
| var html = link.find((val=>(val.toLowerCase().startsWith("html=")|| val.toLowerCase().startsWith("html ="))));
| if(html!=null && html!=''){
| var page = html.split("=")[1].replace("-","/");
| var single = {
| fromUndo:true
| };
| link.forEach((val)=>{
| var temp = val.split("=");
| single[temp[0]] = temp[1];
| });
| this.$router.push({
| path:"/" + page,
| query:single
| });
| }
| }
| },
|
| // 分页选择显示多少条
| sizeChange(val) {
| this.searchParams.pageSize = val;
| this.searchParams.pageNum = 1;
| this.getTableList();
| },
|
| // 分页页码
| currentChange(val) {
| this.searchParams.pageNum = val;
| this.getTableList();
| },
|
| // 查询
| handleSearch(params, done) {
| setTimeout(() => {
| done();
| this.searchParams = { ...params };
| this.getTableList();
| }, 300);
| },
|
| // 清空搜索
| handleReset() {
| this.searchParams = this.defaultSearch;
| this.getTableList();
| },
| // 刷新数据
| handleRefresh() {
| this.getTableList();
| },
| }
| }
| </script>
|
| <style scoped>
|
| </style>
|
|