From 19aa78a505d468739a61054f07d0840477192b2d Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 27 三月 2026 10:10:10 +0800
Subject: [PATCH] 军泰伟业 1.产品维护列表展示工艺路线

---
 src/views/basicData/product/index.vue |  898 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 575 insertions(+), 323 deletions(-)

diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index dba78e3..940c4b5 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -1,385 +1,637 @@
 <template>
   <div class="app-container product-view">
-    <div class="left">
-      <div>
-        <el-input
-            v-model="search"
-            style="width: 240px"
-            placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�"
-            @change="searchFilter"
-            @clear="searchFilter"
+    <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>
+
+      <PIMTable
+        rowKey="id"
+        :column="tableColumn"
+        :tableData="tableData"
+        :page="page"
+        :isSelection="true"
+        @selection-change="handleSelectionChange"
+        :tableLoading="tableLoading"
+        @pagination="pagination"
+      ></PIMTable>
+    </div>
+
+    <FormDialog
+      v-model="modelDia"
+      title="浜у搧淇℃伅"
+      width="500px"
+      @close="closeModelDia"
+      @confirm="submitModelForm"
+    >
+      <el-form
+        :model="modelForm"
+        label-width="100px"
+        :rules="modelRules"
+        ref="modelFormRef"
+      >
+        <el-form-item label="浜у搧鍚嶇О" prop="productName">
+          <el-input
+            v-model="modelForm.productName"
+            placeholder="璇疯緭鍏ヤ骇鍝佸悕绉�"
             clearable
-            prefix-icon="Search"
-        />
-        <el-button type="primary" @click="openProDia('add')" style="margin-left: 10px">鏂板浜у搧</el-button>
-      </div>
-      <div>
-        <el-tree ref="tree" v-loading="treeLoad" :data="list" @node-click="handleNodeClick"
-                 :expand-on-click-node="false"
-                 :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>{{ node.label }}</span>
-              <div>
-                <el-button type="primary" link @click="openProDia('edit', data)">
-                  缂栬緫
-                </el-button>
-                <!-- 淇敼姝ゅ -->
-                <el-button
-                    v-if="!node.childNodes.length"
-                    style="margin-left: 4px"
-                    type="danger"
-                    link
-                    @click="remove(node, data)"
-                >
-                  鍒犻櫎
-                </el-button>
+            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>
-            </div>
-          </template>
-        </el-tree>
-      </div>
-    </div>
-    <div class="right">
-      <div style="margin-bottom: 10px">
-        <el-button type="primary" @click="openModelDia('add')">鏂板瑙勬牸鍨嬪彿</el-button>
-        <el-button type="danger" @click="handleDelete" style="margin-left: 10px" plain>鍒犻櫎</el-button>
-      </div>
-      <PIMTable :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" :handleSelectionChange="handleSelectionChange"
-                :tableLoading="tableLoading" @pagination="pagination" :total="total"></PIMTable>
-    </div>
-    <el-dialog v-model="productDia" title="浜у搧" width="400px">
-      <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/>
-            </el-form-item>
-          </el-col>
-        </el-row>
+            </template>
+          </el-upload>
+        </el-form-item>
       </el-form>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">纭</el-button>
-          <el-button @click="closeProDia">鍙栨秷</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>
-    <el-dialog v-model="modelDia" title="浜у搧" width="400px">
-      <el-form :model="modelForm" label-width="140px" label-position="top" :rules="modelRules" ref="modelFormRef">
-        <el-row>
-          <el-col :span="24">
-            <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
-              <el-input v-model="modelForm.model" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" clearable/>
-            </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/>
-            </el-form-item>
-          </el-col>
-        </el-row>
-      </el-form>
-      <template #footer>
-        <div class="dialog-footer">
-          <el-button type="primary" @click="submitModelForm">纭</el-button>
-          <el-button @click="closeProDia">鍙栨秷</el-button>
-        </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 {ElMessageBox} from "element-plus";
+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,
-  modelList,
-  productTreeList
+  delProduct,
+  productListPage,
+  downloadTemplate,
 } from "@/api/basicData/product.js";
-const { proxy } = getCurrentInstance()
+import { listPage as getProcessRouteList } from "@/api/productionManagement/processRoute.js";
+import ImportExcel from "./ImportExcel/index.vue";
 
-const productDia = ref(false)
-const modelDia = 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 { proxy } = getCurrentInstance();
+const importUploadRef = ref(null);
+
+const modelDia = ref(false);
+const importDia = ref(false);
+const modelOperationType = 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: '瑙勬牸鍨嬪彿',
-    prop: 'model',
+    label: "浜у搧鍚嶇О",
+    prop: "productName",
+    minWidth: 200,
   },
   {
-    label: '鍗曚綅',
-    prop: 'unit',
+    label: "鍥剧焊缂栧彿",
+    prop: "model",
+    minWidth: 150,
+  },
+  {
+    label: "鍗曚綅",
+    prop: "unit",
+    minWidth: 100,
+  },
+  {
+    label: "宸ヨ壓璺嚎",
+    prop: "routeName",
+    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',
+    align: "center",
+    width: 100,
     operation: [
       {
         name: "缂栬緫",
         type: "text",
         clickFun: (row) => {
-          openModelDia('edit', row);
+          openModelDia("edit", row);
         },
       },
     ],
   },
-])
-const tableData = ref([])
-const tableLoading = ref(false)
-const total = ref(0)
-const selectedRows = ref([])
-const page = reactive({
-  current: 1,
-  size: 10,
-})
+]);
+
 const data = reactive({
-  form: {
-    productName: '',
-  },
-  rules: {
-    productName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
-  },
   modelForm: {
-    model: '',
-    unit: '',
+    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 { 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;
+    }
+    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("瀵煎叆澶辫触");
   }
-})
-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 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.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 {
-        form.value.id = currentId.value
-        form.value.parentId = ''
-      }
-      addOrEditProduct(form.value).then(res => {
-        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
-        closeProDia()
-        getProductTreeList()
-      })
+  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 closeProDia = () => {
-  proxy.$refs.formRef.resetFields();
-  productDia.value = false;
-}
-// 鍒犻櫎浜у搧
-const remove = (node, data) => {
-  let ids = []
-  ids.push(data.id)
-  ElMessageBox.confirm(
-      '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�',
-      '鍒犻櫎鎻愮ず', {
-        confirmButtonText: '纭',
-        cancelButtonText: '鍙栨秷',
-        type: 'warning',
-      }
-  ).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) => {
-  currentId.value = val.id
-  currentParentId.value = val.parentId
-  getModelList()
-}
+  }
+};
 
-
-// 鎻愪氦瑙勬牸鍨嬪彿淇敼
 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()
-        getModelList()
-      })
+      addOrEditProductModel(modelForm.value).then((res) => {
+        proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+        closeModelDia();
+        getModelList();
+      });
     }
-  })
-}
-// 鍏抽棴浜у搧寮规
-const closeModelDia = () => {
-  proxy.$refs.modelFormRef.resetFields();
-  modelDia.value = false;
-}
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
-  selectedRows.value = selection
-}
+  });
+};
 
-// 鏌ヨ瑙勬牸鍨嬪彿
-const pagination = ({ current, limit }) => {
-  page.current = current;
-  page.size = limit;
-  getModelList()
-}
+const closeModelDia = () => {
+  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
-  modelList({id: currentId.value}).then(res => {
-    tableLoading.value = false
-    tableData.value = res
-  })
-}
-// 鍒犻櫎瑙勬牸鍨嬪彿
-const handleDelete = () => {
-  let ids = []
-  if (selectedRows.value.length > 0) {
-    ids = selectedRows.value.map(item => item.id);
-  } else {
-    proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁')
-    return
-  }
-  ElMessageBox.confirm(
-      '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�',
-      '鍒犻櫎鎻愮ず', {
-        confirmButtonText: '纭',
-        cancelButtonText: '鍙栨秷',
-        type: 'warning',
-      }
-  ).then(() => {
-    tableLoading.value = true
-    delProductModel(ids).then(res => {
-      proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
-      getModelList()
-    }).finally(() => {
-      tableLoading.value = false
-    })
+  tableLoading.value = true;
+  productListPage({
+    productName: queryForm.productName.trim(),
+    model: queryForm.model.trim(),
+    productType: queryForm.productType,
+    current: page.current,
+    size: page.size,
+  }).then((res) => {
+    tableData.value = res.data.records;
+    page.total = res.data.total;
+    tableLoading.value = false;
   }).catch(() => {
-    proxy.$modal.msg("宸插彇娑�")
+    tableLoading.value = false;
+  });
+};
+
+const handleDelete = () => {
+  let ids = [];
+  if (selectedRows.value.length > 0) {
+    ids = selectedRows.value.map((item) => item.id);
+  } else {
+    proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+    return;
+  }
+  ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "warning",
   })
-}
-// 璋冪敤tree杩囨护鏂规硶 涓枃鑻辫繃婊�
-const filterNode = (value, data, node) => {
-  if (!value) {銆�銆�銆�銆�//濡傛灉鏁版嵁涓虹┖锛屽垯杩斿洖true,鏄剧ず鎵�鏈夌殑鏁版嵁椤�
-    return true
+    .then(() => {
+      tableLoading.value = true;
+      delProduct(ids)
+        .then((res) => {
+          proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+          getModelList();
+        })
+        .finally(() => {
+          tableLoading.value = false;
+        });
+    })
+    .catch(() => {
+      proxy.$modal.msg("宸插彇娑�");
+    });
+};
+
+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 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;
   }
-  const level = node.level
-  // 濡傛灉浼犲叆鐨勮妭鐐规湰韬氨鏄竴绾ц妭鐐瑰氨涓嶇敤鏍¢獙浜�
-  if (level === 1) {
-    return false
+  if (!isLt10M) {
+    proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB锛�");
+    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++
+  return true;
+};
+
+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 || "涓婁紶澶辫触");
   }
-  // 娌″尮閰嶅埌杩斿洖false
-  return false
-}
-getProductTreeList()
+};
+
+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;
 }
-</style>
\ No newline at end of file
+
+.search-form :deep(.el-form-item) {
+  margin-bottom: 12px;
+}
+
+.action-buttons {
+  display: flex;
+  gap: 10px;
+  margin-top: 16px;
+}
+
+.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