From 6ff8faad4a183eaa35fac526e4e29a1c6176ff15 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 08 十月 2026 17:43:18 +0800
Subject: [PATCH] 采购管理系统模块优化

---
 src/views/basicData/supplierManage/index.vue |  134 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 121 insertions(+), 13 deletions(-)

diff --git a/src/views/basicData/supplierManage/index.vue b/src/views/basicData/supplierManage/index.vue
index 63a179c..e7233a0 100644
--- a/src/views/basicData/supplierManage/index.vue
+++ b/src/views/basicData/supplierManage/index.vue
@@ -11,6 +11,8 @@
           clearable
           :prefix-icon="Search"
         />
+        <el-input v-model="searchForm.supplierCode" style="width: 180px; margin-left: 10px" placeholder="渚涘簲鍟嗙紪鐮�" clearable />
+        <el-input v-model="searchForm.productKeyword" style="width: 180px; margin-left: 10px" placeholder="渚涘簲浜у搧" clearable />
         <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
           >鎼滅储</el-button
         >
@@ -28,14 +30,14 @@
     </div>
     <div class="table_list">
       <PIMTable
+        rowKey="id"
         :column="tableColumn"
         :tableData="tableData"
         :page="page"
         :isSelection="true"
-        :handleSelectionChange="handleSelectionChange"
+        @selection-change="handleSelectionChange"
         :tableLoading="tableLoading"
-        @pagination="pagination"
-        :total="total"
+				@pagination="pagination"
       ></PIMTable>
     </div>
     <el-dialog
@@ -51,6 +53,20 @@
         :rules="rules"
         ref="formRef"
       >
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="渚涘簲鍟嗙紪鐮侊細" prop="supplierCode">
+              <el-input v-model="form.supplierCode" placeholder="鐣欑┖鑷姩鐢熸垚" clearable />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="渚涘簲鍟嗙畝绉帮細"><el-input v-model="form.supplierShortName" clearable /></el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12"><el-form-item label="渚涘簲鍟嗗垎绫伙細"><el-input v-model="form.supplierCategory" /></el-form-item></el-col>
+          <el-col :span="12"><el-form-item label="渚涘簲鍟嗙瓑绾э細"><el-select v-model="form.supplierLevel" clearable style="width:100%"><el-option v-for="v in ['A','B','C','D']" :key="v" :label="v" :value="v" /></el-select></el-form-item></el-col>
+        </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="渚涘簲鍟嗗悕绉帮細" prop="supplierName">
@@ -74,6 +90,17 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12"><el-form-item label="鍚堜綔鐘舵�侊細"><el-select v-model="form.cooperationStatus" style="width:100%"><el-option label="鍚堜綔涓�" :value="1"/><el-option label="鏆傚仠鍚堜綔" :value="2"/><el-option label="鍋滅敤" :value="0"/></el-select></el-form-item></el-col>
+          <el-col :span="12"><el-form-item label="棣栨鍚堜綔鏃ユ湡锛�"><el-date-picker v-model="form.cooperationStartDate" value-format="YYYY-MM-DD" style="width:100%" /></el-form-item></el-col>
+        </el-row>
+        <el-form-item label="渚涘簲浜у搧锛�"><el-input v-model="form.suppliedProductsSummary" type="textarea" :rows="2" placeholder="澶氫釜浜у搧鍙敤椤垮彿鍒嗛殧" /></el-form-item>
+        <el-row :gutter="30">
+          <el-col :span="12"><el-form-item label="璧勮川鐘舵�侊細"><el-select v-model="form.qualificationStatus" style="width:100%"><el-option label="寰呭畬鍠�" :value="0"/><el-option label="鏈夋晥" :value="1"/><el-option label="鍗冲皢鍒版湡" :value="2"/><el-option label="宸茶繃鏈�" :value="3"/></el-select></el-form-item></el-col>
+          <el-col :span="12"><el-form-item label="璧勮川鍒版湡鏃ワ細"><el-date-picker v-model="form.qualificationExpiryDate" value-format="YYYY-MM-DD" style="width:100%" /></el-form-item></el-col>
+        </el-row>
+        <el-form-item label="鍚堜綔鍘嗗彶锛�"><el-input v-model="form.cooperationHistorySummary" type="textarea" :rows="2" placeholder="濉啓鍘嗗彶鍚堜綔涓庤瘎浠锋憳瑕�" /></el-form-item>
+        <el-form-item label="澶囨敞锛�"><el-input v-model="form.remark" type="textarea" :rows="2" /></el-form-item>
         <el-row :gutter="30">
           <el-col :span="12">
             <el-form-item label="鍏徃鍦板潃锛�" prop="companyAddress">
@@ -167,6 +194,25 @@
             </el-form-item>
           </el-col>
         </el-row>
+        <el-divider content-position="left">璧勮川璇佹槑</el-divider>
+        <el-button type="primary" plain @click="form.qualifications.push({ status: 1, longTermValid: 0 })">鏂板璧勮川</el-button>
+        <el-table :data="form.qualifications" border style="margin:10px 0 20px">
+          <el-table-column label="璧勮川鍚嶇О"><template #default="{row}"><el-input v-model="row.qualificationName" /></template></el-table-column>
+          <el-table-column label="绫诲瀷"><template #default="{row}"><el-input v-model="row.qualificationType" /></template></el-table-column>
+          <el-table-column label="璇佷功缂栧彿"><template #default="{row}"><el-input v-model="row.certificateNo" /></template></el-table-column>
+          <el-table-column label="鍒版湡鏃ユ湡" width="180"><template #default="{row}"><el-date-picker v-model="row.expiryDate" value-format="YYYY-MM-DD" style="width:100%" /></template></el-table-column>
+          <el-table-column label="鎿嶄綔" width="80"><template #default="{$index}"><el-button type="danger" link @click="form.qualifications.splice($index,1)">鍒犻櫎</el-button></template></el-table-column>
+        </el-table>
+        <el-divider content-position="left">渚涘簲浜у搧</el-divider>
+        <el-button type="primary" plain @click="form.products.push({ status: 1, currency: 'CNY' })">鏂板浜у搧</el-button>
+        <el-table :data="form.products" border style="margin:10px 0 20px">
+          <el-table-column label="浜у搧鍚嶇О"><template #default="{row}"><el-input v-model="row.productName" /></template></el-table-column>
+          <el-table-column label="鍒嗙被"><template #default="{row}"><el-input v-model="row.productCategory" /></template></el-table-column>
+          <el-table-column label="瑙勬牸鍨嬪彿"><template #default="{row}"><el-input v-model="row.specificationModel" /></template></el-table-column>
+          <el-table-column label="渚涜揣鍛ㄦ湡(澶�)" width="140"><template #default="{row}"><el-input-number v-model="row.leadTimeDays" :min="0" /></template></el-table-column>
+          <el-table-column label="鍙傝�冨崟浠�" width="140"><template #default="{row}"><el-input-number v-model="row.referencePrice" :min="0" :precision="2" /></template></el-table-column>
+          <el-table-column label="鎿嶄綔" width="80"><template #default="{$index}"><el-button type="danger" link @click="form.products.splice($index,1)">鍒犻櫎</el-button></template></el-table-column>
+        </el-table>
       </el-form>
       <template #footer>
         <div class="dialog-footer">
@@ -200,13 +246,13 @@
         <template #tip>
           <div class="el-upload__tip text-center">
             <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
-            <el-link
+            <!-- <el-link
               type="primary"
               :underline="false"
               style="font-size: 12px; vertical-align: baseline"
               @click="importTemplate"
               >涓嬭浇妯℃澘</el-link
-            >
+            > -->
           </div>
         </template>
       </el-upload>
@@ -221,7 +267,7 @@
 </template>
 
 <script setup>
-import { ref } from "vue";
+import { onMounted, ref } from "vue";
 import { Search } from "@element-plus/icons-vue";
 import { delSupplier } from "@/api/basicData/supplierManageFile.js";
 import { ElMessageBox } from "element-plus";
@@ -231,6 +277,8 @@
   getSupplier,
   listSupplier,
   updateSupplier,
+  getSupplierArchive,
+  saveSupplierArchive,
 } from "@/api/basicData/supplierManageFile.js";
 import useUserStore from "@/store/modules/user";
 import { getToken } from "@/utils/auth.js";
@@ -238,10 +286,16 @@
 const userStore = useUserStore();
 
 const tableColumn = ref([
+  { label: "渚涘簲鍟嗙紪鐮�", prop: "supplierCode", width: 140 },
   {
     label: "渚涘簲鍟嗗悕绉�",
     prop: "supplierName",
     width: 250,
+  },
+  {
+    label: "绾崇◣浜鸿瘑鍒彿",
+    prop: "taxpayerIdentificationNum",
+    width: 230,
   },
   {
     label: "鍏徃鍦板潃",
@@ -251,14 +305,17 @@
   {
     label: "鑱旂郴鏂瑰紡",
     prop: "companyPhone",
+    width:150
   },
   {
     label: "寮�鎴疯",
     prop: "bankAccountName",
+    width: 220,
   },
   {
     label: "璐﹀彿",
     prop: "bankAccountNum",
+    width: 220,
   },
   {
     label: "鑱旂郴浜�",
@@ -267,7 +324,12 @@
   {
     label: "鑱旂郴鐢佃瘽",
     prop: "contactUserPhone",
+    width: 150,
   },
+  { label: "渚涘簲浜у搧", prop: "suppliedProductsSummary", width: 220 },
+  { label: "绛夌骇", prop: "supplierLevel", width: 80 },
+  { label: "璧勮川鐘舵��", prop: "qualificationStatus", width: 100, formatData: v => ({0:'寰呭畬鍠�',1:'鏈夋晥',2:'鍗冲皢鍒版湡',3:'宸茶繃鏈�'}[v] || '寰呭畬鍠�') },
+  { label: "鍚堜綔鐘舵��", prop: "cooperationStatus", width: 100, formatData: v => ({0:'鍋滅敤',1:'鍚堜綔涓�',2:'鏆傚仠'}[v] || '鍚堜綔涓�') },
   {
     label: "缁存姢浜�",
     prop: "maintainUserName",
@@ -276,11 +338,13 @@
   {
     label: "缁存姢鏃堕棿",
     prop: "maintainTime",
+    width:100
   },
   {
     dataType: "action",
     label: "鎿嶄綔",
     align: "center",
+		fixed: 'right',
     operation: [
       {
         name: "缂栬緫",
@@ -288,6 +352,9 @@
         clickFun: (row) => {
           openForm("edit", row);
         },
+				disabled: (row) => {
+					return row.maintainUserName !== userStore.nickName
+				}
       },
     ],
   },
@@ -298,9 +365,9 @@
 const tableLoading = ref(false);
 const page = reactive({
   current: 1,
-  size: 10,
+  size: 100,
+  total: 0,
 });
-const total = ref(0);
 
 // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
 const operationType = ref("");
@@ -308,8 +375,23 @@
 const data = reactive({
   searchForm: {
     supplierName: "",
+    supplierCode: "",
+    productKeyword: "",
   },
   form: {
+    supplierCode: "",
+    supplierShortName: "",
+    supplierCategory: "",
+    supplierLevel: "",
+    cooperationStatus: 1,
+    cooperationStartDate: "",
+    qualificationStatus: 0,
+    qualificationExpiryDate: "",
+    suppliedProductsSummary: "",
+    cooperationHistorySummary: "",
+    remark: "",
+    qualifications: [],
+    products: [],
     supplierName: "",
     taxpayerIdentificationNum: "",
     companyAddress: "",
@@ -351,6 +433,7 @@
 };
 /** 鎻愪氦涓婁紶鏂囦欢 */
 function submitFileForm() {
+  console.log(upload.url + '?updateSupport=' + upload.updateSupport)
   proxy.$refs["uploadRef"].submit();
 }
 const getList = () => {
@@ -358,7 +441,7 @@
   listSupplier({ ...searchForm.value, ...page }).then((res) => {
     tableLoading.value = false;
     tableData.value = res.data.records;
-    total.value = res.data.total;
+    page.total = res.data.total;
   });
 };
 const upload = reactive({
@@ -368,6 +451,8 @@
   title: "",
   // 鏄惁绂佺敤涓婁紶
   isUploading: false,
+  // 鏄惁鏇存柊宸茬粡瀛樺湪鐨勭敤鎴锋暟鎹�
+  updateSupport: 1,
   // 璁剧疆涓婁紶鐨勮姹傚ご閮�
   headers: { Authorization: "Bearer " + getToken() },
   // 涓婁紶鐨勫湴鍧�
@@ -378,6 +463,19 @@
   upload.title = "渚涘簲鍟嗗鍏�";
   upload.open = true;
 }
+
+/**鏂囦欢涓婁紶涓鐞� */
+const handleFileUploadProgress = (event, file, fileList) => {
+  upload.isUploading = true;
+};
+
+/** 鏂囦欢涓婁紶鎴愬姛澶勭悊 */
+const handleFileSuccess = (response, file, fileList) => {
+  upload.open = false;
+  upload.isUploading = false;
+  proxy.$refs["uploadRef"].handleRemove(file);
+  getList();
+};
 // 琛ㄦ牸閫夋嫨鏁版嵁
 const handleSelectionChange = (selection) => {
   selectedRows.value = selection;
@@ -388,12 +486,14 @@
   form.value = {};
   form.value.maintainUserId = userStore.id;
   form.value.maintainTime = getCurrentDate();
+  form.value.qualifications = [];
+  form.value.products = [];
   userListNoPage().then((res) => {
     userList.value = res.data;
   });
   if (type === "edit") {
-    getSupplier(row.id).then((res) => {
-      form.value = { ...res.data };
+    getSupplierArchive(row.id).then((res) => {
+      form.value = { ...res.data.supplier, qualifications: res.data.qualifications || [], products: res.data.products || [] };
     });
   }
   dialogFormVisible.value = true;
@@ -412,7 +512,8 @@
 };
 // 鎻愪氦鏂板
 const submitAdd = () => {
-  addSupplier(form.value).then((res) => {
+  const { qualifications, products, ...supplier } = form.value;
+  saveSupplierArchive({ supplier, qualifications, products }).then((res) => {
     proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
     closeDia();
     getList();
@@ -420,7 +521,8 @@
 };
 // 鎻愪氦淇敼
 const submitEdit = () => {
-  updateSupplier(form.value).then((res) => {
+  const { qualifications, products, ...supplier } = form.value;
+  saveSupplierArchive({ supplier, qualifications, products }).then((res) => {
     proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
     closeDia();
     getList();
@@ -449,6 +551,12 @@
 const handleDelete = () => {
   let ids = [];
   if (selectedRows.value.length > 0) {
+		// 妫�鏌ユ槸鍚︽湁浠栦汉缁存姢鐨勬暟鎹�
+		const unauthorizedData = selectedRows.value.filter(item => item.maintainUserName !== userStore.nickName);
+		if (unauthorizedData.length > 0) {
+			proxy.$modal.msgWarning("涓嶅彲鍒犻櫎浠栦汉缁存姢鐨勬暟鎹�");
+			return;
+		}
     ids = selectedRows.value.map((item) => item.id);
   } else {
     proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");

--
Gitblit v1.9.3