Authored by 王涛

Merge branch 'master-500-dev-lushangqing' into 'master-500-dev'

【无】人员关系批量处理功能 #1,【无】部门管理增加业务授权功能-表格高度调整 #2



See merge request !653
Showing 30 changed files with 3422 additions and 4 deletions
... ... @@ -191,8 +191,11 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
}
},
{
title: '操作', fixed: 'right', align: 'center',minWidth: 230,
title: '操作', fixed: 'right', align: 'center',minWidth: 280,
templet: '<div>' +
//lsq 新增变更按钮 2022-05-30
'<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>'+
'<button data-username="{{d.username}}" lay-tips="资源类型授权" type="button" class="layui-btn layui-btn-xs layui-btn-normal user_resType_authorization_btn"><i class="layui-icon layui-icon-app"></i></button>'+
... ... @@ -283,6 +286,39 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
}
})
}
//start lsq 人员相关业务批量变更 2022-05-30
$('.user_batch_change_leaders_btn').unbind().on('click',function () {
let param = {
username: $(this).data('username'),
resName: ''
}
let urlParams='';
for(let key in param){
if(param[key]){
urlParams+=key+'='+param[key]+'&'
}
}
urlParams=urlParams.substr(0,urlParams.length-1);
let title=`
<div style="display: flex;justify-content: space-between; align-items: center;">
<span>"`+$(this).data('nickname')+`"相关业务批量变更</span>
</div>
`;
layer.open({
title: [title, 'font-size:18px;'],
type: 2,
area: ['80%', '90%'],
shadeClose: true,//开启遮罩层
id: 'batch_change_leaders',
content: ['/vue3/index.html#/vue3/batchChangeLeaders?'+urlParams, 'no'],
success:function (layero,index){
},
cancel: function () {
// clearTimeout(obj.lineTimer);
}
});
});
//end lsq 2022-05-30
// 配置默认首页
$('.user-config-default-index').unbind('click').on('click', function () {
var username = $(this).data('username');
... ...
... ... @@ -141,3 +141,10 @@ custom-class="config-dialog"
.margin-top-bottom-10{
margin:10px 0;
}
.tree-table .el-table td.el-table__cell div{
display: flex;
align-items: center;
}
.tree-table .el-table .el-table__cell.is-center div{
justify-content: center;
}+
\ No newline at end of file
... ...
<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">
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">
... ...
... ... @@ -98,10 +98,15 @@ export default {
type: String,
default: 'id'
},
//是否默认展开所有
//默认展开哪
expands:{
type: Array,
default: []
},
//是否默认展开所有行
defaultExpand:{
type:Boolean,
default:false
}
},
data() {
... ... @@ -150,6 +155,7 @@ export default {
let params = {
page: currentPage.value, limit: pageSize.value
}
proxy.$refs.multipleTable.clearSelection();
emit('loaddata', params)
}
... ... @@ -224,6 +230,44 @@ 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)=>{
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();
... ... @@ -240,6 +284,8 @@ export default {
})
return {
handleSelect,
handleSelectAll,
toggleSelection,
handleSelectionChange,
// multipleSelection,
... ...
... ... @@ -126,6 +126,11 @@ const routes = [{
name: 'connectScatter',
component: () => myImport('views/connectScatter/index')
},
{
path: '/vue3/batchChangeLeaders',
name: 'batchChangeLeaders',
component: () => myImport('views/batchChangeLeaders/index')
},
//部门业务关系
{
path: '/vue3/orgBustype',
... ...
<el-row>
<el-col :span="24" class="search">
<div class="condition" style="display: flex;">
<el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
<el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button @click="getList">查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="removeRel">取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeUser">变更</el-button>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height">
<cm-table-page :columns="data.columns"
:dataList="data.tableData"
:treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
:total="data.count"
:pageSize="data.searchParams.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="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
... ...
export default {
name: 'resourceTypePer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
default:{}
}
},
setup: function (props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
//列表高度
let height = Vue.ref(window.innerHeight);
let data = Vue.ref({
searchParams: {
"page": 1,
"limit": 50,
"keywords": "",
"userName": proxy.$route.query.username,
"subId": ""
},
userDialogFlag : false,
count: 0,
columns: [{
prop: "subName",
label: "订阅名称",
width: "250",
sortable: true,
align: 'center'
}, {
prop: "subType",
label: "订阅类型",
width: "120",
sortable: true,
align: 'center',
render: function (row) {
switch (row.subType) {
case '1':
return '告警订阅'
break;
case '2':
return '报表订阅'
break;
case '3':
return '系统通知订阅'
break;
case '4':
return '采集器异常订阅'
break;
}
}
}, {
prop: "subWay",
label: "通知类型",
width: "120",
sortable: true,
align: 'center',
render: function (row) {
switch (row.subWay){
case 'wechat':
return '<div class="iconfont icon-weixin" style="font-size: 22px"></div>'
break;
case 'email':
return '<div class="iconfont icon-youxiang" style="font-size: 22px"></div>'
break;
case 'message':
return '<div class="iconfont icon-duanxinqunfa" style="font-size: 22px"></div>'
break;
}
}
},{
prop: "tempType",
label: "通知说明",
width: "300",
sortable: true,
align: 'center',
render: (d) => {
var sendWay = '';
switch (d.subWay){
case 'wechat':
sendWay = '微信'
break;
case 'email':
sendWay = '邮箱';
break;
case 'message':
sendWay = '短信';
break;
}
var unit = d.sentFrequency && d.sentFrequency.indexOf("?")>0?"":"分钟一次";
return `${sendWay}通知${d.sendTotal}次;频率${d.sentFrequency}${unit}`;
}
}, {
prop: "userTotal",
label: "订阅人数",
sortable: true,
align: 'center'
}, {
prop: "times",
label: "允许通知时间段",
sortable: true,
align: 'center'
}, {
prop: "syncFlag",
label: "同步状态",
sortable: true,
align: 'center',
render: (row) => {
switch (row.syncFlag) {
case '0':
return '未同步'
case '1':
return '已同步';
}
}
}],
tableData: [],
// 表格选中
checkArr:[]
})
const getList = () => {
proxy.$http.post(`/api-web/personnelChange/getList/alarmSubPer`, data.value.searchParams, function (res) {
if (res && res.success) {
let dataVal = data.value;
let list = res.data;
let count = res.count;
dataVal.tableData = list;
dataVal.count = count;
}
})
}
// 展示用户选择
let showUserDialog = (flg) =>{
data.value.userDialogFlag = flg;
}
let saveRel = (obj) =>{
// 获取选中
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
let params = {
targetUserName: obj.selectModel.join(''),
"userName": proxy.$route.query.username,
"subId": arr.join(',')
}
if(params.targetUserName == params.userName){
proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!','warning');
return;
}
proxy.$http.post(`/api-web/personnelChange/update/alarmSubPer`,params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
showUserDialog(false);
// 刷新表格
getList();
}
})
}
// 变更
let changeUser = () =>{
// 获取选中
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
showUserDialog(true);
}
/**
* 取消
*/
let removeRel = () =>{
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
data.value.searchParams.subId = arr.join(',')
proxy.$global.confirm("确定取消相关资源?", function () {
proxy.$http.post(`/api-web/personnelChange/remove/alarmSubPer`, data.value.searchParams , function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getList()
}
})
});
}
//重新加载表格数据
let loadTableDataList = ({page, limit}) => {
let dataVal = data.value;
dataVal.page = page;
dataVal.limit = limit;
getList();
}
// 表格全选事件
let selectionChange = (val) => {
let checkArr = [];
val.map(item => {
checkArr.push(item.subId)
})
data.value.checkArr = checkArr;
let isCheck = (list, checkArr) => {
list.forEach((v, i) => {
v.checked = checkArr.includes(v.subId);
if (v.children) {
isCheck(v.children, checkArr);
}
});
}
isCheck(data.value.tableData, checkArr);
}
// 挂载完
Vue.onMounted(() => {
getList();
})
return {
height,
data,
getList,
changeUser,
showUserDialog,
removeRel,
loadTableDataList,
selectionChange,
saveRel
}
}
}
... ...
<el-row>
<el-col :span="24" class="search">
<div class="condition" style="display: flex;">
<el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
<el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button @click="getList">查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="removeRel">取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeUser">变更</el-button>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height">
<cm-table-page :columns="data.columns"
:dataList="data.tableData"
:treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
:total="data.count"
:pageSize="data.searchParams.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="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
... ...
export default {
name: 'autoPatrolPortPer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
default:{}
}
},
setup: function (props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
//列表高度
let height = Vue.ref(window.innerHeight);
let data = Vue.ref({
searchParams: {
"page": 1,
"limit": 50,
"keywords": "",
"userName": proxy.$route.query.username,
"reportId": ""
},
userDialogFlag: false,
count: 0,
columns: [{
prop: "docName",
label: "文档名称",
width: "300",
sortable: true,
align: 'center'
}, {
prop: "frequencyType",
label: "调度类型",
width: "120",
sortable: true,
align: 'center',
render:(d)=>{
switch (d.frequencyType) {
case 'quarter':
return '季度'
case 'month':
return '每月'
case 'day':
return '每日'
case 'hour':
return '小时'
case 'year':
return '每年'
case 'week':
return '每周'
}
}
}, {
prop: "inspectionType",
label: "报表类型",
width: "100",
sortable: true,
align: 'center',
render: (d) => {
switch (d.reportType) {
case 'yxjk':
return '运行监控'
case 'jkjc':
return '健康检查'
case 'lxwh':
return '例行维护'
case 'gzfx':
return '故障分析'
case 'fxbg':
return '分析报告'
}
}
}, {
prop: "runningFlag",
label: "启用/禁用",
width: "120",
sortable: true,
align: 'center',
render: (d) => {
switch (d.runningFlag) {
case '1':
return '启用'
default :
return '禁用'
}
}
},{
prop: "templatePath",
label: "模板地址",
sortable: true,
align: 'left'
}],
tableData: [],
// 表格选中
checkArr: []
})
const getList = () => {
proxy.$http.post(`/api-web/personnelChange/getList/autoPatrolPortPer`, data.value.searchParams, function (res) {
if (res && res.data) {
let dataVal = data.value;
let list = res.data;
let count = res.count;
dataVal.tableData = list;
dataVal.count = count;
}
})
}
// 展示用户选择
let showUserDialog = (flg) => {
data.value.userDialogFlag = flg;
}
let saveRel = (obj) => {
// 获取选中
let arr = data.value.checkArr;
if (arr.length == 0) {
proxy.$global.showMsg('请至少选择一项', 'warning');
return;
}
let params = {
targetUserName: obj.selectModel.join(''),
"userName": proxy.$route.query.username,
"reportId": arr.join(',')
}
if (params.targetUserName == params.userName) {
proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!', 'warning');
return;
}
proxy.$http.post(`/api-web/personnelChange/update/autoPatrolPortPer`, params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
showUserDialog(false);
// 刷新表格
getList();
}
})
}
// 变更
let changeUser = () => {
// 获取选中
let arr = data.value.checkArr;
if (arr.length == 0) {
proxy.$global.showMsg('请至少选择一项', 'warning');
return;
}
showUserDialog(true);
}
/**
* 取消
*/
let removeRel = () => {
let arr = data.value.checkArr;
if (arr.length == 0) {
proxy.$global.showMsg('请至少选择一项', 'warning');
return;
}
data.value.searchParams.reportId = arr.join(',')
proxy.$global.confirm("确定取消相关资源?", function () {
proxy.$http.post(`/api-web/personnelChange/remove/autoPatrolPortPer`, data.value.searchParams, function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getList()
}
})
});
}
//重新加载表格数据
let loadTableDataList = ({page, limit}) => {
let dataVal = data.value;
dataVal.page = page;
dataVal.limit = limit;
getList();
}
// 表格全选事件
let selectionChange = (val) => {
let checkArr = [];
val.map(item => {
checkArr.push(item.id)
})
data.value.checkArr = checkArr;
let isCheck = (list, checkArr) => {
list.forEach((v, i) => {
v.checked = checkArr.includes(v.id);
if (v.children) {
isCheck(v.children, checkArr);
}
});
}
isCheck(data.value.tableData, checkArr);
}
// 挂载完
Vue.onMounted(() => {
getList();
})
return {
height,
data,
getList,
changeUser,
showUserDialog,
removeRel,
loadTableDataList,
selectionChange,
saveRel
}
}
}
... ...
<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;width: 300px">
<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" >查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeAdmin()" style="margin-left: 6px">变更</el-button>
</el-form-item>
</el-form>
</div>
</el-col>
</el-row>
<!--<el-row style="margin-bottom: 10px;">
<div class="flex-div-start">
&lt;!&ndash; <el-button type="primary" @click="changeCancel()" size="small">取消</el-button>&ndash;&gt;
<el-button type="primary" @click="changeAdmin()" size="small" style="margin-left: 6px">变更</el-button>
</div>
</el-row>-->
<el-row style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</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"
: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: 'bizLeader',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
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 loading = Vue.ref(true);
//选中数据
let pitch = Vue.ref([]);
let showTypeList=Vue.ref([]);
let search = Vue.ref({
resType: '',
keyword: '',
page: 1,
limit: 50,
});
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
}
}
}
... ...
<el-row>
<el-col :span="24" class="search">
<div class="condition" style="display: flex;">
<el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
<el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button @click="getList">查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="removeRel">取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeUser">变更</el-button>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height tree-table">
<cm-table-page :columns="data.columns"
:dataList="data.tableData"
:total="data.count"
:pageSize="data.searchParams.limit"
@loaddata="loadTableDataList"
@selectionChange="selectionChange"
:showIndex="true"
:showSelection="true"
:showBorder="true"
:loading="loading"
:showPage="true"
:showTools="false"
:getRowKeys="'busId'"
:defaultExpand="true"
:height="(height - 200)">
<template #default="{row,prop,column}">
</template>
</cm-table-page>
</el-col>
</el-row>
<ChangeUsersList :show="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
... ...
export default {
name: 'resourceTypePer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
default:{}
}
},
setup: function (props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
//列表高度
let height = Vue.ref(window.innerHeight);
let data = Vue.ref({
searchParams: {
"page": 1,
"limit": 50,
"keywords": "",
"userName": proxy.$route.query.username,
"busId": ""
},
userDialogFlag : false,
count: 0,
columns: [{
prop: "busTypeName",
label: "名称",
width: "250",
sortable: true,
align: 'left'
}, {
prop: "nickname",
label: "负责人",
width: "120",
sortable: true,
align: 'center'
}, {
prop: "busTypeDesc",
label: "业务描述",
width: "200",
sortable: true,
align: 'center'
}, {
prop: "isUse",
label: "是否使用",
sortable: true,
align: 'center',
render: (row) => {
switch (row.isUse) {
case 0:
return '否';
case 1:
return '是';
default:
return '';
}
}
}, {
prop: "important",
label: "重要程度",
sortable: true,
align: 'center',
render: (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'
}],
tableData: [],
// 表格选中
checkArr:[]
})
const getList = () => {
proxy.$http.post(`/api-web/personnelChange/getList/bizPer`, data.value.searchParams, function (res) {
if (res && res.data) {
let dataVal = data.value;
let list = res.data;
let count = res.count;
let tableData = list.filter(function (v) {
if (v.parentId == '0') {
// 获取子节点
let childs = list.filter(function (v1) {
if (v1.parentId != '0' && v1.parentId == v.busId) {
// 获取子节点
return v1;
}
}).sort(function (a, b) {
return a.sort - b.sort
})
v.children = childs;
return v;
}
}).sort(function (a, b) {
return a.sort - b.sort
})
dataVal.tableData = tableData;
dataVal.count = count;
}
})
}
// 展示用户选择
let showUserDialog = (flg) =>{
data.value.userDialogFlag = flg;
}
let saveRel = (obj) =>{
// 获取选中
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
let params = {
targetUserName: obj.selectModel.join(''),
"userName": proxy.$route.query.username,
"busId": arr.join(',')
}
if(params.targetUserName == params.userName){
proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!','warning');
return;
}
proxy.$http.post(`/api-web/personnelChange/update/bizPer`,params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
showUserDialog(false);
// 刷新表格
getList();
}
})
}
// 变更
let changeUser = () =>{
// 获取选中
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
showUserDialog(true);
}
/**
* 取消
*/
let removeRel = () =>{
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
data.value.searchParams.busId = arr.join(',')
proxy.$global.confirm("确定取消相关资源?", function () {
proxy.$http.post(`/api-web/personnelChange/remove/bizPer`, data.value.searchParams , function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getList()
}
})
});
}
//重新加载表格数据
let loadTableDataList = ({page, limit}) => {
let dataVal = data.value;
dataVal.page = page;
dataVal.limit = limit;
getList();
}
// 表格全选事件
let selectionChange = (val) => {
let checkArr = [];
val.map(item => {
checkArr.push(item.busId)
})
data.value.checkArr = checkArr;
let isCheck = (list, checkArr) => {
list.forEach((v, i) => {
v.checked = checkArr.includes(v.busId);
if (v.children) {
isCheck(v.children, checkArr);
}
});
}
isCheck(data.value.tableData, checkArr);
}
// 挂载完
Vue.onMounted(() => {
getList();
})
return {
height,
data,
getList,
changeUser,
showUserDialog,
removeRel,
loadTableDataList,
selectionChange,
saveRel
}
}
}
... ...
<cm-dialog :title="title" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="getUser">
<template v-slot>
<el-row >
<el-col :span="24" class="table-height">
<span v-if="isTwoGroup">主负责人:</span>
<el-select
v-model="selectModel"
:multiple="isMulti"
placeholder="请选择用户"
style="width:80%"
clearable
filterable
>
<el-option
v-for="item in userList"
:key="item.username"
:label="item.nickname"
:value="item.username"
>
<div >
<span>{{item.orgName}}/{{item.nickname}}</span>
</div>
</el-option>
</el-select>
</el-col>
</el-row>
<el-row v-if="isTwoGroup" style="margin-top:10px;">
<el-col :span="24">
<span>辅负责人:</span>
<el-select
v-model="selectModelSecond"
multiple
placeholder="请选择用户"
style="width:80%"
clearable
filterable
>
<el-option
v-for="item in userListSecond"
:key="item.username"
:label="item.nickname"
:value="item.username"
>
<div >
<span>{{item.orgName}}/{{item.nickname}}</span>
</div>
</el-option>
</el-select>
</el-col>
</el-row>
</template>
</cm-dialog>
\ No newline at end of file
... ...
export default {
name: 'changeUsersList',
template: '',
components: {
},
data() {
},
props: {
title: {
type: String,
default: '用户列表'
},
show:{
type:Boolean,
default: false
},
//是否为多选
isMulti:{
type:Boolean,
default:false
},
//如果是主/辅负责人时为true
isTwoGroup:{
type:Boolean,
default:false
}
},
setup: function (props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
let height=Vue.ref(window.innerHeight);
let selectModel=Vue.ref([]);
let selectModelSecond=Vue.ref([]);
let hidedialog = () => {
emit('hideDialog', false);
}
let getUser = () =>{
let obj={}
let arr=[];
if(props.isMulti){
arr=selectModel.value
}else{
arr=[selectModel.value];
}
if(props.isTwoGroup){
obj={
selectModel: arr,
selectModelSecond: selectModelSecond.value
}
}else{
obj={
selectModel: arr,
}
}
emit('savebtn', obj);
}
let search=Vue.ref({
username:'',
nickname:'',
enabled:'',
orgId:'',
roles:'',
limit:999999,
page:1
})
let userList=Vue.ref([]);
let userListSecond=Vue.ref([]);
let count=Vue.ref(0);
//获取所有用户
let getAllUser = () =>{
proxy.$http.get('/api-user/users', search.value, function (res) {
if (res && res.data) {
userList.value=res.data;
userListSecond.value=res.data;
count.value=res.count;
}
})
}
// 挂载完
Vue.onMounted(() => {
getAllUser();
})
return {
selectModel,
height,
selectModelSecond,
getAllUser,
userList,
userListSecond,
count,
hidedialog,
getUser,
search
}
}
}
\ No newline at end of file
... ...
<el-row>
<el-col :span="24" class="search">
<div class="condition" style="display: flex;">
<el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
<el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button @click="getList">查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="removeRel">取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeUser">变更</el-button>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height">
<cm-table-page :columns="data.columns"
:dataList="data.tableData"
:treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
:total="data.count"
:pageSize="data.searchParams.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="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
... ...
export default {
name: 'fileManagePer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
default:{}
}
},
setup: function (props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
//列表高度
let height = Vue.ref(window.innerHeight);
let data = Vue.ref({
searchParams: {
"page": 1,
"limit": 50,
"keywords": "",
"userName": proxy.$route.query.username,
"docId": ""
},
userDialogFlag: false,
count: 0,
columns: [{
prop: "name",
label: "名称",
width: "350",
sortable: true,
align: 'center'
}, {
prop: "docNo",
label: "文档编号",
width: "100",
sortable: true,
align: 'center'
}, {
prop: "createUserName",
label: "创建用户",
width: "100",
sortable: true,
align: 'center'
}, {
prop: "localPath",
label: "文档地址",
sortable: true,
align: 'left'
}],
tableData: [],
// 表格选中
checkArr: []
})
const getList = () => {
proxy.$http.post(`/api-web/personnelChange/getList/fileManagePer`, data.value.searchParams, function (res) {
if (res && res.data) {
let dataVal = data.value;
let list = res.data;
let count = res.count;
dataVal.tableData = list;
dataVal.count = count;
}
})
}
// 展示用户选择
let showUserDialog = (flg) => {
data.value.userDialogFlag = flg;
}
let saveRel = (obj) => {
// 获取选中
let arr = data.value.checkArr;
if (arr.length == 0) {
proxy.$global.showMsg('请至少选择一项', 'warning');
return;
}
let params = {
targetUserName: obj.selectModel.join(''),
"userName": proxy.$route.query.username,
"docId": arr.join(',')
}
if (params.targetUserName == params.userName) {
proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!', 'warning');
return;
}
proxy.$http.post(`/api-web/personnelChange/update/fileManagePer`, params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
showUserDialog(false);
// 刷新表格
getList();
}
})
}
// 变更
let changeUser = () => {
// 获取选中
let arr = data.value.checkArr;
if (arr.length == 0) {
proxy.$global.showMsg('请至少选择一项', 'warning');
return;
}
showUserDialog(true);
}
/**
* 取消
*/
let removeRel = () => {
let arr = data.value.checkArr;
if (arr.length == 0) {
proxy.$global.showMsg('请至少选择一项', 'warning');
return;
}
data.value.searchParams.docId = arr.join(',')
proxy.$global.confirm("确定取消相关资源?", function () {
proxy.$http.post(`/api-web/personnelChange/remove/fileManagePer`, data.value.searchParams, function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getList()
}
})
});
}
//重新加载表格数据
let loadTableDataList = ({page, limit}) => {
let dataVal = data.value;
dataVal.page = page;
dataVal.limit = limit;
getList();
}
// 表格全选事件
let selectionChange = (val) => {
let checkArr = [];
val.map(item => {
checkArr.push(item.id)
})
data.value.checkArr = checkArr;
let isCheck = (list, checkArr) => {
list.forEach((v, i) => {
v.checked = checkArr.includes(v.id);
if (v.children) {
isCheck(v.children, checkArr);
}
});
}
isCheck(data.value.tableData, checkArr);
}
// 挂载完
Vue.onMounted(() => {
getList();
})
return {
height,
data,
getList,
changeUser,
showUserDialog,
removeRel,
loadTableDataList,
selectionChange,
saveRel
}
}
}
... ...
<div class="batchChange-container" style="padding:10px;">
<el-row >
<el-col :span="22">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane v-for="(item,index) in tabData" :key="index" :label="item.ddicName" :name="item.ddicCode">
</el-tab-pane>
</el-tabs>
</el-col>
<el-col :span="2">
<div style="padding:0 10px 6px;border-bottom: 2px solid var(--el-border-color-light);">
<el-button type="primary" @click="exportClick()" size="small" style="margin-left: 6px">导出</el-button>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<component :is="activeName" :item="itemInfo" ref="roomDetail" />
</el-col>
</el-row>
</div>
<cm-dialog :title="title" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="okExport">
<template v-slot>
<el-row>
<el-col :span="24">
<el-radio-group v-model="isAll">
<el-radio :label="1">导出全部</el-radio>
<el-radio :label="0">导出部分</el-radio>
</el-radio-group>
</el-col>
</el-row>
<el-row v-if="isAll==0">
<el-col :span="24" class="table-height">
<el-select
v-model="selectModel"
placeholder="请选择需要导出的页签"
multiple
style="width:80%"
clearable
filterable>
<el-option
v-for="item in tabData"
:key="item.ddicCode"
:label="item.ddicName"
:value="item.ddicCode"
/>
</el-select>
</el-col>
</el-row>
</template>
</cm-dialog>
... ...
export default {
name: 'batchChangeLeaders',
template: '',
components: {
//选项卡组件
'resourcePer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/resourcePer/index')
),
'resourceLeader': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/resourceLeader/index')
),
'resourceTypePer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/resourceTypePer/index')
),
'bizPer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/bizPer/index')
),
'bizLeader': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/bizLeader/index')
),
'alarmSubPer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/alarmSubPer/index')
),
'rolePer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/rolePer/index')
),
'topoPer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/topoPer/index')
),
'autoPatrolPortPer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/autoPatrolPortPer/index')
),
'fileManagePer': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/fileManagePer/index')
),
},
data() {
},
props: {
},
setup: function (props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
const tabData=Vue.ref();//页签列表数据
const activeName = Vue.ref('');//标签页显示的页签名称
let itemInfo = Vue.ref({});
let selectModel=Vue.ref([]);//导出列表选中的数据
let title=Vue.ref('导出列表');//导出列表弹框名称
let show=Vue.ref(false);//导出列表弹框是否显示
let isAll=Vue.ref(1);//导出全部或者部分
//页签点击事件
const handleClick = (tab, event) => {
//console.log(tab, event)
let code = tab.props.name;
tabData.value.filter((item) =>{
if(item.ddicCode == code) {
itemInfo.value = item;
}
})
}
//导出点击事件
const exportClick=()=>{
show.value=true;
}
//导出全部按钮点击事件
const clickAll=()=>{
let arr=[];
tabData.value.map(item=>{
arr.push(item.ddicCode)
})
selectModel.value=arr;
}
//导出弹框关闭事件
let hidedialog=(flag)=>{
show.value=flag;
}
//导出弹框确认事件
let okExport=()=>{
let params={
userName:proxy.$route.query.username,
}
if(isAll.value==0){
if(selectModel.value && selectModel.value.length>0){
params.code=selectModel.value.join(',');
}else{
proxy.$global.showMsg('请选择导出所需列表','warning');
return;
}
}else{
params.code='';
}
proxy.$http.downloadFile("/api-web/personnelChange/export", params);
}
//获取需变更的选项卡数据
let getBatchChangeData=()=>{
proxy.$http.post("/api-web/manage/ddic/findSucDdics/batch_change_leaders", {}, function (res) {
if (res && res.data && res.data.length>0) {
tabData.value = res.data.sort((a,b)=>a.ddicSort-b.ddicSort);
activeName.value=tabData.value[0].ddicCode;
itemInfo.value = tabData.value[0];
}
})
}
// 挂载完
Vue.onMounted(() => {
getBatchChangeData();
})
return {
getBatchChangeData,
activeName,
handleClick,
tabData,
selectModel,
title,
show,
exportClick,
hidedialog,
okExport,
clickAll,
isAll,
itemInfo
}
}
}
... ...
<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;width: 300px">
<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="请选择资源类型">
<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">查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeCancel()" >取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeAdmin()" style="margin-left: 6px">变更</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 style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</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"
: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 == '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>
... ...
export default {
name: 'resourceLeader',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
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 loading = Vue.ref(true);
//选中数据
let pitch = Vue.ref([]);
let showTypeList=Vue.ref([]);
let search = Vue.ref({
resType: '',
keyword: '',
page: 1,
limit: 50,
});
let resTypeOptions=Vue.ref([])
const columns = [
{
prop: 'resName',
label: '资源名称',
sortable: true,
align: 'center',
render: function (row) {
if(!row.resName){
return row.resCode;
}
return row.resName;
}
},
{
prop: 'ip',
label: 'IP地址',
sortable: true,
align: 'center',
},
{
prop: 'port',
label: '端口号',
sortable: true,
align: 'center',
},
{
prop: 'resMainAdmin',
label: '负责人',
sortable: true,
align: 'center',
render: function (row) {
let text = "";
let preFix = "";
if(row.resMainAdmin && row.resMainAdmin.includes(userName.value)){
// 主要负责人
text = row.resMainAdmin
preFix = "主";
} else {
// 辅负责人
text = row.resAuxiliaryAdmin
preFix = "辅";
}
return `<div style="display: flex">
<div style='width: 22px;height: 22px;border-radius: 50%;line-height: 22px;border: solid 1px #5fafff;font-size: 12px;font-weight: bold;margin-right: 3px'>
${preFix}
</div>
${text}
</div>`;
}
},
{
prop: 'resTypeName',
label: '资源类型',
sortable: true,
align: 'center',
},
{
prop: 'state',
label: '资源状态',
sortable: true,
align: 'center',
render: function (row) {
switch (row.state) {
case "new" :
return '<span style="background-color: #eee;color:#666;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">未监控</span>'
case "monitor" :
return '<span style="background-color: #0BAC33;color:#fff;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">监控中</span>'
case "stop" :
return '<span style="background-color: #d81e06;color:#fff;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">暂停</span>'
default :
return '<span style="background-color: #eee;color:#666;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">未监控</span>'
}
}
},
{
prop: 'resCategory',
label: '资源分类',
sortable: true,
align: 'center',
/* render: function (row) {
}*/
}
];
//列表数据
let resourceData = Vue.ref([]);
//获取列表数据
const getListData = () => {
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/resourceLeader", 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 resIds=Vue.ref('');//选中的ids
//表格全选事件
let selectionChange = (val) => {
pitch.value = val;
let arr=[];
pitch.value.map(item=>{
arr.push(item.resId)
})
resIds.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,
resId:resIds.value
}
proxy.$http.post(`/api-web/personnelChange/remove/resourceLeader`, 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={
resId:resIds.value,
targetUserName:targetUserName,
userName:userName.value,
}
proxy.$http.post(`/api-web/personnelChange/update/resourceLeader`, 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
}
}
}
... ...
<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;width: 300px">
<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="请选择资源类型">
<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" >查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeCancel()">取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeAdmin()" style="margin-left: 6px">变更</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 style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</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"
: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 == '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>
... ...
export default {
name: 'resourcePer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
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 loading = Vue.ref(true);
//选中数据
let pitch = Vue.ref([]);
let showTypeList=Vue.ref([]);
let search = Vue.ref({
resType: '',
keyword: '',
page: 1,
limit: 50,
});
let resTypeOptions=Vue.ref([])
const columns = [
{
prop: 'resName',
label: '资源名称',
sortable: true,
align: 'center',
},
{
prop: 'ip',
label: 'IP地址',
sortable: true,
align: 'center',
},
{
prop: 'port',
label: '端口号',
sortable: true,
align: 'center',
},
{
prop: 'admin',
label: '负责人',
sortable: true,
align: 'center',
},
{
prop: 'resTypeName',
label: '资源类型',
sortable: true,
align: 'center',
},
{
prop: 'state',
label: '资源状态',
sortable: true,
align: 'center',
render: function (row) {
switch (row.state) {
case "new" :
return '<span style="background-color: #eee;color:#666;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">未监控</span>'
case "monitor" :
return '<span style="background-color: #0BAC33;color:#fff;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">监控中</span>'
case "stop" :
return '<span style="background-color: #d81e06;color:#fff;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">暂停</span>'
default :
return '<span style="background-color: #eee;color:#666;border-radius: 100px;padding:0 8px;display: inline-block;height:24px;line-height: 24px;">未监控</span>'
}
}
},
{
prop: 'paramDesc',
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/resourcePer", 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 resIds=Vue.ref('');//选中的ids
//表格全选事件
let selectionChange = (val) => {
pitch.value = val;
let arr=[];
pitch.value.map(item=>{
arr.push(item.resId)
})
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;
})
}*/
}
//获取资源类型数据
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,
resId:resIds.value
}
proxy.$http.post(`/api-web/personnelChange/remove/resourcePer`, 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={
resId:resIds.value,
targetUserName:targetUserName,
userName:userName.value,
}
proxy.$http.post(`/api-web/personnelChange/update/resourcePer`, 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
}
}
}
... ...
<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;width: 300px">
<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">查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeCancel()" >取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeAdmin()" style="margin-left: 6px">变更</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 style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height tree-table">
<cm-table-page :columns="columns"
:dataList="resourceData"
:total="count"
:pageSize="search.limit"
@loaddata="loadTableDataList"
@selectionChange="selectionChange"
:showIndex="true"
:showSelection="true"
:showBorder="true"
:loading="loading"
:showPage="true"
:showTools="false"
:getRowKeys="'resTypeId'"
:defaultExpand="true"
: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',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
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 loading = Vue.ref(true);
//选中数据
let pitch = Vue.ref([]);
//展示类型
let showTypeList=Vue.ref([]);
//采集类型
let ddicCollType = Vue.ref([]);
let search = Vue.ref({
resType: '',
keyword: '',
page: 1,
limit: 50,
});
let resTypeOptions=Vue.ref([])
const columns = [
{
prop: 'resTypeName',
label: '资源类型名称',
sortable: true,
align: 'center',
},
{
prop: 'resTypeCode',
label: '编码',
sortable: true,
align: 'center',
},
{
prop: 'resTypeDesc',
label: '类别',
sortable: true,
align: 'center',
},
{
prop: 'collType',
label: '采集类型',
sortable: true,
align: 'center',
render: function (row) {
let collType='';
ddicCollType.value.map(item=>{
if(row.collType==item.value){
collType=item.name
}
})
return collType;
}
},
{
prop: 'forbidden',
label: '是否启用',
sortable: true,
align: 'center',
render: function (row) {
let str='';
if(row.forbidden==0){
str='启用';
}else{
str='禁用';
}
return str;
}
},
{
prop: 'showType',
label: '展示类型',
sortable: true,
align: 'center',
/* render: function (row) {
}*/
},
{
prop: 'createTime',
label: '创建时间',
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/resourceTypePer", getParams, function (res) {
if (res && res.data) {
resourceData.value = handleTree(res.data, 'resTypeCode', 'parentId')
count.value = res.count;
loading.value = false;
}else{
resourceData.value=[];
}
})
}
//组装树结构
let handleTree=(data, id, parentId, children)=> {
let config = {
id: id || 'id',
parentId: parentId || 'parentId',
childrenList: children || 'children'
};
var childrenListMap = {};
var nodeIds = {};
var tree = [];
for (let d of data) {
let parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
}
for (let d of data) {
let parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
tree.push(d);
}
}
for (let t of tree) {
adaptToChildrenList(t);
}
function adaptToChildrenList(o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
}
if (o[config.childrenList]) {
for (let c of o[config.childrenList]) {
adaptToChildrenList(c);
}
}
}
return tree;
}
//重新加载表格数据
let loadTableDataList = ({page, limit}) => {
search.value.page=page;
search.value.limit=limit;
selectionChange([])
getListData();
}
let resTypeId=Vue.ref('');//选中的ids
//表格全选事件
let selectionChange = (val) => {
pitch.value = val;
let arr=[];
pitch.value.map(item=>{
arr.push(item.resTypeId)
})
resTypeId.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 initCollType=()=>{
proxy.$http.post("/api-web/manage/ddic/findSucDdics/collType", {}, function (res) {
if (res && res.data) {
let arr=res.data;
if(arr && arr.length>0){
arr.map(v=>{
ddicCollType.value.push({
name: v.ddicName
,value: v.ddicCode
});
})
}
}
})
}
//批量取消负责的相关资源
let changeCancel = () => {
if(pitch.value.length<1){
proxy.$global.showMsg('请至少选择一项','warning');
}else{
proxy.$global.confirm("确定取消负责的相关资源?", function () {
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()
}
})
});
}
}
//变更负责人
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={
resTypeId:resTypeId.value,
targetUserName:targetUserName,
userName:userName.value,
}
proxy.$http.post(`/api-web/personnelChange/update/resourceTypePer`, params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
getListData()
}
})
}
// 挂载完
Vue.onMounted(() => {
initShowType();
initCollType();
getResourceTypoe();
getListData();
})
return {
isMulti,
isTwoGroup,
show,
initShowType,
initCollType,
showTypeList,
ddicCollType,
search,
resTypeOptions,
changeCancel,
count,
hideDialog,
savebtn,
changeAdmin,
getResourceTypoe,
resourceData,
columns,
height,
loading,
selectionChange,
getListData,
loadTableDataList,
}
}
}
... ...
<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;width: 300px">
<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" >查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeCancel()" >取消</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>
&lt;!&ndash; <el-button type="primary" @click="changeAdmin()" size="small" style="margin-left: 6px">变更</el-button>&ndash;&gt;
</div>
</el-row>-->
<el-row style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</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"
: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: 'rolePer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
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 loading = Vue.ref(true);
//选中数据
let pitch = Vue.ref([]);
let search = Vue.ref({
resType: '',
keyword: '',
page: 1,
limit: 50,
});
const columns = [
{
prop: 'name',
label: '角色名称',
sortable: true,
align: 'center',
},
{
prop: 'code',
label: '角色编码',
sortable: true,
align: 'center',
},
{
prop: 'remark',
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
}
}
}
... ...
<el-row>
<el-col :span="24" class="search">
<div class="condition" style="display: flex;">
<el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
<el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button @click="getList">查询</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="removeRel">取消</el-button>
</el-form-item>
<el-form-item style="margin-right: 6px;margin-bottom: 10px;">
<el-button type="primary" @click="changeUser">变更</el-button>
</el-form-item>
</div>
</el-col>
</el-row>
<el-row style="font-size: 12px;color: grey;padding: 6px;">
{{item.ddicDesc}}
</el-row>
<el-row class="margin-bottom-50" style="margin-top: 3px">
<el-col :span="24" class="table-height">
<cm-table-page :columns="data.columns"
:dataList="data.tableData"
:treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
:total="data.count"
:pageSize="data.searchParams.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="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
... ...
export default {
name: 'resourceTypePer',
template: '',
components: {
'ChangeUsersList': Vue.defineAsyncComponent(
() => myImport('views/batchChangeLeaders/changeUsersList/index')
),
},
data() {
},
props: {
item:{
type:Object,
default:{}
}
},
setup: function (props, {attrs, slots, emit}) {
const {proxy} = Vue.getCurrentInstance();
//列表高度
let height = Vue.ref(window.innerHeight);
let data = Vue.ref({
searchParams: {
"page": 1,
"limit": 50,
"keywords": "",
"userName": proxy.$route.query.username,
"jtopoId": ""
},
userDialogFlag : false,
count: 0,
columns: [{
prop: "topoName",
label: "名称",
width: "250",
sortable: true,
align: 'center'
},
{
prop: "isDefault",
label: "默认状态",
sortable: true,
align: 'center',
render: (row) => {
//1是默认,0为非默认
switch (row.isDefault) {
case 0:
return '非默认';
case 1:
return '默认';
default:
return '';
}
}
}, {
prop: "createUser",
label: "创建人",
sortable: true,
align: 'center',
}, {
prop: "createTime",
label: "创建时间",
sortable: true,
align: 'center'
}, {
prop: "remark",
label: "备注",
sortable: true,
align: 'center'
}],
tableData: [],
// 表格选中
checkArr:[]
})
const getList = () => {
proxy.$http.post(`/api-web/personnelChange/getList/topoPer`, data.value.searchParams, function (res) {
if (res && res.data) {
let dataVal = data.value;
let list = res.data;
let count = res.count;
let tableData = list.filter(function (v) {
if (v.parentId == '0') {
// 获取子节点
let childs = list.filter(function (v1) {
if (v1.parentId != '0' && v1.parentId == v.jtopoId) {
// 获取子节点
return v1;
}
}).sort(function (a, b) {
return a.sort - b.sort
})
v.children = childs;
return v;
}
}).sort(function (a, b) {
return a.sort - b.sort
})
dataVal.tableData = list;
dataVal.count = count;
}
})
}
// 展示用户选择
let showUserDialog = (flg) =>{
data.value.userDialogFlag = flg;
}
let saveRel = (obj) =>{
// 获取选中
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
let params = {
targetUserName: obj.selectModel.join(''),
"userName": proxy.$route.query.username,
"jtopoId": arr.join(',')
}
if(params.targetUserName == params.userName){
proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!','warning');
return;
}
proxy.$http.post(`/api-web/personnelChange/update/topoPer`,params, function (res) {
if (res && res.success) {
proxy.$global.showMsg('变更成功!');
showUserDialog(false);
// 刷新表格
getList();
}
})
}
// 变更
let changeUser = () =>{
// 获取选中
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
showUserDialog(true);
}
/**
* 取消
*/
let removeRel = () =>{
let arr = data.value.checkArr;
if(arr.length == 0){
proxy.$global.showMsg('请至少选择一项','warning');
return;
}
data.value.searchParams.jtopoId = arr.join(',')
proxy.$global.confirm("确定取消相关资源?", function () {
proxy.$http.post(`/api-web/personnelChange/remove/topoPer`, data.value.searchParams , function (res) {
if (res && res.success) {
proxy.$global.showMsg('取消成功!');
getList()
}
})
});
}
//重新加载表格数据
let loadTableDataList = ({page, limit}) => {
let dataVal = data.value;
dataVal.page = page;
dataVal.limit = limit;
getList();
}
// 表格全选事件
let selectionChange = (val) => {
let checkArr = [];
val.map(item => {
checkArr.push(item.jtopoId)
})
data.value.checkArr = checkArr;
let isCheck = (list, checkArr) => {
list.forEach((v, i) => {
v.checked = checkArr.includes(v.jtopoId);
if (v.children) {
isCheck(v.children, checkArr);
}
});
}
isCheck(data.value.tableData, checkArr);
}
// 挂载完
Vue.onMounted(() => {
getList();
})
return {
height,
data,
getList,
changeUser,
showUserDialog,
removeRel,
loadTableDataList,
selectionChange,
saveRel
}
}
}
... ...
... ... @@ -68,7 +68,7 @@
:pageSize="search.limitUn"
:showPage="true"
:showTools="false"
:height="height - 230">
:height="height - 300">
<template #default="{row,prop,column}">
<div v-if="prop=='showType'">
<el-select v-model="row.showType" placeholder="">
... ...