luobang 2 年之前
父节点
当前提交
dd8becc591
共有 4 个文件被更改,包括 125 次插入115 次删除
  1. 100 99
      build/utils.js
  2. 2 2
      src/config/routerBefore.js
  3. 13 12
      src/views/index/components/printReceipt.vue
  4. 10 2
      src/views/index/components/printScan.vue

+ 100 - 99
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 为所有
@@ -15,138 +15,139 @@ const devPathSrc = path.resolve(__dirname, "../../../src"); // node_modules应
 // ['index','appoint','configManager','homepage',''inward,'queue','RMS','sale','serviceManager','SporadicManage'
 //       统计报表       组织机构/系统管理 采购  仓储
 //  'statisticalReport','systemConfig','TMS','WMS','workFlow']
-let devModules = ["index", "statisticalReport", "appoint", "sale"];
+//let devModules = ["index", "statisticalReport", "appoint", "sale"];
+let devModules = ['all']
 
-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 entryHtml = glob.sync(pathSrc + "/views/**/app.html"); // 根据html来
-  const devEntryHtml = glob.sync(devPathSrc + "/views/**/app.html"); // 根据html来
-  const entries = {};
+  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 flag = true;
-    flag = false;
+    _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")) {
-        flag = true;
-        break;
+      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);
-      larr = arr.slice(0, 2);
-      _chunk = larr.join("/");
+        rarr = []
+      console.log('arr: ', arr)
+      larr = arr.slice(0, 2)
+      _chunk = larr.join('/')
       if (arr.length > 2) {
-        rarr = arr.slice(2, arr.length);
-        _chunk = _chunk + "/" + rarr.join("-");
+        rarr = arr.slice(2, arr.length)
+        _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;
+        entries[_chunk] = 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
-    setEntries(filePath, _chunk);
-  });
+    let _chunk = filePath.split(pathSrc.replace(/\\/g, '/') + '/')[1] // views/index/app.html
+    setEntries(filePath, _chunk)
+  })
   devEntryHtml.forEach(filePath => {
     // views/index/app.html --> views/index   chunk有'/'则js/css会有相应的目录
-    let _chunk = filePath.split(devPathSrc.replace(/\\/g, "/") + "/")[1]; // views/index/app.html
-    setEntries(filePath, _chunk);
-  });
-  return entries;
-};
+    let _chunk = filePath.split(devPathSrc.replace(/\\/g, '/') + '/')[1] // views/index/app.html
+    setEntries(filePath, _chunk)
+  })
+  return entries
+}
 // 多入口配置(入口JS固定为main.js)
 exports.entries = function() {
   // ['babel-polyfill', './src/main.js']
-  let _entries = getEntries(".js", true);
-  return _entries;
-};
+  let _entries = getEntries('.js', true)
+  return _entries
+}
 //多页面输出配置
 exports.htmlPlugins = function() {
-  let entryHtmls = getEntries(".html");
-  let arr = [];
+  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));
+    arr.push(new HtmlWebpackPlugin(conf))
   }
-  console.log("arr:", arr);
-  return arr;
-};
+  console.log('arr:', arr)
+  return arr
+}
 
 exports.assetsPath = function(_path) {
   const assetsSubDirectory =
-    process.env.NODE_ENV === "production"
+    process.env.NODE_ENV === 'production'
       ? config.build.assetsSubDirectory
-      : config.dev.assetsSubDirectory;
+      : config.dev.assetsSubDirectory
 
-  return path.posix.join(assetsSubDirectory, _path);
-};
+  return path.posix.join(assetsSubDirectory, _path)
+}
 
 exports.cssLoaders = function(options) {
-  options = 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];
+      : [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 +158,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 +170,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);
+  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')
+    })
+  }
+}

+ 2 - 2
src/config/routerBefore.js

@@ -14,7 +14,8 @@ const whiteList = [
   '/dingtalkTaskMobileEnd',
   '/dingtalkWorkFlowMobileEnd',
   '/luckDraw',
-  '/printScan'
+  '/printScan',
+  '/printReceipt'
 ]
 
 /**
@@ -95,7 +96,6 @@ const breadcrumbFn = function(to, menu) {
 //  路由前置操作
 const routerBefore = function(router, constantRouterMap) {
   let flag = false
-  console.log('开始了')
   router.beforeEach((to, from, next) => {
     //  面包屑
     if (document.domain.indexOf('steerinfo.com') > -1) {

+ 13 - 12
src/views/index/components/printReceipt.vue

@@ -18,7 +18,7 @@
       <div id="pdfDom" v-for="(item, index) in dataList" :key="index">
         <div class="blank"></div>
 
-        <div class="title">
+        <div class="title" style="margin-bottom: 10px">
           <h5 align="center">{{ shippername }} 物资送货单</h5>
           <!--        <h5 align="center">物资送货单</h5>-->
         </div>
@@ -44,7 +44,7 @@
             border="1"
             cellpadding="10"
             cellspacing="0"
-            style="margin-top: 10px; text-align: center;height: 40px"
+            style="margin-top: 10px; text-align: center;height: 70px"
             width="1300px"
             class="tablePart1"
           >
@@ -71,7 +71,7 @@
             border="1"
             cellpadding="10"
             cellspacing="0"
-            style="border-top: 0px;height: 30px"
+            style="border-top: 0px;height: 40px"
             width="1300px"
             class="tablePart2"
           >
@@ -88,7 +88,7 @@
             border="1"
             cellpadding="10"
             cellspacing="0"
-            style="border-top: 0px;height: 30px"
+            style="border-top: 0px;height: 40px"
             width="1300px"
             class="tablePart3"
           >
@@ -105,7 +105,7 @@
             border="0"
             cellpadding="10"
             cellspacing="0"
-            style="border-top: 0px;height: 30px"
+            style="border-top: 0px;height: 40px"
             width="1300px"
             class="tablePart4"
           >
@@ -122,7 +122,7 @@
             border="1"
             cellpadding="10"
             cellspacing="0"
-            style="border-top: 0px;height: 30px"
+            style="border-top: 0px;height: 40px"
             width="1300px"
             class="tablePart9"
           >
@@ -139,7 +139,7 @@
             border="0"
             cellpadding="10"
             cellspacing="0"
-            style="margin: auto; font-size: 20px;height: 30px"
+            style="margin-left: 500px; font-size: 20px;height: 40px"
             width="1300px"
             class="tablePart6"
           >
@@ -174,13 +174,13 @@
             border="0"
             cellpadding="10"
             cellspacing="0"
-            style="margin: auto; font-size: 20px;height: 50px"
+            style="margin-left: 500px; font-size: 20px;height: 40px"
             width="1300px"
             class="tablePart6"
           >
             <tr>
-              <th style="width: 14.5%">签收人:</th>
-              <th style="width: 14.5%">签收时间:</th>
+              <th style="width: 14.5%;text-align: left">签收人:</th>
+              <th style="width: 14.5%;text-align: left">签收时间:</th>
             </tr>
           </table>
         </div>
@@ -207,9 +207,9 @@
     <!-- <el-button style="margin-left: 45%;" type="primary" @click="getPdf()">
         <i class="el-icon-download"></i>导出(pdf)
       </el-button> -->
-    <el-button type="primary" @click="backScan()">
+<!--    <el-button type="primary" @click="backScan()">
       <i class="el-icon-back"></i>返回
-    </el-button>
+    </el-button>-->
   </div>
 </template>
 
@@ -260,6 +260,7 @@ export default {
     /*this.timer1 = setTimeout(this.print,2000);*/
     // 六十秒不操作,自动返回扫码页面
     const timer = setInterval(() => {
+
       this.backScan()
     }, 30000)
     this.$once('hook:beforeDestroy', () => {

+ 10 - 2
src/views/index/components/printScan.vue

@@ -16,8 +16,12 @@
       <div v-show="false">
         手动输入开关:
       </div>
-      <i class="el-icon-full-screen" @click="fullScreen" v-show="edit1"></i>
+      <!--      <i class="el-icon-full-screen" @click="fullScreen"
+      v-show="edit1"></i>-->
       <!--      <el-switch
+=======
+      <i class="el-icon-full-screen" @click="fullScreen" v-show="edit1"></i>
+      <el-switch
         :disabled="!isEdit"
         v-show="false"
       >
@@ -37,8 +41,11 @@
       手机二维码对准下方摄像头<br />
       <i
         class="el-icon-bottom"
-        style="padding-left: 450px;font-size: 300px"
+        style="padding-left: 450px;font-size: 300px;color: red"
       ></i>
+      <span style="width: 300px;height: 200px;color: red;margin-left: 50px"
+        >zyf:***</span
+      >
     </div>
   </div>
 </template>
@@ -168,6 +175,7 @@ export default {
   .background {
     width: 100%;
     height: 100%;
+    margin-top: 30px;
     z-index: -1;
     position: absolute;
     overflow: hidden;