This commit is contained in:
Leo_Ding 2025-11-07 17:19:32 +08:00
commit 82b0108091
5 changed files with 114 additions and 191 deletions

View File

@ -1,22 +1,8 @@
<template> <template>
<a-modal <a-modal :width="800" :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading"
:width="800" :after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" :ok-button-props="{ disabled: isViewMode }"
:open="modal.open" @ok="handleOk" @cancel="handleCancel">
:title="modal.title" <a-form layout="vertical" ref="formRef" :model="formData" :rules="isViewMode ? {} : rules">
:confirm-loading="modal.confirmLoading"
:after-close="onAfterClose"
:cancel-text="cancelText"
:ok-text="okText"
:ok-button-props="{ disabled: isViewMode }"
@ok="handleOk"
@cancel="handleCancel"
>
<a-form
layout="vertical"
ref="formRef"
:model="formData"
:rules="isViewMode ? {} : rules"
>
<!-- 基本信息区域 --> <!-- 基本信息区域 -->
<a-card class="mb-4"> <a-card class="mb-4">
<a-row :gutter="16"> <a-row :gutter="16">
@ -28,11 +14,7 @@
<a-col :span="12"> <a-col :span="12">
<a-form-item label="所在机构" name="organizationId" required> <a-form-item label="所在机构" name="organizationId" required>
<a-select v-model:value="formData.organizationId" :disabled="isViewMode"> <a-select v-model:value="formData.organizationId" :disabled="isViewMode">
<a-select-option <a-select-option v-for="item in nodeOptions" :key="item.id" :value="item.id">
v-for="item in nodeOptions"
:key="item.id"
:value="item.id"
>
{{ item.name }} {{ item.name }}
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -45,16 +27,8 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="站点类型" name="type" required> <a-form-item label="站点类型" name="type" required>
<a-select <a-select v-model:value="formData.type" :disabled="isViewMode" @change="handleChange">
v-model:value="formData.type" <a-select-option v-for="item in dicsStore.dictOptions.Station_Type" :key="item.dval" :value="item.dval">
:disabled="isViewMode"
@change="handleChange"
>
<a-select-option
v-for="item in dicsStore.dictOptions.Station_Type"
:key="item.dval"
:value="item.dval"
>
{{ item.introduction }} {{ item.introduction }}
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -67,21 +41,13 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="联系电话" name="phone" required> <a-form-item label="联系电话" name="phone" required>
<a-input <a-input v-model:value="formData.phone" :disabled="isViewMode" placeholder="请输入联系电话" />
v-model:value="formData.phone"
:disabled="isViewMode"
placeholder="请输入联系电话"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="星级等级" name="starLevel"> <a-form-item label="星级等级" name="starLevel">
<a-select v-model:value="formData.starLevel" :disabled="isViewMode"> <a-select v-model:value="formData.starLevel" :disabled="isViewMode">
<a-select-option <a-select-option v-for="item in dicsStore.dictOptions.Level" :key="item.dval" :value="item.dval">
v-for="item in dicsStore.dictOptions.Level"
:key="item.dval"
:value="item.dval"
>
{{ item.introduction }} {{ item.introduction }}
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -89,12 +55,7 @@
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="人员编制(个)" name="staffCount"> <a-form-item label="人员编制(个)" name="staffCount">
<a-input-number <a-input-number v-model:value="formData.staffCount" :disabled="isViewMode" min="0" style="width: 100%" />
v-model:value="formData.staffCount"
:disabled="isViewMode"
min="0"
style="width: 100%"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -105,40 +66,22 @@
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="24"> <a-col :span="24">
<a-form-item label="服务中心地址" name="address"> <a-form-item label="服务中心地址" name="address">
<AreaCascader <AreaCascader v-model:value="formData.address" :disabled="isViewMode" @change="onAreaChange" />
v-model:value="formData.address"
:disabled="isViewMode"
@change="onAreaChange"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="详细地址" name="detailAddress"> <a-form-item label="详细地址" name="detailAddress">
<a-input <a-input v-model:value="formData.detailAddress" :disabled="isViewMode" placeholder="请输入详细地址" />
v-model:value="formData.detailAddress"
:disabled="isViewMode"
placeholder="请输入详细地址"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="地图定位地址" name="location"> <a-form-item label="地图定位地址" name="location">
<a-row :gutter="8"> <a-row :gutter="8">
<a-col :span="18"> <a-col :span="18">
<a-input <a-input v-model:value="formData.location" placeholder="请选择地图位置" readonly :disabled="isViewMode" />
v-model:value="formData.location"
placeholder="请选择地图位置"
readonly
:disabled="isViewMode"
/>
</a-col> </a-col>
<a-col :span="6"> <a-col :span="6">
<a-button <a-button type="primary" block :disabled="isViewMode" @click="openMapSelector">
type="primary"
block
:disabled="isViewMode"
@click="openMapSelector"
>
选择地图位置 选择地图位置
</a-button> </a-button>
</a-col> </a-col>
@ -153,33 +96,19 @@
<a-row :gutter="16"> <a-row :gutter="16">
<a-col :span="12"> <a-col :span="12">
<a-form-item label="建成时间" name="buildTime"> <a-form-item label="建成时间" name="buildTime">
<a-date-picker <a-date-picker v-model:value="formData.buildTime" format="YYYY-MM-DD" placeholder="请选择建成时间"
v-model:value="formData.buildTime" :disabled="isViewMode" />
format="YYYY-MM-DD"
placeholder="请选择建成时间"
:disabled="isViewMode"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="建筑面积(平方米)" name="area"> <a-form-item label="建筑面积(平方米)" name="area">
<a-input-number <a-input-number v-model:value="formData.area" :disabled="isViewMode" min="0" style="width: 100%"
v-model:value="formData.area" placeholder="请输入建筑面积" />
:disabled="isViewMode"
min="0"
style="width: 100%"
placeholder="请输入建筑面积"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-item label="服务介绍" name="description"> <a-form-item label="服务介绍" name="description">
<a-textarea <a-textarea v-model:value="formData.description" :disabled="isViewMode" rows="4" placeholder="请输入服务介绍" />
v-model:value="formData.description"
:disabled="isViewMode"
rows="4"
placeholder="请输入服务介绍"
/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
@ -191,33 +120,19 @@
<a-col :span="12"> <a-col :span="12">
<a-form-item label="营业时间" name="openTime"> <a-form-item label="营业时间" name="openTime">
<div style="display: flex; gap: 8px"> <div style="display: flex; gap: 8px">
<a-time-picker <a-time-picker v-model:value="formData.openTime" format="HH:mm" placeholder="开始时间"
v-model:value="formData.openTime" :disabled="isViewMode" />
format="HH:mm" <a-time-picker v-model:value="formData.closeTime" format="HH:mm" placeholder="结束时间"
placeholder="开始时间" :disabled="isViewMode" />
:disabled="isViewMode"
/>
<a-time-picker
v-model:value="formData.closeTime"
format="HH:mm"
placeholder="结束时间"
:disabled="isViewMode"
/>
</div> </div>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item label="营业状态" name="businessStatus"> <a-form-item label="营业状态" name="businessStatus">
<a-select <a-select v-model:value="formData.businessStatus" :disabled="isViewMode">
v-model:value="formData.businessStatus" <a-select-option v-for="item in dicsStore.dictOptions.Business_Status" :key="item.dval"
:disabled="isViewMode" :value="item.dval">
>
<a-select-option
v-for="item in dicsStore.dictOptions.Business_Status"
:key="item.dval"
:value="item.dval"
>
{{ item.introduction }} {{ item.introduction }}
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -236,16 +151,10 @@
</span> </span>
</template> </template>
<div class="service-tags"> <div class="service-tags">
<a-tag <a-tag v-for="service in allServices" :key="service.value" :class="{
v-for="service in allServices"
:key="service.value"
:class="{
'ant-tag-checkable-checked': formData.services?.includes(service.value), 'ant-tag-checkable-checked': formData.services?.includes(service.value),
}" }" class="service-tag" :style="{ cursor: isViewMode ? 'default' : 'pointer' }"
class="service-tag" @click="isViewMode ? null : handleServiceClick(service.value)">
:style="{ cursor: isViewMode ? 'default' : 'pointer' }"
@click="isViewMode ? null : handleServiceClick(service.value)"
>
{{ service.label }} {{ service.label }}
</a-tag> </a-tag>
</div> </div>
@ -271,11 +180,8 @@
</a-card> </a-card>
</a-form> </a-form>
<MapPickerModal <MapPickerModal :open="showMapPicker" @update:open="(val) => (showMapPicker = val)"
:open="showMapPicker" @select="handleLocationSelect" />
@update:open="(val) => (showMapPicker = val)"
@select="handleLocationSelect"
/>
</a-modal> </a-modal>
</template> </template>
@ -303,6 +209,7 @@ const initFormData = () => ({
name: '', name: '',
parent_id: '', parent_id: '',
organizationId: '', organizationId: '',
organization: '',
code: '', code: '',
type: '', type: '',
manager: '', manager: '',
@ -364,6 +271,7 @@ async function fetchNodeOptions() {
const res = await apis.serviceMenu.getOrgSelect() const res = await apis.serviceMenu.getOrgSelect()
if (res.success && Array.isArray(res.data)) { if (res.success && Array.isArray(res.data)) {
nodeOptions.value = res.data.map((item) => ({ id: item.id, name: item.name })) nodeOptions.value = res.data.map((item) => ({ id: item.id, name: item.name }))
console.log('nodeOptions', nodeOptions.value)
} else { } else {
nodeOptions.value = [] nodeOptions.value = []
message.warning('未获取到服务站点数据') message.warning('未获取到服务站点数据')
@ -403,6 +311,8 @@ async function loadRecord(id, forView = false) {
const record = cloneDeep(data) const record = cloneDeep(data)
const org = record.organization || {} const org = record.organization || {}
console.log('rdataecord', data)
console.log('org', org)
const stationTypeText = record.stationType || '' const stationTypeText = record.stationType || ''
const typeOption = dicsStore.dictOptions.Station_Type?.find( const typeOption = dicsStore.dictOptions.Station_Type?.find(
item => item.introduction === stationTypeText item => item.introduction === stationTypeText
@ -413,7 +323,8 @@ async function loadRecord(id, forView = false) {
...initFormData(), ...initFormData(),
id: record.id, id: record.id,
name: record.name || '', name: record.name || '',
organizationId: org.organizationId || '', organizationId: org.id || '',
organization: org.name || '',
code: org.orgCode || '', code: org.orgCode || '',
type: stationTypeValue, type: stationTypeValue,
manager: org.concatName || '', manager: org.concatName || '',
@ -428,7 +339,8 @@ async function loadRecord(id, forView = false) {
description: record.content || '', description: record.content || '',
openTime: record.openAt ? dayjs(`1970-01-01 ${record.openAt}`) : null, openTime: record.openAt ? dayjs(`1970-01-01 ${record.openAt}`) : null,
closeTime: record.closeAt ? dayjs(`1970-01-01 ${record.closeAt}`) : null, closeTime: record.closeAt ? dayjs(`1970-01-01 ${record.closeAt}`) : null,
businessStatus: record.status || '',
status: record.status || '',
services: record.provideServices || [], services: record.provideServices || [],
qualificationFiles: (record.qualificationAttachment && record.qualificationAttachment.length > 0) ? record.qualificationAttachment.map(item => config('http.apiUpload') + item) : [], qualificationFiles: (record.qualificationAttachment && record.qualificationAttachment.length > 0) ? record.qualificationAttachment.map(item => config('http.apiUpload') + item) : [],
siteImages: (record.stationImgs && record.stationImgs.length > 0) ? record.stationImgs.map(item => config('http.apiUpload') + item) : [], siteImages: (record.stationImgs && record.stationImgs.length > 0) ? record.stationImgs.map(item => config('http.apiUpload') + item) : [],
@ -446,14 +358,17 @@ async function loadRecord(id, forView = false) {
} }
} }
function handleOk() { async function handleOk() {
if (isViewMode.value) return if (isViewMode.value) return
try {
formRef.value.validateFields().then(async (values) => { formRef.value.validateFields().then(async (values) => {
console.log('values', values)
try { try {
const params = { const params = {
Name: values.name, Name: values.name,
organizationId: values.organizationId, organizationId: values.organizationId,
organizationName: nodeOptions.value.find(opt => opt.id === values.organizationId)?.name || '',
OrgCode: values.code, OrgCode: values.code,
StationType: (() => { StationType: (() => {
const typeItem = dicsStore.dictOptions.Station_Type?.find( const typeItem = dicsStore.dictOptions.Station_Type?.find(
@ -475,13 +390,15 @@ function handleOk() {
Content: values.description || '', Content: values.description || '',
OpenAt: values.openTime ? values.openTime.format('HH:mm') : '', OpenAt: values.openTime ? values.openTime.format('HH:mm') : '',
CloseAt: values.closeTime ? values.closeTime.format('HH:mm') : '', CloseAt: values.closeTime ? values.closeTime.format('HH:mm') : '',
Status: values.businessStatus || '', Status: '1',
ProvideServices: values.services?.length ? values.services : null, ProvideServices: values.services?.length ? values.services : null,
QualificationAttachment: values.qualificationFiles?.map(f => f.url || f.response?.url) || null, QualificationAttachment: values.qualificationFiles?.map(f => f.url || f.response?.url) || null,
QualificationAttachment: (values.qualificationFiles && values.qualificationFiles.length) > 0 ? values.qualificationFiles.map(item => spliceUrl(item)) : [], QualificationAttachment: (values.qualificationFiles && values.qualificationFiles.length) > 0 ? values.qualificationFiles.map(item => spliceUrl(item)) : [],
StationImgs: (values.siteImages && values.siteImages.length) > 0 ? values.siteImages.map(item => spliceUrl(item)) : [], StationImgs: (values.siteImages && values.siteImages.length) > 0 ? values.siteImages.map(item => spliceUrl(item)) : [],
} }
console.log('params', params)
let result let result
if (modal.value.mode === 'create') { if (modal.value.mode === 'create') {
result = await apis.serviceMenu.createServiceSite(params) result = await apis.serviceMenu.createServiceSite(params)
@ -501,6 +418,12 @@ function handleOk() {
message.error('操作失败,请重试') message.error('操作失败,请重试')
} }
}) })
} catch (error) {
console.error('表单校验失败:', error)
return
}
} }
function handleCancel() { function handleCancel() {

View File

@ -45,7 +45,7 @@
<a-collapse v-model:activeKey="advancedSearchVisible" ghost > <a-collapse v-model:activeKey="advancedSearchVisible" ghost >
<a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;"> <a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;">
<template #header></template> <template #header></template>
<a-row :gutter="gutter" style="margin-top: 16px;"> <a-row :gutter="gutter" style="margin-top: -20px;">
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="工单号" name="workOrderNo"> <a-form-item label="工单号" name="workOrderNo">
<a-input v-model:value="searchFormData.workOrderNo" placeholder="请输入工单号" /> <a-input v-model:value="searchFormData.workOrderNo" placeholder="请输入工单号" />

View File

@ -37,7 +37,7 @@
<a-collapse v-model:activeKey="advancedSearchVisible" ghost> <a-collapse v-model:activeKey="advancedSearchVisible" ghost>
<a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;"> <a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;">
<template #header></template> <template #header></template>
<a-row :gutter="gutter" style="margin-top: 16px;"> <a-row :gutter="gutter">
<a-form-item label="回访时间" name="plannedDate" style="white-space: nowrap;"> <a-form-item label="回访时间" name="plannedDate" style="white-space: nowrap;">
<a-range-picker v-model:value="searchFormData.plannedDate" style="width: 220px;" /> <a-range-picker v-model:value="searchFormData.plannedDate" style="width: 220px;" />

View File

@ -30,7 +30,7 @@
<a-collapse v-model:activeKey="advancedSearchVisible" ghost> <a-collapse v-model:activeKey="advancedSearchVisible" ghost>
<a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;"> <a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;">
<template #header></template> <template #header></template>
<a-row :gutter="gutter" style="margin-top: 16px;"> <a-row :gutter="gutter" style="margin-top: -20px;">
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="实际服务日期" name="plannedDate"> <a-form-item label="实际服务日期" name="plannedDate">
<a-range-picker v-model:value="searchFormData.plannedDate" /> <a-range-picker v-model:value="searchFormData.plannedDate" />
@ -38,7 +38,7 @@
</a-col> </a-col>
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="实际服务时长(小时)" name="serviceDuration" style="white-space: nowrap;"> <a-form-item label="实际服务(小时)" name="serviceDuration" style="white-space: nowrap;">
<a-input-number v-model:value="searchFormData.serviceDuration" :min="0" <a-input-number v-model:value="searchFormData.serviceDuration" :min="0"
placeholder="请输入时长" style="width: 100%" /> placeholder="请输入时长" style="width: 100%" />
</a-form-item> </a-form-item>
@ -102,7 +102,7 @@
</a-collapse> </a-collapse>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<a-row :gutter="gutter" style="margin-top: 16px;"> <a-row :gutter="gutter">
<a-col :span="24" style="text-align: right;"> <a-col :span="24" style="text-align: right;">
<a-space> <a-space>
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button> <a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>

View File

@ -30,7 +30,7 @@
<a-collapse v-model:activeKey="advancedSearchVisible" ghost> <a-collapse v-model:activeKey="advancedSearchVisible" ghost>
<a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;"> <a-collapse-panel key="1" :showArrow="false" style="padding: 0; border: none;">
<template #header></template> <template #header></template>
<a-row :gutter="gutter" style="margin-top: 16px;"> <a-row :gutter="gutter">
<a-col v-bind="colSpan"> <a-col v-bind="colSpan">
<a-form-item label="实际服务日期" name="plannedDate"> <a-form-item label="实际服务日期" name="plannedDate">
<a-range-picker v-model:value="searchFormData.plannedDate" /> <a-range-picker v-model:value="searchFormData.plannedDate" />