Browse Source

消息通知

Karsa 1 year ago
parent
commit
02abcbc371

+ 28 - 0
src/api/modules/setApi.js

@@ -586,6 +586,34 @@ const operateAuthInterface = {
 	 */
 	getAuthUserByData: params => {
 		return http.get('/datamanage/edb_chart/permission/show_by_data',params)
+	},
+
+	/**
+	 * 获取消息列表
+	 * @param {*} params 
+	 * @returns 
+	 */
+	getNoticeList: params => {
+		return http.get('/datamanage/message/list',params)
+	},
+
+	/**
+	 * 标记已读
+	 * @param {*} params MessageId
+	 * @returns 
+	 */
+	redMessage: params => {
+		return http.post('/datamanage/message/read',params)
+	},
+
+	/**
+	 * 消息详情
+	 * @param {*} params 
+	 * MessageId Source SubSource PageSize CurrentIndex
+	 * @returns 
+	 */
+	getNoticeDetail: params => {
+		return http.get('/datamanage/message/detail',params)
 	}
 }
 

+ 134 - 45
src/components/notificationMsg.vue

@@ -21,7 +21,13 @@
                                 <span class="title">{{item.Content}}</span>
                                 <span class="time">{{item.CreateTime}}</span>
                             </div>
-                            <div class="content">{{item.Remark||''}}&nbsp;</div>
+                            <!-- 审批内容 -->
+                            <div class="content" v-if="activeName==='first'">{{item.Remark||''}}&nbsp;</div>
+                            <!-- 权限内容 -->
+                            <div class="content" v-else>
+                                {{item.Remark||''}}
+                                <span>,点击<el-button type="text" @click="openAuthDetail(item)">查看详情</el-button>!</span>
+                            </div>
                         </div>
                     </div>
                     <tableNoData v-if="!msgList.length" :text="$t('AprrovalPage.no_news_yet')"></tableNoData>
@@ -38,26 +44,35 @@
         
         <m-dialog
             :show.sync="isOpenAuthDia"
-            width="650px"
+            width="800px"
             title="权限变更详情"
             @close="isOpenAuthDia = false"
         >
             <div class="notice-auth-box">
                 <div class="main">
 
-                    <div class="left">
-                        <ul class="data-types">
-                            <li 
+                    <div class="left" v-if="!detailInfo.isAuthSet">
+
+                        <el-radio-group v-model="detailInfo.Source" @input="changeSource" style="margin-bottom:10px;">
+                            <el-radio-button
                                 v-for="item in tabs" 
+                                :key="item.key"
+                                :label="item.key"
+                            >{{item.label}}</el-radio-button>
+                        </el-radio-group>
+
+                        <ul class="data-types" v-if="detailInfo.Source===6">
+                            <li 
+                                v-for="item in subTabs" 
                                 :key="item.key" 
-                                :class="item.key===detailInfo.type&&'act'"
-                                @click="detailInfo.type=item.key"
+                                :class="item.key===detailInfo.SubSource&&'act'"
+                                @click="changeSubSource(item)"
                             >{{item.label}}</li>
                         </ul>
                     </div>
 
                     <div class="right">
-                        <label>ETA指标库</label>
+                        <label v-if="detailInfo.isAuthSet">{{tabs.find(_ => _.key===detailInfo.Source).label}}</label>
 
                         <el-table
                             :data="tableData"
@@ -66,6 +81,7 @@
                             v-loading="tableLoading"
                             border
                             style="margin:20px 0"
+                            max-height="400"
                         >
                             <el-table-column
                                 v-for="item in tableColums"
@@ -90,14 +106,8 @@
                 </div>
                 
                 <div class="dia-bot">
-                    <el-button
-                    type="primary"
-                    style="margin-right: 60px"
-                    @click="confirmTransferHandle"
-                    >{{$t('Dialog.confirm_save_btn')}}</el-button
-                    >
                     <el-button type="primary" plain @click="isOpenAuthDia = false"
-                    >{{$t('Dialog.cancel_btn')}}</el-button
+                    >{{$t('Dialog.known')}}</el-button
                     >
                 </div>
             </div>
@@ -107,6 +117,7 @@
 
 <script>
 import {approveInterence} from '@/api/modules/approve.js';
+import { operateAuthInterface } from '@/api/modules/setApi';
 import mDialog from './mDialog.vue';
 export default {
     components: { mDialog },
@@ -120,8 +131,14 @@ export default {
 
             //详情弹窗
             isOpenAuthDia: false,
+            tableData: [],
+            page_no: 1,
+            haveMore: false,
             detailInfo: {
-                type: 1
+                MessageId: 0,
+                isAuthSet: false,//true权限设置 false资产转移
+                Source: 1,
+                SubSource: 0,
             }
         };
     },
@@ -137,21 +154,30 @@ export default {
             ]
             return tabs
         },
+        subTabs() {
+            const subTabs = [
+                { label: /* '自定义分析' */this.$t('SystemManage.OperateAuth.tab_sub_sheet1'), key: 4 },
+                { label:/*  '时间序列表格' */this.$t('SystemManage.OperateAuth.tab_sub_sheet2'), key: 2 },
+                { label: /* '混合表格' */this.$t('SystemManage.OperateAuth.tab_sub_sheet3'), key: 3 },
+            ]
+
+            return subTabs
+        },
         tableColums() {
             const clomusMap = {
                 5: [
-                    { label: this.$t('SystemManage.OperateAuth.table_col_name01'),key: 'Name' },
-                    { label: '操作时间',key: 'UpdateTime' },
+                    { label: this.$t('SystemManage.OperateAuth.table_col_name01'),key: 'DataName' },
+                    { label: '操作时间',key: 'CreateTime' },
                 ],
                 6: [
-                    { label: this.$t('SystemManage.OperateAuth.table_col_sheet_name'),key: 'Name' },
-                    { label: '操作时间',key: 'UpdateTime' },
+                    { label: this.$t('SystemManage.OperateAuth.table_col_sheet_name'),key: 'DataName' },
+                    { label: '操作时间',key: 'CreateTime' },
                 ],
             }
-            return clomusMap[this.detailInfo.type] ? clomusMap[this.detailInfo.type] 
+            return clomusMap[this.detailInfo.Source] ? clomusMap[this.detailInfo.Source] 
                 : [
-                    { label: this.$t('SystemManage.OperateAuth.table_col_name05'),key: 'Name' },
-                    { label: '操作时间',key: 'UpdateTime' },
+                    { label: this.$t('SystemManage.OperateAuth.table_col_name05'),key: 'DataName' },
+                    { label: '操作时间',key: 'CreateTime' },
                 ]
         },
     },
@@ -160,38 +186,101 @@ export default {
             if(val){
                 this.getMsgList()
             }
+        },
+        isOpenAuthDia(nval) {
+            if(!nval){
+                this.$refs.table.bodyWrapper.removeEventListener('scroll',this.handleScroll)
+                return
+            } 
+
+            this.getAuthMsgDetail()
+            this.$nextTick(() => {
+                this.$refs.table.bodyWrapper.addEventListener('scroll',this.handleScroll)
+            })
         }
     },
     methods:{
-        readMsg(msg){
-            const {ApproveState,ReportApproveId,Id} = msg
-            approveInterence.readApproveMsg({
-                MessageId:Id
-            }).then(res=>{
-                if(res.Ret!==200) return 
-                this.getMsgList()
-            })
-            const type = ApproveState===1?'approve':ApproveState===4?'detail':'myself'
-            this.$router.push({
-                path:'/approveDetail',
-                query:{
-                    type,
-                    approveId:ReportApproveId
-                }
-            })
+        async readMsg(msg){
+            const {ApproveState,ReportApproveId,Id,DataPermissionMessageId} = msg
+            
+            const res = this.activeName === 'first' 
+                ? approveInterence.readApproveMsg({
+                    MessageId:Id
+                  })
+                : operateAuthInterface.redMessage({ MessageId: DataPermissionMessageId })
+
+            if(res.Ret!==200) return 
+            this.getMsgList()
+
+            if(this.activeName === 'first' ) {
+                const type = ApproveState===1?'approve':ApproveState===4?'detail':'myself'
+                this.$router.push({
+                    path:'/approveDetail',
+                    query:{
+                        type,
+                        approveId:ReportApproveId
+                    }
+                })
+            }
         },
         async getMsgList(){
-            let res = this.activeName === 'first' 
+            const res = this.activeName === 'first' 
                 ? await approveInterence.getApproveMsgList({
                     CurrentIndex:1,
                     PageSize:1000
                 })
-                :  null
+                : await operateAuthInterface.getNoticeList()
 
             if(res.Ret!==200) return 
             this.msgList = res.Data.List||[]
             this.UnreadTotal = res.Data.UnreadTotal||0
-        }
+        },
+
+        openAuthDetail(item) {
+            this.detailInfo.MessageId = item.DataPermissionMessageId;
+            this.detailInfo.isAuthSet = [3,4].includes(item.OpType);
+            this.detailInfo.Source = item.Source;
+            this.detailInfo.SubSource = item.SubSource;
+            this.isOpenAuthDia = true
+        },
+
+        changeSource() {
+            this.page_no = 1;
+            this.detailInfo.SubSource = this.detailInfo.Source===6?4:0;
+            this.getAuthMsgDetail()
+        },
+
+        changeSubSource({key}) {
+            this.page_no = 1;
+            this.detailInfo.SubSource = key;
+            this.getAuthMsgDetail()
+        },
+
+        async getAuthMsgDetail() {
+            const { MessageId,Source,SubSource } = this.detailInfo;
+            const res = await operateAuthInterface.getNoticeDetail({
+                MessageId,
+                Source,
+                SubSource,
+                CurrentIndex: this.page_no
+            })
+
+            if(res.Ret !== 200) return 
+
+            let arr = res.Data.List||[]
+            
+            this.haveMore = res.Data.Paging.Pages > this.page_no
+            this.tableData = this.page_no ===1 ? arr : [...this.tableData,...arr];
+        },
+
+        /* 滚动事件 */
+        handleScroll:_.throttle(function(){
+            const {scrollTop,clientHeight,scrollHeight} = this.$refs.table.bodyWrapper
+            if(scrollTop + clientHeight >= scrollHeight-10 && this.haveMore){
+                this.page_no++;
+                this.getAuthMsgDetail();
+            }
+        },300),
     }
 };
 </script>
@@ -255,15 +344,15 @@ export default {
 }
 .notice-auth-box {
     .main {
-        display: flex;
+        //display: flex;
         .left {
             flex-shrink: 0;
             margin-right: 15px;
             .data-types {
+                display: flex;
+                gap: 15px;
                 li {
                     padding: 5px 0;
-                    margin-bottom: 10px;
-
                     border-bottom: 2px solid transparent;
                     &.act {
                         border-color: #0052D9;

+ 1 - 0
src/views/dataEntry_manage/chartSetting.vue

@@ -794,6 +794,7 @@
                         <span v-permission="permissionBtn.chartLibPermission.chartLib_addMy"
                             class="join_txt"
                             @click="addMychartHandle(chart)"
+                            v-if="chart.HaveOperaAuth"
                         >
                             <img
                             :src="$icons.chart_join_ico"

+ 2 - 2
src/views/mychart_manage/components/chooseChart.vue

@@ -63,7 +63,8 @@
               <img :src="(chart_source===1&&!chart.HaveOperaAuth) ? $icons.lock_big : chart.ChartImage" alt="" class="chart-img" />
               <div class="item-bottom">
                 <span class="last-time"><!-- 最近更新 -->{{$t('MyEtaPage.label_update_time')}}:{{ chart.ModifyTime.substr(0,10) }}</span>
-                <span class="join_txt" @click="addMychartHandle(chart)">
+                <span class="join_txt" @click="addMychartHandle(chart)" 
+                v-if="(chart.HaveOperaAuth&&chart_source===1)||chart_source!==1">
                   <img
                     :src="$icons.chart_join_ico"
                     alt=""
@@ -166,7 +167,6 @@ export default {
 
     /* 加入我的图库 */
     addMychartHandle(item) {
-      if(this.chart_source===1&&!item.HaveOperaAuth) return this.$message.warning(this.$t('MsgPrompt.no_chart_auth'))
 
       this.add_chart_id = item.ChartInfoId;
       //已有的分类ids