Przeglądaj źródła

修改业务域

林倩 4 lat temu
rodzic
commit
41e49c00e7

+ 11 - 1
config/dev.env.js

@@ -37,7 +37,17 @@ module.exports = merge(prodEnv, {
             // target: "http://10.11.1.155:8861" // 傅志强
             // target: "http://10.11.1.192:8871" // 马志强
             // target: "http://10.11.1.142:8861", // 易长安
-            target: "http://10.254.11.200:8861" // 傅志强
+            // target: "http://10.254.11.200:8861" // 傅志强
+            target: "http://10.254.10.15:8861" // 傅志强
+            // target: "http://10.11.1.164:8861"
+
+        },
+        "/dcuc": {
+            // target: "http://10.11.0.205:8888", // 易长安
+            // target: "http://10.11.1.155:8860" // 傅志强
+                // target: "http://dcucwebapp:8888", // 傅志强
+                target: "http://10.254.10.15:8860" // 傅志强
+            // target: "http://10.11.1.164:8860"
 
         }
     })

+ 8 - 2
src/api/common.js

@@ -1,5 +1,6 @@
 import req from "ui-jz-v4-common/src/utils/zt-data";
 import axios from "@/utils/req";
+import request from "@/utils/request";
 
 // 将一维数组转换成树形结构
 function treeUtil(data, key = { id: "id", pid: "pid" }) {
@@ -120,7 +121,12 @@ export function getAppfunMenu(appId) {
     return axios.get(`/authsvr/v2/appfuninfo/menu/${appId}`);
 }
 
-// 业务域标签树
+// 标签树
 export function getBusinessTagTree(data) {
-    return axios.post(`/usersvr/v1/label/tree/search`, data, { loading: true });
+    return request({
+        url: `/usersvr/v1/label/tree/search`,
+        method: "POST",
+        baseURL: "/dcuc",
+        data
+    });
 }

+ 9 - 3
src/api/data-auth.js

@@ -5,9 +5,15 @@
  */
 
 import axios from "@/utils/req";
-const baseUrl = "/usersvr/v1/label";
+import request from "@/utils/request";
+const baseUrl = "/dcuc/usersvr/v1/label";
 
 // 标签树
 export function getBusinessTagTree(data) {
-    return axios.post(`${baseUrl}/tree/search`, data, { loading: true });
-}
+    return request({
+        url: `/usersvr/v1/label/tree/search`,
+        method: "POST",
+        baseURL: "/dcuc",
+        data
+    });
+}

+ 44 - 0
src/mixins/transfer-business-tag.js

@@ -0,0 +1,44 @@
+import { getBusinessTagTree } from "@/api/data-auth";
+export default {
+    data() {
+        return {}
+    },
+    methods: {
+        // 构建新的一级标签树
+        setNewTagTree() {
+            let newTagTree = [];
+            for (let j = 0; j < this.tagTree.length; j++) {
+                const item = this.tagTree[j];
+                if (item.child && item.parent) {
+                    newTagTree = [...newTagTree, ...item.child];
+                }
+            }
+            return newTagTree;
+        },
+        // 转换业务域
+        transferBusinessTag(policeBusiness) {
+            if (policeBusiness) {
+                let labelAttr = [];
+                const pbAttr = policeBusiness.split(",");
+                const newTagTree = this.setNewTagTree();
+                for (let i = 0; i < pbAttr.length; i++) {
+                    const pbItem = pbAttr[i];
+                    const element = newTagTree.find(item => item.code == pbItem);
+                    if (element) {
+                        labelAttr.push(element.name);
+                    }
+                }
+                return labelAttr.join(",");
+            }
+        },
+        // 获取业务域标签树
+        getTagTree() {
+            getBusinessTagTree().then(res => {
+                this.tagTree = res.data.content;
+            });
+        }
+    },
+    created() {
+        this.getTagTree();
+    }
+};

+ 1 - 1
src/pages/common/import/index.vue

@@ -8,7 +8,7 @@
             :on-error="handleError"
             :on-success="handleSuccess"
             :before-upload="beforeUpload"
-            action="/dcuc/duceap/v2/upload/file"
+            action="/dcucauth/duceap/v2/upload/file"
             drag
         >
             <i class="el-icon-upload" />

+ 73 - 39
src/pages/common/role-manage/index.vue

@@ -31,14 +31,23 @@
             ></dg-select>
         </el-form-item>
         <el-form-item prop="roleBusiness" label="业务域">
-            <dg-select
+            <dg-tree-drop
+                v-if="tagTree.length > 0"
                 v-model="sizeForm.roleBusiness"
-                filterable
-                clearable
-                :url="url"
                 placeholder="请选择业务域"
+                :props="{
+                    value: 'code',
+                    label: 'name',
+                    children: 'child'
+                }"
+                :data="tagTree"
+                clearable
+                filterable
                 multiple
-            ></dg-select>
+                visible-type="leaf"
+                style="width: 100%"
+                @change="handleTagTreeChange"
+            ></dg-tree-drop>
         </el-form-item>
         <el-form-item prop="isNotLimitCount" label="不限配额">
             <dg-select
@@ -62,7 +71,7 @@
 <script>
 import * as roleinfoManageApi from "@/api/roleinfo-manage";
 import * as regular from "@/utils/regular";
-
+import { getBusinessTagTree } from "@/api/data-auth";
 export default {
     name: "index",
     // 接收父页面传过来的属性
@@ -111,21 +120,14 @@ export default {
                 name: [{ required: true, message: "请输入角色名称", trigger: "blur" }],
                 roleLevel: [{ required: true, message: "请选择角色层级", trigger: "change" }],
                 isNotLimitCount: [{ required: true, message: "请选择是否限制配额", trigger: "change" }]
-            }
+            },
+            tagTree: []
         };
     },
     // 计算属性
     computed: {},
     // 方法
     methods: {
-        changeUrl(code) {
-            this.url = `/duacm/codeSon/v2/searchColumn?codeDicId=DM_POLICE_BUSINESS&columnName=police_type_id&columnValue=${code}`;
-        },
-        handleChange(code) {
-            const that = this;
-            that.$set(that.sizeForm, "roleBusiness", []);
-            that.changeUrl(code);
-        },
         handleClose() {
             this.$emit("success");
         },
@@ -133,46 +135,78 @@ export default {
             const that = this;
             let sizeForm = { ...this.sizeForm };
             const api = that.type === "create" ? "addRole" : "editRole";
-            this.$refs.sizeForm.validate(valid => {
+            this.$refs.sizeForm.validate((valid) => {
                 if (!valid) {
                     return;
                 }
                 // 业务域格式
                 sizeForm.roleBusiness = String(sizeForm.roleBusiness || "");
                 roleinfoManageApi[api](sizeForm)
-                    .then(res => {
+                    .then((res) => {
                         that.$emit("success", true);
                         that.$message.success("保存成功");
                     })
-                    .catch(error => {
+                    .catch((error) => {
                         that.$notify.error({ title: "错误", message: error });
                     });
             });
+        },
+        // 改变标签域
+        handleTagTreeChange(codes, nodes) {
+            let tags = [];
+            for (let i = 0; i < nodes.length; i++) {
+                const item = nodes[i];
+                if (!item.parent) {
+                    tags.push(item.code);
+                }
+            }
+            this.sizeForm.roleBusiness = tags.join(",");
+        },
+        // 获取标签树
+        getTagTree() {
+            return new Promise((resolve) => {
+                getBusinessTagTree().then((res) => {
+                    const tree = res.data.content.map((item) => {
+                        let disabled = true;
+                        if (item.parent && item.child) {
+                            disabled = false;
+                        }
+                        return {
+                            ...item,
+                            disabled
+                        };
+                    });
+                    resolve(tree);
+                });
+            });
+        },
+        async init() {
+            this.tagTree = await this.getTagTree();
+            // 关联应用id
+            this.$set(this.sizeForm, "appId", this.appId);
+            if (this.type == "create") {
+                // 业务域默认
+                // that.changeUrl("01");
+            } else {
+                this.sizeForm = this.formData;
+                // const { policeCategory } = that.sizeForm;
+                // const { roleBusiness } = that.sizeForm;
+                // if (roleBusiness) {
+                //     that.changeUrl(policeCategory);
+                //     that.$set(that.sizeForm, "roleBusiness", roleBusiness.split(","));
+                // } else {
+                //     if (policeCategory) {
+                //         that.changeUrl(policeCategory);
+                //     } else {
+                //         that.changeUrl("01");
+                //     }
+                // }
+            }
         }
     },
     // 创建组件时调用
     created() {
-        const that = this;
-        // 关联应用id
-        this.$set(this.sizeForm, "appId", this.appId);
-        if (that.type == "create") {
-            // 业务域默认
-            that.changeUrl("01");
-        } else {
-            that.sizeForm = that.formData;
-            const { policeCategory } = that.sizeForm;
-            const { roleBusiness } = that.sizeForm;
-            if (roleBusiness) {
-                that.changeUrl(policeCategory);
-                that.$set(that.sizeForm, "roleBusiness", roleBusiness.split(","));
-            } else {
-                if (policeCategory) {
-                    that.changeUrl(policeCategory);
-                } else {
-                    that.changeUrl("01");
-                }
-            }
-        }
+        this.init();
     }
 };
 </script>

+ 3 - 19
src/pages/common/table/index.vue

@@ -40,7 +40,7 @@
                     <span v-if="item.timestamp">{{ formatTimestamp(scope.row, item) }}</span>
                     <span v-if="item.adminAudit">{{ transformText(scope.row, item) }}</span>
                     <span v-if="item.transOperateType">{{ transformOperateType(scope.row, item) }}</span>
-                    <!--<span v-if="item.tranformBusiness">{{ tranformBusinessText(scope.row, item) }}</span>-->
+                    <!-- <span v-if="item.tranformBusiness">{{ tranformBusinessText(scope.row, item) }}</span> -->
                 </template>
             </dg-table-column>
         </template>
@@ -126,7 +126,7 @@ export default {
             mapping: {
                 list: "content",
                 total: "totalPages"
-            }
+            },
         };
     },
 
@@ -337,23 +337,7 @@ export default {
          * 转换业务域
          * */
         tranformBusinessText(row, item) {
-            const that = this;
-            roleAuthApi.getBusiness(row[item.transformProp] || "01").then((res) => {
-                let str = "";
-                if (item.prop && row[item.prop]) {
-                    const arr = row[item.prop].split(",");
-                    for (let i = 0; i < arr.length; i++) {
-                        for (let j = 0; j < res.length; j++) {
-                            if (arr[i] === res[j].value) {
-                                str += res[j].label + ",";
-                                break;
-                            }
-                        }
-                    }
-                }
-                that.$set(row, item.prop, str);
-            });
-            // console.log(row);
+                        
         },
         /*
          * 切换勾选状态

+ 150 - 0
src/pages/data-auth-module/data-permission-manage/data-auth-manage/business-tag-tree.vue

@@ -0,0 +1,150 @@
+<template>
+    <div>
+        <!-- 搜索栏 -->
+        <div class="u-tree__seach">
+            <el-input
+                placeholder="关键字搜索"
+                v-model="keyword"
+                class="tree__search__input"
+                clearable
+                size="mini"
+                @keyup.enter.native="handleSearch"
+            ></el-input>
+            <dg-button type="primary" @click="handleSearch" icon="el-icon-search">查询</dg-button>
+        </div>
+        <!-- 标签树 -->
+        <div class="u-tree__bar" style="height: calc(100vh - 19rem)">
+            <dg-scrollbar>
+                <dg-tree
+                    ref="tree"
+                    node-key="code"
+                    :props="props"
+                    :data="treeData"
+                    :expand-on-click-node="true"
+                    :filter-node-method="filterNode"
+                    style="padding-right: 15px"
+                >
+                    <div slot-scope="{ node, data }" class="u-tree-label">
+                        <p @click="handleNodeClick(data)">
+                            <i class="el-icon-folder-opened" v-if="data.parent"></i>
+                            <i class="el-icon-document" v-else></i>
+                            <span class="tree-node__text"> {{ data.name }}</span>
+                        </p>
+                    </div>
+                </dg-tree>
+            </dg-scrollbar>
+        </div>
+    </div>
+</template>
+
+<script>
+import { getBusinessTagTree } from "@/api/common";
+export default {
+    name: "BusinessTagTree",
+
+    props: {
+        props: {
+            type: Object,
+            default() {
+                return {
+                    value: "10005",
+                    label: "name",
+                    children: "child",
+                    isLeaf(data) {
+                        return data.parent !== true;
+                    }
+                };
+            }
+        }
+    },
+    data() {
+        return {
+            treeData: [],
+            // 查询关键字
+            keyword: ""
+        };
+    },
+    methods: {
+        handleSearch() {
+            this.$refs.tree.filter(this.keyword);
+        },
+        /**
+         * @description: 点击节点
+         * @param {*} node 节点
+         */
+        handleNodeClick(node) {
+            console.log(node);
+            if (!node.parent) {
+                this.$emit("handleGetNode", node);
+            }
+        },
+        
+        filterNode(value, data) {
+            if (!value) return true;
+            return data.name.indexOf(value) !== -1;
+        },
+        // 获取树
+        getTree() {
+            getBusinessTagTree().then((res) => {
+                this.treeData = res.data.content;
+            });
+        }
+    },
+    created() {
+        this.getTree();
+    }
+};
+</script>
+
+<style lang="scss" scoped>
+.u-tree__seach {
+    .tree__search__input {
+        width: 65%;
+        margin-bottom: 10px;
+    }
+}
+.u-tree_pop {
+    width: 100%;
+    border: 1px solid #eef2fa;
+    display: inline-block;
+    vertical-align: top;
+
+    & > h4 {
+        font-size: 14px;
+        height: 48px;
+        line-height: 48px;
+        padding: 0 15px;
+        border: 0 none;
+        background-color: #eef2fa;
+        text-align: left;
+    }
+
+    .dg-tree-node .el-tree-node__content > .el-tree-node__expand-icon {
+        margin-left: 7px;
+    }
+
+    .u-tree__seach {
+        margin: 8px;
+    }
+}
+
+.no-search-data {
+    color: #ff684d;
+}
+.search-result {
+    li {
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+        padding: 5px 12px;
+        cursor: pointer;
+    }
+    li:hover {
+        background-color: rgba(24, 144, 255, 0.12);
+    }
+}
+.u-tree-label {
+    width: 85%;
+    padding-right: 10px;
+}
+</style>

+ 3 - 13
src/pages/data-auth-module/data-permission-manage/data-auth-manage/property-auth.vue

@@ -9,17 +9,7 @@
             <!-- 属性列表 -->
             <dg-col :span="5" class="property-wapper__left">
                 <dg-card header="业务域标签列表" class="org-card box-card">
-                    <propety-tree
-                        ref="tree"
-                        class="u-pm__left"
-                        treeHeight="calc(100vh - 19rem)"
-                        paddingRight="15px"
-                        :search="true"
-                        apiName="getBusinessTagTree"
-                        :lazy="false"
-                        @handleGetNode="handleGetNode"
-                        @submitRootNode="submitRootNode"
-                    ></propety-tree>
+                    <business-tag-tree ref="tree" class="u-pm__left" @handleGetNode="handleGetNode"></business-tag-tree>
                 </dg-card>
             </dg-col>
             <!-- 权限设置 -->
@@ -31,11 +21,11 @@
 </template>
 
 <script>
-import propetyTree from "@/pages/common/tree";
+import businessTagTree from "./business-tag-tree";
 import setAuth from "./set-auth";
 export default {
     components: {
-        propetyTree,
+        businessTagTree,
         setAuth
     },
     data() {

+ 34 - 43
src/pages/empower-manage/persional-empower-manage/persionView.vue

@@ -43,12 +43,12 @@
                         :lazyLoad="true"
                         @handleRowClick="handleRowClick"
                     >
-                        <!--<dg-table-column prop="policeBusiness" label="业务域" align="center">-->
-                        <!--<template slot-scope="{ row }">-->
-                        <!--<div>{{ tfRolebusiness(row.policeCategory, row.policeBusiness) }}</div>-->
-                        <!--</template>-->
-                        <!--</dg-table-column>-->
-                    </Table>
+                        <dg-table-column prop="policeBusiness" label="业务域" align="center">
+                        <template slot-scope="{ row }">
+                        <div>{{ transferBusinessTag(row.policeBusiness) }}</div>
+                        </template>
+                        </dg-table-column>
+                    </Table>    
                 </dg-card>
             </dg-col>
             <dg-col :span="11">
@@ -57,7 +57,7 @@
                         <el-form-item label="应用名称"
                             ><el-input
                                 clearable
-                                style="width: 120px;"
+                                style="width: 120px"
                                 placeholder="请输入应用名称"
                                 v-model="r_reportPersonFrom.appName"
                                 @keyup.enter.native="handleSearchRoleList"
@@ -66,7 +66,7 @@
                         <el-form-item label="角色名称"
                             ><el-input
                                 clearable
-                                style="width: 120px;"
+                                style="width: 120px"
                                 placeholder="请输入角色名称"
                                 v-model="r_reportPersonFrom.roleName"
                                 @keyup.enter.native="handleSearchRoleList"
@@ -86,7 +86,7 @@
                         :pagination="false"
                         :span-method="objectSpanMethod"
                         border
-                        style="width: 100%;"
+                        style="width: 100%"
                         @selection-change="handleSelectChange"
                     >
                         <dg-table-column prop="appName" label="系统名称" min-width="120" align="center">
@@ -110,6 +110,10 @@
                             code="DM_POLICE_BUSINESS"
                             align="center"
                         >
+                           <template slot-scope="{ row }">
+                                {{ transferBusinessTag(row.roleBusiness) }}
+
+                           </template>
                         </dg-table-column>
                         <dg-table-column prop="activeTime" label="有效期至" min-width="90" align="center">
                             <template slot-scope="{ row }">
@@ -129,6 +133,7 @@ import Table from "@/pages/common/table";
 import { mapGetters } from "vuex";
 import * as roleAuthInfoApi from "@/api/role-auth-info";
 import Termvalidate from "./term-validity";
+import transferBusinessTagMixin from "@/mixins/transfer-business-tag"
 
 export default {
     name: "role-list",
@@ -138,6 +143,8 @@ export default {
         Tree,
         Table
     },
+    mixins: [ transferBusinessTagMixin ],
+
     // 页面数据绑定
     data() {
         return {
@@ -148,7 +155,6 @@ export default {
                 { label: "身份证", prop: "idcard" },
                 { label: "用户类型", width: "100px", prop: "userType", code: "DM_USER_TYPE" },
                 { label: "警种", prop: "policeCategory", code: "T_MD_POLICE_TYPE" },
-                { label: "业务域", prop: "policeBusiness", code: "DM_POLICE_BUSINESS" }
             ],
             p_reportPersonFrom: {
                 orgId: { value: "", op: "" },
@@ -185,7 +191,8 @@ export default {
             selections: [],
             deleteIds: [],
             perRow: null,
-            count: 0
+            count: 0,
+            tagTree: []
         };
     },
     // 计算属性
@@ -226,33 +233,17 @@ export default {
             this.r_reportPersonFrom.userId = row.id;
             this.handleSearchRoleList();
         },
-        // 转换业务域
-        tfRolebusiness(policeCategory, policeBusiness) {
-            const category = policeCategory || "01";
-            let concatString = "";
-            // debugger;
-            if (!policeBusiness) {
-                return;
+        // 构建新的一级标签树
+        setNewTagTree() {
+            let newTagTree = [];
+            for (let j = 0; j < this.tagTree.length; j++) {
+                const item = this.tagTree[j];
+                if (item.child && item.parent) {
+                    newTagTree = [...newTagTree, ...item.child];
+                }
             }
-            roleAuthInfoApi
-                .getBusiness(category)
-                .then(res => {
-                    const arr = policeBusiness.split(",");
-                    for (let i = 0; i < arr.length; i++) {
-                        for (let j = 0; j < res.length; j++) {
-                            if (arr[i] === res[j].value) {
-                                concatString += res[j].label + ",";
-                                break;
-                            }
-                        }
-                    }
-                })
-                .finally(() => {
-                    console.log(concatString);
-                    return concatString || null;
-                });
+            return newTagTree;
         },
-
         /*************角色列表****************/
         handleSearchRoleList() {
             const that = this;
@@ -260,10 +251,10 @@ export default {
             this.tableData = [];
             this.selections = [];
             this.deleteIds = [];
-            roleAuthInfoApi.getStaffRoleList(r_reportPersonFrom).then(res => {
+            roleAuthInfoApi.getStaffRoleList(r_reportPersonFrom).then((res) => {
                 that.tableData = res;
                 that.$nextTick(() => {
-                    res.forEach(row => {
+                    res.forEach((row) => {
                         if (row.cause == 1) {
                             this.$refs.myRoleTable.toggleRowSelection(row, true);
                         }
@@ -276,7 +267,7 @@ export default {
         handleSaveStaff() {
             const that = this;
             if (this.selections.length == 0) {
-                this.tableData.forEach(dd => {
+                this.tableData.forEach((dd) => {
                     this.deleteIds.push({
                         id: dd.id,
                         appId: dd.appId
@@ -309,10 +300,10 @@ export default {
             };
             roleAuthInfoApi
                 .saveRoleStaff(queryParams)
-                .then(res => {
+                .then((res) => {
                     that.$message.success("保存成功!");
                 })
-                .catch(err => {
+                .catch((err) => {
                     that.$message.error(err);
                 });
         },
@@ -331,7 +322,7 @@ export default {
         },
         setrowspans() {
             // 先给所有的数据都加一个v.rowspan = 1
-            this.tableData.forEach(v => {
+            this.tableData.forEach((v) => {
                 v.rowspan = 1;
             });
             // 双层循环
@@ -365,7 +356,7 @@ export default {
                     operatorRow: row
                 },
                 on: {
-                    success: function(bool = false, newRow) {
+                    success: function (bool = false, newRow) {
                         layer.closeAll(layer.dialogIndex);
                         console.log(newRow);
                         row.activeTime = newRow;

+ 9 - 2
src/pages/log-report/persionnel-author-audit/index.vue

@@ -75,11 +75,17 @@
                         :condition="r_reportPersonFrom"
                         :lazyLoad="true"
                     >
-                        <dg-table-column label="角色名称" prop="name" align="center" fixed="left">
+                        <dg-table-column label="角色名称" prop="name" align="center">
                             <template slot-scope="{ row }">
                                 <a href="javascript:;" @click="handleDetail(row)">{{ row.name }}</a>
                             </template>
                         </dg-table-column>
+                        <dg-table-column label="角色业务域" prop="roleBusiness" align="center" >
+                            <template slot-scope="{ row }">
+                               {{transferBusinessTag(row.roleBusiness)}}
+                            </template>
+                        </dg-table-column>
+
                     </Table>
                 </div>
             </dg-card>
@@ -93,6 +99,7 @@ import Table from "@/pages/common/table";
 import * as logAuditApi from "@/api/log-audit";
 import * as statisApi from "@/api/statistics-manage";
 import Detail from "./detail";
+import transferBusinessTagMixin from "@/mixins/transfer-business-tag"
 const editorArea = ["1000px", "880px"];
 
 export default {
@@ -101,6 +108,7 @@ export default {
         Tree,
         Table
     },
+    mixins: [ transferBusinessTagMixin ],
     // 接收父页面传过来的属性
     props: {},
     // 页面数据绑定
@@ -144,7 +152,6 @@ export default {
             r_titleData: [
                 { label: "应用名称", prop: "appId", fixed: "left" },
                 { label: "角色层级", prop: "roleLevel", code: "DM_ROLE_LEVEL" },
-                { label: "角色业务域", prop: "roleBusiness", code: "DM_POLICE_BUSINESS" }
             ],
             r_reportPersonFrom: {
                 appId: { value: "", op: "=" },