Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

hmc 1 жил өмнө
parent
commit
2b7915d668

+ 9 - 0
zkqy-ui/src/api/codeListManage/productCodeList.js

@@ -92,6 +92,15 @@ export function getPrintData(id) {
     //baseURL: process.env.VUE_APP_BASE_API1
   })
 }
+// 新的回显数据接口
+export function getPrintDataNew(qrCode) {
+  return request({
+    url: `/system/productCodeList/queryCodeListByQrCode/${qrCode}`,
+    method: 'get',
+    //baseURL: process.env.VUE_APP_BASE_API1
+  })
+}
+
 // 获取箱号编码接口
 export function getQrCode(id) {
   return request({

+ 1 - 0
zkqy-ui/src/assets/styles/index.scss

@@ -124,6 +124,7 @@ aside {
 //main-container全局样式
 .app-container {
   padding: 20px;
+  background-color: #fff;
 }
 
 .components-container {

+ 31 - 22
zkqy-ui/src/utils/print/codeListPrint.js

@@ -58,43 +58,51 @@ function codeListPrint(data, domId) {
       // let qrCodeData = '123456';
       // let temp = id + '@' + uuid + '@' + canisterNum + '@' + suttle + '@' + grossWeight + '@' + lotNum + '@' + productName + '@' + productSpecifications + '@' + productColor + '@' + levels + '@' + qrCode + '@' + boxNum
       let temp = id + '@' + uuid + '@' + canisterNum + '@' + suttle + '@' + grossWeight + '@' + qrCode
-      let resStr = encodeURIComponent(temp)
+      // let resStr = encodeURIComponent(temp)
       if (printFormat == 3) {//打印英文版
         uuidList.push({
           id: uuid + '' + theNumber,
-          qrCodeData: resStr,//id uuid 筒数 净重 毛重 批次 品种 规格 色号 等级 码单号 箱号 
+          qrCodeData: temp,//id uuid 筒数 净重 毛重 批次 品种 规格 色号 等级 码单号 箱号 
           size: 180,
         })
         res = printEN(uuid + '' + theNumber, item, res)
       } else {//打印中文版
         uuidList.push({
           id: uuid + '' + theNumber,
-          qrCodeData: resStr,//id uuid 筒数 净重 毛重 批次 品种 规格 色号 等级 码单号 箱号
+          qrCodeData: temp,//id uuid 筒数 净重 毛重 批次 品种 规格 色号 等级 码单号 箱号
           size: 120,
         })
         res = printCN(uuid + '' + theNumber, item, res) + endHtml;
       }
     }
   }
-  var printWindow = window.open('', '_blank', 'height=500,width=800');
-  printWindow.document.write('<html><head><title>Print Element</title>');
-  printWindow.document.write('</head><body >');
-  printWindow.document.write(res);
-  printWindow.document.write('</body></html>');
-  // printWindow.document.close();
-  // printWindow.document.body.innerHTML = document.getElementById(domId).innerHTML = res;
-  for (var i = 0; i < uuidList.length; i++) {
-    let data = uuidList[i]
-    new QRCode(printWindow.document.getElementById("" + data.id), {
-      text: sleep(2) + data.qrCodeData,
-      width: data.size,
-      height: data.size,
-      colorDark: "#000000",
-      colorLight: "#ffffff",
-      correctLevel: QRCode.CorrectLevel.H,
-    });
-  }
-  printWindow.print();//打印
+  setTimeout(function () {
+    var printWindow = window.open('', '_blank', 'height=500,width=800');
+    console.log(printWindow);
+    if (printWindow == null) {
+      console.log('弹出窗口被阻止');
+      return
+      // 在这里处理弹出被阻止的情况
+    }
+    printWindow.document.write('<html><head><title>Print Element</title>');
+    printWindow.document.write('</head><body >');
+    printWindow.document.write(res);
+    printWindow.document.write('</body></html>');
+    // printWindow.document.close();
+    // printWindow.document.body.innerHTML = document.getElementById(domId).innerHTML = res;
+    for (var i = 0; i < uuidList.length; i++) {
+      let data = uuidList[i]
+      new QRCode(printWindow.document.getElementById("" + data.id), {
+        text: sleep(2) + data.qrCodeData,
+        width: data.size,
+        height: data.size,
+        colorDark: "#000000",
+        colorLight: "#ffffff",
+        correctLevel: QRCode.CorrectLevel.H,
+      });
+    }
+    printWindow.print();//打印
+  }, 100)
   // window.location.reload();
   return false;
 }
@@ -107,6 +115,7 @@ function sleep(ms) {
 
 // 打印中文版
 function printCN(uuid, item, res) {
+  console.log('中文', item);
   let {
     qrCode,//序号
     machineTool,//机台

+ 286 - 1
zkqy-ui/src/views/orderMange/approve.vue

@@ -188,7 +188,9 @@
                 处理<i class="el-icon-arrow-down el-icon--right"></i>
               </el-button>
               <el-dropdown-menu slot="dropdown">
-                <el-dropdown-item>
+                <el-dropdown-item
+                  v-show="queryParams.conditionMap.columnValue == '2'"
+                >
                   <el-button
                     type="text"
                     size="mini"
@@ -196,6 +198,14 @@
                     >审批</el-button
                   >
                 </el-dropdown-item>
+                <el-dropdown-item>
+                  <el-button
+                    type="text"
+                    size="mini"
+                    @click="handleDetail(scope.$index, scope.row)"
+                    >详情</el-button
+                  >
+                </el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
             <Menu
@@ -215,6 +225,16 @@
         :limit.sync="queryParams.pageSize"
         @pagination="pageList"
       />
+      <!-- 详情弹窗 -->
+      <el-dialog title="详情" :visible.sync="detailShow" width="1250px">
+        <div ref="detailTable" id="detail"></div>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="detailShow = false">关 闭</el-button>
+          <!-- <el-button type="primary" @click="detailPrintHandler"
+            >打 印</el-button
+          > -->
+        </span>
+      </el-dialog>
       <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
       <el-dialog :title="title" :visible.sync="open" append-to-body>
         <!-- <iframe
@@ -805,6 +825,9 @@ export default {
   dicts: ["sales_order_type", "payment_method", "direction_of_twist"],
   data() {
     return {
+      // 详情相关数据
+      detailShow: false,
+      printDomData: "",
       // 审批相关数据
       approveType: "", //审批状态
       approveNo: "",
@@ -1014,6 +1037,268 @@ export default {
     },
   },
   methods: {
+    // 根据字典value获取字典label
+    getDictLabel(value, dict) {
+      return (
+        this.dict.type[dict].find((item) => {
+          return item.value === value;
+        })?.label || ""
+      );
+    },
+    // 获取详情数据
+    async handleDetail(index, row) {
+      this.printDomData = await this.getDetailTableString(row);
+      this.detailShow = true;
+      this.$nextTick(() => {
+        this.$refs.detailTable.innerHTML = this.printDomData;
+      });
+    },
+    // 获取详情html字符串
+    async getDetailTableString(row) {
+      let { saleOrderSaleNo } = row;
+      let payLoad = [
+        {
+          basicMap: {
+            tableName: "sale_order",
+          },
+          conditionMap: {
+            sale_no: [saleOrderSaleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_products",
+          },
+          conditionMap: {
+            sale_order_no: [saleOrderSaleNo],
+          },
+        },
+        {
+          basicMap: {
+            tableName: "sale_craft",
+          },
+          conditionMap: {
+            sale_order_no: [saleOrderSaleNo],
+          },
+        },
+      ];
+      let res = await queryDropDownBoxData(payLoad);
+      if (res.code == 200) {
+        console.log(res);
+        let { sale_craft, sale_order, sale_products } = res.data.resultMap;
+        let {
+          //订单表数据
+          saleNo, //合同号
+          lotNumber, //批号
+          saleCustomNo, //客户编号
+          saleDate, //销售单日期
+          saleOrderEstimatedTime, //预计下单时间
+          saleLeadTime, //交货周期
+          deliveryDate,
+          saleAmounts, //合计金额 小写
+          saleAmountInWords, //合计金额 大写
+          salePayType, //支付方式
+          earnestMoney,
+          salesman, //业务员
+          saleLeader, //业务主管
+          finance, //财务部
+          production, //生产部
+          saleApprover, //批准人
+          // customAddress, //客户地址
+          // customCountryType, //国家类型
+          // contactPerson, //联系人
+          // 货品明细表数据
+          // productNo, //货品号
+          // productName, //货品名称
+          // productNumber: "", //销售数量
+          // productWeight: "", //销售重量kg
+          // productUnitPrice: "", //单价
+          // productAmounts: "", //金额
+          // remark: "", //备注
+          // 工艺表
+          craftGrid, //网络
+          craftOil, //油剂
+          craftPackage, //卷装
+          craftColorFastness, //色牢度
+          directionOfTwist,
+          craftOther, //其它工艺要求
+          craftMark, //包装/贴唛
+          shippingMethod, //运输方式
+        } = { ...sale_craft[0], ...sale_order[0] };
+        let customData = this.customerOptions.find(
+          (item) => item.customNo == saleCustomNo
+        );
+        let customerName = customData ? customData.customName : "";
+        let customAddress = customData?.customAddress || "无";
+        let customCountryType = customData?.customCountryType || "";
+        let contactPerson = customData?.contactPerson || "无";
+        let directionOfTwistDescription = directionOfTwist
+          ? this.getDictLabel(directionOfTwist, "direction_of_twist")
+          : "";
+        let printStr = `
+        <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
+            <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
+            <div style="text-align:center;">销售合同审计单</div>
+            <tbody>
+                <tr>
+                    <td width="600px" colspan="4">合同号:${saleNo}</td>
+                    <td width="600px" colspan="4">日期:${saleDate.replace(
+                      "T",
+                      " "
+                    )}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户名称:</td>
+                    <td width="300px" colspan="2">${customerName}</td>
+                    <td width="300px" colspan="2">联系人:</td>
+                    <td width="150px" colspan="1">${contactPerson}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">客户地址:</td>
+                    <td width="300px" colspan="2">${customAddress}</td>
+                    <td width="300px" colspan="2">客户国别:</td>
+                    <td width="300px" colspan="2">${customCountryType}</td>
+                </tr>
+                <tr align="center">
+                    <td width="300px" colspan="2">预计下单时间:</td>
+                    <td  colspan="1">${saleOrderEstimatedTime.replace(
+                      "T",
+                      " "
+                    )}</td>
+                    <td  colspan="1">交货周期:</td>
+                    <td >${saleLeadTime}</td>
+                    <td  colspan="2">交货日期:</td>
+                    <td >${deliveryDate.replace("T", " ")}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="8">货品明细</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">品名</td>
+                    <td width="150px">类型</td>
+                    <td width="150px">数量/kg</td>
+                    <td width="150px">单价</td>
+                    <td width="150px">金额</td>
+                    <td width="150px">切片型号</td>
+                    <td width="150px">色号</td>
+                    <td width="150px">备注</td>
+                </tr>`;
+        let amountTotal = 0,
+          singlTotal = 0,
+          moneyTotal = 0;
+        for (let i = 0; i < sale_products.length; i++) {
+          let item = sale_products[i];
+          amountTotal += Number(item.productNumber);
+          singlTotal += Number(item.productUnitPrice);
+          moneyTotal += Number(item.productAmounts);
+          let productData = this.productionOptions.find(
+            (pro) => pro.productNo == item.productNo
+          );
+          console.log("item", item);
+          item.sliceTypeLabel =
+            this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
+              ?.materielName || "";
+          item.colourNumberLabel = this.colourNumberOptions.find(
+            (k) => k.materielCode == item.colourNumber
+          )?.materieColorNumber;
+          let productName = productData ? productData.productName : "";
+          let productType = productData ? productData.productType : "";
+          printStr += `<tr align="center">
+                    <td>${productName}</td>    
+                    <td>${productType}</td>    
+                    <td>${item.productNumber}</td>
+                    <td>${item.productUnitPrice}</td>
+                    <td>${item.productAmounts}</td>
+                    <td>${item.sliceTypeLabel}</td>
+                    <td>${item.colourNumberLabel}</td>
+                    <td>${item.remark}</td>
+                </tr>`;
+        }
+        // 计算小计
+        printStr += `
+        <tr align="center">
+          <td>小计:</td>
+           <td></td>
+          <td>${amountTotal}</td>
+          <td>${singlTotal}</td>
+          <td>${moneyTotal}</td>
+          <td></td>
+          <td></td>
+          <td></td>
+        </tr>
+                <tr>
+                    <td colspan="8">合计金额(大写):${saleAmountInWords}</td>
+                </tr>
+                `;
+
+        if (salePayType == "1") {
+          //定金
+          printStr += `
+          <tr>
+            <td colspan="4">付款方式:${salePayType}</td>
+            <td colspan="4">定金:${earnestMoney}</td>
+          </tr>`;
+        } else {
+          printStr += `
+         <tr>
+              <td colspan="8">付款方式:${salePayType}</td>
+          </tr>`;
+        }
+        printStr += `<tr align="center">
+                    <td colspan="8">工艺要求</td>
+                </tr>
+                <tr align="center">
+                    <td width="150px">网络</td>
+                    <td width="150px">油剂</td>
+                    <td width="150px">卷装</td>
+                    <td width="150px">色牢度</td>
+                    <td width="150px">捻向</td>
+                    <td width="150px">其他</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr align="center">
+                    <td >${craftGrid}</td>
+                    <td>${craftOil}</td>
+                    <td>${craftPackage}</td>
+                    <td>${craftColorFastness}</td>
+                    <td>${directionOfTwistDescription}</td>
+                    <td>${craftOther}</td>
+                    <td width="150px"></td>
+                    <td width="150px"></td>
+                </tr>
+                <tr>
+                    <td colspan="8">包装/贴唛:${craftMark}</td>
+                </tr>
+                <tr>
+                    <td colspan="8">装运方式:${shippingMethod}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="2">业务员:</td>
+                    <td colspan="2">${salesman}</td>
+                    <td colspan="2">业务主管:</td>
+                    <td colspan="2">${saleLeader}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="2">财务部:</td>
+                    <td colspan="2">${finance}</td>
+                    <td colspan="2">生产部:</td>
+                    <td colspan="2">${production}</td>
+                </tr>
+                <tr align="center">
+                    <td colspan="2">批准人:</td>
+                    <td colspan="2">${saleApprover}</td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                    <td></td>
+                </tr>
+            </tbody>
+        </table>
+        `;
+        return printStr;
+      }
+    },
     // 审批状态改变回调
     approveTypeChange(status) {
       this.getList(false, status);

+ 250 - 84
zkqy-ui/src/views/orderMange/codeListManage/index.vue

@@ -25,22 +25,22 @@
             @keyup.enter.native="handleQuery"
           />
         </el-form-item>
-        <el-form-item label="货品编号" prop="productId">
+        <!-- <el-form-item label="货品编号" prop="productId">
           <el-input
             v-model="queryParams.productId"
             placeholder="请输入货品编号"
             clearable
             @keyup.enter.native="handleQuery"
           />
-        </el-form-item>
-        <el-form-item label="等级" prop="levels">
+        </el-form-item> -->
+        <!-- <el-form-item label="等级" prop="levels">
           <el-input
             v-model="queryParams.levels"
             placeholder="请输入等级"
             clearable
             @keyup.enter.native="handleQuery"
           />
-        </el-form-item>
+        </el-form-item> -->
 
         <el-form-item>
           <el-button
@@ -68,7 +68,7 @@
             >打印
           </el-button>
         </el-col>
-        <el-col :span="1.5">
+        <!-- <el-col :span="1.5">
           <el-button
             type="success"
             plain
@@ -79,7 +79,7 @@
             v-hasPermi="['system:productCodeList:edit']"
             >修改
           </el-button>
-        </el-col>
+        </el-col> -->
         <el-col :span="1.5">
           <el-button
             type="danger"
@@ -300,6 +300,7 @@
         :visible.sync="printShow"
         :fullscreen="true"
         append-to-body
+        @close="getList"
       >
         <div class="main-wrap">
           <div class="left">
@@ -308,7 +309,7 @@
                 <!-- <el-button type="primary" size="mini" @click="printConfirmHandler"
                 >打印</el-button
               > -->
-                <div class="btnWrap">
+                <div class="btnWrap" v-show="excuteType == 1">
                   <el-button
                     v-if="excuteType == 2"
                     :disabled="tableData.length != 1"
@@ -317,7 +318,7 @@
                     @click="updateOrderData"
                     >保存修改
                   </el-button>
-                  <el-button
+                  <!-- <el-button
                     :disabled="tableData.length != 1"
                     type="primary"
                     size="mini"
@@ -331,7 +332,7 @@
                     size="mini"
                     @click="chooseOneToPrint"
                     >{{ chooseState ? "退出批箱单" : "批箱单" }}
-                  </el-button>
+                  </el-button> -->
                   <el-switch
                     class="ml10 mr10"
                     v-model="printAuto"
@@ -342,8 +343,15 @@
                   <el-button type="primary" size="mini" @click="readStateChange"
                     >{{ isStartReadNum ? "停止读数" : "开始读数" }}
                   </el-button>
+                  <el-button
+                    v-show="!printAuto"
+                    type="success"
+                    size="mini"
+                    @click="printBtnHandler"
+                    >打印
+                  </el-button>
                 </div>
-                <div class="weightWrap">
+                <div class="weightWrap" v-show="excuteType == 1">
                   <h1>实时重量:{{ nowWeight }}</h1>
                 </div>
                 <!-- <el-button
@@ -397,12 +405,13 @@
               <el-table-column prop="grossWeight" label="毛重">
                 <template slot-scope="scope">
                   <el-input
-                    :disabled="excuteType == 3"
+                    v-if="excuteType == 2"
                     v-model="scope.row.grossWeight"
                     @input="changeGrossWeight(scope.row)"
                     size="mini"
                     clearable
                   ></el-input>
+                  <span v-else>{{ scope.row.grossWeight }}</span>
                 </template>
               </el-table-column>
               <el-table-column prop="suttle" label="净重"></el-table-column>
@@ -412,6 +421,24 @@
               <el-table-column label="操作">
                 <template slot-scope="scope">
                   <el-button
+                    v-if="excuteType == 2"
+                    type="primary"
+                    size="mini"
+                    :disabled="chooseState"
+                    @click="handleSaveOne(scope.row)"
+                    >保存修改
+                  </el-button>
+                  <el-button
+                    v-else-if="excuteType == 3"
+                    type="primary"
+                    size="mini"
+                    :disabled="chooseState"
+                    @click="handleSuppleOne(scope.row)"
+                    >打印
+                  </el-button>
+
+                  <el-button
+                    v-else
                     type="danger"
                     size="mini"
                     :disabled="chooseState"
@@ -465,7 +492,7 @@
                 label-width="80px"
                 :inline="false"
                 size="normal"
-                :disabled="isDisabled"
+                :disabled="isDisabled || isStartReadNum"
               >
                 <el-col :span="8">
                   <el-form-item prop="packaging" label="包装">
@@ -629,17 +656,16 @@
                     </el-select>
                   </el-form-item>
                 </el-col>
-
                 <el-col :span="8">
-                  <el-form-item prop="comPort" label="端口">
+                  <el-form-item prop="printFormat" label="格式">
                     <el-select
-                      v-model="form.comPort"
+                      v-model="form.printFormat"
                       clearable
                       filterable
                       size="mini"
                     >
                       <el-option
-                        v-for="item in dict.type.port"
+                        v-for="item in dict.type.coding_list_format"
                         :key="item.raw.dictCode"
                         :label="item.label"
                         :value="item.value"
@@ -649,23 +675,32 @@
                   </el-form-item>
                 </el-col>
                 <el-col :span="8">
-                  <el-form-item prop="printFormat" label="格式">
+                  <el-form-item prop="grossWeight" label="毛重">
+                    <el-input
+                      v-model="form.grossWeight"
+                      @input="changeGrossWeightForm"
+                      size="mini"
+                      clearable
+                    ></el-input>
+                  </el-form-item>
+                  <!-- <el-form-item prop="comPort" label="端口">
                     <el-select
-                      v-model="form.printFormat"
+                      v-model="form.comPort"
                       clearable
                       filterable
                       size="mini"
                     >
                       <el-option
-                        v-for="item in dict.type.coding_list_format"
+                        v-for="item in dict.type.port"
                         :key="item.raw.dictCode"
                         :label="item.label"
                         :value="item.value"
                       >
                       </el-option>
                     </el-select>
-                  </el-form-item>
+                  </el-form-item> -->
                 </el-col>
+
                 <el-col :span="24">
                   <el-form-item prop="remark" label="备注">
                     <el-input
@@ -689,19 +724,20 @@
                 clearable
                 @input="batchNumChange"
                 @keyup.enter.native="batchNumChange"
-                :disabled="isDisabled"
+                :disabled="isDisabled || isStartReadNum"
               ></el-input>
-              <el-button
+              <!-- <el-button
                 class="ml10"
                 type="primary"
                 size="mini"
                 :disabled="!currentRow.lotNum || isDisabled || printAuto"
                 @click="addProductHandler"
                 >添加
-              </el-button>
+              </el-button> -->
             </div>
             <div class="table-wrap">
               <el-table
+                ref="proTableRef"
                 :data="batchTableData"
                 border
                 stripe
@@ -710,6 +746,11 @@
                 highlight-current-row
                 @current-change="handleCurrentChange"
               >
+                <!-- <el-table-column
+                  type="index"
+                  label="序号"
+                  width="50"
+                ></el-table-column> -->
                 <el-table-column
                   v-for="col in columns"
                   :prop="col.id"
@@ -746,6 +787,7 @@ import {
   updateProductCodeList,
   getQrCode,
   AutoPrinting,
+  getPrintDataNew,
 } from "@/api/codeListManage/productCodeList";
 import codeListPrint from "@/utils/print/codeListPrint";
 import { getServerPrintData } from "@/utils/print/printUtils";
@@ -753,9 +795,16 @@ import { v4 as uuidv4 } from "uuid";
 
 export default {
   name: "ProductCodeList",
-  dicts: ["packaging_type", "port", "coding_list_format", "direction_of_twist"],
+  dicts: [
+    "packaging_type",
+    "port",
+    "coding_list_format",
+    "direction_of_twist",
+    "automatic_printing",
+  ],
   data() {
     return {
+      qrCode: "", //码单号
       isStartReadNum: false, //是否开始读取重量
       printAuto: true, //是否自动打印
       timer: null, //定时器
@@ -808,9 +857,13 @@ export default {
         tubeColor: "", //管色
         comPort: "", //端口
         printFormat: "", //格式
+        grossWeight: 0, //毛重
         remark: "", //备注
       },
       rules: {
+        grossWeight: [
+          { required: true, message: "请输入重量", trigger: "change" },
+        ],
         packaging: [
           { required: true, message: "请选择包装", trigger: "change" },
         ],
@@ -935,8 +988,7 @@ export default {
     },
   },
   mounted() {
-    console.log(this.dict.type.packaging_type);
-    // this.initWebSocket();
+    // console.log(this.dict.type.packaging_type);
   },
   beforeDestroy() {
     this.closeWebSocket();
@@ -948,18 +1000,39 @@ export default {
   },
 
   methods: {
-    readStateChange() {
+    // 打印按钮回调
+    async printBtnHandler() {
+      let res = await this.validateAndPrint();
+      if (!res) {
+        this.$message.error("请完善数据");
+      }
+    },
+    async readStateChange() {
       if (this.isStartReadNum) {
         //正在读
         this.closeWebSocket();
         this.isStartReadNum = false;
         this.$message.success("已关闭读数");
       } else {
+        // 开启读数时 先获取码单号
+        let res = await getQrCode();
+        if (res.code == 200) {
+          this.qrCode = res.msg;
+        } else {
+          this.$message.error(res.msg);
+        }
         this.initWebSocket();
       }
     },
     initWebSocket() {
-      console.log("开始连接ws", process.env.VUE_APP_BASE_WS_API);
+      // console.log("开始连接ws", process.env.VUE_APP_BASE_WS_API);
+      let automatis_printing = this.dict.type.automatic_printing;
+      let frequency = automatis_printing.find(
+        (item) => item.label == "frequency"
+      )?.value;
+      if (frequency == undefined) {
+        frequency = 30;
+      }
       const wsUrl = "ws:" + process.env.VUE_APP_BASE_WS_API + "/currentWeight";
       this.websocket = new WebSocket(wsUrl);
       this.websocket.addEventListener("open", (event) => {
@@ -967,40 +1040,45 @@ export default {
         this.isStartReadNum = true;
         this.$message.success("已开启读数");
       });
-
+      let initialWeight = null; // 初始化基准重量
+      const weightChangeThreshold = 0.001; // 定义重量变化阈值x
+      let shouldPrint = false; // 用于控制是否应该打印
       this.websocket.addEventListener("message", async (event) => {
         console.log(event);
-        if (!this.printAuto) {
-          // 手动打印直接退出
+        if (!this.printAuto) return;
+        const weightData = JSON.parse(event.data);
+        const weight = weightData.weight;
+        this.nowWeight = weight;
+        this.form.grossWeight = weight;
+        if (weight === 0.0 || weight === 0) {
+          this.resetWeightStatus();
+          shouldPrint = false; // 重量为0时,重置打印标志
           return;
         }
-        const weight = JSON.parse(event.data).weight;
-        this.nowWeight = weight;
-        if (weight == 0.0 || weight == 0) {
-          // 如果重量为0不做任何处理
-          this.waiting = 0;
-          this.lastWeight = 0;
+
+        if (initialWeight === null) {
+          initialWeight = weight;
+          shouldPrint = true; // 第一次有效重量,允许打印
           return;
+        }
+
+        const weightDifference = Math.abs(weight - initialWeight);
+        if (weightDifference > weightChangeThreshold) {
+          initialWeight = weight;
+          this.waiting = 0; // 重量有显著变化,重置等待计数并允许打印
+          shouldPrint = true;
         } else {
-          if (this.lastWeight != weight) {
-            this.lastWeight = weight;
-            return;
-          } else {
-            this.waiting++;
-            if (this.waiting != 30) {
-              return;
-            } else {
-              this.waiting = 0;
-              let isValidate = await this.addIsValidate();
-              console.log("isValidate", isValidate);
-              if (isValidate) {
-                // 开始执行打印逻辑
-                this.setWeight(weight);
-              }
-            }
+          this.waiting++;
+          if (this.waiting == frequency && shouldPrint) {
+            // 只有在应该打印且等待计数达标时才打印
+            this.waiting = 0;
+            shouldPrint = false; // 打印后禁止下一次打印,直到重量再次变化
+            const isValidate = await this.validateAndPrint(weight);
+            console.log("isValidate", isValidate);
           }
         }
       });
+
       this.websocket.addEventListener("on", (e) => {
         console.log(e, "连接已建立");
       });
@@ -1013,6 +1091,24 @@ export default {
         console.log("关闭WebSocket连接");
       });
     },
+    // 用于重置与重量相关的状态
+    resetWeightStatus() {
+      this.waiting = 0;
+      this.lastWeight = 0;
+    },
+    // 整合验证和打印标签的逻辑
+    async validateAndPrint(weight) {
+      let isValidate = await this.addIsValidate();
+      if (isValidate) {
+        this.setWeight(weight);
+      }
+      return isValidate;
+    },
+    // 表单重量改变回调
+    changeGrossWeightForm(val) {
+      // console.log(val);
+      this.nowWeight = val;
+    },
     // 开始设置新的重量
     async setWeight(weight) {
       console.log("设置新的重量", weight);
@@ -1044,17 +1140,11 @@ export default {
       let directionOfTwistLabel = this.dict.type.direction_of_twist.find(
         (item) => item.value == directionOfTwist
       )?.label;
-      let res = await getQrCode();
-      let qrCode = "";
-      if (res.code == 200) {
-        qrCode = res.msg;
-      } else {
-        this.$message.error(res.msg);
-      }
+
       newData = {
         // qrCode: this.getBoxOrderNum(), //箱单号
         packaging, //包装方式 1:车丝 2:小包装  3:大包装
-        qrCode, //箱单号
+        qrCode: this.qrCode, //箱单号
         levels,
         machineTool,
         boxWeight,
@@ -1062,7 +1152,7 @@ export default {
         canisterNum,
         workShifts,
         tubeColor,
-        grossWeight: this.nowWeight, //毛重
+        grossWeight: this.printAuto ? this.nowWeight : grossWeight, //毛重
         // suttle: this.getSuttle(), //净重
         suttle: 0, //净重
         boxNum: this.tableData.length + 1, //序号
@@ -1143,7 +1233,7 @@ export default {
         console.log(res);
         if (res.code == 200 && res.status == "success") {
           this.$message.success(res.msg);
-          if (this.excuteType == 1) {
+          if (this.excuteType == 1 && this.printAuto) {
             this.tableData.push(printRow);
           }
         } else {
@@ -1173,11 +1263,48 @@ export default {
         Number(boxWeight) -
         Number(canisterWeight) * Number(canisterNum)
       ).toFixed(2);
+      console.log(row);
     },
     // 删除表格一条数据回调
     handleDeleteOne(index) {
       this.tableData.splice(index, 1);
     },
+    // 确认保存修改一条数据
+    async handleSaveOne(row) {
+      try {
+        let { sumBoxNum, sumCanisterNum, sumSuttle, sumGrossWeight } =
+          this.count;
+        let rowData = JSON.parse(JSON.stringify(row));
+        let payLoad = {
+          ...this.form,
+          qrCode: rowData.qrCode,
+          lotNum: rowData.lotNum,
+          // boxNum: sumBoxNum,
+          boxNum: rowData.boxNum,
+          productId: rowData.productId,
+          // cartonNumber: rowData.canisterWeight,
+          suttle: rowData.suttle,
+          grossWeight: rowData.grossWeight,
+          productCodeListInfoList: this.tableData,
+        };
+        if (rowData.id) {
+          payLoad.id = rowData.id;
+        }
+        let tempApiFun = updateProductCodeList;
+        let res = await tempApiFun(payLoad);
+        let msg = "编辑";
+        if (res.code == 200) {
+          this.$message.success(`${msg}成功`);
+          // this.printShow = false;
+          // this.getList();
+        } else {
+          console.log(res);
+          this.$message.error(`${msg}失败`);
+        }
+      } catch (error) {
+        console.error(error);
+      }
+    },
     // 确认打印回调
     printConfirmHandler(printData) {
       // if (this.tableData.length == 0) {
@@ -1189,11 +1316,16 @@ export default {
       this.printTableData.forEach((item) => {
         item.qrCodeData = printData + "-" + item.boxNum;
       });
+      this.changeGrossWeight(this.printTableData[0]);
       // 前端打印
-      // codeListPrint(this.printTableData, "printDom");
+      codeListPrint(this.printTableData, "printDom");
+
+      if (this.excuteType == 1) {
+        this.tableData.push(this.printTableData[0]);
+      }
       // 后端打印
-      console.log("newPrintHandler");
-      this.newPrintHandler();
+      // console.log("newPrintHandler");
+      // this.newPrintHandler();
     },
     // 获取机台选项数据
     async getLineOptionLsit() {
@@ -1212,6 +1344,11 @@ export default {
         console.error(error);
       }
     },
+    // 补码打印回调
+    handleSuppleOne(row) {
+      this.printTableData = [row];
+      this.printConfirmHandler(row.id);
+    },
     // 获取箱单数据
     async getOrderData(newData) {
       this.$refs.form.validate(async (valid) => {
@@ -1246,6 +1383,7 @@ export default {
               this.printConfirmHandler(this.tableData[0].id);
               return;
             }
+            this.changeGrossWeight(payLoad);
             let res = await tempApiFun(payLoad);
             let msg = this.isEdit ? "编辑" : "新增";
             if (res.code == 200) {
@@ -1394,7 +1532,7 @@ export default {
             canisterNum,
             workShifts,
             tubeColor,
-            grossWeight: 0, //毛重
+            grossWeight: this.printAuto ? this.nowWeight : grossWeight, //毛重
             // suttle: this.getSuttle(), //净重
             suttle: 0, //净重
             boxNum: this.tableData.length + 1, //序号
@@ -1423,7 +1561,30 @@ export default {
     // 表格点击回调
     async handleCurrentChange(val) {
       console.log("row", val);
-      this.currentRow = JSON.parse(JSON.stringify(val));
+      if (!val) return;
+      if (this.isStartReadNum) {
+        this.$refs.proTableRef.setCurrentRow(this.currentRow);
+        return;
+      }
+      if (val.id != this.currentRow.id) {
+        this.tableData = [];
+        // this.$refs.form.resetFields();
+        this.nowWeight = 0;
+        if (!this.printAuto) {
+          // 手动打印  获取码单号
+          this.getQrCodeHandle();
+        }
+      }
+      this.currentRow = val;
+    },
+    // 获取码单号
+    async getQrCodeHandle() {
+      let res = await getQrCode();
+      if (res.code == 200) {
+        this.qrCode = res.msg;
+      } else {
+        this.$message.error(res.msg);
+      }
     },
     // 选择打印数据回调
     handlePrintOneChange(row) {
@@ -1461,6 +1622,7 @@ export default {
                   } else if (this.excuteType == 2) {
                     tempApiFun = updateProductCodeList;
                   }
+                  this.changeGrossWeight(payLoad);
                   let res = await tempApiFun(payLoad);
                   let msg = this.isEdit ? "编辑" : "新增";
                   if (res.code == 200) {
@@ -1534,6 +1696,7 @@ export default {
     },
     // 表单重置
     reset() {
+      this.nowWeight = 0;
       this.form = {
         id: null,
         qrCode: null,
@@ -1583,7 +1746,7 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.id);
+      this.ids = selection.map((item) => item.qrCode);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },
@@ -1605,13 +1768,14 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
+      console.log(row);
       this.reset();
-      const id = row.id || this.ids;
-      getPrintData(id).then(async (response) => {
+      const id = row.qrCode;
+      getPrintDataNew(id).then(async (response) => {
         if (response.code == 200) {
           this.excuteType = 2;
-          this.form = response.data;
-          this.tableData = [response.data] || [{}];
+          this.form = response.data[0];
+          this.tableData = response.data;
 
           await this.getAllBatchData(); //获取所有产品数据
           await this.getLineOptionLsit(); //获取机台选项数据
@@ -1626,12 +1790,12 @@ export default {
     // 补码回调
     supplementCode(row) {
       this.reset();
-      const id = row.id || this.ids;
-      getPrintData(id).then(async (response) => {
+      const id = row.qrCode;
+      getPrintDataNew(id).then(async (response) => {
         this.excuteType = 3; //补码
         this.printAuto = false;
-        this.form = response.data;
-        this.tableData = [response.data] || [];
+        this.form = response.data[0];
+        this.tableData = response.data;
         await this.getAllBatchData(); //获取所有产品数据
         await this.getLineOptionLsit(); //获取机台选项数据
         await this.getSelectOptions();
@@ -1671,12 +1835,14 @@ export default {
         let directionOfTwistLabel = this.dict.type.direction_of_twist.find(
           (item) => item.value == directionOfTwist
         )?.label;
-        Object.assign(this.tableData[0], {
-          productName, //品种
-          productSpecifications, //规格
-          productColor, //色号
-          directionOfTwist, //捻向
-          directionOfTwistLabel,
+        this.tableData.forEach((item) => {
+          Object.assign(item, {
+            productName, //品种
+            productSpecifications, //规格
+            productColor, //色号
+            directionOfTwist, //捻向
+            directionOfTwistLabel,
+          });
         });
       }
     },
@@ -1702,7 +1868,7 @@ export default {
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
+      const ids = row.qrCode || this.ids;
       this.$modal
         .confirm('是否确认删除产品码单编号为"' + ids + '"的数据项?')
         .then(function () {

+ 14 - 4
zkqy-ui/src/views/orderMange/financeApprove.vue

@@ -199,7 +199,9 @@
               处理<i class="el-icon-arrow-down el-icon--right"></i>
             </el-button>
             <el-dropdown-menu slot="dropdown">
-              <el-dropdown-item>
+              <el-dropdown-item
+                v-show="queryParams.conditionMap.columnValue == '8'"
+              >
                 <el-button
                   type="text"
                   size="mini"
@@ -567,6 +569,11 @@ export default {
         this.$refs.detailTable.innerHTML = this.printDomData;
       });
     },
+    getDictLabel(value, dictLsit = []) {
+      return dictLsit.find((item) => {
+        return item.value == value;
+      })?.label;
+    },
     // 获取详情html字符串
     async getDetailTableString(row) {
       let { saleOrderSaleNo } = row;
@@ -646,7 +653,10 @@ export default {
         let customCountryType = customData?.customCountryType || "";
         let contactPerson = customData?.contactPerson || "无";
         let directionOfTwistDescription = directionOfTwist
-          ? this.getDictLabel(directionOfTwist, "direction_of_twist")
+          ? this.getDictLabel(
+              directionOfTwist,
+              this.dict.type.direction_of_twist
+            )
           : "";
         let printStr = `
         <table style="width:1050px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
@@ -842,7 +852,7 @@ export default {
         if (valid) {
           let payload = {
             idList: this.ids,
-            status: this.approveForm.orderType == '1' ? '5' : '3',
+            status: this.approveForm.orderType == "1" ? "5" : "3",
             finance: this.nickName,
           };
           let res = await batchApproval(payload);
@@ -1326,7 +1336,7 @@ export default {
           };
         });
       }
-      let { saleOrderSaleNo, saleOrderId,saleOrderOrderType } = row;
+      let { saleOrderSaleNo, saleOrderId, saleOrderOrderType } = row;
       this.ids.push(saleOrderId);
       this.approveForm.orderType = saleOrderOrderType;
       this.approveNo = saleOrderSaleNo;

+ 7 - 0
zkqy-ui/src/views/orderMange/goodsCirculation/index.vue

@@ -609,6 +609,13 @@ export default {
           });
           // 获取操作列的按钮数据
           this.excuteBtnArr = res.data.resultMap.button;
+          this.excuteBtnArr = res.data.resultMap.button?.filter(
+            (item) => item.btnGroupType == "right"
+          );
+          // this.topBtnArr =
+          //   res.data.resultMap.button?.filter(
+          //     (item) => item.btnGroupType == "top"
+          //   ) || [];
           this.calcuteExcuteCol();
           this.$nextTick(() => {
             this.$refs.tableRef.doLayout();

+ 11 - 18
zkqy-ui/src/views/orderMange/index.vue

@@ -280,24 +280,6 @@
         :visible.sync="open"
         append-to-body
       >
-        <!-- <iframe
-        :src="iframeUrl"
-        width="100%"
-        height="600px"
-        style="border: none"
-        scrolling="no"
-      >
-      </iframe> -->
-        <!-- <k-form-build
-        v-if="jsonData"
-        class="formBuild"
-        ref="addFromRef"
-        :dynamicData="dynamicData"
-        :defaultValue="defaultValue"
-        @submit="tempSubBtn"
-        @change="formChangeHandler"
-        :value="jsonData"
-      /> -->
         <el-row :gutter="20">
           <el-form
             :model="formData"
@@ -450,6 +432,7 @@
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.productNumber"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
                     size="small"
                     clearable
                     @change="computedPrice(scope.row)"
@@ -461,6 +444,7 @@
                   <el-input
                     v-model="scope.row.productUnitPrice"
                     size="small"
+                    oninput="value=value.replace(/[^0-9.]/g,'')"
                     @change="computedPrice(scope.row)"
                     clearable
                   ></el-input>
@@ -1239,8 +1223,12 @@ export default {
       this.isEdit = false;
       await this.getDropDownData();
       this.resetFormData();
+
       this.title = "新增销售单";
       this.open = true;
+      this.$nextTick(() => {
+        this.$refs["formDataRef"].clearValidate();
+      });
     },
     // 获取下拉框数据
     async getDropDownData() {
@@ -1840,6 +1828,11 @@ export default {
     // 计算金额
     computedPrice(row) {
       let { productNumber, productUnitPrice } = row;
+      console.log(
+        "productNumber, productUnitPrice",
+        productNumber,
+        productUnitPrice
+      );
       row.productAmounts = Number(productNumber) * Number(productUnitPrice);
     },
     isUpperCase(char) {

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 630 - 268
zkqy-ui/src/views/orderMange/planTable/show/fangsi.vue


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 668 - 280
zkqy-ui/src/views/orderMange/planTable/show/fankuang.vue


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 673 - 279
zkqy-ui/src/views/orderMange/planTable/show/luotong.vue


+ 346 - 204
zkqy-ui/src/views/orderMange/planTable/show/northWorkshop.vue

@@ -1,19 +1,71 @@
 <template>
-  <div class="app-container" style="width: 100%;">
+  <div class="app-container" style="width: 100%">
     <!--表格-->
     <el-table
       :data="tableData"
       ref="tableRef"
-      :span-method="spanMethod2">
-      <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
-      <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center" width="111.2px"></el-table-column>
-      <el-table-column label="在机产品" header-align="center" >
-        <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
-        <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
-        <el-table-column prop="currentLotNumber" label="批号" header-align="center"  width="90px" align="center"></el-table-column>
-        <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" width="90px" align="center"></el-table-column>
-        <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
-        <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
+      :span-method="spanMethod2"
+      :height="table_height"
+    >
+      <el-table-column
+        prop="machineId"
+        fixed
+        label="机台号"
+        header-align="center"
+        align="center"
+        width="111px"
+      ></el-table-column>
+      <el-table-column
+        prop="productType"
+        fixed
+        label="产品类别"
+        header-align="center"
+        align="center"
+        width="111.2px"
+      ></el-table-column>
+      <el-table-column label="在机产品" header-align="center">
+        <el-table-column
+          prop="currentColorCode"
+          label="色号"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="currentSpecification"
+          label="规格"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="currentLotNumber"
+          label="批号"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="currentSpindleCount"
+          label="锭数"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="startTime"
+          label="上机时间"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="plannedEndTime"
+          label="下机时间"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
       </el-table-column>
       <!--          <el-table-column  label="待上机产品" header-align="center" align="center">-->
       <!--            <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
@@ -21,30 +73,46 @@
       <!--            <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
       <!--            <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
       <!--          </el-table-column>-->
-      <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center"  >
+      <el-table-column
+        prop="listOfPendingProduction"
+        label="待生产产品列表"
+        header-align="center"
+        align="center"
+      >
         <template slot-scope="scope">
           <div v-if="scope.row.listOfPendingProduction">
-            <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
+            <span
+              v-for="(item, index) in scope.row.listOfPendingProduction.split(
+                ','
+              )"
+              :key="index"
+            >
               {{ item }},
-              <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
+              <br
+                v-if="
+                  (index + 1) % 5 === 0 &&
+                  index !==
+                    scope.row.listOfPendingProduction.split(',').length - 1
+                "
+              />
             </span>
           </div>
         </template>
       </el-table-column>
-<!--      <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
-<!--        <template slot-scope="scope">-->
-<!--          <el-dropdown>-->
-<!--            <el-button type="primary">-->
-<!--              操作-->
-<!--              <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
-<!--            </el-button>-->
-<!--            <el-dropdown-menu slot="dropdown">-->
-<!--              <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
-<!--              <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
-<!--            </el-dropdown-menu>-->
-<!--          </el-dropdown>-->
-<!--        </template>-->
-<!--      </el-table-column>-->
+      <!--      <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
+      <!--        <template slot-scope="scope">-->
+      <!--          <el-dropdown>-->
+      <!--            <el-button type="primary">-->
+      <!--              操作-->
+      <!--              <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+      <!--            </el-button>-->
+      <!--            <el-dropdown-menu slot="dropdown">-->
+      <!--              <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
+      <!--              <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
+      <!--            </el-dropdown-menu>-->
+      <!--          </el-dropdown>-->
+      <!--        </template>-->
+      <!--      </el-table-column>-->
     </el-table>
   </div>
 </template>
@@ -56,86 +124,133 @@ import {
   addMaterielInfo,
   getSalesman,
   getAllPlanListByMachineId,
-  getAllPlanListByProductTypeAndStatus, updatePlanOne
+  getAllPlanListByProductTypeAndStatus,
+  updatePlanOne,
 } from "@/api/plan/paln.js";
-import {getDicts} from "@/api/system/dict/data";
+import { getDicts } from "@/api/system/dict/data";
 export default {
   data() {
     return {
+      // 表格滑动相关
+      scrollTimer: null,
+      table_height: 0,
+      timerId: null,
       //选中的是那个车间
-      selectedWorkshop:"南车间",
-      tableData:[],
-      isDisabled:true,
+      selectedWorkshop: "南车间",
+      tableData: [],
+      isDisabled: true,
       form: {
-        product:"",
+        product: "",
       },
       previousMachineId: undefined,
       currentRowspan: 1,
       prevRow: {},
       tableData2: [],
-      nanInsertDialogTableVisible:false,
-      nanUpdateDialogTableVisible:false,
-      beiInsertDialogTableVisible:false,
-      beiUpdateDialogTableVisible:false,
+      nanInsertDialogTableVisible: false,
+      nanUpdateDialogTableVisible: false,
+      beiInsertDialogTableVisible: false,
+      beiUpdateDialogTableVisible: false,
       editingRowIndex: -1,
-      lastEditLine:0,
-      queryParams:{ productionLineDepartment:"加弹部",
-        productionLineWorkshop:"南车间"},
-      isEditLine:false,
-      productsInfo:[],
-      salesmanInfo:[],
-      product:{},
-      materiel:{},
+      lastEditLine: 0,
+      queryParams: {
+        productionLineDepartment: "加弹部",
+        productionLineWorkshop: "南车间",
+      },
+      isEditLine: false,
+      productsInfo: [],
+      salesmanInfo: [],
+      product: {},
+      materiel: {},
       // 机台号
-      machineId:"",
+      machineId: "",
       // 待机/上机/停产
-      stateList0:[
-        {"id":0,"name":"待机"},
-        {"id":1,"name":"上机"},
+      stateList0: [
+        { id: 0, name: "待机" },
+        { id: 1, name: "上机" },
       ],
-      stateList1:[
-        {"id":0,"name":"待机"},
-        {"id":2,"name":"停机"},
-        {"id":1,"name":"上机"},
-        {"id":3,"name":"已完成"},
+      stateList1: [
+        { id: 0, name: "待机" },
+        { id: 2, name: "停机" },
+        { id: 1, name: "上机" },
+        { id: 3, name: "已完成" },
       ],
-      stateList2:[
-        {"id":0,"name":"待机"},
-        {"id":2,"name":"停机"},
-        {"id":1,"name":"上机"},
+      stateList2: [
+        { id: 0, name: "待机" },
+        { id: 2, name: "停机" },
+        { id: 1, name: "上机" },
       ],
-      formData:{
-        updateSelectedProductCategory:"",
-        updateSelectedProductState:""
+      formData: {
+        updateSelectedProductCategory: "",
+        updateSelectedProductState: "",
       },
       // 产品类别
-      productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
-    }
+      productTypeList: [
+        { value: "A面", lable: "A面" },
+        { value: "B面", lable: "B面" },
+      ],
+    };
+  },
+  created() {
+    // 初始化数据
+    this.initSize();
   },
   mounted() {
+    // 初始化滚动数据
+    this.initScroll();
     // 得到排产计划信息
     this.getAmmunitionPlanInfo();
     // 得到业务员信息
     // this.getSalesman();
     this.getProductsInfo();
     //查询字典信息
-    getDicts("dpsx").then(res=>{
+    getDicts("dpsx").then((res) => {
       //制定周期跑一次定时任务
-      console.log(res.data[0].dictValue)
+      console.log(res.data[0].dictValue);
       this.timerId = setInterval(() => {
         this.counter++;
-        console.log(`计数器:`,this.counter);
+        console.log(`计数器:`, this.counter);
         // 注意:适时清理定时器,例如在组件销毁时
         // 得到排产计划信息
         this.getAmmunitionPlanInfo();
       }, res.data[0].dictValue);
-    })
+    });
   },
   methods: {
+    // 初始化尺寸
+    initSize() {
+      this.table_height = window.innerHeight - 40;
+      console.log("table_height:", this.table_height);
+    },
+    async initScroll() {
+      let time = await getDicts("scroll_speed");
+      console.log(time);
+      if (time.code == 200) {
+        time = Number(time.data[0].dictValue);
+      } else {
+        time = 180;
+      }
+      // 拿到表格挂载后的真实DOM
+      const table = this.$refs.tableRef;
+      // 拿到表格中承载数据的div元素
+      const divData = table.bodyWrapper;
+      // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
+      this.scrollTimer = setInterval(() => {
+        // 元素自增距离顶部1像素
+        divData.scrollTop += 1;
+        // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
+        if (
+          divData.clientHeight + divData.scrollTop + 1 >=
+          divData.scrollHeight
+        ) {
+          // 重置table距离顶部距离
+          divData.scrollTop = 0;
+        }
+      }, time); // 滚动速度
+    },
     // 查询排产信息
     getAmmunitionPlanInfo() {
       ammunitionPlanInfo(this.queryParams).then((response) => {
-        this.tableData = response.data
+        this.tableData = response.data;
       });
     },
 
@@ -143,7 +258,7 @@ export default {
     spanMethod2({ row, column, rowIndex, columnIndex }) {
       //第二列合并
       if (columnIndex === 1) {
-        if(row.productType == null) {
+        if (row.productType == null) {
           return;
         }
         const prevRow2 = this.tableData[rowIndex - 1]; // 上一行数据
@@ -163,7 +278,7 @@ export default {
             nextRow2 &&
             nextRow2.machineId === row.machineId &&
             nextRow2.productType === row.productType
-            ) {
+          ) {
             nextRow2 = this.tableData[++countRowspan2 + rowIndex];
           }
           if (countRowspan2 > 1) {
@@ -173,37 +288,45 @@ export default {
       }
       //待生产列表
       if (columnIndex === 8) {
-        const prevRow2 = this.tableData[rowIndex - 1] //上一行数据
-        let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
+        const prevRow2 = this.tableData[rowIndex - 1]; //上一行数据
+        let nextRow2 = this.tableData[rowIndex + 1]; //下一行数据
         // 当上一行的数据等于当前行数据时,当前行单元格隐藏
 
         // console.log(row.listOfPendingProduction)
-        if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
+        if (
+          row.listOfPendingProduction == null ||
+          row.listOfPendingProduction == undefined ||
+          row.listOfPendingProduction == ""
+        ) {
           return;
         }
-        if (prevRow2 &&
+        if (
+          prevRow2 &&
           prevRow2.machineId === row.machineId &&
           prevRow2.productType === row.productType
         ) {
-          return { rowspan: 0, colspan: 0 }
+          return { rowspan: 0, colspan: 0 };
         } else {
           // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
-          let countRowspan2 = 1 //用于合并计数多少单元格
-          while (nextRow2 &&
-            nextRow2.listOfPendingProduction === row.listOfPendingProduction&&
+          let countRowspan2 = 1; //用于合并计数多少单元格
+          while (
+            nextRow2 &&
+            nextRow2.listOfPendingProduction === row.listOfPendingProduction &&
             nextRow2.machineId === row.machineId &&
             nextRow2.productType === row.productType
-            ) {
-            nextRow2 = this.tableData[++countRowspan2 + rowIndex]
+          ) {
+            nextRow2 = this.tableData[++countRowspan2 + rowIndex];
           }
           if (countRowspan2 > 1) {
-            return { rowspan: countRowspan2, colspan: 1 }
+            return { rowspan: countRowspan2, colspan: 1 };
           }
         }
       }
       //合并最后一列操作列
-      const lastColumnIndex = this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
-      if (columnIndex === lastColumnIndex && column.label === '操作') { // 判断是否为最后一列且标签为'操作'
+      const lastColumnIndex =
+        this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
+      if (columnIndex === lastColumnIndex && column.label === "操作") {
+        // 判断是否为最后一列且标签为'操作'
         const machineIdColumnIndex = 0; // 机台号列的索引假定为0
         const currentMachineId = row.machineId;
 
@@ -215,10 +338,7 @@ export default {
         } else {
           let nextRow = this.tableData[rowIndex + 1];
 
-          while (
-            nextRow &&
-            nextRow.machineId === currentMachineId
-            ) {
+          while (nextRow && nextRow.machineId === currentMachineId) {
             nextRow = this.tableData[++countRowspan + rowIndex];
           }
 
@@ -230,25 +350,25 @@ export default {
       //第一列机台号合并
       if (columnIndex === 0) {
         //定义需要合并的列字段,有哪些列需要合并,就自定义添加字段即可
-        const fields = ['machineId']
+        const fields = ["machineId"];
         // 当前行的数据
-        const cellValue = row[column.property]
-        let countRowspan = 1 //用于合并计数多少单元格
+        const cellValue = row[column.property];
+        let countRowspan = 1; //用于合并计数多少单元格
         // 判断只合并定义字段的列数据
         if (cellValue && fields.includes(column.property)) {
-          const prevRow = this.tableData[rowIndex - 1] //上一行数据
-          let nextRow = this.tableData[rowIndex + 1] //下一行数据
+          const prevRow = this.tableData[rowIndex - 1]; //上一行数据
+          let nextRow = this.tableData[rowIndex + 1]; //下一行数据
           // 当上一行的数据等于当前行数据时,当前行单元格隐藏
           if (prevRow && prevRow[column.property] === cellValue) {
-            return { rowspan: 0, colspan: 0 }
+            return { rowspan: 0, colspan: 0 };
           } else {
             // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
-            let countRowspan = 1 //用于合并计数多少单元格
+            let countRowspan = 1; //用于合并计数多少单元格
             while (nextRow && nextRow[column.property] === cellValue) {
-              nextRow = this.tableData[++countRowspan + rowIndex]
+              nextRow = this.tableData[++countRowspan + rowIndex];
             }
             if (countRowspan > 1) {
-              return { rowspan: countRowspan, colspan: 1 }
+              return { rowspan: countRowspan, colspan: 1 };
             }
           }
         }
@@ -276,52 +396,62 @@ export default {
     getProductsInfo() {
       getProductsInfo().then((response) => {
         this.productsInfo = response.data;
-        this.productsInfo.forEach(item => {
-          item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+        this.productsInfo.forEach((item) => {
+          item.productName =
+            item.productName +
+            "—" +
+            item.materieEncoding +
+            item.materieColorNumber;
         });
-      })
+      });
     },
     // 下拉框数据改变查询色号批号信息
-    selectedChangeDate(row,selectedProduct) {
+    selectedChangeDate(row, selectedProduct) {
       //选择的那个销售产品
-      this.product = this.productsInfo.find(product => product.id === selectedProduct);
-      this.form.product=selectedProduct;
+      this.product = this.productsInfo.find(
+        (product) => product.id === selectedProduct
+      );
+      this.form.product = selectedProduct;
       //通过母粒编码查询到对应的母粒信息
       let queryParams = {
-        "materielCode": this.product.colourNumber
-      }
+        materielCode: this.product.colourNumber,
+      };
       //得到对应的母粒信息
       getMaterielInfo(queryParams).then((response) => {
-        if (response.data!=null) {
+        if (response.data != null) {
           this.materiel = response.data;
           //色号 母粒编码+色号
-          row.currentColorCode = this.materiel.materieEncoding+"("+this.materiel.materieColorNumber+")";
+          row.currentColorCode =
+            this.materiel.materieEncoding +
+            "(" +
+            this.materiel.materieColorNumber +
+            ")";
         }
       });
       //isDisabled(有批号就用,没批号就自己输入)
-      if(this.product.lotNumber!=undefined&&this.product.lotNumber!=""){
-        row.currentLotNumber=this.product.lotNumber;
-        this.isDisabled=true;
-      }else {
-        this.isDisabled=false;
+      if (this.product.lotNumber != undefined && this.product.lotNumber != "") {
+        row.currentLotNumber = this.product.lotNumber;
+        this.isDisabled = true;
+      } else {
+        this.isDisabled = false;
       }
       //产品规格
-      row.currentSpecification= this.product.productSpecifications;
+      row.currentSpecification = this.product.productSpecifications;
       //销售单编号(以前打算存的是业务员信息后来存的是销售单编号)
-      row.salesmanId=this.product.saleOrderNo;
+      row.salesmanId = this.product.saleOrderNo;
     },
     // 新增计划产品信息
     handleAddPlan(row) {
-      if(this.selectedWorkshop=="南车间"){
-        this.nanInsertDialogTableVisible = true
-      }else{
-        this.beiInsertDialogTableVisible = true
+      if (this.selectedWorkshop == "南车间") {
+        this.nanInsertDialogTableVisible = true;
+      } else {
+        this.beiInsertDialogTableVisible = true;
       }
-      this.tableData2=[]
+      this.tableData2 = [];
       //先清空
-      this.machineId=""
+      this.machineId = "";
       //当前操作机台号
-      this.machineId=row.machineId;
+      this.machineId = row.machineId;
     },
 
     // tab栏点击切换
@@ -347,13 +477,15 @@ export default {
       //找到当前行的编辑索引
       var rowIndex = this.tableData2.indexOf(row);
 
-      if (this.lastEditLine != 0 &&
+      if (
+        this.lastEditLine != 0 &&
         this.editingRowIndex !== rowIndex &&
         this.editingRowIndex !== -1 &&
-        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+        !this.isRowFilled(this.tableData2[this.lastEditLine])
+      ) {
         this.$message({
-          message: '请先完成上一条数据的填写',
-          type: 'warning'
+          message: "请先完成上一条数据的填写",
+          type: "warning",
         });
         return;
       }
@@ -368,7 +500,6 @@ export default {
         row.isEditing = true;
         this.editingRowIndex = rowIndex;
       }
-
     },
     // 光标失去焦点变成不可编辑
     handleInputBlur(row) {
@@ -386,155 +517,166 @@ export default {
     },
     // 检查行是否填写完毕的示例方法
     isRowFilled(row) {
-      return row.currentSpecification && row.currentSpindleCount && row.number && row.startTime && row.plannedEndTime;
+      return (
+        row.currentSpecification &&
+        row.currentSpindleCount &&
+        row.number &&
+        row.startTime &&
+        row.plannedEndTime
+      );
     },
     // 新增一行标记为可编辑
     addEditableRow() {
       // 检查当前编辑行是否已填写完毕
-      if(this.tableData2.length!=0){
-        if (this.editingRowIndex !== -1 && !this.isRowFilled(this.tableData2[this.editingRowIndex])) {
+      if (this.tableData2.length != 0) {
+        if (
+          this.editingRowIndex !== -1 &&
+          !this.isRowFilled(this.tableData2[this.editingRowIndex])
+        ) {
           this.$message({
-            message: '请先完成上一条数据的填写',
-            type: 'warning'
+            message: "请先完成上一条数据的填写",
+            type: "warning",
           });
           return;
         }
         //新增行之前先让以前的行不能编辑
-        this.tableData2.forEach(item => {
+        this.tableData2.forEach((item) => {
           item.isEditing = false;
-        })
+        });
       }
       this.tableData2.push({
-        currentColorCode: '',
-        currentSpecification: '',
-        currentLotNumber: '',
-        currentSpindleCount: '',
-        number: '',
-        startTime: '',
-        plannedEndTime:'',
-        planStatus:0,
-        productId:'',
-        salesmanId:'',
-        isEditing: true // 标记为正在编辑状态
+        currentColorCode: "",
+        currentSpecification: "",
+        currentLotNumber: "",
+        currentSpindleCount: "",
+        number: "",
+        startTime: "",
+        plannedEndTime: "",
+        planStatus: 0,
+        productId: "",
+        salesmanId: "",
+        isEditing: true, // 标记为正在编辑状态
       });
       this.editingRowIndex = this.tableData2.length - 1; // 更新当前编辑的行索引
-      this.lastEditLine = this.tableData2.length - 1
+      this.lastEditLine = this.tableData2.length - 1;
     },
     // 添加计划
-    addPlanInfo(){
-      const datatime=Date.now()+this.machineId;
+    addPlanInfo() {
+      const datatime = Date.now() + this.machineId;
       //处理表格数据
-      this.tableData2.forEach(item=>{
-        item.timestampRandomCode=datatime;
-        item.machineId=this.machineId;
-      })
+      this.tableData2.forEach((item) => {
+        item.timestampRandomCode = datatime;
+        item.machineId = this.machineId;
+      });
       //时间戳
-      let data={
+      let data = {
         //机台号
         machineId: this.machineId,
-        timestampRandomCode:datatime,
+        timestampRandomCode: datatime,
         //计划信息
-        detailsOfTheRefuelingPlans: this.tableData2
-      }
+        detailsOfTheRefuelingPlans: this.tableData2,
+      };
       //添加计划信息
-      addMaterielInfo(data).then(response => {
+      addMaterielInfo(data).then((response) => {
         if (response.code == 200) {
           this.$message({
-            message: '添加成功',
-            type: 'success'
+            message: "添加成功",
+            type: "success",
           });
           this.getAmmunitionPlanInfo();
           //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
+          this.nanInsertDialogTableVisible = false;
           //更改订单投产信息的批号,
         } else {
           this.$message({
-            message: '添加失败',
-            type: 'error'
+            message: "添加失败",
+            type: "error",
           });
           //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
+          this.nanInsertDialogTableVisible = false;
         }
       });
-
     },
     // 修改产品计划
     handleEditPlan(row) {
-      this.tableData2=[];
+      this.tableData2 = [];
       //弹窗
-      if(this.selectedWorkshop=="南车间"){
-        this.nanUpdateDialogTableVisible = true
-      }else{
-        this.beiUpdateDialogTableVisible = true
+      if (this.selectedWorkshop == "南车间") {
+        this.nanUpdateDialogTableVisible = true;
+      } else {
+        this.beiUpdateDialogTableVisible = true;
       }
-      this.tableData2=[];
+      this.tableData2 = [];
       getAllPlanListByMachineId(row.machineId).then((response) => {
         //得到生产中,停产的,待产的
-        response.data.forEach(item => {
-          item.isEditing=false;
-          item.planStatus=parseInt(item.planStatus);
-          item.productId=parseInt(item.productId)
-        })
-        this.tableData2=response.data;
-        console.log( this.tableData2)
+        response.data.forEach((item) => {
+          item.isEditing = false;
+          item.planStatus = parseInt(item.planStatus);
+          item.productId = parseInt(item.productId);
+        });
+        this.tableData2 = response.data;
+        console.log(this.tableData2);
         // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
         this.$nextTick(() => {
           // 获取第一个业务员选择框(假设表格只有一行)
           for (let i = 0; i < this.tableData2.length; i++) {
-            const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
+            const firstSalesmanSelect = this.$refs["salesmanSelect" + i];
             // console.log(firstSalesmanSelect,11111111)
             // 触发 change 事件
             if (firstSalesmanSelect) {
-              firstSalesmanSelect.$emit('change', {
-                target: {value: "ddd"},
+              firstSalesmanSelect.$emit("change", {
+                target: { value: "ddd" },
               });
             }
           }
-
         });
-      })
-
-
+      });
     },
     //弹窗里边的点击查询
-    onSubmit(){
-      this.formData.machineId=this.machineId;
-      getAllPlanListByProductTypeAndStatus(this.formData).then(response => {
+    onSubmit() {
+      this.formData.machineId = this.machineId;
+      getAllPlanListByProductTypeAndStatus(this.formData).then((response) => {
         //得到生产中,停产的,待产的
-        response.data.forEach(item => {
-          item.isEditing=false;
-          item.planStatus=parseInt(item.planStatus);
-        })
-        this.tableData2=response.data;
+        response.data.forEach((item) => {
+          item.isEditing = false;
+          item.planStatus = parseInt(item.planStatus);
+        });
+        this.tableData2 = response.data;
       });
     },
     //更新状态
-    updateStatus(ind, row){
+    updateStatus(ind, row) {
       console.log(row);
-      updatePlanOne(row).then(response=>{
+      updatePlanOne(row).then((response) => {
         if (response.code == 200) {
           this.$message({
-            message: '修改成功',
-            type: 'success'
+            message: "修改成功",
+            type: "success",
           });
           this.getAmmunitionPlanInfo();
           //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
+          this.nanInsertDialogTableVisible = false;
         } else {
           this.$message({
-            message: '修改失败',
-            type: 'error'
+            message: "修改失败",
+            type: "error",
           });
           //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
+          this.nanInsertDialogTableVisible = false;
         }
-      })
-    }
+      });
+    },
   },
-  computed: {
-
+  beforeDestroy() {
+    if (this.timerId) {
+      clearInterval(this.timerId);
+    }
+    if (this.scrollTimer) {
+      clearInterval(this.scrollTimer);
+    }
   },
-}
+  computed: {},
+};
 </script>
 
 <style scoped>

+ 287 - 150
zkqy-ui/src/views/orderMange/planTable/show/southWorkshop.vue

@@ -1,52 +1,119 @@
 <template>
-  <div class="app-container" style="width: 100%;">
-
-        <!--表格-->
-        <el-table
-          :data="tableData"
-          ref="tableRef"
-          :span-method="spanMethod2">
-          <el-table-column prop="machineId" fixed label="机台号" header-align="center" align="center" width="111px" ></el-table-column>
-          <el-table-column prop="productType" fixed label="产品类别" header-align="center" align="center" width="111.2px"></el-table-column>
-          <el-table-column label="在机产品" header-align="center" >
-            <el-table-column prop="currentColorCode" label="色号" header-align="center" width="90px" align="center"></el-table-column>
-            <el-table-column prop="currentSpecification" label="规格" header-align="center" width="90px" align="center"></el-table-column>
-            <el-table-column prop="currentLotNumber" label="批号" header-align="center"  width="90px" align="center"></el-table-column>
-            <el-table-column prop="currentSpindleCount" label="锭数" header-align="center" width="90px" align="center"></el-table-column>
-            <el-table-column prop="startTime" label="上机时间" header-align="center" width="90px" align="center"></el-table-column>
-            <el-table-column prop="plannedEndTime" label="下机时间" header-align="center" width="90px" align="center"></el-table-column>
-          </el-table-column>
-          <!--          <el-table-column  label="待上机产品" header-align="center" align="center">-->
-          <!--            <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
-          <!--            <el-table-column prop="djCurrentSpecification" label="规格" header-align="center" align="center"></el-table-column>-->
-          <!--            <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
-          <!--            <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
-          <!--          </el-table-column>-->
-          <el-table-column prop="listOfPendingProduction" label="待生产产品列表" header-align="center" align="center"  >
-            <template slot-scope="scope">
-              <div v-if="scope.row.listOfPendingProduction">
-                <span v-for="(item, index) in scope.row.listOfPendingProduction.split(',')">
-                  {{ item }},
-                  <br v-if="(index + 1) % 5 === 0 && index !== scope.row.listOfPendingProduction.split(',').length - 1" />
-                </span>
-              </div>
-            </template>
-          </el-table-column>
-<!--          <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
-<!--            <template slot-scope="scope">-->
-<!--              <el-dropdown>-->
-<!--                <el-button type="primary">-->
-<!--                  操作-->
-<!--                  <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
-<!--                </el-button>-->
-<!--                <el-dropdown-menu slot="dropdown">-->
-<!--                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
-<!--                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
-<!--                </el-dropdown-menu>-->
-<!--              </el-dropdown>-->
-<!--            </template>-->
-<!--          </el-table-column>-->
-        </el-table>
+  <div class="app-container" style="width: 100%">
+    <!--表格-->
+    <el-table
+      :data="tableData"
+      ref="tableRef"
+      :height="table_height"
+      :span-method="spanMethod2"
+    >
+      <el-table-column
+        prop="machineId"
+        fixed
+        label="机台号"
+        header-align="center"
+        align="center"
+        width="111px"
+      ></el-table-column>
+      <el-table-column
+        prop="productType"
+        fixed
+        label="产品类别"
+        header-align="center"
+        align="center"
+        width="111.2px"
+      ></el-table-column>
+      <el-table-column label="在机产品" header-align="center">
+        <el-table-column
+          prop="currentColorCode"
+          label="色号"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="currentSpecification"
+          label="规格"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="currentLotNumber"
+          label="批号"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="currentSpindleCount"
+          label="锭数"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="startTime"
+          label="上机时间"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="plannedEndTime"
+          label="下机时间"
+          header-align="center"
+          width="90px"
+          align="center"
+        ></el-table-column>
+      </el-table-column>
+      <!--          <el-table-column  label="待上机产品" header-align="center" align="center">-->
+      <!--            <el-table-column prop="djCurrentColorCode" label="色号" header-align="center" align="center"></el-table-column>-->
+      <!--            <el-table-column prop="djCurrentSpecification" label="规格" header-align="center" align="center"></el-table-column>-->
+      <!--            <el-table-column prop="djNumber" label="数量" header-align="center" align="center"></el-table-column>-->
+      <!--            <el-table-column prop="djCurrentLotNumber" label="原丝批号" header-align="center" align="center"></el-table-column>-->
+      <!--          </el-table-column>-->
+      <el-table-column
+        prop="listOfPendingProduction"
+        label="待生产产品列表"
+        header-align="center"
+        align="center"
+      >
+        <template slot-scope="scope">
+          <div v-if="scope.row.listOfPendingProduction">
+            <span
+              v-for="(item, index) in scope.row.listOfPendingProduction.split(
+                ','
+              )"
+              :key="index"
+            >
+              {{ item }},
+              <br
+                v-if="
+                  (index + 1) % 5 === 0 &&
+                  index !==
+                    scope.row.listOfPendingProduction.split(',').length - 1
+                "
+              />
+            </span>
+          </div>
+        </template>
+      </el-table-column>
+      <!--          <el-table-column   fixed="right" label="操作" header-align="center" align="center" width="150px" >-->
+      <!--            <template slot-scope="scope">-->
+      <!--              <el-dropdown>-->
+      <!--                <el-button type="primary">-->
+      <!--                  操作-->
+      <!--                  <i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+      <!--                </el-button>-->
+      <!--                <el-dropdown-menu slot="dropdown">-->
+      <!--                  <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>-->
+      <!--                  <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>-->
+      <!--                </el-dropdown-menu>-->
+      <!--              </el-dropdown>-->
+      <!--            </template>-->
+      <!--          </el-table-column>-->
+    </el-table>
   </div>
 </template>
 <script>
@@ -57,96 +124,150 @@ import {
   addMaterielInfo,
   getSalesman,
   getAllPlanListByMachineId,
-  getAllPlanListByProductTypeAndStatus, updatePlanOne
+  getAllPlanListByProductTypeAndStatus,
+  updatePlanOne,
 } from "@/api/plan/paln.js";
 
-import {getDicts} from "@/api/system/dict/data"
+import { getDicts } from "@/api/system/dict/data";
 export default {
   data() {
     return {
+      // 表格滑动相关
+      scrollTimer: null,
+      table_height: 0,
       //选中的是那个车间
-      selectedWorkshop:"北车间",
-      tableData:[],
-      isDisabled:true,
+      selectedWorkshop: "北车间",
+      tableData: [],
+      isDisabled: true,
       form: {
-        product:"",
+        product: "",
       },
       previousMachineId: undefined,
       currentRowspan: 1,
       prevRow: {},
       tableData2: [],
-      nanInsertDialogTableVisible:false,
-      nanUpdateDialogTableVisible:false,
-      beiInsertDialogTableVisible:false,
-      beiUpdateDialogTableVisible:false,
+      nanInsertDialogTableVisible: false,
+      nanUpdateDialogTableVisible: false,
+      beiInsertDialogTableVisible: false,
+      beiUpdateDialogTableVisible: false,
       editingRowIndex: -1,
-      lastEditLine:0,
-      queryParams:{ productionLineDepartment:"加弹部",
-        productionLineWorkshop:"北车间"},
-      isEditLine:false,
-      productsInfo:[],
-      salesmanInfo:[],
-      product:{},
-      materiel:{},
+      lastEditLine: 0,
+      queryParams: {
+        productionLineDepartment: "加弹部",
+        productionLineWorkshop: "北车间",
+      },
+      isEditLine: false,
+      productsInfo: [],
+      salesmanInfo: [],
+      product: {},
+      materiel: {},
       // 机台号
-      machineId:"",
+      machineId: "",
       // 待机/上机/停产
-      stateList0:[
-        {"id":0,"name":"待机"},
-        {"id":1,"name":"上机"},
+      stateList0: [
+        { id: 0, name: "待机" },
+        { id: 1, name: "上机" },
       ],
-      stateList1:[
-        {"id":0,"name":"待机"},
-        {"id":2,"name":"停机"},
-        {"id":1,"name":"上机"},
-        {"id":3,"name":"已完成"},
+      stateList1: [
+        { id: 0, name: "待机" },
+        { id: 2, name: "停机" },
+        { id: 1, name: "上机" },
+        { id: 3, name: "已完成" },
       ],
-      stateList2:[
-        {"id":0,"name":"待机"},
-        {"id":2,"name":"停机"},
-        {"id":1,"name":"上机"},
+      stateList2: [
+        { id: 0, name: "待机" },
+        { id: 2, name: "停机" },
+        { id: 1, name: "上机" },
       ],
-      formData:{
-        updateSelectedProductCategory:"",
-        updateSelectedProductState:""
+      formData: {
+        updateSelectedProductCategory: "",
+        updateSelectedProductState: "",
       },
       // 产品类别
-      productTypeList:[{value:"A面",lable:"A面"},{value:"B面",lable:"B面"}],
-      counter:0,
-      timerId: null
-    }
+      productTypeList: [
+        { value: "A面", lable: "A面" },
+        { value: "B面", lable: "B面" },
+      ],
+      counter: 0,
+      timerId: null,
+    };
+  },
+  created() {
+    // 初始化数据
+    this.initSize();
   },
   mounted() {
+    // 初始化滚动数据
+    this.initScroll();
     // 得到排产计划信息
     this.getAmmunitionPlanInfo();
     // 得到业务员信息
     // this.getSalesman();
     this.getProductsInfo();
     //查询字典信息
-    getDicts("dpsx").then(res=>{
+    getDicts("dpsx").then((res) => {
       //制定周期跑一次定时任务
-      console.log(res.data[0].dictValue)
+      console.log(res.data[0].dictValue);
       this.timerId = setInterval(() => {
         this.counter++;
-        console.log(`计数器:`,this.counter);
+        console.log(`计数器:`, this.counter);
         // 注意:适时清理定时器,例如在组件销毁时
         // 得到排产计划信息
         this.getAmmunitionPlanInfo();
       }, res.data[0].dictValue);
-    })
+    });
+  },
+  beforeDestroy() {
+    if (this.timerId) {
+      clearInterval(this.timerId);
+    }
+    if (this.scrollTimer) {
+      clearInterval(this.scrollTimer);
+    }
   },
   methods: {
+    // 初始化尺寸
+    initSize() {
+      this.table_height = window.innerHeight - 40;
+      console.log("table_height:", this.table_height);
+    },
+    async initScroll() {
+      let time = await getDicts("scroll_speed");
+      console.log(time);
+      if (time.code == 200) {
+        time = Number(time.data[0].dictValue);
+      } else {
+        time = 180;
+      }
+      // 拿到表格挂载后的真实DOM
+      const table = this.$refs.tableRef;
+      // 拿到表格中承载数据的div元素
+      const divData = table.bodyWrapper;
+      // 拿到元素后,对元素进行定时增加距离顶部距离,实现滚动效果(此配置为每100毫秒移动1像素)
+      this.scrollTimer = setInterval(() => {
+        // 元素自增距离顶部1像素
+        divData.scrollTop += 1;
+        // 判断元素是否滚动到底部(可视高度+距离顶部=整个高度)
+        if (
+          divData.clientHeight + divData.scrollTop + 1 >=
+          divData.scrollHeight
+        ) {
+          // 重置table距离顶部距离
+          divData.scrollTop = 0;
+        }
+      }, time); // 滚动速度
+    },
     // 查询排产信息
     getAmmunitionPlanInfo() {
       ammunitionPlanInfo(this.queryParams).then((response) => {
-        this.tableData = response.data
+        this.tableData = response.data;
       });
     },
     // 合并单元格
     spanMethod2({ row, column, rowIndex, columnIndex }) {
       //第二列合并
       if (columnIndex === 1) {
-        if(row.productType == null) {
+        if (row.productType == null) {
           return;
         }
         const prevRow2 = this.tableData[rowIndex - 1]; // 上一行数据
@@ -166,7 +287,7 @@ export default {
             nextRow2 &&
             nextRow2.machineId === row.machineId &&
             nextRow2.productType === row.productType
-            ) {
+          ) {
             nextRow2 = this.tableData[++countRowspan2 + rowIndex];
           }
           if (countRowspan2 > 1) {
@@ -176,37 +297,45 @@ export default {
       }
       //待生产列表
       if (columnIndex === 8) {
-        const prevRow2 = this.tableData[rowIndex - 1] //上一行数据
-        let nextRow2 = this.tableData[rowIndex + 1] //下一行数据
+        const prevRow2 = this.tableData[rowIndex - 1]; //上一行数据
+        let nextRow2 = this.tableData[rowIndex + 1]; //下一行数据
         // 当上一行的数据等于当前行数据时,当前行单元格隐藏
 
         // console.log(row.listOfPendingProduction)
-        if(row.listOfPendingProduction==null||row.listOfPendingProduction==undefined|| row.listOfPendingProduction==""){
+        if (
+          row.listOfPendingProduction == null ||
+          row.listOfPendingProduction == undefined ||
+          row.listOfPendingProduction == ""
+        ) {
           return;
         }
-        if (prevRow2 &&
+        if (
+          prevRow2 &&
           prevRow2.machineId === row.machineId &&
           prevRow2.productType === row.productType
         ) {
-          return { rowspan: 0, colspan: 0 }
+          return { rowspan: 0, colspan: 0 };
         } else {
           // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
-          let countRowspan2 = 1 //用于合并计数多少单元格
-          while (nextRow2 &&
-            nextRow2.listOfPendingProduction === row.listOfPendingProduction&&
+          let countRowspan2 = 1; //用于合并计数多少单元格
+          while (
+            nextRow2 &&
+            nextRow2.listOfPendingProduction === row.listOfPendingProduction &&
             nextRow2.machineId === row.machineId &&
             nextRow2.productType === row.productType
-            ) {
-            nextRow2 = this.tableData[++countRowspan2 + rowIndex]
+          ) {
+            nextRow2 = this.tableData[++countRowspan2 + rowIndex];
           }
           if (countRowspan2 > 1) {
-            return { rowspan: countRowspan2, colspan: 1 }
+            return { rowspan: countRowspan2, colspan: 1 };
           }
         }
       }
       //合并最后一列操作列
-      const lastColumnIndex = this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
-      if (columnIndex === lastColumnIndex && column.label === '操作') { // 判断是否为最后一列且标签为'操作'
+      const lastColumnIndex =
+        this.$refs.tableRef.store.states.columns.length - 1; // 获取表格最后一列的索引
+      if (columnIndex === lastColumnIndex && column.label === "操作") {
+        // 判断是否为最后一列且标签为'操作'
         const machineIdColumnIndex = 0; // 机台号列的索引假定为0
         const currentMachineId = row.machineId;
 
@@ -218,10 +347,7 @@ export default {
         } else {
           let nextRow = this.tableData[rowIndex + 1];
 
-          while (
-            nextRow &&
-            nextRow.machineId === currentMachineId
-            ) {
+          while (nextRow && nextRow.machineId === currentMachineId) {
             nextRow = this.tableData[++countRowspan + rowIndex];
           }
 
@@ -233,25 +359,25 @@ export default {
       //第一列机台号合并
       if (columnIndex === 0) {
         //定义需要合并的列字段,有哪些列需要合并,就自定义添加字段即可
-        const fields = ['machineId']
+        const fields = ["machineId"];
         // 当前行的数据
-        const cellValue = row[column.property]
-        let countRowspan = 1 //用于合并计数多少单元格
+        const cellValue = row[column.property];
+        let countRowspan = 1; //用于合并计数多少单元格
         // 判断只合并定义字段的列数据
         if (cellValue && fields.includes(column.property)) {
-          const prevRow = this.tableData[rowIndex - 1] //上一行数据
-          let nextRow = this.tableData[rowIndex + 1] //下一行数据
+          const prevRow = this.tableData[rowIndex - 1]; //上一行数据
+          let nextRow = this.tableData[rowIndex + 1]; //下一行数据
           // 当上一行的数据等于当前行数据时,当前行单元格隐藏
           if (prevRow && prevRow[column.property] === cellValue) {
-            return { rowspan: 0, colspan: 0 }
+            return { rowspan: 0, colspan: 0 };
           } else {
             // 反之,则循环判断若下一行数据等于当前行数据,则当前行开始进行合并单元格
-            let countRowspan = 1 //用于合并计数多少单元格
+            let countRowspan = 1; //用于合并计数多少单元格
             while (nextRow && nextRow[column.property] === cellValue) {
-              nextRow = this.tableData[++countRowspan + rowIndex]
+              nextRow = this.tableData[++countRowspan + rowIndex];
             }
             if (countRowspan > 1) {
-              return { rowspan: countRowspan, colspan: 1 }
+              return { rowspan: countRowspan, colspan: 1 };
             }
           }
         }
@@ -279,10 +405,14 @@ export default {
     getProductsInfo() {
       getProductsInfo().then((response) => {
         this.productsInfo = response.data;
-        this.productsInfo.forEach(item => {
-          item.productName = item.productName+"—"+item.materieEncoding+item.materieColorNumber
+        this.productsInfo.forEach((item) => {
+          item.productName =
+            item.productName +
+            "—" +
+            item.materieEncoding +
+            item.materieColorNumber;
         });
-      })
+      });
     },
 
     // tab栏点击切换
@@ -308,13 +438,15 @@ export default {
       //找到当前行的编辑索引
       var rowIndex = this.tableData2.indexOf(row);
 
-      if (this.lastEditLine != 0 &&
+      if (
+        this.lastEditLine != 0 &&
         this.editingRowIndex !== rowIndex &&
         this.editingRowIndex !== -1 &&
-        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+        !this.isRowFilled(this.tableData2[this.lastEditLine])
+      ) {
         this.$message({
-          message: '请先完成上一条数据的填写',
-          type: 'warning'
+          message: "请先完成上一条数据的填写",
+          type: "warning",
         });
         return;
       }
@@ -329,7 +461,6 @@ export default {
         row.isEditing = true;
         this.editingRowIndex = rowIndex;
       }
-
     },
     // 光标失去焦点变成不可编辑
     handleInputBlur(row) {
@@ -347,51 +478,57 @@ export default {
     },
     // 检查行是否填写完毕的示例方法
     isRowFilled(row) {
-      return row.currentSpecification && row.currentSpindleCount && row.number && row.startTime && row.plannedEndTime;
+      return (
+        row.currentSpecification &&
+        row.currentSpindleCount &&
+        row.number &&
+        row.startTime &&
+        row.plannedEndTime
+      );
     },
 
     //弹窗里边的点击查询
-    onSubmit(){
-      this.formData.machineId=this.machineId;
-      getAllPlanListByProductTypeAndStatus(this.formData).then(response => {
+    onSubmit() {
+      this.formData.machineId = this.machineId;
+      getAllPlanListByProductTypeAndStatus(this.formData).then((response) => {
         //得到生产中,停产的,待产的
-        response.data.forEach(item => {
-          item.isEditing=false;
-          item.planStatus=parseInt(item.planStatus);
-        })
-        this.tableData2=response.data;
+        response.data.forEach((item) => {
+          item.isEditing = false;
+          item.planStatus = parseInt(item.planStatus);
+        });
+        this.tableData2 = response.data;
       });
     },
     //更新状态
-    updateStatus(ind, row){
+    updateStatus(ind, row) {
       console.log(row);
-      updatePlanOne(row).then(response=>{
+      updatePlanOne(row).then((response) => {
         if (response.code == 200) {
           this.$message({
-            message: '修改成功',
-            type: 'success'
+            message: "修改成功",
+            type: "success",
           });
           this.getAmmunitionPlanInfo();
           //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
+          this.nanInsertDialogTableVisible = false;
         } else {
           this.$message({
-            message: '修改失败',
-            type: 'error'
+            message: "修改失败",
+            type: "error",
           });
           //最后把弹窗关掉
-          this.nanInsertDialogTableVisible=false
+          this.nanInsertDialogTableVisible = false;
         }
-      })
-    }
+      });
+    },
   },
-  computed: {
+  computed: {},
 
-  },
   beforeDestroy() {
+    console.log("销毁了");
     clearInterval(this.timerId); // 清理定时器
-  }
-}
+  },
+};
 </script>
 
 <style scoped>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно