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
| <template>
| <!--类型Action-->
| <el-container>
| <el-aside>
| <basic-container>
| <div ref="TreeBox" style="height: calc(100vh - 154px);!important;">
| <!-- 左侧树 -->
| <div style="height: calc(100vh - 190px);">
| <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
| <span slot-scope="{ node, data }" class="el-tree-node__label">
| <span style="font-size: 15px">
| <i class="el-icon-s-promotion"></i>
| {{ (node || {}).label }}
| </span>
| </span>
| </avue-tree>
| </div>
| </div>
| </basic-container>
| </el-aside>
|
| <el-main>
| <basic-container>
| <avue-crud
| ref="crud"
| :data="data"
| :option="option"
| :table-loading="tableLoading"
| @refresh-change="handleRefresh"
| @search-change="handleSearch"
| @search-reset="handleReset"
| @selection-change="selectChangeHandler"
| @row-click="rowClickHandler">
| <template slot="menuLeft">
| <el-button icon="el-icon-plus" size="small" type="primary" @click="addHandler">添加</el-button>
| <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delHandler">移除</el-button>
| </template>
| </avue-crud>
| <action-dialog ref="actionDialog" :is-muti="true" @updataAction="actionSaveHandler"></action-dialog>
| </basic-container>
| </el-main>
|
| </el-container>
| </template>
|
| <script>
| import basicOption from "@/util/basic-option";
| import { getBizTree} from "@/api/UI/uiDefine";
| import {getTypeActionByType,savePLTypeAction,delPLTypeActions} from "@/api/authority/ui/typeAction"
| import func from "@/util/func";
| import actionDialog from "@/views/modelingMenu/ui/Aciton/components/dialog"
|
| export default {
| name: "index",
| components:{actionDialog},
| data() {
| return {
| treeOption: {
| height: 'auto',
| defaultExpandAll: true,
| menu: false,
| addBtn: false,
| props: {
| label: 'text',
| value: 'oid',
| children: 'children'
| }
| },
| nodeRow: {},
| treeData: [],
| searchParams: {},
| tableLoading: false,
| selectList: [],
| option: {
| ...basicOption,
| calcHeight: -50,
| addBtn: false,
| editBtn: false,
| delBtn: false,
| tip: false,
| searchMenuSpan: 6,
| align: 'left',
| menu:false,
| column: [
| {
| label: '编号',
| prop: 'plCode',
| overHidden: true,
| search: true
| },
| {
| label: '名称',
| prop: 'plName',
| overHidden: true,
| search: true
| },
| {
| label: 'C/S类路径',
| prop: 'plCSClass',
| searchLabelWidth:120,
| overHidden: true,
| },
| {
| label: 'B/S链接地址',
| prop: 'plBSUrl',
| searchLabelWidth:120,
| overHidden: true,
| },
| {
| label: '类型',
| prop: 'plTypeType',
| type: 'select',
| width:100,
| dicData: [{
| label: '业务类型',
| value: 'business'
| }, {
| label: '链接类型',
| value: 'link'
| }]
| },
| {
| label: '描述',
| prop: 'plDesc',
| overHidden: true,
| },
| ]
| },
| allData: [],
| data: [],
| }
| },
| created() {
| this.getTreeList();
| },
| methods: {
| //树表查询
| getTreeList() {
| const loading = this.$loading({});
| getBizTree().then(res => {
| this.treeData = [res.data.obj];
| loading.close();
| }).catch(error => {
| loading.close();
| })
| },
| // 树点击
| nodeClick(row) {
| if (row.oid) {
| this.nodeRow = row;
| this.tableLoading = true;
| this.getTableList();
| }
| },
| getTableList() {
| getTypeActionByType({
| 'typeName': this.nodeRow.attributes.name,
| }).then(res => {
| this.data = res.data.data;
| this.allData = res.data.data;
| this.$refs.crud.clearSelection();
| this.tableLoading = false;
| })
| },
| // 多选
| selectChangeHandler(row) {
| this.selectList = row;
| },
| // 行点击
| rowClickHandler(row) {
| func.rowClickHandler(
| row,
| this.$refs.crud,
| this.lastIndex,
| (newIndex) => {
| this.lastIndex = newIndex;
| },
| () => {
| this.selectList = [];
| }
| );
| },
| handleRefresh() {
| this.getTableList();
| },
| // 搜索查询
| handleSearch(params, done) {
| const data=this.allData.filter(item=>{
| if(item.plCode.includes(params.plCode ||'') && item.plName.includes(params.plName || '')){
| return true;
| }else {
| return false;
| }
| })
| this.data=data;
| done();
| },
|
| // 重置搜索条件
| handleReset() {
| this.data=this.allData;
| },
| //创建
| addHandler() {
| if (this.nodeRow && this.nodeRow.oid && this.nodeRow.oid!='') {
| this.$refs.actionDialog.openDialog();
| } else {
| this.$message.error('请选择业务类型');
| }
| },
| // 保存action
| actionSaveHandler(val) {
| const params = {
| plTypeName: this.nodeRow.attributes.name,
| actions:val
| }
| savePLTypeAction(params).then(res => {
| if(res.data.code == 200){
| this.$message.success(res.data.obj);
|
| }
| })
| },
| delHandler() {
| if (this.selectList.length <= 0) {
| this.$message.error('请至少选择一条数据');
| return;
| }
| const params = {
| typeName: this.nodeRow.attributes.name,
| typeActionOIds: this.selectList.map(item => item.plOId).join(',')
| }
| this.$confirm('是否移除选中的Action?', '提示', {
| confirmButtonText: '确定',
| cancelButtonText: '取消',
| type: 'warning'
| }).then(() => {
| delPLTypeActions(params).then(res => {
| if (res.data.code === 200) {
| this.$message.success('删除成功');
| this.getTableList();
| }
| })
| }).catch(() => {
| this.$message({
| type: 'info',
| message: '已取消删除'
| });
| });
| },
| }
| }
| </script>
|
| <style lang="scss" scoped>
| ::v-deep {
| .el-scrollbar__wrap {
| overflow: auto !important;
| }
| }
| </style>
|
|