瀏覽代碼

新需求

cz 1 年之前
父節點
當前提交
598c865e47

+ 1 - 0
package.json

@@ -47,6 +47,7 @@
     "nprogress": "0.2.0",
     "pinia": "2.0.22",
     "pubsub-js": "^1.9.4",
+    "qrcodejs2-fix": "^0.0.1",
     "sortablejs": "^1.15.0",
     "typescript": "^5.0.4",
     "vue": "3.2.45",

+ 121 - 0
src/components/PDF/productionPDF.vue

@@ -0,0 +1,121 @@
+<template>
+  <div>
+    <div id="pdfDom" ref="pdfDom" style="font-family: 'msyh'">
+      <div>
+        <div class="title">产品生产流程单</div>
+        <table border="1" style="width: 100%" class="table">
+          <tr>
+            <td style="width: 20%">项目名称</td>
+            <td style="width: 30%"></td>
+            <td style="width: 20%">日期</td>
+            <td style="width: 30%"></td>
+          </tr>
+          <tr>
+            <td>规格</td>
+            <td></td>
+            <td>数量</td>
+            <td></td>
+          </tr>
+          <tr v-for="item in 3" :key="item">
+            <td>工序{{ item }}开始</td>
+            <td></td>
+            <td>工序{{ item }}结束</td>
+            <td></td>
+          </tr>
+          <tr>
+            <td>
+              <div>组<br /><br /></div>
+              <div>装<br /><br /></div>
+              <div>要<br /><br /></div>
+              <div>求</div>
+            </td>
+            <td colspan="3"></td>
+          </tr>
+          <tr>
+            <td>机型编号</td>
+            <td></td>
+            <td>合格入库</td>
+            <td></td>
+          </tr>
+          <tr>
+            <td>入库时间</td>
+            <td></td>
+            <td>交货时间</td>
+            <td></td>
+          </tr>
+          <tr>
+            <td>发货确认</td>
+            <td></td>
+            <td>仓库时间</td>
+            <td></td>
+          </tr>
+        </table>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+const { proxy } = getCurrentInstance();
+const pdfData = ref({});
+const props = defineProps({
+  rowData: Object,
+});
+
+const handlePrintPdf = (row) => {
+  proxy.post("/salesContract/detail", { id: row.id }).then((res) => {
+    console.log(res, "ada");
+    if (res.customerUserList && res.customerUserList.length > 0) {
+      let data = res.customerUserList[0];
+      if (data.contactJson) {
+        data.contactJson = JSON.parse(data.contactJson);
+        const current = data.contactJson.find((x) => x.type == "mobile");
+        const currentPhone = data.contactJson.find((x) => x.type == "phone");
+        if (current && current.contactNo) {
+          res.contactNo = current.contactNo;
+        }
+        if (currentPhone && currentPhone.contactNo) {
+          res.contactPhoneNo = currentPhone.contactNo;
+        }
+      }
+    }
+    pdfData.value = res;
+  });
+};
+
+if (props.rowData && props.rowData.id) {
+  handlePrintPdf(props.rowData);
+}
+
+watch(
+  () => props.rowData.id,
+  (val) => {
+    if (props.rowData && props.rowData.id) {
+      handlePrintPdf(props.rowData);
+    }
+  }
+);
+</script>
+
+<style lang="scss" scoped>
+#pdfDom {
+  font-size: 14px;
+  color: #000000;
+  // padding: 30px 30px;
+  .title {
+    font-size: 25px;
+    font-weight: 700;
+    margin-bottom: 20px;
+    text-align: center;
+    letter-spacing: 10px;
+  }
+  .table {
+    border-collapse: collapse;
+    border-spacing: 0;
+    td {
+      text-align: center;
+      padding: 5px 10px;
+    }
+  }
+}
+</style>

+ 62 - 21
src/views/JXSK/production/forward/index.vue

@@ -78,6 +78,20 @@
             </el-upload>
           </div>
         </template>
+        <template #fileOne>
+          <div style="width: 100%">
+            <el-upload
+              v-model:fileList="formData.data.fileListOne"
+              action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
+              :data="uploadData"
+              multiple
+              :before-upload="uploadFile"
+              :on-preview="onPreviewFile"
+            >
+              <el-button disabled>选择</el-button>
+            </el-upload>
+          </div>
+        </template>
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
@@ -222,12 +236,12 @@ const formOption = reactive({
 const byform = ref(null);
 const formConfig = computed(() => {
   return [
-    {
-      type: "slot",
-      slotName: "right",
-      label: "",
-      isShow: submitType.value == "20",
-    },
+    // {
+    //   type: "slot",
+    //   slotName: "right",
+    //   label: "",
+    //   isShow: submitType.value == "20",
+    // },
     {
       type: "input",
       itemType: "text",
@@ -280,6 +294,11 @@ const formConfig = computed(() => {
     },
     {
       type: "slot",
+      slotName: "fileOne",
+      label: "上一个工序图纸",
+    },
+    {
+      type: "slot",
       slotName: "file",
       label: "工序图纸",
     },
@@ -419,21 +438,43 @@ const getDtl = (row) => {
   // formOption.disabled = true;
   formData.data = { ...row, fileList: [] };
   dialogVisible.value = true;
-  printData.value = {
-    customerName: row.customerName,
-    productName: row.productName + `(${row.productSpec})`,
-  };
-  let barCode = row.productSn;
-  nextTick(() => {
-    JsBarcode("#barCode", barCode, {
-      format: "CODE128", //选择要使用的条形码类型
-      text: barCode, //显示文本
-      displayValue: true, //是否在条形码下方显示文字
-      textPosition: "bottom", //设置文本的垂直位置
-      // background: "#eee", //设置条形码的背景
-      font: "fantasy", //设置文本的字体
-      margin: 15, //设置条形码周围的空白边距
-    });
+  // if (submitType.value == "20") {
+  //   printData.value = {
+  //     customerName: row.customerName,
+  //     productName: row.productName + `(${row.productSpec})`,
+  //   };
+  //   let barCode = row.productSn;
+  //   nextTick(() => {
+  //     JsBarcode("#barCode", barCode, {
+  //       format: "CODE128", //选择要使用的条形码类型
+  //       text: barCode, //显示文本
+  //       displayValue: true, //是否在条形码下方显示文字
+  //       textPosition: "bottom", //设置文本的垂直位置
+  //       // background: "#eee", //设置条形码的背景
+  //       font: "fantasy", //设置文本的字体
+  //       margin: 15, //设置条形码周围的空白边距
+  //     });
+  //   });
+  // }
+
+  proxy.post("/productionTaskDetail/detail", { id: row.id }).then((res) => {
+    if (
+      res.productionTaskDetailRecordList &&
+      res.productionTaskDetailRecordList.length > 0
+    ) {
+      let id = res.productionTaskDetailRecordList[0].id;
+      proxy.post("/fileInfo/getList", { businessIdList: [id] }).then((res) => {
+        if (res[id] && res[id].length > 0) {
+          formData.data.fileListOne = res[id].map((item) => {
+            return {
+              raw: item,
+              name: item.fileName,
+              url: item.fileUrl,
+            };
+          });
+        }
+      });
+    }
   });
 };
 

+ 94 - 0
src/views/JXSK/production/schedule/index.vue

@@ -51,6 +51,43 @@
         >
       </template>
     </el-dialog>
+
+    <el-dialog
+      :title="'查看工序图纸'"
+      v-model="dialogVisibleOne"
+      width="700"
+      destroy-on-close
+    >
+      <div>
+        <div
+          v-for="(item, index) in allData"
+          :key="item.id"
+          style="margin-bottom: 20px"
+        >
+          <div style="margin-top: 5px">
+            工序名称:{{ item.productionProcessesName }}
+          </div>
+          <div style="margin-top: 5px">
+            工序负责人:{{ item.personLiableName }}
+          </div>
+          <div style="margin-top: 5px">
+            工序图纸:
+            <span
+              v-for="file in item.fileList"
+              :key="file.id"
+              style="margin-right: 20px; cursor: pointer; color: #409eff"
+              @click="handleOpenFile(file)"
+              >{{ file.fileName }}</span
+            >
+          </div>
+        </div>
+      </div>
+      <template #footer>
+        <el-button @click="dialogVisibleOne = false" size="large"
+          >取 消</el-button
+        >
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -238,6 +275,28 @@ const config = computed(() => {
         width: 160,
       },
     },
+    {
+      attrs: {
+        label: "操作",
+        width: "80",
+        align: "center",
+      },
+      renderHTML(row) {
+        return [
+          {
+            attrs: {
+              label: "查看",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              getDtl(row);
+            },
+          },
+        ];
+      },
+    },
   ];
 });
 
@@ -388,6 +447,41 @@ const moreSearchReset = () => {
   };
   moreSearchQuery();
 };
+const dialogVisibleOne = ref(false);
+const allData = ref([]);
+const getDtl = (row) => {
+  proxy.post("/productionTaskDetail/detail", { id: row.id }).then((res) => {
+    if (
+      res.productionTaskDetailRecordList &&
+      res.productionTaskDetailRecordList.length > 0
+    ) {
+      let ids = res.productionTaskDetailRecordList.map((x) => x.id);
+      allData.value = res.productionTaskDetailRecordList;
+      dialogVisibleOne.value = true;
+      proxy
+        .post("/fileInfo/getList", { businessIdList: ids })
+        .then((fileObj) => {
+          for (let i = 0; i < allData.value.length; i++) {
+            const e = allData.value[i];
+            for (const key in fileObj) {
+              if (e.id === key) {
+                e.fileList = fileObj[key];
+              }
+            }
+          }
+        });
+    } else {
+      return ElMessage({
+        message: "该任务还未开始",
+        type: "info",
+      });
+    }
+  });
+};
+
+const handleOpenFile = (file) => {
+  window.open(file.fileUrl, "_blank");
+};
 </script>
 
 <style lang="scss" scoped>

+ 117 - 3
src/views/JXSK/production/task/index.vue

@@ -99,6 +99,60 @@
         </el-button>
       </template>
     </el-dialog>
+
+    <el-dialog
+      title="打印"
+      v-if="printDialog"
+      v-model="printDialog"
+      width="500"
+    >
+      <div
+        style="height: calc(100vh - 300px); overflow: auto; padding-right: 20px"
+      >
+        <div id="pdfDom">
+          <div
+            v-for="item in qrList"
+            :key="item.productSn"
+            style="border: 1px solid #000; padding: 10px; margin-bottom: 20px"
+          >
+            <div style="display: flex">
+              <div :ref="item.productSn"></div>
+              <div
+                style="
+                  margin-left: 20px;
+                  display: flex;
+                  padding: 10px 0;
+                  flex-direction: column;
+                  justify-content: space-between;
+                "
+              >
+                <div class="print-row">产品:{{ printData.productName }}</div>
+                <div class="print-row">客户:{{ printData.customerName }}</div>
+              </div>
+            </div>
+            <div
+              style="
+                font-size: 16px;
+                font-weight: 700;
+                color: #000;
+                margin-top: 10px;
+              "
+            >
+              {{ item.productSn }}
+            </div>
+            <!-- 换页 -->
+            <div style="page-break-after: always"></div>
+          </div>
+        </div>
+      </div>
+
+      <template #footer>
+        <el-button @click="printDialog = false" size="large">取 消</el-button>
+        <el-button type="primary" v-print="printObj" size="large"
+          >打 印</el-button
+        >
+      </template>
+    </el-dialog>
   </div>
 </template>
 
@@ -107,6 +161,7 @@ import { ElMessage, ElMessageBox } from "element-plus";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import useUserStore from "@/store/modules/user";
+import QRCode from "qrcodejs2-fix";
 
 const { proxy } = getCurrentInstance();
 const loading = ref(false);
@@ -192,7 +247,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "操作",
-        width: "80",
+        width: "120",
         align: "center",
       },
       renderHTML(row) {
@@ -208,6 +263,17 @@ const config = computed(() => {
               getDtl(row);
             },
           },
+          {
+            attrs: {
+              label: "打印",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handlePrint(row);
+            },
+          },
         ];
       },
     },
@@ -529,7 +595,7 @@ const changeFn = (val) => {
     // const index = formConfig.value.findIndex(
     //   (x) => x.slotName === changeId.value
     // );
-    formConfig.value.splice(5, productionProcessesList.value.length);
+    formConfig.value.splice(6, productionProcessesList.value.length);
     productionProcessesList.value = [];
     productionObj.value = {};
   }
@@ -557,12 +623,55 @@ const handleClose = () => {
     productionProcessesList.value &&
     productionProcessesList.value.length > 0
   ) {
-    formConfig.value.splice(5, productionProcessesList.value.length);
+    formConfig.value.splice(6, productionProcessesList.value.length);
   }
   productionProcessesList.value = [];
   productionObj.value = {};
   dialogVisible.value = false;
 };
+
+const printDialog = ref(false);
+const printData = ref({});
+const qrList = ref([]);
+const handlePrint = (row) => {
+  const { code, quantity } = row;
+  const arr = [];
+  for (let i = 0; i < quantity; i++) {
+    let key = i + 1 + "";
+    key = key.padStart(3, "0");
+    let obj = {
+      productSn: code + "-" + key,
+    };
+    arr.push(obj);
+  }
+  qrList.value = arr;
+  printData.value = {
+    customerName: row.customerName,
+    productName: row.productName + `(${row.productSpec})`,
+  };
+  printDialog.value = true;
+  nextTick(() => {
+    for (let i = 0; i < qrList.value.length; i++) {
+      const ele = qrList.value[i];
+      proxy.$refs[ele.productSn][0].innerHTML = ""; //清除二维码方法一
+      new QRCode(proxy.$refs[ele.productSn][0], {
+        text: ele.productSn, //页面地址 ,如果页面需要参数传递请注意哈希模式#
+        width: 100,
+        height: 100,
+        colorDark: "#000000",
+        colorLight: "#ffffff",
+        correctLevel: QRCode.CorrectLevel.H,
+      });
+    }
+  });
+};
+const printObj = ref({
+  id: "pdfDom",
+  popTitle: "",
+  extraCss:
+    "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
+  extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
+});
 </script>
 
 <style lang="scss" scoped>
@@ -572,4 +681,9 @@ const handleClose = () => {
 ::v-deep(.el-input-number .el-input__inner) {
   text-align: left;
 }
+.print-row {
+  font-size: 14px;
+  font-weight: 700;
+  color: #000;
+}
 </style>

+ 3 - 3
src/views/JXSK/salesMange/contract/index.vue

@@ -318,9 +318,9 @@ const rules = ref({
   shroffAccountId: [
     { required: true, message: "请选择收款账户", trigger: "change" },
   ],
-  deliveryDate: [
-    { required: true, message: "请选择交货期限", trigger: "change" },
-  ],
+  // deliveryDate: [
+  //   { required: true, message: "请选择交货期限", trigger: "change" },
+  // ],
   payMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
   freightPayer: [
     { required: true, message: "请选择运费支付方", trigger: "change" },

+ 16 - 57
src/views/purchaseSales/outAndInWarehouse/waitingForStorage/index.vue

@@ -51,33 +51,9 @@
       title="打印"
       v-if="printDialog"
       v-model="printDialog"
-      width="500"
+      width="680"
     >
-      <div id="pdfDom" style="border: 1px solid #000; padding: 10px">
-        <svg id="barCode"></svg>
-        <div>
-          <div
-            style="
-              font-size: 14px;
-              font-weight: 700;
-              color: #000;
-              line-height: 32px;
-            "
-          >
-            产品:{{ printData.productName }}
-          </div>
-          <div
-            style="
-              font-size: 14px;
-              font-weight: 700;
-              color: #000;
-              line-height: 32px;
-            "
-          >
-            客户:{{ printData.customerName }}
-          </div>
-        </div>
-      </div>
+      <ProductionPDF :rowData="rowData"></ProductionPDF>
       <template #footer>
         <el-button @click="printDialog = false" size="large">取 消</el-button>
         <el-button type="primary" v-print="printObj" size="large"
@@ -93,7 +69,8 @@ import { computed, nextTick, ref } from "vue";
 import byTable from "@/components/byTable/index";
 import byForm from "@/components/byForm/index";
 import { ElMessage } from "element-plus";
-import JsBarcode from "jsbarcode";
+// import JsBarcode from "jsbarcode";
+import ProductionPDF from "@/components/PDF/productionPDF.vue";
 
 const { proxy } = getCurrentInstance();
 const warehouseList = ref([]);
@@ -275,19 +252,17 @@ const config = computed(() => {
                 },
               }
             : {},
-          row.businessType == 2
-            ? {
-                attrs: {
-                  label: "打印",
-                  type: "primary",
-                  text: true,
-                },
-                el: "button",
-                click() {
-                  handlePrint(row);
-                },
-              }
-            : {},
+          {
+            attrs: {
+              label: "打印",
+              type: "primary",
+              text: true,
+            },
+            el: "button",
+            click() {
+              handlePrint(row);
+            },
+          },
         ];
       },
     },
@@ -486,25 +461,9 @@ const onPreviewFile = (file) => {
 };
 
 const printDialog = ref(false);
-const printData = ref({});
+const rowData = ref({});
 const handlePrint = (row) => {
   printDialog.value = true;
-  let barCode = row.productSn;
-  printData.value = {
-    customerName: row.customerName,
-    productName: row.productName + `(${row.productSpec})`,
-  };
-  nextTick(() => {
-    JsBarcode("#barCode", barCode, {
-      format: "CODE128", //选择要使用的条形码类型
-      text: barCode, //显示文本
-      displayValue: true, //是否在条形码下方显示文字
-      textPosition: "bottom", //设置文本的垂直位置
-      // background: "#eee", //设置条形码的背景
-      font: "fantasy", //设置文本的字体
-      margin: 15, //设置条形码周围的空白边距
-    });
-  });
 };
 const printObj = ref({
   id: "pdfDom",