【#1162】 变更负责人相关业务-资源类型、业务负责人、角色权限接口调用,树表格的父节点选中,子节点也选中
Showing
11 changed files
with
634 additions
and
47 deletions
@@ -229,25 +229,47 @@ export default { | @@ -229,25 +229,47 @@ export default { | ||
229 | return val; | 229 | return val; |
230 | 230 | ||
231 | } | 231 | } |
232 | + //设置父节点选中后children也选中 | ||
233 | + let setChecked=(row)=>{ | ||
234 | + let arr=[]; | ||
235 | + if(row.children){ | ||
236 | + row.children.map(j=>{ | ||
237 | + arr.push(j) | ||
238 | + setChecked(j) | ||
239 | + }) | ||
240 | + } | ||
241 | + toggleSelection(arr) | ||
242 | + } | ||
232 | //勾选数据行的Checkbox事件 | 243 | //勾选数据行的Checkbox事件 |
233 | let handleSelect=(selection, row)=>{ | 244 | let handleSelect=(selection, row)=>{ |
234 | - if(selection.some(el=>{ return row[props.getRowKeys] ===el[props.getRowKeys]})){ | ||
235 | - if(row.children){ | ||
236 | - row.children.map(j=>{ | ||
237 | - toggleSelection(j) | ||
238 | - }) | ||
239 | - } | 245 | + /* if(selection.some(el=>{ return row[props.getRowKeys] ===el[props.getRowKeys]})){ |
246 | + setChecked(row); | ||
240 | }else{ | 247 | }else{ |
241 | - if(row.children){ | ||
242 | - row.children.map(j=>{ | ||
243 | - toggleSelection(j) | ||
244 | - }) | ||
245 | - } | ||
246 | - } | 248 | + setChecked(row); |
249 | + }*/ | ||
250 | + setChecked(row); | ||
251 | + | ||
247 | emit('handleSelect',selection) | 252 | emit('handleSelect',selection) |
248 | } | 253 | } |
249 | //勾选全选checkbox事件 | 254 | //勾选全选checkbox事件 |
250 | let handleSelectAll=(selection)=>{ | 255 | let handleSelectAll=(selection)=>{ |
256 | + const isSelect=selection.some(el=>{ | ||
257 | + const tableDataIds=props.dataList.map(j=>j[props.getRowKeys]) | ||
258 | + return tableDataIds.includes(el.id) | ||
259 | + }) | ||
260 | + const isCancel=!props.dataList.every(el=>{ | ||
261 | + const selectIds=selection.map(j=>j[props.getRowKeys]) | ||
262 | + return selectIds.includes(el.id) | ||
263 | + }) | ||
264 | + if(isSelect){ | ||
265 | + setChecked(selection); | ||
266 | + } | ||
267 | + if(isCancel){ | ||
268 | + props.dataList.map(el=>{ | ||
269 | + setChecked(el); | ||
270 | + }) | ||
271 | + } | ||
272 | + | ||
251 | emit('handleSelectAll',selection) | 273 | emit('handleSelectAll',selection) |
252 | } | 274 | } |
253 | // 挂载完 | 275 | // 挂载完 |
hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.html
1 | +<el-row> | ||
2 | + <el-col :span="24" class="search"> | ||
3 | + <div class="condition" > | ||
4 | + <el-form ref=“form” style="display: flex;"> | ||
5 | + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | ||
6 | + <el-input v-model="search.keyword" placeholder="请输入业务名称"></el-input> | ||
7 | + </el-form-item> | ||
8 | + <!--<el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | ||
9 | + <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型"> | ||
10 | + <el-option | ||
11 | + v-for="item in resTypeOptions" | ||
12 | + :key="item.resTypeCode" | ||
13 | + :label="item.resTypeName" | ||
14 | + :value="item.resTypeCode"> | ||
15 | + </el-option> | ||
16 | + </el-select> | ||
17 | + </el-form-item>--> | ||
18 | + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | ||
19 | + <el-button @click="getListData" type="primary">查询</el-button> | ||
20 | + </el-form-item> | ||
21 | + </el-form> | ||
22 | + </div> | ||
23 | + </el-col> | ||
24 | +</el-row> | ||
25 | +<el-row style="margin-bottom: 10px;"> | ||
26 | + <div class="flex-div-start"> | ||
27 | +<!-- <el-button type="primary" @click="changeCancel()" size="small">取消</el-button>--> | ||
28 | + <el-button type="primary" @click="changeAdmin()" size="small" style="margin-left: 6px">变更</el-button> | ||
29 | + </div> | ||
30 | +</el-row> | ||
31 | +<el-row class="margin-bottom-50" style="margin-top: 3px"> | ||
32 | + <el-col :span="24" class="table-height"> | ||
33 | + <cm-table-page :columns="columns" | ||
34 | + :dataList="resourceData" | ||
35 | + :total="count" | ||
36 | + :layout="'total, prev,pager,next,sizes, jumper'" | ||
37 | + :pageSize="pageSize" | ||
38 | + @loaddata="loadTableDataList" | ||
39 | + @selectionChange="selectionChange" | ||
40 | + :showIndex="true" | ||
41 | + :showSelection="true" | ||
42 | + :showBorder="true" | ||
43 | + :loading="loading" | ||
44 | + :showPage="true" | ||
45 | + :showTools="false" | ||
46 | + :height="(height - 200)"> | ||
47 | + <template #default="{row,prop,column}"> | ||
48 | + <div v-if="prop == 'paramDesc'"> | ||
49 | + <el-select v-if="row.resType == 'HOST_X86SERVER'" v-model="row.showType" placeholder=""> | ||
50 | + <el-option | ||
51 | + v-for="item in showTypeList" | ||
52 | + :key="item.value" | ||
53 | + :label="item.name" | ||
54 | + :value="item.value" | ||
55 | + > | ||
56 | + </el-option> | ||
57 | + </el-select> | ||
58 | + </div> | ||
59 | + </template> | ||
60 | + </cm-table-page> | ||
61 | + </el-col> | ||
62 | +</el-row> | ||
63 | + | ||
64 | +<ChangeUsersList :show="show" :isTwoGroup="isTwoGroup" :isMulti="isMulti" @hideDialog="hideDialog" @savebtn="savebtn"></ChangeUsersList> |
1 | export default { | 1 | export default { |
2 | - name: 'resourceTypePer', | 2 | + name: 'bizLeader', |
3 | template: '', | 3 | template: '', |
4 | components: { | 4 | components: { |
5 | - | 5 | + 'ChangeUsersList': Vue.defineAsyncComponent( |
6 | + () => myImport('views/batchChangeLeaders/changeUsersList/index') | ||
7 | + ), | ||
6 | }, | 8 | }, |
7 | data() { | 9 | data() { |
8 | }, | 10 | }, |
@@ -10,12 +12,268 @@ export default { | @@ -10,12 +12,268 @@ export default { | ||
10 | }, | 12 | }, |
11 | setup: function (props, {attrs, slots, emit}) { | 13 | setup: function (props, {attrs, slots, emit}) { |
12 | const {proxy} = Vue.getCurrentInstance(); | 14 | const {proxy} = Vue.getCurrentInstance(); |
15 | + //接收从用户列表中选中的用户 | ||
16 | + let userName=Vue.ref(proxy.$route.query.username); | ||
17 | + //变更人员弹框 | ||
18 | + let show=Vue.ref(false); | ||
19 | + //变更人员列表是否多选 | ||
20 | + let isMulti=Vue.ref(false); | ||
21 | + //变更人员列表是否是两组 | ||
22 | + let isTwoGroup=Vue.ref(false); | ||
23 | + //配置列表总数 | ||
24 | + let count = Vue.ref(0); | ||
25 | + //列表高度 | ||
26 | + let height = Vue.ref(window.innerHeight); | ||
27 | + //列表分页 | ||
28 | + let limit = Vue.ref(400); | ||
29 | + //加载 | ||
30 | + let loading = Vue.ref(true); | ||
31 | + //选中数据 | ||
32 | + let pitch = Vue.ref([]); | ||
33 | + let showTypeList=Vue.ref([]); | ||
34 | + let search = Vue.ref({ | ||
35 | + resType: '', | ||
36 | + keyword: '', | ||
37 | + page: 1, | ||
38 | + limit: 20, | ||
39 | + }); | ||
40 | + let resTypeOptions=Vue.ref([]) | ||
41 | + const columns = [ | ||
42 | + { | ||
43 | + prop: 'busTypeName', | ||
44 | + label: '业务类型名称', | ||
45 | + sortable: true, | ||
46 | + align: 'center', | ||
47 | + }, | ||
48 | + { | ||
49 | + prop: 'admin', | ||
50 | + label: '负责人', | ||
51 | + sortable: true, | ||
52 | + align: 'center', | ||
53 | + }, | ||
54 | + { | ||
55 | + prop: 'busTypeDesc', | ||
56 | + label: '业务类型描述', | ||
57 | + sortable: true, | ||
58 | + align: 'center', | ||
59 | + }, | ||
60 | + { | ||
61 | + prop: 'isUse', | ||
62 | + label: '是否使用', | ||
63 | + sortable: true, | ||
64 | + align: 'center', | ||
65 | + render: function (row) { | ||
66 | + switch (row.isUse) { | ||
67 | + case 0: | ||
68 | + return '否'; | ||
69 | + case 1: | ||
70 | + return '是'; | ||
71 | + default: | ||
72 | + return ''; | ||
73 | + } | ||
74 | + } | ||
75 | + }, | ||
76 | + { | ||
77 | + prop: 'important', | ||
78 | + label: '重要程度', | ||
79 | + sortable: true, | ||
80 | + align: 'center', | ||
81 | + render: function (row) { | ||
82 | + switch (row.important) { | ||
83 | + case 1: | ||
84 | + return '核心'; | ||
85 | + case 2: | ||
86 | + return '重要'; | ||
87 | + case 3: | ||
88 | + return '一般'; | ||
89 | + case 9: | ||
90 | + return '虚拟业务'; | ||
91 | + default: | ||
92 | + return ''; | ||
93 | + } | ||
94 | + } | ||
95 | + }, | ||
96 | + { | ||
97 | + prop: 'sort', | ||
98 | + label: '排序', | ||
99 | + sortable: true, | ||
100 | + align: 'center', | ||
101 | + }, | ||
102 | + { | ||
103 | + prop: 'showType', | ||
104 | + label: '展示类型', | ||
105 | + sortable: true, | ||
106 | + align: 'center', | ||
107 | + /* render: function (row) { | ||
108 | + | ||
109 | + }*/ | ||
110 | + } | ||
111 | + ]; | ||
112 | + | ||
113 | + //列表数据 | ||
114 | + let resourceData = Vue.ref([]); | ||
115 | + //获取列表数据 | ||
116 | + const getListData = () => { | ||
117 | + resourceData.value=[]; | ||
118 | + loading.value = true; | ||
119 | + //定义列表参数 | ||
120 | + let getParams = { | ||
121 | + resType:search.value.resType, | ||
122 | + keywords:search.value.keyword, | ||
123 | + userName:userName.value, | ||
124 | + page: search.value.page, | ||
125 | + limit: search.value.limit | ||
126 | + }; | ||
127 | + proxy.$http.post("/api-web/personnelChange/getList/bizLeader", getParams, function (res) { | ||
128 | + if (res && res.data) { | ||
129 | + resourceData.value = res.data ? res.data : []; | ||
130 | + count.value = res.count; | ||
131 | + loading.value = false; | ||
132 | + } | ||
133 | + }) | ||
134 | + } | ||
135 | + //重新加载表格数据 | ||
136 | + let loadTableDataList = ({page, limit}) => { | ||
137 | + search.value.page=page; | ||
138 | + search.value.limit=limit; | ||
139 | + getListData(); | ||
140 | + } | ||
141 | + let busIds=Vue.ref('');//选中的ids | ||
142 | + //表格全选事件 | ||
143 | + let selectionChange = (val) => { | ||
144 | + pitch.value = val; | ||
145 | + let arr=[]; | ||
146 | + pitch.value.map(item=>{ | ||
147 | + arr.push(item.busId) | ||
148 | + }) | ||
149 | + busIds.value=arr.join(",");//选中的值 | ||
150 | + /*proxy.resourceData.map((v, i) => { | ||
151 | + v.checked = false; | ||
152 | + }); | ||
153 | + let selectData = val; | ||
154 | + if (selectData.length > 0) { | ||
155 | + selectData.map((item, index) => { | ||
156 | + proxy.resourceData.map((v, i) => { | ||
157 | + if (item.id == v.id) { | ||
158 | + v.checked = true; | ||
159 | + } | ||
160 | + }) | ||
161 | + }) | ||
162 | + } else { | ||
163 | + proxy.resourceData.map((v, i) => { | ||
164 | + v.checked = false; | ||
165 | + }) | ||
166 | + }*/ | ||
167 | + } | ||
168 | + //获取资源类型数据 | ||
169 | + let getResourceTypoe=()=>{ | ||
170 | + proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) { | ||
171 | + if (res && res.data) { | ||
172 | + resTypeOptions.value=res.data | ||
173 | + } | ||
174 | + }) | ||
175 | + } | ||
176 | + //获取展示类型的字典数据 | ||
177 | + let initShowType=()=>{ | ||
178 | + proxy.$http.post("/api-web/manage/ddic/findSucDdics/DETAILS_POWER", {}, function (res) { | ||
179 | + if (res && res.data) { | ||
180 | + let arr=res.data; | ||
181 | + if(arr && arr.length>0){ | ||
182 | + arr.map(v=>{ | ||
183 | + showTypeList.value.push({ | ||
184 | + name: v.ddicName | ||
185 | + ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length) | ||
186 | + }); | ||
187 | + }) | ||
188 | + } | ||
189 | + | ||
190 | + } | ||
191 | + }) | ||
192 | + } | ||
193 | + //批量取消相关资源 | ||
194 | + let changeCancel = () => { | ||
195 | + if(pitch.value.length<1){ | ||
196 | + proxy.$global.showMsg('请至少选择一项','warning'); | ||
197 | + }else{ | ||
198 | + proxy.$global.confirm("确定取消相关资源?", function () { | ||
199 | + let parmas={ | ||
200 | + userName:userName.value, | ||
201 | + busId:busIds.value | ||
202 | + } | ||
203 | + proxy.$http.post(`/api-web/personnelChange/remove/bizLeader`, parmas, function (res) { | ||
204 | + if (res && res.success) { | ||
205 | + proxy.$global.showMsg('取消成功!'); | ||
206 | + getListData() | ||
207 | + } | ||
208 | + }) | ||
209 | + }); | ||
210 | + } | ||
211 | + } | ||
212 | + //变更负责人 | ||
213 | + let changeAdmin = () => { | ||
214 | + if(pitch.value.length<1){ | ||
215 | + proxy.$global.showMsg('请至少选择一项','warning'); | ||
13 | 216 | ||
217 | + }else{ | ||
218 | + show.value=true; | ||
219 | + } | ||
220 | + | ||
221 | + } | ||
222 | + //变更人员的弹框关闭后 | ||
223 | + let hideDialog =(flag)=>{ | ||
224 | + show.value=flag; | ||
225 | + } | ||
226 | + //变更人员的弹框保存后 | ||
227 | + let savebtn =(obj)=>{ | ||
228 | + show.value=false; | ||
229 | + //obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组 | ||
230 | + let targetUserName=''; | ||
231 | + if(obj.selectModel){ | ||
232 | + targetUserName=obj.selectModel.join(',') | ||
233 | + } | ||
234 | + let params={ | ||
235 | + busId:busIds.value, | ||
236 | + targetUserName:targetUserName, | ||
237 | + userName:userName.value, | ||
238 | + } | ||
239 | + proxy.$http.post(`/api-web/personnelChange/update/bizLeader`, params, function (res) { | ||
240 | + if (res && res.success) { | ||
241 | + proxy.$global.showMsg('变更成功!'); | ||
242 | + getListData() | ||
243 | + } | ||
244 | + }) | ||
245 | + } | ||
14 | // 挂载完 | 246 | // 挂载完 |
15 | Vue.onMounted(() => { | 247 | Vue.onMounted(() => { |
248 | + initShowType(); | ||
249 | + getResourceTypoe(); | ||
250 | + getListData(); | ||
16 | }) | 251 | }) |
17 | return { | 252 | return { |
253 | + isMulti, | ||
254 | + isTwoGroup, | ||
255 | + show, | ||
256 | + initShowType, | ||
257 | + showTypeList, | ||
258 | + search, | ||
259 | + resTypeOptions, | ||
260 | + changeCancel, | ||
261 | + count, | ||
262 | + hideDialog, | ||
263 | + savebtn, | ||
264 | + changeAdmin, | ||
265 | + getResourceTypoe, | ||
266 | + | ||
267 | + resourceData, | ||
268 | + columns, | ||
269 | + height, | ||
270 | + loading, | ||
271 | + | ||
272 | + selectionChange, | ||
18 | 273 | ||
274 | + getListData, | ||
275 | + loadTableDataList, | ||
276 | + userName | ||
19 | } | 277 | } |
20 | } | 278 | } |
21 | } | 279 | } |
@@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
30 | </el-row> | 30 | </el-row> |
31 | <el-row class="margin-bottom-50" style="margin-top: 3px"> | 31 | <el-row class="margin-bottom-50" style="margin-top: 3px"> |
32 | <el-col :span="24" class="table-height"> | 32 | <el-col :span="24" class="table-height"> |
33 | - <cm-table-page v-if="resourceData.length>0" :columns="columns" | 33 | + <cm-table-page :columns="columns" |
34 | :dataList="resourceData" | 34 | :dataList="resourceData" |
35 | :total="count" | 35 | :total="count" |
36 | :layout="'total, prev,pager,next,sizes, jumper'" | 36 | :layout="'total, prev,pager,next,sizes, jumper'" |
@@ -108,7 +108,7 @@ export default { | @@ -108,7 +108,7 @@ export default { | ||
108 | let resourceData = Vue.ref([]); | 108 | let resourceData = Vue.ref([]); |
109 | //获取列表数据 | 109 | //获取列表数据 |
110 | const getListData = () => { | 110 | const getListData = () => { |
111 | - resourceData.value=[]; | 111 | + // resourceData.value=[]; |
112 | loading.value = true; | 112 | loading.value = true; |
113 | //定义列表参数 | 113 | //定义列表参数 |
114 | let getParams = { | 114 | let getParams = { |
@@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
30 | </el-row> | 30 | </el-row> |
31 | <el-row class="margin-bottom-50" style="margin-top: 3px"> | 31 | <el-row class="margin-bottom-50" style="margin-top: 3px"> |
32 | <el-col :span="24" class="table-height"> | 32 | <el-col :span="24" class="table-height"> |
33 | - <cm-table-page v-if="resourceData.length>0" :columns="columns" | 33 | + <cm-table-page :columns="columns" |
34 | :dataList="resourceData" | 34 | :dataList="resourceData" |
35 | :total="count" | 35 | :total="count" |
36 | :layout="'total, prev,pager,next,sizes, jumper'" | 36 | :layout="'total, prev,pager,next,sizes, jumper'" |
hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.js
@@ -102,7 +102,7 @@ export default { | @@ -102,7 +102,7 @@ export default { | ||
102 | let resourceData = Vue.ref([]); | 102 | let resourceData = Vue.ref([]); |
103 | //获取列表数据 | 103 | //获取列表数据 |
104 | const getListData = () => { | 104 | const getListData = () => { |
105 | - resourceData.value=[]; | 105 | + // resourceData.value=[]; |
106 | loading.value = true; | 106 | loading.value = true; |
107 | //定义列表参数 | 107 | //定义列表参数 |
108 | let getParams = { | 108 | let getParams = { |
@@ -3,9 +3,9 @@ | @@ -3,9 +3,9 @@ | ||
3 | <div class="condition" > | 3 | <div class="condition" > |
4 | <el-form ref=“form” style="display: flex;"> | 4 | <el-form ref=“form” style="display: flex;"> |
5 | <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | 5 | <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> |
6 | - <el-input v-model="search.keyword" placeholder="请输入资源名称/编码/类别"></el-input> | 6 | + <el-input v-model="search.keyword" placeholder="请输入资源类型"></el-input> |
7 | </el-form-item> | 7 | </el-form-item> |
8 | - <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | 8 | + <!-- <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> |
9 | <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型"> | 9 | <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型"> |
10 | <el-option | 10 | <el-option |
11 | v-for="item in resTypeOptions" | 11 | v-for="item in resTypeOptions" |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | :value="item.resTypeCode"> | 14 | :value="item.resTypeCode"> |
15 | </el-option> | 15 | </el-option> |
16 | </el-select> | 16 | </el-select> |
17 | - </el-form-item> | 17 | + </el-form-item>--> |
18 | <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | 18 | <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> |
19 | <el-button @click="getListData" type="primary">查询</el-button> | 19 | <el-button @click="getListData" type="primary">查询</el-button> |
20 | </el-form-item> | 20 | </el-form-item> |
@@ -45,7 +45,6 @@ | @@ -45,7 +45,6 @@ | ||
45 | :showTools="false" | 45 | :showTools="false" |
46 | :getRowKeys="'resTypeId'" | 46 | :getRowKeys="'resTypeId'" |
47 | :defaultExpand="true" | 47 | :defaultExpand="true" |
48 | - @handleSelect="handleSelect" | ||
49 | :height="(height - 200)"> | 48 | :height="(height - 200)"> |
50 | <template #default="{row,prop,column}"> | 49 | <template #default="{row,prop,column}"> |
51 | <div v-if="prop == 'paramDesc'"> | 50 | <div v-if="prop == 'paramDesc'"> |
@@ -112,6 +112,8 @@ export default { | @@ -112,6 +112,8 @@ export default { | ||
112 | let resourceData = Vue.ref([]); | 112 | let resourceData = Vue.ref([]); |
113 | //获取列表数据 | 113 | //获取列表数据 |
114 | const getListData = () => { | 114 | const getListData = () => { |
115 | + // resourceData.value=[]; | ||
116 | + loading.value = true; | ||
115 | //定义列表参数 | 117 | //定义列表参数 |
116 | let getParams = { | 118 | let getParams = { |
117 | resType:search.value.resType, | 119 | resType:search.value.resType, |
@@ -178,34 +180,18 @@ export default { | @@ -178,34 +180,18 @@ export default { | ||
178 | let loadTableDataList = ({page, limit}) => { | 180 | let loadTableDataList = ({page, limit}) => { |
179 | search.value.page=page; | 181 | search.value.page=page; |
180 | search.value.limit=limit; | 182 | search.value.limit=limit; |
183 | + selectionChange([]) | ||
181 | getListData(); | 184 | getListData(); |
182 | } | 185 | } |
183 | - let resType=Vue.ref('');//选中的ids | 186 | + let resTypeId=Vue.ref('');//选中的ids |
184 | //表格全选事件 | 187 | //表格全选事件 |
185 | let selectionChange = (val) => { | 188 | let selectionChange = (val) => { |
186 | pitch.value = val; | 189 | pitch.value = val; |
187 | let arr=[]; | 190 | let arr=[]; |
188 | pitch.value.map(item=>{ | 191 | pitch.value.map(item=>{ |
189 | - arr.push(item.resType) | 192 | + arr.push(item.resTypeId) |
190 | }) | 193 | }) |
191 | - resType.value=arr.join(",");//选中的值 | ||
192 | - /*proxy.resourceData.map((v, i) => { | ||
193 | - v.checked = false; | ||
194 | - }); | ||
195 | - let selectData = val; | ||
196 | - if (selectData.length > 0) { | ||
197 | - selectData.map((item, index) => { | ||
198 | - proxy.resourceData.map((v, i) => { | ||
199 | - if (item.id == v.id) { | ||
200 | - v.checked = true; | ||
201 | - } | ||
202 | - }) | ||
203 | - }) | ||
204 | - } else { | ||
205 | - proxy.resourceData.map((v, i) => { | ||
206 | - v.checked = false; | ||
207 | - }) | ||
208 | - }*/ | 194 | + resTypeId.value=arr.join(",");//选中的值 |
209 | } | 195 | } |
210 | //勾选数据行的checked | 196 | //勾选数据行的checked |
211 | let handleSelect=(selection)=>{ | 197 | let handleSelect=(selection)=>{ |
@@ -261,7 +247,7 @@ export default { | @@ -261,7 +247,7 @@ export default { | ||
261 | proxy.$global.confirm("确定取消负责的相关资源?", function () { | 247 | proxy.$global.confirm("确定取消负责的相关资源?", function () { |
262 | let parmas={ | 248 | let parmas={ |
263 | userName:userName.value, | 249 | userName:userName.value, |
264 | - resType:resType.value | 250 | + resTypeId:resTypeId.value |
265 | } | 251 | } |
266 | proxy.$http.post(`/api-web/personnelChange/remove/resourceTypePer`, parmas, function (res) { | 252 | proxy.$http.post(`/api-web/personnelChange/remove/resourceTypePer`, parmas, function (res) { |
267 | if (res && res.success) { | 253 | if (res && res.success) { |
@@ -295,7 +281,7 @@ export default { | @@ -295,7 +281,7 @@ export default { | ||
295 | targetUserName=obj.selectModel.join(',') | 281 | targetUserName=obj.selectModel.join(',') |
296 | } | 282 | } |
297 | let params={ | 283 | let params={ |
298 | - resType:resType.value, | 284 | + resTypeId:resTypeId.value, |
299 | targetUserName:targetUserName, | 285 | targetUserName:targetUserName, |
300 | userName:userName.value, | 286 | userName:userName.value, |
301 | } | 287 | } |
@@ -334,7 +320,6 @@ export default { | @@ -334,7 +320,6 @@ export default { | ||
334 | columns, | 320 | columns, |
335 | height, | 321 | height, |
336 | loading, | 322 | loading, |
337 | - | ||
338 | selectionChange, | 323 | selectionChange, |
339 | 324 | ||
340 | getListData, | 325 | getListData, |
1 | +<el-row> | ||
2 | + <el-col :span="24" class="search"> | ||
3 | + <div class="condition" > | ||
4 | + <el-form ref=“form” style="display: flex;"> | ||
5 | + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | ||
6 | + <el-input v-model="search.keyword" placeholder="请输入业务名称"></el-input> | ||
7 | + </el-form-item> | ||
8 | + <!--<el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | ||
9 | + <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型"> | ||
10 | + <el-option | ||
11 | + v-for="item in resTypeOptions" | ||
12 | + :key="item.resTypeCode" | ||
13 | + :label="item.resTypeName" | ||
14 | + :value="item.resTypeCode"> | ||
15 | + </el-option> | ||
16 | + </el-select> | ||
17 | + </el-form-item>--> | ||
18 | + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> | ||
19 | + <el-button @click="getListData" type="primary">查询</el-button> | ||
20 | + </el-form-item> | ||
21 | + </el-form> | ||
22 | + </div> | ||
23 | + </el-col> | ||
24 | +</el-row> | ||
25 | +<el-row style="margin-bottom: 10px;"> | ||
26 | + <div class="flex-div-start"> | ||
27 | + <el-button type="primary" @click="changeCancel()" size="small">取消</el-button> | ||
28 | +<!-- <el-button type="primary" @click="changeAdmin()" size="small" style="margin-left: 6px">变更</el-button>--> | ||
29 | + </div> | ||
30 | +</el-row> | ||
31 | +<el-row class="margin-bottom-50" style="margin-top: 3px"> | ||
32 | + <el-col :span="24" class="table-height"> | ||
33 | + <cm-table-page :columns="columns" | ||
34 | + :dataList="resourceData" | ||
35 | + :total="count" | ||
36 | + :layout="'total, prev,pager,next,sizes, jumper'" | ||
37 | + :pageSize="pageSize" | ||
38 | + @loaddata="loadTableDataList" | ||
39 | + @selectionChange="selectionChange" | ||
40 | + :showIndex="true" | ||
41 | + :showSelection="true" | ||
42 | + :showBorder="true" | ||
43 | + :loading="loading" | ||
44 | + :showPage="true" | ||
45 | + :showTools="false" | ||
46 | + :height="(height - 200)"> | ||
47 | + <template #default="{row,prop,column}"> | ||
48 | + <div v-if="prop == 'paramDesc'"> | ||
49 | + <el-select v-if="row.resType == 'HOST_X86SERVER'" v-model="row.showType" placeholder=""> | ||
50 | + <el-option | ||
51 | + v-for="item in showTypeList" | ||
52 | + :key="item.value" | ||
53 | + :label="item.name" | ||
54 | + :value="item.value" | ||
55 | + > | ||
56 | + </el-option> | ||
57 | + </el-select> | ||
58 | + </div> | ||
59 | + </template> | ||
60 | + </cm-table-page> | ||
61 | + </el-col> | ||
62 | +</el-row> | ||
63 | + | ||
64 | +<ChangeUsersList :show="show" :isTwoGroup="isTwoGroup" :isMulti="isMulti" @hideDialog="hideDialog" @savebtn="savebtn"></ChangeUsersList> |
1 | export default { | 1 | export default { |
2 | - name: 'resourceTypePer', | 2 | + name: 'rolePer', |
3 | template: '', | 3 | template: '', |
4 | components: { | 4 | components: { |
5 | - | 5 | + 'ChangeUsersList': Vue.defineAsyncComponent( |
6 | + () => myImport('views/batchChangeLeaders/changeUsersList/index') | ||
7 | + ), | ||
6 | }, | 8 | }, |
7 | data() { | 9 | data() { |
8 | }, | 10 | }, |
@@ -10,12 +12,205 @@ export default { | @@ -10,12 +12,205 @@ export default { | ||
10 | }, | 12 | }, |
11 | setup: function (props, {attrs, slots, emit}) { | 13 | setup: function (props, {attrs, slots, emit}) { |
12 | const {proxy} = Vue.getCurrentInstance(); | 14 | const {proxy} = Vue.getCurrentInstance(); |
15 | + //接收从用户列表中选中的用户 | ||
16 | + let userName=Vue.ref(proxy.$route.query.username); | ||
17 | + //变更人员弹框 | ||
18 | + let show=Vue.ref(false); | ||
19 | + //变更人员列表是否多选 | ||
20 | + let isMulti=Vue.ref(false); | ||
21 | + //变更人员列表是否是两组 | ||
22 | + let isTwoGroup=Vue.ref(false); | ||
23 | + //配置列表总数 | ||
24 | + let count = Vue.ref(0); | ||
25 | + //列表高度 | ||
26 | + let height = Vue.ref(window.innerHeight); | ||
27 | + //列表分页 | ||
28 | + let limit = Vue.ref(400); | ||
29 | + //加载 | ||
30 | + let loading = Vue.ref(true); | ||
31 | + //选中数据 | ||
32 | + let pitch = Vue.ref([]); | ||
33 | + let showTypeList=Vue.ref([]); | ||
34 | + let search = Vue.ref({ | ||
35 | + resType: '', | ||
36 | + keyword: '', | ||
37 | + page: 1, | ||
38 | + limit: 20, | ||
39 | + }); | ||
40 | + let resTypeOptions=Vue.ref([]) | ||
41 | + const columns = [ | ||
42 | + { | ||
43 | + prop: 'name', | ||
44 | + label: '角色名称', | ||
45 | + sortable: true, | ||
46 | + align: 'center', | ||
47 | + } | ||
48 | + ]; | ||
49 | + | ||
50 | + //列表数据 | ||
51 | + let resourceData = Vue.ref([]); | ||
52 | + //获取列表数据 | ||
53 | + const getListData = () => { | ||
54 | + resourceData.value=[]; | ||
55 | + loading.value = true; | ||
56 | + //定义列表参数 | ||
57 | + let getParams = { | ||
58 | + resType:search.value.resType, | ||
59 | + keywords:search.value.keyword, | ||
60 | + userName:userName.value, | ||
61 | + page: search.value.page, | ||
62 | + limit: search.value.limit | ||
63 | + }; | ||
64 | + proxy.$http.post("/api-web/personnelChange/getList/rolePer", getParams, function (res) { | ||
65 | + if (res && res.data) { | ||
66 | + resourceData.value = res.data ? res.data : []; | ||
67 | + count.value = res.count; | ||
68 | + loading.value = false; | ||
69 | + } | ||
70 | + }) | ||
71 | + } | ||
72 | + //重新加载表格数据 | ||
73 | + let loadTableDataList = ({page, limit}) => { | ||
74 | + search.value.page=page; | ||
75 | + search.value.limit=limit; | ||
76 | + getListData(); | ||
77 | + } | ||
78 | + let roleIds=Vue.ref('');//选中的ids | ||
79 | + //表格全选事件 | ||
80 | + let selectionChange = (val) => { | ||
81 | + pitch.value = val; | ||
82 | + let arr=[]; | ||
83 | + pitch.value.map(item=>{ | ||
84 | + arr.push(item.id) | ||
85 | + }) | ||
86 | + roleIds.value=arr.join(",");//选中的值 | ||
87 | + /*proxy.resourceData.map((v, i) => { | ||
88 | + v.checked = false; | ||
89 | + }); | ||
90 | + let selectData = val; | ||
91 | + if (selectData.length > 0) { | ||
92 | + selectData.map((item, index) => { | ||
93 | + proxy.resourceData.map((v, i) => { | ||
94 | + if (item.id == v.id) { | ||
95 | + v.checked = true; | ||
96 | + } | ||
97 | + }) | ||
98 | + }) | ||
99 | + } else { | ||
100 | + proxy.resourceData.map((v, i) => { | ||
101 | + v.checked = false; | ||
102 | + }) | ||
103 | + }*/ | ||
104 | + } | ||
105 | + //获取资源类型数据 | ||
106 | + let getResourceTypoe=()=>{ | ||
107 | + proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) { | ||
108 | + if (res && res.data) { | ||
109 | + resTypeOptions.value=res.data | ||
110 | + } | ||
111 | + }) | ||
112 | + } | ||
113 | + //获取展示类型的字典数据 | ||
114 | + let initShowType=()=>{ | ||
115 | + proxy.$http.post("/api-web/manage/ddic/findSucDdics/DETAILS_POWER", {}, function (res) { | ||
116 | + if (res && res.data) { | ||
117 | + let arr=res.data; | ||
118 | + if(arr && arr.length>0){ | ||
119 | + arr.map(v=>{ | ||
120 | + showTypeList.value.push({ | ||
121 | + name: v.ddicName | ||
122 | + ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length) | ||
123 | + }); | ||
124 | + }) | ||
125 | + } | ||
13 | 126 | ||
127 | + } | ||
128 | + }) | ||
129 | + } | ||
130 | + //批量取消相关资源 | ||
131 | + let changeCancel = () => { | ||
132 | + if(pitch.value.length<1){ | ||
133 | + proxy.$global.showMsg('请至少选择一项','warning'); | ||
134 | + }else{ | ||
135 | + proxy.$global.confirm("确定取消相关资源?", function () { | ||
136 | + let parmas={ | ||
137 | + userName:userName.value, | ||
138 | + roleId:roleIds.value | ||
139 | + } | ||
140 | + proxy.$http.post(`/api-web/personnelChange/remove/rolePer`, parmas, function (res) { | ||
141 | + if (res && res.success) { | ||
142 | + proxy.$global.showMsg('取消成功!'); | ||
143 | + getListData() | ||
144 | + } | ||
145 | + }) | ||
146 | + }); | ||
147 | + } | ||
148 | + } | ||
149 | + //变更负责人 | ||
150 | + let changeAdmin = () => { | ||
151 | + if(pitch.value.length<1){ | ||
152 | + proxy.$global.showMsg('请至少选择一项','warning'); | ||
153 | + | ||
154 | + }else{ | ||
155 | + show.value=true; | ||
156 | + } | ||
157 | + | ||
158 | + } | ||
159 | + //变更人员的弹框关闭后 | ||
160 | + let hideDialog =(flag)=>{ | ||
161 | + show.value=flag; | ||
162 | + } | ||
163 | + //变更人员的弹框保存后 | ||
164 | + let savebtn =(obj)=>{ | ||
165 | + show.value=false; | ||
166 | + //obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组 | ||
167 | + let targetUserName=''; | ||
168 | + if(obj.selectModel){ | ||
169 | + targetUserName=obj.selectModel.join(',') | ||
170 | + } | ||
171 | + let params={ | ||
172 | + roleId:roleIds.value, | ||
173 | + targetUserName:targetUserName, | ||
174 | + userName:userName.value, | ||
175 | + } | ||
176 | + proxy.$http.post(`/api-web/personnelChange/update/rolePer`, params, function (res) { | ||
177 | + if (res && res.success) { | ||
178 | + proxy.$global.showMsg('变更成功!'); | ||
179 | + getListData() | ||
180 | + } | ||
181 | + }) | ||
182 | + } | ||
14 | // 挂载完 | 183 | // 挂载完 |
15 | Vue.onMounted(() => { | 184 | Vue.onMounted(() => { |
185 | + initShowType(); | ||
186 | + getResourceTypoe(); | ||
187 | + getListData(); | ||
16 | }) | 188 | }) |
17 | return { | 189 | return { |
190 | + isMulti, | ||
191 | + isTwoGroup, | ||
192 | + show, | ||
193 | + initShowType, | ||
194 | + showTypeList, | ||
195 | + search, | ||
196 | + resTypeOptions, | ||
197 | + changeCancel, | ||
198 | + count, | ||
199 | + hideDialog, | ||
200 | + savebtn, | ||
201 | + changeAdmin, | ||
202 | + getResourceTypoe, | ||
203 | + | ||
204 | + resourceData, | ||
205 | + columns, | ||
206 | + height, | ||
207 | + loading, | ||
208 | + | ||
209 | + selectionChange, | ||
18 | 210 | ||
211 | + getListData, | ||
212 | + loadTableDataList, | ||
213 | + userName | ||
19 | } | 214 | } |
20 | } | 215 | } |
21 | } | 216 | } |
-
Please register or login to post a comment