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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
| <template>
| <el-dialog v-dialogDrag
| :append-to-body="true"
| :close-on-click-modal="false"
| :destroy-on-close="true"
| :title="dialog.title"
| :visible.sync="dialog.showDialog"
| class="avue-dialog"
| width="1400px"
| @close="cancelDialog">
| <el-container style="height: 580px;">
| <el-aside>
| <basic-container style="height: 560px;">
| <!-- 左侧树 -->
| <div style="height: 520px;">
| <avue-tree
| ref="tree"
| v-model="treeForm"
| :data="treeData"
| :option="treeOption"
| @node-click="nodeClick">
| <span slot-scope="{ node, data }" class="el-tree-node__label">
| <span>
| <i class="el-icon-s-promotion"></i>
| {{ (node || {}).label }}
| </span>
| </span>
| </avue-tree>
| </div>
| </basic-container>
| </el-aside>
|
| <el-main>
| <basic-container style="height: 560px;">
| <div>
| <avue-crud
| ref="crud"
| :data="data"
| :option="option"
| :page.sync="page"
| :table-loading="tableLoading"
| @search-change="handleSearch"
| @search-reset="handleReset"
| @refresh-change="handleRefresh"
| @selection-change="selectChangeHandler"
| @row-click="rowClickHandler">
| <template slot="plTypeType" slot-scope="{row}">
| <el-tag :type="row.plTypeType === 'business' ? '' : 'success'">
| {{ row.plTypeType === 'business' ? '业务类型' : '链接类型' }}
| </el-tag>
| </template>
| </avue-crud>
| </div>
| </basic-container>
| </el-main>
| </el-container>
| <div slot="footer" class="dialog-footer avue-dialog__footer">
| <el-button size="small" type="primary" @click="submitDialog">确 定</el-button>
| <el-button size="small" @click="cancelDialog">取 消</el-button>
| </div>
| </el-dialog>
| </template>
|
| <script>
| import { getActionTree, getActionTableData} from '@/api/UI/Action/api'
| import func from "@/util/func";
| import basicOption from "@/util/basic-option";
|
| export default {
| name: "index",
| props:['isMuti'],
| data() {
| return {
| dialog: {
| showDialog: false,
| title: "选择Action",
| loading: false,
| type: "add",
| },
| currenRow: {}, // action当前行信息
| tableLoading: false,
| lastIndex: null,
| selectList: [],
| data: [],
| option: {
| ...basicOption,
| addBtn: false,
| height: 420,
| highlightCurrentRow: true,
| menu:false,
| column: [
| {
| label: '编号',
| prop: 'plCode',
| overHidden: true,
| search: true
| },
| {
| label: '名称',
| prop: 'plName',
| overHidden: true,
| search: true
| },
| {
| label: 'C/S类路径',
| prop: 'plCSClass',
| search: true,
| searchLabelWidth:120,
| overHidden: true,
| },
| {
| label: 'B/S链接地址',
| prop: 'plBSUrl',
| search: true,
| searchLabelWidth:120,
| overHidden: true,
| },
| {
| label: '类型',
| prop: 'plTypeType',
| search: true,
| type: 'select',
| width:100,
| dicData: [{
| label: '业务类型',
| value: 'business'
| }, {
| label: '链接类型',
| value: 'link'
| }]
| },
| {
| label: '描述',
| prop: 'plDesc',
| search: true,
| overHidden: true,
| },
| ]
| },
| treeNodeRow: {},
| treeForm: {},
| treeOption: {
| addBtn: false,
| defaultExpandedKeys: ['root'],
| props: {
| label: 'name',
| value: 'id',
| children: 'childs'
| }
| },
| treeData: [],
| }
| },
| created() {
| },
| methods: {
| openDialog() {
| this.dialog.showDialog = true;
| this.getTreeList()
| this.data = [];
| },
| cancelDialog() {
| this.dialog.loading = false;
| this.dialog.showDialog = false;
| this.$refs.tree.setCurrentKey(null);
| },
| submitDialog() {
| if (this.selectList.length==0) {
| this.$message.error('请选择Action');
| return;
| }
| if(this.isMuti){
| this.$emit('updataAction', this.selectList);
| }else {
| if(this.selectList.length>1){
| this.$message.error('请选择一条Action');
| return;
| }
| this.$emit('updataAction', this.selectList[0]);
| }
|
| this.cancelDialog();
|
| },
| // 左侧树请求
| getTreeList(status) {
| const params = {
| isExp: status ? true : false
| }
| getActionTree(params).then(res => {
| const data = res.data.obj;
| this.treeData = [data];
| })
| },
|
| // 左侧树行点击
| nodeClick(row) {
| this.treeNodeRow = row;
| this.getRightTableList(row);
| },
|
| // 头部刷新按钮
| handleRefresh() {
| if (func.isEmptyObject(this.treeNodeRow)) {
| return;
| }
| this.getRightTableList(this.treeNodeRow);
| },
|
| // 右侧表格信息
| getRightTableList(row) {
| this.tableLoading = true;
| const params = {
| plactioncls: row.id
| }
| getActionTableData(params).then(res => {
| const data = res.data.data;
| this.data = data;
| this.tableLoading = false;
|
| this.$nextTick(function (){
| this.$refs.crud.doLayout()
| })
| })
| },
|
| // 表格多选
| selectChangeHandler(row) {
| this.selectList = row;
| },
|
| // 行点击
| rowClickHandler(row) {
| this.currenRow = row;
| func.rowClickHandler(
| row,
| this.$refs.crud,
| this.lastIndex,
| (newIndex) => {
| this.lastIndex = newIndex;
| },
| () => {
| this.selectList = [];
| }
| );
| },
|
| // 搜索
| handleSearch(params, done) {
| if (func.isEmptyObject(this.treeNodeRow)) {
| this.$message.error('请先在左侧选择节点后操作');
| return done();
| }
| this.tableLoading = true;
| const apiParams = {
| plactioncls: this.treeNodeRow.id === 'root' ? '' : this.treeNodeRow.id,
| ...params
| }
|
| getActionTableData(apiParams).then(res => {
| const data = res.data.data;
| this.data = data;
| this.tableLoading = false;
| })
| done();
| },
|
| // 重置搜索条件
| handleReset() {
| if (func.isEmptyObject(this.treeNodeRow)) {
| this.$message.error('请先在左侧选择节点后操作');
| return;
| }
| this.getRightTableList(this.treeNodeRow);
| },
| }
| }
| </script>
|
| <style lang="scss" scoped>
| ::v-deep {
| .el-scrollbar__wrap {
| overflow: auto !important;
| }
| }
| </style>
|
|