From 7ff48284cc634e02abed3a545630e9d680bbf19f Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 18 三月 2026 16:04:37 +0800
Subject: [PATCH] 电压分选报工

---
 src/views/productionManagement/workOrder/components/VoltageSortingForm.vue |  341 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/views/productionManagement/productionReporting/index.vue               |   28 ++-
 src/views/productionManagement/productionReporting/components/Detail.vue   |    1 
 src/views/productionManagement/workOrder/index.vue                         |   12 +
 4 files changed, 369 insertions(+), 13 deletions(-)

diff --git a/src/views/productionManagement/productionReporting/components/Detail.vue b/src/views/productionManagement/productionReporting/components/Detail.vue
index 5983d1c..a4aec9a 100644
--- a/src/views/productionManagement/productionReporting/components/Detail.vue
+++ b/src/views/productionManagement/productionReporting/components/Detail.vue
@@ -16,6 +16,7 @@
   }
 });
 
+const emits = defineEmits(["update:isShow"]);
 
 const visible = computed({
   get: () => props.isShow,
diff --git a/src/views/productionManagement/productionReporting/index.vue b/src/views/productionManagement/productionReporting/index.vue
index 0904dee..e802f24 100644
--- a/src/views/productionManagement/productionReporting/index.vue
+++ b/src/views/productionManagement/productionReporting/index.vue
@@ -46,21 +46,9 @@
                 :total="page.total">
         <template #productNoSlot="{ row }">
           <el-button
-              v-if="row.process ==='鍗伴摐' || row.process ==='鍗伴摱'"
               type="primary"
               link
               @click="openDetail(row)"
-          >
-            {{ row.productNo }}
-          </el-button>
-          <el-button
-              v-else
-              type="primary"
-              link
-              @click="(row) => {
-                currentReportRowData = row
-                showDetail = true
-              }"
           >
             {{ row.productNo }}
           </el-button>
@@ -154,6 +142,12 @@
         :isEdit="false"
         :row="currentReportRowData"
         @refreshData="getList"/>
+    <VoltageSortingForm
+        v-if="voltageSortingFormVisible"
+        v-model:isShow="voltageSortingFormVisible"
+        :isEdit="false"
+        :row="currentReportRowData"
+        @refreshData="getList"/>
     <Detail
         v-if="showDetail"
         v-model:isShow="showDetail"
@@ -173,6 +167,7 @@
 import {productionProductMainListPage} from "@/api/productionManagement/productionProductMain.js";
 import {userListNoPageByTenantId} from "@/api/system/user.js";
 import InputModal from "@/views/productionManagement/productionReporting/Input.vue";
+import VoltageSortingForm from "@/views/productionManagement/workOrder/components/VoltageSortingForm.vue";
 
 const CopperPrintingForm = defineAsyncComponent(() => import("@/views/productionManagement/workOrder/components/CopperPrintingForm.vue"));
 const Detail = defineAsyncComponent(() => import("@/views/productionManagement/productionReporting/components/Detail.vue"));
@@ -434,6 +429,7 @@
 // 鎵撳紑鎶曞叆妯℃�佹
 const isShowInput = ref(false);
 const copperPrintingFormVisible = ref(false);
+const voltageSortingFormVisible = ref(false);
 const showDetail = ref(false);
 const isShowingId = ref(0);
 const showInput = row => {
@@ -457,7 +453,13 @@
 };
 const openDetail = row => {
   currentReportRowData.value = row;
-  copperPrintingFormVisible.value = true;
+  if (row.process ==='鍗伴摐' || row.process ==='鍗伴摱') {
+    copperPrintingFormVisible.value = true;
+  } else if (row.process === '鐢靛帇鍒嗛��') {
+    voltageSortingFormVisible.value = true;
+  } else {
+    showDetail.value = true;
+  }
 };
 onMounted(() => {
   getList();
diff --git a/src/views/productionManagement/workOrder/components/VoltageSortingForm.vue b/src/views/productionManagement/workOrder/components/VoltageSortingForm.vue
new file mode 100644
index 0000000..3d2c927
--- /dev/null
+++ b/src/views/productionManagement/workOrder/components/VoltageSortingForm.vue
@@ -0,0 +1,341 @@
+<script setup lang="ts">
+import {computed, onMounted, reactive, ref} from "vue";
+import dayjs from "dayjs";
+import {userListNoPageByTenantId} from "@/api/system/user.js";
+import {ElMessage} from "element-plus";
+import {addProductMain} from "@/api/productionManagement/workOrder.js";
+
+defineOptions({
+  name: "VoltageSortingForm"
+});
+
+const props = defineProps({
+  isShow: {
+    type: Boolean,
+    required: true
+  },
+  isEdit: {
+    type: Boolean,
+    default: false
+  },
+  row: {
+    type: Object,
+    default: () => ({}),
+  }
+});
+
+const emits = defineEmits(["update:isShow", "refreshData"]);
+
+const visible = computed({
+  get: () => props.isShow,
+  set: (value: boolean) => emits("update:isShow", value),
+});
+
+const formData = reactive({
+  productProcessRouteItemId: undefined,
+  workOrderId: undefined,
+  planQuantity: undefined,
+  reportWork: undefined,
+  productMainId: undefined,
+  quantity: undefined, // 浜у嚭鏁伴噺
+  userId: undefined, // 浣滀笟鍛�
+  userName: undefined, // 浣滀笟鍛�
+  scrapQty: undefined, // 涓嶈壇鏁伴噺
+  otherData: {
+    engineException: undefined,// 鏈夋棤宸ョ▼寮傚父
+    specificIssue: undefined,// 鍏蜂綋涓嶈壇
+    dryingTemperature: '', // 鐑樺共娓╁害
+    scrapingDate: dayjs().format('YYYY-MM-DD HH:mm:ss'), // 鍒噺鏃ユ湡
+    machineNumber: undefined, // 鏈哄彴鍙�
+    receiveQuantity: undefined, // 鎺ユ敹鏁伴噺
+    voltageSpecs: [], // 鐢靛帇瑙勬牸,
+    voltage: [], // 鐢靛帇
+    quantity: [], // 鏁伴噺
+    comprehensiveHit: undefined, // 缁煎悎鍛戒腑鏈�
+    userId: undefined, // 浣滀笟鍛�
+    userName: undefined, // 浣滀笟鍛�
+    exceptionDealResult: undefined, // 寮傚父澶勭悊缁撴灉
+  }
+})
+
+const userOptions = ref([]);
+const getUserList = () => {
+  userListNoPageByTenantId()
+      .then(res => {
+        if (res.code === 200) {
+          userOptions.value = res.data || [];
+        }
+      })
+      .catch(err => {
+        console.error("鑾峰彇鐢ㄦ埛鍒楄〃澶辫触", err);
+      });
+};
+// 鐢ㄦ埛閫夋嫨鍙樺寲鏃舵洿鏂� userName
+const handleUserChange = (value) => {
+  if (value) {
+    formData.userName = userOptions.value.find(user => user.userId === value).userName;
+  }
+};
+const handleReport = () => {
+  if (!formData.userId) {
+    ElMessage.error('璇烽�夋嫨浣滀笟鍛�')
+    return;
+  }
+  if (!formData.quantity || formData.quantity <= 0) {
+    ElMessage.error('璇疯緭鍏ヤ骇鍑烘暟閲�')
+    return;
+  }
+
+  const otherData = JSON.stringify(formData.otherData);
+  const submitData = {
+    ...formData,
+    otherData: otherData
+  };
+
+  addProductMain(submitData).then(res => {
+    if (res.code === 200) {
+      ElMessage({
+        message: '鎶ュ伐鎴愬姛',
+        type: 'success',
+      })
+      emits("refreshData")
+      visible.value = false;
+    } else {
+      ElMessage.error('鎶ュ伐澶辫触')
+    }
+  });
+};
+
+const initData = () => {
+  if (!props.isEdit) {
+    formData.otherData = JSON.parse(props.row.otherData || '{}');
+    formData.quantity = props.row.quantity;
+  } else {
+    const row = props.row;
+    formData.planQuantity = row.planQuantity
+    formData.productProcessRouteItemId = row.productProcessRouteItemId
+    formData.workOrderId = row.id
+    formData.reportWork = row.reportWork
+    formData.productMainId = row.productMainId
+  }
+}
+
+const displayValue = (value: any) => {
+  return value === undefined || value === null || value === "" ? "-" : value;
+};
+
+onMounted(() => {
+  getUserList();
+  initData()
+})
+</script>
+
+<template>
+  <el-dialog v-model="visible"
+             :title="isEdit? '鐢靛帇鍒嗛�夋姤宸�' : '璇︽儏'"
+             width="90%">
+    <el-form :model="formData">
+      <table class="report-table">
+        <tbody>
+        <tr>
+          <td class="tip" colspan="12">鐢靛帇鍒嗛�夋儏鍐�</td>
+          <td class="label" colspan="2">鍒噺鏃ユ湡</td>
+          <td colspan="2">
+            <el-date-picker
+                v-if="props.isEdit"
+                v-model="formData.otherData.scrapingDate"
+                type="datetime"
+                value-format="YYYY-MM-DD HH:mm:ss"
+                format="YYYY-MM-DD HH:mm:ss"
+                placeholder="璇烽�夋嫨"
+                style="width: 100%"
+            />
+            <span v-else class="view-value">{{ displayValue(formData.otherData.scrapingDate) }}</span>
+          </td>
+          <td class="label" colspan="2">鏈哄彴鍙�</td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.machineNumber" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.machineNumber) }}</span>
+          </td>
+          <td class="label" colspan="3">浣滀笟鍛�</td>
+        </tr>
+        <tr>
+          <td class="label" colspan="2">妗d綅</td>
+          <td class="label" colspan="2">涓�妗�</td>
+          <td class="label" colspan="2">浜屾。</td>
+          <td class="label" colspan="2">涓夋。</td>
+          <td class="label" colspan="2">鍥涙。</td>
+          <td class="label" colspan="2">浜旀。</td>
+          <td class="label" colspan="2">鎺ユ敹鏁伴噺</td>
+          <td colspan="6">
+            <el-input-number v-if="props.isEdit" v-model="formData.otherData.receiveQuantity" controls-position="right" style="width: 100%;" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.receiveQuantity) }}</span>
+          </td>
+          <td rowspan="6" colspan="3">
+            <el-select v-model="formData.userId"
+                       v-if="props.isEdit"
+                       style="width: 100%"
+                       placeholder="璇烽�夋嫨浣滀笟鍛�"
+                       clearable
+                       filterable
+                       @change="handleUserChange">
+              <el-option v-for="user in userOptions"
+                         :key="user.userId"
+                         :label="user.userName"
+                         :value="user.userId"/>
+            </el-select>
+            <span v-else class="view-value">{{ displayValue(formData.userName || formData.userId) }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td class="label" colspan="2">鐢靛帇瑙勬牸</td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltageSpecs[0]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltageSpecs[0]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltageSpecs[1]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltageSpecs[1]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltageSpecs[2]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltageSpecs[2]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltageSpecs[3]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltageSpecs[3]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltageSpecs[4]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltageSpecs[4]) }}</span>
+          </td>
+          <td class="label" colspan="2">浜у嚭鏁伴噺</td>
+          <td colspan="6">
+            <el-input-number v-if="props.isEdit" controls-position="right" v-model="formData.quantity" style="width: 100%;" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.quantity) }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td class="label" colspan="2">鐢靛帇</td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltage[0]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltage[0]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltage[1]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltage[1]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltage[2]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltage[2]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltage[3]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltage[3]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.voltage[4]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.voltage[4]) }}</span>
+          </td>
+          <td class="label" colspan="2">涓嶈壇鏁伴噺</td>
+          <td colspan="6">
+            <el-input-number v-if="props.isEdit" controls-position="right" v-model="formData.scrapQty" style="width: 100%;" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.scrapQty) }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td class="label" colspan="2">鏁伴噺</td>
+          <td colspan="2">
+            <el-input-number v-if="props.isEdit" controls-position="right" v-model="formData.otherData.quantity[0]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.quantity[0]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input-number v-if="props.isEdit" controls-position="right" v-model="formData.otherData.quantity[1]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.quantity[1]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input-number v-if="props.isEdit" controls-position="right" v-model="formData.otherData.quantity[2]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.quantity[2]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input-number v-if="props.isEdit" controls-position="right" v-model="formData.otherData.quantity[3]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.quantity[3]) }}</span>
+          </td>
+          <td colspan="2">
+            <el-input-number v-if="props.isEdit" controls-position="right" v-model="formData.otherData.quantity[4]" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.quantity[4]) }}</span>
+          </td>
+          <td class="label" colspan="2">缁煎悎鍛戒腑鏈�</td>
+          <td colspan="6">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.comprehensiveHit" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.comprehensiveHit) }}</span>
+          </td>
+        </tr>
+        <tr>
+          <td class="label" colspan="2">鏈夋棤宸ョ▼寮傚父</td>
+          <td colspan="10">
+            <div v-if="props.isEdit" style="display: flex; align-items: center; width: 100%;">
+              <el-radio-group v-model="formData.otherData.engineException" style="display: flex; margin-right: 20px;">
+                <el-radio value="鏃�">鏃�</el-radio>
+                <el-radio value="鏈�">鏈�</el-radio>
+              </el-radio-group>
+              <div v-if="formData.otherData.engineException === '鏈�'" style="display: flex; align-items: center; flex: 1;">
+                <div style="width: 100px;">鍏蜂綋涓嶈壇锛�</div>
+                <el-input v-model="formData.otherData.specificIssue" placeholder="璇疯緭鍏�" style="width: 100%;"/>
+              </div>
+            </div>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.specificIssue) }}</span>
+          </td>
+          <td class="label" colspan="2">寮傚父澶勭悊缁撴灉</td>
+          <td colspan="6">
+            <el-input v-if="props.isEdit" v-model="formData.otherData.exceptionDealResult" placeholder="璇疯緭鍏�"/>
+            <span v-else class="view-value">{{ displayValue(formData.otherData.exceptionDealResult) }}</span>
+          </td>
+        </tr>
+        </tbody>
+      </table>
+    </el-form>
+    <template #footer>
+        <span class="dialog-footer">
+          <el-button v-if="props.isEdit" type="primary"
+                     @click="handleReport">纭畾</el-button>
+          <el-button @click="visible = false">{{ props.isEdit ? "鍙栨秷" : "鍏抽棴" }}</el-button>
+        </span>
+    </template>
+  </el-dialog>
+</template>
+
+<style scoped>
+.report-table {
+  width: 100%;
+  border-collapse: collapse;
+  table-layout: fixed;
+  font-size: 13px;
+}
+
+.report-table td {
+  border: 1px solid #dcdfe6;
+  padding: 6px;
+  vertical-align: middle;
+}
+
+.report-table .label {
+  width: 90px;
+  background: #f5f7fa;
+  text-align: center;
+  font-weight: 500;
+}
+
+.report-table .tip {
+  text-align: center;
+  font-weight: 500;
+  line-height: 1.4;
+  background: #fafafa;
+}
+
+.view-value {
+  display: inline-block;
+  min-height: 32px;
+  line-height: 32px;
+}
+</style>
\ No newline at end of file
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index 4155757..da42a3f 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -227,6 +227,12 @@
         :isEdit="true"
         :row="currentReportRowData"
         @refreshData="getList"/>
+    <VoltageSortingForm
+        v-if="voltageSortingFormVisible"
+        v-model:isShow="voltageSortingFormVisible"
+        :isEdit="true"
+        :row="currentReportRowData"
+        @refreshData="getList"/>
   </div>
 </template>
 
@@ -249,6 +255,7 @@
 const {priority_type} = proxy.useDict("priority_type");
 
 const CopperPrintingForm = defineAsyncComponent(() => import("./components/CopperPrintingForm.vue"));
+const VoltageSortingForm = defineAsyncComponent(() => import("./components/VoltageSortingForm.vue"));
 const tableColumn = ref([
   {
     label: "浼樺厛绾�",
@@ -375,6 +382,7 @@
 const qrRowData = ref(null);
 const editDialogVisible = ref(false);
 const copperPrintingFormVisible = ref(false);
+const voltageSortingFormVisible = ref(false);
 const transferCardVisible = ref(false);
 const transferCardData = ref([]);
 const transferCardQrUrl = ref("");
@@ -629,6 +637,10 @@
     copperPrintingFormVisible.value = true
     return
   }
+  if (row.processName === '鐢靛帇鍒嗛��') {
+    voltageSortingFormVisible.value = true
+    return;
+  }
   reportForm.planQuantity = row.planQuantity;
   reportForm.quantity = row.quantity !== undefined && row.quantity !== null ? row.quantity : null;
   reportForm.productProcessRouteItemId = row.productProcessRouteItemId;

--
Gitblit v1.9.3