feat: 桌面端表单必填项标记 * + 提交校验
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -156,6 +156,7 @@ function onVisitorsChange(val: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleSave() {
|
async function handleSave() {
|
||||||
|
if (!form.value.customer_id) { ElMessage.warning('请选择客户单位'); return }
|
||||||
try {
|
try {
|
||||||
if (dialogMode.value === 'create') {
|
if (dialogMode.value === 'create') {
|
||||||
await api.post('/key-visits/', form.value)
|
await api.post('/key-visits/', form.value)
|
||||||
@@ -297,7 +298,7 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
<!-- Dialog -->
|
<!-- Dialog -->
|
||||||
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 要客拜访'" width="520px">
|
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 要客拜访'" width="520px">
|
||||||
<el-form label-position="top">
|
<el-form label-position="top">
|
||||||
<el-form-item label="客户单位">
|
<el-form-item label="客户单位 *">
|
||||||
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
||||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@@ -371,4 +372,5 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
.quick-create-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px dashed var(--gold); padding: 6px 12px; color: var(--gold-dark); font-family: var(--font-body); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
.quick-create-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px dashed var(--gold); padding: 6px 12px; color: var(--gold-dark); font-family: var(--font-body); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
||||||
.quick-create-btn:hover { border-color: var(--vermilion); color: var(--vermilion); background: rgba(184,71,46,0.03); }
|
.quick-create-btn:hover { border-color: var(--vermilion); color: var(--vermilion); background: rgba(184,71,46,0.03); }
|
||||||
.select-empty-create { padding: 8px 12px; text-align: center; }
|
.select-empty-create { padding: 8px 12px; text-align: center; }
|
||||||
|
.required-star { color: var(--vermilion); font-weight: 700; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -329,4 +329,5 @@ function onStatusChange(val: string) {
|
|||||||
border-left: 3px solid #5B7FA5 !important;
|
border-left: 3px solid #5B7FA5 !important;
|
||||||
background: rgba(91, 127, 165, 0.04) !important;
|
background: rgba(91, 127, 165, 0.04) !important;
|
||||||
}
|
}
|
||||||
|
.required-star { color: var(--vermilion); font-weight: 700; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -475,7 +475,7 @@ const notesByDate = computed(() => {
|
|||||||
<!-- Create/Edit Dialog -->
|
<!-- Create/Edit Dialog -->
|
||||||
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' ' + typeLabel(dialogType)" width="520px">
|
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' ' + typeLabel(dialogType)" width="520px">
|
||||||
<el-form label-position="top" v-if="form">
|
<el-form label-position="top" v-if="form">
|
||||||
<el-form-item v-if="['visit','plan','mini','key'].includes(dialogType)" label="客户单位">
|
<el-form-item v-if="['visit','plan','mini','key'].includes(dialogType)" label="客户单位 *">
|
||||||
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
||||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@@ -586,4 +586,5 @@ const notesByDate = computed(() => {
|
|||||||
.quick-create-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px dashed var(--gold); padding: 6px 12px; color: var(--gold-dark); font-family: var(--font-body); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
.quick-create-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px dashed var(--gold); padding: 6px 12px; color: var(--gold-dark); font-family: var(--font-body); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
||||||
.quick-create-btn:hover { border-color: var(--vermilion); color: var(--vermilion); background: rgba(184,71,46,0.03); }
|
.quick-create-btn:hover { border-color: var(--vermilion); color: var(--vermilion); background: rgba(184,71,46,0.03); }
|
||||||
.select-empty-create { padding: 8px 12px; text-align: center; }
|
.select-empty-create { padding: 8px 12px; text-align: center; }
|
||||||
|
.required-star { color: var(--vermilion); font-weight: 700; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ function openEdit(item: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleSave() {
|
async function handleSave() {
|
||||||
|
if (!form.value.customer_id) { ElMessage.warning('请选择客户单位'); return }
|
||||||
try {
|
try {
|
||||||
if (dialogMode.value === 'create') {
|
if (dialogMode.value === 'create') {
|
||||||
await api.post('/mini-business/', form.value)
|
await api.post('/mini-business/', form.value)
|
||||||
@@ -314,7 +315,7 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
<!-- Dialog -->
|
<!-- Dialog -->
|
||||||
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 小微商机'" width="500px">
|
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 小微商机'" width="500px">
|
||||||
<el-form label-position="top">
|
<el-form label-position="top">
|
||||||
<el-form-item label="客户单位">
|
<el-form-item label="客户单位 *">
|
||||||
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
||||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@@ -458,4 +459,5 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
.log-chip { padding: 4px 10px; border: 1px solid var(--warm-border); background: var(--surface); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
.log-chip { padding: 4px 10px; border: 1px solid var(--warm-border); background: var(--surface); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
||||||
.log-chip:hover { border-color: var(--ink); }
|
.log-chip:hover { border-color: var(--ink); }
|
||||||
.log-chip--active { font-weight: 600; }
|
.log-chip--active { font-weight: 600; }
|
||||||
|
.required-star { color: var(--vermilion); font-weight: 700; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -129,6 +129,7 @@ function openEdit(item: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleSave() {
|
async function handleSave() {
|
||||||
|
if (!form.value.customer_id) { ElMessage.warning('请选择客户单位'); return }
|
||||||
try {
|
try {
|
||||||
if (dialogMode.value === 'create') {
|
if (dialogMode.value === 'create') {
|
||||||
await api.post('/work-plans/', form.value)
|
await api.post('/work-plans/', form.value)
|
||||||
@@ -263,7 +264,7 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
<!-- Dialog -->
|
<!-- Dialog -->
|
||||||
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 工作计划'" width="500px">
|
<el-dialog v-model="dialogVisible" :title="(dialogMode === 'create' ? '新建' : '编辑') + ' 工作计划'" width="500px">
|
||||||
<el-form label-position="top">
|
<el-form label-position="top">
|
||||||
<el-form-item label="客户单位">
|
<el-form-item label="客户单位 *">
|
||||||
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
<el-select v-model="form.customer_id" filterable remote :remote-method="handleCustomerSearch" placeholder="搜索选择客户" style="width:100%">
|
||||||
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
<el-option v-for="c in customers" :key="c.id" :label="c.name" :value="c.id" />
|
||||||
<template #empty>
|
<template #empty>
|
||||||
@@ -327,4 +328,5 @@ async function quickStatusChange(row: any, newStatus: string) {
|
|||||||
.quick-create-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px dashed var(--gold); padding: 6px 12px; color: var(--gold-dark); font-family: var(--font-body); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
.quick-create-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 1px dashed var(--gold); padding: 6px 12px; color: var(--gold-dark); font-family: var(--font-body); font-size: 12px; cursor: pointer; transition: all 0.2s; }
|
||||||
.quick-create-btn:hover { border-color: var(--vermilion); color: var(--vermilion); background: rgba(184,71,46,0.03); }
|
.quick-create-btn:hover { border-color: var(--vermilion); color: var(--vermilion); background: rgba(184,71,46,0.03); }
|
||||||
.select-empty-create { padding: 8px 12px; text-align: center; }
|
.select-empty-create { padding: 8px 12px; text-align: center; }
|
||||||
|
.required-star { color: var(--vermilion); font-weight: 700; }
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user