From 00c1803e79181f0173c923b70dcd09ff9e217473 Mon Sep 17 00:00:00 2001 From: lushangqing <lushangqing@honggroup.com.cn> Date: Wed, 1 Jun 2022 16:11:48 +0800 Subject: [PATCH] 【#1162】 变更负责人相关业务-资源类型、业务负责人、角色权限接口调用,树表格的父节点选中,子节点也选中 --- hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.js | 46 ++++++++++++++++++++++++++++++++++------------ hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.html | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.js | 262 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.html | 2 +- hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.js | 2 +- hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.html | 2 +- hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.js | 2 +- hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.html | 7 +++---- hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.js | 31 ++++++++----------------------- hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.html | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.js | 199 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 11 files changed, 634 insertions(+), 47 deletions(-) diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.js index 73dad5f..70673b0 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.js +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/components/common/table-page/index.js @@ -229,25 +229,47 @@ export default { return val; } + //设置父节点选中后children也选中 + let setChecked=(row)=>{ + let arr=[]; + if(row.children){ + row.children.map(j=>{ + arr.push(j) + setChecked(j) + }) + } + toggleSelection(arr) + } //勾选数据行的Checkbox事件 let handleSelect=(selection, row)=>{ - if(selection.some(el=>{ return row[props.getRowKeys] ===el[props.getRowKeys]})){ - if(row.children){ - row.children.map(j=>{ - toggleSelection(j) - }) - } + /* if(selection.some(el=>{ return row[props.getRowKeys] ===el[props.getRowKeys]})){ + setChecked(row); }else{ - if(row.children){ - row.children.map(j=>{ - toggleSelection(j) - }) - } - } + setChecked(row); + }*/ + setChecked(row); + emit('handleSelect',selection) } //勾选全选checkbox事件 let handleSelectAll=(selection)=>{ + const isSelect=selection.some(el=>{ + const tableDataIds=props.dataList.map(j=>j[props.getRowKeys]) + return tableDataIds.includes(el.id) + }) + const isCancel=!props.dataList.every(el=>{ + const selectIds=selection.map(j=>j[props.getRowKeys]) + return selectIds.includes(el.id) + }) + if(isSelect){ + setChecked(selection); + } + if(isCancel){ + props.dataList.map(el=>{ + setChecked(el); + }) + } + emit('handleSelectAll',selection) } // 挂载完 diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.html b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.html index e69de29..0255b2b 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.html +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.html @@ -0,0 +1,64 @@ +<el-row> + <el-col :span="24" class="search"> + <div class="condition" > + <el-form ref=“form” style="display: flex;"> + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> + <el-input v-model="search.keyword" placeholder="请输入业务名称"></el-input> + </el-form-item> + <!--<el-form-item style="margin-right: 6px;margin-bottom: 10px;"> + <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型"> + <el-option + v-for="item in resTypeOptions" + :key="item.resTypeCode" + :label="item.resTypeName" + :value="item.resTypeCode"> + </el-option> + </el-select> + </el-form-item>--> + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> + <el-button @click="getListData" type="primary">查询</el-button> + </el-form-item> + </el-form> + </div> + </el-col> +</el-row> +<el-row style="margin-bottom: 10px;"> + <div class="flex-div-start"> +<!-- <el-button type="primary" @click="changeCancel()" size="small">取消</el-button>--> + <el-button type="primary" @click="changeAdmin()" size="small" style="margin-left: 6px">变更</el-button> + </div> +</el-row> +<el-row class="margin-bottom-50" style="margin-top: 3px"> + <el-col :span="24" class="table-height"> + <cm-table-page :columns="columns" + :dataList="resourceData" + :total="count" + :layout="'total, prev,pager,next,sizes, jumper'" + :pageSize="pageSize" + @loaddata="loadTableDataList" + @selectionChange="selectionChange" + :showIndex="true" + :showSelection="true" + :showBorder="true" + :loading="loading" + :showPage="true" + :showTools="false" + :height="(height - 200)"> + <template #default="{row,prop,column}"> + <div v-if="prop == 'paramDesc'"> + <el-select v-if="row.resType == 'HOST_X86SERVER'" v-model="row.showType" placeholder=""> + <el-option + v-for="item in showTypeList" + :key="item.value" + :label="item.name" + :value="item.value" + > + </el-option> + </el-select> + </div> + </template> + </cm-table-page> + </el-col> +</el-row> + +<ChangeUsersList :show="show" :isTwoGroup="isTwoGroup" :isMulti="isMulti" @hideDialog="hideDialog" @savebtn="savebtn"></ChangeUsersList> diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.js index 0c1dfbb..ae826cc 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.js +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/bizLeader/index.js @@ -1,8 +1,10 @@ export default { - name: 'resourceTypePer', + name: 'bizLeader', template: '', components: { - + 'ChangeUsersList': Vue.defineAsyncComponent( + () => myImport('views/batchChangeLeaders/changeUsersList/index') + ), }, data() { }, @@ -10,12 +12,268 @@ export default { }, setup: function (props, {attrs, slots, emit}) { const {proxy} = Vue.getCurrentInstance(); + //接收从用户列表中选中的用户 + let userName=Vue.ref(proxy.$route.query.username); + //变更人员弹框 + let show=Vue.ref(false); + //变更人员列表是否多选 + let isMulti=Vue.ref(false); + //变更人员列表是否是两组 + let isTwoGroup=Vue.ref(false); + //配置列表总数 + let count = Vue.ref(0); + //列表高度 + let height = Vue.ref(window.innerHeight); + //列表分页 + let limit = Vue.ref(400); + //加载 + let loading = Vue.ref(true); + //选中数据 + let pitch = Vue.ref([]); + let showTypeList=Vue.ref([]); + let search = Vue.ref({ + resType: '', + keyword: '', + page: 1, + limit: 20, + }); + let resTypeOptions=Vue.ref([]) + const columns = [ + { + prop: 'busTypeName', + label: '业务类型名称', + sortable: true, + align: 'center', + }, + { + prop: 'admin', + label: '负责人', + sortable: true, + align: 'center', + }, + { + prop: 'busTypeDesc', + label: '业务类型描述', + sortable: true, + align: 'center', + }, + { + prop: 'isUse', + label: '是否使用', + sortable: true, + align: 'center', + render: function (row) { + switch (row.isUse) { + case 0: + return '否'; + case 1: + return '是'; + default: + return ''; + } + } + }, + { + prop: 'important', + label: '重要程度', + sortable: true, + align: 'center', + render: function (row) { + switch (row.important) { + case 1: + return '核心'; + case 2: + return '重要'; + case 3: + return '一般'; + case 9: + return '虚拟业务'; + default: + return ''; + } + } + }, + { + prop: 'sort', + label: '排序', + sortable: true, + align: 'center', + }, + { + prop: 'showType', + label: '展示类型', + sortable: true, + align: 'center', + /* render: function (row) { + + }*/ + } + ]; + + //列表数据 + let resourceData = Vue.ref([]); + //获取列表数据 + const getListData = () => { + resourceData.value=[]; + loading.value = true; + //定义列表参数 + let getParams = { + resType:search.value.resType, + keywords:search.value.keyword, + userName:userName.value, + page: search.value.page, + limit: search.value.limit + }; + proxy.$http.post("/api-web/personnelChange/getList/bizLeader", getParams, function (res) { + if (res && res.data) { + resourceData.value = res.data ? res.data : []; + count.value = res.count; + loading.value = false; + } + }) + } + //重新加载表格数据 + let loadTableDataList = ({page, limit}) => { + search.value.page=page; + search.value.limit=limit; + getListData(); + } + let busIds=Vue.ref('');//选中的ids + //表格全选事件 + let selectionChange = (val) => { + pitch.value = val; + let arr=[]; + pitch.value.map(item=>{ + arr.push(item.busId) + }) + busIds.value=arr.join(",");//选中的值 + /*proxy.resourceData.map((v, i) => { + v.checked = false; + }); + let selectData = val; + if (selectData.length > 0) { + selectData.map((item, index) => { + proxy.resourceData.map((v, i) => { + if (item.id == v.id) { + v.checked = true; + } + }) + }) + } else { + proxy.resourceData.map((v, i) => { + v.checked = false; + }) + }*/ + } + //获取资源类型数据 + let getResourceTypoe=()=>{ + proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) { + if (res && res.data) { + resTypeOptions.value=res.data + } + }) + } + //获取展示类型的字典数据 + let initShowType=()=>{ + proxy.$http.post("/api-web/manage/ddic/findSucDdics/DETAILS_POWER", {}, function (res) { + if (res && res.data) { + let arr=res.data; + if(arr && arr.length>0){ + arr.map(v=>{ + showTypeList.value.push({ + name: v.ddicName + ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length) + }); + }) + } + + } + }) + } + //批量取消相关资源 + let changeCancel = () => { + if(pitch.value.length<1){ + proxy.$global.showMsg('请至少选择一项','warning'); + }else{ + proxy.$global.confirm("确定取消相关资源?", function () { + let parmas={ + userName:userName.value, + busId:busIds.value + } + proxy.$http.post(`/api-web/personnelChange/remove/bizLeader`, parmas, function (res) { + if (res && res.success) { + proxy.$global.showMsg('取消成功!'); + getListData() + } + }) + }); + } + } + //变更负责人 + let changeAdmin = () => { + if(pitch.value.length<1){ + proxy.$global.showMsg('请至少选择一项','warning'); + }else{ + show.value=true; + } + + } + //变更人员的弹框关闭后 + let hideDialog =(flag)=>{ + show.value=flag; + } + //变更人员的弹框保存后 + let savebtn =(obj)=>{ + show.value=false; + //obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组 + let targetUserName=''; + if(obj.selectModel){ + targetUserName=obj.selectModel.join(',') + } + let params={ + busId:busIds.value, + targetUserName:targetUserName, + userName:userName.value, + } + proxy.$http.post(`/api-web/personnelChange/update/bizLeader`, params, function (res) { + if (res && res.success) { + proxy.$global.showMsg('变更成功!'); + getListData() + } + }) + } // 挂载完 Vue.onMounted(() => { + initShowType(); + getResourceTypoe(); + getListData(); }) return { + isMulti, + isTwoGroup, + show, + initShowType, + showTypeList, + search, + resTypeOptions, + changeCancel, + count, + hideDialog, + savebtn, + changeAdmin, + getResourceTypoe, + + resourceData, + columns, + height, + loading, + + selectionChange, + getListData, + loadTableDataList, + userName } } } \ No newline at end of file diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.html b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.html index caa9c2e..06b4132 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.html +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.html @@ -30,7 +30,7 @@ </el-row> <el-row class="margin-bottom-50" style="margin-top: 3px"> <el-col :span="24" class="table-height"> - <cm-table-page v-if="resourceData.length>0" :columns="columns" + <cm-table-page :columns="columns" :dataList="resourceData" :total="count" :layout="'total, prev,pager,next,sizes, jumper'" diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.js index 1978528..e440b30 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.js +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceLeader/index.js @@ -108,7 +108,7 @@ export default { let resourceData = Vue.ref([]); //获取列表数据 const getListData = () => { - resourceData.value=[]; + // resourceData.value=[]; loading.value = true; //定义列表参数 let getParams = { diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.html b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.html index 26a6779..06b4132 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.html +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.html @@ -30,7 +30,7 @@ </el-row> <el-row class="margin-bottom-50" style="margin-top: 3px"> <el-col :span="24" class="table-height"> - <cm-table-page v-if="resourceData.length>0" :columns="columns" + <cm-table-page :columns="columns" :dataList="resourceData" :total="count" :layout="'total, prev,pager,next,sizes, jumper'" diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.js index 4ebd7df..a3b3b1f 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.js +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourcePer/index.js @@ -102,7 +102,7 @@ export default { let resourceData = Vue.ref([]); //获取列表数据 const getListData = () => { - resourceData.value=[]; + // resourceData.value=[]; loading.value = true; //定义列表参数 let getParams = { diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.html b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.html index 609c826..ee09bbf 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.html +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.html @@ -3,9 +3,9 @@ <div class="condition" > <el-form ref=“form” style="display: flex;"> <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> - <el-input v-model="search.keyword" placeholder="请输入资源名称/编码/类别"></el-input> + <el-input v-model="search.keyword" placeholder="请输入资源类型"></el-input> </el-form-item> - <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> + <!-- <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型"> <el-option v-for="item in resTypeOptions" @@ -14,7 +14,7 @@ :value="item.resTypeCode"> </el-option> </el-select> - </el-form-item> + </el-form-item>--> <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> <el-button @click="getListData" type="primary">查询</el-button> </el-form-item> @@ -45,7 +45,6 @@ :showTools="false" :getRowKeys="'resTypeId'" :defaultExpand="true" - @handleSelect="handleSelect" :height="(height - 200)"> <template #default="{row,prop,column}"> <div v-if="prop == 'paramDesc'"> diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.js index c377cc8..b3a02d7 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.js +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/resourceTypePer/index.js @@ -112,6 +112,8 @@ export default { let resourceData = Vue.ref([]); //获取列表数据 const getListData = () => { + // resourceData.value=[]; + loading.value = true; //定义列表参数 let getParams = { resType:search.value.resType, @@ -178,34 +180,18 @@ export default { let loadTableDataList = ({page, limit}) => { search.value.page=page; search.value.limit=limit; + selectionChange([]) getListData(); } - let resType=Vue.ref('');//选中的ids + let resTypeId=Vue.ref('');//选中的ids //表格全选事件 let selectionChange = (val) => { pitch.value = val; let arr=[]; pitch.value.map(item=>{ - arr.push(item.resType) + arr.push(item.resTypeId) }) - resType.value=arr.join(",");//选中的值 - /*proxy.resourceData.map((v, i) => { - v.checked = false; - }); - let selectData = val; - if (selectData.length > 0) { - selectData.map((item, index) => { - proxy.resourceData.map((v, i) => { - if (item.id == v.id) { - v.checked = true; - } - }) - }) - } else { - proxy.resourceData.map((v, i) => { - v.checked = false; - }) - }*/ + resTypeId.value=arr.join(",");//选中的值 } //勾选数据行的checked let handleSelect=(selection)=>{ @@ -261,7 +247,7 @@ export default { proxy.$global.confirm("确定取消负责的相关资源?", function () { let parmas={ userName:userName.value, - resType:resType.value + resTypeId:resTypeId.value } proxy.$http.post(`/api-web/personnelChange/remove/resourceTypePer`, parmas, function (res) { if (res && res.success) { @@ -295,7 +281,7 @@ export default { targetUserName=obj.selectModel.join(',') } let params={ - resType:resType.value, + resTypeId:resTypeId.value, targetUserName:targetUserName, userName:userName.value, } @@ -334,7 +320,6 @@ export default { columns, height, loading, - selectionChange, getListData, diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.html b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.html index e69de29..52ea916 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.html +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.html @@ -0,0 +1,64 @@ +<el-row> + <el-col :span="24" class="search"> + <div class="condition" > + <el-form ref=“form” style="display: flex;"> + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> + <el-input v-model="search.keyword" placeholder="请输入业务名称"></el-input> + </el-form-item> + <!--<el-form-item style="margin-right: 6px;margin-bottom: 10px;"> + <el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型"> + <el-option + v-for="item in resTypeOptions" + :key="item.resTypeCode" + :label="item.resTypeName" + :value="item.resTypeCode"> + </el-option> + </el-select> + </el-form-item>--> + <el-form-item style="margin-right: 6px;margin-bottom: 10px;"> + <el-button @click="getListData" type="primary">查询</el-button> + </el-form-item> + </el-form> + </div> + </el-col> +</el-row> +<el-row style="margin-bottom: 10px;"> + <div class="flex-div-start"> + <el-button type="primary" @click="changeCancel()" size="small">取消</el-button> +<!-- <el-button type="primary" @click="changeAdmin()" size="small" style="margin-left: 6px">变更</el-button>--> + </div> +</el-row> +<el-row class="margin-bottom-50" style="margin-top: 3px"> + <el-col :span="24" class="table-height"> + <cm-table-page :columns="columns" + :dataList="resourceData" + :total="count" + :layout="'total, prev,pager,next,sizes, jumper'" + :pageSize="pageSize" + @loaddata="loadTableDataList" + @selectionChange="selectionChange" + :showIndex="true" + :showSelection="true" + :showBorder="true" + :loading="loading" + :showPage="true" + :showTools="false" + :height="(height - 200)"> + <template #default="{row,prop,column}"> + <div v-if="prop == 'paramDesc'"> + <el-select v-if="row.resType == 'HOST_X86SERVER'" v-model="row.showType" placeholder=""> + <el-option + v-for="item in showTypeList" + :key="item.value" + :label="item.name" + :value="item.value" + > + </el-option> + </el-select> + </div> + </template> + </cm-table-page> + </el-col> +</el-row> + +<ChangeUsersList :show="show" :isTwoGroup="isTwoGroup" :isMulti="isMulti" @hideDialog="hideDialog" @savebtn="savebtn"></ChangeUsersList> diff --git a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.js b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.js index 0c1dfbb..404121a 100644 --- a/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.js +++ b/hg-monitor-web-base/src/main/resources/static/vue3/src/views/batchChangeLeaders/rolePer/index.js @@ -1,8 +1,10 @@ export default { - name: 'resourceTypePer', + name: 'rolePer', template: '', components: { - + 'ChangeUsersList': Vue.defineAsyncComponent( + () => myImport('views/batchChangeLeaders/changeUsersList/index') + ), }, data() { }, @@ -10,12 +12,205 @@ export default { }, setup: function (props, {attrs, slots, emit}) { const {proxy} = Vue.getCurrentInstance(); + //接收从用户列表中选中的用户 + let userName=Vue.ref(proxy.$route.query.username); + //变更人员弹框 + let show=Vue.ref(false); + //变更人员列表是否多选 + let isMulti=Vue.ref(false); + //变更人员列表是否是两组 + let isTwoGroup=Vue.ref(false); + //配置列表总数 + let count = Vue.ref(0); + //列表高度 + let height = Vue.ref(window.innerHeight); + //列表分页 + let limit = Vue.ref(400); + //加载 + let loading = Vue.ref(true); + //选中数据 + let pitch = Vue.ref([]); + let showTypeList=Vue.ref([]); + let search = Vue.ref({ + resType: '', + keyword: '', + page: 1, + limit: 20, + }); + let resTypeOptions=Vue.ref([]) + const columns = [ + { + prop: 'name', + label: '角色名称', + sortable: true, + align: 'center', + } + ]; + + //列表数据 + let resourceData = Vue.ref([]); + //获取列表数据 + const getListData = () => { + resourceData.value=[]; + loading.value = true; + //定义列表参数 + let getParams = { + resType:search.value.resType, + keywords:search.value.keyword, + userName:userName.value, + page: search.value.page, + limit: search.value.limit + }; + proxy.$http.post("/api-web/personnelChange/getList/rolePer", getParams, function (res) { + if (res && res.data) { + resourceData.value = res.data ? res.data : []; + count.value = res.count; + loading.value = false; + } + }) + } + //重新加载表格数据 + let loadTableDataList = ({page, limit}) => { + search.value.page=page; + search.value.limit=limit; + getListData(); + } + let roleIds=Vue.ref('');//选中的ids + //表格全选事件 + let selectionChange = (val) => { + pitch.value = val; + let arr=[]; + pitch.value.map(item=>{ + arr.push(item.id) + }) + roleIds.value=arr.join(",");//选中的值 + /*proxy.resourceData.map((v, i) => { + v.checked = false; + }); + let selectData = val; + if (selectData.length > 0) { + selectData.map((item, index) => { + proxy.resourceData.map((v, i) => { + if (item.id == v.id) { + v.checked = true; + } + }) + }) + } else { + proxy.resourceData.map((v, i) => { + v.checked = false; + }) + }*/ + } + //获取资源类型数据 + let getResourceTypoe=()=>{ + proxy.$http.get(`/api-web/manage/restype/list`, {}, function (res) { + if (res && res.data) { + resTypeOptions.value=res.data + } + }) + } + //获取展示类型的字典数据 + let initShowType=()=>{ + proxy.$http.post("/api-web/manage/ddic/findSucDdics/DETAILS_POWER", {}, function (res) { + if (res && res.data) { + let arr=res.data; + if(arr && arr.length>0){ + arr.map(v=>{ + showTypeList.value.push({ + name: v.ddicName + ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length) + }); + }) + } + } + }) + } + //批量取消相关资源 + let changeCancel = () => { + if(pitch.value.length<1){ + proxy.$global.showMsg('请至少选择一项','warning'); + }else{ + proxy.$global.confirm("确定取消相关资源?", function () { + let parmas={ + userName:userName.value, + roleId:roleIds.value + } + proxy.$http.post(`/api-web/personnelChange/remove/rolePer`, parmas, function (res) { + if (res && res.success) { + proxy.$global.showMsg('取消成功!'); + getListData() + } + }) + }); + } + } + //变更负责人 + let changeAdmin = () => { + if(pitch.value.length<1){ + proxy.$global.showMsg('请至少选择一项','warning'); + + }else{ + show.value=true; + } + + } + //变更人员的弹框关闭后 + let hideDialog =(flag)=>{ + show.value=flag; + } + //变更人员的弹框保存后 + let savebtn =(obj)=>{ + show.value=false; + //obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组 + let targetUserName=''; + if(obj.selectModel){ + targetUserName=obj.selectModel.join(',') + } + let params={ + roleId:roleIds.value, + targetUserName:targetUserName, + userName:userName.value, + } + proxy.$http.post(`/api-web/personnelChange/update/rolePer`, params, function (res) { + if (res && res.success) { + proxy.$global.showMsg('变更成功!'); + getListData() + } + }) + } // 挂载完 Vue.onMounted(() => { + initShowType(); + getResourceTypoe(); + getListData(); }) return { + isMulti, + isTwoGroup, + show, + initShowType, + showTypeList, + search, + resTypeOptions, + changeCancel, + count, + hideDialog, + savebtn, + changeAdmin, + getResourceTypoe, + + resourceData, + columns, + height, + loading, + + selectionChange, + getListData, + loadTableDataList, + userName } } } \ No newline at end of file -- libgit2 0.24.0