diff --git a/src/views/serviceMenu/serviceSites/components/EditDialog.vue b/src/views/serviceMenu/serviceSites/components/EditDialog.vue
index d3011f4..88a8bb5 100644
--- a/src/views/serviceMenu/serviceSites/components/EditDialog.vue
+++ b/src/views/serviceMenu/serviceSites/components/EditDialog.vue
@@ -1,22 +1,8 @@
-
-
+
+
@@ -28,11 +14,7 @@
-
+
{{ item.name }}
@@ -45,16 +27,8 @@
-
-
+
+
{{ item.introduction }}
@@ -67,21 +41,13 @@
-
+
-
+
{{ item.introduction }}
@@ -89,12 +55,7 @@
-
+
@@ -105,40 +66,22 @@
-
+
-
+
-
+
-
+
选择地图位置
@@ -153,33 +96,19 @@
-
+
-
+
-
+
@@ -191,33 +120,19 @@
-
-
+
+
{{ item.introduction }}
@@ -236,16 +151,10 @@
@@ -259,23 +168,20 @@
-
+
-
+
- (showMapPicker = val)"
- @select="handleLocationSelect"
- />
+ (showMapPicker = val)"
+ @select="handleLocationSelect" />
@@ -303,6 +209,7 @@ const initFormData = () => ({
name: '',
parent_id: '',
organizationId: '',
+ organization: '',
code: '',
type: '',
manager: '',
@@ -364,6 +271,7 @@ async function fetchNodeOptions() {
const res = await apis.serviceMenu.getOrgSelect()
if (res.success && Array.isArray(res.data)) {
nodeOptions.value = res.data.map((item) => ({ id: item.id, name: item.name }))
+ console.log('nodeOptions', nodeOptions.value)
} else {
nodeOptions.value = []
message.warning('未获取到服务站点数据')
@@ -389,12 +297,12 @@ function handleCreateChild(record = {}) {
async function handleEdit(record = {}) {
console.log('handleEdit', record)
showModal({ mode: 'edit', title: '编辑服务站点' })
- await loadRecord(record.id,false)
+ await loadRecord(record.id, false)
}
async function handleView(record = {}) {
showModal({ mode: 'view', title: '查看服务站点' })
- await loadRecord(record.id,true)
+ await loadRecord(record.id, true)
}
async function loadRecord(id, forView = false) {
@@ -403,6 +311,8 @@ async function loadRecord(id, forView = false) {
const record = cloneDeep(data)
const org = record.organization || {}
+ console.log('rdataecord', data)
+ console.log('org', org)
const stationTypeText = record.stationType || ''
const typeOption = dicsStore.dictOptions.Station_Type?.find(
item => item.introduction === stationTypeText
@@ -413,7 +323,8 @@ async function loadRecord(id, forView = false) {
...initFormData(),
id: record.id,
name: record.name || '',
- organizationId: org.organizationId || '',
+ organizationId: org.id || '',
+ organization: org.name || '',
code: org.orgCode || '',
type: stationTypeValue,
manager: org.concatName || '',
@@ -428,10 +339,11 @@ async function loadRecord(id, forView = false) {
description: record.content || '',
openTime: record.openAt ? dayjs(`1970-01-01 ${record.openAt}`) : null,
closeTime: record.closeAt ? dayjs(`1970-01-01 ${record.closeAt}`) : null,
- businessStatus: record.status || '',
+
+ status: record.status || '',
services: record.provideServices || [],
- 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) : [],
+ 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) : [],
latitude: record.latitude || 0,
longitude: record.longitude || 0,
}
@@ -446,61 +358,72 @@ async function loadRecord(id, forView = false) {
}
}
-function handleOk() {
+async function handleOk() {
if (isViewMode.value) return
- formRef.value.validateFields().then(async (values) => {
- try {
- const params = {
- Name: values.name,
- organizationId: values.organizationId,
- OrgCode: values.code,
- StationType: (() => {
- const typeItem = dicsStore.dictOptions.Station_Type?.find(
- (item) => item.dval === values.type
- )
- return typeItem ? typeItem.introduction : values.type || ''
- })(),
- StationTypeValue: values.type, // 传 dval 给后端
- ConcatName: values.manager,
- ConcatPhone: values.phone,
- StarLv: values.starLevel || '',
- MemberNum: values.staffCount || 0,
- AreaLabels: values.address?.length ? values.address : null,
- Address: values.detailAddress || '',
- Latitude: formData.value.latitude || 0,
- Longitude: formData.value.longitude || 0,
- CompletionAt: values.buildTime ? values.buildTime.toDate() : null,
- Area: values.area || 0,
- Content: values.description || '',
- OpenAt: values.openTime ? values.openTime.format('HH:mm') : '',
- CloseAt: values.closeTime ? values.closeTime.format('HH:mm') : '',
- Status: values.businessStatus || '',
- ProvideServices: values.services?.length ? values.services : 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)) : [],
- StationImgs:( values.siteImages && values.siteImages.length) > 0 ? values.siteImages.map(item => spliceUrl(item)) : [],
- }
+ try {
+ formRef.value.validateFields().then(async (values) => {
+ console.log('values', values)
+ try {
+ const params = {
+ Name: values.name,
+ organizationId: values.organizationId,
+ organizationName: nodeOptions.value.find(opt => opt.id === values.organizationId)?.name || '',
+ OrgCode: values.code,
+ StationType: (() => {
+ const typeItem = dicsStore.dictOptions.Station_Type?.find(
+ (item) => item.dval === values.type
+ )
+ return typeItem ? typeItem.introduction : values.type || ''
+ })(),
+ StationTypeValue: values.type, // 传 dval 给后端
+ ConcatName: values.manager,
+ ConcatPhone: values.phone,
+ StarLv: values.starLevel || '',
+ MemberNum: values.staffCount || 0,
+ AreaLabels: values.address?.length ? values.address : null,
+ Address: values.detailAddress || '',
+ Latitude: formData.value.latitude || 0,
+ Longitude: formData.value.longitude || 0,
+ CompletionAt: values.buildTime ? values.buildTime.toDate() : null,
+ Area: values.area || 0,
+ Content: values.description || '',
+ OpenAt: values.openTime ? values.openTime.format('HH:mm') : '',
+ CloseAt: values.closeTime ? values.closeTime.format('HH:mm') : '',
+ Status: '1',
+ ProvideServices: values.services?.length ? values.services : 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)) : [],
+ StationImgs: (values.siteImages && values.siteImages.length) > 0 ? values.siteImages.map(item => spliceUrl(item)) : [],
+ }
- let result
- if (modal.value.mode === 'create') {
- result = await apis.serviceMenu.createServiceSite(params)
- } else if (modal.value.mode === 'edit') {
- result = await apis.serviceMenu.updateServiceSite(formData.value.id, params)
- }
+ console.log('params', params)
- if (result?.success) {
- message.success(modal.value.mode === 'create' ? '新增成功' : '更新成功')
- hideModal()
- emit('ok')
- } else {
- message.error(result?.message || '操作失败')
+ let result
+ if (modal.value.mode === 'create') {
+ result = await apis.serviceMenu.createServiceSite(params)
+ } else if (modal.value.mode === 'edit') {
+ result = await apis.serviceMenu.updateServiceSite(formData.value.id, params)
+ }
+
+ if (result?.success) {
+ message.success(modal.value.mode === 'create' ? '新增成功' : '更新成功')
+ hideModal()
+ emit('ok')
+ } else {
+ message.error(result?.message || '操作失败')
+ }
+ } catch (error) {
+ console.error('提交失败:', error)
+ message.error('操作失败,请重试')
}
- } catch (error) {
- console.error('提交失败:', error)
- message.error('操作失败,请重试')
- }
- })
+ })
+ } catch (error) {
+ console.error('表单校验失败:', error)
+ return
+ }
+
+
}
function handleCancel() {