From dfe4ae8545ded79d19ce1130501dff0f4d61364f Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期五, 27 三月 2026 11:17:09 +0800
Subject: [PATCH] feat(客户管理): 新增地区列表查询功能并重构客户档案页面布局
---
src/views/basicData/customerFile/index.vue | 1221 +++++++++++++++++++++------------------------------------
1 files changed, 458 insertions(+), 763 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index ad1c5bb..bd65a22 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -1,52 +1,115 @@
<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>
+ <el-button type="primary"
+ size="small"
+ @click="openAddRegionDialog">鏂板鍦板尯</el-button>
+ </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: selectedRegion === '' }"
+ @click="selectRegion('')">鍏ㄩ儴</div>
+ <div v-for="item in filteredRegions"
+ :key="item.__key"
+ class="region-item"
+ :class="{ active: selectedRegion === item.regionName }"
+ @click="selectRegion(item.regionName)"
+ :title="item.regionName">{{ item.regionName }}</div>
+ <div v-if="filteredRegions.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-input v-model="addRegionForm.regionName"
+ 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="dialogFormVisible"
:title="operationType === 'add' ? '鏂板瀹㈡埛淇℃伅' : '缂栬緫瀹㈡埛淇℃伅'"
width="70%"
@@ -76,7 +139,7 @@
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍏徃鍦板潃锛�"
+ <el-form-item label="瀹㈡埛鍦板潃锛�"
prop="companyAddress">
<el-input v-model="form.companyAddress"
placeholder="璇疯緭鍏�"
@@ -84,11 +147,35 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鍏徃鐢佃瘽锛�"
+ <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">
+ <el-form-item label="瀹㈡埛鐢佃瘽锛�"
prop="companyPhone">
<el-input v-model="form.companyPhone"
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>
@@ -117,19 +204,6 @@
<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>
@@ -240,132 +314,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 @click="closeReminderDialog">鍙栨秷</el-button>
- <el-button type="primary"
- @click="submitReminderForm">鎻愪氦</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 @click="closeNegotiationDialog">鍙栨秷</el-button>
- <el-button type="primary"
- @click="submitNegotiationForm">鎻愪氦</el-button>
- </div>
- </template>
- </el-dialog>
+ <!--
+ 鍥炶鎻愰啋 / 娲借皥杩涘害鍔熻兘锛堝叆鍙e強寮圭獥锛夊凡鎸夐渶姹傛敞閲娿��
+ 濡傞渶鎭㈠锛氭斁寮�鎿嶄綔鍒楀叆鍙� + 鍙栨秷鏈娉ㄩ噴 + 鎭㈠ script 涓浉鍏冲彉閲�/鏂规硶/鎺ュ彛寮曞叆銆�
+ -->
<!-- 瀹㈡埛璇︽儏瀵硅瘽妗� -->
<el-dialog title="瀹㈡埛璇︽儏"
v-model="detailDialogVisible"
@@ -461,174 +413,35 @@
</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
- size="small"
- @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
- size="small"
- @click="editNegotiationRecord(row, $index)">
- 淇敼
- </el-button>
- <el-button type="danger"
- link
- size="small"
- @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
- size="small"
- @click="downloadAttachment(row)">
- 涓嬭浇
- </el-button>
- <el-button type="danger"
- link
- size="small"
- @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 } from "vue";
+ import { Search } from "@element-plus/icons-vue";
import {
addCustomer,
delCustomer,
getCustomer,
listCustomer,
+ listCustomerRegions,
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";
@@ -637,49 +450,48 @@
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);
@@ -699,21 +511,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([
{
@@ -725,6 +529,11 @@
label: "瀹㈡埛鍚嶇О",
prop: "customerName",
width: 220,
+ },
+ {
+ label: "瀹㈡埛鍦板尯",
+ prop: "regions",
+ width: 120,
},
{
label: "绾崇◣浜鸿瘑鍒爜",
@@ -784,7 +593,7 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 250,
+ width: 120,
operation: [
{
name: "缂栬緫",
@@ -793,27 +602,27 @@
openForm("edit", row);
},
},
- {
- name: "璇︽儏",
- type: "text",
- clickFun: row => {
- openDetailDialog(row);
- },
- },
- {
- name: "鍥炶鎻愰啋",
- type: "text",
- clickFun: row => {
- openReminderDialog(row);
- },
- },
- {
- name: "娣诲姞娲借皥杩涘害",
- type: "text",
- clickFun: row => {
- openNegotiationDialog(row);
- },
- },
+ // {
+ // name: "娣诲姞娲借皥杩涘害",
+ // type: "text",
+ // clickFun: row => {
+ // openNegotiationDialog(row);
+ // },
+ // },
+ // {
+ // name: "鍥炶鎻愰啋",
+ // type: "text",
+ // clickFun: row => {
+ // openReminderDialog(row);
+ // },
+ // },
+ {
+ name: "璇︽儏",
+ type: "text",
+ clickFun: row => {
+ openDetailDialog(row);
+ },
+ },
],
},
]);
@@ -844,6 +653,7 @@
searchForm: {
customerName: "",
customerType: "",
+ regions: "",
},
form: {
customerName: "",
@@ -934,6 +744,73 @@
},
});
const { searchForm, form, rules } = toRefs(data);
+
+ // 宸︿晶鍦板尯鏍�
+ const regionsLoading = ref(false);
+ const regions = ref([]);
+ const regionKeyword = ref("");
+ const selectedRegion = ref(""); // '' 琛ㄧず鍏ㄩ儴
+ const addRegionDialogVisible = ref(false);
+ const addRegionForm = reactive({ regionName: "" });
+
+ const normalizeRegionItem = (raw, index) => {
+ if (typeof raw === "string") {
+ return { regionName: raw, __key: `s_${raw}_${index}`, __local: false };
+ }
+ const name = raw?.regionName ?? raw?.regions ?? raw?.name ?? raw?.label ?? "";
+ return { ...raw, regionName: name, __key: raw?.id ?? `o_${name}_${index}` };
+ };
+
+ const fetchRegions = async () => {
+ regionsLoading.value = true;
+ try {
+ const res = await listCustomerRegions({});
+ const list = res?.data ?? res?.rows ?? res ?? [];
+ regions.value = Array.isArray(list)
+ ? list.map(normalizeRegionItem).filter(i => i.regionName)
+ : [];
+ } catch (e) {
+ console.error("鍦板尯鏌ヨ澶辫触:", e);
+ regions.value = [];
+ } finally {
+ regionsLoading.value = false;
+ }
+ };
+
+ const filteredRegions = computed(() => {
+ const kw = (regionKeyword.value || "").trim();
+ if (!kw) return regions.value;
+ return regions.value.filter(r => (r.regionName || "").includes(kw));
+ });
+
+ const selectRegion = regionName => {
+ selectedRegion.value = regionName ?? "";
+ searchForm.value.regions = selectedRegion.value || "";
+ handleQuery();
+ };
+
+ const openAddRegionDialog = () => {
+ addRegionForm.regionName = "";
+ addRegionDialogVisible.value = true;
+ };
+ const closeAddRegionDialog = () => {
+ addRegionDialogVisible.value = false;
+ addRegionForm.regionName = "";
+ };
+ const submitAddRegion = () => {
+ const name = (addRegionForm.regionName || "").trim();
+ if (!name) return proxy.$modal.msgWarning("璇疯緭鍏ュ湴鍖哄悕绉�");
+ const exists = regions.value.some(r => r.regionName === name);
+ if (!exists) {
+ regions.value.unshift({
+ regionName: name,
+ __key: `local_${Date.now()}`,
+ __local: true,
+ });
+ }
+ proxy.$modal.msgWarning("鍦板尯鏂板鎺ュ彛鏈彁渚涳紝宸叉湰鍦版柊澧烇紙鍒锋柊鍚庡け鏁堬級");
+ closeAddRegionDialog();
+ };
const addNewContact = () => {
formYYs.value.contactList.push({
contactPerson: "",
@@ -1113,168 +990,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 => {
@@ -1295,190 +1021,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() {
@@ -1490,11 +1037,159 @@
}
onMounted(() => {
+ fetchRegions();
getList();
});
</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-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;
+ }
+
+ .empty-tip {
+ padding: 16px 10px;
+ color: #909399;
+ font-size: 13px;
+ }
+
.detail-section {
margin-bottom: 20px;
padding: 15px;
--
Gitblit v1.9.3