chore: 从 git 中移除 backend/target 目录
- 使用 git rm --cached 从版本控制中删除 target 目录 - .gitignore 已配置忽略 target 和 node_modules - 本地文件保留,仅从 git 索引中删除 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
934b8aad40
commit
ea8f8390da
99 files changed
+3551
-724
No files matched your search
@@ -4,10 +4,15 @@
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>客户管理</span>
|
||||
<el-button type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增客户
|
||||
</el-button>
|
||||
<div style="display: flex; gap: 10px; align-items: center">
|
||||
<el-tag type="info" size="large">
|
||||
当前保护期配置:{{ protectDays }} 天
|
||||
</el-tag>
|
||||
<el-button type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>
|
||||
新增客户
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -60,6 +65,16 @@
|
||||
<el-tag v-else type="info">已失效</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="currentDealerName" label="当前经销商" width="150">
|
||||
<template #default="{ row }">
|
||||
{{ row.status === 1 ? (row.currentDealerName || '-') : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="protectEndDate" label="保护期截止" width="180">
|
||||
<template #default="{ row }">
|
||||
{{ row.status === 1 && row.protectEndDate ? formatDate(row.protectEndDate) : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createdAt" label="创建时间" width="180" />
|
||||
<el-table-column label="操作" width="180" fixed="right">
|
||||
<template #default="{ row }">
|
||||
@@ -76,6 +91,8 @@
|
||||
:total="total"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
prev-text="上一页"
|
||||
next-text="下一页"
|
||||
@size-change="fetchData"
|
||||
@current-change="fetchData"
|
||||
style="margin-top: 20px; justify-content: flex-end"
|
||||
@@ -91,7 +108,21 @@
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" :rules="rules" label-width="100px">
|
||||
<el-form-item label="客户名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入客户名称" />
|
||||
<el-autocomplete
|
||||
v-model="formData.name"
|
||||
:fetch-suggestions="searchSchool"
|
||||
placeholder="请输入客户名称"
|
||||
:trigger-on-focus="false"
|
||||
style="width: 100%"
|
||||
@select="handleSchoolSelect"
|
||||
>
|
||||
<template #default="{ item }">
|
||||
<div class="school-option">
|
||||
<div class="school-name">{{ item.schoolName }}</div>
|
||||
<div class="school-location">{{ item.location }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-autocomplete>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入联系电话" />
|
||||
@@ -123,7 +154,12 @@
|
||||
import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
|
||||
import { getCustomerPage, createCustomer, updateCustomer, deleteCustomer } from '@/api/customer'
|
||||
import { getConfigValue } from '@/api/system'
|
||||
import { searchSchoolByName } from '@/api/school'
|
||||
import type { Customer, CustomerForm } from '@/types'
|
||||
import type { School } from '@/api/school'
|
||||
|
||||
const protectDays = ref<number>(90)
|
||||
|
||||
const loading = ref(false)
|
||||
const tableData = ref<Customer[]>([])
|
||||
@@ -131,6 +167,8 @@ const total = ref(0)
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = computed(() => (formData.id ? '编辑客户' : '新增客户'))
|
||||
const formRef = ref<FormInstance>()
|
||||
const schoolSearchLoading = ref(false)
|
||||
const schoolOptions = ref<School[]>([])
|
||||
|
||||
const queryForm = reactive({
|
||||
current: 1,
|
||||
@@ -151,6 +189,44 @@ const rules: FormRules = {
|
||||
name: [{ required: true, message: '请输入客户名称', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
// 格式化日期,去掉时分秒
|
||||
const formatDate = (dateStr: string | null | undefined) => {
|
||||
if (!dateStr) return '-'
|
||||
return dateStr.split(' ')[0] // 只保留日期部分,去掉时间
|
||||
}
|
||||
|
||||
// 搜索学校(用于自动完成)
|
||||
const searchSchool = async (queryString: string, cb: any) => {
|
||||
if (!queryString || queryString.trim().length < 1) {
|
||||
cb([])
|
||||
return
|
||||
}
|
||||
|
||||
schoolSearchLoading.value = true
|
||||
try {
|
||||
const schools = await searchSchoolByName(queryString)
|
||||
// 转换为 el-autocomplete 需要的格式
|
||||
const suggestions = schools.map(school => ({
|
||||
...school,
|
||||
value: school.schoolName
|
||||
}))
|
||||
cb(suggestions)
|
||||
} catch (error) {
|
||||
console.error('搜索学校失败', error)
|
||||
cb([])
|
||||
} finally {
|
||||
schoolSearchLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 选择学校后的回调
|
||||
const handleSchoolSelect = (item: School) => {
|
||||
// 用户可以选择性地填充地址字段
|
||||
if (item.location && !formData.address) {
|
||||
formData.address = item.location
|
||||
}
|
||||
}
|
||||
|
||||
// 获取行业标签
|
||||
const getIndustryLabel = (industry: string) => {
|
||||
const map: Record<string, string> = {
|
||||
@@ -208,7 +284,15 @@ const handleEdit = (row: Customer) => {
|
||||
// 删除按钮
|
||||
const handleDelete = async (row: Customer) => {
|
||||
try {
|
||||
await ElMessageBox.confirm('确定要删除该客户吗?', '提示', { type: 'warning' })
|
||||
await ElMessageBox.confirm(
|
||||
'确定要删除该客户吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
await deleteCustomer(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
fetchData()
|
||||
@@ -251,7 +335,18 @@ const handleDialogClose = () => {
|
||||
delete formData.id
|
||||
}
|
||||
|
||||
// 获取保护期配置
|
||||
const fetchProtectDays = async () => {
|
||||
try {
|
||||
const res = await getConfigValue('report.protect.days')
|
||||
protectDays.value = parseInt(res) || 90
|
||||
} catch (error) {
|
||||
console.error('获取配置失败', error)
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchProtectDays()
|
||||
fetchData()
|
||||
})
|
||||
</script>
|
||||
@@ -270,4 +365,20 @@ onMounted(() => {
|
||||
.query-form {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.school-option {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.school-name {
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.school-location {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-top: 4px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user