FormAuthorizeManager.vue
6.45 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
<template>
<div class="fullheight">
<ht-table
ref="htTable"
:data="rows"
:pageResult="pagination"
:selection="true"
quick-search-props="authorizeDesc,creator"
:show-export="false"
:show-custom-column="false"
:default-sorter="[{ property: 'create_time_', direction: 'DESC' },]"
@selection-change="handleSelectionChange"
@loading="loadData"
>
<template v-slot:toolbar>
<el-button-group>
<el-button size="small" @click="showDialog()" icon="el-icon-plus">添加</el-button>
<ht-delete-button
url="${form}/formAuthorize/v1/deleteByIds?ids="
:htTable="$refs.htTable"
style="margin-left:10px;"
:disabled="isDisabled"
>删除</ht-delete-button
>
</el-button-group>
</template>
<template>
<ht-table-column type="index" width="50" align="center" label="序号" />
<ht-table-column
prop="authorizeDesc"
label="授权说明"
:show-overflow-tooltip="true"
>
<template v-slot="{row}">
<el-link
type="primary"
@click="showDialog(row.id)"
title="查看详情"
>{{row.authorizeDesc}}</el-link>
</template>
</ht-table-column>
<ht-table-column
prop="authorizeModel"
label="授权对象"
:filters="modelFilter"
:show-overflow-tooltip="true"
>
<template v-slot="{row}">
{{getModelsDesc(row.authorizeModel)}}
</template>
</ht-table-column>
<ht-table-column
prop="creator"
label="创建人"
:show-overflow-tooltip="true"
>
</ht-table-column>
<ht-table-column
prop="createTime"
label="创建时间"
:sortable="true"
:show-overflow-tooltip="true"
>
</ht-table-column>
</template>
</ht-table>
<FormAuthorize-manager-edit :modelRightType="modelRightType" :models="models" @onConfirm="$refs.htTable.load()" ref="FormAuthorizeManagerEdit"></FormAuthorize-manager-edit>
</div>
</template>
<script>
import FormAuthorizeManagerEdit from "./FormAuthorizeManagerEdit.vue";
import api from "@/api/FormAuthorize.js"
export default {
name: 'FormAuthorizeManager',
components:{FormAuthorizeManagerEdit},
data() {
return {
dialogVisible: false,
rows: [],
pagination: {
page: 1,
pageSize: 50,
total: 0
},
FormAuthorize: {},
saveMethod: "POST",
modelRightType:[],
isDisabled: true,
selectedList: [],
models:[{key:'01',value:'建模',catId:'9',listUrl:"${form}/bo/def/v1/list",name:"description"},
{key:'02',value:'pc表单',catId:'7',listUrl:"${form}/form/form/v1/list",alias:"formKey",querys:[{group: "defaultQueryGroup", operation: "EQUAL", relation: "AND", property: "formType", value: "pc"}]},
{key:'03',value:'手机表单',catId:'7',listUrl:"${form}/form/form/v1/list",alias:"formKey",querys:[{group: "defaultQueryGroup", operation: "EQUAL", relation: "AND", property: "formType", value: "mobile"}]},
{key:'04',value:'套打模板',catId:'13',listUrl:"${form}/form/printTemplate/v1/getPrintList?type=word"},
{key:'05',value:'关联查询',catId:'16',listUrl:"${form}/form/customQuery/v1/list"},
{key:'06',value:'对话框',catId:'17',listUrl:"${form}/form/customDialog/v1/list"},
// {key:'7',value:'流水号',catId:'18',listUrl:"${portal}/sys/identity/v1/listJson"}, 这2模块后台代码不在表单,先不处理
// {key:'8',value:'数据字典',typeKey:'DIC',alias:'key',listUrl:"${portal}/sys/dataDict/v1/getAllRootDicts"},
// {key:'9',value:'标签',catId:'11'},
{key:'10',value:'自定义组件',listUrl:"${form}/formCustomComponent/v1/query"},
{key:'11',value:'数据列表',listUrl:"${form}/form/query/querySqldef/query"},
{key:'12',value:'表单列表',catId:'7',listUrl:"${form}/form/dataTemplate/v1/query"}],
modelsMap:{},
modelFilter:[]
};
},
computed: {
tableHeight() {
return this.$baseTableHeight()
},
},
watch: {
selectedList: {
handler(val) {
this.isDisabled = val.length < 1 ? true : false
},
deep: true,
},
},
methods: {
getModelsDesc(modelsStr){
if (!modelsStr) {
return '';
}
let descArray = []
let this_ = this
modelsStr.split(',').forEach(m => {
descArray.push(this_.modelsMap[m].value)
});
return descArray.join(',')
},
handleSelectionChange(selection){
this.selectedList = selection
},
showDialog(id) {
this.$refs.FormAuthorizeManagerEdit.showDialog(id);
},
loadData(param, cb) {
param = param || {}
param = JSON.parse(JSON.stringify(param))
if (param.querys) {
let newQuerys = []
param.querys.forEach(q => {
if (q.property == 'authorizeModel') {
if (q.value.constructor == String) {
q.value = [q.value]
}
q.value.forEach(v => {
newQuerys.push({group: "authorizeModelGroup",operation: "LIKE",property: "authorizeModel",relation: "OR",value: v});
});
}else{
newQuerys.push(q);
}
});
param.querys = newQuerys
}
api.loadData(param||{}).then(
(resp) => {
let response = resp.data || resp
this.rows = response.rows
this.total = response.total
this.pagination = {
page: response.page,
pageSize: response.pageSize,
total: response.total
}
}
)
.finally(() => cb && cb());
},
removeValid() {
if (this.$refs.htTable.selection.length == 0) {
this.$message({ message: '请至少选择一条记录', type: 'warning' })
return false
}
return true
},
handleRemove() {
const ids = []
this.$refs.htTable.selection.forEach((item) => {
ids.push(item.id)
})
api.deleteByIds(ids.join(',')).then(() => {
this.loadData()
})
},
},
created(){
api.getModelRightType().then((resp) => {
this.modelRightType = resp.data.value
})
this.models.forEach(mo => {
this.modelsMap[mo.key] = mo
this.modelFilter.push({text:mo.value,value:mo.key})
});
}
};
</script>