Authored by 鲁尚清

【#1162】 变更负责人相关业务-资源权限列表页 #3

@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 <el-input v-model="search.keyword" placeholder="请输入关键字"></el-input> 5 <el-input v-model="search.keyword" placeholder="请输入关键字"></el-input>
6 </el-form-item> 6 </el-form-item>
7 <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> 7 <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
8 - <el-select clearable multiple v-model="search.resType" placeholder="请选择资源类型"> 8 + <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型">
9 <el-option 9 <el-option
10 v-for="item in resTypeOptions" 10 v-for="item in resTypeOptions"
11 :key="item.resTypeCode" 11 :key="item.resTypeCode"
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 <cm-table-page :columns="columns" 31 <cm-table-page :columns="columns"
32 :dataList="resourceData" 32 :dataList="resourceData"
33 :total="count" 33 :total="count"
  34 + :layout="'total, prev,pager,next,sizes, jumper'"
34 :pageSize="pageSize" 35 :pageSize="pageSize"
35 @loaddata="loadTableDataList" 36 @loaddata="loadTableDataList"
36 @selectionChange="selectionChange" 37 @selectionChange="selectionChange"
@@ -42,9 +43,17 @@ @@ -42,9 +43,17 @@
42 :showTools="false" 43 :showTools="false"
43 :height="(height - 200)"> 44 :height="(height - 200)">
44 <template #default="{row,prop,column}"> 45 <template #default="{row,prop,column}">
45 - <!-- <div v-if="prop == 'protocolType'">  
46 -  
47 - </div>--> 46 + <div v-if="prop == 'paramDesc'">
  47 + <el-select v-if="row.resType == 'HOST_X86SERVER'" v-model="row.showType" placeholder="">
  48 + <el-option
  49 + v-for="item in showTypeList"
  50 + :key="item.value"
  51 + :label="item.name"
  52 + :value="item.value"
  53 + >
  54 + </el-option>
  55 + </el-select>
  56 + </div>
48 </template> 57 </template>
49 </cm-table-page> 58 </cm-table-page>
50 </el-col> 59 </el-col>
@@ -96,17 +96,15 @@ export default { @@ -96,17 +96,15 @@ export default {
96 align: 'center', 96 align: 'center',
97 render: function (row) { 97 render: function (row) {
98 if(row.resType == 'HOST_X86SERVER'){ 98 if(row.resType == 'HOST_X86SERVER'){
99 - //初始化select内容  
100 - /* var html='<div><select data-resId="'+d.resId+'" data-username="'+username+'" data-index="99" name="showType" class="layui-input user_showType" style="min-width: 150px;display: inline">'; 99 + let span='<span>';
101 showTypeList.value.map((v,i)=>{ 100 showTypeList.value.map((v,i)=>{
102 - if(d.showType == v.value){  
103 - html += '<option value="' + v.value + '" selected>' + v.name + '</option> '  
104 - }else{  
105 - html += '<option value="' + v.value + '">' + v.name + '</option> ' 101 + if(row.showType == v.value){
  102 + span += v.name
106 } 103 }
107 }) 104 })
108 - html+='</select></div>';  
109 - return html;*/ 105 + span+='</span>';
  106 + return span;
  107 +
110 }else{ 108 }else{
111 return ''; 109 return '';
112 } 110 }
@@ -116,19 +114,12 @@ export default { @@ -116,19 +114,12 @@ export default {
116 114
117 //列表数据 115 //列表数据
118 let resourceData = Vue.ref([]); 116 let resourceData = Vue.ref([]);
119 -  
120 - //资源数据  
121 - let resIdArr = Vue.ref([]);  
122 -  
123 -  
124 //获取列表数据 117 //获取列表数据
125 const getListData = () => { 118 const getListData = () => {
126 -  
127 let username=proxy.$route.query.username; 119 let username=proxy.$route.query.username;
128 let resName=proxy.$route.query.resName; 120 let resName=proxy.$route.query.resName;
129 //定义列表参数 121 //定义列表参数
130 let getParams = { 122 let getParams = {
131 - resIds: resIdArr.value.join(','),  
132 resType:search.value.resType, 123 resType:search.value.resType,
133 keyword:search.value.keyword, 124 keyword:search.value.keyword,
134 resName: resName, 125 resName: resName,
@@ -144,10 +135,21 @@ export default { @@ -144,10 +135,21 @@ export default {
144 } 135 }
145 }) 136 })
146 } 137 }
147 - 138 + //重新加载表格数据
  139 + let loadTableDataList = ({page, limit}) => {
  140 + search.value.page=page;
  141 + search.value.limit=limit;
  142 + getListData();
  143 + }
  144 + let resIds=Vue.ref('');//选中的ids
148 //表格全选事件 145 //表格全选事件
149 let selectionChange = (val) => { 146 let selectionChange = (val) => {
150 pitch.value = val; 147 pitch.value = val;
  148 + let arr=[];
  149 + pitch.value.map(item=>{
  150 + arr.push(item.resId)
  151 + })
  152 + resIds.value=arr.join(",");//选中的值
151 proxy.resourceData.map((v, i) => { 153 proxy.resourceData.map((v, i) => {
152 v.checked = false; 154 v.checked = false;
153 }); 155 });
@@ -166,28 +168,47 @@ export default { @@ -166,28 +168,47 @@ export default {
166 }) 168 })
167 } 169 }
168 } 170 }
  171 + //获取资源类型数据
  172 + let getResourceTypoe=()=>{
  173 + proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) {
  174 + if (res && res.data) {
  175 + resTypeOptions.value=res.data
  176 + }
  177 + })
  178 + }
  179 + //获取展示类型的字典数据
  180 + let initShowType=()=>{
  181 + proxy.$http.post("/api-web/manage/ddic/findSucDdics/DETAILS_POWER", {}, function (res) {
  182 + if (res && res.success) {
  183 + let arr=res.data;
  184 + if(arr && arr.length>0){
  185 + arr.map(v=>{
  186 + showTypeList.value.push({
  187 + name: v.ddicName
  188 + ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length)
  189 + });
  190 + })
  191 + }
169 192
  193 + }
  194 + })
  195 + }
170 //批量取消相关资源 196 //批量取消相关资源
171 let changeCancel = () => { 197 let changeCancel = () => {
172 - console.log("123654",pitch.value)  
173 if(pitch.value.length<1){ 198 if(pitch.value.length<1){
174 proxy.$global.showMsg('请至少选择一项','warning'); 199 proxy.$global.showMsg('请至少选择一项','warning');
175 -  
176 }else{ 200 }else{
177 proxy.$global.confirm("确定取消相关资源?", function () { 201 proxy.$global.confirm("确定取消相关资源?", function () {
178 proxy.$global.showMsg('取消成功!'); 202 proxy.$global.showMsg('取消成功!');
179 -  
180 - // proxy.$http.get(`/api-web/alarmsubscribe/exclude/delete/${row.id}`, {}, function (res) { 203 + // proxy.$http.get(`/api-web/`, {resIds:resIds.value}, function (res) {
181 // if (res && res.success) { 204 // if (res && res.success) {
182 // proxy.$global.showMsg('取消成功!'); 205 // proxy.$global.showMsg('取消成功!');
183 // getListData() 206 // getListData()
184 // } 207 // }
185 // }) 208 // })
186 -  
187 }); 209 });
188 } 210 }
189 } 211 }
190 -  
191 //变更负责人 212 //变更负责人
192 let changeAdmin = () => { 213 let changeAdmin = () => {
193 if(pitch.value.length<1){ 214 if(pitch.value.length<1){
@@ -198,14 +219,6 @@ export default { @@ -198,14 +219,6 @@ export default {
198 } 219 }
199 220
200 } 221 }
201 -  
202 - //重新加载表格数据  
203 - let loadTableDataList = ({page, limit}) => {  
204 - search.value.page=page;  
205 - search.value.limit=limit;  
206 - getListData();  
207 - }  
208 -  
209 //变更人员的弹框关闭后 222 //变更人员的弹框关闭后
210 let hideDialog =(flag)=>{ 223 let hideDialog =(flag)=>{
211 show.value=flag; 224 show.value=flag;
@@ -215,37 +228,20 @@ export default { @@ -215,37 +228,20 @@ export default {
215 let savebtn =(obj)=>{ 228 let savebtn =(obj)=>{
216 show.value=false; 229 show.value=false;
217 //obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组 230 //obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组
218 - console.log("&&&",obj)  
219 - getListData();  
220 - }  
221 - //获取资源类型数据  
222 - let getResourceTypoe=()=>{  
223 - proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) {  
224 - if (res && res.data) {  
225 - resTypeOptions.value=res.data  
226 - }  
227 - })  
228 -  
229 - }  
230 - //获取展示类型的字典数据  
231 - let initShowType=()=>{  
232 - proxy.$http.get("/api-web/manage/resource/getAllResByUser", {}, function (res) {  
233 - if (res && res.success) {  
234 - let arr=res.data;  
235 - if(arr && arr.length>0){  
236 - arr.map(v=>{  
237 - showTypeList.value.push({  
238 - name: v.ddicName  
239 - ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length)  
240 - });  
241 - })  
242 - }  
243 -  
244 - }  
245 - }) 231 + let params={
  232 + resIds:resIds.value,
  233 + selectModel:obj.selectModel,
  234 + }
  235 + // proxy.$http.get(`/api-web/`, {}, function (res) {
  236 + // if (res && res.success) {
  237 + // proxy.$global.showMsg('变更成功!');
  238 + // getListData()
  239 + // }
  240 + // })
246 } 241 }
247 // 挂载完 242 // 挂载完
248 Vue.onMounted(() => { 243 Vue.onMounted(() => {
  244 + initShowType();
249 getResourceTypoe(); 245 getResourceTypoe();
250 getListData(); 246 getListData();
251 }) 247 })