From d85e1b4cce3e137a02f08515cd78c601fcf325b0 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 05 一月 2026 17:53:46 +0800
Subject: [PATCH] 新增生产工单页面

---
 src/api/productionManagement/workOrder.js          |    9 +++
 src/views/productionManagement/workOrder/index.vue |  153 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 162 insertions(+), 0 deletions(-)

diff --git a/src/api/productionManagement/workOrder.js b/src/api/productionManagement/workOrder.js
new file mode 100644
index 0000000..7bf908b
--- /dev/null
+++ b/src/api/productionManagement/workOrder.js
@@ -0,0 +1,9 @@
+import request from "@/utils/request";
+
+export function productWorkOrderPage(query) {
+  return request({
+    url: "/productWorkOrder/page",
+    method: "get",
+    params: query,
+  });
+}
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
new file mode 100644
index 0000000..c4779cb
--- /dev/null
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -0,0 +1,153 @@
+<template>
+  <div class="app-container">
+    <div class="search_form">
+      <div>
+        <span class="search_title">宸ュ崟缂栧彿锛�</span>
+        <el-input v-model="searchForm.workOrderNo"
+                  style="width: 240px"
+                  placeholder="璇疯緭鍏�"
+                  @change="handleQuery"
+                  clearable
+                  prefix-icon="Search" />
+        <el-button type="primary"
+                   @click="handleQuery"
+                   style="margin-left: 10px">鎼滅储</el-button>
+      </div>
+      <div>
+      </div>
+    </div>
+    <div class="table_list">
+      <PIMTable rowKey="id"
+                :column="tableColumn"
+                :tableData="tableData"
+                :page="page"
+                :tableLoading="tableLoading"
+                @pagination="pagination"></PIMTable>
+    </div>
+    <el-dialog v-model="qrDialogVisible"
+               title="浜岀淮鐮�"
+               width="300px">
+      <div style="text-align:center;">
+        <img :src="qrCodeUrl"
+             alt="浜岀淮鐮�"
+             style="width:200px;height:200px;" />
+        <div style="margin:10px 0;">
+          <el-button type="primary"
+                     @click="downloadQRCode">涓嬭浇浜岀淮鐮佸浘鐗�</el-button>
+        </div>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup>
+  import { onMounted, ref } from "vue";
+  import { ElMessageBox } from "element-plus";
+  import dayjs from "dayjs";
+  import { productWorkOrderPage } from "@/api/productionManagement/workOrder.js";
+  import QRCode from "qrcode";
+  import { getCurrentInstance, reactive, toRefs } from "vue";
+  const { proxy } = getCurrentInstance();
+
+  const tableColumn = ref([
+    {
+      label: "宸ュ崟缂栧彿",
+      prop: "workOrderNo",
+    },
+    {
+      label: "浜у搧鍚嶇О",
+      prop: "productName",
+    },
+    {
+      label: "瑙勬牸",
+      prop: "model",
+    },
+    {
+      label: "鍗曚綅",
+      prop: "unit",
+    },
+    {
+      label: "宸ュ簭鍚嶇О",
+      prop: "processName",
+    },
+    {
+      label: "璁″垝寮�濮嬫椂闂�",
+      prop: "planStartTime",
+    },
+    {
+      label: "璁″垝缁撴潫鏃堕棿",
+      prop: "planEndTime",
+    },
+    {
+      label: "瀹為檯寮�濮嬫椂闂�",
+      prop: "actualStartTime",
+    },
+    {
+      label: "瀹為檯缁撴潫鏃堕棿",
+      prop: "actualEndTime",
+    },
+  ]);
+  const tableData = ref([]);
+  const tableLoading = ref(false);
+  const qrDialogVisible = ref(false);
+  const qrCodeUrl = ref("");
+  const qrRowData = ref(null);
+  const page = reactive({
+    current: 1,
+    size: 100,
+    total: 0,
+  });
+
+  const data = reactive({
+    searchForm: {
+      workOrderNo: "",
+    },
+  });
+  const { searchForm } = toRefs(data);
+
+  // 鏌ヨ鍒楄〃
+  /** 鎼滅储鎸夐挳鎿嶄綔 */
+  const handleQuery = () => {
+    page.current = 1;
+    getList();
+  };
+  const pagination = obj => {
+    page.current = obj.page;
+    page.size = obj.limit;
+    getList();
+  };
+  const getList = () => {
+    tableLoading.value = true;
+    const params = { ...searchForm.value, ...page };
+    productWorkOrderPage(params)
+      .then(res => {
+        tableLoading.value = false;
+        tableData.value = res.data.records;
+        page.total = res.data.total;
+      })
+      .catch(() => {
+        tableLoading.value = false;
+      });
+  };
+  const showQRCode = async row => {
+    // 鐩存帴浣跨敤URL锛屼笉瑕佺敤JSON.stringify鍖呰
+    const qrContent = proxy.javaApi + "/device-info?deviceId=" + row.id;
+    qrCodeUrl.value = await QRCode.toDataURL(qrContent);
+    qrRowData.value = row;
+    qrDialogVisible.value = true;
+  };
+  const downloadQRCode = () => {
+    const link = document.createElement("a");
+    link.href = qrCodeUrl.value;
+    link.download = `浜岀淮鐮乢${qrRowData.value.id}.png`;
+    document.body.appendChild(link);
+    link.click();
+    document.body.removeChild(link);
+  };
+
+  onMounted(() => {
+    getList();
+  });
+</script>
+
+<style scoped lang="scss"></style>

--
Gitblit v1.9.3