|
@@ -0,0 +1,244 @@
|
|
|
+<template>
|
|
|
+ <div class="content-box reportPush-userSet">
|
|
|
+ <el-tree
|
|
|
+ :data="list"
|
|
|
+ node-key="Id"
|
|
|
+ :props="{
|
|
|
+ label: 'ClassifyName',
|
|
|
+ children: 'Child'
|
|
|
+ }"
|
|
|
+ check-strictly
|
|
|
+ :empty-text="$t('Common.no_classify_msg')"
|
|
|
+ draggable
|
|
|
+ indent='76'
|
|
|
+ :allow-drop="canDropHandle"
|
|
|
+ @node-drop="dropOverHandle"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="classify-item-wrap"
|
|
|
+ slot-scope="{ data,node }"
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <span>{{data.ClassifyName}}</span>
|
|
|
+ <template v-if="!data.Child||(data.Child&&!data.Child.length)">
|
|
|
+ <el-tag
|
|
|
+ :type="data.IceMsgUsers?'success':'danger'"
|
|
|
+ size="small"
|
|
|
+ >{{ data.IceMsgUsers ? '已配置' : '未配置' }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="opt-box">
|
|
|
+ <span
|
|
|
+ class="editsty"
|
|
|
+ v-if="(!data.Child||(data.Child&&!data.Child.length)) && permissionBtn.isShowBtn('reportManageBtn','reportPush_setBtn')"
|
|
|
+ @click="handleOpenSetUser(data,node)"
|
|
|
+ >
|
|
|
+ 配置人员
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-tree>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 配置人员弹窗 -->
|
|
|
+ <m-dialog
|
|
|
+ :show.sync="isOpenSetDialog"
|
|
|
+ :title="$t('ReportManage.ReportList.set_tags_title')"
|
|
|
+ width="450px"
|
|
|
+ >
|
|
|
+ <div class="edit-tag-wrap">
|
|
|
+ <el-form
|
|
|
+ :model="classifyForm"
|
|
|
+ inline
|
|
|
+ >
|
|
|
+ <el-form-item label="报告分类">
|
|
|
+ <span style="margin-right: 20px">{{classifyForm.classifyName}}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="接收人员" prop="users">
|
|
|
+ <el-cascader
|
|
|
+ v-model="classifyForm.users"
|
|
|
+ ref="userRef"
|
|
|
+ :options="userOptions"
|
|
|
+ :props="{
|
|
|
+ value: 'NodeIdKey',
|
|
|
+ label: 'NodeName',
|
|
|
+ children: 'Children',
|
|
|
+ emitPath: false,
|
|
|
+ multiple: true,
|
|
|
+ }"
|
|
|
+ collapse-tags
|
|
|
+ :show-all-levels="false"
|
|
|
+ clearable
|
|
|
+ @change="checkUser"
|
|
|
+ filterable
|
|
|
+ :placeholder="this.$t('SystemManage.OperateAuth.ph_see_user')"
|
|
|
+ style="width:300px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <div style="margin:30px 0;text-align:center">
|
|
|
+ <el-button type="primary" plain @click="isOpenSetDialog=false">{{$t('Dialog.cancel_btn')}}</el-button>
|
|
|
+ <el-button type="primary" @click="handleSetUser">{{$t('Dialog.confirm_btn')}}</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </m-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import mDialog from '@/components/mDialog.vue';
|
|
|
+import { departInterence } from '@/api/modules/setApi';
|
|
|
+import { traverseTree } from "@/utils/commonOptions"
|
|
|
+import { classifylist } from 'api/api.js';
|
|
|
+import {
|
|
|
+ reportPushInterface
|
|
|
+} from '@/api/modules/reportV2.js';
|
|
|
+export default {
|
|
|
+ components: { mDialog },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ list: [],
|
|
|
+
|
|
|
+ userOptions: [],
|
|
|
+ isOpenSetDialog: false,
|
|
|
+ classifyForm: {
|
|
|
+ users:[],
|
|
|
+ classifyId: 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted(){
|
|
|
+ this.getUserList();
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ async getList(){
|
|
|
+ const res=await classifylist()
|
|
|
+
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ this.list=res.Data.List||[]
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 获取用户列表 */
|
|
|
+ async getUserList() {
|
|
|
+
|
|
|
+ const res = await departInterence.getSystemUser();
|
|
|
+ if (res.Ret !== 200) return
|
|
|
+
|
|
|
+ this.userOptions = res.Data || []
|
|
|
+ //遍历加上唯一的key
|
|
|
+ traverseTree(
|
|
|
+ {Children:this.userOptions},
|
|
|
+ {
|
|
|
+ childKey:'Children',
|
|
|
+ nodeKey:'NodeIdKey',
|
|
|
+ cb:(node)=>node.NodeType===3,
|
|
|
+ cb2:(node)=>node.NodeId+''
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
+ this.filterTreeEmpty({Children:this.userOptions})
|
|
|
+ },
|
|
|
+
|
|
|
+ // 递归处理数组
|
|
|
+ filterTreeEmpty(arr) {
|
|
|
+ function dfs(node) {
|
|
|
+ if (Array.isArray(node.Children)) {
|
|
|
+ for (let child of node.Children) {
|
|
|
+ dfs(child);
|
|
|
+ }
|
|
|
+ if(node.Children.length===0) delete node.Children
|
|
|
+ }
|
|
|
+ //若为叶子节点,且不为用户,禁止选中
|
|
|
+ if(!node.Children||!Array.isArray(node.Children)){
|
|
|
+ if(node.NodeType!==3) node.disabled = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dfs(arr);
|
|
|
+ },
|
|
|
+
|
|
|
+ handleOpenSetUser(data,node) {
|
|
|
+ let classifyName = '';
|
|
|
+
|
|
|
+ switch(node.level){
|
|
|
+ case 1:
|
|
|
+ classifyName = data.ClassifyName;
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ classifyName = `${node.parent.data.ClassifyName}/${data.ClassifyName}`;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ classifyName = `${node.parent.parent.data.ClassifyName}/${node.parent.data.ClassifyName}/${data.ClassifyName}`;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.classifyForm = {
|
|
|
+ classifyId: data.Id,
|
|
|
+ classifyName,
|
|
|
+ users: data.IceMsgUsers ? data.IceMsgUsers.map(_ => String(_)) : []
|
|
|
+ }
|
|
|
+ this.isOpenSetDialog = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ async handleSetUser() {
|
|
|
+ const res = await reportPushInterface.setMsgUsers({
|
|
|
+ ClassifyId: this.classifyForm.classifyId,
|
|
|
+ NotifyUsers: this.classifyForm.users.map(_ => Number(_))
|
|
|
+ })
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ this.$message.success('配置成功')
|
|
|
+ this.isOpenSetDialog = false;
|
|
|
+ this.getList()
|
|
|
+ }
|
|
|
+ },
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style scoped lang='scss'>
|
|
|
+.content-box{
|
|
|
+ padding: 20px;
|
|
|
+ margin-top: 20px;
|
|
|
+ height: calc(100vh - 260px);
|
|
|
+ overflow-y: auto;
|
|
|
+ background-color: #FFFFFF;
|
|
|
+ .classify-item-wrap{
|
|
|
+ flex: 1;
|
|
|
+ padding-right: 20px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ .tag{
|
|
|
+ display: inline-block;
|
|
|
+ min-width: 76px;
|
|
|
+ line-height: 30px;
|
|
|
+ text-align: center;
|
|
|
+ &.open{
|
|
|
+ background-color: #ECF2FE;
|
|
|
+ color: #0052D9;
|
|
|
+ }
|
|
|
+ &.close{
|
|
|
+ background-color: #0052D9;
|
|
|
+ color: #fff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .opt-box{
|
|
|
+ .icon-drag,.icon-set{
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ margin-left: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+<style lang="scss">
|
|
|
+.reportPush-userSet {
|
|
|
+ .el-tree-node__content{
|
|
|
+ height: fit-content;
|
|
|
+ padding-top: 10px;
|
|
|
+ padding-bottom: 10px;
|
|
|
+ border-bottom: 1px solid #C8CDD9;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+</style>
|