chenmy 3 years ago
parent
commit
f23d916c97

+ 1 - 1
TEAMModeBI/ClientApp/public/index.html

@@ -11,7 +11,7 @@
     </title>
 </head>
 <script src="https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"></script>
-<script src="https://at.alicdn.com/t/font_2934132_o31bgq7urir.js"></script>
+<script src="https://at.alicdn.com/t/font_2934132_jamkq43te8b.js"></script>
 
 <body>
     <noscript>

+ 6 - 0
TEAMModeBI/ClientApp/src/api/index.js

@@ -159,5 +159,11 @@ export default {
     //新增或编辑当前册别 (同时也支持添加实践任务)
     redactOraddAbility(data) {
         return post('/biabilitymgmt/upd-ability', data)
+    },
+
+    //操作日志类
+    //获取所有日志
+    getAlllog(data) {
+        return post('/operatelog/get-record', data)
     }
 }

+ 9 - 1
TEAMModeBI/ClientApp/src/router/index.js

@@ -24,7 +24,7 @@ const routes = [{
                 permission: "teacher-read|teacher-upd",
                 menuName: "teachermgmt",
                 isShow: true,
-                component: () => require.ensure([], (require) => require(`@/view/index/index.vue`))
+                component: () => require.ensure([], (require) => require(`@/view/index/dashboard.vue`))
             },
             {
                 name: "人员管理",
@@ -66,6 +66,14 @@ const routes = [{
                 isShow: true,
                 component: () => require.ensure([], (require) => require(`@/view/created/created.vue`))
             },
+            {
+                name: "日志",
+                path: "log",
+                permission: "batcharea-read|batcharea-upd|batchschool-read|batchschool-upd",
+                menuName: "",
+                isShow: true,
+                component: () => require.ensure([], (require) => require(`@/view/index/operateLog.vue`))
+            },
         ]
     },
     {

+ 4 - 0
TEAMModeBI/ClientApp/src/until/common.js

@@ -25,5 +25,9 @@ export default {
             return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2)
         }
         return size
+    },
+    //时间戳转日期
+    getLocalTime(nS) {
+        return new Date(parseInt(nS)).toLocaleString().replace(/:\d{1,2}$/, ' ');
     }
 }

+ 8 - 0
TEAMModeBI/ClientApp/src/until/inspect.js

@@ -16,4 +16,12 @@ export default {
     guid() {
         return this.randomId() + this.randomId() + '-' + this.randomId() + '-' + this.randomId() + '-' + this.randomId() + '-' + this.randomId() + this.randomId() + this.randomId()
     },
+    //时间戳转日期
+    getdate(time) {
+        var now = time
+        y = now.getFullYear(),
+            m = now.getMonth() + 1,
+            d = now.getDate();
+        return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + now.toTimeString().substr(0, 8);
+    }
 }

+ 58 - 25
TEAMModeBI/ClientApp/src/view/common/header.vue

@@ -1,27 +1,41 @@
 <template>
     <el-header style="text-align: right; font-size: 12px">
-        <el-dropdown>
-            <el-icon style="margin-right: 25px;margin-top:8px">
-                <el-avatar :size="40" :src="circleUrl"></el-avatar>
-            </el-icon>
-            <template #dropdown>
-                <el-dropdown-menu>
-                    <!-- <el-dropdown-item>姓名:XXX</el-dropdown-item> -->
-                    <div class="userInfo">
-                        <svg class="header-icon" aria-hidden="true">
-                            <use xlink:href="#icon-yonghu"></use>
-                        </svg>
-                        姓名:{{user.tmdName}}
-                    </div>
-                    <el-dropdown-item @click="quit">
-                        <svg class="header-icon" aria-hidden="true">
-                            <use xlink:href="#icon-tuichu"></use>
-                        </svg>
-                        退出登录
-                    </el-dropdown-item>
-                </el-dropdown-menu>
-            </template>
-        </el-dropdown>
+        <div class="logsbox" title="操作日志" @click="pushlog">
+            <svg class="log-icon" aria-hidden="true">
+                <use xlink:href="#icon-caozuorizhi-copy"></use>
+            </svg>
+        </div>
+        <div class="userbox">
+            <el-dropdown>
+                <el-icon style="margin-right: 25px;margin-top:8px">
+                    <el-avatar :size="40" :src="circleUrl"></el-avatar>
+                </el-icon>
+                <template #dropdown>
+                    <el-dropdown-menu>
+                        <!-- <el-dropdown-item>姓名:XXX</el-dropdown-item> -->
+                        <div class="userInfo">
+                            <svg class="header-icon" aria-hidden="true">
+                                <use xlink:href="#icon-yonghu"></use>
+                            </svg>
+                            姓名:{{user.tmdName}}
+                        </div>
+                        <!-- <el-dropdown-item>
+                            <svg class="header-icon" aria-hidden="true">
+                                <use xlink:href="#icon-caozuorizhi-copy"></use>
+                            </svg>
+                            操作日志
+                        </el-dropdown-item> -->
+                        <el-dropdown-item @click="quit">
+                            <svg class="header-icon" aria-hidden="true">
+                                <use xlink:href="#icon-tuichu"></use>
+                            </svg>
+                            退出登录
+                        </el-dropdown-item>
+                    </el-dropdown-menu>
+                </template>
+            </el-dropdown>
+        </div>
+
     </el-header>
 </template>
 <script>
@@ -41,11 +55,15 @@ export default {
             router.push('/login')
             localStorage.clear()
         }
+        function pushlog() {
+            router.push('/home/log')
+        }
         return {
             ...toRefs(state),
             proxy,
             user,
             quit,
+            pushlog,
         }
     },
 }
@@ -66,14 +84,29 @@ export default {
     cursor: pointer;
     outline: 0;
 }
+.logsbox,
+.userbox {
+    display: inline-block;
+}
 </style>
 <style>
 .header-icon {
-    width: 1em;
-    height: 1em;
-    vertical-align: -0.2em;
+    width: 1.2em;
+    height: 1.2em;
+    vertical-align: -0.4em;
     fill: currentColor;
     overflow: hidden;
     margin-right: 5px;
 }
+.log-icon {
+    width: 2em;
+    height: 2em;
+    vertical-align: 0.5em;
+    fill: currentColor;
+    overflow: hidden;
+    margin-right: 15px;
+}
+.log-icon:hover {
+    cursor: pointer;
+}
 </style>

+ 52 - 57
TEAMModeBI/ClientApp/src/view/ddlogin.vue

@@ -5,118 +5,113 @@
 </template>
  
 <script>
-import axios from "axios";
+import axios from 'axios'
 export default {
-    name: "App",
+    name: 'App',
     components: {},
     data() {
         return {
-            appid: "dingrucgsnt8p13rfbgd",
-            redirectUrl: "https://localhost:5001/login",
-            apiUrl: "/common/login/DingLogin",
+            appid: 'dingrucgsnt8p13rfbgd',
+            redirectUrl: 'https://bitest.teammodel.cn/login',
+            apiUrl: '/common/login/DingLogin',
             dingCodeConfig: {
-                id: "login_container",
-                style: "background-color:#FFFFFF;",
-                width: "300",
-                height: "350",
+                id: 'login_container',
+                style: 'background-color:#FFFFFF;',
+                width: '300',
+                height: '350',
             },
-        };
+        }
     },
     computed: {
         getRedirectUrl() {
-            return encodeURIComponent(this.redirectUrl);
+            return encodeURIComponent(this.redirectUrl)
         },
         getAuthUrl() {
-            return `https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=${this.appid}&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=${this.getRedirectUrl}`;
+            return `https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=${this.appid}&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=${this.getRedirectUrl}`
         },
         getGoto() {
-            return encodeURIComponent(this.getAuthUrl);
+            return encodeURIComponent(this.getAuthUrl)
         },
         getDingCodeConfig() {
-            return { ...this.dingCodeConfig, goto: this.getGoto };
+            return { ...this.dingCodeConfig, goto: this.getGoto }
         },
     },
     created() {
-        this.initDingJs();
+        this.initDingJs()
     },
     mounted() {
-        this.addDingListener();
-        this.initDingLogin();
-        this.getUser();
+        this.addDingListener()
+        this.initDingLogin()
+        this.getUser()
     },
     methods: {
         initDingJs() {
             !(function (window, document) {
                 function d(a) {
                     var e,
-                        c = document.createElement("iframe"),
-                        d =
-                            "https://login.dingtalk.com/login/qrcode.htm?goto=" +
-                            a.goto;
-                    (d += a.style
-                        ? "&style=" + encodeURIComponent(a.style)
-                        : ""),
-                        (d += a.href ? "&href=" + a.href : ""),
+                        c = document.createElement('iframe'),
+                        d = 'https://login.dingtalk.com/login/qrcode.htm?goto=' + a.goto
+                    ;(d += a.style ? '&style=' + encodeURIComponent(a.style) : ''),
+                        (d += a.href ? '&href=' + a.href : ''),
                         (c.src = d),
-                        (c.frameBorder = "0"),
-                        (c.allowTransparency = "true"),
-                        (c.scrolling = "no"),
-                        (c.width = a.width ? a.width + "px" : "365px"),
-                        (c.height = a.height ? a.height + "px" : "400px"),
+                        (c.frameBorder = '0'),
+                        (c.allowTransparency = 'true'),
+                        (c.scrolling = 'no'),
+                        (c.width = a.width ? a.width + 'px' : '365px'),
+                        (c.height = a.height ? a.height + 'px' : '400px'),
                         (e = document.getElementById(a.id)),
-                        (e.innerHTML = ""),
-                        e.appendChild(c);
+                        (e.innerHTML = ''),
+                        e.appendChild(c)
                 }
 
-                window.DDLogin = d;
-            })(window, document);
+                window.DDLogin = d
+            })(window, document)
         },
         addDingListener() {
-            let self = this;
+            let self = this
 
             let handleLoginTmpCode = function (loginTmpCode) {
-                window.location.href =
-                    self.getAuthUrl + `&loginTmpCode=${loginTmpCode}`;
-            };
+                window.location.href = self.getAuthUrl + `&loginTmpCode=${loginTmpCode}`
+            }
 
             let handleMessage = function (event) {
-                if (event.origin == "https://login.dingtalk.com") {
-                    handleLoginTmpCode(event.data);
+                if (event.origin == 'https://login.dingtalk.com') {
+                    handleLoginTmpCode(event.data)
                 }
-            };
+            }
 
-            if (typeof window.addEventListener != "undefined") {
-                window.addEventListener("message", handleMessage, false);
-            } else if (typeof window.attachEvent != "undefined") {
-                window.attachEvent("onmessage", handleMessage);
+            if (typeof window.addEventListener != 'undefined') {
+                window.addEventListener('message', handleMessage, false)
+            } else if (typeof window.attachEvent != 'undefined') {
+                window.attachEvent('onmessage', handleMessage)
             }
         },
         initDingLogin() {
-            window.DDLogin(this.getDingCodeConfig);
+            window.DDLogin(this.getDingCodeConfig)
         },
         getUser() {
             let getQueryString = function (name) {
-                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
-                var r = window.location.search.substr(1).match(reg);
+                var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
+                var r = window.location.search.substr(1).match(reg)
                 if (r != null) {
-                    return unescape(r[2]);
+                    return unescape(r[2])
                 }
-                return null;
-            };
+                return null
+            }
 
-            let code = getQueryString("code");
+            let code = getQueryString('code')
 
             if (code !== null) {
                 axios
                     .get(`${this.apiUrl}?code=${code}`)
                     .then((response) => {
-                        console.log(response);
+                        console.log(response)
                     })
                     .catch((error) => {
-                        console.log(error);
-                    });
+                        console.log(error)
+                    })
             }
         },
     },
-};
+}
 </script>

+ 0 - 10
TEAMModeBI/ClientApp/src/view/index/index.vue

@@ -1,10 +0,0 @@
-<template>
-    <div>1111</div>
-</template>
-<script>
-export default {
-    setup() {},
-}
-</script>
-<style>
-</style>

+ 66 - 0
TEAMModeBI/ClientApp/src/view/index/operateLog.vue

@@ -0,0 +1,66 @@
+<template>
+    <div class="logbox">
+        <div class="topbox">
+            <div class="exportFile">
+                <el-button type="primary" size="small">导出日志文件</el-button>
+            </div>
+        </div>
+        <div class="recordbox">
+            <el-table ref="multipleTableRef" :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
+                <el-table-column type="selection" />
+                <el-table-column prop="index" label="编号" sortable align="center" />
+                <el-table-column property="name" label="操作人姓名" align="center" />
+                <el-table-column property="tmdId" label="tmdId" align="center" />
+                <el-table-column property="platform" label="平台" sortable align="center" />
+                <el-table-column property="type" label="操作内容" align="center" />
+                <el-table-column property="rowKey" label="数据ID" align="center" />
+                <el-table-column property="msg" label="内容" align="center" />
+                <el-table-column property="convertTime" label="时间" align="center" />
+            </el-table>
+        </div>
+    </div>
+</template>
+<script>
+import { getCurrentInstance, ref } from 'vue'
+export default {
+    setup() {
+        let { proxy } = getCurrentInstance()
+        let tableData = ref([])
+        //获取所有日志内容
+        function getLogcontent(startDate, endDate, platform) {
+            let data = { single: '', startDate: startDate, endDate: endDate, platform: platform }
+            proxy.$api.getAlllog({}).then((res) => {
+                console.log(res, '日志')
+                res.operateLogs.forEach((element, index) => {
+                    element.index = index + 1
+                    element.convertTime = proxy.$common.getLocalTime(element.time)
+                })
+                tableData.value = res.operateLogs
+            })
+        }
+        getLogcontent()
+        return { tableData, getLogcontent }
+    },
+}
+</script>
+<style scoped>
+.logbox {
+    width: 100%;
+    margin: 0 auto;
+    line-height: 20px;
+}
+.topbox {
+    text-align: left;
+    padding-left: 1%;
+}
+.recordbox {
+    width: 100%;
+    padding: 1%;
+}
+</style>
+<style>
+.recordbox .el-table--fit {
+    height: 85vh;
+    overflow-y: auto;
+}
+</style>

+ 9 - 0
TEAMModeBI/ClientApp/vue.config.js

@@ -1,4 +1,13 @@
 module.exports = {
+    baseUrl: '/',
+    outputDir: '../wwwroot',
+    lintOnSave: false,
+    publicPath: './', // 默认'/',部署应用包时的基本 URL
+    outputDir: 'dist', // 'dist', 生产环境构建文件的目录
+    assetsDir: '', // 相对于outputDir的静态资源(js、css、img、fonts)目录
+    lintOnSave: false,
+    runtimeCompiler: true, // 是否使用包含运行时编译器的 Vue 构建版本
+    productionSourceMap: false, // 生产环境的 source map
     devServer: {
         overlay: {
             warnings: false,