From 79fb20a2102f2d6a050b83f20477aa13b221f096 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 26 三月 2026 09:16:29 +0800
Subject: [PATCH] 军泰伟业 1.bom添加可以按bom添加物料清单功能,并不用绑定工序

---
 src/views/basicData/product/index.vue |  866 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 483 insertions(+), 383 deletions(-)

diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index 3aa263e..62550ae 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -1,93 +1,60 @@
 <template>
   <div class="app-container product-view">
-    <div class="left">
-      <div>
-        <el-input
-          v-model="search"
-          style="width: 210px"
-          placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�"
-          @change="searchFilter"
-          @clear="searchFilter"
-          clearable
-          prefix-icon="Search"
-        />
-        <el-button
-          type="primary"
-          @click="openProDia('addOne')"
-          style="margin-left: 10px"
-          >鏂板浜у搧澶х被</el-button
-        >
+    <div class="main-content">
+      <div class="search-section">
+        <el-form :inline="true" :model="queryForm" class="search-form">
+          <el-form-item label="浜у搧鍚嶇О">
+            <el-input
+              v-model="queryForm.productName"
+              placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
+              clearable
+              style="width: 200px"
+              @keyup.enter="handleSearch"
+            />
+          </el-form-item>
+          <el-form-item label="鍥剧焊缂栧彿">
+            <el-input
+              v-model="queryForm.model"
+              placeholder="璇疯緭鍏ュ浘绾哥紪鍙�"
+              clearable
+              style="width: 200px"
+              @keyup.enter="handleSearch"
+            />
+          </el-form-item>
+          <el-form-item label="浜у搧灞炴��">
+            <el-select
+              v-model="queryForm.productType"
+              placeholder="璇烽�夋嫨浜у搧灞炴��"
+              clearable
+              style="width: 150px"
+            >
+              <el-option label="鑷埗" :value="1" />
+              <el-option label="澶栬喘" :value="2" />
+              <el-option label="濮斿" :value="3" />
+            </el-select>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="handleSearch" icon="Search">
+              鎼滅储
+            </el-button>
+            <el-button @click="handleReset" icon="Refresh">
+              閲嶇疆
+            </el-button>
+          </el-form-item>
+        </el-form>
+        <div class="action-buttons">
+          <el-button type="primary" @click="openModelDia('add')" icon="Plus">
+            鏂板浜у搧
+          </el-button>
+          <el-button type="success" @click="handleImport" icon="Upload">
+            瀵煎叆
+          </el-button>
+          <el-button type="danger" @click="handleDelete" icon="Delete" plain>
+            鍒犻櫎
+          </el-button>
+        </div>
       </div>
-      <div ref="containerRef">
-        <el-tree
-          ref="tree"
-          v-loading="treeLoad"
-          :data="list"
-          @node-click="handleNodeClick"
-          :expand-on-click-node="false"
-          default-expand-all
-          :default-expanded-keys="expandedKeys"
-          :draggable="true"
-          :filter-node-method="filterNode"
-          :props="{ children: 'children', label: 'label' }"
-          highlight-current
-          node-key="id"
-          style="
-            height: calc(100vh - 190px);
-            overflow-y: scroll;
-            scrollbar-width: none;
-          "
-        >
-          <template #default="{ node, data }">
-            <div class="custom-tree-node">
-              <span class="tree-node-content">
-                <el-icon class="orange-icon">
-                  <component :is="data.children && data.children.length > 0
-                  ? node.expanded ? 'FolderOpened' : 'Folder' : 'Tickets'" />
-                </el-icon>
-                {{ data.label }}
-              </span>
-              <div>
-                <el-button
-                  type="primary"
-                  link
-                  @click="openProDia('edit', data)"
-                >
-                  缂栬緫
-                </el-button>
-                <el-button type="primary" link @click="openProDia('add', data)" :disabled="node.level >= 3">
-                  娣诲姞浜у搧
-                </el-button>
-                <el-button
-                  v-if="!node.childNodes.length"
-                  style="margin-left: 4px"
-                  type="danger"
-                  link
-                  @click="remove(node, data)"
-                >
-                  鍒犻櫎
-                </el-button>
-              </div>
-            </div>
-          </template>
-        </el-tree>
-      </div>
-    </div>
-    <div class="right">
-      <div style="margin-bottom: 10px" v-if="isShowButton">
-        <el-button type="primary" @click="openModelDia('add')">
-          鏂板瑙勬牸鍨嬪彿
-        </el-button>
-        <ImportExcel @uploadSuccess="getModelList" />
-        <el-button
-          type="danger"
-          @click="handleDelete"
-          style="margin-left: 10px"
-          plain
-        >
-          鍒犻櫎
-        </el-button>
-      </div>
+
       <PIMTable
         rowKey="id"
         :column="tableColumn"
@@ -99,123 +66,214 @@
         @pagination="pagination"
       ></PIMTable>
     </div>
-    <el-dialog v-model="productDia" title="浜у搧" width="400px" @keydown.enter.prevent>
-      <el-form
-        :model="form"
-        label-width="140px"
-        label-position="top"
-        :rules="rules"
-        ref="formRef"
-      >
-        <el-row :gutter="30">
-          <el-col :span="24">
-            <el-form-item label="浜у搧鍚嶇О锛�" prop="productName">
-              <el-input
-                v-model="form.productName"
-                placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
-                clearable
-                @keydown.enter.prevent
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭</el-button>
-          <el-button @click="closeProDia">鍙栨秷</el-button>
-        </div>
-      </template>
-    </el-dialog>
-    <el-dialog
+
+    <FormDialog
       v-model="modelDia"
-      title="瑙勬牸鍨嬪彿"
-      width="400px"
+      title="浜у搧淇℃伅"
+      width="500px"
       @close="closeModelDia"
-      @keydown.enter.prevent
+      @confirm="submitModelForm"
     >
       <el-form
         :model="modelForm"
-        label-width="140px"
-        label-position="top"
+        label-width="100px"
         :rules="modelRules"
         ref="modelFormRef"
       >
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
-              <el-input
-                v-model="modelForm.model"
-                placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�"
-                clearable
-                @keydown.enter.prevent
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="鍗曚綅锛�" prop="unit">
-              <el-input
-                v-model="modelForm.unit"
-                placeholder="璇疯緭鍏ュ崟浣�"
-                clearable
-                @keydown.enter.prevent
-              />
-            </el-form-item>
-          </el-col>
-        </el-row>
+        <el-form-item label="浜у搧鍚嶇О" prop="productName">
+          <el-input
+            v-model="modelForm.productName"
+            placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
+            clearable
+            maxlength="50"
+            show-word-limit
+          />
+        </el-form-item>
+        <el-form-item label="鍥剧焊缂栧彿" prop="model">
+          <el-input
+            v-model="modelForm.model"
+            placeholder="璇疯緭鍏ュ浘绾哥紪鍙�"
+            clearable
+          />
+        </el-form-item>
+        <el-form-item label="鍗曚綅" prop="unit">
+          <el-select
+            v-model="modelForm.unit"
+            placeholder="璇烽�夋嫨鍗曚綅"
+            clearable
+            style="width: 100%"
+          >
+            <el-option label="浠�" value="浠�" />
+            <el-option label="濂�" value="濂�" />
+            <el-option label="鍙�" value="鍙�" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="浜у搧灞炴��" prop="productType">
+          <el-select
+            v-model="modelForm.productType"
+            placeholder="璇烽�夋嫨浜у搧灞炴��"
+            clearable
+            style="width: 100%"
+          >
+            <el-option label="鑷埗" :value="1" />
+            <el-option label="澶栬喘" :value="2" />
+            <el-option label="濮斿" :value="3" />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="宸ヨ壓璺嚎" prop="routeId">
+          <el-select
+            v-model="modelForm.routeId"
+            placeholder="璇烽�夋嫨宸ヨ壓璺嚎"
+            clearable
+            style="width: 100%"
+            filterable
+          >
+            <el-option
+              v-for="item in processRouteList"
+              :key="item.id"
+              :label="item.processRouteName"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="涓婁紶鍥剧焊" prop="drawingFile">
+          <el-upload
+            v-model:file-list="drawingFileList"
+            :action="upload.url"
+            :headers="upload.headers"
+            :data="upload.data"
+            :on-success="handleDrawingUploadSuccess"
+            :on-remove="handleDrawingRemove"
+            :before-upload="handleDrawingBeforeUpload"
+            :limit="1"
+            accept=".pdf,.jpg,.jpeg,.png,.dwg"
+            list-type="picture-card"
+          >
+            <el-icon class="avatar-uploader-icon"><Plus /></el-icon>
+            <template #tip>
+              <div class="el-upload__tip">
+                鏀寔 pdf銆乯pg銆乯peg銆乸ng銆乨wg 鏍煎紡锛屽ぇ灏忎笉瓒呰繃 10MB
+              </div>
+            </template>
+          </el-upload>
+        </el-form-item>
       </el-form>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button type="primary" @click="submitModelForm">纭</el-button>
-          <el-button @click="closeModelDia">鍙栨秷</el-button>
+    </FormDialog>
+
+    <FormDialog
+      v-model="importDia"
+      title="浜у搧瀵煎叆"
+      width="600px"
+      @cancel="importDia = false"
+      @confirm="submitImport"
+    >
+      <el-upload
+        ref="importUploadRef"
+        :limit="1"
+        accept=".xlsx,.xls"
+        :action="importUpload.url"
+        :headers="importUpload.headers"
+        :before-upload="importUpload.beforeUpload"
+        :on-success="importUpload.onSuccess"
+        :on-error="importUpload.onError"
+        :on-progress="importUpload.onProgress"
+        :on-change="importUpload.onChange"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em>
         </div>
-      </template>
-    </el-dialog>
+        <template #tip>
+          <div class="el-upload__tip">
+            浠呮敮鎸� xls/xlsx锛屽ぇ灏忎笉瓒呰繃 10MB銆�
+            <el-button link type="primary" @click="importTemplate">涓嬭浇瀵煎叆妯℃澘</el-button>
+          </div>
+        </template>
+      </el-upload>
+    </FormDialog>
   </div>
 </template>
 
 <script setup>
-import { ref } from "vue";
+import { ref, reactive, onMounted } from "vue";
 import { ElMessageBox } from "element-plus";
+import { Plus } from "@element-plus/icons-vue";
+import { getToken } from "@/utils/auth.js";
+import FormDialog from "@/components/Dialog/FormDialog.vue";
 import {
-  addOrEditProduct,
   addOrEditProductModel,
   delProduct,
-  delProductModel,
-  modelListPage,
-  productTreeList,
+  productListPage,
+  downloadTemplate,
 } from "@/api/basicData/product.js";
+import { listPage as getProcessRouteList } from "@/api/productionManagement/processRoute.js";
 import ImportExcel from "./ImportExcel/index.vue";
 
 const { proxy } = getCurrentInstance();
-const tree = ref(null);
-const containerRef = ref(null);
+const importUploadRef = ref(null);
 
-const productDia = ref(false);
 const modelDia = ref(false);
+const importDia = ref(false);
 const modelOperationType = ref("");
-const search = ref("");
-const currentId = ref("");
-const currentParentId = ref("");
-const operationType = ref("");
-const treeLoad = ref(false);
-const list = ref([]);
-const expandedKeys = ref([]);
+const tableData = ref([]);
+const tableLoading = ref(false);
+const selectedRows = ref([]);
+const modelFormRef = ref();
+const processRouteList = ref([]);
+const drawingFileList = ref([]);
+
+const upload = reactive({
+  url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
+  headers: { Authorization: "Bearer " + getToken() },
+  data: { type: 13 },
+});
+
+const queryForm = reactive({
+  productName: "",
+  model: "",
+  productType: null,
+});
+
+const page = reactive({
+  current: 1,
+  size: 50,
+  total: 0,
+});
+
 const tableColumn = ref([
   {
-    label: "瑙勬牸鍨嬪彿",
+    label: "浜у搧鍚嶇О",
+    prop: "productName",
+    minWidth: 200,
+  },
+  {
+    label: "鍥剧焊缂栧彿",
     prop: "model",
+    minWidth: 150,
   },
   {
     label: "鍗曚綅",
     prop: "unit",
+    minWidth: 100,
+  },
+  {
+    label: "浜у搧灞炴��",
+    prop: "productType",
+    width: 100,
+    dataType: "tag",
+    formatData: (v) => ({ "1": "鑷埗", "2": "澶栬喘", "3": "濮斿" }[String(v)] ?? v),
+    formatType: (v) => {
+      const typeMap = { "1": "success", "2": "warning", "3": "info" };
+      return typeMap[String(v)] || "info";
+    },
   },
   {
     dataType: "action",
     label: "鎿嶄綔",
     align: "center",
+    width: 100,
     operation: [
       {
         name: "缂栬緫",
@@ -227,174 +285,118 @@
     ],
   },
 ]);
-const tableData = ref([]);
-const tableLoading = ref(false);
-const isShowButton = ref(false);
-const selectedRows = ref([]);
-const page = reactive({
-  current: 1,
-  size: 10,
-  total: 0,
-});
+
 const data = reactive({
-  form: {
-    productName: "",
-  },
-  rules: {
-    productName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-  },
   modelForm: {
+    productName: "",
     model: "",
     unit: "",
+    productType: null,
+    routeId: null,
+    drawingFile: "",
+    tempFileIds: [],
+    salesLedgerFiles: [],
   },
   modelRules: {
-    model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-    unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+    productName: [
+      { required: true, message: "璇疯緭鍏ヤ骇鍝佸悕绉�", trigger: "blur" },
+      { max: 50, message: "浜у搧鍚嶇О涓嶈兘瓒呰繃50涓瓧绗�", trigger: "blur" },
+    ],
+    model: [{ required: true, message: "璇疯緭鍏ュ浘绾哥紪鍙�", trigger: "blur" }],
+    unit: [{ required: true, message: "璇烽�夋嫨鍗曚綅", trigger: "change" }],
+    productType: [{ required: true, message: "璇烽�夋嫨浜у搧灞炴��", trigger: "change" }],
   },
 });
-const { form, rules, modelForm, modelRules } = toRefs(data);
-// 鏌ヨ浜у搧鏍�
-const getProductTreeList = () => {
-  treeLoad.value = true;
-  productTreeList()
-    .then((res) => {
-      list.value = res;
-      list.value.forEach((a) => {
-        expandedKeys.value.push(a.label);
-      });
-      treeLoad.value = false;
-    })
-    .catch((err) => {
-      treeLoad.value = false;
-    });
-};
-// 杩囨护浜у搧鏍�
-const searchFilter = () => {
-  proxy.$refs.tree.filter(search.value);
-};
-// 鎵撳紑浜у搧寮规
-const openProDia = (type, data) => {
-  operationType.value = type;
-  productDia.value = true;
-  form.value.productName = "";
-  if (type === "edit") {
-    form.value.productName = data.productName;
-  }
-};
-// 鎵撳紑瑙勬牸鍨嬪彿寮规
-const openModelDia = (type, data) => {
-  modelOperationType.value = type;
-  modelDia.value = true;
-  modelForm.value.model = "";
-  modelForm.value.model = "";
-  modelForm.value.id = "";
-  if (type === "edit") {
-    modelForm.value = { ...data };
-  }
-};
-// 鎻愪氦浜у搧鍚嶇О淇敼
-const submitForm = () => {
-  proxy.$refs.formRef.validate((valid) => {
-    if (valid) {
-      if (operationType.value === "add") {
-        form.value.parentId = currentId.value;
-        form.value.id = "";
-      } else if (operationType.value === "addOne") {
-        form.value.id = "";
-        form.value.parentId = "";
-      } else {
-        form.value.id = currentId.value;
-        form.value.parentId = "";
-      }
-      addOrEditProduct(form.value).then((res) => {
-        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
-        closeProDia();
-        getProductTreeList();
-      });
+const { modelForm, modelRules } = toRefs(data);
+
+const importUpload = reactive({
+  title: "浜у搧瀵煎叆",
+  open: false,
+  url: import.meta.env.VITE_APP_BASE_API + "/basic/product/import",
+  headers: { Authorization: "Bearer " + getToken() },
+  isUploading: false,
+  beforeUpload: (file) => {
+    const isExcel = file.name.endsWith('.xlsx') || file.name.endsWith('.xls');
+    const isLt10M = file.size / 1024 / 1024 < 10;
+    if (!isExcel) {
+      proxy.$modal.msgError("涓婁紶鏂囦欢鍙兘鏄� xlsx/xls 鏍煎紡!");
+      return false;
     }
-  });
-};
-// 鍏抽棴浜у搧寮规
-const closeProDia = () => {
-  proxy.$refs.formRef.resetFields();
-  productDia.value = false;
-};
-// 灏佽涓�涓畨鍏ㄧ殑纭妗嗭紝褰诲簳闃绘Enter閿Е鍙�
-const safeConfirm = (message, title) => {
-  // 鏍囪鏄惁鏄紶鏍囩偣鍑伙紙鐐瑰嚮鎸夐挳浼氳Е鍙慺ocus浜嬩欢锛�
-  let isMouseClick = false;
-
-  return new Promise((resolve, reject) => {
-    const box = ElMessageBox.confirm(message, title, {
-      confirmButtonText: "纭",
-      cancelButtonText: "鍙栨秷",
-      type: "warning",
-      beforeClose: (action, instance, done) => {
-        if (action === "confirm") {
-          // 鍙湁榧犳爣鐐瑰嚮鏃舵墠鍏佽纭
-          if (isMouseClick) {
-            done();
-            resolve();
-          } else {
-            // Enter閿Е鍙戞椂闃绘
-            done(false);
-          }
-        } else {
-          // 鍙栨秷鎿嶄綔鐩存帴鍏佽
-          done();
-          reject();
-        }
+    if (!isLt10M) {
+      proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB!");
+      return false;
+    }
+    return true;
+  },
+  onChange: (file, fileList) => {
+    console.log('鏂囦欢鐘舵�佹敼鍙�', file, fileList);
+  },
+  onProgress: (event, file, fileList) => {
+    console.log('涓婁紶涓�...', event.percent);
+  },
+  onSuccess: (response, file, fileList) => {
+    console.log('涓婁紶鎴愬姛', response, file, fileList);
+    importUpload.isUploading = false;
+    if (response.code === 200) {
+      proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
+      importDia.value = false;
+      if (importUploadRef.value) {
+        importUploadRef.value.clearFiles();
       }
-    });
+      getModelList();
+    } else {
+      proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
+    }
+  },
+  onError: (error, file, fileList) => {
+    console.log('涓婁紶澶辫触', error, file, fileList);
+    importUpload.isUploading = false;
+    proxy.$modal.msgError("瀵煎叆澶辫触");
+  }
+});
 
-    // 鐩戝惉纭鎸夐挳鐨刦ocus浜嬩欢锛堥紶鏍囩偣鍑讳細瑙﹀彂锛孍nter閿笉浼氾級
-    setTimeout(() => {
-      const confirmBtn = document.querySelector('.el-message-box__btns .el-button--primary');
-      if (confirmBtn) {
-        confirmBtn.addEventListener('focus', () => {
-          isMouseClick = true;
-        });
-      }
-    }, 0); // 寤惰繜鑾峰彇锛岀‘淇滵OM宸叉覆鏌�
-  });
-};
-// 鍒犻櫎浜у搧
-// 鍒犻櫎浜у搧
-const remove = (node, data) => {
-  let ids = [data.id];
-  // 浣跨敤灏佽鐨剆afeConfirm
-  safeConfirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず")
-    .then(() => {
-      // 纭鍒犻櫎閫昏緫
-      tableLoading.value = true;
-      delProduct(ids)
-        .then((res) => {
-          proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-          getProductTreeList();
-        })
-        .finally(() => {
-          tableLoading.value = false;
-        });
-    })
-    .catch(() => {
-      proxy.$modal.msg("宸插彇娑�");
-    });
-};
-// 閫夋嫨浜у搧
-const handleNodeClick = (val, node, el) => {
-  // 鍒ゆ柇鏄惁涓哄彾瀛愯妭鐐�
-  isShowButton.value = !(val.children && val.children.length > 0);
-  // 鍙湁鍙跺瓙鑺傜偣鎵嶆墽琛屼互涓嬮�昏緫
-  currentId.value = val.id;
-  currentParentId.value = val.parentId;
+const handleSearch = () => {
+  page.current = 1;
   getModelList();
 };
 
-// 鎻愪氦瑙勬牸鍨嬪彿淇敼
+const handleReset = () => {
+  queryForm.productName = "";
+  queryForm.model = "";
+  queryForm.productType = null;
+  page.current = 1;
+  getModelList();
+};
+
+const openModelDia = (type, data) => {
+  modelOperationType.value = type;
+  modelDia.value = true;
+  modelForm.value.productName = "";
+  modelForm.value.model = "";
+  modelForm.value.id = "";
+  modelForm.value.unit = "";
+  modelForm.value.productType = null;
+  modelForm.value.routeId = null;
+  modelForm.value.drawingFile = "";
+  modelForm.value.tempFileIds = [];
+  modelForm.value.salesLedgerFiles = [];
+  drawingFileList.value = [];
+  if (type === "edit") {
+    modelForm.value = { ...data };
+    modelForm.value.tempFileIds = data.tempFileIds || [];
+    modelForm.value.salesLedgerFiles = data.salesLedgerFiles || [];
+    if (data.drawingFile) {
+      drawingFileList.value = [{
+        name: data.drawingFile.split('/').pop(),
+        url: data.drawingFile
+      }];
+    }
+  }
+};
+
 const submitModelForm = () => {
-  proxy.$refs.modelFormRef.validate((valid) => {
+  modelFormRef.value.validate((valid) => {
     if (valid) {
-      modelForm.value.productId = currentId.value;
       addOrEditProductModel(modelForm.value).then((res) => {
         proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
         closeModelDia();
@@ -403,36 +405,39 @@
     }
   });
 };
-// 鍏抽棴鍨嬪彿寮规
+
 const closeModelDia = () => {
-  proxy.$refs.modelFormRef.resetFields();
+  modelFormRef.value.resetFields();
   modelDia.value = false;
 };
-// 琛ㄦ牸閫夋嫨鏁版嵁
+
 const handleSelectionChange = (selection) => {
   selectedRows.value = selection;
 };
 
-// 鏌ヨ瑙勬牸鍨嬪彿
 const pagination = (obj) => {
   page.current = obj.page;
   page.size = obj.limit;
   getModelList();
 };
+
 const getModelList = () => {
   tableLoading.value = true;
-  modelListPage({
-    id: currentId.value,
+  productListPage({
+    productName: queryForm.productName.trim(),
+    model: queryForm.model.trim(),
+    productType: queryForm.productType,
     current: page.current,
     size: page.size,
   }).then((res) => {
-    console.log("res", res);
-    tableData.value = res.records;
-    page.total = res.total;
+    tableData.value = res.data.records;
+    page.total = res.data.total;
+    tableLoading.value = false;
+  }).catch(() => {
     tableLoading.value = false;
   });
 };
-// 鍒犻櫎瑙勬牸鍨嬪彿
+
 const handleDelete = () => {
   let ids = [];
   if (selectedRows.value.length > 0) {
@@ -441,10 +446,14 @@
     proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
     return;
   }
-  safeConfirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず")
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
+  })
     .then(() => {
       tableLoading.value = true;
-      delProductModel(ids)
+      delProduct(ids)
         .then((res) => {
           proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
           getModelList();
@@ -457,76 +466,167 @@
       proxy.$modal.msg("宸插彇娑�");
     });
 };
-// 璋冪敤tree杩囨护鏂规硶 涓枃鑻辫繃婊�
-const filterNode = (value, data, node) => {
-  if (!value) {
-    //濡傛灉鏁版嵁涓虹┖锛屽垯杩斿洖true,鏄剧ず鎵�鏈夌殑鏁版嵁椤�
-    return true;
+
+const handleImport = () => {
+  importDia.value = true;
+  if (importUploadRef.value) {
+    importUploadRef.value.clearFiles();
   }
-  // 鏌ヨ鍒楄〃鏄惁鏈夊尮閰嶆暟鎹紝灏嗗�煎皬鍐欙紝鍖归厤鑻辨枃鏁版嵁
-  let val = value.toLowerCase();
-  return chooseNode(val, data, node); // 璋冪敤杩囨护浜屽眰鏂规硶
 };
-// 杩囨护鐖惰妭鐐� / 瀛愯妭鐐� (濡傛灉杈撳叆鐨勫弬鏁版槸鐖惰妭鐐逛笖鑳藉尮閰嶏紝鍒欒繑鍥炶鑺傜偣浠ュ強鍏朵笅鐨勬墍鏈夊瓙鑺傜偣锛涘鏋滃弬鏁版槸瀛愯妭鐐癸紝鍒欒繑鍥炶鑺傜偣鐨勭埗鑺傜偣銆俷ame鏄腑鏂囧瓧绗︼紝enName鏄嫳鏂囧瓧绗�.
-const chooseNode = (value, data, node) => {
-  if (data.label.indexOf(value) !== -1) {
-    return true;
-  }
-  const level = node.level;
-  // 濡傛灉浼犲叆鐨勮妭鐐规湰韬氨鏄竴绾ц妭鐐瑰氨涓嶇敤鏍¢獙浜�
-  if (level === 1) {
+
+const submitImport = () => {
+  importUploadRef.value.submit();
+};
+
+const importTemplate = () => {
+  proxy.download("/basic/product/downloadTemplate", {}, "浜у搧瀵煎叆妯℃澘.xlsx");
+};
+
+const getProcessRouteListData = () => {
+  getProcessRouteList({ current: 1, size: 1000 }).then((res) => {
+    processRouteList.value = res.data.records || [];
+  }).catch(() => {
+    processRouteList.value = [];
+  });
+};
+
+const handleDrawingBeforeUpload = (file) => {
+  const isAllowed = [
+    'application/pdf',
+    'image/jpeg',
+    'image/jpg',
+    'image/png',
+    'application/dwg'
+  ].includes(file.type) || file.name.endsWith('.dwg');
+  const isLt10M = file.size / 1024 / 1024 < 10;
+  
+  if (!isAllowed) {
+    proxy.$modal.msgError("鍙兘涓婁紶 pdf銆乯pg銆乯peg銆乸ng銆乨wg 鏍煎紡鐨勬枃浠讹紒");
     return false;
   }
-  // 鍏堝彇褰撳墠鑺傜偣鐨勭埗鑺傜偣
-  let parentData = node.parent;
-  // 閬嶅巻褰撳墠鑺傜偣鐨勭埗鑺傜偣
-  let index = 0;
-  while (index < level - 1) {
-    // 濡傛灉鍖归厤鍒扮洿鎺ヨ繑鍥烇紝姝ゅname鍊兼槸涓枃瀛楃锛宔nName鏄嫳鏂囧瓧绗︺�傚垽鏂尮閰嶄腑鑻辨枃杩囨护
-    if (parentData.data.label.indexOf(value) !== -1) {
-      return true;
-    }
-    // 鍚﹀垯鐨勮瘽鍐嶅線涓婁竴灞傚仛鍖归厤
-    parentData = parentData.parent;
-    index++;
+  if (!isLt10M) {
+    proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB锛�");
+    return false;
   }
-  // 娌″尮閰嶅埌杩斿洖false
-  return false;
+  return true;
 };
-getProductTreeList();
+
+const handleDrawingUploadSuccess = (response, file, fileList) => {
+  console.log('涓婁紶鎴愬姛鍝嶅簲', response);
+  console.log('response.data', response.data);
+  if (response.code === 200) {
+    modelForm.value.tempFileIds = [response.data?.tempId];
+    modelForm.value.salesLedgerFiles = [{
+      tempId: response.data?.tempId,
+      originalName: response.data?.originalName || file.name,
+      tempPath: response.data?.tempPath,
+      type: response.data?.type || 13
+    }];
+    proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+  } else {
+    proxy.$modal.msgError(response.msg || "涓婁紶澶辫触");
+  }
+};
+
+const handleDrawingRemove = (file) => {
+  modelForm.value.tempFileIds = [];
+  modelForm.value.salesLedgerFiles = [];
+};
+
+onMounted(() => {
+  getModelList();
+  getProcessRouteListData();
+});
 </script>
 
 <style scoped>
 .product-view {
-  display: flex;
+  padding: 20px;
+  background: #f5f7fa;
+  min-height: 100vh;
 }
-.left {
-  width: 380px;
-  padding: 16px;
+
+.main-content {
   background: #ffffff;
+  border-radius: 8px;
+  padding: 24px;
+  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
 }
-.right {
-  width: calc(100% - 380px);
-  padding: 16px;
-  margin-left: 20px;
-  background: #ffffff;
+
+.search-section {
+  margin-bottom: 20px;
+  padding-bottom: 20px;
+  border-bottom: 1px solid #e4e7ed;
 }
-.custom-tree-node {
-  flex: 1;
+
+.search-form {
   display: flex;
+  flex-wrap: wrap;
+  gap: 12px;
   align-items: center;
-  justify-content: space-between;
-  font-size: 14px;
-  padding-right: 8px;
 }
-.tree-node-content {
+
+.search-form :deep(.el-form-item) {
+  margin-bottom: 12px;
+}
+
+.action-buttons {
   display: flex;
-  align-items: center; /* 鍨傜洿灞呬腑 */
-  height: 100%;
+  gap: 10px;
+  margin-top: 16px;
 }
-.orange-icon {
-  color: orange;
-  font-size: 18px;
-  margin-right: 8px; /* 鍥炬爣涓庢枃瀛椾箣闂村姞鐐归棿璺� */
+
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 148px;
+  height: 148px;
+  text-align: center;
+  line-height: 148px;
+}
+
+:deep(.el-upload--picture-card) {
+  width: 148px;
+  height: 148px;
+}
+
+:deep(.el-upload-list__item) {
+  width: 148px;
+  height: 148px;
+}
+
+:deep(.el-upload__tip) {
+  font-size: 12px;
+  color: #909399;
+  margin-top: 8px;
+}
+
+:deep(.el-dialog__body) {
+  padding: 20px 24px;
+}
+
+:deep(.el-form-item__label) {
+  font-weight: 500;
+  color: #303133;
+}
+
+:deep(.el-input__inner) {
+  border-radius: 4px;
+}
+
+:deep(.el-button) {
+  border-radius: 4px;
+  font-weight: 500;
+}
+
+:deep(.el-upload-dragger) {
+  border-radius: 8px;
+  border: 2px dashed #dcdfe6;
+  transition: all 0.3s;
+}
+
+:deep(.el-upload-dragger:hover) {
+  border-color: #409eff;
+  background-color: #f5f7fa;
 }
 </style>

--
Gitblit v1.9.3