luobang 3 tahun lalu
induk
melakukan
b15d4a3358

+ 91 - 87
build/utils.js

@@ -1,13 +1,13 @@
-'use strict'
-const path = require('path')
-const config = require('../config')
-const ExtractTextPlugin = require('extract-text-webpack-plugin')
-const packageConfig = require('../package.json')
-const HtmlWebpackPlugin = require('html-webpack-plugin');
-const merge = require('webpack-merge');
-const glob = require('glob');
-const pathSrc = path.resolve(__dirname, '../src'); // F:\webui\multiple-pages\demo\src
-const devPathSrc = path.resolve(__dirname, '../../../src'); // node_modules应用下
+"use strict";
+const path = require("path");
+const config = require("../config");
+const ExtractTextPlugin = require("extract-text-webpack-plugin");
+const packageConfig = require("../package.json");
+const HtmlWebpackPlugin = require("html-webpack-plugin");
+const merge = require("webpack-merge");
+const glob = require("glob");
+const pathSrc = path.resolve(__dirname, "../src"); // F:\webui\multiple-pages\demo\src
+const devPathSrc = path.resolve(__dirname, "../../../src"); // node_modules应用下
 
 // 指定开发模式下需要加载的模块(可以做到只加载当前模块,提高开发效率)
 // index模块(登录)为必须,all 为所有
@@ -18,135 +18,139 @@ const devPathSrc = path.resolve(__dirname, '../../../src'); // node_modules应
 // let devModules = ['index','inward']
 // let devModules = ['index','appoint','sale','statisticalReport','RMS','TMS']
 // let devModules = ['index','TMS']
-let devModules = ['index','appoint']
+// let devModules = ["index", "appoint", "sale"];
+let devModules = ["all"];
 // let devModules = ['index','statisticalReport','inward']
-if (pathSrc.indexOf('node_modules') > -1) {
-    devModules = require('../../../cors.js').devModules;
+if (pathSrc.indexOf("node_modules") > -1) {
+  devModules = require("../../../cors.js").devModules;
 }
 // 获取入口集合
-const getEntries = function (suffix, polyfill) {
+const getEntries = function(suffix, polyfill) {
   // 自动获取
-  const entryHtml = glob.sync(pathSrc + '/views/**/app.html'); // 根据html来
-  const devEntryHtml = glob.sync(devPathSrc + '/views/**/app.html'); // 根据html来
+  const entryHtml = glob.sync(pathSrc + "/views/**/app.html"); // 根据html来
+  const devEntryHtml = glob.sync(devPathSrc + "/views/**/app.html"); // 根据html来
   const entries = {};
-  let setEntries = function (filePath, _chunk) {
-    _chunk = _chunk.substring(0, _chunk.lastIndexOf('/'));
+  let setEntries = function(filePath, _chunk) {
+    _chunk = _chunk.substring(0, _chunk.lastIndexOf("/"));
     let flag = true;
     flag = false;
     for (let item of devModules) {
-      if (item && (_chunk.indexOf('views/' + item) >= 0 || item === 'all')) {
+      if (item && (_chunk.indexOf("views/" + item) >= 0 || item === "all")) {
         flag = true;
         break;
       }
     }
     if (flag) {
-      let arr = _chunk.split('/'),
+      let arr = _chunk.split("/"),
         larr = [],
         rarr = [];
-      console.log('arr: ', arr);
+      console.log("arr: ", arr);
       larr = arr.slice(0, 2);
-      _chunk = larr.join('/');
+      _chunk = larr.join("/");
       if (arr.length > 2) {
         rarr = arr.slice(2, arr.length);
-        _chunk = _chunk + '/' + rarr.join('-');
+        _chunk = _chunk + "/" + rarr.join("-");
       }
       if (suffix) {
-        filePath = filePath.replace('.html', suffix);
+        filePath = filePath.replace(".html", suffix);
       }
       if (polyfill) {
-        entries[_chunk] = ['babel-polyfill', filePath];
+        entries[_chunk] = ["babel-polyfill", filePath];
       } else {
         entries[_chunk] = filePath;
       }
     }
-  }
-  entryHtml.forEach((filePath) => {
+  };
+  entryHtml.forEach(filePath => {
     // views/index/app.html --> views/index   chunk有'/'则js/css会有相应的目录
-    let _chunk = filePath.split(pathSrc.replace(/\\/g, '/') + '/')[1]; // views/index/app.html
+    let _chunk = filePath.split(pathSrc.replace(/\\/g, "/") + "/")[1]; // views/index/app.html
     setEntries(filePath, _chunk);
   });
-  devEntryHtml.forEach((filePath) => {
+  devEntryHtml.forEach(filePath => {
     // views/index/app.html --> views/index   chunk有'/'则js/css会有相应的目录
-    let _chunk = filePath.split(devPathSrc.replace(/\\/g, '/') + '/')[1]; // views/index/app.html
+    let _chunk = filePath.split(devPathSrc.replace(/\\/g, "/") + "/")[1]; // views/index/app.html
     setEntries(filePath, _chunk);
   });
   return entries;
 };
 // 多入口配置(入口JS固定为main.js)
-exports.entries = function () {
+exports.entries = function() {
   // ['babel-polyfill', './src/main.js']
-  let _entries = getEntries('.js', true);
+  let _entries = getEntries(".js", true);
   return _entries;
 };
 //多页面输出配置
-exports.htmlPlugins = function () {
-  let entryHtmls = getEntries('.html');
+exports.htmlPlugins = function() {
+  let entryHtmls = getEntries(".html");
   let arr = [];
   for (let _chunk in entryHtmls) {
-    console.log('loading chunk:', _chunk);
+    console.log("loading chunk:", _chunk);
     // _chunk :views/index/index
     let conf = {
-      favicon: pathSrc + '/assets/img/favicon.ico', //favicon路径,通过webpack引入同时可以生成hash值
+      favicon: pathSrc + "/assets/img/favicon.ico", //favicon路径,通过webpack引入同时可以生成hash值
       template: entryHtmls[_chunk], // html模板路径
       // filename: 'views/' + fileName, // 生成的html存放路径,相对于path
-      filename: _chunk + '.html',
+      filename: _chunk + ".html",
       chunks: [_chunk],
       inject: true // js插入的位置,true/'head'/'body'/false
     };
-    if (process.env.NODE_ENV === 'production') {
-      console.log('package content: ', _chunk)
+    if (process.env.NODE_ENV === "production") {
+      console.log("package content: ", _chunk);
       conf = merge(conf, {
-        chunks: ['manifest', 'vendor', _chunk],
+        chunks: ["manifest", "vendor", _chunk],
         minify: {
           // removeAttributeQuotes: true, // 删除可删除的引号
           removeComments: true, // 移除HTML中的注释
           collapseWhitespace: true // 删除空白符与换行符
         },
-        chunksSortMode: 'dependency'
-      })
+        chunksSortMode: "dependency"
+      });
     }
     arr.push(new HtmlWebpackPlugin(conf));
   }
- console.log('arr:', arr);
+  console.log("arr:", arr);
   return arr;
 };
 
-exports.assetsPath = function (_path) {
-  const assetsSubDirectory = process.env.NODE_ENV === 'production' ?
-    config.build.assetsSubDirectory :
-    config.dev.assetsSubDirectory
+exports.assetsPath = function(_path) {
+  const assetsSubDirectory =
+    process.env.NODE_ENV === "production"
+      ? config.build.assetsSubDirectory
+      : config.dev.assetsSubDirectory;
 
-  return path.posix.join(assetsSubDirectory, _path)
-}
+  return path.posix.join(assetsSubDirectory, _path);
+};
 
-exports.cssLoaders = function (options) {
-  options = options || {}
+exports.cssLoaders = function(options) {
+  options = options || {};
 
   const cssLoader = {
-    loader: 'css-loader',
+    loader: "css-loader",
     options: {
       sourceMap: options.sourceMap
     }
-  }
+  };
 
   const postcssLoader = {
-    loader: 'postcss-loader',
+    loader: "postcss-loader",
     options: {
       sourceMap: options.sourceMap
     }
-  }
+  };
 
   // generate loader string to be used with extract text plugin
   function generateLoaders(loader, loaderOptions) {
-    const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
+    const loaders = options.usePostCSS
+      ? [cssLoader, postcssLoader]
+      : [cssLoader];
 
     if (loader) {
       loaders.push({
-        loader: loader + '-loader',
+        loader: loader + "-loader",
         options: Object.assign({}, loaderOptions, {
           sourceMap: options.sourceMap
         })
-      })
+      });
     }
 
     // Extract CSS when that option is specified
@@ -157,11 +161,11 @@ exports.cssLoaders = function (options) {
         // 解决打包后背景图片路径不对的问题
         // static/css/views/index/index.css
         // ../../../../static/img/xx.jpg
-        publicPath: '../../../', // 注意: 此处根据路径, 自动更改
-        fallback: 'vue-style-loader'
-      })
+        publicPath: "../../../", // 注意: 此处根据路径, 自动更改
+        fallback: "vue-style-loader"
+      });
     } else {
-      return ['vue-style-loader'].concat(loaders)
+      return ["vue-style-loader"].concat(loaders);
     }
   }
 
@@ -169,46 +173,46 @@ exports.cssLoaders = function (options) {
   return {
     css: generateLoaders(),
     postcss: generateLoaders(),
-    less: generateLoaders('less'),
-    sass: generateLoaders('sass', {
+    less: generateLoaders("less"),
+    sass: generateLoaders("sass", {
       indentedSyntax: true
     }),
-    scss: generateLoaders('sass'),
-    stylus: generateLoaders('stylus'),
-    styl: generateLoaders('stylus')
-  }
-}
+    scss: generateLoaders("sass"),
+    stylus: generateLoaders("stylus"),
+    styl: generateLoaders("stylus")
+  };
+};
 
 // Generate loaders for standalone style files (outside of .vue)
-exports.styleLoaders = function (options) {
-  const output = []
-  const loaders = exports.cssLoaders(options)
+exports.styleLoaders = function(options) {
+  const output = [];
+  const loaders = exports.cssLoaders(options);
 
   for (const extension in loaders) {
-    const loader = loaders[extension]
+    const loader = loaders[extension];
     output.push({
-      test: new RegExp('\\.' + extension + '$'),
+      test: new RegExp("\\." + extension + "$"),
       use: loader
-    })
+    });
   }
 
-  return output
-}
+  return output;
+};
 
 exports.createNotifierCallback = () => {
-  const notifier = require('node-notifier')
+  const notifier = require("node-notifier");
 
   return (severity, errors) => {
-    if (severity !== 'error') return
+    if (severity !== "error") return;
 
-    const error = errors[0]
-    const filename = error.file && error.file.split('!').pop()
+    const error = errors[0];
+    const filename = error.file && error.file.split("!").pop();
 
     notifier.notify({
       title: packageConfig.name,
-      message: severity + ': ' + error.name,
-      subtitle: filename || '',
-      icon: path.join(__dirname, 'logo.png')
-    })
-  }
-}
+      message: severity + ": " + error.name,
+      subtitle: filename || "",
+      icon: path.join(__dirname, "logo.png")
+    });
+  };
+};

+ 48 - 48
config/index.js

@@ -1,49 +1,50 @@
-'use strict'
+"use strict";
 // Template version: 1.3.1
 // see http://vuejs-templates.github.io/webpack for documentation.
 
-const path = require('path')
+const path = require("path");
 
-const pathSrc = path.resolve(__dirname, '../src');
+const pathSrc = path.resolve(__dirname, "../src");
 
 let proxyTable = {
-  '/icore.icp.web/pass/v1/sysusers/user/token': {  //https://portal.steerinfo.com/icore.icp.web/pass/sso/v1/sysusers/user/token
+  "/icore.icp.web/pass/v1/sysusers/user/token": {
+    //https://portal.steerinfo.com/icore.icp.web/pass/sso/v1/sysusers/user/token
     //target: 'https://portal-dev.steerinfo.com/icore.icp.web/pass/sso/v1/sysusers/user/token',
-    target:'http://172.16.33.166:9001/v1/sysusers/user/token',
+    target: "http://172.16.33.166:9001/v1/sysusers/user/token",
     changeOrigin: true,
     pathRewrite: {
-      '^/icore.icp.web/pass/v1/sysusers/user/token': '/'
+      "^/icore.icp.web/pass/v1/sysusers/user/token": "/"
     }
   },
-  '/icore.icp.web/pass/v1': {
+  "/icore.icp.web/pass/v1": {
     //target: 'http://172.16.33.161:80/v1', //加http
-    target: 'http://172.16.33.166:9001/v1',
+    target: "http://172.16.33.166:9001/v1",
     changeOrigin: true,
     pathRewrite: {
-      '^/icore.icp.web/pass/v1': '/' //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替
+      "^/icore.icp.web/pass/v1": "/" //这里理解成用‘/api’代替target里面的地址,组件中我们调接口时直接用/api代替
       // 比如我要调用'http://0.0:300/user/add',直接写‘/api/user/add’即可 代理后地址栏显示/
     }
   },
-   '/icore.icp.web/pass/auth/login': {
-     //target: 'http://sso-dev.steerinfo.com/icore.icp.web/pass/auth/login',
-     target: 'http://172.16.33.166:9001/auth/login',
-     changeOrigin: true,
-     pathRewrite: {
-       '^/icore.icp.web/pass/auth/login': ''
-     }
-   },
-   '/icore-api': {
-    target: 'http://172.16.33.166:9001',
+  "/icore.icp.web/pass/auth/login": {
+    //target: 'http://sso-dev.steerinfo.com/icore.icp.web/pass/auth/login',
+    target: "http://172.16.33.166:9001/auth/login",
     changeOrigin: true,
     pathRewrite: {
-      '^/icore-api': '/'
+      "^/icore.icp.web/pass/auth/login": ""
     }
   },
-  '/icore.icp.web/pass/act': {
-    target: 'http://172.16.33.166:8095',
+  "/icore-api": {
+    target: "http://172.16.33.166:9001",
     changeOrigin: true,
     pathRewrite: {
-      '^/icore.icp.web/pass/act': '/'
+      "^/icore-api": "/"
+    }
+  },
+  "/icore.icp.web/pass/act": {
+    target: "http://172.16.33.166:8095",
+    changeOrigin: true,
+    pathRewrite: {
+      "^/icore.icp.web/pass/act": "/"
     }
   },
   // 表格表单请求的域名地址
@@ -80,31 +81,31 @@ let proxyTable = {
       "^/views/api/v1": "/api/v1"
     }
   },
-  '/icore.icp.web/pass/logout': {
-    target: 'http://172.16.33.166:9001/logout',
+  "/icore.icp.web/pass/logout": {
+    target: "http://172.16.33.166:9001/logout",
     changeOrigin: true,
     pathRewrite: {
-      '^/icore.icp.web/pass/logout': '/'
-    }
-  },
-}
-let dist = '../dist';
-if (pathSrc.indexOf('node_modules') > -1) {
-    dist = '../../../dist';
-    let proxyTableGet = require('../../../cors.js').proxyTable;
-    for (let i in proxyTableGet) {
-        proxyTable[i] = proxyTableGet[i]
+      "^/icore.icp.web/pass/logout": "/"
     }
+  }
+};
+let dist = "../dist";
+if (pathSrc.indexOf("node_modules") > -1) {
+  dist = "../../../dist";
+  let proxyTableGet = require("../../../cors.js").proxyTable;
+  for (let i in proxyTableGet) {
+    proxyTable[i] = proxyTableGet[i];
+  }
 }
 
 module.exports = {
-    dev: {
-      // Paths
-      assetsSubDirectory: 'static',
-      assetsPublicPath: '/',
-      proxyTable: proxyTable,
+  dev: {
+    // Paths
+    assetsSubDirectory: "static",
+    assetsPublicPath: "/",
+    proxyTable: proxyTable,
     // Various Dev Server settings
-    host: 'localhost', // can be overwritten by process.env.HOST
+    host: "localhost", // can be overwritten by process.env.HOST
     port: 8802, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,
@@ -141,15 +142,14 @@ module.exports = {
     }
   },
 
-  
   build: {
     // Template for index.html
-    index: path.resolve(__dirname, dist + '/index.html'),
+    index: path.resolve(__dirname, dist + "/index.html"),
 
     // Paths
     assetsRoot: path.resolve(__dirname, dist),
-    assetsSubDirectory: 'static', // 打包后 static放的位置
-    assetsPublicPath: '../', // html中webpack打包的JS -> ../static/xxx.js
+    assetsSubDirectory: "static", // 打包后 static放的位置
+    assetsPublicPath: "../", // html中webpack打包的JS -> ../static/xxx.js
 
     /**
      * Source Maps
@@ -157,14 +157,14 @@ module.exports = {
 
     productionSourceMap: false,
     // https:       //webpack.js.org/configuration/devtool/#production
-    devtool: '#source-map',
+    devtool: "#source-map",
 
     // Gzip off by default as many popular static hosts such as
     // Surge or Netlify already gzip all static assets for you.
     // Before setting to `true`, make sure to:
     // npm install --save-dev compression-webpack-plugin
     productionGzip: false,
-    productionGzipExtensions: ['js', 'css'],
+    productionGzipExtensions: ["js", "css"],
 
     // Run the build command with an extra argument to
     // View the bundle analyzer report after build finishes:
@@ -172,4 +172,4 @@ module.exports = {
     // Set to `true` or `false` to always turn it on or off
     bundleAnalyzerReport: process.env.npm_config_report
   }
-}
+};

+ 64 - 34
src/views/sale/components/offSiteTransportation/currentLocation.vue

@@ -4,8 +4,21 @@
     <div class="controller">
       <div class="in_transit_information">
         <span class="item_details">车牌号:</span>
-        <el-input style="width: 120px;" class="inputStyle" v-model.trim="carNumber"> </el-input>
-        <el-button type="primary" class="searchstyle" @click="initData">查询</el-button>
+        <el-input
+          style="width: 120px;"
+          class="inputStyle"
+          v-model.trim="carNumber"
+        >
+        </el-input>
+        <el-button type="primary" class="searchstyle" @click="initData"
+          >查询</el-button
+        >
+        <el-button type="primary" class="searchstyle" @click="openInfo"
+          >打开信息窗体</el-button
+        >
+        <el-button type="primary" class="searchstyle" @click="closeinfo"
+          >关闭信息窗口</el-button
+        >
       </div>
     </div>
   </div>
@@ -17,6 +30,7 @@ import { sjTime, stringToDate } from "@/utils/sharedJsFile";
 import Slider from "./slider.vue";
 Vue.use(Slider);
 import Vue from "vue";
+var infoWindow;
 export default {
   name: "PathView",
   setup() {
@@ -38,22 +52,18 @@ export default {
   },
   data() {
     return {
-     
       //查询车牌号
       carNumber: "",
       //地图组件
-      map:null,
-
+      map: null
     };
   },
   created() {
-    let that =this;
-    that.initMap(105.602725,37.076636)
+    let that = this;
+    that.initMap(105.602725, 37.076636);
   },
   mounted() {},
   methods: {
-    
-
     //初始化数据
     initData() {
       let that = this;
@@ -62,40 +72,53 @@ export default {
         return;
       }
       that.axios
-        .get("/api/v1/otms/getCurrentLocation?capcityNumber="+that.carNumber)
+        .get("/api/v1/otms/getCurrentLocation?capcityNumber=" + that.carNumber)
         .then(res => {
-              console.log(res.data.data)
-              if(res.data.data=='-1'){
-                 this.$message.error('自提车辆无权查看!');
-              }else if(res.data.data.status!='1006'){
-                console.log("res.data.data.status")
-                  that.map.setCenter([res.data.data.result.lon,res.data.data.result.lat]);
-                  //画车
-                  that.initMarkes( 45,60, require("@/assets/img/car1.png"),res.data.data.result.lon,res.data.data.result.lat,"现在所在位置");
-                  //显示窗体
-                  that.initCustomMarkes(that.carNumber,res.data.data.result.adr,res.data.data.result.lon,res.data.data.result.lat);
-              }else{
-                  this.$message.error("车辆暂时无GPS");
-              }
-          });
-          
+          console.log(res.data.data);
+          if (res.data.data == "-1") {
+            this.$message.error("自提车辆无权查看!");
+          } else if (res.data.data.status != "1006") {
+            console.log("res.data.data.status");
+            that.map.setCenter([
+              res.data.data.result.lon,
+              res.data.data.result.lat
+            ]);
+            //画车
+            that.initMarkes(
+              45,
+              60,
+              require("@/assets/img/car1.png"),
+              res.data.data.result.lon,
+              res.data.data.result.lat,
+              "现在所在位置"
+            );
+            //显示窗体
+            that.initCustomMarkes(
+              that.carNumber,
+              res.data.data.result.adr,
+              res.data.data.result.lon,
+              res.data.data.result.lat
+            );
+          } else {
+            this.$message.error("车辆暂时无GPS");
+          }
+        });
     },
-   
-   
+
     //初始化地图
-    initMap(lon,lat) {
+    initMap(lon, lat) {
       lazyAMapApiLoaderInstance.load().then(() => {
         let that = this;
         that.map = new AMap.Map("amap-container", {
           //设置地图容器id
           viewMode: "2D", //是否为2D地图模式
           zoom: 18, //初始化地图级别
-          center: [lon,lat] //初始化地图中心点位置105.602725,37.076636
+          center: [lon, lat] //初始化地图中心点位置105.602725,37.076636
         });
       });
     },
 
-     //创建简单的标记
+    //创建简单的标记
     initMarkes(weight, height, image, lon, lat, title) {
       let that = this;
       //图标标记点
@@ -114,7 +137,7 @@ export default {
       // 将创建的点标记添加到已有的地图实例:
       that.map.add(pointmarker);
     },
-   
+
     //初始化窗体
     initCustomMarkes(title, details, lon, lat) {
       let that = this;
@@ -129,13 +152,20 @@ export default {
       ];
       // 创建 infoWindow 实例
       var infoWindow = new AMap.InfoWindow({
-        content: content.join("<br>"),//传入 dom 对象,或者 html 字符串
-        offset:new AMap.Pixel(0,-20)//修改信息差窗体偏移
+        content: content.join("<br>"), //传入 dom 对象,或者 html 字符串
+        offset: new AMap.Pixel(0, -20) //修改信息差窗体偏移
       });
       // 打开信息窗体
       infoWindow.open(that.map, [lon, lat]);
+      infoWindow.close();
+    },
+    // 关闭信息窗口
+    closeinfo() {
+      infoWindow.close();
     },
-  
+    openInfo() {
+      infoWindow.open();
+    }
   }
 };
 </script>