From 4b96a3812c141f06c767467a7f9e41940b4e8d03 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 24 六月 2026 18:42:13 +0800
Subject: [PATCH] 1.客户,销售,供应商,采购增加总合同号 2.采购的产品增加库存状态回显 3.出厂改成创建时间倒序 4.开发总合同号管理页面
---
src/views/basicData/customerFile/index.vue | 411 +++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 347 insertions(+), 64 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index daf38b7..1b8fe52 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -357,70 +357,129 @@
</el-row>
</div>
</div>
- <!-- 娲借皥杩涘害璁板綍 -->
- <div class="detail-section">
- <div class="section-header">
- <h3 class="section-title">娲借皥杩涘害璁板綍</h3>
- <el-button type="primary"
- size="small"
- @click="openNegotiationDialog(detailForm)">
- 娣诲姞杩涘害
- </el-button>
- </div>
- <el-table :data="negotiationRecords"
- border
- style="width: 100%">
- <el-table-column prop="followUpTime"
- label="璺熻繘鏃堕棿"
- width="160" />
- <el-table-column prop="followUpMethod"
- label="璺熻繘鏂瑰紡"
- width="100" />
- <el-table-column prop="followUpLevel"
- label="璺熻繘绋嬪害" />
- <el-table-column prop="followerUserName"
- label="璺熻繘浜�"
- width="100" />
- <el-table-column prop="content"
- label="鍐呭"
- show-overflow-tooltip />
- <el-table-column label="闄勪欢"
- width="100"
- align="center">
- <template #default="{ row }">
- <el-button type="info"
- link
- @click="openAttachmentDialog(row)">
- <el-icon>
- <Paperclip />
- </el-icon>
- 闄勪欢
- <!-- {{ row.fileList && row.fileList.length > 0 ? row.fileList.length : '涓婁紶' }} -->
- </el-button>
- </template>
- </el-table-column>
- <el-table-column label="鎿嶄綔"
- width="150"
- align="center">
- <template #default="{ row, $index }">
- <el-button type="primary"
- link
- @click="editNegotiationRecord(row, $index)">
- 淇敼
- </el-button>
- <el-button type="danger"
- link
- @click="deleteNegotiationRecord(row, $index)" v-hasPermi="['basicData:customerFile:remove']">
- 鍒犻櫎
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div v-if="negotiationRecords.length === 0"
- class="no-records">
- 鏆傛棤娲借皥杩涘害璁板綍
- </div>
- </div>
+ <!-- Tab鍒囨崲鍖哄煙 -->
+ <el-tabs v-model="detailActiveTab" class="detail-tabs">
+ <!-- 娲借皥杩涘害璁板綍 -->
+ <el-tab-pane label="娲借皥杩涘害璁板綍" name="negotiation">
+ <div class="section-header">
+ <el-button type="primary"
+ size="small"
+ @click="openNegotiationDialog(detailForm)">
+ 娣诲姞杩涘害
+ </el-button>
+ </div>
+ <el-table :data="negotiationRecords"
+ border
+ style="width: 100%">
+ <el-table-column prop="followUpTime"
+ label="璺熻繘鏃堕棿"
+ width="160" />
+ <el-table-column prop="followUpMethod"
+ label="璺熻繘鏂瑰紡"
+ width="100" />
+ <el-table-column prop="followUpLevel"
+ label="璺熻繘绋嬪害" />
+ <el-table-column prop="followerUserName"
+ label="璺熻繘浜�"
+ width="100" />
+ <el-table-column prop="content"
+ label="鍐呭"
+ show-overflow-tooltip />
+ <el-table-column label="闄勪欢"
+ width="100"
+ align="center">
+ <template #default="{ row }">
+ <el-button type="info"
+ link
+ @click="openAttachmentDialog(row)">
+ <el-icon>
+ <Paperclip />
+ </el-icon>
+ 闄勪欢
+ </el-button>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔"
+ width="150"
+ align="center">
+ <template #default="{ row, $index }">
+ <el-button type="primary"
+ link
+ @click="editNegotiationRecord(row, $index)">
+ 淇敼
+ </el-button>
+ <el-button type="danger"
+ link
+ @click="deleteNegotiationRecord(row, $index)" v-hasPermi="['basicData:customerFile:remove']">
+ 鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div v-if="negotiationRecords.length === 0"
+ class="no-records">
+ 鏆傛棤娲借皥杩涘害璁板綍
+ </div>
+ </el-tab-pane>
+ <!-- 鍚堝悓璁板綍 -->
+ <el-tab-pane label="鍚堝悓璁板綍" name="contract">
+ <div class="section-header">
+ <el-button type="primary"
+ size="small"
+ @click="handleAddContract">
+ 鏂板鍚堝悓璁板綍
+ </el-button>
+ </div>
+ <el-table :data="contractList"
+ border
+ style="width: 100%">
+ <el-table-column prop="masterContractNo"
+ label="鎬诲悎鍚屽彿"
+ show-overflow-tooltip />
+ <el-table-column prop="entryDate"
+ label="褰曞叆鏃ユ湡"
+ width="180" />
+ <el-table-column prop="entryPerson"
+ label="褰曞叆浜�"
+ width="120" />
+ <el-table-column prop="remark"
+ label="澶囨敞"
+ show-overflow-tooltip />
+ <el-table-column label="闄勪欢"
+ width="100"
+ align="center">
+ <template #default="{ row }">
+ <el-link type="primary"
+ v-if="row.fileList && row.fileList.length"
+ @click="handleViewContractFiles(row)">
+ 鏌ョ湅({{ row.fileList.length }})
+ </el-link>
+ <span v-else>-</span>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔"
+ width="150"
+ align="center">
+ <template #default="{ row }">
+ <el-button type="primary"
+ link
+ @click="handleEditContract(row)">
+ 缂栬緫
+ </el-button>
+ <el-button type="danger"
+ link
+ @click="handleDeleteContract(row)" v-hasPermi="['basicData:customerFile:remove']">
+ 鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div v-if="contractList.length === 0"
+ class="no-records">
+ 鏆傛棤鍚堝悓璁板綍
+ </div>
+ </el-tab-pane>
+ </el-tabs>
<template #footer>
<div class="dialog-footer">
<el-button @click="closeDetailDialog">鍏抽棴</el-button>
@@ -503,6 +562,79 @@
</div>
</template>
</el-dialog>
+ <!-- 鍚堝悓璁板綍鏂板/缂栬緫寮圭獥 -->
+ <el-dialog :title="contractDialogTitle"
+ v-model="contractDialogVisible"
+ width="600px"
+ @close="closeContractDialog">
+ <el-form :model="contractForm"
+ :rules="contractRules"
+ ref="contractFormRef"
+ label-width="100px">
+ <el-form-item label="鎬诲悎鍚屽彿" prop="masterContractNo">
+ <el-input v-model="contractForm.masterContractNo"
+ placeholder="璇疯緭鍏ユ�诲悎鍚屽彿" />
+ </el-form-item>
+ <el-form-item label="褰曞叆鏃ユ湡" prop="entryDate">
+ <el-date-picker v-model="contractForm.entryDate"
+ type="datetime"
+ placeholder="閫夋嫨鏃ユ湡鏃堕棿"
+ value-format="YYYY-MM-DD HH:mm:ss"
+ style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="褰曞叆浜�" prop="entryPerson">
+ <el-input v-model="contractForm.entryPerson"
+ placeholder="璇疯緭鍏ュ綍鍏ヤ汉" />
+ </el-form-item>
+ <el-form-item label="闄勪欢">
+ <FileUpload v-model:file-list="contractForm.storageBlobDTOs" />
+ </el-form-item>
+ <el-form-item label="澶囨敞">
+ <el-input v-model="contractForm.remark"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ュ娉�" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="contractDialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary" @click="submitContractForm">纭畾</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <!-- 鍚堝悓闄勪欢鏌ョ湅寮圭獥 -->
+ <el-dialog title="闄勪欢鍒楄〃"
+ v-model="contractFileDialogVisible"
+ width="600px">
+ <el-table :data="currentContractFiles"
+ border
+ style="width: 100%">
+ <el-table-column prop="name"
+ label="鏂囦欢鍚�"
+ show-overflow-tooltip />
+ <el-table-column label="鎿嶄綔"
+ width="120"
+ align="center">
+ <template #default="{ row }">
+ <el-button type="primary"
+ link
+ @click="downloadContractFile(row)">
+ 涓嬭浇
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div v-if="!currentContractFiles || currentContractFiles.length === 0"
+ class="no-records">
+ 鏆傛棤闄勪欢
+ </div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="contractFileDialogVisible = false">鍏抽棴</el-button>
+ </div>
+ </template>
+ </el-dialog>
</div>
</template>
@@ -516,11 +648,19 @@
addReturnVisit,
getReturnVisit,
} from "@/api/basicData/customerFile.js";
+ import {
+ getCustomerContractList,
+ getCustomerContractById,
+ addCustomerContract,
+ updateCustomerContract,
+ delCustomerContract,
+ } from "@/api/basicData/customerContract.js";
import {listCustomer, getCustomer, addCustomer, updateCustomer, delCustomer, backCustomer} from "@/api/basicData/customer.js";
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
import useUserStore from "@/store/modules/user";
import { getToken } from "@/utils/auth.js";
+ import FileUpload from "@/components/AttachmentUpload/file/index.vue";
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
@@ -570,6 +710,7 @@
// 璇︽儏鐩稿叧
const detailDialogVisible = ref(false);
+ const detailActiveTab = ref("negotiation");
const detailForm = reactive({
customerName: "",
customerType: "",
@@ -579,6 +720,32 @@
maintenanceTime: "",
});
const negotiationRecords = ref([]);
+
+ // 鍚堝悓璁板綍鐩稿叧
+ const contractList = ref([]);
+ const contractDialogVisible = ref(false);
+ const contractDialogTitle = ref("");
+ const contractFormRef = ref();
+ const contractForm = reactive({
+ id: null,
+ customerId: null,
+ masterContractNo: "",
+ entryDate: "",
+ entryPerson: "",
+ entryPersonId: null,
+ remark: "",
+ storageBlobDTOs: [],
+ });
+ const contractRules = {
+ masterContractNo: [
+ { required: true, message: "璇疯緭鍏ユ�诲悎鍚屽彿", trigger: "blur" },
+ ],
+ entryDate: [
+ { required: true, message: "璇烽�夋嫨褰曞叆鏃ユ湡", trigger: "change" },
+ ],
+ };
+ const contractFileDialogVisible = ref(false);
+ const currentContractFiles = ref([]);
// 闄勪欢鐩稿叧
const attachmentDialogVisible = ref(false);
@@ -1087,20 +1254,132 @@
// 鎵撳紑璇︽儏寮圭獥
const openDetailDialog = row => {
+ detailActiveTab.value = "negotiation";
getCustomer(row.id).then(res => {
// 濉厖瀹㈡埛鍩烘湰淇℃伅
Object.assign(detailForm, res.data);
+ detailForm.id = row.id; // 淇濆瓨瀹㈡埛ID
// 鑾峰彇娲借皥杩涘害璁板綍
negotiationRecords.value = res.data.followUpList || [];
detailDialogVisible.value = true;
});
+
+ // 鑾峰彇鍚堝悓璁板綍鍒楄〃
+ getContractList(row.id);
+ };
+
+ // 鑾峰彇鍚堝悓璁板綍鍒楄〃
+ const getContractList = customerId => {
+ getCustomerContractList(customerId).then(res => {
+ if (res.code === 200) {
+ contractList.value = res.data || [];
+ }
+ });
+ };
+
+ // 鏂板鍚堝悓璁板綍
+ const handleAddContract = () => {
+ contractDialogTitle.value = "鏂板鍚堝悓璁板綍";
+ contractForm.id = null;
+ contractForm.customerId = detailForm.id;
+ contractForm.masterContractNo = "";
+ contractForm.entryDate = "";
+ contractForm.entryPerson = userStore.nickName;
+ contractForm.entryPersonId = userStore.id;
+ contractForm.remark = "";
+ contractForm.storageBlobDTOs = [];
+ contractDialogVisible.value = true;
+ };
+
+ // 缂栬緫鍚堝悓璁板綍
+ const handleEditContract = row => {
+ contractDialogTitle.value = "缂栬緫鍚堝悓璁板綍";
+ getCustomerContractById(row.id).then(res => {
+ if (res.code === 200) {
+ contractForm.id = res.data.id;
+ contractForm.customerId = res.data.customerId;
+ contractForm.masterContractNo = res.data.masterContractNo;
+ contractForm.entryDate = res.data.entryDate;
+ contractForm.entryPerson = res.data.entryPerson;
+ contractForm.entryPersonId = res.data.entryPersonId;
+ contractForm.remark = res.data.remark;
+ contractForm.storageBlobDTOs = res.data.fileList || [];
+ contractDialogVisible.value = true;
+ }
+ });
+ };
+
+ // 鍒犻櫎鍚堝悓璁板綍
+ const handleDeleteContract = row => {
+ ElMessageBox.confirm("纭畾鍒犻櫎璇ュ悎鍚岃褰曞悧锛�", "鎻愮ず", {
+ type: "warning",
+ }).then(() => {
+ delCustomerContract(row.id).then(res => {
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getContractList(detailForm.id);
+ }
+ });
+ }).catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ // 鎻愪氦鍚堝悓璁板綍琛ㄥ崟
+ const submitContractForm = () => {
+ proxy.$refs.contractFormRef.validate(valid => {
+ if (valid) {
+ const submitData = {
+ id: contractForm.id,
+ customerId: contractForm.customerId,
+ masterContractNo: contractForm.masterContractNo,
+ entryDate: contractForm.entryDate,
+ entryPerson: contractForm.entryPerson,
+ entryPersonId: contractForm.entryPersonId,
+ remark: contractForm.remark,
+ storageBlobDTOs: contractForm.storageBlobDTOs.map(f => ({ id: f.id })),
+ };
+
+ const request = contractForm.id ? updateCustomerContract : addCustomerContract;
+ request(submitData).then(res => {
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鎿嶄綔鎴愬姛");
+ contractDialogVisible.value = false;
+ getContractList(detailForm.id);
+ }
+ });
+ }
+ });
+ };
+
+ // 鍏抽棴鍚堝悓璁板綍寮圭獥
+ const closeContractDialog = () => {
+ proxy.resetForm("contractFormRef");
+ contractDialogVisible.value = false;
+ };
+
+ // 鏌ョ湅鍚堝悓闄勪欢
+ const handleViewContractFiles = row => {
+ currentContractFiles.value = row.fileList || [];
+ contractFileDialogVisible.value = true;
+ };
+
+ // 涓嬭浇鍚堝悓闄勪欢
+ const downloadContractFile = row => {
+ if (row.downloadURL || row.url) {
+ proxy.$download.byUrl(row.downloadURL || row.url, row.name || row.originalFilename);
+ } else {
+ proxy.$modal.msgError("涓嬭浇閾炬帴涓嶅瓨鍦�");
+ }
};
// 鍏抽棴璇︽儏寮圭獥
const closeDetailDialog = () => {
detailDialogVisible.value = false;
+ detailActiveTab.value = "negotiation";
+ contractList.value = [];
};
// 淇敼娲借皥璁板綍
@@ -1356,6 +1635,10 @@
font-size: 14px;
}
+ .detail-tabs {
+ margin-top: 20px;
+ }
+
.attachment-section {
.upload-area {
margin-bottom: 20px;
--
Gitblit v1.9.3