Authored by wangtao
... ... @@ -194,7 +194,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
title: '操作', fixed: 'right', align: 'center',minWidth: 280,
templet: '<div>' +
//lsq 新增变更按钮 2022-05-30
'<button data-username="{{d.username}}" lay-tips="人员相关业务变更" type="button" class="layui-btn layui-btn-xs layui-btn-normal user_batch_change_leaders_btn"><i class="layui-icon layui-icon-edit"></i></button>'+
'<button data-username="{{d.username}}" data-nickname="{{d.nickname}}" lay-tips="人员相关业务变更" type="button" class="layui-btn layui-btn-xs layui-btn-normal user_batch_change_leaders_btn"><i class="layui-icon layui-icon-edit"></i></button>'+
'<button data-id="{{d.id}}" lay-tips="删除" type="button" class="layui-btn layui-btn-xs layui-btn-normal user_delete_btn"><i class="layui-icon layui-icon-delete"></i></button>'+
'<button data-id="{{d.id}}" data-username="{{d.username}}" lay-tips="重置密码" type="button" class="layui-btn layui-btn-xs layui-btn-normal user_pass_btn"><i class="layui-icon layui-icon-password"></i></button>'+
... ... @@ -288,10 +288,10 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
}
//start lsq 人员相关业务批量变更 2022-05-30
$('.user_batch_change_leaders_btn').unbind().on('click',function () {
if ($.inArray('back:user:impower',permissionList) == -1) {
layer.msg('暂无权限',{icon: 7,time:3000})
return false;
}
// if ($.inArray('back:user:impower',permissionList) == -1) {
// layer.msg('暂无权限',{icon: 7,time:3000})
// return false;
// }
let param = {
username: $(this).data('username'),
resName: ''
... ... @@ -305,7 +305,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
urlParams=urlParams.substr(0,urlParams.length-1);
let title=`
<div style="display: flex;justify-content: space-between; align-items: center;">
<span>相关业务批量变更</span>
<span>"`+$(this).data('nickname')+`"相关业务批量变更</span>
<button id="exportBtn" type="button" class="layui-btn layui-btn-sm layui-btn-normal exportBtn">导出</button>
</div>
`;
... ...
<div >
<!-- 表格-->
<el-table :border="showBorder" v-loading="loading" :size="size" ref="multipleTable" @selection-change="handleSelectionChange" :data="dataList" stripe header-row-class-name="tbl-header-class" :height="height"
style="width: 100%;margin: 0px 0px; font-size:13.5px;" :row-key="getRowKeys" :expand-row-keys="expands" :default-expand-all="defaultExpand">
style="width: 100%;margin: 0px 0px; font-size:13.5px;" :row-key="getRowKeys" :expand-row-keys="expands" :default-expand-all="defaultExpand"
@select="handleSelect" @select-all="handleSelectAll"
>
<el-table-column type="expand" v-if="showExpand">
<template #default="scope">
... ...
... ... @@ -155,6 +155,7 @@ export default {
let params = {
page: currentPage.value, limit: pageSize.value
}
proxy.$refs.multipleTable.clearSelection();
emit('loaddata', params)
}
... ... @@ -229,6 +230,49 @@ 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]})){
setChecked(row);
}else{
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)
}
// 挂载完
Vue.onMounted(() => {
//callback();
... ... @@ -245,6 +289,8 @@ export default {
})
return {
handleSelect,
handleSelectAll,
toggleSelection,
handleSelectionChange,
// multipleSelection,
... ...
... ... @@ -14,7 +14,11 @@ let http = {
window.top.location.reload();
//window.top.location.href = localStorage.getItem('loginUrl');
} else {
__global.showMsg("服务异常,请联系管理员!","error");
let text='服务异常,请联系管理员!';
if(xhr.responseJSON.resp_msg){
text=xhr.responseJSON.resp_msg
}
__global.showMsg(text,"error");
}
}catch (e){
}
... ...
<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="search.limit"
@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 == 'showType'">
<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>
... ...
export default {
name: 'resourceTypePer',
name: 'bizLeader',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
... ... @@ -10,12 +12,251 @@ 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(",");//选中的值
}
//获取资源类型数据
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
... ...
... ... @@ -3,7 +3,7 @@
<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="请输入资源名称/ip"></el-input>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型">
... ... @@ -30,11 +30,11 @@
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height">
<cm-table-page :columns="columns"
<cm-table-page :columns="columns"
:dataList="resourceData"
:total="count"
:layout="'total, prev,pager,next,sizes, jumper'"
:pageSize="pageSize"
:pageSize="search.limit"
@loaddata="loadTableDataList"
@selectionChange="selectionChange"
:showIndex="true"
... ... @@ -61,4 +61,4 @@
</el-col>
</el-row>
<ChangeUsersList :show="show" :isTwoGroup="true" :isMulti="isMulti" @hideDialog="hideDialog" @savebtn="savebtn"></ChangeUsersList>
<ChangeUsersList :show="show" :isTwoGroup="isTwoGroup" :isMulti="isMulti" @hideDialog="hideDialog" @savebtn="savebtn"></ChangeUsersList>
... ...
... ... @@ -12,6 +12,8 @@ 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);
//变更人员列表是否多选
... ... @@ -56,8 +58,14 @@ export default {
align: 'center',
},
{
prop: 'admin',
label: '负责人',
prop: 'resMainAdmin',
label: '主负责人',
sortable: true,
align: 'center',
},
{
prop: 'resAuxiliaryAdmin',
label: '辅负责人',
sortable: true,
align: 'center',
},
... ... @@ -100,18 +108,16 @@ export default {
let resourceData = Vue.ref([]);
//获取列表数据
const getListData = () => {
let username=proxy.$route.query.username;
let resName=proxy.$route.query.resName;
loading.value = true;
//定义列表参数
let getParams = {
resType:search.value.resType,
keyword:search.value.keyword,
resName: resName,
userId: username,
keywords:search.value.keyword,
userName:userName.value,
page: search.value.page,
limit: search.value.limit
};
proxy.$http.get("/api-web/manage/resource/getAllResByUser", getParams, function (res) {
proxy.$http.post("/api-web/personnelChange/getList/resourceLeader", getParams, function (res) {
if (res && res.data) {
resourceData.value = res.data ? res.data : [];
count.value = res.count;
... ... @@ -134,7 +140,7 @@ export default {
arr.push(item.resId)
})
resIds.value=arr.join(",");//选中的值
proxy.resourceData.map((v, i) => {
/*proxy.resourceData.map((v, i) => {
v.checked = false;
});
let selectData = val;
... ... @@ -150,7 +156,7 @@ export default {
proxy.resourceData.map((v, i) => {
v.checked = false;
})
}
}*/
}
//获取资源类型数据
let getResourceTypoe=()=>{
... ... @@ -177,19 +183,22 @@ export default {
}
})
}
//批量取消负责的相关资源
//批量取消相关资源
let changeCancel = () => {
if(pitch.value.length<1){
proxy.$global.showMsg('请至少选择一项','warning');
}else{
proxy.$global.confirm("确定取消负责的相关资源?", function () {
proxy.$global.showMsg('取消成功!');
// proxy.$http.get(`/api-web/`, {resIds:resIds.value}, function (res) {
// if (res && res.data) {
// proxy.$global.showMsg('取消成功!');
// getListData()
// }
// })
proxy.$global.confirm("确定取消相关资源?", function () {
let parmas={
userName:userName.value,
resId:resIds.value
}
proxy.$http.post(`/api-web/personnelChange/remove/resourceLeader`, parmas, function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getListData()
}
})
});
}
}
... ... @@ -206,22 +215,26 @@ export default {
//变更人员的弹框关闭后
let hideDialog =(flag)=>{
show.value=flag;
// getListData();
}
//变更人员的弹框保存后
let savebtn =(obj)=>{
show.value=false;
//obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组
let targetUserName='';
if(obj.selectModel){
targetUserName=obj.selectModel.join(',')
}
let params={
resIds:resIds.value,
selectModel:obj.selectModel,
resId:resIds.value,
targetUserName:targetUserName,
userName:userName.value,
}
// proxy.$http.get(`/api-web/`, {}, function (res) {
// if (res && res.data) {
// proxy.$global.showMsg('变更成功!');
// getListData()
// }
// })
proxy.$http.post(`/api-web/personnelChange/update/resourceLeader`, params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
getListData()
}
})
}
// 挂载完
Vue.onMounted(() => {
... ... @@ -253,7 +266,7 @@ export default {
getListData,
loadTableDataList,
userName
}
}
}
\ No newline at end of file
... ...
... ... @@ -3,7 +3,7 @@
<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="请输入资源名称/ip"></el-input>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-select filterable clearable v-model="search.resType" placeholder="请选择资源类型">
... ... @@ -30,11 +30,11 @@
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height">
<cm-table-page :columns="columns"
<cm-table-page :columns="columns"
:dataList="resourceData"
:total="count"
:layout="'total, prev,pager,next,sizes, jumper'"
:pageSize="pageSize"
:pageSize="search.limit"
@loaddata="loadTableDataList"
@selectionChange="selectionChange"
:showIndex="true"
... ...
... ... @@ -12,6 +12,8 @@ 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);
//变更人员列表是否多选
... ... @@ -100,18 +102,17 @@ export default {
let resourceData = Vue.ref([]);
//获取列表数据
const getListData = () => {
let username=proxy.$route.query.username;
let resName=proxy.$route.query.resName;
// resourceData.value=[];
loading.value = true;
//定义列表参数
let getParams = {
resType:search.value.resType,
keyword:search.value.keyword,
resName: resName,
userId: username,
keywords:search.value.keyword,
userName:userName.value,
page: search.value.page,
limit: search.value.limit
};
proxy.$http.get("/api-web/manage/resource/getAllResByUser", getParams, function (res) {
proxy.$http.post("/api-web/personnelChange/getList/resourcePer", getParams, function (res) {
if (res && res.data) {
resourceData.value = res.data ? res.data : [];
count.value = res.count;
... ... @@ -134,7 +135,7 @@ export default {
arr.push(item.resId)
})
resIds.value=arr.join(",");//选中的值
proxy.resourceData.map((v, i) => {
/*proxy.resourceData.map((v, i) => {
v.checked = false;
});
let selectData = val;
... ... @@ -150,7 +151,7 @@ export default {
proxy.resourceData.map((v, i) => {
v.checked = false;
})
}
}*/
}
//获取资源类型数据
let getResourceTypoe=()=>{
... ... @@ -183,13 +184,16 @@ export default {
proxy.$global.showMsg('请至少选择一项','warning');
}else{
proxy.$global.confirm("确定取消相关资源?", function () {
proxy.$global.showMsg('取消成功!');
// proxy.$http.get(`/api-web/`, {resIds:resIds.value}, function (res) {
// if (res && res.data) {
// proxy.$global.showMsg('取消成功!');
// getListData()
// }
// })
let parmas={
userName:userName.value,
resId:resIds.value
}
proxy.$http.post(`/api-web/personnelChange/remove/resourcePer`, parmas, function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getListData()
}
})
});
}
}
... ... @@ -206,22 +210,26 @@ export default {
//变更人员的弹框关闭后
let hideDialog =(flag)=>{
show.value=flag;
// getListData();
}
//变更人员的弹框保存后
let savebtn =(obj)=>{
show.value=false;
//obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组
let targetUserName='';
if(obj.selectModel){
targetUserName=obj.selectModel.join(',')
}
let params={
resIds:resIds.value,
selectModel:obj.selectModel,
resId:resIds.value,
targetUserName:targetUserName,
userName:userName.value,
}
// proxy.$http.get(`/api-web/`, {}, function (res) {
// if (res && res.data) {
// proxy.$global.showMsg('变更成功!');
// getListData()
// }
// })
proxy.$http.post(`/api-web/personnelChange/update/resourcePer`, params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
getListData()
}
})
}
// 挂载完
Vue.onMounted(() => {
... ... @@ -253,7 +261,7 @@ export default {
getListData,
loadTableDataList,
userName
}
}
}
\ No newline at end of file
... ...
... ... @@ -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>
... ... @@ -34,7 +34,7 @@
:dataList="resourceData"
:total="count"
:layout="'total, prev,pager,next,sizes, jumper'"
:pageSize="pageSize"
:pageSize="search.limit"
@loaddata="loadTableDataList"
@selectionChange="selectionChange"
:showIndex="true"
... ... @@ -47,7 +47,7 @@
:defaultExpand="true"
:height="(height - 200)">
<template #default="{row,prop,column}">
<div v-if="prop == 'paramDesc'">
<div v-if="prop == 'showType'">
<el-select v-if="row.resType == 'HOST_X86SERVER'" v-model="row.showType" placeholder="">
<el-option
v-for="item in showTypeList"
... ...
... ... @@ -12,6 +12,8 @@ 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);
//变更人员列表是否多选
... ... @@ -110,22 +112,19 @@ export default {
let resourceData = Vue.ref([]);
//获取列表数据
const getListData = () => {
let username=proxy.$route.query.username;
let resTypeName=proxy.$route.query.resTypeName;
// resourceData.value=[];
loading.value = true;
//定义列表参数
let getParams = {
resType:search.value.resType,
keyword:search.value.keyword,
resTypeName: resTypeName,
userAccount: username,
// page: search.value.page,
// limit: search.value.limit
keywords:search.value.keyword,
userName: userName.value,
page: search.value.page,
limit: search.value.limit
};
proxy.$http.get("/api-web/manage/restype/listAll", getParams, function (res) {
proxy.$http.post("/api-web/personnelChange/getList/resourceTypePer", getParams, function (res) {
if (res && res.data) {
resourceData.value = handleTree(res.data, 'resTypeCode', 'parentId')
console.log("(()",resourceData.value)
count.value = res.count;
loading.value = false;
}else{
... ... @@ -181,34 +180,22 @@ export default {
let loadTableDataList = ({page, limit}) => {
search.value.page=page;
search.value.limit=limit;
selectionChange([])
getListData();
}
let resIds=Vue.ref('');//选中的ids
let resTypeId=Vue.ref('');//选中的ids
//表格全选事件
let selectionChange = (val) => {
pitch.value = val;
let arr=[];
pitch.value.map(item=>{
arr.push(item.resId)
arr.push(item.resTypeId)
})
resIds.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)=>{
console.log("selection",selection)
}
//获取资源类型数据
let getResourceTypoe=()=>{
... ... @@ -258,13 +245,16 @@ export default {
proxy.$global.showMsg('请至少选择一项','warning');
}else{
proxy.$global.confirm("确定取消负责的相关资源?", function () {
proxy.$global.showMsg('取消成功!');
// proxy.$http.get(`/api-web/`, {resIds:resIds.value}, function (res) {
// if (res && res.data) {
// proxy.$global.showMsg('取消成功!');
// getListData()
// }
// })
let parmas={
userName:userName.value,
resTypeId:resTypeId.value
}
proxy.$http.post(`/api-web/personnelChange/remove/resourceTypePer`, parmas, function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getListData()
}
})
});
}
}
... ... @@ -281,22 +271,26 @@ export default {
//变更人员的弹框关闭后
let hideDialog =(flag)=>{
show.value=flag;
// getListData();
}
//变更人员的弹框保存后
let savebtn =(obj)=>{
show.value=false;
//obj.selectModel 选中的用户组(一个/主负责人) obj.selectModelSecond 辅负责人,都是数组
let targetUserName='';
if(obj.selectModel){
targetUserName=obj.selectModel.join(',')
}
let params={
resIds:resIds.value,
selectModel:obj.selectModel,
resTypeId:resTypeId.value,
targetUserName:targetUserName,
userName:userName.value,
}
// proxy.$http.get(`/api-web/`, {}, function (res) {
// if (res && res.data) {
// proxy.$global.showMsg('变更成功!');
// getListData()
// }
// })
proxy.$http.post(`/api-web/personnelChange/update/resourceTypePer`, params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
getListData()
}
})
}
// 挂载完
Vue.onMounted(() => {
... ... @@ -326,12 +320,11 @@ export default {
columns,
height,
loading,
selectionChange,
getListData,
loadTableDataList,
handleSelect
}
}
}
\ No newline at end of file
... ...
<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-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="search.limit"
@loaddata="loadTableDataList"
@selectionChange="selectionChange"
:showIndex="true"
:showSelection="true"
:showBorder="true"
:loading="loading"
:showPage="true"
:showTools="false"
:height="(height - 200)">
<template #default="{row,prop,column}">
</template>
</cm-table-page>
</el-col>
</el-row>
<ChangeUsersList :show="show" :isTwoGroup="isTwoGroup" :isMulti="isMulti" @hideDialog="hideDialog" @savebtn="savebtn"></ChangeUsersList>
... ...
export default {
name: 'resourceTypePer',
name: 'rolePer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
... ... @@ -10,12 +12,153 @@ 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 search = Vue.ref({
resType: '',
keyword: '',
page: 1,
limit: 20,
});
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(",");//选中的值
}
//批量取消相关资源
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(() => {
getListData();
})
return {
isMulti,
isTwoGroup,
show,
search,
changeCancel,
count,
hideDialog,
savebtn,
changeAdmin,
resourceData,
columns,
height,
loading,
selectionChange,
getListData,
loadTableDataList,
userName
}
}
}
\ No newline at end of file
... ...