Authored by 王涛

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

【无】部门管理增加业务授权功能- #1



See merge request !651
... ... @@ -113,6 +113,8 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
if (configDeptPwdOpen == 1){
_html += ' <button data-id="'+d.orgId+'" data-password="'+d.orgPassword+'" lay-tips="设置部门默认密码" type="button" class="layui-btn layui-btn-xs layui-btn-normal pwd-org-btn"><i class="layui-icon layui-icon-set"></i></button>';
}
_html +='<button data-orgid="'+d.orgId+'" lay-tips="业务授权" type="button" class="layui-btn layui-btn-xs layui-btn-normal org_busType_authorization_btn"><i class="layui-icon layui-icon-menu-fill"></i></button>';
_html += '</div>';
return _html;
}
... ... @@ -182,6 +184,11 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
}
openEditHtml($(this).data("id"))
})
//start lsq 业务授权
$('.org_busType_authorization_btn').unbind().on('click',function () {
busTypeAuthorization($(this).data('orgid'))
});
}
, error(error) {
layer.close(loading)
... ... @@ -189,6 +196,29 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
})
}
//start lsq 业务类型授权2022-06-10
function busTypeAuthorization(orgId) {
var orgIds = [];
if (orgId){ //增加操作栏中业务类型授权
orgIds.push(orgId);
}else{
}
if(orgIds.length < 1){
layer.msg("请勾选需要赋权的部门!", { offset: '15px' , icon: 7 , time: 2000 });
}else{
layer.open({
title: ['业务授权', 'font-size:18px;'],
type: 2,
area: ['90%','80%'],
resize:false,
content: ['/vue3/index.html#/vue3/orgBustype?orgId=' + orgId, 'no'],
cancel: function () {
clearTimeout();
}
});
}
}
function saveDeptPwd(conf) {
loading = layer.load(2);
admin.req({
... ...
... ... @@ -126,6 +126,12 @@ const routes = [{
name: 'connectScatter',
component: () => myImport('views/connectScatter/index')
},
//部门业务关系
{
path: '/vue3/orgBustype',
name: 'orgBustype',
component: () => myImport('views/orgBustype/index')
},
];
// hash模式: createWebHashHistory
... ...
<div class="container" :style="{'height':height+'px','max-height':height+'px'}">
<div class="cm-card" :style="{'min-height':height+'px','max-height':height+'px','height':'100%'}">
<div class="search" style="margin:6px 0;">
<div class="condition">
<el-input style="width:160px" v-model="search.keyWords" placeholder="请输入关键字"></el-input>
<el-button size="small" type="primary" style="margin-left: 6px;" @click="getDataList">查询</el-button>
<el-button size="small" type="primary" @click="addConfig">新增关系</el-button>
<el-button size="small" type="primary" @click="delConfig">删除关系</el-button>
</div>
</div>
<div class="search-table">
<cm-table-page :columns="tableData.columns" :dataList="tableData.dataList"
:showIndex="true"
:total="tableData.count"
@loaddata = "loaddata"
:showSelection="true"
@selectionChange="selectionChange"
:showBorder="true"
:loading="false"
:pageSize="search.limit"
:showPage="true"
:showTools="true"
:height="height - 110">
<template #default="{row,prop,column}">
<div v-if="prop=='showType'">
<el-select 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>
<template #tools="{scope}">
<div class="list-handle">
<i class="el-icon-delete" title="删除关系" style="cursor: pointer;" @click="handleDelete(scope.row)"></i>
<!-- <i style="margin-left:6px;cursor: pointer;" class="el-icon-edit" title="修改" @click="handleEdit(scope.row)"></i>-->
</div>
</template>
</cm-table-page>
</div>
</div>
</div>
<!--弹框-->
<cm-dialog :title="dialog.title" width="80%" :showDialogVisible="dialog.show" @okfunc="saveConfig" @hidedialog="hideDialog" :showFooter="true">
<template v-slot>
<div class="add-container" style="height:400px;padding:0 10px;">
<!-- <div class="cm-card" :style="{'min-height':height+'px','max-height':height+'px','height':'100%'}">-->
<div class="search" style="margin:6px 0;">
<div class="condition" style="display: flex;">
<el-input style="width:160px" v-model="search.keyWordsUn" placeholder="请输入关键字"></el-input>
<el-button size="small" type="primary" style="margin-left: 6px;" @click="getDataListUnauth">查询</el-button>
</div>
</div>
<div class="search-table">
<cm-table-page :columns="tableData.columns" :dataList="tableData.dataListUn"
:showIndex="true"
:total="tableData.countUn"
@loaddata = "loaddataUn"
:showSelection="true"
@selectionChange="selectionChangeUn"
:showBorder="true"
:loading="false"
:pageSize="search.limitUn"
:showPage="true"
:showTools="false"
:height="height - 230">
<template #default="{row,prop,column}">
<div v-if="prop=='showType'">
<el-select 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>
</div>
</div>
<!-- </div>-->
</template>
</cm-dialog>
... ...
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,
}
}
}
... ...
... ... @@ -221,6 +221,12 @@ const routes = [{
name: 'connectScatter',
component: () => myImport('views/connectScatter/index')
},
//部门业务关系
{
path: '/vue3/orgBustype',
name: 'orgBustype',
component: () => myImport('views/orgBustype/index')
},
];
// hash模式: createWebHashHistory
... ...