From 3ce715a4e66955eac86dcd2f5c8afcfdf8becb6d Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期四, 29 十月 2026 16:46:47 +0800
Subject: [PATCH] Merge origin/dev_项目管理 into dev_项目管理
---
src/views/basicData/customerFile/index.vue | 1370 ++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 1,067 insertions(+), 303 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 68311f0..1c4e6e8 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -1,325 +1,1089 @@
<template>
-<div class="app-container">
- <div class="search_form">
- <div>
- <span class="search_title">瀹㈡埛鍚嶇О锛�</span>
- <el-input
- v-model="searchForm.customerName"
- style="width: 240px"
- placeholder="璇疯緭鍏�"
- @change="handleQuery"
- clearable
- :prefix-icon="Search"
- />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px">鎼滅储</el-button>
- </div>
- <div>
- <el-button type="primary" @click="openForm('add')">鏂板瀹㈡埛</el-button>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
- </div>
- </div>
- <div class="table_list">
- <PIMTable :column="tableColumn" :tableData="tableData" :page="page" :isSelection="true" :handleSelectionChange="handleSelectionChange"
- :tableLoading="tableLoading" @pagination="pagination" :total="total"></PIMTable>
- </div>
- <el-dialog v-model="dialogFormVisible" :title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'" width="70%" @close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="瀹㈡埛鍚嶇О锛�" prop="customerName">
- <el-input v-model="form.customerName" placeholder="璇疯緭鍏�" clearable/>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="绾崇◣浜鸿瘑鍒彿锛�" prop="taxpayerIdentificationNumber">
- <el-input v-model="form.taxpayerIdentificationNumber" placeholder="璇疯緭鍏�" clearable/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鍏徃鍦板潃锛�" prop="companyAddress">
- <el-input v-model="form.companyAddress" placeholder="璇疯緭鍏�" clearable/>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鍏徃鐢佃瘽锛�" prop="companyPhone">
- <el-input v-model="form.companyPhone" placeholder="璇疯緭鍏�" clearable/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="鑱旂郴浜猴細" prop="contactPerson">
- <el-input v-model="form.contactPerson" placeholder="璇疯緭鍏�" clearable/>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="鑱旂郴鐢佃瘽锛�" prop="contactPhone">
- <el-input v-model="form.contactPhone" placeholder="璇疯緭鍏�" clearable/>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="30">
- <el-col :span="12">
- <el-form-item label="缁存姢浜猴細" prop="maintainer">
- <el-select v-model="form.maintainer" placeholder="璇烽�夋嫨" clearable disabled>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="缁存姢鏃堕棿锛�" prop="maintenanceTime" >
- <el-date-picker
- style="width: 100%"
- v-model="form.maintenanceTime"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- type="date"
- placeholder="璇烽�夋嫨"
- clearable
- disabled
- />
- </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="closeDia">鍙栨秷</el-button>
+ <div class="app-container">
+ <div class="search_form" style="margin-bottom: 20px;">
+ <div>
+ <span class="search_title">瀹㈡埛鍚嶇О锛�</span>
+ <el-input v-model="searchForm.customerName"
+ style="width: 240px;margin-right: 10px"
+ placeholder="璇疯緭鍏�"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span class="search_title">瀹㈡埛鍒嗙被锛�</span>
+ <el-select v-model="searchForm.customerType"
+ placeholder="璇烽�夋嫨"
+ style="width: 240px"
+ clearable
+ @change="handleQuery">
+ <el-option label="涓夊ぇ娌�"
+ value="涓夊ぇ娌�" />
+ <el-option label="澶栭攢"
+ value="澶栭攢" />
+ </el-select>
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
</div>
- </template>
- </el-dialog>
-</div>
+ <div>
+ <el-button type="primary"
+ v-hasPermi="['basic:customer:add']"
+ @click="openForm('add')">鏂板瀹㈡埛</el-button>
+ <el-button v-hasPermi="['basic:customer:export']"
+ @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="info"
+ plain
+ icon="Upload"
+ v-hasPermi="['basic:customer:import']"
+ @click="handleImport">瀵煎叆</el-button>
+ <el-button type="danger"
+ plain
+ v-hasPermi="['basic:customer:remove']"
+ @click="handleDelete">鍒犻櫎</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"></PIMTable>
+ </div>
+ <el-dialog v-model="dialogFormVisible"
+ :title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
+ width="70%"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="瀹㈡埛鍚嶇О锛�"
+ prop="customerName">
+ <el-input v-model="form.customerName"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="绾崇◣浜鸿瘑鍒彿锛�"
+ prop="taxpayerIdentificationNumber">
+ <el-input v-model="form.taxpayerIdentificationNumber"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鍏徃鍦板潃锛�"
+ prop="companyAddress">
+ <el-input v-model="form.companyAddress"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍏徃鐢佃瘽锛�"
+ prop="companyPhone">
+ <el-input v-model="form.companyPhone"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="閾惰鍩烘湰鎴凤細"
+ prop="basicBankAccount">
+ <el-input v-model="form.basicBankAccount"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="閾惰璐﹀彿锛�"
+ prop="bankAccount">
+ <el-input v-model="form.bankAccount"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="寮�鎴疯鍙凤細"
+ prop="bankCode">
+ <el-input v-model="form.bankCode"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瀹㈡埛鍒嗙被锛�"
+ prop="customerType">
+ <el-select v-model="form.customerType"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option label="涓夊ぇ娌�"
+ value="涓夊ぇ娌�" />
+ <el-option label="澶栭攢"
+ value="澶栭攢" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="缁戝畾鐧诲綍璐﹀彿锛�"
+ prop="bindUserId">
+ <el-select v-model="form.bindUserId"
+ placeholder="璇烽�夋嫨璇ュ鎴风殑鐧诲綍璐﹀彿"
+ clearable
+ filterable
+ style="width: 100%">
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName + '锛�' + item.userName + '锛�'"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30"
+ v-for="(contact, index) in formYYs.contactList"
+ :key="index">
+ <el-col :span="12">
+ <el-form-item label="鑱旂郴浜猴細"
+ prop="contactPerson">
+ <el-input v-model="contact.contactPerson"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鑱旂郴鐢佃瘽锛�"
+ prop="contactPhone">
+ <div style="display: flex; align-items: center;width: 100%;">
+ <el-input v-model="contact.contactPhone"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ <el-button @click="removeContact(index)"
+ type="danger"
+ circle
+ style="margin-left: 5px;">
+ <el-icon>
+ <Close />
+ </el-icon>
+ </el-button>
+ </div>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-button @click="addNewContact"
+ style="margin-bottom: 10px;">+ 鏂板鑱旂郴浜�</el-button>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="缁存姢浜猴細"
+ prop="maintainer">
+ <el-select v-model="form.maintainer"
+ placeholder="璇烽�夋嫨"
+ clearable
+ disabled>
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="缁存姢鏃堕棿锛�"
+ prop="maintenanceTime">
+ <el-date-picker style="width: 100%"
+ v-model="form.maintenanceTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </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="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <!-- 鐢ㄦ埛瀵煎叆瀵硅瘽妗� -->
+ <el-dialog :title="upload.title"
+ v-model="upload.open"
+ width="400px"
+ append-to-body>
+ <el-upload ref="uploadRef"
+ :limit="1"
+ accept=".xlsx, .xls"
+ :headers="upload.headers"
+ :action="upload.url"
+ :data="upload.data"
+ :disabled="upload.isUploading"
+ :before-upload="upload.beforeUpload"
+ :on-progress="upload.onProgress"
+ :on-success="upload.onSuccess"
+ :on-error="upload.onError"
+ :on-change="upload.onChange"
+ :auto-upload="false"
+ drag>
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+ <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+ <template #tip>
+ <div class="el-upload__tip text-center">
+ <span>浠呭厑璁稿鍏ls銆亁lsx鏍煎紡鏂囦欢銆�</span>
+ <el-link type="primary"
+ :underline="false"
+ style="font-size: 12px; vertical-align: baseline"
+ @click="importTemplate">涓嬭浇妯℃澘</el-link>
+ </div>
+ </template>
+ </el-upload>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="submitFileForm">纭� 瀹�</el-button>
+ <el-button @click="upload.open = false">鍙� 娑�</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <!-- 杩�3骞磋储鍔℃姤琛ㄤ笂浼� -->
+ <el-dialog title="杩�3骞磋储鍔℃姤琛ㄤ笂浼�"
+ v-model="reportDialogVisible"
+ width="900px"
+ @close="closeReportDialog">
+ <div class="report-customer">瀹㈡埛锛歿{ reportCustomer.customerName }}</div>
+ <el-form :model="reportForm"
+ label-width="90px"
+ inline
+ class="report-form">
+ <el-form-item label="鎶ヨ〃骞村害">
+ <el-select v-model="reportForm.reportYear"
+ placeholder="璇烽�夋嫨骞村害"
+ style="width: 150px">
+ <el-option v-for="year in reportYears"
+ :key="year"
+ :label="year + '骞�'"
+ :value="year" />
+ </el-select>
+ </el-form-item>
+ <el-form-item label="鎶ヨ〃鍚嶇О">
+ <el-input v-model="reportForm.reportName"
+ placeholder="渚嬪锛�2025骞村害璐㈠姟鎶ヨ〃"
+ style="width: 260px"
+ clearable />
+ </el-form-item>
+ </el-form>
+ <FileUpload v-model="reportForm.reportFiles"
+ :limit="5"
+ :file-size="20"
+ :file-type="['pdf', 'doc', 'docx', 'xls', 'xlsx', 'jpg', 'png', 'zip', 'rar']" />
+ <div class="report-actions">
+ <el-button type="primary"
+ :loading="reportSaving"
+ @click="saveReport">淇濆瓨涓婁紶</el-button>
+ <el-button @click="resetReportForm">閲嶇疆</el-button>
+ </div>
+ <el-table :data="reportRows"
+ border
+ size="small"
+ style="margin-top: 16px">
+ <el-table-column prop="reportYear"
+ label="骞村害"
+ width="90"
+ align="center" />
+ <el-table-column prop="reportName"
+ label="鎶ヨ〃鍚嶇О"
+ min-width="180"
+ show-overflow-tooltip />
+ <el-table-column label="鎶ヨ〃闄勪欢"
+ min-width="260">
+ <template #default="scope">
+ <FileUpload v-model="scope.row.reportFiles"
+ disabled
+ :is-show-tip="false" />
+ </template>
+ </el-table-column>
+ <el-table-column prop="uploadUserName"
+ label="涓婁紶浜�"
+ width="110" />
+ <el-table-column prop="updateTime"
+ label="涓婁紶鏃堕棿"
+ width="170" />
+ <el-table-column label="瀹℃壒鐘舵��"
+ width="100"
+ align="center">
+ <template #default="scope">
+ <el-tag :type="reportStatusTag(scope.row.auditStatus)">
+ {{ reportStatusText(scope.row.auditStatus) }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="鎿嶄綔"
+ width="140"
+ align="center">
+ <template #default="scope">
+ <el-button type="primary"
+ link
+ @click="editReport(scope.row)">淇敼</el-button>
+ <el-button type="danger"
+ link
+ @click="deleteReport(scope.row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div v-if="reportRows.length === 0"
+ class="no-record">鏆傛棤璐㈠姟鎶ヨ〃锛岃鎸夊勾搴︿笂浼犺繎3骞磋储鍔℃姤琛�</div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="closeReportDialog">鍏抽棴</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <!-- 瀹㈡埛璇︽儏瀵硅瘽妗� -->
+ <el-dialog title="瀹㈡埛璇︽儏"
+ v-model="detailDialogVisible"
+ width="1000px"
+ @close="closeDetailDialog">
+ <div class="detail-section">
+ <h3 class="section-title">瀹㈡埛鍩烘湰淇℃伅</h3>
+ <div class="info-display">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">瀹㈡埛鍚嶇О锛�</span>
+ <span class="info-value">{{ detailForm.customerName }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">瀹㈡埛鍒嗙被锛�</span>
+ <span class="info-value">{{ detailForm.customerType }}</span>
+ </div>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">绾崇◣浜鸿瘑鍒彿锛�</span>
+ <span class="info-value">{{ detailForm.taxpayerIdentificationNumber }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">鍏徃鐢佃瘽锛�</span>
+ <span class="info-value">{{ detailForm.companyPhone }}</span>
+ </div>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">鍏徃鍦板潃锛�</span>
+ <span class="info-value">{{ detailForm.companyAddress }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">閾惰鍩烘湰鎴凤細</span>
+ <span class="info-value">{{ detailForm.basicBankAccount }}</span>
+ </div>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">閾惰璐﹀彿锛�</span>
+ <span class="info-value">{{ detailForm.bankAccount }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">寮�鎴疯鍙凤細</span>
+ <span class="info-value">{{ detailForm.bankCode }}</span>
+ </div>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">鑱旂郴浜猴細</span>
+ <span class="info-value">{{ detailForm.contactPerson }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">鑱旂郴鐢佃瘽锛�</span>
+ <span class="info-value">{{ detailForm.contactPhone }}</span>
+ </div>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">缁戝畾鐧诲綍璐﹀彿锛�</span>
+ <span class="info-value">{{ detailForm.bindUserName || '-' }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">缁存姢浜猴細</span>
+ <span class="info-value">{{ detailForm.maintainer }}</span>
+ </div>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">缁存姢鏃堕棿锛�</span>
+ <span class="info-value">{{ detailForm.maintenanceTime }}</span>
+ </div>
+ </el-col>
+ </el-row>
+ </div>
+ </div>
+ <div class="detail-section">
+ <h3 class="section-title">杩�3骞磋储鍔℃姤琛�</h3>
+ <el-table :data="detailReports"
+ border
+ size="small"
+ style="width: 100%">
+ <el-table-column prop="reportYear"
+ label="骞村害"
+ width="90"
+ align="center" />
+ <el-table-column prop="reportName"
+ label="鎶ヨ〃鍚嶇О"
+ min-width="180"
+ show-overflow-tooltip />
+ <el-table-column label="鎶ヨ〃闄勪欢"
+ min-width="260">
+ <template #default="scope">
+ <FileUpload v-model="scope.row.reportFiles"
+ disabled
+ :is-show-tip="false" />
+ </template>
+ </el-table-column>
+ <el-table-column prop="uploadUserName"
+ label="涓婁紶浜�"
+ width="110" />
+ <el-table-column prop="updateTime"
+ label="涓婁紶鏃堕棿"
+ width="170" />
+ </el-table>
+ <div v-if="detailReports.length === 0"
+ class="no-record">鏆傛棤璐㈠姟鎶ヨ〃</div>
+ </div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="closeDetailDialog">鍏抽棴</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
</template>
<script setup>
-import { ref } from 'vue'
-import {Search} from "@element-plus/icons-vue";
-import {addCustomer, delCustomer, getCustomer, listCustomer, updateCustomer} from "@/api/basicData/customerFile.js";
-import {ElMessageBox } from "element-plus";
-import {userListNoPage} from "@/api/system/user.js";
-import useUserStore from "@/store/modules/user"
-const { proxy } = getCurrentInstance()
-const userStore = useUserStore()
+ import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
+ import { Search, Close } from "@element-plus/icons-vue";
+ import { listCustomer, getCustomer, addCustomer, updateCustomer, delCustomer } from "@/api/basicData/customer.js";
+ import {
+ listCustomerFinancialReport,
+ saveCustomerFinancialReport,
+ delCustomerFinancialReport,
+ } from "@/api/basicData/customerFinancialReport.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/FileUpload/index.vue";
+ const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
-const tableColumn = ref([
- {
- label: '瀹㈡埛鍚嶇О',
- prop: 'customerName',
- width: 220,
- },
- {
- label: '绾崇◣浜鸿瘑鍒爜',
- prop: 'taxpayerIdentificationNumber',
- width: 220,
- },
- {
- label: '鍦板潃鍙婅仈绯绘柟寮�',
- prop: 'addressPhone',
- width: 220,
- },
- {
- label: '鑱旂郴浜�',
- prop: 'contactPerson'
- },
- {
- label: '鑱旂郴鐢佃瘽',
- prop: 'contactPhone',
- },
- {
- label: '缁存姢浜�',
- prop: 'maintainer',
- },
- {
- label: '缁存姢鏃堕棿',
- prop: 'maintenanceTime',
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: 'center',
- operation: [
- {
- name: "缂栬緫",
- type: "text",
- clickFun: (row) => {
- openForm('edit', row);
+ // 璇︽儏鐩稿叧
+ const detailDialogVisible = ref(false);
+ const detailReports = ref([]);
+ const detailForm = reactive({
+ customerName: "",
+ customerType: "",
+ taxpayerIdentificationNumber: "",
+ companyPhone: "",
+ companyAddress: "",
+ basicBankAccount: "",
+ bankAccount: "",
+ bankCode: "",
+ contactPerson: "",
+ contactPhone: "",
+ bindUserId: "",
+ bindUserName: "",
+ maintainer: "",
+ maintenanceTime: "",
+ });
+
+ // 杩�3骞磋储鍔℃姤琛ㄧ浉鍏�
+ const reportDialogVisible = ref(false);
+ const reportSaving = ref(false);
+ const reportCustomer = reactive({ id: "", customerName: "" });
+ const reportRows = ref([]);
+ const nowYear = new Date().getFullYear();
+ const reportYears = [nowYear, nowYear - 1, nowYear - 2];
+ const reportForm = reactive({ reportYear: nowYear, reportName: "", reportFiles: "" });
+
+ const tableColumn = ref([
+ {
+ label: "瀹㈡埛鍒嗙被",
+ prop: "customerType",
+ width: 120,
+ },
+ {
+ label: "瀹㈡埛鍚嶇О",
+ prop: "customerName",
+ width: 220,
+ },
+ {
+ label: "绾崇◣浜鸿瘑鍒爜",
+ prop: "taxpayerIdentificationNumber",
+ width: 220,
+ },
+ {
+ label: "鍦板潃鍙婅仈绯绘柟寮�",
+ prop: "addressPhone",
+ width: 250,
+ },
+ {
+ label: "鑱旂郴浜�",
+ prop: "contactPerson",
+ },
+ {
+ label: "鑱旂郴鐢佃瘽",
+ prop: "contactPhone",
+ width: 150,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 240,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ showHide: () => proxy.$auth.hasPermi("basic:customer:edit"),
+ clickFun: row => {
+ openForm("edit", row);
+ },
},
+ {
+ name: "杩�3骞磋储鍔℃姤琛�",
+ type: "text",
+ showHide: () => proxy.$auth.hasPermi("basic:customer:report"),
+ clickFun: row => {
+ openReportDialog(row);
+ },
+ },
+ {
+ name: "璇︽儏",
+ type: "text",
+ showHide: () => proxy.$auth.hasPermi("basic:customer:query"),
+ clickFun: row => {
+ openDetailDialog(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const userList = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+
+ // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+ const operationType = ref("");
+ const dialogFormVisible = ref(false);
+ const formYYs = ref({
+ contactList: [
+ {
+ contactPerson: "",
+ contactPhone: "",
},
],
- },
-])
-const tableData = ref([])
-const selectedRows = ref([])
-const userList = ref([])
-const tableLoading = ref(false)
-const page = reactive({
- current: 1,
- size: 10,
-})
-const total = ref(0)
-
-// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
-const operationType = ref('')
-const dialogFormVisible = ref(false)
-const data = reactive({
- searchForm: {
- customerName: '',
- },
- form: {
- customerName: '',
- taxpayerIdentificationNumber: '',
- companyAddress: '',
- companyPhone: '',
- contactPerson: '',
- contactPhone: '',
- maintainer: '',
- maintenanceTime: '',
- },
- rules: {
- customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- taxpayerIdentificationNumber: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- contactPerson: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- contactPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- maintainer: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
- maintenanceTime: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
- }
-})
-const { searchForm, form, rules } = toRefs(data)
-
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
- page.current = 1
- getList()
-}
-const pagination = ({ current, limit }) => {
- page.current = current;
- page.size = limit;
- getList()
-}
-const getList = () => {
- tableLoading.value = true
- listCustomer({...searchForm.value, ...page}).then(res => {
- tableLoading.value = false
- tableData.value = res.rows
- total.value = res.total
- })
-}
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection
-}
-// 鎵撳紑寮规
-const openForm = (type, row) => {
- operationType.value = type
- form.value = {}
- form.value.maintainer = userStore.nickName
- form.value.maintenanceTime = getCurrentDate();
- userListNoPage().then(res => {
- userList.value = res.data
- })
- if (type === 'edit') {
- getCustomer(row.id).then(res => {
- form.value = {...res.data}
- })
- }
- dialogFormVisible.value = true
-}
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
- proxy.$refs["formRef"].validate(valid => {
- if (valid) {
- if (operationType.value === "edit") {
- submitEdit()
+ });
+ const data = reactive({
+ searchForm: {
+ customerName: "",
+ customerType: "",
+ type: 0
+ },
+ form: {
+ customerName: "",
+ taxpayerIdentificationNumber: "",
+ companyAddress: "",
+ companyPhone: "",
+ contactPerson: "",
+ contactPhone: "",
+ bindUserId: "",
+ maintainer: "",
+ maintenanceTime: "",
+ basicBankAccount: "",
+ bankAccount: "",
+ bankCode: "",
+ customerType: "",
+ type: 0
+ },
+ rules: {
+ customerName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ taxpayerIdentificationNumber: [
+ { required: true, message: "璇疯緭鍏�", trigger: "blur" },
+ ],
+ companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ maintainer: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+ maintenanceTime: [
+ { required: false, message: "璇烽�夋嫨", trigger: "change" },
+ ],
+ basicBankAccount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ bankAccount: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ bankCode: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ customerType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
+ });
+ const upload = reactive({
+ // 鏄惁鏄剧ず寮瑰嚭灞傦紙瀹㈡埛瀵煎叆锛�
+ open: false,
+ // 寮瑰嚭灞傛爣棰橈紙瀹㈡埛瀵煎叆锛�
+ title: "",
+ // 鏄惁绂佺敤涓婁紶
+ isUploading: false,
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/basic/customer/importData",
+ data: {
+ type: 0
+ },
+ // 鏂囦欢涓婁紶鍓嶇殑鍥炶皟
+ beforeUpload: file => {
+ // 鍙互鍦ㄦ澶勫仛鏂囦欢绫诲瀷鎴栧ぇ灏忔牎楠�
+ const isValid =
+ file.type ===
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
+ file.name.endsWith(".xlsx") ||
+ file.name.endsWith(".xls");
+ if (!isValid) {
+ proxy.$modal.msgError("鍙兘涓婁紶 Excel 鏂囦欢");
+ }
+ return isValid;
+ },
+ // 鏂囦欢鐘舵�佹敼鍙樻椂鐨勫洖璋�
+ onChange: (file, fileList) => {
+ console.log("鏂囦欢鐘舵�佹敼鍙�", file, fileList);
+ },
+ // 鏂囦欢涓婁紶鎴愬姛鏃剁殑鍥炶皟
+ onSuccess: (response, file, fileList) => {
+ upload.isUploading = false;
+ if (response.code === 200) {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
+ upload.open = false;
+ proxy.$refs["uploadRef"].clearFiles();
+ getList();
+ } else if (response.code === 500) {
+ proxy.$modal.msgError(response.msg);
} else {
- submitAdd()
+ proxy.$modal.msgWarning(response.msg);
}
+ },
+ // 鏂囦欢涓婁紶澶辫触鏃剁殑鍥炶皟
+ onError: (error, file, fileList) => {
+ upload.isUploading = false;
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ },
+ // 鏂囦欢涓婁紶杩涘害鍥炶皟
+ onProgress: event => {
+ console.log("涓婁紶涓�...", event.percent);
+ },
+ });
+ const { searchForm, form, rules } = toRefs(data);
+ const addNewContact = () => {
+ formYYs.value.contactList.push({
+ contactPerson: "",
+ contactPhone: "",
+ });
+ };
+
+ const removeContact = index => {
+ if (formYYs.value.contactList.length > 1) {
+ formYYs.value.contactList.splice(index, 1);
}
- })
-}
-// 鎻愪氦鏂板
-const submitAdd = () => {
- addCustomer(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
- closeDia()
- getList()
- })
-}
-// 鎻愪氦淇敼
-const submitEdit = () => {
- updateCustomer(form.value).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛")
- closeDia()
- getList()
- })
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef")
- dialogFormVisible.value = false
-}
-// 瀵煎嚭
-const handleOut = () => {
- ElMessageBox.confirm(
- '閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�',
- '瀵煎嚭', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
- }
- ).then(() => {
- proxy.download("/basic/customer/export", {}, '瀹㈡埛妗f.xlsx')
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
-// 鍒犻櫎
-const handleDelete = () => {
- let ids = []
- if (selectedRows.value.length > 0) {
- ids = selectedRows.value.map(item => item.id);
- } else {
- proxy.$modal.msgWarning('璇烽�夋嫨鏁版嵁')
- return
+ };
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const pagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ listCustomer({ ...searchForm.value, ...page }).then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ }).catch(() => {
+ tableLoading.value = false;
+ });
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+ /** 鎻愪氦涓婁紶鏂囦欢 */
+ function submitFileForm() {
+ upload.isUploading = true;
+ proxy.$refs["uploadRef"].submit();
}
- ElMessageBox.confirm(
- '閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�',
- '鍒犻櫎鎻愮ず', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning',
+ /** 瀵煎叆鎸夐挳鎿嶄綔 */
+ function handleImport() {
+ upload.title = "瀹㈡埛瀵煎叆";
+ upload.open = true;
+ }
+ /** 涓嬭浇妯℃澘 */
+ function importTemplate() {
+ proxy.download("/basic/customer/downloadTemplate", {}, "瀹㈡埛瀵煎叆妯℃澘.xlsx");
+ }
+ // 鎵撳紑寮规
+ const openForm = (type, row) => {
+ operationType.value = type;
+ form.value = {};
+ form.value.maintainer = userStore.nickName;
+ formYYs.value.contactList = [
+ {
+ contactPerson: "",
+ contactPhone: "",
+ },
+ ];
+ form.value.type = 0;
+ form.value.maintenanceTime = getCurrentDate();
+ userListNoPage().then(res => {
+ userList.value = res.data;
+ });
+ if (type === "edit") {
+ getCustomer(row.id).then(res => {
+ form.value = { ...res.data };
+ formYYs.value.contactList = (res.data.contactPerson || "")
+ .split(",")
+ .filter(item => item)
+ .map((item, index) => {
+ return {
+ contactPerson: item,
+ contactPhone: (res.data.contactPhone || "").split(",")[index],
+ };
+ });
+ if (formYYs.value.contactList.length === 0) {
+ formYYs.value.contactList = [{ contactPerson: "", contactPhone: "" }];
+ }
+ });
+ }
+ dialogFormVisible.value = true;
+ };
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = () => {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ if (operationType.value === "edit") {
+ submitEdit();
+ } else {
+ submitAdd();
+ }
}
- ).then(() => {
- tableLoading.value = true
- delCustomer(ids).then(res => {
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛")
- getList()
- }).finally(() => {
- tableLoading.value = false
+ });
+ };
+ // 鎻愪氦鏂板
+ const submitAdd = () => {
+ if (formYYs.value.contactList.length < 1) {
+ return proxy.$modal.msgWarning("璇疯嚦灏戞坊鍔犱竴涓仈绯讳汉");
+ }
+ form.value.contactPerson = formYYs.value.contactList
+ .map(item => item.contactPerson)
+ .join(",");
+ form.value.contactPhone = formYYs.value.contactList
+ .map(item => item.contactPhone)
+ .join(",");
+ addCustomer(form.value).then(() => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ };
+ // 鎻愪氦淇敼
+ const submitEdit = () => {
+ form.value.contactPerson = formYYs.value.contactList
+ .map(item => item.contactPerson)
+ .join(",");
+ form.value.contactPhone = formYYs.value.contactList
+ .map(item => item.contactPhone)
+ .join(",");
+ updateCustomer(form.value).then(() => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ };
+ // 瀵煎嚭
+ const handleOut = () => {
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
- }).catch(() => {
- proxy.$modal.msg("宸插彇娑�")
- })
-}
+ .then(() => {
+ proxy.download("/basic/customer/export", { type: 0 }, "瀹㈡埛妗f.xlsx");
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ // 鍒犻櫎
+ const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ const unauthorizedData = selectedRows.value.filter(
+ item => item.type === 1 || item.type === "1"
+ );
+ if (unauthorizedData.length > 0) {
+ proxy.$modal.msgWarning("鍏捣鍒嗛厤鐨勫鎴蜂笉鑳藉垹闄�");
+ return;
+ }
+ ids = selectedRows.value.map(item => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ tableLoading.value = true;
+ delCustomer(ids)
+ .then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
-// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
-function getCurrentDate() {
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, '0'); // 鏈堜唤浠�0寮�濮�
- const day = String(today.getDate()).padStart(2, '0');
- return `${year}-${month}-${day}`;
-}
+ // 鎵撳紑杩�3骞磋储鍔℃姤琛ㄥ脊绐�
+ const openReportDialog = row => {
+ reportCustomer.id = row.id;
+ reportCustomer.customerName = row.customerName;
+ resetReportForm();
+ loadReports(row.id);
+ reportDialogVisible.value = true;
+ };
-getList()
+ const loadReports = customerId => {
+ listCustomerFinancialReport({ customerId }).then(res => {
+ reportRows.value = res.data || [];
+ });
+ };
+
+ const reportStatusText = status => {
+ if (status === 1) return "宸查�氳繃";
+ if (status === 2) return "宸查��鍥�";
+ return "寰呭鎵�";
+ };
+ const reportStatusTag = status => {
+ if (status === 1) return "success";
+ if (status === 2) return "danger";
+ return "warning";
+ };
+
+ const resetReportForm = () => {
+ reportForm.reportYear = nowYear;
+ reportForm.reportName = "";
+ reportForm.reportFiles = "";
+ };
+
+ const editReport = row => {
+ reportForm.reportYear = row.reportYear;
+ reportForm.reportName = row.reportName;
+ reportForm.reportFiles = row.reportFiles;
+ };
+
+ const saveReport = () => {
+ if (!reportForm.reportFiles) {
+ proxy.$modal.msgWarning("璇蜂笂浼犺储鍔℃姤琛ㄩ檮浠�");
+ return;
+ }
+ reportSaving.value = true;
+ saveCustomerFinancialReport({
+ customerId: reportCustomer.id,
+ reportYear: reportForm.reportYear,
+ reportName: reportForm.reportName,
+ reportFiles: reportForm.reportFiles,
+ }).then(() => {
+ proxy.$modal.msgSuccess("淇濆瓨鎴愬姛");
+ resetReportForm();
+ loadReports(reportCustomer.id);
+ }).finally(() => {
+ reportSaving.value = false;
+ });
+ };
+
+ const deleteReport = row => {
+ ElMessageBox.confirm("纭畾瑕佸垹闄よ骞村害璐㈠姟鎶ヨ〃鍚楋紵", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ delCustomerFinancialReport(row.id).then(() => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ loadReports(reportCustomer.id);
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ const closeReportDialog = () => {
+ reportDialogVisible.value = false;
+ reportRows.value = [];
+ resetReportForm();
+ };
+
+ // 鎵撳紑璇︽儏寮圭獥
+ const openDetailDialog = row => {
+ getCustomer(row.id).then(res => {
+ Object.assign(detailForm, res.data);
+ const bindUser = userList.value.find(item => item.userId === res.data.bindUserId);
+ detailForm.bindUserName = bindUser ? bindUser.nickName : "";
+ detailReports.value = [];
+ detailDialogVisible.value = true;
+ listCustomerFinancialReport({ customerId: row.id }).then(reportRes => {
+ detailReports.value = reportRes.data || [];
+ });
+ });
+ };
+
+ // 鍏抽棴璇︽儏寮圭獥
+ const closeDetailDialog = () => {
+ detailDialogVisible.value = false;
+ };
+
+ // 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
+ function getCurrentDate() {
+ const today = new Date();
+ const year = today.getFullYear();
+ const month = String(today.getMonth() + 1).padStart(2, "0");
+ const day = String(today.getDate()).padStart(2, "0");
+ return `${year}-${month}-${day}`;
+ }
+
+ onMounted(() => {
+ userListNoPage().then(res => {
+ userList.value = res.data;
+ });
+ getList();
+ });
</script>
<style scoped lang="scss">
+ .detail-section {
+ margin-bottom: 20px;
+ padding: 15px;
+ background-color: #f9f9f9;
+ border-radius: 4px;
+ }
+ .section-title {
+ font-size: 16px;
+ font-weight: bold;
+ margin: 0 0 15px 0;
+ color: #333;
+ }
+
+ .info-display {
+ background-color: #fff;
+ padding: 15px;
+ border-radius: 4px;
+ }
+
+ .info-item {
+ margin-bottom: 12px;
+ display: flex;
+ align-items: flex-start;
+ }
+
+ .info-label {
+ width: 120px;
+ font-weight: 500;
+ color: #606266;
+ margin-right: 10px;
+ }
+
+ .info-value {
+ flex: 1;
+ color: #303133;
+ word-break: break-word;
+ }
+
+ .no-record {
+ text-align: center;
+ padding: 20px;
+ color: #999;
+ font-size: 14px;
+ }
+
+ .report-customer {
+ font-size: 14px;
+ color: #606266;
+ margin-bottom: 12px;
+ }
+
+ .report-form {
+ margin-bottom: 4px;
+ }
+
+ .report-actions {
+ margin-top: 10px;
+ }
</style>
--
Gitblit v1.9.3