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
| <template>
| <div class="page-list-container">
| <!--数据Table-->
| <yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="buttons" :action-field="actionField" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes" :fixed-where="{enable:{operator:'raw',value:'(enable is null OR enable=0)'}}">
| <template slot="common-column-slot" slot-scope="{row, col}">
| <template v-if="col.prop=='enable'">
| <template v-if="row[col.prop]==1">
| <el-tag color="#7aaffe" style="color:white;border:0">
| {{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
| </el-tag>
| </template>
| <template v-else>
| <el-tag color="#ffcc33" style="color:white;border:0">
| {{ $refs[dataListRef].translateText(col.prop, row[col.prop]||0, col.dropdown_Id) }}
| </el-tag>
| </template>
| </template>
| <template v-else-if="col.prop=='sex'">
| {{ $refs[dataListRef].translateText(col.prop, row[col.prop]||0, col.dropdown_Id) }}
| </template>
| <template v-else>
| {{ row[col.prop] }}
| </template>
| </template>
| </yrt-data-list>
|
| <!--数据编辑器Editor-->
| <yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :auth-nodes="authNodes"></yrt-editor>
| </div>
| </template>
|
| <script>
| import baseLayout from "@/components/common/base-layout.vue";
|
| export default {
| name: "user-disabled-tab",
| // 自定义JSON路由地址
| custoJsonmRoute: "/sys/permission/user",
|
| components: {},
| mixins: [baseLayout],
| data() {
| return {
| // 自定义按钮
| buttons: [
| {
| type: "button-group",
| label: "按钮组",
| buttons: [
| {
| type: "button",
| label: "解禁",
| options: {
| icon: "el-icon-yrt-shenpi3",
| type: "primary",
| authNode: "Enable"
| },
| key: "1544526690000_95807"
| },
| {
| type: "button",
| label: "删除",
| options: {
| icon: "el-icon-yrt-shanchu2",
| type: "primary",
| authNode: "delete"
| },
| key: "1544526694000_18473"
| }
| ],
| options: {
| icon: "el-icon-yrt-anniuzu"
| },
| key: "1544526689000_39228"
| },
| {
| type: "button-group",
| label: "按钮组",
| buttons: [
| {
| type: "button",
| label: "刷新",
| options: {
| icon: "el-icon-yrt-shuaxin",
| type: "default",
| authNode: "refresh"
| },
| key: "1544526700000_1981"
| },
| {
| type: "button",
| label: "帮助",
| options: {
| icon: "el-icon-info",
| type: "default",
| authNode: "helper"
| },
| key: "1544526720000_74567"
| }
| ],
| options: {
| icon: "el-icon-yrt-anniuzu"
| },
| key: "1544526698000_61679"
| }
| ],
| // 自定义表格操作按钮
| actionField: {
| prop: "_action",
| label: "操作",
| width: "100",
| headerAlign: "center",
| align: "center",
| action: [
| {
| type: "button",
| action: "Enable",
| label: "解禁",
| onClick: (btnInfo, rowData) => {
| this.rowEnableUser(btnInfo, rowData);
| return true;
| }
| },
| {
| type: "button",
| action: "delete",
| label: "删除"
| }
| ],
| hidden: false
| }
| };
| },
| created() {},
| methods: {
| // 列表页面按钮点击事件
| buttonClick(authNode) {
| switch (authNode) {
| case "Enable":
| // 批量审核
| this.multiEnableUser();
| break;
| }
| },
| // 批量解禁用户
| multiEnableUser() {
| const the = this;
| if (!the.dataListSelections.length) {
| this.$message.error("至少选择一行!");
| return;
| }
|
| this.$confirm("确定要批量进行解禁操作吗?", "批量解禁", {
| confirmButtonText: "确定",
| cancelButtonText: "取消",
| type: "warning"
| })
| .then(() => {
| // 获得已选中的ID
| const selectIDs = the.dataListSelections
| .map((item, index, Array) => {
| return item.Receive_Id;
| })
| .join(",");
| const url = "/api/Sys_User/enableUser";
| const params = {
| selectIDs: selectIDs
| };
| const ref = the.$refs[the.$options.dataListRef];
| var callback = res => {
| the.common.showMsg(res);
| if (res.result) {
| ref.loadData();
| }
| };
| the.common.ajax(url, params, callback, ref);
| })
| .catch(() => {
| the.$message({
| type: "info",
| message: "已取消"
| });
| });
| },
| // 单条解禁
| rowEnableUser(btnInfo, rowData) {
| const the = this;
| this.$confirm("确定要进行解禁操作吗?", "解禁", {
| confirmButtonText: "确定",
| cancelButtonText: "取消",
| type: "warning"
| })
| .then(() => {
| // 获得已选中的ID
| const user_Id = rowData.user_Id;
| const url = "/api/sys/user/enableUser";
| const params = {
| openNodeApi: true,
| user_Id: user_Id
| };
| const ref = the.findRef(the.dataListRef);
| var callback = res => {
| the.common.showMsg(res);
| if (res.result) {
| ref.loadData();
| the.editorOptions.config.visible = false;
| }
| };
| the.common.ajax(url, params, callback, ref);
| })
| .catch(() => {
| the.$message({
| type: "info",
| message: "已取消"
| });
| });
| }
| }
| };
| </script>
|
|