Browse Source

添加日志管理

asd123a20 3 years ago
parent
commit
03d360f86c

+ 2 - 1
admin-code/vue.config.js

@@ -1,8 +1,9 @@
 const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
-console.log(path.join(frameSrc));
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3001,
     headers: {

+ 2 - 0
admin-column/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3006,
     headers: {

+ 2 - 0
admin-content/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3007,
     headers: {

+ 20 - 4
admin-files/vue.config.js

@@ -1,10 +1,19 @@
-const packageName = require('./package.json').name
-
+const path = require('path');
+const frameSrc = path.resolve(__dirname, '../admin-frame');
+const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
-    port: 3002,
+    port: 3003,
     headers: {
       'Access-Control-Allow-Origin': '*'
+    },
+    proxy: {
+      '/api/': {
+        target: 'http://192.168.0.45:18090'
+        // target: 'http://127.0.0.1:18090'
+      }
     }
   },
   configureWebpack: {
@@ -12,6 +21,13 @@ module.exports = {
       library: `${packageName}-[name]`,
       libraryTarget: 'umd',
       jsonpFunction: `webpackJsonp_${packageName}`
+    },
+    resolve: {
+      alias: {
+        '@components': path.join(frameSrc, '/src/components'),
+        '@style': path.join(frameSrc, '/style'),
+        '@lib': path.join(frameSrc, '/lib')
+      }
     }
   }
-}
+};

+ 1 - 0
admin-frame/.env.development

@@ -0,0 +1 @@
+VUE_APP_DEV=true

+ 1 - 0
admin-frame/.env.pre

@@ -0,0 +1 @@
+VUE_APP_DEV=false

+ 17 - 10
admin-frame/lib/apps.js

@@ -1,13 +1,14 @@
 // .env配置
 const config = {
-  tabs: eval(process.env.VUE_APP_TABS ?? false)
+  tabs: eval(process.env.VUE_APP_TABS ?? false),
+  dev: eval(process.env.VUE_APP_DEV ?? false)
 };
 export default [
   {
     // 子应用名称
     name: 'admin-code',
     // 子应用入口
-    entry: '//localhost:3001',
+    entry: config.dev ? '//localhost:3001/admin-code/' : './admin-code',
     // 子应用渲染ID
     container: config.tabs ? '#code' : '#content',
     // 路由匹配规则
@@ -21,51 +22,57 @@ export default [
   // },
   {
     name: 'admin-user',
-    entry: '//localhost:3003',
+    entry: config.dev ? '//localhost:3003/admin-user/' : 'admin-user',
     container: config.tabs ? '#adminUser' : '#content',
     activeRule: '/admin/adminUser'
   },
   {
     name: 'admin-role',
-    entry: '//localhost:3004',
+    entry: config.dev ? '//localhost:3004/admin-role/' : 'admin/role',
     container: config.tabs ? '#role' : '#content',
     activeRule: '/admin/role'
   },
   // 内容管理
   {
     name: 'admin-menus',
-    entry: '//localhost:3005',
+    entry: config.dev ? '//localhost:3005/admin-menus/' : 'admin-menus',
     container: config.tabs ? '#menus' : '#content',
     activeRule: '/admin/menus'
   },
   {
     name: 'admin-column',
-    entry: '//localhost:3006',
+    entry: config.dev ? '//localhost:3006/admin-column/' : 'admin-column',
     container: config.tabs ? '#column' : '#content',
     activeRule: '/admin/column'
   },
   {
     name: 'admin-contents',
-    entry: '//localhost:3007',
+    entry: config.dev ? '//localhost:3007/admin-contents/' : 'admin-contents',
     container: config.tabs ? '#contents' : '#content',
     activeRule: '/admin/contents'
   },
   {
     name: 'admin-pages',
-    entry: '//localhost:3008',
+    entry: config.dev ? '//localhost:3008/admin-pages' : 'admin-pages',
     container: config.tabs ? '#pages' : '#content',
     activeRule: '/admin/pages'
   },
   {
     name: 'admin-imgNews',
-    entry: '//localhost:3009',
+    entry: config.dev ? '//localhost:3009/admin-imgNews/' : 'admin-imgNews',
     container: config.tabs ? '#imgNews' : '#content',
     activeRule: '/admin/imgNews'
   },
   {
     name: 'admin-toConfig',
-    entry: '//localhost:3010',
+    entry: config.dev ? '//localhost:3010/admin-toConfig/' : 'admin-toConfig',
     container: config.tabs ? '#toConfig' : '#content',
     activeRule: '/admin/toConfig'
+  },
+  {
+    name: 'admin-log',
+    entry: config.dev ? '//localhost:3011/admin-log/' : 'admin-log',
+    container: config.tabs ? '#log' : '#content',
+    activeRule: '/admin/log'
   }
 ];

+ 2 - 2
admin-frame/package.json

@@ -3,8 +3,8 @@
   "version": "0.1.0",
   "private": true,
   "scripts": {
-    "serve": "vue-cli-service serve",
-    "build": "vue-cli-service build",
+    "serve": "vue-cli-service serve --mode development",
+    "build": "vue-cli-service build --mode pre",
     "lint": "vue-cli-service lint"
   },
   "dependencies": {

+ 2 - 1
admin-frame/vue.config.js

@@ -5,8 +5,8 @@ const baseUrl = '/admin/';
 
 module.exports = {
   publicPath: baseUrl,
+  outputDir: path.join(frameSrc, '../../admin-web'),
   productionSourceMap: false,
-
   configureWebpack: {
     resolve: {
       alias: {
@@ -23,6 +23,7 @@ module.exports = {
     proxy: {
       '/api/': {
         target: 'http://192.168.0.45:18090'
+        // target: 'http://127.0.0.1:18090'
       },
       '/upload/': {
         target: 'http://192.168.0.45:9002'

+ 2 - 0
admin-img-news/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3009,
     headers: {

+ 3 - 0
admin-log/.browserslistrc

@@ -0,0 +1,3 @@
+> 1%
+last 2 versions
+not dead

+ 5 - 0
admin-log/.editorconfig

@@ -0,0 +1,5 @@
+[*.{js,jsx,ts,tsx,vue}]
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
+insert_final_newline = true

+ 2 - 0
admin-log/.env

@@ -0,0 +1,2 @@
+# 窗口使用弹出还是抽屉 (dialog And drawer)
+VUE_APP_WINDOW=dialog

+ 1 - 0
admin-log/.eslintignore

@@ -0,0 +1 @@
+public-path.js

+ 23 - 0
admin-log/.eslintrc.js

@@ -0,0 +1,23 @@
+module.exports = {
+  root: true,
+  env: {
+    node: true
+  },
+  extends: [
+    'plugin:vue/essential',
+    '@vue/standard'
+  ],
+  parserOptions: {
+    parser: 'babel-eslint'
+  },
+  rules: {
+    'no-console': 0,
+    'no-debugger': 0,
+    'comma-dangle': [2, 'never'],
+    'no-extra-parens': 2,
+    'no-extra-semi': 2,
+    semi: [2, 'always'],
+    'space-before-function-paren': [0, 'always'],
+    eqeqeq: 0
+  }
+};

+ 23 - 0
admin-log/.gitignore

@@ -0,0 +1,23 @@
+.DS_Store
+node_modules
+/dist
+
+
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+pnpm-debug.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw?

+ 24 - 0
admin-log/README.md

@@ -0,0 +1,24 @@
+# admin-role
+
+## Project setup
+```
+npm install
+```
+
+### Compiles and hot-reloads for development
+```
+npm run serve
+```
+
+### Compiles and minifies for production
+```
+npm run build
+```
+
+### Lints and fixes files
+```
+npm run lint
+```
+
+### Customize configuration
+See [Configuration Reference](https://cli.vuejs.org/config/).

+ 5 - 0
admin-log/babel.config.js

@@ -0,0 +1,5 @@
+module.exports = {
+  presets: [
+    '@vue/cli-plugin-babel/preset'
+  ]
+};

File diff suppressed because it is too large
+ 12565 - 0
admin-log/package-lock.json


+ 35 - 0
admin-log/package.json

@@ -0,0 +1,35 @@
+{
+  "name": "admin-log",
+  "version": "0.1.0",
+  "private": true,
+  "scripts": {
+    "serve": "vue-cli-service serve",
+    "build": "vue-cli-service build",
+    "lint": "vue-cli-service lint"
+  },
+  "dependencies": {
+    "core-js": "^3.6.5",
+    "element-ui": "^2.15.6",
+    "sass": "^1.48.0",
+    "sass-loader": "^10.0.0",
+    "vue": "^2.6.11",
+    "vue-router": "^3.2.0",
+    "vuex": "^3.4.0"
+  },
+  "devDependencies": {
+    "@vue/cli-plugin-babel": "~4.5.0",
+    "@vue/cli-plugin-eslint": "~4.5.0",
+    "@vue/cli-plugin-router": "~4.5.0",
+    "@vue/cli-plugin-vuex": "~4.5.0",
+    "@vue/cli-service": "~4.5.0",
+    "@vue/eslint-config-standard": "^5.1.2",
+    "babel-eslint": "^10.1.0",
+    "eslint": "^6.7.2",
+    "eslint-plugin-import": "^2.20.2",
+    "eslint-plugin-node": "^11.1.0",
+    "eslint-plugin-promise": "^4.2.1",
+    "eslint-plugin-standard": "^4.0.0",
+    "eslint-plugin-vue": "^6.2.2",
+    "vue-template-compiler": "^2.6.11"
+  }
+}

BIN
admin-log/public/favicon.ico


+ 17 - 0
admin-log/public/index.html

@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
+    <title><%= htmlWebpackPlugin.options.title %></title>
+  </head>
+  <body>
+    <noscript>
+      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
+    </noscript>
+    <div id="app"></div>
+    <!-- built files will be auto injected -->
+  </body>
+</html>

+ 24 - 0
admin-log/src/App.vue

@@ -0,0 +1,24 @@
+<template>
+  <div id="app">
+    <router-view></router-view>
+  </div>
+</template>
+
+<script>
+export default {
+  components: {},
+  computed: {},
+  data() {
+    return {};
+  },
+  mounted() {},
+  methods: {}
+};
+</script>
+
+<style lang="scss" scoped>
+#app {
+  width: 100%;
+  height: 100%;
+}
+</style>

BIN
admin-log/src/assets/logo.png


+ 48 - 0
admin-log/src/main.js

@@ -0,0 +1,48 @@
+import Vue from 'vue';
+import App from './App.vue';
+import VueRouter from 'vue-router';
+import routes from './router';
+import store from './store';
+import ElementUI from 'element-ui';
+import 'element-ui/lib/theme-chalk/index.css';
+import './public-path.js';
+import dict from '@lib/dict.js';
+import tree from '@lib/tree.js';
+import resChange from '@lib/resChange.js';
+Vue.config.productionTip = false;
+Vue.use(VueRouter);
+Vue.use(ElementUI);
+Vue.use(dict);
+Vue.use(tree);
+Vue.use(resChange);
+let router = null;
+let instance = null;
+function render (props = {}) {
+  const { container } = props;
+  router = new VueRouter({
+    base: window.__POWERED_BY_QIANKUN__ ? '/admin/log/' : '/',
+    mode: 'history',
+    routes
+  });
+  instance = new Vue({
+    router,
+    store,
+    render: (h) => h(App)
+  }).$mount(container ? container.querySelector('#app') : '#app');
+}
+
+// 独立运行时
+if (!window.__POWERED_BY_QIANKUN__) {
+  render();
+}
+
+export async function bootstrap () {}
+export async function mount (props) {
+  render(props);
+}
+export async function unmount () {
+  instance.$destroy();
+  instance.$el.innerHTML = '';
+  instance = null;
+  router = null;
+}

+ 3 - 0
admin-log/src/public-path.js

@@ -0,0 +1,3 @@
+if (window.__POWERED_BY_QIANKUN__) {
+  __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__;
+}

+ 11 - 0
admin-log/src/router/index.js

@@ -0,0 +1,11 @@
+import home from '../views/home.vue';
+
+const routes = [
+  {
+    path: '/home',
+    name: 'home',
+    component: home
+  }
+];
+
+export default routes;

+ 33 - 0
admin-log/src/store/index.js

@@ -0,0 +1,33 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import $axios from '@lib/axios.js';
+const api = {
+  logQuery: '/api/log/log/query'
+};
+Vue.use(Vuex);
+const state = () => ({
+  Total: 0,
+  logList: []
+});
+
+const actions = {
+  async logQuery ({ commit }, { filter, paging } = {}) {
+    const res = await $axios.get(api.logQuery, { ...filter, skip: paging.page, limit: paging.size });
+    commit('logQuery', res);
+    return res;
+  }
+};
+
+const mutations = {
+  logQuery(state, payload) {
+    state.logList = payload.data;
+    state.Total = payload.total;
+  }
+};
+
+export default new Vuex.Store({
+  state,
+  actions,
+  mutations,
+  modules: {}
+});

+ 82 - 0
admin-log/src/views/home.vue

@@ -0,0 +1,82 @@
+<template>
+  <div class="box">
+    <el-card class="box-card">
+      <div slot="header" class="clearfix">
+        <span>日志管理</span>
+      </div>
+      <div class="main">
+        <filterList ref="filterList" :operation="operation" :tableData="logList" :filed="filed" @look="look" @query="filterQuery" :total="Total"></filterList>
+      </div>
+    </el-card>
+    <dialogAndDrawer :width="'35%'" :title="title" :visibleSync="visibleSync" v-if="visibleSync" @close="visibleSync = false">
+      <template v-slot:windowMain>
+        <p>模块: {{ formdata.service }}</p>
+        <p>服务: {{ formdata.module }}</p>
+        <p>方法: {{ formdata.method }}</p>
+        <p>结果: {{ formdata.result }}</p>
+        <p>帐号: {{ formdata.userName }}</p>
+        <p>名称: {{ formdata.name }}</p>
+        <p>详情: {{ formdata.details }}</p>
+      </template>
+    </dialogAndDrawer>
+  </div>
+</template>
+<script>
+import filterList from '@components/filterList/index.vue';
+import dialogAndDrawer from '@components/dialogAndDrawer.vue';
+import { mapState, mapActions } from 'vuex';
+export default {
+  components: {
+    filterList,
+    dialogAndDrawer
+  },
+  data() {
+    return {
+      title: '',
+      visibleSync: false,
+      operation: [
+        { name: 'look', label: '详情', icon: 'el-icon-menu' }
+      ],
+      filed: [
+        { name: 'service', label: '模块', filter: true },
+        { name: 'module', label: '服务', filter: true },
+        { name: 'method', label: '方法', filter: true },
+        { name: 'result', label: '结果', filter: true },
+        { name: 'userName', label: '帐号', filter: true }
+      ],
+      formdata: {}
+    };
+  },
+  computed: {
+    ...mapState(['logList', 'Total'])
+  },
+  async mounted() {
+    await this.filterQuery();
+  },
+  methods: {
+    ...mapActions(['logQuery']),
+    // 修改
+    look (e) {
+      this.formdata = e;
+      this.title = '日志详情';
+      this.visibleSync = true;
+    },
+    // 查询
+    async filterQuery ({ filter = {}, paging = { page: 0, size: 10 } } = {}) {
+      await this.logQuery({ filter, paging });
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+.box {
+  width: 100%;
+  height: 100%;
+  .box-card {
+    height: 100%;
+    .el-card__body {
+      height: 100%;
+    }
+  }
+}
+</style>

+ 33 - 0
admin-log/vue.config.js

@@ -0,0 +1,33 @@
+const path = require('path');
+const frameSrc = path.resolve(__dirname, '../admin-frame');
+const packageName = require('./package.json').name;
+module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
+  devServer: {
+    port: 3011,
+    headers: {
+      'Access-Control-Allow-Origin': '*'
+    },
+    proxy: {
+      '/api/': {
+        target: 'http://192.168.0.45:18090'
+        // target: 'http://127.0.0.1:18090'
+      }
+    }
+  },
+  configureWebpack: {
+    output: {
+      library: `${packageName}-[name]`,
+      libraryTarget: 'umd',
+      jsonpFunction: `webpackJsonp_${packageName}`
+    },
+    resolve: {
+      alias: {
+        '@components': path.join(frameSrc, '/src/components'),
+        '@style': path.join(frameSrc, '/style'),
+        '@lib': path.join(frameSrc, '/lib')
+      }
+    }
+  }
+};

+ 2 - 0
admin-menu/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3005,
     headers: {

+ 2 - 0
admin-page/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3008,
     headers: {

+ 2 - 0
admin-role/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3004,
     headers: {

+ 2 - 0
admin-toconfig/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3010,
     headers: {

+ 2 - 0
admin-user/vue.config.js

@@ -2,6 +2,8 @@ const path = require('path');
 const frameSrc = path.resolve(__dirname, '../admin-frame');
 const packageName = require('./package.json').name;
 module.exports = {
+  publicPath: `/${packageName}/`,
+  outputDir: path.join(frameSrc, `../../admin-web/${packageName}/`),
   devServer: {
     port: 3003,
     headers: {

+ 38 - 0
xms.code-workspace

@@ -0,0 +1,38 @@
+{
+	"folders": [
+		{
+			"path": "admin-frame"
+		},
+		{
+			"path": "admin-code"
+		},
+		{
+			"path": "admin-role"
+		},
+		{
+			"path": "admin-user"
+		},
+		{
+			"path": "admin-menu"
+		},
+		{
+			"path": "admin-column"
+		},
+		{
+			"path": "admin-page"
+		},
+		{
+			"path": "admin-content"
+		},
+		{
+			"path": "admin-img-news"
+		},
+		{
+			"path": "admin-toconfig"
+		},
+		{
+			"path": "admin-log"
+		},
+	],
+	"settings": {}
+}