index.vue
7.11 KB
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
<template>
<anji-crud ref="listPage" :option="crudOption">
<template v-slot:pageSection>
</template>
</anji-crud>
</template>
<script>
import {
reportShareDeleteBatch,
reportShareDetail,
reportShareList,
reportShareDelay, reportShareAdd
} from "@/api/reportShare";
export default {
name: "Report",
components: {
anjiCrud: require("@/components/AnjiPlus/anji-crud/anji-crud").default,
},
data() {
return {
crudOption: {
// 使用菜单做为页面标题
title: '报表分享',
// 详情页中输入框左边文字宽度
labelWidth: '120px',
// 查询表单条件
queryFormFields: [
{
inputType: "input",
label: "分享编码",
field: "shareCode"
},
{
inputType: "input",
label: "报表编码",
field: "reportCode"
},
{
inputType: "anji-select",
anjiSelectOption: {
dictCode: "SHARE_VAILD"
},
label: "分享类型",
field: "shareValidType"
},
],
// 表头按钮
tableButtons: [
{
label: "删除",
type: "danger",
permission: "reportShareManage:delete",
icon: "el-icon-delete",
plain: false,
click: () => {
return this.$refs.listPage.handleDeleteBatch();
}
}
],
// 表格行按钮
rowButtons: [
{
label: "复制url",
click: this.copyUrlPath
},
{
label: "删除",
permission: "reportShareManage:delete",
click: row => {
return this.$refs.listPage.handleDeleteBatch(row);
}
},
{
label: "延期1天",
permission: "reportShareManage:shareDelay",
click: this.shareDelay_1
},
{
label: "延期1周",
permission: "reportShareManage:shareDelay",
click: this.shareDelay_7
},
{
label: "延期1月",
permission: "reportShareManage:shareDelay",
click: this.shareDelay_30
},
],
// 操作按钮
buttons: {
query: {
api: reportShareList,
permission: 'ReportShare:query',
sort: "create_time",
order: "DESC"
},
queryByPrimarykey: {
api: reportShareDetail,
permission: 'ReportShare:detail'
},
delete: {
api: reportShareDeleteBatch,
permission: 'ReportShare:delete'
},
rowButtonsWidth: 150 // row自定义按钮表格宽度
},
// 表格列
columns: [
{
label: '',
field: 'id',
primaryKey: true, // 根据主键查询详情或者根据主键删除时, 主键的
tableHide: true, // 表格中不显示
editHide: true, // 编辑弹框中不显示
},
{
label: '报表编码',//报表编码
placeholder: '',
field: 'reportCode',
editField: 'reportCode',
inputType: 'input',
rules: [
{ min: 1, max: 50, message: '不超过50个字符', trigger: 'blur' }
],
disabled: false,
},
{
label: '分享编码',//分享编码,系统生成,默认UUID
placeholder: '',
field: 'shareCode',
editField: 'shareCode',
inputType: 'input',
rules: [
{ min: 1, max: 50, message: '不超过50个字符', trigger: 'blur' }
],
disabled: false,
},
{
label: '分享类型',//分享有效期类型,DIC_NAME=SHARE_VAILD
placeholder: '',
field: 'shareValidType',
fieldTableRowRenderer: row => {
return this.getDictLabelByCode("SHARE_VAILD", row["shareValidType"]);
},
editField: 'shareValidType',
inputType: 'input',
rules: [
],
disabled: false,
},
{
label: '分享过期时间',//分享有效期
placeholder: '',
field: 'shareValidTime',
editField: 'shareValidTime',
inputType: 'input',
rules: [
],
disabled: false,
},
{
label: '分享token',//分享token
placeholder: '',
field: 'shareToken',
editField: 'shareToken',
tableHide: true,
inputType: 'input',
rules: [
{ min: 1, max: 255, message: '不超过255个字符', trigger: 'blur' }
],
disabled: false,
},
{
label: '分享url',//分享url
placeholder: '',
field: 'shareUrl',
editField: 'shareUrl',
inputType: 'input',
rules: [
{ min: 1, max: 100, message: '不超过100个字符', trigger: 'blur' }
],
disabled: false,
},
{
label: '分享码',
placeholder: '',
field: 'sharePassword',
editField: 'sharePassword',
inputType: 'input',
rules: [
],
disabled: false,
},
],
// 弹出框表单对应的值有改动时
// formData 整个表单,通过编辑打开弹出框,根据主键查询数据时,fieldName, fieldVal, fieldExtend为空
// fieldName 触发修改的input name
// fieldVal input最新值
// fieldExtend 对于select型的扩展值
formChange: (formData, fieldName, fieldVal, fieldExtend) => {
}
},
// 复制
copyVisible: false,
rowData: {}
};
},
created() {},
methods: {
handleOpenDialog1() {
alert("自定义按钮1点击事件");
},
shareDelay_1(val) {
this.shareDelay(val.id, 1)
},
shareDelay_7(val) {
this.shareDelay(val.id, 7)
},
shareDelay_30(val) {
this.shareDelay(val.id, 30)
},
async shareDelay(shareId, shareValidType) {
const param = {}
param['id'] = shareId
param['shareValidType'] = shareValidType
const {code} = await reportShareDelay(param);
if (code != "200") return;
this.$message({
message: "延期成功!",
type: "success"
});
this.$refs.listPage.handleQueryForm("query");
},
copyUrlPath(val) {
this.copyToClip(val.shareUrl);
this.$message({
message: "已将url路径复制至剪切板!",
type: "success"
});
},
copyToClip(content, message) {
let aux = document.createElement("input");
aux.setAttribute("value", content);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
}
}
};
</script>