From 437a70bd86d8adda3da41853b8b1c2706a22fdd7 Mon Sep 17 00:00:00 2001
From: 张诺 <zhang_12370@163.com>
Date: 星期四, 12 六月 2025 18:03:59 +0800
Subject: [PATCH] 优化文档管理及基础信息页面

---
 src/views/basicInformation/index.vue                        |    2 
 src/views/procureMent/index.vue                             |  157 ++++++++----
 src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue  |    2 
 src/views/archiveManagement/mould/archiveDialog.vue         |  119 +++++++++
 src/views/procureMent/components/ProductionDialog.vue       |  214 +++++++++++------
 src/views/basicInformation/mould/coal.vue                   |    2 
 src/views/archiveManagement/index.vue                       |  160 +++++++++++-
 src/views/basicInformation/mould/supplier.vue               |    2 
 src/views/basicInformation/mould/coalQualityMaintenance.vue |    7 
 src/views/basicInformation/mould/customer.vue               |    2 
 src/views/production/components/ProductionDialog.vue        |   16 -
 11 files changed, 499 insertions(+), 184 deletions(-)

diff --git a/src/views/archiveManagement/index.vue b/src/views/archiveManagement/index.vue
index 139b1e2..d5951dc 100644
--- a/src/views/archiveManagement/index.vue
+++ b/src/views/archiveManagement/index.vue
@@ -92,10 +92,21 @@
     </div>
     <div class="right">
       <el-row :gutter="24">
-          <el-col :span="2" :offset="20"><el-button :icon="Delete" type="danger">鍒犻櫎</el-button></el-col>
-          <el-col :span="2"><el-button :icon="Plus" type="primary">鏂板</el-button></el-col>
+        <el-col :span="2" :offset="20"
+          ><el-button :icon="Delete" type="danger" @click="delHandler">鍒犻櫎</el-button></el-col
+        >
+        <el-col :span="2"
+          ><el-button
+            :icon="Plus"
+            type="primary"
+            @click="add"
+            :disabled="!tableData.length"
+            >鏂板</el-button
+          ></el-col
+        >
       </el-row>
       <ETable
+        :maxHeight="1200"
         :loading="loading"
         :table-data="tableData"
         :columns="columns"
@@ -107,17 +118,27 @@
       </ETable>
       <Pagination
         :total="total"
-        :page-size="10"
-        :page-count="Math.ceil(total / 10)"
-        @page-change="currentPageChange"
+        :page="queryParams.current"
+        :limit="queryParams.pageSize"
+        :show-total="true"
+        @pagination="handlePageChange"
+        :layout="'total, prev, pager, next, jumper'"
       ></Pagination>
     </div>
+    <archiveDialog
+      v-model:centerDialogVisible="dialogVisible"
+      @centerDialogVisible="centerDialogVisible"
+      :row="row"
+      @submitForm="submitForm"
+    >
+    </archiveDialog>
   </el-card>
 </template>
 <script setup>
-import { onMounted, ref, nextTick } from "vue";
+import { onMounted, ref, nextTick, reactive } from "vue";
 import ETable from "@/components/Table/ETable.vue";
-import { ElButton, ElInput, ElIcon } from "element-plus";
+import { ElButton, ElInput, ElIcon, ElMessage } from "element-plus";
+import archiveDialog from "./mould/archiveDialog.vue";
 import Pagination from "@/components/Pagination/index.vue";
 import {
   Plus,
@@ -134,6 +155,7 @@
   addOrEditArchive,
   delArchive,
 } from "@/api/archiveManagement";
+const dialogVisible = ref(false); // 鎺у埗褰掓。瀵硅瘽妗嗘樉绀�
 const loading = ref(false);
 const tableData = ref([]);
 const treeData = ref([]);
@@ -142,35 +164,131 @@
 const filterText = ref(""); // 鎼滅储鍏抽敭瀛�
 const treeRef = ref(); // 鏍戠粍浠跺紩鐢�
 const total = ref(0); // 鎬昏褰曟暟
-const current = ref(1); // 褰撳墠椤电爜
 const columns = [
   { prop: "name", label: "鍚嶇О", minWidth: 180 },
   { prop: "type", label: "绫诲瀷", minWidth: 120 },
   { prop: "status", label: "鐘舵��", minWidth: 100 },
 ];
+const selectedRows = reactive([]); // 瀛樺偍閫変腑琛屾暟鎹�
 const handleSelectionChange = (selection) => {
-  console.log("Selected rows:", selection);
+  selectedRows.splice(0, selectedRows.length, ...selection);
 };
-
+const queryParams = reactive({
+  searchText: "",
+  current: 1,
+  pageSize: 10, // 鍥哄畾姣忛〉10鏉�
+  treeId: null, // 褰撳墠鏍戣妭鐐笽D
+});
 // 鎼滅储杩囨护鍔熻兘
 const handleFilter = () => {
   treeRef.value?.filter(filterText.value);
 };
-
+const row = ref({}); // 褰撳墠閫変腑琛屾暟鎹�
 const filterNode = (value, data) => {
   if (!value) return true;
   return data.name?.toLowerCase().includes(value.toLowerCase());
 };
-
+const submitForm = async (res) => {
+  console.log("鎻愪氦琛ㄥ崟鍥炶皟:", res);
+  
+  if (res && res.code === 200) {
+    ElMessage.success("鎿嶄綔鎴愬姛");
+    // 鍒锋柊鍒楄〃鏁版嵁
+    await getArchiveListData();
+  } else {
+    ElMessage.error("鎿嶄綔澶辫触: " + (res?.message || "鏈煡閿欒"));
+  }
+}
+const centerDialogVisible = (val) => {
+  console.log(val);
+};
 // 澶勭悊鑺傜偣鐐瑰嚮
 const handleNodeClick = async (data) => {
   console.log("鐐瑰嚮鑺傜偣:", data);
-  let res = await getArchiveList(data.id);
-  tableData.value = res.data?.records || res.data || [];
-  console.log(data)
+  // 鍒囨崲鑺傜偣鏃堕噸缃埌绗竴椤�
+  queryParams.current = 1;
+  queryParams.treeId = data.id;
+  getArchiveListData();
 };
-const currentPageChange = (id) => {
-  console.log(id);
+// add
+const add = () => {
+  row.value = {}; // 娓呯┖琛屾暟鎹紝纭繚鏄柊澧炴ā寮�
+  dialogVisible.value = true;
+  newName.value = ""; // 娓呯┖杈撳叆妗�
+};
+// 澶勭悊鍒嗛〉鍙樺寲
+const handlePageChange = ({ page }) => {
+  console.log("鍒嗛〉鍙樺寲:", { page });
+  queryParams.current = page;
+  // pageSize 鍥哄畾涓�20锛屼笉鍐嶄粠鍙傛暟涓幏鍙�
+  getArchiveListData();
+};
+
+const getArchiveListData = async () => {
+  try {
+    loading.value = true;
+    console.log("鑾峰彇褰掓。鍒楄〃鏁版嵁", {
+      treeId: queryParams.treeId,
+      current: queryParams.current,
+      pageSize: queryParams.pageSize,
+    });
+
+    let res = await getArchiveList({
+      treeId: queryParams.treeId,
+      current: queryParams.current,
+      size: queryParams.pageSize,
+    });
+
+    if (res.code !== 200) {
+      ElMessage.error("鑾峰彇鏁版嵁澶辫触: " + res.message);
+      tableData.value = [];
+      total.value = 0;
+      return;
+    }
+
+    tableData.value = res.data?.records || res.data || [];
+    total.value = res.data?.total || 0;
+    // 纭繚鍒嗛〉鍙傛暟姝g‘鏇存柊
+    if (res.data?.current) {
+      queryParams.current = res.data.current;
+    }
+    // pageSize 鍥哄畾涓�20锛屼笉浠庡悗绔幏鍙�
+
+    console.log("鏁版嵁鏇存柊瀹屾垚:", {
+      total: total.value,
+      current: queryParams.current,
+      pageSize: queryParams.pageSize,
+      records: tableData.value.length,
+    });
+  } catch (error) {
+    console.error("鑾峰彇褰掓。鍒楄〃澶辫触:", error);
+    ElMessage.error("鑾峰彇鏁版嵁澶辫触");
+    tableData.value = [];
+    total.value = 0;
+  } finally {
+    loading.value = false;
+  }
+};
+const delHandler = async () => {
+  if (selectedRows.length === 0) {
+    ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
+    return;
+  }
+  try {
+    const ids = selectedRows.map((row) => row.id);
+    console.log(ids)
+    const { code, msg } = await delArchive(ids);
+    if (code !== 200) {
+      ElMessage.warning("鍒犻櫎澶辫触: " + msg);
+    } else {
+      ElMessage.success("鍒犻櫎鎴愬姛");
+      // 鍒犻櫎鎴愬姛鍚庨噸鏂拌幏鍙栨暟鎹�
+      await getArchiveListData();
+    }
+  } catch (error) {
+    console.error("鍒犻櫎褰掓。澶辫触:", error);
+    ElMessage.error("鍒犻櫎褰掓。澶辫触");
+  }
 };
 // 鍙屽嚮缂栬緫鑺傜偣
 const headerDbClick = (comeTreeData) => {
@@ -327,7 +445,11 @@
   }
 };
 
-const handleEdit = () => {};
+const handleEdit = (rows) => {
+  row.value = rows;
+  dialogVisible.value = true;
+  console.log("缂栬緫鑺傜偣:", row.value);
+};
 
 // 绉婚櫎鎳掑姞杞斤紝鐩存帴鑾峰彇鏁版嵁
 const getList = async () => {
@@ -564,7 +686,7 @@
     float: left;
   }
 }
-.archive-management-card{
+.archive-management-card {
   margin: 0;
 }
 </style>
diff --git a/src/views/archiveManagement/mould/archiveDialog.vue b/src/views/archiveManagement/mould/archiveDialog.vue
new file mode 100644
index 0000000..c976722
--- /dev/null
+++ b/src/views/archiveManagement/mould/archiveDialog.vue
@@ -0,0 +1,119 @@
+<template>
+  <el-dialog v-model="centerDialogVisible" title="Warning" width="500" center>
+    <el-form
+      ref="ruleFormRef"
+      style="max-width: 600px"
+      :model="ruleForm"
+      :rules="rules"
+      label-width="auto"
+    >
+      <el-form-item label="鍚嶇О" prop="name">
+        <el-input v-model="ruleForm.name" placeholder="璇疯緭鍏ユ枃妗e悕绉�"/>
+      </el-form-item>
+      <el-form-item label="璇疯緭鍏ユ枃妗g被鍨�" prop="type">
+        <el-select v-model="ruleForm.type" placeholder="璇疯緭鍏ユ枃妗g被鍨�">
+          <el-option label="鍚堝悓" value="鍚堝悓" />
+          <el-option label="鎶ュ憡" value="鎶ュ憡" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="璇疯緭鍏ユ枃妗g姸鎬�" prop="status">
+        <el-select v-model="ruleForm.status" placeholder="璇疯緭鍏ユ枃妗g姸鎬�">
+          <el-option v-for="option in options" :key="option.value" :label="option.label" :value="option.value" />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="centerDialogVisible = false">Cancel</el-button>
+        <el-button type="primary" @click="submit">
+          Confirm
+        </el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+
+<script setup>
+import { ref, watch } from "vue";
+import { addOrEditArchive } from "@/api/archiveManagement"
+
+const centerDialogVisible = defineModel("centerDialogVisible", {
+  type: Boolean,
+  default: false,
+});
+
+const props = defineProps({
+  row: {
+    type: Object,
+    default: () => ({}),
+  },
+});
+const copyFormData = (data) => {
+  return JSON.parse(JSON.stringify(data));
+};
+// 鍒濆鍖栬〃鍗曟暟鎹殑杈呭姪鍑芥暟
+const initFormData = (rowData) => {
+  if (rowData && rowData.id) {
+    return copyFormData(rowData);
+  }
+  return {
+    name: "",
+    type: "",
+    status: "",
+  };
+};
+
+// 鍒濆鍖栬〃鍗曟暟鎹�
+const ruleFormRef = ref(null);
+const ruleForm = ref(initFormData(props.row));
+const copyForm = ref()
+// 鐩戝惉 row 鐨勫彉鍖栵紝鏇存柊 ruleForm
+watch(() => props.row, (newRow) => {
+  copyForm.value = initFormData(newRow);
+  ruleForm.value = JSON.parse(JSON.stringify(copyForm.value));
+}, { deep: true });
+const rules = {
+  name: [
+    { required: true, message: "Please input activity name", trigger: "blur" },
+  ],
+  type: [
+    { required: true, message: "Please select activity zone", trigger: "change" },
+  ],
+  status: [
+    { required: true, message: "Please select activity count", trigger: "change" },
+  ],
+};
+
+const options = [
+  { value: "鏈夋晥", label: "鏈夋晥" },
+  { value: "鏃犳晥", label: "鏃犳晥" },
+  { value: "浣滃簾", label: "浣滃簾" },
+];
+const emit = defineEmits(["submitForm"]);
+const submit = async () => {
+  // 楠岃瘉琛ㄥ崟
+  if (!ruleFormRef.value) return;
+  
+  try {
+    const valid = await ruleFormRef.value.validate();
+    if (!valid) {
+      return;
+    }
+    
+    // 璋冪敤 API
+    let res = await addOrEditArchive(ruleForm.value);
+    console.log("API 鍝嶅簲:", res);
+    
+    // 鍙戦�� emit 浜嬩欢
+    emit("submitForm", res);
+    console.log("emit submitForm 宸插彂閫�");
+    
+    // 鍏抽棴瀵硅瘽妗�
+    centerDialogVisible.value = false;
+  } catch (error) {
+    console.error("琛ㄥ崟楠岃瘉澶辫触鎴朅PI璋冪敤澶辫触:", error);
+  }
+}
+</script>
+
+<style lang="less" scoped></style>
diff --git a/src/views/basicInformation/index.vue b/src/views/basicInformation/index.vue
index f399bc0..fda5d65 100644
--- a/src/views/basicInformation/index.vue
+++ b/src/views/basicInformation/index.vue
@@ -314,7 +314,7 @@
     }
   },
   { prop: "contactAddress", label: "鑱旂郴浜鸿缁嗗湴鍧�", minWidth: 120 },
-  { prop: "createTime", label: "缁存姢鏃ユ湡", minWidth: 120 },
+  { prop: "updateTime", label: "缁存姢鏃ユ湡", minWidth: 120 },
 ]);
 
 /**
diff --git a/src/views/basicInformation/mould/coal.vue b/src/views/basicInformation/mould/coal.vue
index ae905ed..a0454a3 100644
--- a/src/views/basicInformation/mould/coal.vue
+++ b/src/views/basicInformation/mould/coal.vue
@@ -121,8 +121,6 @@
     if (!formRef.value) return
     await formRef.value.validate(async (valid, fields) => {
         if (valid) {
-            delete formData.value.createTime
-            delete formData.value.updateTime
             delete formData.value.maintainerName // 鍒犻櫎鏄剧ず鐢ㄧ殑瀛楁锛屽彧淇濈暀ID
             
             // 纭繚maintainerId鏈夊��
diff --git a/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue b/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue
index a7dcbdb..c7de9c3 100644
--- a/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue
+++ b/src/views/basicInformation/mould/coalMeiZhiZiDuanWeiHu.vue
@@ -91,8 +91,6 @@
           result
         };
       } else {
-        delete formData.value.createTime
-        delete formData.value.updateTime
         let result = await addOrEditCoalField({
           ...formData.value,
         })
diff --git a/src/views/basicInformation/mould/coalQualityMaintenance.vue b/src/views/basicInformation/mould/coalQualityMaintenance.vue
index da58839..64373b0 100644
--- a/src/views/basicInformation/mould/coalQualityMaintenance.vue
+++ b/src/views/basicInformation/mould/coalQualityMaintenance.vue
@@ -221,13 +221,6 @@
       coalFields: stringifyCoalFields(formData.value.coalFields),
       fieldIds: stringifyCoalFields(formData.value.fieldIds)
     };
-
-    // 鍒犻櫎涓嶉渶瑕佺殑鏃堕棿瀛楁锛堢紪杈戞椂锛�
-    if (isEditMode.value) {
-      delete submitData.createTime;
-      delete submitData.updateTime;
-    }
-
     // 璋冪敤API鎻愪氦鏁版嵁
     const result = await addOrEditCoalPlan(submitData);
 
diff --git a/src/views/basicInformation/mould/customer.vue b/src/views/basicInformation/mould/customer.vue
index f0f25c1..0aa5a62 100644
--- a/src/views/basicInformation/mould/customer.vue
+++ b/src/views/basicInformation/mould/customer.vue
@@ -158,8 +158,6 @@
           result
         };
       } else {
-        delete formData.value.createTime
-        delete formData.value.updateTime
         let result = await addOrEditCustomer({
           ...formData.value,
         })
diff --git a/src/views/basicInformation/mould/supplier.vue b/src/views/basicInformation/mould/supplier.vue
index b18cd9d..d40b4c7 100644
--- a/src/views/basicInformation/mould/supplier.vue
+++ b/src/views/basicInformation/mould/supplier.vue
@@ -153,8 +153,6 @@
           result
         };
       } else {
-        delete formData.value.createTime
-        delete formData.value.updateTime
         let result = await addOrEditSupply({
           ...formData.value,
         })
diff --git a/src/views/procureMent/components/ProductionDialog.vue b/src/views/procureMent/components/ProductionDialog.vue
index 5a0f8a9..5069233 100644
--- a/src/views/procureMent/components/ProductionDialog.vue
+++ b/src/views/procureMent/components/ProductionDialog.vue
@@ -17,81 +17,86 @@
         style="max-width: 400px; margin: 0 auto"
       >
         <el-form-item label="渚涘簲鍟嗗悕绉�" prop="supplierName">
-          <el-input v-model="form.supplierName" placeholder="璇疯緭鍏�" />
+          <el-select v-model="form.supplierName" placeholder="璇烽�夋嫨渚涘簲鍟�">
+            <el-option :label="item.label" v-for="item in supplyList" :key="item.value" :value="item.value" />
+          </el-select>
         </el-form-item>
         <el-form-item label="鐓ょ" prop="coal">
-            <el-select v-model="form.coal" placeholder="璇烽�夋嫨鐓ょ" clearable style="width: 100%">
-              <el-option label="鐦︾叅" value="鐦︾叅" />
-              <el-option label="姘旂叅" value="姘旂叅" />
-              <el-option label="鏃犵儫鐓�" value="鏃犵儫鐓�" />
-              <el-option label="闀跨劙鐓�" value="闀跨劙鐓�" />
-              <el-option label="璐叅" value="璐叅" />
-            </el-select>
-          </el-form-item>
+          <el-select v-model="form.coal" placeholder="璇烽�夋嫨鐓ょ">
+            <el-option :label="item.label" v-for="item in coalList" :key="item.value" :value="item.value" />
+          </el-select>
+        </el-form-item>
         <el-form-item label="鍗曚綅" prop="unit">
-          <el-select v-model="form.unit" placeholder="璇烽�夋嫨鍗曚綅" clearable style="width: 100%">
-              <el-option label="鍚�" value="鍚�" />
-              <el-option label="鍗冨厠" value="鍗冨厠" />
-            </el-select>
-        </el-form-item>        <el-form-item label="閲囪喘鏁伴噺" prop="purchaseQuantity">
-          <el-input 
-            v-model.number="form.purchaseQuantity" 
+          <el-select
+            v-model="form.unit"
+            placeholder="璇烽�夋嫨鍗曚綅"
+            clearable
+            style="width: 100%"
+          >
+            <el-option label="鍚�" value="鍚�" />
+            <el-option label="鍗冨厠" value="鍗冨厠" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="閲囪喘鏁伴噺" prop="purchaseQuantity">
+          <el-input
+            v-model.number="form.purchaseQuantity"
             placeholder="璇疯緭鍏�"
             @blur="handleQuantityBlur"
           >
             <template v-slot:suffix>
-            <i style="font-style:normal;">{{form.unit?form.unit:''}}</i>
-          </template>
-          </el-input>
-        </el-form-item><el-form-item label="绋庣巼" prop="taxRate">
-          <el-input 
-            v-model.number="form.taxRate" 
+              <i style="font-style: normal">{{ form.unit ? form.unit : "" }}</i>
+            </template>
+          </el-input> </el-form-item
+        ><el-form-item label="绋庣巼" prop="taxRate">
+          <el-input
+            v-model.number="form.taxRate"
             placeholder="璇疯緭鍏ョ◣鐜�"
             @blur="handleTaxRateBlur"
           >
             <template v-slot:suffix>
-            <i style="font-style:normal;">%</i>
-          </template>
-            </el-input>
+              <i style="font-style: normal">%</i>
+            </template>
+          </el-input>
         </el-form-item>
         <el-form-item label="鍗曚环(涓嶅惈绋�)" prop="priceExcludingTax">
-          <el-input 
-            v-model.number="form.priceExcludingTax" 
+          <el-input
+            v-model.number="form.priceExcludingTax"
             placeholder="璇疯緭鍏�"
             @blur="handlePriceBlur"
           >
             <template v-slot:suffix>
-            <i style="font-style:normal;">鍏�</i>
-          </template>
+              <i style="font-style: normal">鍏�</i>
+            </template>
           </el-input>
-        </el-form-item>        <el-form-item label="鍗曚环(鍚◣)" prop="priceIncludingTax">
-          <el-input 
+        </el-form-item>
+        <el-form-item label="鍗曚环(鍚◣)" prop="priceIncludingTax">
+          <el-input
             v-model.number="form.priceIncludingTax"
-            placeholder="鑷姩璁$畻" 
+            placeholder="鑷姩璁$畻"
           >
             <template v-slot:suffix>
-            <i style="font-style:normal;">鍏�</i>
-          </template>
+              <i style="font-style: normal">鍏�</i>
+            </template>
           </el-input>
         </el-form-item>
         <el-form-item label="鎬讳环(涓嶅惈绋�)" prop="totalPriceExcludingTax">
-          <el-input 
+          <el-input
             v-model.number="form.totalPriceExcludingTax"
-            placeholder="鑷姩璁$畻" 
+            placeholder="鑷姩璁$畻"
           >
             <template v-slot:suffix>
-            <i style="font-style:normal;">鍏�</i>
-          </template>
+              <i style="font-style: normal">鍏�</i>
+            </template>
           </el-input>
         </el-form-item>
         <el-form-item label="鎬讳环(鍚◣)" prop="totalPriceIncludingTax">
-          <el-input 
+          <el-input
             v-model.number="form.totalPriceIncludingTax"
-            placeholder="鑷姩璁$畻" 
+            placeholder="鑷姩璁$畻"
           >
             <template v-slot:suffix>
-            <i style="font-style:normal;">鍏�</i>
-          </template>
+              <i style="font-style: normal">鍏�</i>
+            </template>
           </el-input>
         </el-form-item>
         <el-form-item label="鐧昏浜�" prop="registrantId">
@@ -111,14 +116,10 @@
       <template #footer>
         <div class="dialog-footer">
           <!-- 閲嶇疆鍜屽彇娑� -->
-          <el-button
-            @click="handleClose"
-            v-if="title.includes('鏂板')"
+          <el-button @click="handleClose" v-if="title.includes('鏂板')"
             >鍙栨秷</el-button
           >
-          <el-button
-            @click="handleReset"
-            v-if="title.includes('缂栬緫')"
+          <el-button @click="handleReset" v-if="title.includes('缂栬緫')"
             >閲嶇疆</el-button
           >
           <el-button type="primary" @click="handleSubmit">纭</el-button>
@@ -129,10 +130,12 @@
 </template>
 
 <script setup name="ProductionDialog">
-import { ref, defineProps, watch, onMounted, nextTick, computed  } from "vue";
+import { ref, defineProps, watch, onMounted, nextTick, computed } from "vue";
 import { ElMessage } from "element-plus";
-import useUserStore from '@/store/modules/user'
-import {addOrEditPR} from "@/api/procureMent";
+import useUserStore from "@/store/modules/user";
+import { addOrEditPR } from "@/api/procureMent";
+import { getSupply } from "@/api/basicInformation/supplier";
+import { getCoalInfo } from "@/api/basicInformation/coal";
 const props = defineProps({
   title: {
     type: String,
@@ -152,12 +155,42 @@
   required: true,
   type: Object,
 });
+const supplyList = ref([]);
+const coalList = ref([]);
+// 鑾峰彇渚涘簲鍟嗕笅鎷夊拰鐓ょ涓嬫媺
+const getDropdownData = async () => {
+  try {
+    const [supplyRes, coalRes] = await Promise.all([
+      getSupply(),
+      getCoalInfo(),
+    ]);
+    let supplyData = supplyRes.data.records;
+    let coalData = coalRes.data.records;
+    supplyList.value = supplyData.map((item) => ({
+      value: item.id,
+      label: item.supplierName,
+    }));
+    coalList.value = coalData.map((item) => ({
+      value: item.id,
+      label: item.coal,
+    }));
+    console.log(supplyList.value, coalList.value);
+  } catch (error) {
+    console.error("鑾峰彇涓嬫媺鏁版嵁澶辫触:", error);
+  }
+};
 
+defineExpose({
+  getDropdownData,
+});
 const toFixed = (num, precision = 2) => {
-  if (isNaN(num) || num === null || num === undefined || num === '') {
+  if (isNaN(num) || num === null || num === undefined || num === "") {
     return 0;
   }
-  return Math.floor(parseFloat(num) * Math.pow(10, precision)) / Math.pow(10, precision);
+  return (
+    Math.floor(parseFloat(num) * Math.pow(10, precision)) /
+    Math.pow(10, precision)
+  );
 };
 // 鍚◣鍗曚环璁$畻
 const unitPriceWithTax = computed(() => {
@@ -175,11 +208,11 @@
   const priceExcludingTax = parseFloat(form.value.priceExcludingTax) || 0;
   const taxRate = parseFloat(form.value.taxRate) || 0;
   const purchaseQuantity = parseFloat(form.value.purchaseQuantity) || 0;
-  
+
   if (!priceExcludingTax || !taxRate || !purchaseQuantity) {
     return 0;
   }
-  
+
   const unitPriceWithTaxValue = priceExcludingTax * (1 + taxRate / 100);
   const result = unitPriceWithTaxValue * purchaseQuantity;
   return toFixed(result, 2);
@@ -189,11 +222,11 @@
 const taxExclusiveTotalPrice = computed(() => {
   const purchaseQuantity = parseFloat(form.value.purchaseQuantity) || 0;
   const priceExcludingTax = parseFloat(form.value.priceExcludingTax) || 0;
-  
+
   if (!purchaseQuantity || !priceExcludingTax) {
     return 0;
   }
-  
+
   const result = purchaseQuantity * priceExcludingTax;
   return toFixed(result, 2);
 });
@@ -211,34 +244,52 @@
   form.value.totalPriceExcludingTax = newValue;
 });
 
-const userStore = useUserStore()
+const userStore = useUserStore();
 const userInfo = ref({});
 
 // 澶勭悊绋庣巼杈撳叆妗嗗け鐒︼紝纭繚绮惧害
 const handleTaxRateBlur = () => {
-  if (form.value.taxRate !== null && form.value.taxRate !== undefined && form.value.taxRate !== '') {
+  if (
+    form.value.taxRate !== null &&
+    form.value.taxRate !== undefined &&
+    form.value.taxRate !== ""
+  ) {
     form.value.taxRate = toFixed(parseFloat(form.value.taxRate), 2);
   }
 };
 
 // 澶勭悊涓嶅惈绋庡崟浠疯緭鍏ユ澶辩劍锛岀‘淇濈簿搴�
 const handlePriceBlur = () => {
-  if (form.value.priceExcludingTax !== null && form.value.priceExcludingTax !== undefined && form.value.priceExcludingTax !== '') {
-    form.value.priceExcludingTax = toFixed(parseFloat(form.value.priceExcludingTax), 2);
+  if (
+    form.value.priceExcludingTax !== null &&
+    form.value.priceExcludingTax !== undefined &&
+    form.value.priceExcludingTax !== ""
+  ) {
+    form.value.priceExcludingTax = toFixed(
+      parseFloat(form.value.priceExcludingTax),
+      2
+    );
   }
 };
 
 // 澶勭悊閲囪喘鏁伴噺杈撳叆妗嗗け鐒︼紝纭繚绮惧害
 const handleQuantityBlur = () => {
-  if (form.value.purchaseQuantity !== null && form.value.purchaseQuantity !== undefined && form.value.purchaseQuantity !== '') {
-    form.value.purchaseQuantity = toFixed(parseFloat(form.value.purchaseQuantity), 3); // 鏁伴噺淇濈暀3浣嶅皬鏁�
+  if (
+    form.value.purchaseQuantity !== null &&
+    form.value.purchaseQuantity !== undefined &&
+    form.value.purchaseQuantity !== ""
+  ) {
+    form.value.purchaseQuantity = toFixed(
+      parseFloat(form.value.purchaseQuantity),
+      3
+    ); // 鏁伴噺淇濈暀3浣嶅皬鏁�
   }
 };
 
 onMounted(async () => {
-  let res = await userStore.getInfo()
+  let res = await userStore.getInfo();
   userInfo.value = res;
-})
+});
 const rules = {
   supplierName: [
     { required: true, message: "璇疯緭鍏ヤ緵搴斿晢鍚嶇О", trigger: "blur" },
@@ -249,10 +300,18 @@
     { required: true, message: "璇疯緭鍏ラ噰璐暟閲�", trigger: "blur" },
     { type: "number", message: "閲囪喘鏁伴噺蹇呴』涓烘暟瀛�", trigger: "blur" },
   ],
-  priceExcludingTax: [{ required: true, message: "璇疯緭鍏ュ崟浠�", trigger: "blur" }],
-  totalPriceExcludingTax: [{ required: true, message: "璇疯緭鍏ユ�讳环", trigger: "blur" }],
-  priceIncludingTax: [{ required: true, message: "璇疯緭鍏ュ惈绋庡崟浠�", trigger: "blur" }],
-  totalPriceIncludingTax: [{ required: true, message: "璇疯緭鍏ュ惈绋庢�讳环", trigger: "blur" }],
+  priceExcludingTax: [
+    { required: true, message: "璇疯緭鍏ュ崟浠�", trigger: "blur" },
+  ],
+  totalPriceExcludingTax: [
+    { required: true, message: "璇疯緭鍏ユ�讳环", trigger: "blur" },
+  ],
+  priceIncludingTax: [
+    { required: true, message: "璇疯緭鍏ュ惈绋庡崟浠�", trigger: "blur" },
+  ],
+  totalPriceIncludingTax: [
+    { required: true, message: "璇疯緭鍏ュ惈绋庢�讳环", trigger: "blur" },
+  ],
   taxRate: [{ required: true, message: "璇疯緭鍏ョ◣鐜�", trigger: "blur" }],
   registrantId: [{ required: true, message: "璇疯緭鍏ョ櫥璁颁汉", trigger: "blur" }],
   registrationDate: [
@@ -280,25 +339,25 @@
   await formRef.value.validate(async (valid) => {
     if (valid) {
       const obj = ref({});
-      if (props.title.includes('鏂板')) {
+      if (props.title.includes("鏂板")) {
         let result = await addOrEditPR({
           ...form.value,
-        })
+        });
         obj.value = {
           title: "鏂板",
           ...form.value,
-          result
+          result,
         };
       } else {
-        delete form.value.updateTime
-        delete form.value.createTime
+        delete form.value.updateTime;
+        delete form.value.createTime;
         let result = await addOrEditPR({
           ...form.value,
-        })
+        });
         obj.value = {
           title: "缂栬緫",
           ...form.value,
-          result
+          result,
         };
       }
       emit("submit", obj.value);
@@ -307,5 +366,4 @@
 };
 </script>
 
-<style lang="sass" scoped>
-</style>
\ No newline at end of file
+<style lang="sass" scoped></style>
diff --git a/src/views/procureMent/index.vue b/src/views/procureMent/index.vue
index 5b96d12..0651cd4 100644
--- a/src/views/procureMent/index.vue
+++ b/src/views/procureMent/index.vue
@@ -2,16 +2,36 @@
   <div class="app-container">
     <el-form :inline="true" :model="queryParams" class="search-form">
       <el-form-item label="鎼滅储">
-        <el-input v-model="queryParams.searchText" placeholder="璇疯緭鍏ュ叧閿瘝" clearable :style="{ width: '100%' }" />
+        <el-input
+          v-model="queryParams.searchText"
+          placeholder="璇疯緭鍏ュ叧閿瘝"
+          clearable
+          :style="{ width: '100%' }"
+        />
       </el-form-item>
       <el-form-item label="渚涘簲鍟嗗悕绉�">
-        <el-input v-model="queryParams.supplierName" placeholder="璇疯緭鍏�" clearable :style="{ width: '100%' }" />
+        <el-input
+          v-model="queryParams.supplierName"
+          placeholder="璇疯緭鍏�"
+          clearable
+          :style="{ width: '100%' }"
+        />
       </el-form-item>
       <el-form-item label="缁熶竴浜鸿瘑鍒彿">
-        <el-input v-model="queryParams.identifyNumber" placeholder="璇疯緭鍏�" clearable :style="{ width: '100%' }" />
+        <el-input
+          v-model="queryParams.identifyNumber"
+          placeholder="璇疯緭鍏�"
+          clearable
+          :style="{ width: '100%' }"
+        />
       </el-form-item>
       <el-form-item label="缁忚惀鍦板潃">
-        <el-input v-model="queryParams.address" placeholder="璇疯緭鍏�" clearable :style="{ width: '100%' }" />
+        <el-input
+          v-model="queryParams.address"
+          placeholder="璇疯緭鍏�"
+          clearable
+          :style="{ width: '100%' }"
+        />
       </el-form-item>
       <el-form-item>
         <el-button type="primary" @click="handleQuery">鏌ヨ</el-button>
@@ -21,17 +41,44 @@
     <el-card>
       <!-- 鎿嶄綔鎸夐挳鍖� -->
       <el-row :gutter="24" class="table-toolbar">
-        <el-button type="primary" :icon="Plus" @click="handleAdd">鏂板缓</el-button>
-        <el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button>
+        <el-button type="primary" :icon="Plus" @click="handleAdd"
+          >鏂板缓</el-button
+        >
+        <el-button type="danger" :icon="Delete" @click="handleDelete"
+          >鍒犻櫎</el-button
+        >
         <!-- <el-button type="info" :icon="Download" @click="handleExport">瀵煎嚭</el-button> -->
       </el-row>
       <!-- 琛ㄦ牸缁勪欢 -->
-      <data-table :loading="loading" :table-data="tableData" :columns="columns" @selection-change="handleSelectionChange"
-        @edit="handleEdit" @delete="handleDeleteSuccess" :show-selection="true" :border="true" :maxHeight="440" />
-      <pagination v-if="total>0" :page="pageNum" :limit="pageSize" :total="total" @pagination="handlePagination"
-        :layout="'total, prev, pager, next, jumper'" />
-    </el-card>    <ProductionDialog v-model:copyForm="copyForm" v-model:dialogFormVisible="dialogFormVisible" v-model:form="form" :title="title" @submit="handleSubmit"
-      @success="handleSuccess" />
+      <data-table
+        :loading="loading"
+        :table-data="tableData"
+        :columns="columns"
+        @selection-change="handleSelectionChange"
+        @edit="handleEdit"
+        @delete="handleDeleteSuccess"
+        :show-selection="true"
+        :border="true"
+        :maxHeight="440"
+      />
+      <pagination
+        v-if="total > 0"
+        :page="current"
+        :limit="pageSize"
+        :total="total"
+        @pagination="handlePagination"
+        :layout="'total, prev, pager, next, jumper'"
+      />
+    </el-card>
+    <ProductionDialog
+      v-model:copyForm="copyForm"
+      v-model:dialogFormVisible="dialogFormVisible"
+      v-model:form="form"
+      :title="title"
+      @submit="handleSubmit"
+      @success="handleSuccess"
+      ref="productionDialogs"
+    />
   </div>
 </template>
 
@@ -41,32 +88,18 @@
 import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue";
 import DataTable from "@/components/Table/ETable.vue";
 import Pagination from "@/components/Pagination";
-import ProductionDialog from './components/ProductionDialog.vue';
+import ProductionDialog from "./components/ProductionDialog.vue";
 import { purchaseRegistration } from "@/api/procureMent";
-import useUserStore from '@/store/modules/user'
-import useDictStore from "@/store/modules/dict";
+import useUserStore from "@/store/modules/user";
 // 寮曞叆瀛楀吀鏁版嵁
-const useDictStores = useDictStore();
-useDictStores.setDict({
-  id: 1,
-  name: "鐓ょ绫诲瀷",
-  type: "coalType",
-  items: [
-    { label: "鏃犵儫鐓�", value: "anthracite" },
-    { label: "鐑熺叅", value: "bituminous" },
-    { label: "瑜愮叅", value: "lignite" }
-  ]
-})
-console.log(useDictStores.dict);
-
-const { proxy } = getCurrentInstance()
+const { proxy } = getCurrentInstance();
 const dialogFormVisible = ref(false);
 const form = ref({});
 const title = ref("");
 // 鐘舵�佸彉閲�
 const loading = ref(false);
 const total = ref(0);
-const pageNum = ref(1)
+const current = ref(1);
 const pageSize = ref(10);
 const selectedRows = ref([]);
 const copyForm = ref({});
@@ -76,8 +109,8 @@
   supplierName: "",
   identifyNumber: "",
   address: "",
-  pageNum: 1,
-  pageSize: 10
+  current: 1,
+  pageSize: 10,
 });
 // 鏄惁缂栬緫
 const addOrEdit = ref("add");
@@ -92,15 +125,15 @@
 const userStore = useUserStore();
 // 鑾峰彇鐢ㄦ埛淇℃伅
 const userInfo = ref({});
-onMounted(async() => {
-  let res = await userStore.getInfo()
+onMounted(async () => {
+  let res = await userStore.getInfo();
   userInfo.value = res.user;
 });
 // 鍒嗛〉澶勭悊
 const handlePagination = (val) => {
-  pageNum.value = val.page;
+  current.value = val.page;
   pageSize.value = val.limit;
-  queryParams.pageNum = val.page;
+  queryParams.current = val.page;
   queryParams.pageSize = val.limit;
   getList();
 };
@@ -122,7 +155,7 @@
 // 閲嶇疆鏌ヨ
 const resetQuery = () => {
   Object.keys(queryParams).forEach((key) => {
-    if (key !== "pageNum" && key !== "pageSize") {
+    if (key !== "current" && key !== "pageSize") {
       queryParams[key] = "";
     }
   });
@@ -133,9 +166,18 @@
   handleAddEdit();
 };
 // 鏂板缂栬緫
+const productionDialogs = ref(null); // 娣诲姞ref澹版槑
+
 const handleAddEdit = () => {
   addOrEdit.value == "add" ? (title.value = "鏂板") : (title.value = "缂栬緫");
   title.value = title.value + "閲囪喘淇℃伅";
+  
+  // 姝g‘浣跨敤瀛愮粍浠秗ef
+  if (productionDialogs.value) {
+    // 杩欓噷鍙互璋冪敤瀛愮粍浠剁殑鏂规硶
+    console.log("瀛愮粍浠跺疄渚�:", productionDialogs.value.getDropdownData());
+  }
+  
   openDialog();
 };
 // 鎵撳紑寮圭獥
@@ -144,6 +186,7 @@
     // 纭繚澶嶅埗涓�浠芥暟鎹紝閬垮厤鐩存帴寮曠敤
     copyForm.value = JSON.parse(JSON.stringify(form.value));
     dialogFormVisible.value = true;
+    // 瑙﹀彂ref閲岄潰鐨勬柟娉�
     return;
   }
   // 鏂板缓鏃跺垵濮嬪寲琛ㄥ崟
@@ -158,7 +201,7 @@
     totalPriceIncludingTax: "",
     taxRate: "",
     registrantId: userInfo.value.userName,
-    registrationDate: new Date().toISOString().split('T')[0]
+    registrationDate: new Date().toISOString().split("T")[0],
   };
   // 鏂板缓鏃朵篃闇�瑕佽缃� copyForm 鐢ㄤ簬閲嶇疆鍔熻兘
   copyForm.value = JSON.parse(JSON.stringify(form.value));
@@ -183,22 +226,18 @@
 const handleEdit = (row) => {
   form.value = JSON.parse(JSON.stringify(row));
   addOrEdit.value = "edit";
-  handleAddEdit()
+  handleAddEdit();
 };
 const handleDelete = () => {
   if (selectedRows.value.length === 0) {
     ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
     return;
   }
-  ElMessageBox.confirm(
-    `纭畾鍒犻櫎閫変腑鐨勬暟鎹悧锛焋,
-    "鎻愮ず",
-    {
-      confirmButtonText: "纭畾",
-      cancelButtonText: "鍙栨秷",
-      type: "warning"
-    }
-  )
+  ElMessageBox.confirm(`纭畾鍒犻櫎閫変腑鐨勬暟鎹悧锛焋, "鎻愮ず", {
+    confirmButtonText: "纭畾",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
     .then(() => {
       // 妯℃嫙鍒犻櫎鎿嶄綔
       tableData.value = tableData.value.filter(
@@ -210,15 +249,19 @@
     .catch(() => {
       ElMessage.info("宸插彇娑堝垹闄�");
     });
-}
+};
 const handleDeleteSuccess = (row) => {
   ElMessage.success("鍒犻櫎鎴愬姛锛�" + row.supplierName);
 };
 // 瀵煎嚭
 const handleExport = (row) => {
-  proxy.download("system/post/export", {
-    ...queryParams.value
-  }, `post_${new Date().getTime()}.xlsx`)
+  proxy.download(
+    "system/post/export",
+    {
+      ...queryParams.value,
+    },
+    `post_${new Date().getTime()}.xlsx`
+  );
   ElMessage.success("瀵煎嚭鏁版嵁锛�" + row.supplierName);
 };
 // 鎴愬姛
@@ -233,9 +276,9 @@
   try {
     // 浼犻�掑垎椤靛弬鏁�
     let res = await purchaseRegistration({
-      pageNum: pageNum.value,
+      current: current.value,
       pageSize: pageSize.value,
-      ...queryParams
+      ...queryParams,
     });
     if (res && res.data) {
       tableData.value = res.data.records || [];
@@ -295,10 +338,10 @@
 }
 /* 琛ㄦ牸宸ュ叿鏍� */
 .table-toolbar,
-.table-toolbar>* {
+.table-toolbar > * {
   margin: 0 0 0 0 !important;
 }
-.table-toolbar{
+.table-toolbar {
   margin-bottom: 20px !important;
 }
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/production/components/ProductionDialog.vue b/src/views/production/components/ProductionDialog.vue
index 035d75a..07772d6 100644
--- a/src/views/production/components/ProductionDialog.vue
+++ b/src/views/production/components/ProductionDialog.vue
@@ -8,7 +8,6 @@
   >
     <el-button type="primary" @click="handlData">閫夋嫨鏁版嵁</el-button>
     <ETable
-      v-if="tableData.length > 0"
       :columns="columns"
       height="200"
       @cell-edit="handleCellEdit"
@@ -19,7 +18,7 @@
     />
     <div class="empty-table">
     <h1>鐢熶骇鏄庣粏</h1>
-      <el-row :gutter="10" v-if="tableData.length > 0">
+      <el-row :gutter="10">
       <el-col :span="2">
         <el-button type="primary" @click="addNewRow">
           <el-icon>
@@ -45,7 +44,6 @@
       </el-col> -->
     </el-row>
     <ProductionDetailsTable
-     v-if="tableData.length > 0"
       v-model="detailsTableData"
       :border="false"
       :show-operations="true"
@@ -53,7 +51,6 @@
       @input-change="handleDetailsChange"
       @delete-row="handleDeleteRow"
     />
-      <div style="margin-top: 20px;" v-else>鏆傛棤鏁版嵁锛岃閫夋嫨閰嶇疆鏁版嵁</div>
 
     </div>
 
@@ -129,16 +126,7 @@
   { label: "鏈浣跨敤鏁伴噺", prop: "used" },
 ];
 const detailsTableData = ref([
-  {
-    coalType: "",
-    calorificValue: "",
-    productionQuantity: "",
-    laborCost: "",
-    energyCost: "",
-    equipmentDepreciation: "",
-    purchasePrice: "",
-    totalCost: "",
-  },
+  
 ]);
 const handleRowClick = (row) => {
   currentRow.value = row;

--
Gitblit v1.9.3