Explorar o código

0.0.22 trace 模块独立的打包

YangZhiJie %!s(int64=2) %!d(string=hai) anos
pai
achega
1d27646926

+ 2 - 2
.eslintrc.js

@@ -87,9 +87,9 @@ module.exports = {
     "localStorage": true,
     "window": true,
     "BootstrapDialog": true,
-    "gantt": true,
     "__webpack_public_path__": true,
     "Notify": true,
-    "Vue": true
+    "gantt": true,
+    "Vue": true,
   }
 }

+ 10 - 9
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "client-trace-v3",
-  "version": "1.0.15",
+  "version": "1.0.20",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "client-trace-v3",
-      "version": "1.0.15",
+      "version": "1.0.20",
       "devDependencies": {
         "@babel/core": "^7.17.5",
         "@babel/eslint-parser": "^7.17.0",
@@ -34,7 +34,7 @@
       },
       "peerDependencies": {
         "ant-design-vue": "^3.2.15",
-        "pc-component-v3": "1.0.81",
+        "pc-component-v3": "^1.0.69",
         "v-tooltip": "^4.0.0-beta.17",
         "vue-select": "^4.0.0-beta.6",
         "vuedraggable": "^4.1.0"
@@ -6776,11 +6776,12 @@
       }
     },
     "node_modules/pc-component-v3": {
-      "version": "1.0.64",
-      "resolved": "http://wuzhixin.vip:4873/pc-component-v3/-/pc-component-v3-1.0.64.tgz",
-      "integrity": "sha512-bJgdDLsWw5uEgMAN8ODc0G6b5E6txLR47DsPWFYUF5JSLcw4A5KlEq6KLJWvQcvRtZxUn9fj0N2f+/VKCpOpWw==",
+      "version": "1.0.82",
+      "resolved": "http://wuzhixin.vip:4873/pc-component-v3/-/pc-component-v3-1.0.82.tgz",
+      "integrity": "sha512-CGzi8CzCJIcCDjzsGrASeYxI8vSwQGaurI1Nu5n0rsSYJMI/o/vHPo0RTuXIg4FEmOYBWsf5gRy9FKMehTJEqw==",
       "peer": true,
       "peerDependencies": {
+        "ant-design-vue": "^3.2.20",
         "v-tooltip": "^4.0.0-beta.17",
         "vue": "^3.2.31",
         "vue-i18n": "^9.1.9",
@@ -14124,9 +14125,9 @@
       "dev": true
     },
     "pc-component-v3": {
-      "version": "1.0.64",
-      "resolved": "http://wuzhixin.vip:4873/pc-component-v3/-/pc-component-v3-1.0.64.tgz",
-      "integrity": "sha512-bJgdDLsWw5uEgMAN8ODc0G6b5E6txLR47DsPWFYUF5JSLcw4A5KlEq6KLJWvQcvRtZxUn9fj0N2f+/VKCpOpWw==",
+      "version": "1.0.82",
+      "resolved": "http://wuzhixin.vip:4873/pc-component-v3/-/pc-component-v3-1.0.82.tgz",
+      "integrity": "sha512-CGzi8CzCJIcCDjzsGrASeYxI8vSwQGaurI1Nu5n0rsSYJMI/o/vHPo0RTuXIg4FEmOYBWsf5gRy9FKMehTJEqw==",
       "peer": true,
       "requires": {}
     },

+ 3 - 2
package.json

@@ -1,12 +1,13 @@
 {
   "name": "client-trace-v3",
   "description": "client-trace-v3",
-  "version": "1.0.20",
+  "version": "1.0.22",
   "author": "yangzhijie <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "webpack serve --config ./webpack.dev.js",
     "build": "cross-env NODE_ENV=production webpack --mode=production --config ./webpack.prod.js --progress",
-    "build-lib": "cross-env NODE_ENV=production webpack --progress --config ./webpack.lib.js"
+    "build-lib": "cross-env NODE_ENV=production webpack --progress --config ./webpack.lib.js",
+    "pub": "npm publish --registry http://wuzhixin.vip:4873/"
   },
   "files": [
     "package.json",

+ 40 - 0
public/index-debug.html

@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+  <meta charset="utf-8">
+  <meta name="viewport" content="width=device-width,initial-scale=1.0">
+  <title>client-trace</title>
+
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap/dist/css/bootstrap.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap/dist/css//bootstrap-theme.min.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap3-dialog/dist/css/bootstrap-dialog.css">
+  
+  <link rel="stylesheet" type="text/css" href="/static/bootstrap-treeview/bootstrap-treeview.css">
+  <link rel="stylesheet" type="text/css" href="/static/summernote/dist/summernote.min.css">
+
+
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/jquery/dist/jquery.js"></script>
+
+
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/bootstrap/dist/js/bootstrap.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/bootstrap3-dialog/dist/js/bootstrap-dialog.js"></script>
+  
+	<script src="/static/bootstrap-treeview/bootstrap-treeview.js"></script>
+	<script src="/static/summernote/dist/summernote.min.js"></script>
+	<script src="/static/summernote/dist/lang/summernote-zh-CN.min.js"></script>
+	<script src="/static/dayjs/dayjs.min.js"></script>
+
+  
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue/dist/vue.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-i18n/dist/vue-i18n.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vuex/dist/vuex.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-router/dist/vue-router.global.js"></script>
+</head>
+
+<body>
+  <div id="app-client-trace"></div>
+  <!-- built files will be auto injected -->
+</body>
+
+</html>

+ 7 - 8
public/index.html → public/index-release.html

@@ -6,17 +6,16 @@
   <meta name="viewport" content="width=device-width,initial-scale=1.0">
   <title>client-trace</title>
 
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap/dist/css/bootstrap.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap/dist/css/bootstrap.min.css">
 	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap/dist/css//bootstrap-theme.min.css">
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap3-dialog/dist/css/bootstrap-dialog.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap3-dialog/dist/css/bootstrap-dialog.min.css">
   
   <link rel="stylesheet" type="text/css" href="/static/bootstrap-treeview/bootstrap-treeview.css">
   <link rel="stylesheet" type="text/css" href="/static/summernote/dist/summernote.min.css">
 
   <link rel="stylesheet" type="text/css" href="/static/dhtmlxgantt/dhtmlxgantt.css">
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/jquery/dist/jquery.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/jquery.cookie/jquery.cookie.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/jquery/dist/jquery.min.js"></script>
 
 
 	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/bootstrap/dist/js/bootstrap.js"></script>
@@ -35,10 +34,10 @@
   <script src="/static/dhtmlxgantt/ext/dhtmlxgantt_fullscreen.js"></script>
   <script src="/static/dhtmlxgantt/ext/api.js"></script>
   
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue/dist/vue.global.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-i18n/dist/vue-i18n.global.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vuex/dist/vuex.global.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-router/dist/vue-router.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue/dist/vue.global.prod.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-i18n/dist/vue-i18n.global.prod.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vuex/dist/vuex.global.prod.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-router/dist/vue-router.global.prod.js"></script>
 </head>
 
 <body>

+ 2 - 220
src/common/Common.js

@@ -194,216 +194,22 @@ export default{
 
   },
 
-  getApsURL: function (apiName) {
-    var apsBaseUrl = localStorage.getItem('apsBaseUrl');
-    if (apsBaseUrl == undefined) {
-      Notify.error('错误', '系统参数"apsBaseUrl"未设置,请联系系统管理员设置参数', false);
-      return;
-    }
-    return apsBaseUrl + apiName;
-  },
-
-  getActivitiURL: function (apiName) {
-    var apsBaseUrl = localStorage.getItem('activitiUrl');
-    if (apsBaseUrl == undefined) {
-      Notify.error('错误', '系统参数"activitiUrl"未设置,请联系系统管理员设置参数', false);
-      return;
-    }
-    return apsBaseUrl + apiName;
-  },
 
-  getSchedulingURL: function (apiName) {
-    var _self = this;
-    var apsBaseUrl = localStorage.getItem('schedulingUrl');
-    if (apsBaseUrl == undefined) {
-      _self.loadSystemParam('schedulingUrl', function () {
-        apsBaseUrl = localStorage.getItem('schedulingUrl');
-        if (apsBaseUrl == undefined) {
-          Notify.error('错误', '系统参数"schedulingUrl"未设置,请联系系统管理员设置参数', false);
-          return;
-        }
-      });
-    }
-    return apsBaseUrl + apiName;
-  },
 
-  getCameraURL: function (apiName) {
-    var apsBaseUrl = localStorage.getItem('cameraBaseURL');
-    if (apsBaseUrl == undefined) {
-      Notify.error('错误', '系统参数"cameraBaseURL"未设置,请联系系统管理员设置参数', false);
-      return;
-    }
-    return apsBaseUrl + apiName;
-  },
 
-  //设置路径到localStorage
-  setHref: function () {
-    var href = window.location.href;
-    if (href.indexOf('http') == 0) {
-      href = href.substring(0, href.indexOf('#') + 2);
-      localStorage.setItem('href', href);
-    } else {
-      var hostPageBaseURL = localStorage.getItem('hostPageBaseURL');
-      if (hostPageBaseURL == undefined) {
-        let href = window.location.href;
-        href = href.substring(0, href.indexOf('#') + 2);
-        localStorage.setItem('href', href);
-      }
-    }
-  },
 
-  //加载系统参数到localStorage
-  loadSystemParam: function (systemParamName, success) {
-    var that = this;
-    $.ajax({
-      url: that.getApiURL('SystemParamResource/loadSystemParam'),
-      type: 'GET',
-      dataType: 'text',
-      data: {
-        'systemParamName': systemParamName,
-      },
-      beforeSend: function (request) {
-        that.addTokenToRequest(request);
-      },
-      success: function (data) {
-        localStorage.setItem(systemParamName, data);
-        success();
-      },
-      error: function (XMLHttpRequest, textStatus, errorThrown) {
-        that.processException(XMLHttpRequest, textStatus, errorThrown);
-      },
-    });
-  },
 
   // 给请求头中加上account和token信息
   addTokenToRequest: function (request) {
-    var token = $.cookie('token');
-    var account = $.cookie('account');
-    if (token == undefined) {
-      var localStorageToken = localStorage.getItem('#token');
-      if (localStorageToken != undefined) {
-        token = localStorageToken;
-      }
-    }
-    if (account == undefined) {
-      var localStorageAccount = localStorage.getItem('#accountId');
-      if (localStorageAccount != undefined) {
-        account = localStorageAccount;
-      }
-    }
+    var token = localStorage.getItem('#token');
+    var account = localStorage.getItem('#accountId');
     request.setRequestHeader('account', account);
     request.setRequestHeader('token', token);
 
   },
 
-  /**
-   * 获取Token
-   */
-  getToken: function () {
-    return $.cookie('token');
-  },
-
-  // 获取新建对象的Id
-  getNewRecordId: function () {
-    window.CRUDId++;
-    return window.CRUDId;
-  },
-
-  // 清空 Cookie
-  clearCookie: function () {
-    var keys = document.cookie.match(/[^ =;]+(?==)/g);
-    if (keys) {
-      for (var i = keys.length; i--;) {
-        // 清除当前域名路径的有限日期
-        document.cookie = keys[i] + '=0;path=/;expires=' + new Date(0).toUTCString();
-        // Domain Name域名 清除当前域名的
-        document.cookie = keys[i] + '=0;path=/;domain=' + document.domain + ';expires=' + new Date(0).toUTCString();
-        // 清除一级域名下的或指定的
-        document.cookie = keys[i] + '=0;path=/;domain=baidu.com;expires=' + new Date(0).toUTCString();
-      }
-    }
-  },
-
-  clearLocalStorage: function () {
-    // 清理localStorage时需要保留的参数列表
-    var reserveParams = ['hostPageBaseURL', 'workShopId', 'resourceInstanceId',
-      'resourceInstanceName', 'apsBaseUrl', 'cameraBaseURL'];
-    //存放的信息
-    var reserveParamValues = [];
-
-    //获取参数信息 
-    var len = reserveParams.length;
-    for (var i = 0; i < len; i++) {
-      var reserveParam = reserveParams[i];
-      var reserveParamValue = '';
-      if (localStorage.getItem(reserveParam) != undefined) {
-        reserveParamValue = localStorage.getItem(reserveParam);
-      }
-      reserveParamValues.push(reserveParamValue);
-    }
-
-    //清理localStorage
-    window.localStorage.clear();
-
-    //还原参数信息
-    for (let i = 0; i < len; i++) {
-      localStorage.setItem(reserveParams[i], reserveParamValues[i]);
-    }
-
-  },
 
-  showDialog: function (title, content, type) {
-    if (type == 'success') {
-      Notify.success(title, content, 4000);
-    }
-    else if (type == 'error') {
-      Notify.error(title, content, -1);
-    }
-    else if (type == 'info') {
-      Notify.info(title, content, 2000);
-    }
-    else if (type == 'notice') {
-      Notify.notice(title, content, 2000);
-    }
-  },
 
-  //合并路由数组
-  mergeArray: function (arr1, arr2) {
-    var arr = [];
-    for (var k = 0, len = arr1.length; k < len; k++) {
-      arr.push(arr1[k]);
-    }
-    for (var i = 0, len2 = arr2.length; i < len2; i++) {
-      //是否添加该元素
-      var flag = true;
-      for (var j = 0, len1 = arr.length; j < len1; j++) {
-        //如果path相同,则合并children;如果children不存在,则不合并;
-        if (arr[j].path == arr2[i].path) {
-          flag = false;
-          if (arr[j].children instanceof Array && arr2[i].children instanceof Array) {
-            arr[j].children = this.mergeArray(arr[j].children, arr2[i].children);
-          }
-        }
-      }
-      if (flag) {
-        arr.push(arr2[i]);
-      }
-    }
-    //将path为"*"的项移到最后
-    var temp;
-    var index;
-    for (var n = 0, len3 = arr.length; n < len3; n++) {
-      if (arr[n].path == '*' || arr[n].path == '/*') {
-        index = n;
-      }
-    }
-    if (index != undefined) {
-      temp = arr[index];
-      arr[index] = arr[len3 - 1];
-      arr[len3 - 1] = temp;
-    }
-    return arr;
-  },
 
   // 获取路由中的参数
   getRouteParam: function (name) {
@@ -425,30 +231,6 @@ export default{
     }
   },
 
-  /**
-   * 可以修改url的参数
-   * 例如将
-   *    www.baidu.com
-   * 修改为
-   *    www.baidu.com?name=123
-   * 操作为
-   *    window.location.href = changeURLArg(window.location.href,'name',123)
-   */
-  changeURLArg: function (url, arg, value) {
-    var pattern = arg + '=([^&]*)';
-    var replaceText = arg + '=' + value;
-    if (url.match(pattern)) {
-      var tmp = '/(' + arg + '=)([^&]*)/gi';
-      tmp = url.replace(eval(tmp), replaceText);
-      return tmp;
-    } else {
-      if (url.match('[?]')) {
-        return url + '&' + replaceText;
-      } else {
-        return url + '?' + replaceText;
-      }
-    }
-  },
 
 };
 

+ 0 - 7
src/main.js

@@ -12,13 +12,6 @@ import Antd from 'ant-design-vue';
 
 import 'jquery';
 
-// gantt 全局引用
-// import gantt from 'gantt';
-
-// console.log(gantt);
-// bug fixed by jack 
-// 在加载 css 的时候 font 不能被正确的加载
-// import './assets/summernote.css';
 
 import 'ant-design-vue/dist/antd.css';
 

+ 2 - 2
src/trace/ProjectAdminUserList.vue

@@ -79,7 +79,7 @@
 <script>
 
 import Common from '../common/Common.js';
-import { Uuid } from 'pc-component-v3';
+import { Uuid, Notify } from 'pc-component-v3';
 
 export default {
   components: {
@@ -220,7 +220,7 @@ export default {
       }
 
       if (userIds.length == 0) {
-        Common.showDialog('不能保存', '至少需要选择一个人员', 'error');
+        Notify.error('不能保存', '至少需要选择一个人员', -1);
         return;
       }
 

+ 1 - 1
webpack.base.js

@@ -13,6 +13,7 @@ module.exports = {
         {
           test: /\.js$/,
           loader: 'babel-loader',
+          exclude: /node_modules/,
           // include: [        
           //   path.resolve(__dirname, './node_modules/pc-component-v3/dist/pc-component-v3.js'),      
           // ],
@@ -73,7 +74,6 @@ module.exports = {
     'vue-i18n': 'VueI18n',
     'vue-router': 'VueRouter',
     'vuex': 'Vuex',
-    // 'gantt': 'gantt'
   },
   
   plugins: [

+ 12 - 12
webpack.dev.js

@@ -33,65 +33,65 @@ module.exports = WebpackMerge.merge(baseConfig, {
     compress: false,
     proxy: {
       '/api': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/static': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/content': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/dashboard': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/mock': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/authApi': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/Dictionary': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/Files': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: false,
         changeOrigin: true,
         secure:true,
       },
       '/WebSocket': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: true,
         changeOrigin: true,
       },
       '/TrainVideo': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: true,
         changeOrigin: true,
       },
       '/gateway-api': {
-        target: 'http://localhost:83/',
+        target: 'http://localhost:10022/',
         ws: true,
         changeOrigin: true,
         secure:true,
@@ -109,7 +109,7 @@ module.exports = WebpackMerge.merge(baseConfig, {
   plugins: (module.exports.plugins || []).concat([
     new HtmlWebpackPlugin({
       title: 'Prodog',
-      template: './public/index.html',  // 源模板文件
+      template: './public/index-debug.html',  // 源模板文件
       filename: './index.html', // 输出文件【注意:这里的根路径是module.exports.output.path】
       chunks: ['main']
     })

+ 19 - 13
webpack.prod.js

@@ -4,7 +4,8 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
 const HtmlWebpackPlugin = require('html-webpack-plugin');
 const WebpackMerge = require('webpack-merge')
 const baseConfig = require('./webpack.base.js')
-const { name } = require('./package');
+const TerserPlugin = require('terser-webpack-plugin');
+const { CleanWebpackPlugin } = require('clean-webpack-plugin');
 
 module.exports =  WebpackMerge.merge(baseConfig, {
   mode: 'production',
@@ -20,10 +21,8 @@ module.exports =  WebpackMerge.merge(baseConfig, {
 
 
   output: {
-    path: path.resolve(__dirname, './dist/client-trace-v3'),
+    path: path.resolve(__dirname, './dist'),
     publicPath: './',
-    library: `${name}`,
-    libraryTarget: 'umd', // 把微应用打包成 umd 库格式
     filename: './client-trace-v3-bundle/[name].[contenthash:8].js',
     chunkFilename: './client-trace-v3-chunk/[name].[contenthash:8].js',
   },
@@ -32,10 +31,19 @@ module.exports =  WebpackMerge.merge(baseConfig, {
   
   optimization: {
     minimize: true,    // 压缩 bundle
+    minimizer: [new TerserPlugin({
+      parallel: true, //使用多进程并发运行以提高构建速度 Boolean|Number 默认值: true  
+      terserOptions: {
+        format: {
+          comments: false,//删除注释
+        },
+      },
+      extractComments: false, //不将注释提取到单独的文件中
+    })],
     splitChunks: {
       // include all types of chunks
       chunks: 'all',
-      // name: false,
+      name: false,
       minSize: 30000,
       maxSize: 500000,
       cacheGroups: {
@@ -46,7 +54,7 @@ module.exports =  WebpackMerge.merge(baseConfig, {
           priority: 2,
           minChunks: 2,
         },
-      }
+      },
     },
   },
 
@@ -55,21 +63,19 @@ module.exports =  WebpackMerge.merge(baseConfig, {
 
   plugins: (module.exports.plugins || []).concat([
 
+    // 清除dist文件夹
+    new CleanWebpackPlugin(),
 
     new HtmlWebpackPlugin({
       title: 'Prodog',
-      template: './public/index.html',  // 源模板文件
-      filename: './index.html', // 输出文件【注意:这里的根路径是module.exports.output.path】
+      template: './public/index-release.html',  // 源模板文件
+      filename: './task-trace.html', // 输出文件【注意:这里的根路径是module.exports.output.path】
       chunks: ['main']
     }),
 
-    new webpack.LoaderOptionsPlugin({
-      minimize: true
-    }),
-
     // CSS 提取
     new MiniCssExtractPlugin({
-      filename: "./asset-style/[name].[contenthash:8].css"
+      filename: "./client-trace-v3-style/[name].[contenthash:8].css"
     }),
 
   ])