瀏覽代碼

新需求

cz 1 年之前
父節點
當前提交
68b294e2ca

+ 103 - 37
src/views/JXSK/afterSales/add.vue

@@ -8,7 +8,7 @@
       @click-right="onClickRight"
     >
       <template #right>
-        <div v-show="isShowVideo">{{$t('afterSales.closeTheCamera')}}</div>
+        <div v-show="isShowVideo">{{ $t("afterSales.closeTheCamera") }}</div>
       </template>
     </van-nav-bar>
     <testForm
@@ -30,7 +30,7 @@
 </template>
 
 <script setup>
-import { ref, reactive, getCurrentInstance, onMounted } from "vue";
+import { ref, reactive, getCurrentInstance, onMounted, nextTick } from "vue";
 import { showSuccessToast, showFailToast } from "vant";
 import { useRoute } from "vue-router";
 import testForm from "@/components/testForm/index.vue";
@@ -46,9 +46,24 @@ const formData = reactive({
   data: {},
 });
 const rules = {
-  productSn: [{ required: true, message: proxy.t('afterSales.pleaseEnterTheEquipmentSN') }],
-  afterSalesPersonId: [{ required: true, message: proxy.t('afterSales.pleaseSelectAfterSalesPersonnel') }],
-  remark: [{ required: true, message: proxy.t('afterSales.pleaseEnterTheAfterSalesReason') }],
+  productSn: [
+    {
+      required: true,
+      message: proxy.t("afterSales.pleaseEnterTheEquipmentSN"),
+    },
+  ],
+  afterSalesPersonId: [
+    {
+      required: true,
+      message: proxy.t("afterSales.pleaseSelectAfterSalesPersonnel"),
+    },
+  ],
+  remark: [
+    {
+      required: true,
+      message: proxy.t("afterSales.pleaseEnterTheAfterSalesReason"),
+    },
+  ],
 };
 const formOption = reactive({
   readonly: false, //用于控制整个表单是否只读
@@ -61,11 +76,11 @@ const formOption = reactive({
 const formConfig = reactive([
   {
     type: "input",
-    label: proxy.t('afterSales.equipmentSN'),
+    label: "产品Sn",
     prop: "productSn",
     isNeedBlurMethon: true,
     blurMethon: (val) => {
-      showScanData(val);
+      // showScanData(val);
     },
     isNeedRightBtn: true,
     rightIcon: "scan",
@@ -73,21 +88,34 @@ const formConfig = reactive([
       handleScanCode();
     },
   },
+
   {
     type: "input",
-    label: proxy.t('afterSales.contractCode'),
-    prop: "code",
+    label: proxy.t("afterSales.productName"),
+    prop: "productName",
     readonly: true,
   },
   {
     type: "input",
-    label: proxy.t('afterSales.productName'),
-    prop: "productName",
+    label: "规格型号",
+    prop: "productSpec",
+    readonly: true,
+  },
+  {
+    type: "input",
+    label: "客户名称",
+    prop: "productSpec",
+    readonly: true,
+  },
+  {
+    type: "input",
+    label: proxy.t("afterSales.contractCode"),
+    prop: "code",
     readonly: true,
   },
   {
     type: "picker",
-    label: proxy.t('afterSales.afterSalesPersonnel'),
+    label: "售后类型",
     prop: "afterSalesPersonId",
     itemType: "onePicker",
     showPicker: false,
@@ -100,9 +128,33 @@ const formConfig = reactive([
   {
     type: "input",
     itemType: "textarea",
-    label: proxy.t('afterSales.afterSalesReason'),
+    label: "售后说明",
     prop: "remark",
   },
+  {
+    type: "input",
+    label: "客户联系人",
+    prop: "productSpec",
+    readonly: true,
+  },
+  {
+    type: "input",
+    label: "客户联系方式",
+    prop: "productSpec",
+    readonly: true,
+  },
+  {
+    type: "picker",
+    label: proxy.t("afterSales.afterSalesPersonnel"),
+    prop: "afterSalesPersonId",
+    itemType: "onePicker",
+    showPicker: false,
+    fieldNames: {
+      text: "label",
+      value: "value",
+    },
+    data: [],
+  },
 ]);
 const onClickLeft = () => history.back();
 
@@ -129,6 +181,15 @@ const getDetails = (id) => {
 };
 
 onMounted(() => {
+  nextTick(() => {
+    window.getVueMessage = (data) => {
+      if (data) {
+        // showSuccessToast(data);
+        formData.data.productSn = data;
+      }
+    };
+  });
+
   formData.data.afterSalesPersonId = getUserInfo().userId;
   getDict();
   if (route.query.id) {
@@ -139,7 +200,7 @@ onMounted(() => {
 const onSubmit = () => {
   proxy.post("/afterSalesRecord/add", formData.data).then(
     () => {
-      showSuccessToast(proxy.t('afterSales.operationSuccessful'));
+      showSuccessToast(proxy.t("afterSales.operationSuccessful"));
       setTimeout(() => {
         onClickLeft();
       }, 500);
@@ -169,7 +230,7 @@ const decodeFromInputVideoFunc = (firstDeviceId) => {
     (result, err) => {
       if (result) {
         codeReader.reset();
-        showSuccessToast(proxy.t('afterSales.scanSuccess'));
+        showSuccessToast(proxy.t("afterSales.scanSuccess"));
         isShowVideo.value = false;
         showScanData(result.text);
       }
@@ -182,28 +243,33 @@ const decodeFromInputVideoFunc = (firstDeviceId) => {
 };
 
 const handleScanCode = () => {
-  codeReader
-    .getVideoInputDevices()
-    .then((videoInputDevices) => {
-      // 默认获取第一个摄像头设备id
-      let firstDeviceId = videoInputDevices[0].deviceId;
-      // 获取第一个摄像头设备的名称
-      const videoInputDeviceslablestr = JSON.stringify(
-        videoInputDevices[0].label
-      );
-      if (videoInputDevices.length > 1) {
-        // 判断是否后置摄像头
-        if (videoInputDeviceslablestr.indexOf("back") > -1) {
-          firstDeviceId = videoInputDevices[0].deviceId;
-        } else {
-          firstDeviceId = videoInputDevices[1].deviceId;
-        }
-      }
-      decodeFromInputVideoFunc(firstDeviceId);
-    })
-    .catch((err) => {
-      console.error(err, proxy.t('afterSales.error'));
-    });
+  // codeReader
+  //   .getVideoInputDevices()
+  //   .then((videoInputDevices) => {
+  //     // 默认获取第一个摄像头设备id
+  //     let firstDeviceId = videoInputDevices[0].deviceId;
+  //     // 获取第一个摄像头设备的名称
+  //     const videoInputDeviceslablestr = JSON.stringify(
+  //       videoInputDevices[0].label
+  //     );
+  //     if (videoInputDevices.length > 1) {
+  //       // 判断是否后置摄像头
+  //       if (videoInputDeviceslablestr.indexOf("back") > -1) {
+  //         firstDeviceId = videoInputDevices[0].deviceId;
+  //       } else {
+  //         firstDeviceId = videoInputDevices[1].deviceId;
+  //       }
+  //     }
+  //     decodeFromInputVideoFunc(firstDeviceId);
+  //   })
+  //   .catch((err) => {
+  //     console.error(err, proxy.t('afterSales.error'));
+  //   });
+  uni.postMessage({
+    data: {
+      type: "scanCode",
+    },
+  });
 };
 
 const onClickRight = () => {

+ 173 - 2
src/views/JXSK/mes/forward/add.vue

@@ -19,6 +19,62 @@
       <!-- <template #file>
         <div>aa</div>
       </template> -->
+      <template #fileOne>
+        <div
+          style="width: 100%"
+          v-if="
+            formData.data.fileListOne && formData.data.fileListOne.length > 0
+          "
+        >
+          <span
+            v-for="item in formData.data.fileListOne"
+            :key="item.id"
+            @click="onPreviewFile(item)"
+            style="margin-right: 10px; cursor: pointer; color: #409eff"
+          >
+            {{ item.name }}
+          </span>
+        </div>
+        <div style="width: 100%" v-else>无</div>
+      </template>
+
+      <template #fileTwo>
+        <div
+          style="width: 100%"
+          v-if="
+            formData.data.fileListTwo && formData.data.fileListTwo.length > 0
+          "
+        >
+          <span
+            v-for="item in formData.data.fileListTwo"
+            :key="item.id"
+            @click="onPreviewFile(item)"
+            style="margin-right: 10px; cursor: pointer; color: #409eff"
+          >
+            {{ item.name }}
+          </span>
+        </div>
+        <div v-else>无</div>
+      </template>
+      <template #fileThree>
+        <div
+          style="width: 100%"
+          v-if="
+            formData.data.fileListThree &&
+            formData.data.fileListThree.length > 0
+          "
+        >
+          <span
+            v-for="item in formData.data.fileListThree"
+            :key="item.id"
+            @click="onPreviewFile(item)"
+            style="margin-right: 10px; cursor: pointer; color: #409eff"
+          >
+            {{ item.name }}
+          </span>
+        </div>
+        <div v-else>无</div>
+      </template>
     </testForm>
   </div>
 </template>
@@ -136,9 +192,67 @@ const otherBtnClick = () => {
 };
 
 const getDetails = () => {
-  proxy.post("/productionTask/detail", { id: route.query.id }).then(
+  proxy.post("/productionTaskDetail/detail", { id: route.query.id }).then(
     (res) => {
-      console.log(res, "ada");
+      if (res.data && res.data.productionTaskDetailRecordList.length > 0) {
+        let id = res.data.previousProcessesRecordId;
+        proxy
+          .post("/fileInfo/getList", { businessIdList: [id] })
+          .then((res) => {
+            if (res.data && res.data[id].length > 0) {
+              formData.data.fileListOne = res.data[id].map((item) => {
+                return {
+                  raw: item,
+                  name: item.fileName,
+                  url: item.fileUrl,
+                };
+              });
+            }
+          });
+      }
+
+      proxy
+        .post("/fileInfo/getList", {
+          businessIdList: [res.data.productionProcessesId],
+        })
+        .then((resOne) => {
+          if (
+            resOne.data[res.data.productionProcessesId] &&
+            resOne.data[res.data.productionProcessesId].length > 0
+          ) {
+            formData.data.fileListTwo = resOne.data[
+              res.data.productionProcessesId
+            ].map((item) => {
+              return {
+                raw: item,
+                name: item.fileName,
+                url: item.fileUrl,
+              };
+            });
+          }
+        });
+
+      proxy
+        .post("/fileInfo/getList", {
+          businessIdList: [res.data.workOrderId],
+          fileType: 1,
+        })
+        .then((resOne) => {
+          if (
+            resOne.data[res.data.workOrderId] &&
+            resOne.data[res.data.workOrderId].length > 0
+          ) {
+            formData.data.fileListThree = resOne.data[res.data.workOrderId].map(
+              (item) => {
+                return {
+                  raw: item,
+                  name: item.fileName,
+                  url: item.fileUrl,
+                };
+              }
+            );
+          }
+        });
     },
     (err) => {
       return showFailToast(err.message);
@@ -157,6 +271,13 @@ const configData = [
     {
       type: "input",
       itemType: "text",
+      label: "规格型号",
+      prop: "productSpec",
+      readonly: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
       label: proxy.t("forward.productSN"),
       prop: "productSn",
       readonly: true,
@@ -175,6 +296,22 @@ const configData = [
       prop: "productionProcessesName",
       readonly: true,
     },
+
+    {
+      type: "slot",
+      slotName: "fileOne",
+      label: "上一个工序图纸",
+    },
+    {
+      type: "slot",
+      label: "工序附件",
+      slotName: "fileTwo",
+    },
+    {
+      type: "slot",
+      label: "工单附件",
+      slotName: "fileThree",
+    },
     {
       type: "upload",
       label: proxy.t("forward.processDrawing"),
@@ -215,6 +352,13 @@ const configData = [
     {
       type: "input",
       itemType: "text",
+      label: "规格型号",
+      prop: "productSpec",
+      readonly: true,
+    },
+    {
+      type: "input",
+      itemType: "text",
       label: proxy.t("forward.productSN"),
       prop: "productSn",
       readonly: true,
@@ -233,6 +377,22 @@ const configData = [
       prop: "productionProcessesName",
       readonly: true,
     },
+
+    {
+      type: "slot",
+      slotName: "fileOne",
+      label: "上一个工序图纸",
+    },
+    {
+      type: "slot",
+      label: "工序附件",
+      slotName: "fileTwo",
+    },
+    {
+      type: "slot",
+      label: "工单附件",
+      slotName: "fileThree",
+    },
     {
       type: "upload",
       label: proxy.t("forward.processDrawing"),
@@ -249,8 +409,19 @@ onMounted(() => {
     formConfig.value = configData[1];
     formOption.submitBtnText = proxy.t("forward.submitStorage");
   }
+  getDetails();
   formData.data = { ...route.query };
 });
+
+const onPreviewFile = (item) => {
+  uni.postMessage({
+    data: {
+      type: "file",
+      url: item.url,
+      name: item.name,
+    },
+  });
+};
 </script>
 <style lang="scss" scoped>
 .row {

+ 4 - 1
src/views/JXSK/mes/forward/index.vue

@@ -66,7 +66,10 @@ const listConfig = ref([
     label: proxy.t("forward.productName"),
     prop: "productName",
   },
-
+  {
+    label: "规格型号",
+    prop: "productSpec",
+  },
   {
     label: proxy.t("forward.productSN"),
     prop: "productSn",

+ 109 - 2
src/views/JXSK/mes/receive/add.vue

@@ -16,6 +16,43 @@
       @otherBtnClick="otherBtnClick"
       ref="formDom"
     >
+      <template #fileTwo>
+        <div
+          style="width: 100%"
+          v-if="
+            formData.data.fileListTwo && formData.data.fileListTwo.length > 0
+          "
+        >
+          <span
+            v-for="item in formData.data.fileListTwo"
+            :key="item.id"
+            @click="onPreviewFile(item)"
+            style="margin-right: 10px; cursor: pointer; color: #409eff"
+          >
+            {{ item.name }}
+          </span>
+        </div>
+        <div v-else>无</div>
+      </template>
+      <template #fileThree>
+        <div
+          style="width: 100%"
+          v-if="
+            formData.data.fileListThree &&
+            formData.data.fileListThree.length > 0
+          "
+        >
+          <span
+            v-for="item in formData.data.fileListThree"
+            :key="item.id"
+            @click="onPreviewFile(item)"
+            style="margin-right: 10px; cursor: pointer; color: #409eff"
+          >
+            {{ item.name }}
+          </span>
+        </div>
+        <div v-else>无</div>
+      </template>
     </testForm>
   </div>
 </template>
@@ -55,7 +92,7 @@ const formOption = reactive({
   scroll: true,
   labelWidth: "62pk",
   submitBtnText: proxy.t("receive.confirmReceipt"),
-  otherBtn: true,
+  otherBtn: false,
   otherBtnText: "退回前道工序",
   btnConfig: {
     isNeed: false,
@@ -77,6 +114,13 @@ const formConfig = reactive([
   {
     type: "input",
     itemType: "text",
+    label: "规格型号",
+    prop: "productSpec",
+    readonly: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
     label: proxy.t("receive.productSN"),
     prop: "productSn",
     readonly: true,
@@ -102,6 +146,16 @@ const formConfig = reactive([
     showUpload: false,
   },
   {
+    type: "slot",
+    label: "工序附件",
+    slotName: "fileTwo",
+  },
+  {
+    type: "slot",
+    label: "工单附件",
+    slotName: "fileThree",
+  },
+  {
     type: "input",
     itemType: "text",
     label: proxy.t("receive.previousProcess"),
@@ -179,7 +233,7 @@ const getDetails = () => {
   proxy.post("/productionTaskDetail/detail", { id: route.query.id }).then(
     (res) => {
       if (res.data && res.data.productionTaskDetailRecordList.length > 0) {
-        let id = res.data.productionTaskDetailRecordList[0].id;
+        let id = res.data.previousProcessesRecordId;
         proxy
           .post("/fileInfo/getList", { businessIdList: [id] })
           .then((res) => {
@@ -194,6 +248,49 @@ const getDetails = () => {
             }
           });
       }
+
+      proxy
+        .post("/fileInfo/getList", {
+          businessIdList: [res.data.productionProcessesId],
+        })
+        .then((resOne) => {
+          if (
+            resOne.data[res.data.productionProcessesId] &&
+            resOne.data[res.data.productionProcessesId].length > 0
+          ) {
+            formData.data.fileListTwo = resOne.data[
+              res.data.productionProcessesId
+            ].map((item) => {
+              return {
+                raw: item,
+                name: item.fileName,
+                url: item.fileUrl,
+              };
+            });
+          }
+        });
+
+      proxy
+        .post("/fileInfo/getList", {
+          businessIdList: [res.data.workOrderId],
+          fileType: 1,
+        })
+        .then((resOne) => {
+          if (
+            resOne.data[res.data.workOrderId] &&
+            resOne.data[res.data.workOrderId].length > 0
+          ) {
+            formData.data.fileListThree = resOne.data[res.data.workOrderId].map(
+              (item) => {
+                return {
+                  raw: item,
+                  name: item.fileName,
+                  url: item.fileUrl,
+                };
+              }
+            );
+          }
+        });
     },
     (err) => {
       return showFailToast(err.message);
@@ -212,6 +309,16 @@ onMounted(() => {
     }
   }
 });
+
+const onPreviewFile = (item) => {
+  uni.postMessage({
+    data: {
+      type: "file",
+      url: item.url,
+      name: item.name,
+    },
+  });
+};
 </script>
 <style lang="scss" scoped>
 .row {

+ 4 - 1
src/views/JXSK/mes/receive/index.vue

@@ -51,7 +51,10 @@ const listConfig = ref([
     label: proxy.t("receive.productName"),
     prop: "productName",
   },
-
+  {
+    label: "规格型号",
+    prop: "productSpec",
+  },
   {
     label: proxy.t("receive.productSN"),
     prop: "productSn",

+ 9 - 0
src/views/JXSK/mes/task/add.vue

@@ -162,6 +162,8 @@ const formConfig = reactive([
           option.selectedOptions[0].label;
         formData.data.productionPlanId = option.selectedOptions[0].value;
         formData.data.productName = option.selectedOptions[0].productName;
+        formData.data.productSpec = option.selectedOptions[0].productSpec;
+
         formData.data.waitQuantity =
           option.selectedOptions[0].remainingQuantity;
         formData.data.startDate = option.selectedOptions[0].startDate;
@@ -191,6 +193,13 @@ const formConfig = reactive([
   },
   {
     type: "input",
+    itemType: "text",
+    label: "规格型号",
+    prop: "productSpec",
+    readonly: true,
+  },
+  {
+    type: "input",
     itemType: "number",
     label: proxy.t("task.scheduledQuantity"),
     prop: "waitQuantity",

+ 4 - 1
src/views/JXSK/mes/task/index.vue

@@ -56,7 +56,10 @@ const listConfig = ref([
     label: proxy.t("task.productName"),
     prop: "productName",
   },
-
+  {
+    label: "规格型号",
+    prop: "productSpec",
+  },
   {
     label: proxy.t("task.taskQuantity"),
     prop: "quantity",

+ 1 - 0
src/views/MES/produce/plan/add.vue

@@ -46,6 +46,7 @@
           readonly
           :label="$t('plan.productName')"
         />
+        <van-field v-model="formData.productSpec" readonly label="规格型号" />
         <van-field
           v-model="formData.waitQuantity"
           readonly

+ 4 - 1
src/views/MES/produce/plan/index.vue

@@ -59,7 +59,10 @@ const listConfig = ref([
     label: proxy.t("plan.productName"),
     prop: "productName",
   },
-
+  {
+    label: "规格型号",
+    prop: "productSpec",
+  },
   {
     label: proxy.t("plan.planQuantity"),
     prop: "quantity",