From 55853d1a56d123b798bb30b53cb0dfefbeacb1a2 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期四, 19 三月 2026 14:57:07 +0800
Subject: [PATCH] 报工详情

---
 src/views/productionManagement/workOrder/components/ProductionRecordForm.vue |  146 ++++++++++++++++++++++++++++++++++++
 src/views/productionManagement/productionReporting/components/Detail.vue     |   19 ++++
 src/views/productionManagement/workOrder/index.vue                           |   29 ++++++
 3 files changed, 191 insertions(+), 3 deletions(-)

diff --git a/src/views/productionManagement/productionReporting/components/Detail.vue b/src/views/productionManagement/productionReporting/components/Detail.vue
index a4aec9a..8820727 100644
--- a/src/views/productionManagement/productionReporting/components/Detail.vue
+++ b/src/views/productionManagement/productionReporting/components/Detail.vue
@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import {computed} from "vue";
+import {computed, onMounted} from "vue";
 
 defineOptions({
   name: "ReportingDetail"
@@ -23,6 +23,17 @@
   set: (value: boolean) => emits("update:isShow", value),
 });
 
+const otherData = ref([])
+const init = () => {
+  if (props.row.otherData !== null && props.row.otherData !== '') {
+    otherData.value = JSON.parse(props.row.otherData);
+  }
+};
+
+onMounted(() => {
+  init();
+})
+
 </script>
 
 <template>
@@ -40,6 +51,12 @@
       <el-descriptions-item label="鎶ュ簾鏁伴噺">{{ row.quantity || '-' }}</el-descriptions-item>
       <el-descriptions-item label="鍗曚綅">{{ row.scrapQty || '-' }}</el-descriptions-item>
       <el-descriptions-item label="鍒涘缓鏃堕棿">{{ row.createTime || '-' }}</el-descriptions-item>
+      <el-descriptions-item
+          v-for="item in otherData"
+          :label="`${item.parameterItem}`"
+      >
+        {{ item.value || '-' }}
+      </el-descriptions-item>
     </el-descriptions>
     <template #footer>
         <span class="dialog-footer">
diff --git a/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
new file mode 100644
index 0000000..9b2938e
--- /dev/null
+++ b/src/views/productionManagement/workOrder/components/ProductionRecordForm.vue
@@ -0,0 +1,146 @@
+<script setup lang="ts">
+import {computed, reactive, ref, watch} from "vue";
+import {getDeviceLedger} from "@/api/equipmentManagement/ledger";
+
+defineOptions({
+  name: "ProductionRecordForm"
+});
+
+const props = defineProps({
+  list: {
+    type: Array,
+    default() {
+      return [];
+    }
+  }
+});
+
+const formRef = ref();
+const formData = reactive({
+  list: [] as any[],
+});
+
+const fieldLabel = (item: any) => {
+  if (!item.unit || item.unit === "/") {
+    return item.parameterItem;
+  }
+  return `${item.parameterItem}锛�${item.unit}锛塦;
+};
+
+const getType = (item: any) => item.type || "鏂囨湰鏍煎紡";
+
+const rules = computed(() => {
+  const result: Record<string, any[]> = {};
+  formData.list.forEach((item, index) => {
+    if (String(item.isRequired) === "1") {
+      result[`list.${index}.value`] = [{required: true, message: `璇疯緭鍏�${item.parameterItem}`, trigger: "blur"}];
+    }
+  });
+  return result;
+});
+
+const deviceOptions = ref([]);
+const loadDeviceName = async () => {
+  const {data} = await getDeviceLedger();
+  deviceOptions.value = data;
+};
+
+const initData = () => {
+  formData.list = props.list || [];
+  formData.list.forEach(item => {
+    if (item.value === undefined) {
+      item.value = null;
+    }
+  });
+  loadDeviceName()
+};
+
+const submitData = async () => {
+  const valid = await formRef.value.validate().catch(() => false)
+
+  if (valid) {
+    return formData.list
+  } else {
+    return null
+  }
+}
+
+watch(
+    () => props.list,
+    () => {
+      initData();
+    },
+    {immediate: true, deep: true}
+);
+
+defineExpose({
+  submitData
+})
+</script>
+
+<template>
+  <el-form ref="formRef" :model="formData" :rules="rules" label-width="120px">
+    <el-form-item
+        v-for="(item, index) in formData.list"
+        :key="item.id"
+        :label="fieldLabel(item)"
+        :prop="`list.${index}.value`"
+    >
+      <el-input-number
+          v-if="getType(item) === '鏁板�兼牸寮�'"
+          v-model="item.value"
+          :controls="false"
+          style="width: 100%"
+          placeholder="璇疯緭鍏�"
+      />
+      <el-date-picker
+          v-else-if="getType(item) === '鏃堕棿鏍煎紡'"
+          v-model="item.value"
+          type="datetime"
+          value-format="YYYY-MM-DD HH:mm:ss"
+          format="YYYY-MM-DD HH:mm:ss"
+          placeholder="璇烽�夋嫨"
+          style="width: 100%"
+      />
+      <el-date-picker
+          v-else-if="getType(item) === '鏃ユ湡鏍煎紡'"
+          v-model="item.value"
+          type="date"
+          value-format="YYYY-MM-DD"
+          format="YYYY-MM-DD"
+          placeholder="璇烽�夋嫨"
+          style="width: 100%"
+      />
+      <el-select
+          v-else-if="getType(item) === '鏄�/鍚﹂�夋'"
+          v-model="item.value"
+          placeholder="璇烽�夋嫨"
+          clearable
+          style="width: 100%"
+      >
+        <el-option label="鏄�" value="鏄�"/>
+        <el-option label="鍚�" value="鍚�"/>
+      </el-select>
+      <el-select
+          v-else-if="getType(item) === '鏈哄彴閫夋嫨'"
+          v-model="item.value"
+          placeholder="璇烽�夋嫨"
+          clearable
+          style="width: 100%"
+      >
+        <el-option
+            v-for="(item, index) in deviceOptions"
+            :key="index"
+            :label="item.deviceName"
+            :value="item.deviceName"
+        ></el-option>
+      </el-select>
+      <el-input
+          v-else
+          v-model="item.value"
+          placeholder="璇疯緭鍏�"
+          clearable
+      />
+    </el-form-item>
+  </el-form>
+</template>
\ No newline at end of file
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index da42a3f..9a5aadd 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -211,6 +211,7 @@
                        :value="user.userId"/>
           </el-select>
         </el-form-item>
+        <ProductionRecordForm ref="productionRecordFormRef" :list="processParamList"/>
       </el-form>
       <template #footer>
         <span class="dialog-footer">
@@ -250,12 +251,16 @@
 import QRCode from "qrcode";
 import {getCurrentInstance, reactive, toRefs} from "vue";
 import FilesDia from "./components/filesDia.vue";
+import {
+  listPage as listProcessParamPage,
+} from "@/api/productionManagement/productProcessParameter.js";
 
 const {proxy} = getCurrentInstance();
 const {priority_type} = proxy.useDict("priority_type");
 
 const CopperPrintingForm = defineAsyncComponent(() => import("./components/CopperPrintingForm.vue"));
 const VoltageSortingForm = defineAsyncComponent(() => import("./components/VoltageSortingForm.vue"));
+const ProductionRecordForm = defineAsyncComponent(() => import("./components/ProductionRecordForm.vue"));
 const tableColumn = ref([
   {
     label: "浼樺厛绾�",
@@ -401,7 +406,9 @@
   productProcessRouteItemId: "",
   userId: "",
   productMainId: null,
+  otherData: {}
 });
+const productionRecordFormRef = ref();
 
 // 鏈鐢熶骇鏁伴噺楠岃瘉瑙勫垯
 const validateQuantity = (rule, value, callback) => {
@@ -631,7 +638,22 @@
       });
 };
 
-const showReportDialog = row => {
+const processParamPage = reactive({
+  current: 1,
+  size: 9999,
+  total: 0,
+});
+const getProcessParamList = async (row) => {
+  const params = {
+    processId: row.processId,
+    ...processParamPage,
+  };
+  const res = await listProcessParamPage(params)
+  return res.data.records
+};
+
+const processParamList = ref([])
+const showReportDialog = async row => {
   currentReportRowData.value = row;
   if (row.processName === '鍗伴摐' || row.processName === '鍗伴摱') {
     copperPrintingFormVisible.value = true
@@ -641,6 +663,7 @@
     voltageSortingFormVisible.value = true
     return;
   }
+  processParamList.value = await getProcessParamList(row)
   reportForm.planQuantity = row.planQuantity;
   reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
   reportForm.productProcessRouteItemId = row.productProcessRouteItemId;
@@ -670,7 +693,9 @@
   workOrderFilesRef.value?.openDialog(row);
 };
 
-const handleReport = () => {
+const handleReport = async () => {
+  const data = await productionRecordFormRef.value.submitData()
+  reportForm.otherData = JSON.stringify(data || {});
   reportFormRef.value?.validate((valid) => {
     if (!valid) {
       return false;

--
Gitblit v1.9.3