From 2cb71b3a0e63aae9d9beb13863c69b4c10397025 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期一, 25 五月 2026 13:37:25 +0800
Subject: [PATCH] feat(customer): 使用字典数据优化客户类型选择功能
---
src/views/basicData/customerFile/index.vue | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/src/views/basicData/customerFile/index.vue b/src/views/basicData/customerFile/index.vue
index 6b1c06e..aa99bf6 100644
--- a/src/views/basicData/customerFile/index.vue
+++ b/src/views/basicData/customerFile/index.vue
@@ -15,10 +15,10 @@
style="width: 240px"
clearable
@change="handleQuery">
- <el-option label="闆跺敭瀹㈡埛"
- value="闆跺敭瀹㈡埛"/>
- <el-option label="杩涢攢鍟嗗鎴�"
- value="杩涢攢鍟嗗鎴�"/>
+ <el-option v-for="dict in customerTypeOptions"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"/>
</el-select>
<el-button type="primary"
@click="handleQuery"
@@ -130,10 +130,10 @@
<el-select v-model="form.customerType"
placeholder="璇烽�夋嫨"
clearable>
- <el-option label="闆跺敭瀹㈡埛"
- value="闆跺敭瀹㈡埛"/>
- <el-option label="杩涢攢鍟嗗鎴�"
- value="杩涢攢鍟嗗鎴�"/>
+ <el-option v-for="dict in customerTypeOptions"
+ :key="dict.value"
+ :label="dict.label"
+ :value="dict.value"/>
</el-select>
</el-form-item>
</el-col>
@@ -425,7 +425,7 @@
<el-col :span="12">
<div class="info-item">
<span class="info-label">瀹㈡埛鍒嗙被锛�</span>
- <span class="info-value">{{ detailForm.customerType }}</span>
+ <span class="info-value">{{ getCustomerTypeLabel(detailForm.customerType) }}</span>
</div>
</el-col>
</el-row>
@@ -671,6 +671,7 @@
import {getToken} from "@/utils/auth.js";
const {proxy} = getCurrentInstance();
+const { customer_type: customerTypeOptions } = proxy.useDict("customer_type");
const userStore = useUserStore();
// 鍥炶鎻愰啋鐩稿叧
@@ -762,11 +763,19 @@
: baseUrl;
};
+const getCustomerTypeLabel = (value) => {
+ const match = (customerTypeOptions.value || []).find(
+ (item) => String(item.value) === String(value)
+ );
+ return match?.label ?? value ?? "";
+};
+
const tableColumn = ref([
{
label: "瀹㈡埛鍒嗙被",
prop: "customerType",
width: 120,
+ formatData: getCustomerTypeLabel,
},
{
label: "瀹㈡埛鍚嶇О",
--
Gitblit v1.9.3