quwangxin 2 years ago
parent
commit
408f984f4b

+ 1 - 0
.eslintrc.js

@@ -11,6 +11,7 @@ module.exports = {
     'eslint:recommended',
     'plugin:prettier/recommended'
   ],
+
   parserOptions: {
     ecmaVersion: 2020,
     sourceType: 'module'

+ 1 - 1
package.json

@@ -53,7 +53,7 @@
     "@vue/cli-service": "^5.0.8",
     "compression-webpack-plugin": "^9.2.0",
     "eslint": "^8.23.0",
-    "eslint-config-prettier": "^8.5.0",
+    "eslint-config-prettier": "^8.10.0",
     "eslint-plugin-prettier": "^4.2.1",
     "eslint-plugin-vue": "^9.4.0",
     "prettier": "^2.7.1",

+ 1 - 0
src/App.vue

@@ -9,6 +9,7 @@
 
   export default {
     name: 'App',
+
     created() {
       // 恢复主题
       this.$store.dispatch('theme/recoverTheme');

+ 116 - 111
src/components/print/OrderPrint.vue

@@ -39,9 +39,9 @@
           :key="index"
           v-if="item.taskTypeName === '挤压成型'"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 挤压成型</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 挤压成型</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -65,9 +65,9 @@
           :key="index"
           v-else-if="item.taskTypeName === '自然干燥'"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 自然干燥</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 自然干燥</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -90,9 +90,9 @@
           :key="index"
           v-else-if="item.taskTypeName === '升温干燥'"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 升温干燥</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 升温干燥</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
 
           <template v-for="(itm, idx) in item.list || []">
@@ -116,9 +116,9 @@
           :key="index"
           v-else-if="item.taskTypeName.includes('定长')"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 半加定长</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 半加定长</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -141,9 +141,9 @@
           :key="index"
           v-else-if="item.taskTypeName === '备炉'"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 备炉</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 备炉</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -166,9 +166,9 @@
           :key="index"
           v-else-if="item.taskTypeName === '烧结'"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 烧结</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 烧结</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -191,9 +191,9 @@
           :key="index"
           v-else-if="item.taskTypeName === '质检'"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 质检</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 质检</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -216,9 +216,9 @@
           :key="index"
           v-else-if="item.taskTypeName === '包装'"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 包装</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 包装</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -246,14 +246,11 @@
                 >物料编号:{{ material.code }}
               </el-col>
               <el-col :span="4" class="border-dashed-right border-dashed-bottom"
-                >数量:{{ material.number }}
+                >物料数量:{{ material.number }}
               </el-col>
-              <el-col :span="4" class="border-dashed-right border-dashed-bottom"
+              <el-col :span="8" class="border-dashed-right border-dashed-bottom"
                 >批次号:{{ material.batchNo }}
               </el-col>
-              <el-col :span="4" class="border-dashed-right border-dashed-bottom"
-                >数量:{{ material.number }}
-              </el-col>
             </el-col>
           </template>
           <el-col :span="24" v-if="!(item.list && item.list.length)">
@@ -265,9 +262,9 @@
           class="processes-data"
           v-else-if="item.taskTypeName.includes('库')"
         >
-          <el-col :span="24" class="bg top"
-            ><div class="title">{{ index + 1 }}0 入库</div></el-col
-          >
+          <el-col :span="24" class="bg top">
+            <div class="title">{{ index + 1 }}0 入库</div>
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -286,16 +283,16 @@
           </el-col>
         </el-row>
         <el-row class="processes-data" :key="index" v-else>
-          <el-col :span="24" class="bg top"
-            ><div class="title"
+          <el-col :span="24" class="bg top">
+            <div class="title"
               >{{ index + 1 }}0
               {{
                 item.taskTypeName === '深加工'
                   ? '深加工(精磨)'
                   : item.taskTypeName
               }}</div
-            ></el-col
-          >
+            >
+          </el-col>
           <!-- <el-col :span="10" class="bg top">备注:</el-col> -->
           <template v-for="(itm, idx) in item.list || []">
             <el-col
@@ -346,7 +343,7 @@
         default: ''
       }
     },
-    data () {
+    data() {
       return {
         visible: false,
         typeList: {
@@ -367,7 +364,7 @@
             key: 'brandNo',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm.workReportCategoryList[0]?.brandNum;
             }
           },
@@ -376,7 +373,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm.workReportCategoryList[0]?.batchNo;
             }
           },
@@ -385,7 +382,7 @@
             key: 'feedingWeight',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm.workReportCategoryList[0]?.number;
             }
           },
@@ -394,8 +391,8 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.standardNum;
+            formatter(itm) {
+              return itm.productInfo?.standardNum + '';
             }
           },
           {
@@ -403,8 +400,8 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.noStandardNum;
+            formatter(itm) {
+              return itm.productInfo?.noStandardNum || '0';
             }
           },
 
@@ -413,7 +410,7 @@
             key: 'deviceCode',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
@@ -425,7 +422,7 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 5
               );
@@ -437,7 +434,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
@@ -449,7 +446,7 @@
             key: 'boatNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
@@ -462,7 +459,7 @@
             key: 'stampingTimes',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 5
               );
@@ -500,7 +497,7 @@
             key: 'dryingDuration',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm.workReportArea?.extraField?.dryTime;
             }
           },
@@ -509,8 +506,8 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.standardNum;
+            formatter(itm) {
+              return itm.productInfo?.standardNum + '';
             }
           },
           {
@@ -518,8 +515,8 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.noStandardNum;
+            formatter(itm) {
+              return itm.productInfo?.noStandardNum || '0';
             }
           },
           {
@@ -527,7 +524,7 @@
             key: 'areaCode',
             span: 8,
             class: 'border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm.workReportArea?.code;
             }
           },
@@ -537,7 +534,7 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right ',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
@@ -570,7 +567,7 @@
             key: 'temperatureRamp',
             span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
@@ -588,8 +585,8 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.standardNum;
+            formatter(itm) {
+              return itm.productInfo?.standardNum + '';
             }
           },
           {
@@ -597,16 +594,16 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.noStandardNum;
+            formatter(itm) {
+              return itm.productInfo?.noStandardNum || '0';
             }
           },
           {
             label: '设备号',
             key: 'deviceCode',
-            span: 4,
+            span: 8,
             class: ' border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
@@ -619,7 +616,7 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
@@ -641,7 +638,7 @@
           {
             label: '备注',
             key: 'remark',
-            span: 4,
+            span: 8,
             class: 'border-dashed-right'
           }
         ],
@@ -658,8 +655,8 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.standardNum;
+            formatter(itm) {
+              return itm.productInfo?.standardNum + '';
             }
           },
           {
@@ -667,8 +664,8 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.noStandardNum;
+            formatter(itm) {
+              return itm.productInfo?.noStandardNum || '0';
             }
           },
           {
@@ -676,7 +673,7 @@
             key: 'deviceCode',
             span: 8,
             class: ' border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
@@ -689,7 +686,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
@@ -701,7 +698,7 @@
             key: 'boatNum',
             span: 4,
             class: 'border-dashed-right',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 8
               );
@@ -734,7 +731,7 @@
             key: 'xxx',
             span: 8,
             class: 'border-dashed-right',
-            formatter (itm) {
+            formatter(itm) {
               const obj = itm.workReportCategoryList.find(
                 (i) => i.rootCategoryLevelId == 9
               );
@@ -746,7 +743,7 @@
             key: 'deviceCode',
             span: 4,
             class: 'border-dashed-right',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
@@ -762,15 +759,15 @@
           {
             label: '日期',
             key: 'executeTime',
-            span: 4,
-            class: 'border-dashed-right'
-          },
-          {
-            label: '备注',
-            key: 'remark',
-            span: 4,
+            span: 8,
             class: 'border-dashed-right'
           }
+          // {
+          //   label: '备注',
+          //   key: 'remark',
+          //   span: 4,
+          //   class: 'border-dashed-right'
+          // }
         ],
         // 烧结
         sinter: [
@@ -785,8 +782,8 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.standardNum;
+            formatter(itm) {
+              return itm.productInfo?.standardNum + '';
             }
           },
           {
@@ -794,8 +791,8 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom border-dashed-right',
-            formatter (itm) {
-              return itm.productInfo?.noStandardNum;
+            formatter(itm) {
+              return itm.productInfo?.noStandardNum || '0';
             }
           },
           {
@@ -803,7 +800,7 @@
             key: 'deviceCode',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
@@ -977,8 +974,8 @@
             key: 'standardNum',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.standardNum;
+            formatter(itm) {
+              return itm.productInfo?.standardNum + '';
             }
           },
           {
@@ -986,8 +983,8 @@
             key: 'noStandardNum',
             span: 4,
             class: 'border-dashed-bottom',
-            formatter (itm) {
-              return itm.productInfo?.noStandardNum;
+            formatter(itm) {
+              return itm.productInfo?.noStandardNum || '0';
             }
           },
           {
@@ -995,7 +992,7 @@
             key: 'deviceCode',
             span: 4,
             class: 'border-dashed-right',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 4
               );
@@ -1026,9 +1023,9 @@
           {
             label: '包装要求',
             key: 'xxx',
-            span: 4,
+            span: 8,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm?.packInfo?.packDemand;
             }
           },
@@ -1037,7 +1034,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm?.packInfo?.packUnit;
             }
           },
@@ -1046,7 +1043,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm?.packInfo?.packNum;
             }
           },
@@ -1055,8 +1052,8 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
-              return `PCS/${itm.packInfo.packUnit}`;
+            formatter(itm) {
+              return `${itm.packInfo.minPackNum}PCS/${itm.packInfo.packUnit}`;
             }
           },
           {
@@ -1064,7 +1061,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm?.packInfo?.netWeight;
             }
           },
@@ -1073,7 +1070,7 @@
             key: 'xxx',
             span: 4,
             class: ' border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm?.packInfo?.roughWeight;
             }
           },
@@ -1082,7 +1079,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               return itm?.packInfo?.surplusNum;
             }
           },
@@ -1095,15 +1092,15 @@
           {
             label: '日期',
             key: 'executeTime',
-            span: 4,
-            class: 'border-dashed-right'
-          },
-          {
-            label: '备注',
-            key: 'remark',
             span: 12,
             class: 'border-dashed-right'
           }
+          // {
+          //   label: '备注',
+          //   key: 'remark',
+          //   span: 12,
+          //   class: 'border-dashed-right'
+          // }
         ],
         // 预缴库
         preStorage: [
@@ -1112,7 +1109,7 @@
             key: 'xxx',
             span: 4,
             class: 'border-dashed-right border-dashed-bottom',
-            formatter (itm) {
+            formatter(itm) {
               const obj = (itm.workReportDeviceList || []).find(
                 (i) => i.rootCategoryLevelId == 9
               );
@@ -1142,11 +1139,11 @@
     },
 
     methods: {
-      open () {
+      open() {
         this.visible = true;
         this.init();
       },
-      init () {
+      init() {
         for (const p of this.processList) {
           this.$set(p, 'list', []);
         }
@@ -1160,13 +1157,14 @@
           }
         });
       },
-      cancel () {
+      cancel() {
         this.visible = false;
       },
       //打印
-      handlePrint () {
+      handlePrint() {
         this.PrintLoading = true;
         const page = this.$refs.pagesRef;
+
         const pHeight = page.offsetHeight;
         const pWidth = page.offsetWidth;
 
@@ -1201,9 +1199,11 @@
 <style scoped lang="scss">
   $heihgt: 36px;
   $border: 1px solid #ddd;
+
   * {
     box-sizing: border-box !important;
   }
+
   .bg {
     background-color: #f1f1f1;
     line-height: $heihgt - 2px;
@@ -1213,9 +1213,11 @@
   .border-dashed-right {
     border-right: $border;
   }
+
   .border-dashed-bottom {
     border-bottom: $border;
   }
+
   .main-data {
     .bg {
       text-align: center;
@@ -1230,6 +1232,7 @@
       border-bottom: $border;
       padding-left: 10px;
     }
+
     .code {
       line-height: 2 * $heihgt;
       height: 2 * $heihgt;
@@ -1251,11 +1254,13 @@
       color: #000;
       font-weight: bold;
     }
+
     :deep(.el-col) {
       line-height: $heihgt - 2px;
       height: $heihgt;
       padding-left: 10px;
     }
+
     .top {
       border-top: $border;
       border-bottom: $border;

+ 18 - 0
src/utils/math.js

@@ -0,0 +1,18 @@
+export function add(a, b) {
+  let aLen = (a + '').split('.')[1]?.length || 0;
+  let bLen = (b + '').split('.')[1]?.length || 0;
+
+  const powN = Math.pow(10, Math.max(aLen, bLen));
+
+  return (a * powN + b * powN) / powN;
+}
+
+export function multiply(a, b) {
+  let aLen = (a + '').split('.')[1]?.length || 0;
+  let bLen = (b + '').split('.')[1]?.length || 0;
+
+  const powA = Math.pow(10, aLen);
+  const powB = Math.pow(10, bLen);
+
+  return (a * powA * (b * powB)) / (powA * powB);
+}

+ 0 - 89
src/utils/pdf copy.js

@@ -1,89 +0,0 @@
-import html2canvas from 'html2canvas';
-import jsPDF from 'jspdf';
-
-const ratio = 1; //放大 兼容低分辨率屏幕清晰度
-
-const margin = 10; //边距
-// A4宽高
-const a4Width = 595.28;
-const a4Height = 841.89;
-// let pdf = null;
-export const downloadPDF = (page, fileName = '工单') => {
-  // direction : 方向
-  return new Promise((resolve, reject) => {
-    html2canvas(page, { scale: ratio }).then(function (canvas) {
-      var contentWidth = canvas.width;
-      var contentHeight = canvas.height;
-
-      //一页pdf显示html页面生成的canvas高度;
-      var pageHeight = (contentWidth / a4Width) * a4Height;
-      //未生成pdf的html页面高度
-      var leftHeight = contentHeight;
-      //页面偏移
-      var position = 10;
-      //a4纸的尺寸[595.28,841.89],html页面生成的canvas在pdf中图片的宽高
-      var imgWidth = a4Width - margin * 2;
-      var imgHeight = (imgWidth / contentWidth) * contentHeight;
-
-      console.log(imgHeight, 'imgHeight');
-
-      var pageData = canvas.toDataURL('image/jpeg', 1.0);
-
-      var pdf = new jsPDF('', 'pt', 'a4');
-
-      console.log(canvasSplit(canvas, imgWidth, a4Height - 20));
-
-      //有两个高度需要区分,一个是html页面的实际高度,和生成pdf的页面高度(841.89)
-      //当内容未超过pdf一页显示的范围,无需分页
-      if (leftHeight < pageHeight) {
-        pdf.addImage(pageData, 'JPEG', margin, position, imgWidth, imgHeight);
-      } else {
-        while (leftHeight > 0) {
-          pdf.addImage(pageData, 'JPEG', margin, position, imgWidth, imgHeight);
-          console.log(leftHeight, pageHeight, position);
-          leftHeight -= pageHeight;
-          position -= pageHeight;
-          //避免添加空白页
-          if (leftHeight > 0) {
-            pdf.addPage();
-          }
-        }
-      }
-
-      pdf.save(`${fileName}.pdf`);
-      const blob = pdf.output('blob');
-      var blob_url = URL.createObjectURL(blob);
-      window.open(blob_url);
-      pdf = null;
-      resolve();
-    });
-  });
-};
-
-function canvasSplit (canvas, width, height) {
-  const pageList = [];
-  const contentHeight = canvas.height;
-
-  let leftHeight = (width / canvas.width) * contentHeight;
-
-  console.log('leftHeight', leftHeight);
-  const can = document.createElement('canvas');
-
-  can.width = width;
-  can.height = height;
-
-  const ctx = can.getContext('2d');
-
-  const imgHeight = (canvas.width / width) * height;
-
-  while (leftHeight > 0) {
-    ctx.drawImage(canvas, 0, 0, canvas.width, imgHeight, 0, 0, width, height);
-    pageList.push(canvas.toDataURL('image/jpeg', 1.0));
-    ctx.clearRect(0, 0, 0, 0);
-    leftHeight -= imgHeight;
-
-    console.log('leftHeight', leftHeight, imgHeight);
-  }
-
-  return pageList;
-}

+ 46 - 33
src/views/produceOrder/components/report/Common.vue

@@ -49,7 +49,7 @@
             type="datetime"
             format="yyyy-MM-dd HH:mm:ss"
             placeholder="请选择"
-			:disabled="formData.dateType==2"
+            :disabled="formData.dateType == 2"
           ></el-date-picker
         ></el-form-item>
       </div>
@@ -142,8 +142,10 @@
                 (workReport.productInfo.standardWeight =
                   workReport.productInfo.standardNum === ''
                     ? ''
-                    : workReport.productInfo.standardNum *
-                      (infoData.productUnitWeight || 1))
+                    : multiply(
+                        workReport.productInfo.standardNum,
+                        infoData.productUnitWeight || 1
+                      ))
               "
               clearable
             ></el-input> </el-form-item
@@ -169,8 +171,10 @@
               (workReport.productInfo.noStandardWeight =
                 workReport.productInfo.noStandardNum === ''
                   ? ''
-                  : workReport.productInfo.noStandardNum *
-                    (infoData.productUnitWeight || 1))
+                  : multiply(
+                      workReport.productInfo.noStandardNum,
+                      infoData.productUnitWeight || 1
+                    ))
             "
             clearable
           ></el-input
@@ -229,6 +233,7 @@
   import equipmentDailog from '@/components/EquipmentDailog/report-equipment';
   import { reportCount } from '@/api/produceOrder';
   import dayjs from 'dayjs';
+  import { multiply } from '@/utils/math';
   export default {
     components: { personSelectRemote, equipmentDailog },
     props: {
@@ -240,20 +245,20 @@
         type: Object,
         default: () => ({})
       },
-	formData: {
-		type: Object,
-		default: () => ({})
-	},
-	firstInfo:{
-	  type: Object,
-	  default: () => ({})
-	},
-	currentInfo:{
-		type: Object,
-		default: () => ({}) 
-	}
+      formData: {
+        type: Object,
+        default: () => ({})
+      },
+      firstInfo: {
+        type: Object,
+        default: () => ({})
+      },
+      currentInfo: {
+        type: Object,
+        default: () => ({})
+      }
     },
-    data () {
+    data() {
       return {
         categoryMsg: {
           batchNo: '',
@@ -291,31 +296,38 @@
         countMsg: {}
       };
     },
-    created () {
+    created() {
       this.workReport.executorId = this.$store.state.user.info?.userId;
       this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
     },
     watch: {
       taskInfo: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.taskInfo.code) {
             this.getReportCount();
           }
         }
       },
-	  formData: {
-	    immediate: true,
-	    handler () {
-	      if (this.formData.dateType==2) {
-	        this.$set(this.workReport,'executeTime',this.formData.appointTime);
-	      }
-	    }
-	  },
+      formData: {
+        immediate: true,
+        handler() {
+          if (this.formData.dateType == 2) {
+            this.$set(
+              this.workReport,
+              'executeTime',
+              this.formData.appointTime
+            );
+          }
+        }
+      },
       infoData: {
         immediate: true,
-        handler () {
-          if (this.infoData.id && this.currentInfo.code == this.firstInfo.code ) {
+        handler() {
+          if (
+            this.infoData.id &&
+            this.currentInfo.code == this.firstInfo.code
+          ) {
             // 设备
             this.workReportDeviceList = Object.assign(
               {},
@@ -335,7 +347,8 @@
       }
     },
     methods: {
-      async getReportCount () {
+      multiply,
+      async getReportCount() {
         const res = await reportCount({
           taskCode: this.taskInfo.code,
           workOrderId: this.infoData.id
@@ -343,7 +356,7 @@
 
         this.countMsg = res;
       },
-      getEquip () {
+      getEquip() {
         this.$refs.equipmentRef.openSingle(
           [this.workReportDeviceList],
           (res) => {
@@ -360,7 +373,7 @@
           }
         );
       },
-      report (fun) {
+      report(fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
             if (!this.workReportDeviceList.code) {

+ 17 - 11
src/views/produceOrder/components/report/Drying.vue

@@ -159,8 +159,10 @@
                 (workReport.productInfo.standardWeight =
                   workReport.productInfo.standardNum === ''
                     ? ''
-                    : workReport.productInfo.standardNum *
-                      (infoData.productUnitWeight || 1))
+                    : multiply(
+                        workReport.productInfo.standardNum,
+                        infoData.productUnitWeight || 1
+                      ))
               "
               clearable
             ></el-input> </el-form-item
@@ -186,8 +188,10 @@
               (workReport.productInfo.noStandardWeight =
                 workReport.productInfo.noStandardNum === ''
                   ? ''
-                  : workReport.productInfo.noStandardNum *
-                    (infoData.productUnitWeight || 1))
+                  : multiply(
+                      workReport.productInfo.noStandardNum,
+                      infoData.productUnitWeight || 1
+                    ))
             "
             clearable
           ></el-input
@@ -252,6 +256,7 @@
   import { reportCount } from '@/api/produceOrder';
   import catogaryDialog from '../catogaryDialog.vue';
   import dayjs from 'dayjs';
+  import { multiply } from '@/utils/math';
   export default {
     components: { personSelectRemote, workshopDailog, catogaryDialog },
     props: {
@@ -276,7 +281,7 @@
         default: () => ({})
       }
     },
-    data () {
+    data() {
       return {
         categoryMsg: {
           batchNo: '',
@@ -329,14 +334,14 @@
         }
       };
     },
-    created () {
+    created() {
       this.workReport.executorId = this.$store.state.user.info?.userId;
       this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
     },
     watch: {
       formData: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.formData.dateType == 2) {
             this.$set(
               this.workReport,
@@ -348,7 +353,8 @@
       }
     },
     methods: {
-      getCategory (id, memo) {
+      multiply,
+      getCategory(id, memo) {
         this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
           this[memo].rootCategoryLevelId = res.categoryLevelId;
           this[memo].code = res.code;
@@ -363,7 +369,7 @@
           }
         });
       },
-      async getReportCount () {
+      async getReportCount() {
         const res = await reportCount({
           taskCode: this.taskInfo.code,
           workOrderId: this.infoData.id
@@ -371,7 +377,7 @@
 
         this.countMsg = res;
       },
-      getEquip () {
+      getEquip() {
         this.$refs.workshopRef.openSingle([this.workReportArea], (res) => {
           this.workReportArea.code = res.code;
           this.workReportArea.name = res.name;
@@ -380,7 +386,7 @@
           this.workReportArea.id = res.id;
         });
       },
-      report (fun) {
+      report(fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
             this.$confirm('是否确定要报工?', '提示').then(() => {

+ 29 - 21
src/views/produceOrder/components/report/Extrusion.vue

@@ -150,8 +150,10 @@
                 (workReport.productInfo.standardWeight =
                   workReport.productInfo.standardNum === ''
                     ? ''
-                    : workReport.productInfo.standardNum *
-                      (infoData.productUnitWeight || 1))
+                    : multiply(
+                        workReport.productInfo.standardNum,
+                        infoData.productUnitWeight || 1
+                      ))
               "
               clearable
             ></el-input> </el-form-item
@@ -176,8 +178,10 @@
               (workReport.productInfo.noStandardWeight =
                 workReport.productInfo.noStandardNum === ''
                   ? ''
-                  : workReport.productInfo.noStandardNum *
-                    (infoData.productUnitWeight || 1))
+                  : multiply(
+                      workReport.productInfo.noStandardNum,
+                      infoData.productUnitWeight || 1
+                    ))
             "
             clearable
           ></el-input
@@ -285,6 +289,7 @@
   import materialDialog from '../materialDialog.vue';
   import catogaryDialog from '../catogaryDialog.vue';
   import { reportCount, getSoltNum } from '@/api/produceOrder';
+  import { multiply } from '@/utils/math';
   import dayjs from 'dayjs';
   export default {
     components: {
@@ -306,16 +311,16 @@
         type: Object,
         default: () => ({})
       },
-	  firstInfo:{
+      firstInfo: {
         type: Object,
         default: () => ({})
       },
-	  currentInfo:{
-		 type: Object,
-		 default: () => ({}) 
-	  }
+      currentInfo: {
+        type: Object,
+        default: () => ({})
+      }
     },
-    data () {
+    data() {
       return {
         categoryMsg: {
           batchNo: '',
@@ -382,7 +387,7 @@
     watch: {
       taskInfo: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.taskInfo.code) {
             this.getReportCount();
           }
@@ -390,7 +395,7 @@
       },
       formData: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.formData.dateType == 2) {
             this.$set(
               this.workReport,
@@ -402,8 +407,11 @@
       },
       infoData: {
         immediate: true,
-        handler () {
-          if (this.infoData.id && this.currentInfo.code == this.firstInfo.code) {
+        handler() {
+          if (
+            this.infoData.id &&
+            this.currentInfo.code == this.firstInfo.code
+          ) {
             // 设备
             this.workReportDeviceList = Object.assign(
               {},
@@ -421,14 +429,14 @@
           }
         }
       }
-	  
     },
-    created () {
+    created() {
       this.workReport.executorId = this.$store.state.user.info?.userId;
       this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
     },
     methods: {
-      getCategory (id, memo) {
+      multiply,
+      getCategory(id, memo) {
         this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
           if (id == '8') {
             getSoltNum(res.id).then((r) => {
@@ -448,7 +456,7 @@
           }
         });
       },
-      getMaterial () {
+      getMaterial() {
         this.$refs.materialRef.open(this.categoryMsg, (res) => {
           this.categoryMsg.name = res.categoryName;
           this.categoryMsg.code = res.categoryCode;
@@ -463,7 +471,7 @@
           });
         });
       },
-      getEquip () {
+      getEquip() {
         this.$refs.equipmentRef.openSingle(
           [this.workReportDeviceList],
           (res) => {
@@ -479,7 +487,7 @@
           }
         );
       },
-      async getReportCount () {
+      async getReportCount() {
         const res = await reportCount({
           taskCode: this.taskInfo.code,
           workOrderId: this.infoData.id
@@ -487,7 +495,7 @@
 
         this.countMsg = res;
       },
-      report (fun) {
+      report(fun) {
         this.$refs.formRef.validate((value, error) => {
           if (value) {
             if (!this.workReportDeviceList.code) {

+ 19 - 13
src/views/produceOrder/components/report/HalfAdded.vue

@@ -154,8 +154,10 @@
                 (workReport.productInfo.standardWeight =
                   workReport.productInfo.standardNum === ''
                     ? ''
-                    : workReport.productInfo.standardNum *
-                      (infoData.productUnitWeight || 1))
+                    : multiply(
+                        workReport.productInfo.standardNum,
+                        infoData.productUnitWeight || 1
+                      ))
               "
               clearable
             ></el-input> </el-form-item
@@ -181,8 +183,10 @@
               (workReport.productInfo.noStandardWeight =
                 workReport.productInfo.noStandardNum === ''
                   ? ''
-                  : workReport.productInfo.noStandardNum *
-                    (infoData.productUnitWeight || 1))
+                  : multiply(
+                      workReport.productInfo.noStandardNum,
+                      infoData.productUnitWeight || 1
+                    ))
             "
             clearable
           ></el-input
@@ -243,6 +247,7 @@
   import { reportCount } from '@/api/produceOrder';
   import catogaryDialog from '../catogaryDialog.vue';
   import dayjs from 'dayjs';
+  import { multiply } from '@/utils/math';
   export default {
     components: { personSelectRemote, equipmentDailog, catogaryDialog },
     props: {
@@ -267,7 +272,7 @@
         default: () => ({})
       }
     },
-    data () {
+    data() {
       return {
         categoryMsg: {
           batchNo: '',
@@ -320,7 +325,7 @@
     watch: {
       taskInfo: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.taskInfo.code) {
             this.getReportCount();
           }
@@ -328,7 +333,7 @@
       },
       infoData: {
         immediate: true,
-        handler () {
+        handler() {
           if (
             this.infoData.id &&
             this.currentInfo.code == this.firstInfo.code
@@ -352,7 +357,7 @@
       },
       formData: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.formData.dateType == 2) {
             this.$set(
               this.workReport,
@@ -363,12 +368,13 @@
         }
       }
     },
-    created () {
+    created() {
       this.workReport.executorId = this.$store.state.user.info?.userId;
       this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
     },
     methods: {
-      getCategory (id, memo) {
+      multiply,
+      getCategory(id, memo) {
         this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
           this[memo].rootCategoryLevelId = res.categoryLevelId;
           this[memo].code = res.code;
@@ -383,7 +389,7 @@
           }
         });
       },
-      async getReportCount () {
+      async getReportCount() {
         const res = await reportCount({
           taskCode: this.taskInfo.code,
           workOrderId: this.infoData.id
@@ -391,7 +397,7 @@
 
         this.countMsg = res;
       },
-      getEquip () {
+      getEquip() {
         this.$refs.equipmentRef.openSingle(
           [this.workReportDeviceList],
           (res) => {
@@ -408,7 +414,7 @@
           }
         );
       },
-      report (fun) {
+      report(fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
             if (!this.workReportDeviceList.code) {

+ 31 - 22
src/views/produceOrder/components/report/Heating.vue

@@ -154,8 +154,10 @@
                 (workReport.productInfo.standardWeight =
                   workReport.productInfo.standardNum === ''
                     ? ''
-                    : workReport.productInfo.standardNum *
-                      (infoData.productUnitWeight || 1))
+                    : multiply(
+                        workReport.productInfo.standardNum,
+                        infoData.productUnitWeight || 1
+                      ))
               "
               clearable
             ></el-input> </el-form-item
@@ -181,8 +183,10 @@
               (workReport.productInfo.noStandardWeight =
                 workReport.productInfo.noStandardNum === ''
                   ? ''
-                  : workReport.productInfo.noStandardNum *
-                    (infoData.productUnitWeight || 1))
+                  : multiply(
+                      workReport.productInfo.noStandardNum,
+                      infoData.productUnitWeight || 1
+                    ))
             "
             clearable
           ></el-input
@@ -249,6 +253,7 @@
   import { reportCount } from '@/api/produceOrder';
   import catogaryDialog from '../catogaryDialog.vue';
   import dayjs from 'dayjs';
+  import { multiply } from '@/utils/math';
   export default {
     components: { personSelectRemote, equipmentDailog, catogaryDialog },
     props: {
@@ -264,16 +269,16 @@
         type: Object,
         default: () => ({})
       },
-		firstInfo:{
-		  type: Object,
-		  default: () => ({})
-		},
-		currentInfo:{
-			type: Object,
-			default: () => ({}) 
-		}
+      firstInfo: {
+        type: Object,
+        default: () => ({})
+      },
+      currentInfo: {
+        type: Object,
+        default: () => ({})
+      }
     },
-    data () {
+    data() {
       return {
         categoryMsg: {
           batchNo: '',
@@ -329,7 +334,7 @@
     watch: {
       taskInfo: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.taskInfo.code) {
             this.getReportCount();
           }
@@ -337,8 +342,11 @@
       },
       infoData: {
         immediate: true,
-        handler () {
-          if (this.infoData.id && this.currentInfo.code == this.firstInfo.code) {
+        handler() {
+          if (
+            this.infoData.id &&
+            this.currentInfo.code == this.firstInfo.code
+          ) {
             // 设备
             this.workReportDeviceList = Object.assign(
               {},
@@ -358,7 +366,7 @@
       },
       formData: {
         immediate: true,
-        handler () {
+        handler() {
           if (this.formData.dateType == 2) {
             this.$set(
               this.workReport,
@@ -369,12 +377,13 @@
         }
       }
     },
-    created () {
+    created() {
       this.workReport.executorId = this.$store.state.user.info?.userId;
       this.workReport.executorJobNum = this.$store.state.user.info?.jobNumber;
     },
     methods: {
-      getCategory (id, memo) {
+      multiply,
+      getCategory(id, memo) {
         this.$refs.catogaryDialogRef.open(id, this[memo], (res) => {
           this[memo].rootCategoryLevelId = res.categoryLevelId;
           this[memo].code = res.code;
@@ -389,7 +398,7 @@
           }
         });
       },
-      async getReportCount () {
+      async getReportCount() {
         const res = await reportCount({
           taskCode: this.taskInfo.code,
           workOrderId: this.infoData.id
@@ -397,7 +406,7 @@
 
         this.countMsg = res;
       },
-      getEquip () {
+      getEquip() {
         this.$refs.equipmentRef.openSingle(
           [this.workReportDeviceList],
           (res) => {
@@ -414,7 +423,7 @@
           }
         );
       },
-      report (fun) {
+      report(fun) {
         this.$refs.formRef.validate((value) => {
           if (value) {
             if (!this.workReportDeviceList.code) {