|
|
export default {
|
|
|
name: 'orgBustype',
|
|
|
template: '',
|
|
|
components: {
|
|
|
},
|
|
|
props: [],
|
|
|
setup(props, {attrs, slots, emit}) {
|
|
|
const {proxy} = Vue.getCurrentInstance();
|
|
|
let height = Vue.ref(window.innerHeight);
|
|
|
let showTypeList=Vue.ref([]);
|
|
|
|
|
|
let yearCheckList=Vue.ref([]);//年选择数据
|
|
|
let monthCheckList=Vue.ref([]);//月选择数据
|
|
|
let dayCheckList=Vue.ref([]);//日选择数据
|
|
|
let hourCheckList=Vue.ref([]);//时选择数据
|
|
|
let dialog=Vue.ref({
|
|
|
title:'新增关系',
|
|
|
show:false,
|
|
|
id:''
|
|
|
});
|
|
|
let search = Vue.ref({
|
|
|
orgId: proxy.$route.query.orgId,
|
|
|
keyWords: '',
|
|
|
page: 1,
|
|
|
limit: 50,
|
|
|
keyWordsUn: '',
|
|
|
pageUn: 1,
|
|
|
limitUn: 50,
|
|
|
});
|
|
|
|
|
|
//表格字段
|
|
|
let tableData = Vue.ref({
|
|
|
count:0,
|
|
|
dataList: [],
|
|
|
dataListUn:[],
|
|
|
columns: [
|
|
|
{
|
|
|
prop: 'busTypeName',
|
|
|
label: '名称',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
width: '200',
|
|
|
},
|
|
|
{
|
|
|
prop: 'nickname',
|
|
|
label: '负责人',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
width: '120',
|
|
|
},
|
|
|
{
|
|
|
prop: 'busTypeDesc',
|
|
|
label: '业务类型描述',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
width: '300',
|
|
|
},
|
|
|
{
|
|
|
prop: 'isOps',
|
|
|
label: '乙方运维',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
width: '120',
|
|
|
render: function (row) {
|
|
|
if(row.isOps==0){
|
|
|
return '否';
|
|
|
}else{
|
|
|
return '是';
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
prop: 'isUse',
|
|
|
label: '是否使用',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
width: '120',
|
|
|
render: function (row) {
|
|
|
switch (row.isUse) {
|
|
|
case 0:
|
|
|
return '否';
|
|
|
case 1:
|
|
|
return '是';
|
|
|
default:
|
|
|
return '';
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
prop: 'important',
|
|
|
label: '重要程度',
|
|
|
sortable: true,
|
|
|
align: 'center',
|
|
|
width: '120',
|
|
|
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',
|
|
|
}
|
|
|
]
|
|
|
})
|
|
|
// 已授权表格全选事件
|
|
|
let checkData=Vue.ref([]);
|
|
|
let selectionChange = (val) => {
|
|
|
let checkArr = [];
|
|
|
val.map(item => {
|
|
|
checkArr.push(item.busId)
|
|
|
})
|
|
|
checkData.value = checkArr;
|
|
|
|
|
|
}
|
|
|
//未授权表格全选事件
|
|
|
let checkDataUn=Vue.ref([]);
|
|
|
let selectionChangeUn=(val)=>{
|
|
|
let checkArr = [];
|
|
|
val.map(item => {
|
|
|
checkArr.push(item.busId)
|
|
|
})
|
|
|
checkDataUn.value = checkArr;
|
|
|
}
|
|
|
// 获取已授权列表
|
|
|
let getDataList = () => {
|
|
|
proxy.$http.get(`/api-analysis/BusinessOrg/getBusList?keyWords=`+search.value.keyWords, {
|
|
|
orgId:search.value.orgId,
|
|
|
page: search.value.page,
|
|
|
limit: search.value.limit,
|
|
|
}, function (res) {
|
|
|
if (res && res.data) {
|
|
|
tableData.value.dataList = res.data;
|
|
|
tableData.value.count = res.count;
|
|
|
tableData.value.dataList.map(item=>{
|
|
|
item.isAuth=true;
|
|
|
item.checked=true;
|
|
|
})
|
|
|
} else {
|
|
|
tableData.value.dataList = [];
|
|
|
tableData.value.count = 0;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
//根据showtype获取到showtypename
|
|
|
let getShowTypeName=(val)=>{
|
|
|
let name='';
|
|
|
showTypeList.value.map(item=>{
|
|
|
if(val==item.value){
|
|
|
name=item.name;
|
|
|
}
|
|
|
})
|
|
|
return name;
|
|
|
}
|
|
|
//获取未授权的列表
|
|
|
let getDataListUnauth =()=>{
|
|
|
proxy.$http.get(`/api-analysis/BusinessOrg/getUnBusList?keyWords=`+search.value.keyWordsUn, {
|
|
|
orgId:search.value.orgId,
|
|
|
page: search.value.pageUn,
|
|
|
limit: search.value.limitUn,
|
|
|
}, function (res) {
|
|
|
if (res && res.data) {
|
|
|
tableData.value.dataListUn = res.data;
|
|
|
tableData.value.countUn = res.count;
|
|
|
tableData.value.dataListUn.map(item=>{
|
|
|
item.isAuth=false;
|
|
|
item.checked=false;
|
|
|
|
|
|
})
|
|
|
} else {
|
|
|
tableData.value.dataListUn = [];
|
|
|
tableData.value.countUn = 0;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
let loaddata = ({page, limit}) => {
|
|
|
search.value.page = page;
|
|
|
search.value.limit = limit;
|
|
|
}
|
|
|
let loaddataUn = ({page, limit}) => {
|
|
|
search.value.pageUn = page;
|
|
|
search.value.limitUn = limit;
|
|
|
}
|
|
|
|
|
|
let hideDialog = (flg) => {
|
|
|
dialog.value.show = flg;
|
|
|
if(!flg){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//删除关系
|
|
|
let handleDelete=(row)=>{
|
|
|
deletData(row);
|
|
|
}
|
|
|
|
|
|
//新增关系
|
|
|
let addConfig=()=>{
|
|
|
getDataListUnauth();
|
|
|
hideDialog(true);
|
|
|
}
|
|
|
//批量删除关系
|
|
|
let delConfig=()=>{
|
|
|
if(checkData.value.length<1){
|
|
|
proxy.$global.showMsg('请至少选择一项','warning');
|
|
|
return;
|
|
|
}
|
|
|
deletData();
|
|
|
}
|
|
|
//删除操作
|
|
|
let deletData=(row)=>{
|
|
|
let busIdList =[];
|
|
|
if(row){
|
|
|
busIdList =[row.busId];
|
|
|
}else{
|
|
|
busIdList=checkData.value;
|
|
|
}
|
|
|
proxy.$global.confirm("确认删除该机构下的业务关系吗?", function () {
|
|
|
proxy.$http.post(`/api-analysis/BusinessOrg/delete`, {
|
|
|
busIdList : busIdList,
|
|
|
orgId:search.value.orgId
|
|
|
}, function (res) {
|
|
|
if(res && res.success){
|
|
|
proxy.$global.showMsg('删除成功');
|
|
|
}else{
|
|
|
proxy.$global.showMsg('删除失败','error');
|
|
|
}
|
|
|
getDataList();
|
|
|
})
|
|
|
})
|
|
|
}
|
|
|
//保存关系
|
|
|
let saveConfig=()=>{
|
|
|
if(checkDataUn.value.length<1){
|
|
|
proxy.$global.showMsg('请至少选择一个业务','warning');
|
|
|
return;
|
|
|
}
|
|
|
let busIdList=checkDataUn.value;
|
|
|
if(tableData.value.dataList && tableData.value.dataList.length>0){
|
|
|
tableData.value.dataList.map(item=>{
|
|
|
busIdList.push(item.busId)
|
|
|
})
|
|
|
}
|
|
|
proxy.$http.post(`/api-analysis/BusinessOrg/add`, {
|
|
|
orgId: search.value.orgId,
|
|
|
busIdList: busIdList,
|
|
|
}, function (res) {
|
|
|
if(res && res.success){
|
|
|
proxy.$global.showMsg('保存成功');
|
|
|
}else{
|
|
|
proxy.$global.showMsg('保存失败','error');
|
|
|
}
|
|
|
hideDialog(false);
|
|
|
getDataList();
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//获取展示类型的字典数据
|
|
|
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)
|
|
|
});
|
|
|
})
|
|
|
}
|
|
|
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
// 挂载完
|
|
|
Vue.onMounted(() => {
|
|
|
initShowType();
|
|
|
getDataList();
|
|
|
})
|
|
|
|
|
|
|
|
|
return {
|
|
|
initShowType,
|
|
|
showTypeList,
|
|
|
getDataListUnauth,
|
|
|
selectionChangeUn,
|
|
|
saveConfig,
|
|
|
delConfig,
|
|
|
addConfig,
|
|
|
selectionChange,
|
|
|
handleDelete,
|
|
|
checkData,
|
|
|
dialog,
|
|
|
height,
|
|
|
search,
|
|
|
hideDialog,
|
|
|
loaddata,
|
|
|
loaddataUn,
|
|
|
tableData,
|
|
|
getDataList,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|