From 05eb7f660c2968afcfa5d8c961a17d5bf9964d2f Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 27 三月 2026 13:46:39 +0800
Subject: [PATCH] feat(地区管理): 增加地区增删改查功能并优化客户档案页面
---
src/views/basicData/customerFile/index.vue | 1384 ++++++++++++++++++++++++++-------------------------------
1 files changed, 633 insertions(+), 751 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index a800885..cdb802b 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -1,52 +1,158 @@
<template>
<div class="app-container">
- <div class="search_form">
- <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 class="customer-split">
+ <div class="left-panel">
+ <div class="left-header">
+ <div class="left-title">鍦板尯</div>
+ <div class="left-actions">
+ <el-button type="primary"
+ size="small"
+ @click="openAddRegionDialog">鏂板</el-button>
+ <el-button size="small"
+ @click="openEditRegionDialog">淇敼</el-button>
+ <el-button type="danger"
+ plain
+ size="small"
+ @click="handleDeleteRegion">鍒犻櫎</el-button>
+ </div>
+ </div>
+
+ <div class="left-search">
+ <el-input v-model="regionKeyword"
+ placeholder="鏌ヨ鍦板尯"
+ clearable
+ :prefix-icon="Search" />
+ </div>
+
+ <div class="left-list">
+ <el-skeleton v-if="regionsLoading"
+ :rows="8"
+ animated />
+ <template v-else>
+ <div class="region-item"
+ :class="{ active: selectedRegionId === 0 }"
+ @click="selectRegion('')">鍏ㄩ儴</div>
+ <el-tree ref="regionTreeRef"
+ :data="regionTreeData"
+ node-key="id"
+ :props="regionTreeProps"
+ :filter-node-method="filterRegionNode"
+ highlight-current
+ default-expand-all
+ :expand-on-click-node="false"
+ @node-click="handleRegionNodeClick" />
+ <div v-if="regionTreeData.length === 0"
+ class="empty-tip">鏆傛棤鍦板尯</div>
+ </template>
+ </div>
</div>
- <div>
- <el-button type="primary"
- @click="openForm('add')">鏂板瀹㈡埛</el-button>
- <el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="info"
- plain
- icon="Upload"
- @click="handleImport">瀵煎叆</el-button>
- <el-button type="danger"
- plain
- @click="handleDelete">鍒犻櫎</el-button>
+
+ <div class="right-panel">
+ <div class="toolbar-card">
+ <div class="search_form right-search-form">
+ <div class="search-fields">
+ <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>
+ <div class="toolbar-divider"></div>
+ <div class="action-buttons">
+ <el-button type="primary"
+ @click="openForm('add')">鏂板瀹㈡埛</el-button>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="info"
+ plain
+ icon="Upload"
+ @click="handleImport">瀵煎叆</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
+ </div>
+ </div>
+ </div>
+ <div class="table_list table-card">
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"></PIMTable>
+ </div>
</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="addRegionDialogVisible"
+ title="鏂板鍦板尯"
+ width="420px"
+ @close="closeAddRegionDialog">
+ <el-form :model="addRegionForm"
+ label-width="90px">
+ <el-form-item label="涓婄骇鍦板尯">
+ <el-cascader v-model="addRegionForm.parentPath"
+ :options="regionTreeData"
+ :props="regionCascaderProps"
+ clearable
+ filterable
+ placeholder="涓嶉�夊垯涓洪《绾у湴鍖�" />
+ </el-form-item>
+ <el-form-item label="鍦板尯鍚嶇О">
+ <el-input v-model="addRegionForm.regionsName"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="submitAddRegion">纭</el-button>
+ <el-button @click="closeAddRegionDialog">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ <el-dialog v-model="editRegionDialogVisible"
+ title="淇敼鍦板尯"
+ width="420px"
+ @close="closeEditRegionDialog">
+ <el-form :model="editRegionForm"
+ label-width="90px">
+ <el-form-item label="涓婄骇鍦板尯">
+ <el-input :value="editRegionParentLabel"
+ disabled />
+ </el-form-item>
+ <el-form-item label="鍦板尯鍚嶇О">
+ <el-input v-model="editRegionForm.regionsName"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="submitEditRegion">纭</el-button>
+ <el-button @click="closeEditRegionDialog">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
<el-dialog v-model="dialogFormVisible"
:title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
width="70%"
@@ -76,6 +182,19 @@
</el-row>
<el-row :gutter="30">
<el-col :span="12">
+ <el-form-item label="瀹㈡埛鍦板尯锛�"
+ prop="regions">
+ <el-cascader v-model="formRegionPath"
+ :options="regionTreeData"
+ :props="regionCascaderProps"
+ clearable
+ filterable
+ style="width: 100%"
+ placeholder="璇烽�夋嫨"
+ @change="handleFormRegionChange" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
<el-form-item label="瀹㈡埛鍦板潃锛�"
prop="companyAddress">
<el-input v-model="form.companyAddress"
@@ -83,15 +202,6 @@
clearable />
</el-form-item>
</el-col>
- <el-col :span="12">
- <el-form-item label="瀹㈡埛鍦板尯锛�"
- prop="regions">
- <el-input v-model="form.regions"
- placeholder="璇疯緭鍏�"
- clearable />
- </el-form-item>
- </el-col>
-
</el-row>
<el-row :gutter="30">
<el-col :span="12">
@@ -251,130 +361,10 @@
</div>
</template>
</el-dialog>
- <!-- 鍥炶鎻愰啋瀵硅瘽妗� -->
- <el-dialog title="鍥炶鎻愰啋"
- v-model="reminderDialogVisible"
- width="500px"
- @close="closeReminderDialog">
- <el-form :model="reminderForm"
- label-width="100px"
- :rules="reminderRules"
- ref="reminderFormRef">
- <el-form-item label="瀹㈡埛鍚嶇О锛�">
- <el-input v-model="reminderForm.customerName"
- disabled />
- </el-form-item>
- <el-form-item label="鎻愰啋寮�鍏筹細">
- <el-switch v-model="reminderForm.reminderSwitch" />
- </el-form-item>
- <el-form-item label="鎻愰啋鍐呭锛�"
- prop="reminderContent">
- <el-input v-model="reminderForm.reminderContent"
- type="textarea"
- :maxlength="100"
- show-word-limit
- placeholder="璇疯緭鍏ユ彁閱掑唴瀹�" />
- </el-form-item>
- <el-form-item label="鎻愰啋鏃堕棿锛�"
- prop="reminderTime">
- <el-date-picker v-model="reminderForm.reminderTime"
- type="datetime"
- value-format="YYYY-MM-DD HH:mm:ss"
- format="YYYY-MM-DD HH:mm:ss"
- placeholder="璇烽�夋嫨鎻愰啋鏃堕棿"
- style="width: 100%" />
- </el-form-item>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitReminderForm">纭</el-button>
- <el-button @click="closeReminderDialog">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
- <!-- 娣诲姞/淇敼娲借皥杩涘害瀵硅瘽妗� -->
- <el-dialog :title="negotiationForm.editIndex !== undefined ? '淇敼杩涘害' : '娣诲姞杩涘害'"
- v-model="negotiationDialogVisible"
- width="600px"
- @close="closeNegotiationDialog">
- <el-form :model="negotiationForm"
- label-width="100px"
- :rules="negotiationRules"
- ref="negotiationFormRef">
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="璺熻繘鏂瑰紡锛�"
- prop="followUpMethod">
- <el-select v-model="negotiationForm.followUpMethod"
- placeholder="璇烽�夋嫨"
- style="width: 100%">
- <el-option label="鐢佃瘽"
- value="鐢佃瘽" />
- <el-option label="閭欢"
- value="閭欢" />
- <el-option label="涓婇棬"
- value="涓婇棬" />
- <el-option label="寰俊"
- value="寰俊" />
- <el-option label="鍏朵粬"
- value="鍏朵粬" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="璺熻繘绋嬪害锛�"
- prop="followUpLevel">
- <el-select v-model="negotiationForm.followUpLevel"
- placeholder="璇烽�夋嫨"
- style="width: 100%">
- <el-option label="娼滃湪瀹㈡埛"
- value="娼滃湪瀹㈡埛" />
- <el-option label="鍒濇鎷滆"
- value="鍒濇鎷滆" />
- <el-option label="澶氭鎷滆"
- value="澶氭鎷滆" />
- <el-option label="鎰忓悜瀹㈡埛"
- value="鎰忓悜瀹㈡埛" />
- <el-option label="宸茬绾﹀鎴�"
- value="宸茬绾﹀鎴�" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row :gutter="20">
- <el-col :span="12">
- <el-form-item label="璺熻繘鏃堕棿锛�"
- prop="followUpTime">
- <el-date-picker v-model="negotiationForm.followUpTime"
- type="datetime"
- value-format="YYYY-MM-DD HH:mm:ss"
- format="YYYY-MM-DD HH:mm:ss"
- placeholder="璇烽�夋嫨"
- style="width: 100%" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="璺熻繘浜猴細">
- <el-input v-model="negotiationForm.followerUserName"
- disabled />
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item label="鍐呭锛�"
- prop="content">
- <el-input v-model="negotiationForm.content"
- type="textarea"
- :rows="4"
- placeholder="璇疯緭鍏�" />
- </el-form-item>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitNegotiationForm">纭</el-button>
- <el-button @click="closeNegotiationDialog">鍙栨秷</el-button>
- </div>
- </template>
- </el-dialog>
+ <!--
+ 鍥炶鎻愰啋 / 娲借皥杩涘害鍔熻兘锛堝叆鍙e強寮圭獥锛夊凡鎸夐渶姹傛敞閲娿��
+ 濡傞渶鎭㈠锛氭斁寮�鎿嶄綔鍒楀叆鍙� + 鍙栨秷鏈娉ㄩ噴 + 鎭㈠ script 涓浉鍏冲彉閲�/鏂规硶/鎺ュ彛寮曞叆銆�
+ -->
<!-- 瀹㈡埛璇︽儏瀵硅瘽妗� -->
<el-dialog title="瀹㈡埛璇︽儏"
v-model="detailDialogVisible"
@@ -407,7 +397,7 @@
</el-col>
<el-col :span="12">
<div class="info-item">
- <span class="info-label">鍏徃鐢佃瘽锛�</span>
+ <span class="info-label">瀹㈡埛鐢佃瘽锛�</span>
<span class="info-value">{{ detailForm.companyPhone }}</span>
</div>
</el-col>
@@ -415,52 +405,60 @@
<el-row :gutter="20">
<el-col :span="12">
<div class="info-item">
- <span class="info-label">鍏徃鍦板潃锛�</span>
+ <span class="info-label">瀹㈡埛鍦板尯锛�</span>
+ <span class="info-value">{{ detailForm.regionsName || detailForm.regions }}</span>
+ </div>
+ </el-col>
+ <el-col :span="12">
+ <div class="info-item">
+ <span class="info-label">瀹㈡埛鍦板潃锛�</span>
<span class="info-value">{{ detailForm.companyAddress }}</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.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-row>
+ <el-row :gutter="20">
<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-row>
+ <el-row :gutter="20">
<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.maintainer }}</span>
</div>
</el-col>
+ </el-row>
+ <el-row :gutter="20">
<el-col :span="12">
<div class="info-item">
<span class="info-label">缁存姢鏃堕棿锛�</span>
@@ -470,169 +468,38 @@
</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)">
- 鍒犻櫎
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <div v-if="negotiationRecords.length === 0"
- class="no-records">
- 鏆傛棤娲借皥杩涘害璁板綍
- </div>
- </div>
+ <!--
+ 娲借皥杩涘害璁板綍锛堝惈闄勪欢/淇敼/鍒犻櫎锛夊凡鎸夐渶姹傛暣浣撴敞閲娿��
+ 濡傞渶鎭㈠锛氬彇娑堟湰娈垫敞閲婏紝骞舵仮澶� script 涓浉鍏冲彉閲�/鏂规硶/鎺ュ彛寮曞叆銆�
+ -->
<template #footer>
<div class="dialog-footer">
<el-button @click="closeDetailDialog">鍏抽棴</el-button>
</div>
</template>
</el-dialog>
- <!-- 闄勪欢涓婁紶寮圭獥 -->
- <el-dialog title="闄勪欢绠$悊"
- v-model="attachmentDialogVisible"
- width="600px"
- @close="closeAttachmentDialog">
- <div class="attachment-section">
- <div class="upload-area">
- <el-upload ref="attachmentUploadRef"
- :action="getAttachmentUploadUrl()"
- :headers="attachmentUploadHeaders"
- :file-list="currentAttachmentList"
- :on-success="handleAttachmentSuccess"
- :on-error="handleAttachmentError"
- :on-remove="handleAttachmentRemove"
- :before-upload="beforeAttachmentUpload"
- multiple
- :limit="10"
- name="files">
- <el-button type="primary">
- <el-icon>
- <Upload />
- </el-icon>
- 涓婁紶闄勪欢
- </el-button>
- <template #tip>
- <div class="el-upload__tip">
- 鏀寔涓婁紶鍥剧墖銆佹枃妗g瓑鏂囦欢锛屽崟涓枃浠朵笉瓒呰繃50MB
- </div>
- </template>
- </el-upload>
- </div>
- <div v-if="currentAttachmentList.length > 0"
- class="attachment-list">
- <h4>宸蹭笂浼犻檮浠讹細</h4>
- <el-table :data="currentAttachmentList"
- border
- size="small">
- <el-table-column prop="name"
- label="鏂囦欢鍚�"
- show-overflow-tooltip />
- <el-table-column prop="size"
- label="澶у皬"
- width="100">
- <template #default="{ row }">
- {{ formatFileSize(row.size) }}
- </template>
- </el-table-column>
- <el-table-column label="鎿嶄綔"
- width="120"
- align="center">
- <template #default="{ row, $index }">
- <el-button type="primary"
- link
- @click="downloadAttachment(row)">
- 涓嬭浇
- </el-button>
- <el-button type="danger"
- link
- @click="deleteAttachment(row, $index)">
- 鍒犻櫎
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div v-else
- class="no-attachment">
- 鏆傛棤闄勪欢
- </div>
- </div>
- <template #footer>
- <div class="dialog-footer">
- <el-button @click="closeAttachmentDialog">鍏抽棴</el-button>
- </div>
- </template>
- </el-dialog>
+ <!-- 闄勪欢绠$悊鍔熻兘宸查殢娲借皥杩涘害鏁翠綋娉ㄩ噴 -->
</div>
</template>
<script setup>
- import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue";
- import { Search, Paperclip, Upload } from "@element-plus/icons-vue";
+ import { onMounted, ref, reactive, getCurrentInstance, toRefs, computed, watch } from "vue";
+ import { Search } from "@element-plus/icons-vue";
import {
addCustomer,
delCustomer,
getCustomer,
listCustomer,
+ listCustomerRegions,
+ addCustomerRegions,
+ updateCustomerRegions,
+ delCustomerRegions,
updateCustomer,
- addCustomerFollow,
- updateCustomerFollow,
- delCustomerFollow,
- addReturnVisit,
- getReturnVisit,
+ // addCustomerFollow,
+ // updateCustomerFollow,
+ // delCustomerFollow,
+ // addReturnVisit,
+ // getReturnVisit,
} from "@/api/basicData/customerFile.js";
import { ElMessageBox } from "element-plus";
import { userListNoPage } from "@/api/system/user.js";
@@ -641,54 +508,55 @@
const { proxy } = getCurrentInstance();
const userStore = useUserStore();
- // 鍥炶鎻愰啋鐩稿叧
- const reminderDialogVisible = ref(false);
- const reminderFormRef = ref();
- const currentCustomerId = ref();
- const reminderForm = reactive({
- customerName: "",
- reminderSwitch: false,
- reminderContent: "",
- reminderTime: "",
- });
- const reminderRules = {
- reminderContent: [
- { required: true, message: "璇疯緭鍏ユ彁閱掑唴瀹�", trigger: "blur" },
- ],
- reminderTime: [
- { required: true, message: "璇烽�夋嫨鎻愰啋鏃堕棿", trigger: "change" },
- ],
- };
-
- // 娲借皥杩涘害鐩稿叧
- const negotiationDialogVisible = ref(false);
- const negotiationFormRef = ref();
- const negotiationForm = reactive({
- customerName: "",
- customerId: "",
- followUpMethod: "",
- followUpLevel: "",
- followUpTime: "",
- followerUserName: "",
- content: "",
- });
- const negotiationRules = {
- followUpMethod: [
- { required: true, message: "璇烽�夋嫨璺熻繘鏂瑰紡", trigger: "change" },
- ],
- followUpLevel: [
- { required: true, message: "璇烽�夋嫨璺熻繘绋嬪害", trigger: "change" },
- ],
- followUpTime: [
- { required: true, message: "璇烽�夋嫨璺熻繘鏃堕棿", trigger: "change" },
- ],
- content: [{ required: true, message: "璇疯緭鍏ュ唴瀹�", trigger: "blur" }],
- };
+ // 鍥炶鎻愰啋/娲借皥杩涘害鐩稿叧锛堝凡鎸夐渶姹傛暣浣撴敞閲婏級
+ // const reminderDialogVisible = ref(false);
+ // const reminderFormRef = ref();
+ // const currentCustomerId = ref();
+ // const reminderForm = reactive({
+ // customerName: "",
+ // reminderSwitch: false,
+ // reminderContent: "",
+ // reminderTime: "",
+ // });
+ // const reminderRules = {
+ // reminderContent: [
+ // { required: true, message: "璇疯緭鍏ユ彁閱掑唴瀹�", trigger: "blur" },
+ // ],
+ // reminderTime: [
+ // { required: true, message: "璇烽�夋嫨鎻愰啋鏃堕棿", trigger: "change" },
+ // ],
+ // };
+ //
+ // const negotiationDialogVisible = ref(false);
+ // const negotiationFormRef = ref();
+ // const negotiationForm = reactive({
+ // customerName: "",
+ // customerId: "",
+ // followUpMethod: "",
+ // followUpLevel: "",
+ // followUpTime: "",
+ // followerUserName: "",
+ // content: "",
+ // });
+ // const negotiationRules = {
+ // followUpMethod: [
+ // { required: true, message: "璇烽�夋嫨璺熻繘鏂瑰紡", trigger: "change" },
+ // ],
+ // followUpLevel: [
+ // { required: true, message: "璇烽�夋嫨璺熻繘绋嬪害", trigger: "change" },
+ // ],
+ // followUpTime: [
+ // { required: true, message: "璇烽�夋嫨璺熻繘鏃堕棿", trigger: "change" },
+ // ],
+ // content: [{ required: true, message: "璇疯緭鍏ュ唴瀹�", trigger: "blur" }],
+ // };
// 璇︽儏鐩稿叧
const detailDialogVisible = ref(false);
const detailForm = reactive({
customerName: "",
+ regionsName: "",
+ regions: "",
customerType: "",
taxpayerIdentificationNumber: "",
companyPhone: "",
@@ -703,21 +571,13 @@
});
const negotiationRecords = ref([]);
- // 闄勪欢鐩稿叧
- const attachmentDialogVisible = ref(false);
- const attachmentUploadRef = ref();
- const currentAttachmentList = ref([]);
- const currentFollowRecord = ref({});
- const attachmentUploadHeaders = { Authorization: "Bearer " + getToken() };
-
- // 鍔ㄦ�佹瀯寤轰笂浼燯RL
- const getAttachmentUploadUrl = () => {
- const baseUrl =
- import.meta.env.VITE_APP_BASE_API + "/basic/customer-follow/upload";
- return currentFollowRecord.value.id
- ? `${baseUrl}/${currentFollowRecord.value.id}`
- : baseUrl;
- };
+ // 闄勪欢鐩稿叧锛堥殢娲借皥杩涘害鏁翠綋娉ㄩ噴锛�
+ // const attachmentDialogVisible = ref(false);
+ // const attachmentUploadRef = ref();
+ // const currentAttachmentList = ref([]);
+ // const currentFollowRecord = ref({});
+ // const attachmentUploadHeaders = { Authorization: "Bearer " + getToken() };
+ // const getAttachmentUploadUrl = () => {};
const tableColumn = ref([
{
@@ -793,7 +653,7 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 290,
+ width: 120,
operation: [
{
name: "缂栬緫",
@@ -802,20 +662,20 @@
openForm("edit", row);
},
},
- {
- name: "娣诲姞娲借皥杩涘害",
- type: "text",
- clickFun: row => {
- openNegotiationDialog(row);
- },
- },
- {
- name: "鍥炶鎻愰啋",
- type: "text",
- clickFun: row => {
- openReminderDialog(row);
- },
- },
+ // {
+ // name: "娣诲姞娲借皥杩涘害",
+ // type: "text",
+ // clickFun: row => {
+ // openNegotiationDialog(row);
+ // },
+ // },
+ // {
+ // name: "鍥炶鎻愰啋",
+ // type: "text",
+ // clickFun: row => {
+ // openReminderDialog(row);
+ // },
+ // },
{
name: "璇︽儏",
type: "text",
@@ -853,11 +713,14 @@
searchForm: {
customerName: "",
customerType: "",
+ regions: "",
+ regionsId: "",
},
form: {
customerName: "",
taxpayerIdentificationNumber: "",
companyAddress: "",
+ regions: "",
companyPhone: "",
contactPerson: "",
contactPhone: "",
@@ -874,6 +737,7 @@
{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
],
companyAddress: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ regions: [{ required: true, message: "璇烽�夋嫨瀹㈡埛鍦板尯", trigger: "change" }],
companyPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
// contactPerson: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
// contactPhone: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -943,6 +807,173 @@
},
});
const { searchForm, form, rules } = toRefs(data);
+
+ // 宸︿晶鍦板尯鏍�
+ const regionTreeRef = ref();
+ const regionsLoading = ref(false);
+ const regionTreeData = ref([]);
+ const regionKeyword = ref("");
+ const selectedRegionId = ref(0); // 0 琛ㄧず鍏ㄩ儴
+ const selectedRegionNode = ref(null);
+ const formRegionPath = ref([]);
+ const addRegionDialogVisible = ref(false);
+ const editRegionDialogVisible = ref(false);
+ const addRegionForm = reactive({ parentPath: [], regionsName: "" });
+ const editRegionForm = reactive({ id: undefined, parentId: 0, regionsName: "" });
+ const regionTreeProps = { label: "label", children: "children" };
+ const regionCascaderProps = {
+ value: "id",
+ label: "label",
+ children: "children",
+ checkStrictly: true,
+ emitPath: true,
+ };
+ const regionNodeMap = computed(() => {
+ const map = new Map();
+ const walk = list => {
+ (list || []).forEach(node => {
+ map.set(node.id, node);
+ walk(node.children || []);
+ });
+ };
+ walk(regionTreeData.value);
+ return map;
+ });
+ const editRegionParentLabel = computed(() => {
+ if (!editRegionForm.parentId) return "椤剁骇鍦板尯";
+ return regionNodeMap.value.get(editRegionForm.parentId)?.label || "鏈煡";
+ });
+
+ const normalizeRegionTree = list => {
+ return (list || []).map(item => ({
+ ...item,
+ label: item.label || item.regionsName || "",
+ regionsName: item.regionsName || item.label || "",
+ children: normalizeRegionTree(item.children || []),
+ }));
+ };
+
+ const fetchRegions = async () => {
+ regionsLoading.value = true;
+ try {
+ const res = await listCustomerRegions({});
+ const list = res?.data ?? res?.rows ?? res ?? [];
+ regionTreeData.value = Array.isArray(list) ? normalizeRegionTree(list) : [];
+ } catch (e) {
+ console.error("鍦板尯鏌ヨ澶辫触:", e);
+ regionTreeData.value = [];
+ } finally {
+ regionsLoading.value = false;
+ }
+ };
+
+ const filterRegionNode = (value, data) => {
+ if (!value) return true;
+ return (data.label || "").includes(value);
+ };
+
+ const selectRegion = regionName => {
+ selectedRegionId.value = 0;
+ selectedRegionNode.value = null;
+ searchForm.value.regions = regionName || "";
+ searchForm.value.regionsId = "";
+ handleQuery();
+ };
+ const handleRegionNodeClick = data => {
+ selectedRegionId.value = data.id;
+ selectedRegionNode.value = data;
+ searchForm.value.regions = data.regionsName || data.label || "";
+ searchForm.value.regionsId = data.id;
+ handleQuery();
+ };
+
+ const openAddRegionDialog = () => {
+ addRegionForm.parentPath = [];
+ addRegionForm.regionsName = "";
+ addRegionDialogVisible.value = true;
+ };
+ const closeAddRegionDialog = () => {
+ addRegionDialogVisible.value = false;
+ addRegionForm.parentPath = [];
+ addRegionForm.regionsName = "";
+ };
+ const submitAddRegion = async () => {
+ const name = (addRegionForm.regionsName || "").trim();
+ if (!name) return proxy.$modal.msgWarning("璇疯緭鍏ュ湴鍖哄悕绉�");
+ const parentPath = addRegionForm.parentPath || [];
+ const parentId = parentPath.length ? parentPath[parentPath.length - 1] : 0;
+ await addCustomerRegions({ parentId, regionsName: name });
+ proxy.$modal.msgSuccess("鏂板鎴愬姛");
+ await fetchRegions();
+ closeAddRegionDialog();
+ };
+
+ const openEditRegionDialog = () => {
+ if (!selectedRegionNode.value || selectedRegionId.value === 0) {
+ return proxy.$modal.msgWarning("璇峰厛閫夋嫨瑕佷慨鏀圭殑鍦板尯");
+ }
+ editRegionForm.id = selectedRegionNode.value.id;
+ editRegionForm.parentId = selectedRegionNode.value.parentId || 0;
+ editRegionForm.regionsName =
+ selectedRegionNode.value.regionsName || selectedRegionNode.value.label || "";
+ editRegionDialogVisible.value = true;
+ };
+ const closeEditRegionDialog = () => {
+ editRegionDialogVisible.value = false;
+ editRegionForm.id = undefined;
+ editRegionForm.parentId = 0;
+ editRegionForm.regionsName = "";
+ };
+ const submitEditRegion = async () => {
+ const name = (editRegionForm.regionsName || "").trim();
+ if (!name) return proxy.$modal.msgWarning("璇疯緭鍏ュ湴鍖哄悕绉�");
+ await updateCustomerRegions({
+ id: editRegionForm.id,
+ parentId: editRegionForm.parentId,
+ regionsName: name,
+ });
+ proxy.$modal.msgSuccess("淇敼鎴愬姛");
+ await fetchRegions();
+ closeEditRegionDialog();
+ };
+ const handleDeleteRegion = () => {
+ if (!selectedRegionNode.value || selectedRegionId.value === 0) {
+ return proxy.$modal.msgWarning("璇峰厛閫夋嫨瑕佸垹闄ょ殑鍦板尯");
+ }
+ ElMessageBox.confirm("鍒犻櫎鍚庝笉鍙仮澶嶏紝鏄惁缁х画锛�", "鍒犻櫎鍦板尯", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(async () => {
+ await delCustomerRegions(selectedRegionNode.value.id);
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ selectRegion("");
+ await fetchRegions();
+ })
+ .catch(() => {});
+ };
+
+ const handleFormRegionChange = value => {
+ const ids = value || [];
+ if (!ids.length) {
+ form.value.regions = "";
+ return;
+ }
+ const lastId = ids[ids.length - 1];
+ form.value.regions = regionNodeMap.value.get(lastId)?.regionsName || "";
+ };
+ const findRegionPathByName = (tree, targetName, parentPath = []) => {
+ for (const item of tree || []) {
+ const currentPath = [...parentPath, item.id];
+ if ((item.regionsName || item.label) === targetName) {
+ return currentPath;
+ }
+ const childResult = findRegionPathByName(item.children || [], targetName, currentPath);
+ if (childResult.length) return childResult;
+ }
+ return [];
+ };
const addNewContact = () => {
formYYs.value.contactList.push({
contactPerson: "",
@@ -996,6 +1027,7 @@
const openForm = (type, row) => {
operationType.value = type;
form.value = {};
+ formRegionPath.value = [];
form.value.maintainer = userStore.nickName;
formYYs.value.contactList = [
{
@@ -1010,6 +1042,10 @@
if (type === "edit") {
getCustomer(row.id).then(res => {
form.value = { ...res.data };
+ formRegionPath.value = findRegionPathByName(
+ regionTreeData.value,
+ form.value.regions || ""
+ );
formYYs.value.contactList = res.data.contactPerson
.split(",")
.map((item, index) => {
@@ -1068,6 +1104,7 @@
// 鍏抽棴寮规
const closeDia = () => {
proxy.resetForm("formRef");
+ formRegionPath.value = [];
dialogFormVisible.value = false;
};
// 瀵煎嚭
@@ -1122,168 +1159,17 @@
});
};
- // 鎵撳紑鍥炶鎻愰啋寮圭獥
- const openReminderDialog = row => {
- currentCustomerId.value = row.id;
- reminderForm.customerName = row.customerName;
- reminderForm.reminderSwitch = false;
- reminderForm.reminderContent = "";
- reminderForm.reminderTime = "";
-
- // 灏濊瘯鑾峰彇宸叉湁鐨勫洖璁挎彁閱�
- getReturnVisit(row.id)
- .then(res => {
- if (res.code === 200 && res.data) {
- reminderForm.reminderSwitch = res.data.isEnabled === 1;
- reminderForm.reminderContent = res.data.content;
- reminderForm.reminderTime = res.data.reminderTime;
- reminderForm.id = res.data.id;
- }
- })
- .catch(error => {
- console.error("鑾峰彇鍥炶鎻愰啋澶辫触:", error);
- });
-
- reminderDialogVisible.value = true;
- };
-
- // 鍏抽棴鍥炶鎻愰啋寮圭獥
- const closeReminderDialog = () => {
- proxy.resetForm("reminderFormRef");
- reminderDialogVisible.value = false;
- };
- const submitvalue = ref({});
-
- // 鎻愪氦鍥炶鎻愰啋
- const submitReminderForm = () => {
- console.log("鎻愪氦鍥炶鎻愰啋鏁版嵁:", userStore.id, userStore);
- proxy.$refs.reminderFormRef.validate(valid => {
- if (valid) {
- if (reminderForm.id) {
- submitvalue.value = {
- id: reminderForm.id,
- customerId: currentCustomerId.value,
- isEnabled: reminderForm.reminderSwitch ? 1 : 0,
- content: reminderForm.reminderContent,
- reminderTime: reminderForm.reminderTime,
- remindUserId: userStore.id,
- };
- } else {
- submitvalue.value = {
- customerId: currentCustomerId.value,
- isEnabled: reminderForm.reminderSwitch ? 1 : 0,
- content: reminderForm.reminderContent,
- reminderTime: reminderForm.reminderTime,
- remindUserId: userStore.id,
- };
- }
-
- console.log("鎻愪氦鍥炶鎻愰啋鏁版嵁:", submitvalue.value);
-
- // 璋冪敤鎺ュ彛
- addReturnVisit(submitvalue.value)
- .then(res => {
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鍥炶鎻愰啋璁剧疆鎴愬姛");
- closeReminderDialog();
- } else {
- proxy.$modal.msgError(res.msg || "璁剧疆澶辫触");
- }
- })
- .catch(error => {
- console.error("璁剧疆鍥炶鎻愰啋澶辫触:", error);
- proxy.$modal.msgError("璁剧疆澶辫触");
- });
- }
- });
- };
-
- // 鎵撳紑娲借皥杩涘害寮圭獥
- const openNegotiationDialog = row => {
- negotiationForm.customerName = row.customerName;
- negotiationForm.customerId = row.id;
- negotiationForm.followUpMethod = "";
- negotiationForm.followUpLevel = "";
- negotiationForm.followUpTime = "";
- negotiationForm.followerUserName = userStore.nickName; // 榛樿褰撳墠鐧诲綍浜�
- negotiationForm.content = "";
- // {
- // "customerId": 152,
- // "followUpMethod": "鐢佃瘽娌熼��",
- // "followUpLevel": "娌℃湁鎰忓悜",
- // "followUpTime": "2026-03-04T15:30:00",
- // "followerUserName": "绠$悊鍛樿处鍙�",
- // "content": "111"
- // }
- negotiationDialogVisible.value = true;
- };
-
- // 鍏抽棴娲借皥杩涘害寮圭獥
- const closeNegotiationDialog = () => {
- proxy.resetForm("negotiationFormRef");
- // 娓呴櫎缂栬緫鐘舵��
- delete negotiationForm.editIndex;
- delete negotiationForm.id;
- negotiationDialogVisible.value = false;
- };
-
- // 鎻愪氦娲借皥杩涘害
- const submitNegotiationForm = () => {
- proxy.$refs.negotiationFormRef.validate(valid => {
- if (valid) {
- // 鍒ゆ柇鏄柊澧炶繕鏄慨鏀�
- const isEdit = negotiationForm.editIndex !== undefined;
-
- if (isEdit) {
- // 淇敼鎿嶄綔
- console.log("淇敼娲借皥杩涘害鏁版嵁:", negotiationForm);
- // 杩欓噷鍙互璋冪敤鏇存柊鎺ュ彛
- // 瀹為檯椤圭洰涓渶瑕佹牴鎹悗绔帴鍙h繘琛岃皟鏁�
- // 绀轰緥锛歶pdateCustomerFollow(negotiationForm).then(res => {
- // // 鏇存柊鏈湴鏁版嵁
- // const index = negotiationForm.editIndex;
- // negotiationRecords.value[index] = {
- // followUpTime: negotiationForm.followUpTime,
- // followUpMethod: negotiationForm.followUpMethod,
- // followUpLevel: negotiationForm.followUpLevel,
- // followerUserName: negotiationForm.followerUserName,
- // content: negotiationForm.content,
- // id: negotiationForm.id,
- // };
- // proxy.$modal.msgSuccess("淇敼鎴愬姛");
- // closeNegotiationDialog();
- // });
- updateCustomerFollow(negotiationForm).then(res => {
- // 鏇存柊鏈湴鏁版嵁
- getCustomer(negotiationForm.customerId).then(res => {
- // 鏇存柊鏈湴鏁版嵁
- negotiationRecords.value = res.data.followUpList || [];
- });
- });
- proxy.$modal.msgSuccess("淇敼鎴愬姛");
- closeNegotiationDialog();
- } else {
- // 鏂板鎿嶄綔
- console.log("鎻愪氦娲借皥杩涘害鏁版嵁:", negotiationForm);
- addCustomerFollow(negotiationForm).then(res => {
- // 娣诲姞鎴愬姛鍚庢洿鏂拌鎯呴〉闈㈢殑杩涘害璁板綍
- const newRecord = {
- followUpTime: negotiationForm.followUpTime,
- followUpMethod: negotiationForm.followUpMethod,
- followUpLevel: negotiationForm.followUpLevel,
- followerUserName: negotiationForm.followerUserName,
- content: negotiationForm.content,
- };
- negotiationRecords.value.unshift(newRecord);
-
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeNegotiationDialog();
- getList();
- });
- }
- }
- });
- };
+ /*
+ * 鍥炶鎻愰啋 / 娲借皥杩涘害鍔熻兘锛堝叆鍙e強寮圭獥锛夊凡鎸夐渶姹傛敞閲婏紝浠ヤ笅鏂规硶鏆備笉鍚敤锛�
+ * - openReminderDialog / closeReminderDialog / submitReminderForm
+ * - openNegotiationDialog / closeNegotiationDialog / submitNegotiationForm
+ */
+ // const openReminderDialog = row => {};
+ // const closeReminderDialog = () => {};
+ // const submitReminderForm = () => {};
+ // const openNegotiationDialog = row => {};
+ // const closeNegotiationDialog = () => {};
+ // const submitNegotiationForm = () => {};
// 鎵撳紑璇︽儏寮圭獥
const openDetailDialog = row => {
@@ -1304,190 +1190,11 @@
detailDialogVisible.value = false;
};
- // 淇敼娲借皥璁板綍
- const editNegotiationRecord = (row, index) => {
- // 灏嗗綋鍓嶈褰曟暟鎹~鍏呭埌琛ㄥ崟
- Object.assign(negotiationForm, {
- customerName: row.customerName,
- customerId: row.customerId,
- followUpMethod: row.followUpMethod,
- followUpLevel: row.followUpLevel,
- followUpTime: row.followUpTime,
- followerUserName: row.followerUserName,
- content: row.content,
- id: row.id, // 璁板綍ID鐢ㄤ簬鏇存柊
- editIndex: index, // 璁板綍绱㈠紩鐢ㄤ簬鏈湴鏇存柊
- });
- negotiationDialogVisible.value = true;
- };
-
- // 鍒犻櫎娲借皥璁板綍
- const deleteNegotiationRecord = (row, index) => {
- ElMessageBox.confirm("纭畾瑕佸垹闄よ繖鏉℃唇璋堣褰曞悧锛�", "鍒犻櫎鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- // 杩欓噷鍙互璋冪敤鍒犻櫎鎺ュ彛
- // 瀹為檯椤圭洰涓渶瑕佹牴鎹悗绔帴鍙h繘琛岃皟鏁�
- // 绀轰緥锛歞eleteCustomerFollow(row.id).then(() => {
- // negotiationRecords.value.splice(index, 1);
- // proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- // });
- delCustomerFollow(row.id).then(() => {
- // 鍒犻櫎鎴愬姛鍚庢洿鏂版湰鍦版暟鎹�
- getCustomer(row.customerId).then(res => {
- // 鏇存柊鏈湴鏁版嵁
- negotiationRecords.value = res.data.followUpList || [];
- });
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- });
- // 鏈湴鍒犻櫎锛堟ā鎷燂級
- negotiationRecords.value.splice(index, 1);
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑堝垹闄�");
- });
- };
-
- // 鎵撳紑闄勪欢寮圭獥
- const openAttachmentDialog = row => {
- currentFollowRecord.value = row;
- // 杞崲涓虹鍚圗lement Plus fileList鏍煎紡鐨勬暟缁�
- currentAttachmentList.value = (row.fileList || []).map((file, index) => ({
- name: file.fileName,
- url: file.fileUrl,
- size: file.fileSize,
- id: file.id,
- uid: file.id || index,
- status: "success",
- }));
-
- attachmentDialogVisible.value = true;
- };
-
- // 鍏抽棴闄勪欢寮圭獥
- const closeAttachmentDialog = () => {
- attachmentDialogVisible.value = false;
- currentFollowRecord.value = {};
- currentAttachmentList.value = [];
- };
-
- // 闄勪欢涓婁紶鎴愬姛
- const handleAttachmentSuccess = (response, file, fileList) => {
- if (response.code === 200) {
- proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
- // 鏇存柊褰撳墠璁板綍鐨勯檮浠跺垪琛�
- currentAttachmentList.value = fileList.map(item => ({
- name: item.name,
- size: item.size,
- url: item.response?.data?.url || item.url,
- id: item.response?.data?.id,
- uid: item.uid,
- status: "success",
- }));
- // 鏇存柊鍘熻褰曚腑鐨刦iles瀛楁
- if (currentFollowRecord.value) {
- currentFollowRecord.value.files = [...currentAttachmentList.value];
- }
- } else {
- proxy.$modal.msgError(response.msg || "涓婁紶澶辫触");
- }
- };
-
- // 闄勪欢涓婁紶澶辫触
- const handleAttachmentError = (error, file, fileList) => {
- console.error("涓婁紶澶辫触:", error);
- proxy.$modal.msgError("涓婁紶澶辫触");
- };
-
- // 闄勪欢绉婚櫎
- const handleAttachmentRemove = (file, fileList) => {
- currentAttachmentList.value = fileList;
- // 鏇存柊鍘熻褰曚腑鐨刦iles瀛楁
- if (currentFollowRecord.value) {
- currentFollowRecord.value.files = [...fileList];
- }
- };
-
- // 闄勪欢涓婁紶鍓嶆牎楠�
- const beforeAttachmentUpload = file => {
- const maxSize = 50 * 1024 * 1024; // 50MB
- if (file.size > maxSize) {
- proxy.$modal.msgError("鏂囦欢澶у皬涓嶈兘瓒呰繃50MB");
- return false;
- }
- return true;
- };
-
- // 鏍煎紡鍖栨枃浠跺ぇ灏�
- const formatFileSize = size => {
- if (size < 1024) {
- return size + " B";
- } else if (size < 1024 * 1024) {
- return (size / 1024).toFixed(2) + " KB";
- } else {
- return (size / (1024 * 1024)).toFixed(2) + " MB";
- }
- };
-
- // 涓嬭浇闄勪欢
- const downloadAttachment = row => {
- if (row.url) {
- // proxy.download(row.url, {}, row.name);
- proxy.$download.name(row.url);
- } else {
- proxy.$modal.msgError("涓嬭浇閾炬帴涓嶅瓨鍦�");
- }
- };
-
- // 鍒犻櫎闄勪欢
- const deleteAttachment = (row, index) => {
- ElMessageBox.confirm("纭畾瑕佸垹闄よ繖涓檮浠跺悧锛�", "鍒犻櫎鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- // 璋冪敤鍚庣鎺ュ彛鍒犻櫎闄勪欢
- const deleteUrl =
- import.meta.env.VITE_APP_BASE_API +
- "/basic/customer-follow/file/" +
- row.id;
- fetch(deleteUrl, {
- method: "DELETE",
- headers: {
- Authorization: "Bearer " + getToken(),
- "Content-Type": "application/json",
- },
- })
- .then(response => response.json())
- .then(res => {
- if (res.code === 200) {
- // 鍒犻櫎鎴愬姛鍚庢洿鏂版湰鍦版枃浠跺垪琛�
- currentAttachmentList.value.splice(index, 1);
- // 鏇存柊鍘熻褰曚腑鐨刦iles瀛楁
- if (currentFollowRecord.value) {
- currentFollowRecord.value.files = [
- ...currentAttachmentList.value,
- ];
- }
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
- } else {
- proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触");
- }
- })
- .catch(error => {
- console.error("鍒犻櫎闄勪欢澶辫触:", error);
- proxy.$modal.msgError("鍒犻櫎澶辫触");
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑堝垹闄�");
- });
- };
+ /*
+ * 娲借皥杩涘害璁板綍 & 闄勪欢绠$悊鐩稿叧锛堝凡闅忓叆鍙f暣浣撴敞閲婏級
+ * - editNegotiationRecord / deleteNegotiationRecord
+ * - openAttachmentDialog / closeAttachmentDialog / ...闄勪欢鐩稿叧鏂规硶
+ */
// 鑾峰彇褰撳墠鏃ユ湡骞舵牸寮忓寲涓� YYYY-MM-DD
function getCurrentDate() {
@@ -1499,11 +1206,186 @@
}
onMounted(() => {
+ fetchRegions();
getList();
+ });
+
+ watch(regionKeyword, value => {
+ regionTreeRef.value?.filter((value || "").trim());
});
</script>
<style scoped lang="scss">
+ .customer-split {
+ display: flex;
+ gap: 12px;
+ }
+
+ .left-panel {
+ width: 260px;
+ flex: 0 0 260px;
+ background: #fff;
+ border-radius: 6px;
+ border: 1px solid #ebeef5;
+ padding: 12px;
+ height: calc(100vh - 140px);
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+ }
+
+ .right-panel {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .toolbar-card {
+ background: #ffffff;
+ border: 1px solid #ebeef5;
+ border-radius: 10px;
+ padding: 14px 16px;
+ margin-bottom: 12px;
+ box-shadow: 0 2px 10px rgba(31, 35, 41, 0.04);
+ }
+
+ .right-search-form {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 12px;
+ flex-wrap: nowrap;
+ }
+
+ .search-fields {
+ display: flex;
+ align-items: center;
+ flex-wrap: nowrap;
+ gap: 0;
+ flex: 1;
+ min-width: 0;
+ }
+
+ .toolbar-divider {
+ width: 1px;
+ align-self: stretch;
+ background: linear-gradient(to bottom, transparent, #e4e7ed 15%, #e4e7ed 85%, transparent);
+ }
+
+ .action-buttons {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 8px;
+ padding-left: 2px;
+ flex-shrink: 0;
+ }
+
+ .action-buttons :deep(.el-button) {
+ margin-left: 0;
+ min-width: 84px;
+ }
+
+ .table-card {
+ background: #fff;
+ border: 1px solid #ebeef5;
+ border-radius: 10px;
+ padding: 12px;
+ box-shadow: 0 2px 10px rgba(31, 35, 41, 0.03);
+ }
+
+ @media (max-width: 1500px) {
+ .right-search-form {
+ flex-wrap: wrap;
+ }
+
+ .search-fields {
+ flex-wrap: wrap;
+ gap: 8px 0;
+ }
+
+ .toolbar-divider {
+ display: none;
+ }
+
+ .action-buttons {
+ width: 100%;
+ border-top: 1px dashed #e4e7ed;
+ padding-top: 10px;
+ }
+ }
+
+ .left-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ margin-bottom: 10px;
+ }
+
+ .left-title {
+ font-weight: 600;
+ color: #303133;
+ }
+
+ .left-actions {
+ display: flex;
+ gap: 6px;
+ }
+
+ .left-actions :deep(.el-button) {
+ margin-left: 0;
+ padding: 5px 10px;
+ }
+
+ .left-search {
+ margin-bottom: 10px;
+ }
+
+ .left-list {
+ flex: 1;
+ overflow: auto;
+ padding-right: 4px;
+ }
+
+ .region-item {
+ padding: 8px 10px;
+ border-radius: 6px;
+ cursor: pointer;
+ color: #303133;
+ user-select: none;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ }
+
+ .region-item:hover {
+ background: #f5f7fa;
+ }
+
+ .region-item.active {
+ background: #ecf5ff;
+ color: #409eff;
+ font-weight: 600;
+ }
+
+ .left-list :deep(.el-tree) {
+ background: transparent;
+ }
+
+ .left-list :deep(.el-tree-node__content) {
+ height: 30px;
+ border-radius: 6px;
+ }
+
+ .left-list :deep(.el-tree-node__content:hover) {
+ background: #f5f7fa;
+ }
+
+ .empty-tip {
+ padding: 16px 10px;
+ color: #909399;
+ font-size: 13px;
+ }
+
.detail-section {
margin-bottom: 20px;
padding: 15px;
--
Gitblit v1.9.3