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', @@ -113,6 +113,8 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
113 if (configDeptPwdOpen == 1){ 113 if (configDeptPwdOpen == 1){
114 _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>'; 114 _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>';
115 } 115 }
  116 + _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>';
  117 +
116 _html += '</div>'; 118 _html += '</div>';
117 return _html; 119 return _html;
118 } 120 }
@@ -182,6 +184,11 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', @@ -182,6 +184,11 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
182 } 184 }
183 openEditHtml($(this).data("id")) 185 openEditHtml($(this).data("id"))
184 }) 186 })
  187 + //start lsq 业务授权
  188 + $('.org_busType_authorization_btn').unbind().on('click',function () {
  189 +
  190 + busTypeAuthorization($(this).data('orgid'))
  191 + });
185 } 192 }
186 , error(error) { 193 , error(error) {
187 layer.close(loading) 194 layer.close(loading)
@@ -189,6 +196,29 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common', @@ -189,6 +196,29 @@ layui.define(['table', 'form', 'laydate', 'admin', 'layer', 'laytpl', 'common',
189 }) 196 })
190 } 197 }
191 198
  199 + //start lsq 业务类型授权2022-06-10
  200 + function busTypeAuthorization(orgId) {
  201 + var orgIds = [];
  202 + if (orgId){ //增加操作栏中业务类型授权
  203 + orgIds.push(orgId);
  204 + }else{
  205 + }
  206 + if(orgIds.length < 1){
  207 + layer.msg("请勾选需要赋权的部门!", { offset: '15px' , icon: 7 , time: 2000 });
  208 + }else{
  209 + layer.open({
  210 + title: ['业务授权', 'font-size:18px;'],
  211 + type: 2,
  212 + area: ['90%','80%'],
  213 + resize:false,
  214 + content: ['/vue3/index.html#/vue3/orgBustype?orgId=' + orgId, 'no'],
  215 + cancel: function () {
  216 + clearTimeout();
  217 + }
  218 + });
  219 + }
  220 + }
  221 +
192 function saveDeptPwd(conf) { 222 function saveDeptPwd(conf) {
193 loading = layer.load(2); 223 loading = layer.load(2);
194 admin.req({ 224 admin.req({
@@ -126,6 +126,12 @@ const routes = [{ @@ -126,6 +126,12 @@ const routes = [{
126 name: 'connectScatter', 126 name: 'connectScatter',
127 component: () => myImport('views/connectScatter/index') 127 component: () => myImport('views/connectScatter/index')
128 }, 128 },
  129 + //部门业务关系
  130 + {
  131 + path: '/vue3/orgBustype',
  132 + name: 'orgBustype',
  133 + component: () => myImport('views/orgBustype/index')
  134 + },
129 ]; 135 ];
130 136
131 // hash模式: createWebHashHistory 137 // hash模式: createWebHashHistory
  1 +<div class="container" :style="{'height':height+'px','max-height':height+'px'}">
  2 + <div class="cm-card" :style="{'min-height':height+'px','max-height':height+'px','height':'100%'}">
  3 + <div class="search" style="margin:6px 0;">
  4 + <div class="condition">
  5 + <el-input style="width:160px" v-model="search.keyWords" placeholder="请输入关键字"></el-input>
  6 + <el-button size="small" type="primary" style="margin-left: 6px;" @click="getDataList">查询</el-button>
  7 + <el-button size="small" type="primary" @click="addConfig">新增关系</el-button>
  8 + <el-button size="small" type="primary" @click="delConfig">删除关系</el-button>
  9 + </div>
  10 + </div>
  11 + <div class="search-table">
  12 + <cm-table-page :columns="tableData.columns" :dataList="tableData.dataList"
  13 + :showIndex="true"
  14 + :total="tableData.count"
  15 + @loaddata = "loaddata"
  16 + :showSelection="true"
  17 + @selectionChange="selectionChange"
  18 + :showBorder="true"
  19 + :loading="false"
  20 + :pageSize="search.limit"
  21 + :showPage="true"
  22 + :showTools="true"
  23 + :height="height - 110">
  24 + <template #default="{row,prop,column}">
  25 + <div v-if="prop=='showType'">
  26 + <el-select v-model="row.showType" placeholder="">
  27 + <el-option
  28 + v-for="item in showTypeList"
  29 + :key="item.value"
  30 + :label="item.name"
  31 + :value="item.value"
  32 + >
  33 + </el-option>
  34 + </el-select>
  35 + </div>
  36 + </template>
  37 + <template #tools="{scope}">
  38 + <div class="list-handle">
  39 + <i class="el-icon-delete" title="删除关系" style="cursor: pointer;" @click="handleDelete(scope.row)"></i>
  40 +<!-- <i style="margin-left:6px;cursor: pointer;" class="el-icon-edit" title="修改" @click="handleEdit(scope.row)"></i>-->
  41 + </div>
  42 + </template>
  43 + </cm-table-page>
  44 + </div>
  45 + </div>
  46 +</div>
  47 +
  48 +<!--弹框-->
  49 +<cm-dialog :title="dialog.title" width="80%" :showDialogVisible="dialog.show" @okfunc="saveConfig" @hidedialog="hideDialog" :showFooter="true">
  50 + <template v-slot>
  51 + <div class="add-container" style="height:400px;padding:0 10px;">
  52 +<!-- <div class="cm-card" :style="{'min-height':height+'px','max-height':height+'px','height':'100%'}">-->
  53 + <div class="search" style="margin:6px 0;">
  54 + <div class="condition" style="display: flex;">
  55 + <el-input style="width:160px" v-model="search.keyWordsUn" placeholder="请输入关键字"></el-input>
  56 + <el-button size="small" type="primary" style="margin-left: 6px;" @click="getDataListUnauth">查询</el-button>
  57 + </div>
  58 + </div>
  59 + <div class="search-table">
  60 + <cm-table-page :columns="tableData.columns" :dataList="tableData.dataListUn"
  61 + :showIndex="true"
  62 + :total="tableData.countUn"
  63 + @loaddata = "loaddataUn"
  64 + :showSelection="true"
  65 + @selectionChange="selectionChangeUn"
  66 + :showBorder="true"
  67 + :loading="false"
  68 + :pageSize="search.limitUn"
  69 + :showPage="true"
  70 + :showTools="false"
  71 + :height="height - 230">
  72 + <template #default="{row,prop,column}">
  73 + <div v-if="prop=='showType'">
  74 + <el-select v-model="row.showType" placeholder="">
  75 + <el-option
  76 + v-for="item in showTypeList"
  77 + :key="item.value"
  78 + :label="item.name"
  79 + :value="item.value"
  80 + >
  81 + </el-option>
  82 + </el-select>
  83 + </div>
  84 + </template>
  85 + </cm-table-page>
  86 + </div>
  87 + </div>
  88 +<!-- </div>-->
  89 +
  90 + </template>
  91 +</cm-dialog>
  92 +
  1 +export default {
  2 + name: 'orgBustype',
  3 + template: '',
  4 + components: {
  5 + },
  6 + props: [],
  7 + setup(props, {attrs, slots, emit}) {
  8 + const {proxy} = Vue.getCurrentInstance();
  9 + let height = Vue.ref(window.innerHeight);
  10 + let showTypeList=Vue.ref([]);
  11 +
  12 + let yearCheckList=Vue.ref([]);//年选择数据
  13 + let monthCheckList=Vue.ref([]);//月选择数据
  14 + let dayCheckList=Vue.ref([]);//日选择数据
  15 + let hourCheckList=Vue.ref([]);//时选择数据
  16 + let dialog=Vue.ref({
  17 + title:'新增关系',
  18 + show:false,
  19 + id:''
  20 + });
  21 + let search = Vue.ref({
  22 + orgId: proxy.$route.query.orgId,
  23 + keyWords: '',
  24 + page: 1,
  25 + limit: 50,
  26 + keyWordsUn: '',
  27 + pageUn: 1,
  28 + limitUn: 50,
  29 + });
  30 +
  31 + //表格字段
  32 + let tableData = Vue.ref({
  33 + count:0,
  34 + dataList: [],
  35 + dataListUn:[],
  36 + columns: [
  37 + {
  38 + prop: 'busTypeName',
  39 + label: '名称',
  40 + sortable: true,
  41 + align: 'center',
  42 + width: '200',
  43 + },
  44 + {
  45 + prop: 'nickname',
  46 + label: '负责人',
  47 + sortable: true,
  48 + align: 'center',
  49 + width: '120',
  50 + },
  51 + {
  52 + prop: 'busTypeDesc',
  53 + label: '业务类型描述',
  54 + sortable: true,
  55 + align: 'center',
  56 + width: '300',
  57 + },
  58 + {
  59 + prop: 'isOps',
  60 + label: '乙方运维',
  61 + sortable: true,
  62 + align: 'center',
  63 + width: '120',
  64 + render: function (row) {
  65 + if(row.isOps==0){
  66 + return '否';
  67 + }else{
  68 + return '是';
  69 + }
  70 + }
  71 + },
  72 + {
  73 + prop: 'isUse',
  74 + label: '是否使用',
  75 + sortable: true,
  76 + align: 'center',
  77 + width: '120',
  78 + render: function (row) {
  79 + switch (row.isUse) {
  80 + case 0:
  81 + return '否';
  82 + case 1:
  83 + return '是';
  84 + default:
  85 + return '';
  86 + }
  87 + }
  88 + },
  89 + {
  90 + prop: 'important',
  91 + label: '重要程度',
  92 + sortable: true,
  93 + align: 'center',
  94 + width: '120',
  95 + render: function (row) {
  96 + switch (row.important) {
  97 + case 1:
  98 + return '核心';
  99 + case 2:
  100 + return '重要';
  101 + case 3:
  102 + return '一般';
  103 + case 9:
  104 + return '虚拟业务';
  105 + default:
  106 + return '';
  107 + }
  108 + }
  109 + }, {
  110 + prop: 'sort',
  111 + label: '排序',
  112 + sortable: true,
  113 + align: 'center',
  114 + }
  115 + ]
  116 + })
  117 + // 已授权表格全选事件
  118 + let checkData=Vue.ref([]);
  119 + let selectionChange = (val) => {
  120 + let checkArr = [];
  121 + val.map(item => {
  122 + checkArr.push(item.busId)
  123 + })
  124 + checkData.value = checkArr;
  125 +
  126 + }
  127 + //未授权表格全选事件
  128 + let checkDataUn=Vue.ref([]);
  129 + let selectionChangeUn=(val)=>{
  130 + let checkArr = [];
  131 + val.map(item => {
  132 + checkArr.push(item.busId)
  133 + })
  134 + checkDataUn.value = checkArr;
  135 + }
  136 + // 获取已授权列表
  137 + let getDataList = () => {
  138 + proxy.$http.get(`/api-analysis/BusinessOrg/getBusList?keyWords=`+search.value.keyWords, {
  139 + orgId:search.value.orgId,
  140 + page: search.value.page,
  141 + limit: search.value.limit,
  142 + }, function (res) {
  143 + if (res && res.data) {
  144 + tableData.value.dataList = res.data;
  145 + tableData.value.count = res.count;
  146 + tableData.value.dataList.map(item=>{
  147 + item.isAuth=true;
  148 + item.checked=true;
  149 + })
  150 + } else {
  151 + tableData.value.dataList = [];
  152 + tableData.value.count = 0;
  153 + }
  154 + });
  155 +
  156 + }
  157 + //根据showtype获取到showtypename
  158 + let getShowTypeName=(val)=>{
  159 + let name='';
  160 + showTypeList.value.map(item=>{
  161 + if(val==item.value){
  162 + name=item.name;
  163 + }
  164 + })
  165 + return name;
  166 + }
  167 + //获取未授权的列表
  168 + let getDataListUnauth =()=>{
  169 + proxy.$http.get(`/api-analysis/BusinessOrg/getUnBusList?keyWords=`+search.value.keyWordsUn, {
  170 + orgId:search.value.orgId,
  171 + page: search.value.pageUn,
  172 + limit: search.value.limitUn,
  173 + }, function (res) {
  174 + if (res && res.data) {
  175 + tableData.value.dataListUn = res.data;
  176 + tableData.value.countUn = res.count;
  177 + tableData.value.dataListUn.map(item=>{
  178 + item.isAuth=false;
  179 + item.checked=false;
  180 +
  181 + })
  182 + } else {
  183 + tableData.value.dataListUn = [];
  184 + tableData.value.countUn = 0;
  185 + }
  186 + });
  187 + }
  188 +
  189 + let loaddata = ({page, limit}) => {
  190 + search.value.page = page;
  191 + search.value.limit = limit;
  192 + }
  193 + let loaddataUn = ({page, limit}) => {
  194 + search.value.pageUn = page;
  195 + search.value.limitUn = limit;
  196 + }
  197 +
  198 + let hideDialog = (flg) => {
  199 + dialog.value.show = flg;
  200 + if(!flg){
  201 + }
  202 + }
  203 +
  204 + //删除关系
  205 + let handleDelete=(row)=>{
  206 + deletData(row);
  207 + }
  208 +
  209 + //新增关系
  210 + let addConfig=()=>{
  211 + getDataListUnauth();
  212 + hideDialog(true);
  213 + }
  214 + //批量删除关系
  215 + let delConfig=()=>{
  216 + if(checkData.value.length<1){
  217 + proxy.$global.showMsg('请至少选择一项','warning');
  218 + return;
  219 + }
  220 + deletData();
  221 + }
  222 + //删除操作
  223 + let deletData=(row)=>{
  224 + let busIdList =[];
  225 + if(row){
  226 + busIdList =[row.busId];
  227 + }else{
  228 + busIdList=checkData.value;
  229 + }
  230 + proxy.$global.confirm("确认删除该机构下的业务关系吗?", function () {
  231 + proxy.$http.post(`/api-analysis/BusinessOrg/delete`, {
  232 + busIdList : busIdList,
  233 + orgId:search.value.orgId
  234 + }, function (res) {
  235 + if(res && res.success){
  236 + proxy.$global.showMsg('删除成功');
  237 + }else{
  238 + proxy.$global.showMsg('删除失败','error');
  239 + }
  240 + getDataList();
  241 + })
  242 + })
  243 + }
  244 + //保存关系
  245 + let saveConfig=()=>{
  246 + if(checkDataUn.value.length<1){
  247 + proxy.$global.showMsg('请至少选择一个业务','warning');
  248 + return;
  249 + }
  250 + let busIdList=checkDataUn.value;
  251 + if(tableData.value.dataList && tableData.value.dataList.length>0){
  252 + tableData.value.dataList.map(item=>{
  253 + busIdList.push(item.busId)
  254 + })
  255 + }
  256 + proxy.$http.post(`/api-analysis/BusinessOrg/add`, {
  257 + orgId: search.value.orgId,
  258 + busIdList: busIdList,
  259 + }, function (res) {
  260 + if(res && res.success){
  261 + proxy.$global.showMsg('保存成功');
  262 + }else{
  263 + proxy.$global.showMsg('保存失败','error');
  264 + }
  265 + hideDialog(false);
  266 + getDataList();
  267 + })
  268 + }
  269 +
  270 + //获取展示类型的字典数据
  271 + let initShowType=()=>{
  272 + proxy.$http.post("/api-web/manage/ddic/findSucDdics/DETAILS_POWER", {}, function (res) {
  273 + if (res && res.data) {
  274 + let arr=res.data;
  275 + if(arr && arr.length>0){
  276 + arr.map(v=>{
  277 + showTypeList.value.push({
  278 + name: v.ddicName
  279 + ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length)
  280 + });
  281 + })
  282 + }
  283 +
  284 + }
  285 + })
  286 + }
  287 + // 挂载完
  288 + Vue.onMounted(() => {
  289 + initShowType();
  290 + getDataList();
  291 + })
  292 +
  293 +
  294 + return {
  295 + initShowType,
  296 + showTypeList,
  297 + getDataListUnauth,
  298 + selectionChangeUn,
  299 + saveConfig,
  300 + delConfig,
  301 + addConfig,
  302 + selectionChange,
  303 + handleDelete,
  304 + checkData,
  305 + dialog,
  306 + height,
  307 + search,
  308 + hideDialog,
  309 + loaddata,
  310 + loaddataUn,
  311 + tableData,
  312 + getDataList,
  313 + }
  314 + }
  315 +
  316 +}
@@ -221,6 +221,12 @@ const routes = [{ @@ -221,6 +221,12 @@ const routes = [{
221 name: 'connectScatter', 221 name: 'connectScatter',
222 component: () => myImport('views/connectScatter/index') 222 component: () => myImport('views/connectScatter/index')
223 }, 223 },
  224 + //部门业务关系
  225 + {
  226 + path: '/vue3/orgBustype',
  227 + name: 'orgBustype',
  228 + component: () => myImport('views/orgBustype/index')
  229 + },
224 ]; 230 ];
225 231
226 // hash模式: createWebHashHistory 232 // hash模式: createWebHashHistory