generated from Leo_Ding/web-template
Merge branch 'master' of https://gitlab.guxuan.icu/Leo_Ding/hahaPension_admin
This commit is contained in:
commit
1d4b75e6f7
285
src/components/Import/index.vue
Normal file
285
src/components/Import/index.vue
Normal file
@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<!-- 绑定本地visible变量 -->
|
||||
<a-modal
|
||||
v-model="localVisible"
|
||||
title="批量导入"
|
||||
:maskClosable="false"
|
||||
@cancel="handleCancel"
|
||||
:footer="null"
|
||||
width="500px"
|
||||
>
|
||||
<!-- 原有内容不变 -->
|
||||
<div class="import-container">
|
||||
<div class="import-section" :class="{ 'section-top': true }">
|
||||
<h3 class="section-title">
|
||||
<span class="required-mark">*</span>下载模板填写表格信息
|
||||
</h3>
|
||||
<p class="section-desc">
|
||||
请按照数据模板格式准备数据,模板中的表头名称不可更改,表头行不能删除,单次导入的数据不超过1000条。
|
||||
</p>
|
||||
|
||||
<div class="file-info">
|
||||
<a-icon type="file-excel-o" class="file-icon" theme="outlined" />
|
||||
<div class="file-detail">
|
||||
<p class="file-format">支持格式:.xlsx .xls</p>
|
||||
<a-button
|
||||
type="primary"
|
||||
class="action-btn"
|
||||
@click="handleDownloadTemplate"
|
||||
>
|
||||
下载模板
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="import-section upload-section" :class="{ 'section-bottom': true }">
|
||||
<h3 class="section-title">
|
||||
<span class="required-mark">*</span>上传填好的表格信息
|
||||
</h3>
|
||||
<p class="section-desc">
|
||||
文件后缀名必须为xls或xlsx(即Excel格式),文件大小不得超过10M
|
||||
</p>
|
||||
|
||||
<div class="file-info">
|
||||
<a-icon type="file-excel-o" class="file-icon" theme="filled" />
|
||||
<div class="file-detail">
|
||||
<p class="file-format">支持格式:.xlsx .xls</p>
|
||||
<a-upload
|
||||
:showUploadList="false"
|
||||
:beforeUpload="beforeUpload"
|
||||
:customRequest="handleFileUpload"
|
||||
>
|
||||
<a-button
|
||||
type="primary"
|
||||
class="action-btn"
|
||||
>
|
||||
选择表格
|
||||
</a-button>
|
||||
</a-upload>
|
||||
|
||||
<div v-if="selectedFile" class="selected-file">
|
||||
<span class="file-name">{{ selectedFile.name }}</span>
|
||||
<a-icon
|
||||
type="close-circle"
|
||||
class="remove-icon"
|
||||
@click="clearSelectedFile"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<a-button @click="handleCancel">取消</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="handleConfirmUpload"
|
||||
:disabled="!selectedFile"
|
||||
>
|
||||
上传
|
||||
</a-button>
|
||||
</div>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineProps, defineEmits, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
// 1. 定义接收父组件的prop(遵循v-model默认命名规范)
|
||||
const props = defineProps({
|
||||
modelValue: { // 注意这里改名为modelValue,这是v-model的默认绑定名
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
// 2. 定义事件(通知父组件更新值)
|
||||
const emit = defineEmits(['update:modelValue', 'upload', 'download']);
|
||||
|
||||
// 3. 创建本地变量,用于模态框的v-model绑定
|
||||
const localVisible = ref(props.modelValue);
|
||||
const selectedFile = ref(null);
|
||||
|
||||
// 4. 监听父组件传入的modelValue变化,同步到本地变量
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
localVisible.value = newVal;
|
||||
}
|
||||
);
|
||||
|
||||
// 5. 监听本地变量变化,通知父组件(实现双向绑定)
|
||||
watch(
|
||||
() => localVisible.value,
|
||||
(newVal) => {
|
||||
emit('update:modelValue', newVal);
|
||||
}
|
||||
);
|
||||
|
||||
// 处理取消
|
||||
const handleCancel = () => {
|
||||
localVisible.value = false; // 修改本地变量
|
||||
selectedFile.value = null;
|
||||
};
|
||||
|
||||
// 处理下载模板
|
||||
const handleDownloadTemplate = () => {
|
||||
emit('download');
|
||||
};
|
||||
|
||||
// 上传前的校验
|
||||
const beforeUpload = (file) => {
|
||||
const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
|| file.type === 'application/vnd.ms-excel';
|
||||
if (!isExcel) {
|
||||
message.error('请上传Excel格式的文件(.xls或.xlsx)');
|
||||
return false;
|
||||
}
|
||||
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
if (!isLt10M) {
|
||||
message.error('文件大小不能超过10M');
|
||||
return false;
|
||||
}
|
||||
|
||||
selectedFile.value = file;
|
||||
return false;
|
||||
};
|
||||
|
||||
// 处理文件上传
|
||||
const handleFileUpload = () => {
|
||||
// 自定义上传逻辑
|
||||
};
|
||||
|
||||
// 清除选中的文件
|
||||
const clearSelectedFile = () => {
|
||||
selectedFile.value = null;
|
||||
};
|
||||
|
||||
// 确认上传
|
||||
const handleConfirmUpload = () => {
|
||||
if (selectedFile.value) {
|
||||
emit('upload', selectedFile.value);
|
||||
localVisible.value = false; // 上传后关闭模态框
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.import-container {
|
||||
background-color: #ffffff;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.import-section {
|
||||
padding: 16px 16px;
|
||||
background-color: #fafafa;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.import-section.section-top {
|
||||
/* border-bottom: 1px solid #e8e8e8; */
|
||||
margin-bottom: 8px;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
.import-section.section-bottom {
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.required-mark {
|
||||
color: #ff4d4f;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
.section-desc {
|
||||
margin: 0 0 16px 0;
|
||||
font-size: 12px;
|
||||
color: rgba(0, 0, 0, 0.65);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.file-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px;
|
||||
/* background-color: #f5f5f5; */
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.file-icon {
|
||||
font-size: 48px;
|
||||
color: #00b42a;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
.file-detail {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.file-format {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 12px;
|
||||
color: rgba(0, 0, 0, 0.75);
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.selected-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
color: rgba(0, 0, 0, 0.9);
|
||||
max-width: 300px;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.file-name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
margin-right: 8px;
|
||||
background-color: #fff;
|
||||
padding: 2px 6px;
|
||||
border-radius: 2px;
|
||||
border: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
.remove-icon {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
cursor: pointer;
|
||||
transition: color 0.3s;
|
||||
}
|
||||
|
||||
.remove-icon:hover {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 16px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.modal-footer > button:not(:last-child) {
|
||||
margin-right: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@ -44,4 +44,5 @@ export default {
|
||||
serviceMenu: '服务设施',
|
||||
serviceSites: '服务站点',
|
||||
serviceOrganization: '服务组织',
|
||||
nodeAdministration: '节点管理',
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ export default [
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'serviceSites/index.vue',
|
||||
path: 'serviceSites',
|
||||
name: 'serviceSites',
|
||||
component: 'serviceMenu/serviceSites/index.vue',
|
||||
meta: {
|
||||
@ -25,7 +25,7 @@ export default [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'serviceOrganization/index.vue',
|
||||
path: 'serviceOrganization',
|
||||
name: 'serviceOrganization',
|
||||
component: 'serviceMenu/serviceOrganization/index.vue',
|
||||
meta: {
|
||||
@ -36,16 +36,18 @@ export default [
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'add/index.vue',
|
||||
name: 'serviceOrganizationAdd',
|
||||
component: 'serviceMenu/serviceOrganization/pages/index.vue',
|
||||
path: 'nodeAdministration',
|
||||
name: 'nodeAdministration',
|
||||
component: 'serviceMenu/nodeAdministration/index.vue',
|
||||
meta: {
|
||||
title: '新建',
|
||||
isMenu: false,
|
||||
title: '节点管理',
|
||||
isMenu: true,
|
||||
keepAlive: true,
|
||||
permission: '*',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
],
|
||||
},
|
||||
]
|
||||
@ -0,0 +1,687 @@
|
||||
<template>
|
||||
<a-modal
|
||||
:width="800"
|
||||
:open="modal.open"
|
||||
:title="modal.title"
|
||||
:confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose"
|
||||
:cancel-text="cancelText"
|
||||
:ok-text="okText"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-form layout="vertical" ref="formRef" :model="formData" :rules="formRules">
|
||||
<a-card class="mb-4">
|
||||
<a-row :gutter="16">
|
||||
<!-- 基本信息区域 -->
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'站点名称'" name="name" :required="true">
|
||||
<a-input v-model:value="formData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'所在节点'" name="nodeType" :required="true">
|
||||
<a-select v-model:value="formData.nodeType" @change="handleChange">
|
||||
<a-select-option value="jack">已结单</a-select-option>
|
||||
<a-select-option value="lucy">已作废</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'机构代码'" name="code" :required="true">
|
||||
<a-input v-model:value="formData.code"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'站点类型'" name="type" :required="true">
|
||||
<a-select v-model:value="formData.type" @change="handleChange">
|
||||
<a-select-option value="type1">社区服务中心</a-select-option>
|
||||
<a-select-option value="type2">养老服务站</a-select-option>
|
||||
<a-select-option value="type3">综合服务中心</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'负责人姓名'" name="manager" :required="true">
|
||||
<a-input v-model:value="formData.manager"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'联系电话'" name="phone" :required="true">
|
||||
<a-input v-model:value="formData.phone" placeholder="请输入联系电话"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'星级等级'" name="starLevel">
|
||||
<a-select v-model:value="formData.starLevel">
|
||||
<a-select-option value="1">一星</a-select-option>
|
||||
<a-select-option value="2">二星</a-select-option>
|
||||
<a-select-option value="3">三星</a-select-option>
|
||||
<a-select-option value="4">四星</a-select-option>
|
||||
<a-select-option value="5">五星</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'人员编制(个)'" name="staffCount">
|
||||
<a-input-number v-model:value="formData.staffCount" min="0" style="width: 100%"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<!-- 地址信息区域 -->
|
||||
<a-card class="mb-4" title="地址信息">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'服务中心地址'" name="address">
|
||||
<a-cascader
|
||||
v-model:value="formData.address"
|
||||
:options="addressOptions"
|
||||
placeholder="请选择省/市/区"
|
||||
style="width: 100%"
|
||||
></a-cascader>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'详细地址'" name="detailAddress">
|
||||
<a-input v-model:value="formData.detailAddress" placeholder="请输入详细地址"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'地图定位地址'" name="location">
|
||||
<a-row :gutter="8">
|
||||
<a-col :span="18">
|
||||
<a-input
|
||||
v-model:value="formData.location"
|
||||
placeholder="请选择地图位置"
|
||||
readonly
|
||||
></a-input>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-button type="primary" block @click="openMapSelector">选择地图位置</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<!-- 站点信息区域 -->
|
||||
<a-card class="mb-4" title="站点信息">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'建成时间'" name="buildTime">
|
||||
<a-date-picker
|
||||
v-model:value="formData.buildTime"
|
||||
format="YYYY-MM-DD"
|
||||
placeholder="请选择建成时间"
|
||||
></a-date-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'建筑面积(平方米)'" name="area">
|
||||
<a-input-number
|
||||
v-model:value="formData.area"
|
||||
min="0"
|
||||
style="width: 100%"
|
||||
placeholder="请输入建筑面积"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'服务介绍'" name="description">
|
||||
<a-textarea
|
||||
v-model:value="formData.description"
|
||||
rows="4"
|
||||
placeholder="请输入服务介绍"
|
||||
></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<!-- 服务信息区域 -->
|
||||
<a-card class="mb-4" title="服务信息">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'开始营业时间'" name="openTime">
|
||||
<a-time-picker
|
||||
v-model:value="formData.openTime"
|
||||
format="HH:mm"
|
||||
placeholder="请选择开始营业时间"
|
||||
></a-time-picker>
|
||||
<a-time-picker
|
||||
v-model:value="formData.closeTime"
|
||||
format="HH:mm"
|
||||
placeholder="请选择结束营业时间"
|
||||
></a-time-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'营业状态'" name="businessStatus">
|
||||
<a-select v-model:value="formData.businessStatus">
|
||||
<a-select-option value="open">营业中</a-select-option>
|
||||
<a-select-option value="closed">已关闭</a-select-option>
|
||||
<a-select-option value="suspended">暂停营业</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item name="services">
|
||||
<template #label>
|
||||
<span>
|
||||
提供服务
|
||||
<a-tooltip>
|
||||
<template #title>
|
||||
勾选以下服务类型在小程序可见
|
||||
</template>
|
||||
<question-circle-outlined class="info-icon" />
|
||||
</a-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<div class="service-tags">
|
||||
<a-tag
|
||||
v-for="service in allServices"
|
||||
:key="service.value"
|
||||
:checked="formData.services?.includes(service.value)"
|
||||
@click="handleServiceClick(service.value)"
|
||||
:class="{'ant-tag-checkable-checked': formData.services?.includes(service.value)}"
|
||||
class="service-tag"
|
||||
>
|
||||
{{ service.label }}
|
||||
</a-tag>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'是否有厨房'" name="hasKitchen">
|
||||
<a-select v-model:value="formData.hasKitchen">
|
||||
<a-select-option value="yes">是</a-select-option>
|
||||
<a-select-option value="no">否</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'提供餐饮'" name="provideMeal">
|
||||
<a-select v-model:value="formData.provideMeal">
|
||||
<a-select-option value="yes">是</a-select-option>
|
||||
<a-select-option value="no">否</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'支持送餐'" name="supportDelivery">
|
||||
<a-select v-model:value="formData.supportDelivery">
|
||||
<a-select-option value="yes">是</a-select-option>
|
||||
<a-select-option value="no">否</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'助餐点名称'" name="mealPointName">
|
||||
<a-input v-model:value="formData.mealPointName" placeholder="请输入助餐点名称"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'床位数'" name="bedCount" :required="true">
|
||||
<a-input-number v-model:value="formData.bedCount" placeholder="请输入床位数" min="0" style="width: 100%"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'日间照料中心名称'" name="daycareCenterName">
|
||||
<a-input v-model:value="formData.daycareCenterName" placeholder="请输入日间照料中心名称"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<!-- 图片上传区域 -->
|
||||
<a-card class="mb-4" title="图片上传">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'资质附件'" name="qualificationFiles">
|
||||
<a-upload
|
||||
list-type="picture-card"
|
||||
v-model:file-list="formData.qualificationFiles"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div v-if="formData.qualificationFiles.length < 5">
|
||||
<plus-outlined />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
</div>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'站点图片'" name="siteImages">
|
||||
<a-upload
|
||||
list-type="picture-card"
|
||||
v-model:file-list="formData.siteImages"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div v-if="formData.siteImages.length < 5">
|
||||
<plus-outlined />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
</div>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { QuestionCircleOutlined, PlusOutlined } from '@ant-design/icons-vue'
|
||||
import apis from '@/apis'
|
||||
import { useModal, useForm } from '@/hooks'
|
||||
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { config } from '@/config'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import storage from '@/utils/storage'
|
||||
import { message } from 'ant-design-vue'
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formData, formRef, formRules, resetForm } = useForm()
|
||||
|
||||
// 初始化表单数据
|
||||
formData.value = {
|
||||
name: '', // 站点名称
|
||||
parent_id: '',
|
||||
nodeType: '',
|
||||
code: '',
|
||||
type: '',
|
||||
manager: '',
|
||||
phone: '',
|
||||
starLevel: '',
|
||||
staffCount: 0,
|
||||
address: [], // 省市区三级联动
|
||||
detailAddress: '',
|
||||
location: '', // 地图定位地址
|
||||
buildTime: null, // 建成时间
|
||||
area: 0, // 建筑面积
|
||||
description: '', // 服务介绍
|
||||
openTime: null, // 开始营业时间
|
||||
closeTime: null, // 结束营业时间
|
||||
businessStatus: '', // 营业状态
|
||||
services: [], // 提供的服务
|
||||
hasKitchen: '', // 是否有厨房
|
||||
provideMeal: '', // 提供餐饮
|
||||
supportDelivery: '', // 支持送餐
|
||||
mealPointName: '', // 助餐点名称
|
||||
bedCount: 0, // 床位数
|
||||
daycareCenterName: '', // 日间照料中心名称
|
||||
qualificationFiles: [], // 资质附件
|
||||
siteImages: [], // 站点图片
|
||||
resources: []
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
formRules.value = {
|
||||
name: [
|
||||
{ required: true, message: '请输入站点名称' }
|
||||
],
|
||||
nodeType: [
|
||||
{ required: true, message: '请选择所在节点' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: '请输入机构代码' }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '请选择站点类型' }
|
||||
],
|
||||
manager: [
|
||||
{ required: true, message: '请输入负责人姓名' }
|
||||
],
|
||||
phone: [
|
||||
{ required: true, message: '请输入联系电话' },
|
||||
{
|
||||
pattern: /^1[3-9]\d{9}$/,
|
||||
message: '请输入正确的联系电话'
|
||||
}
|
||||
],
|
||||
bedCount: [
|
||||
{ required: true, message: '请输入床位数' },
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
if (typeof value === 'number' && value >= 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(new Error('床位数必须为非负数'));
|
||||
}
|
||||
return Promise.reject(new Error('请输入床位数'));
|
||||
}
|
||||
}
|
||||
],
|
||||
address: { required: true, message: '请选择省市区' },
|
||||
detailAddress: { required: true, message: '请输入详细地址' },
|
||||
buildTime: { required: true, message: '请选择建成时间' },
|
||||
area: {
|
||||
required: true,
|
||||
validator: (_, value) => {
|
||||
if (value && value > 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(new Error('请输入有效的建筑面积'));
|
||||
}
|
||||
},
|
||||
openTime: { required: true, message: '请选择开始营业时间' },
|
||||
closeTime: { required: true, message: '请选择结束营业时间' },
|
||||
businessStatus: { required: true, message: '请选择营业状态' },
|
||||
services: {
|
||||
required: true,
|
||||
validator: (_, value) => {
|
||||
if (value && value.length > 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(new Error('请至少选择一项服务'));
|
||||
}
|
||||
},
|
||||
hasKitchen: { required: true, message: '请选择是否有厨房' },
|
||||
provideMeal: { required: true, message: '请选择是否提供餐饮' }
|
||||
}
|
||||
|
||||
// 表格列定义
|
||||
const columns = [
|
||||
{ title: t('pages.system.menu.form.path'), dataIndex: 'types', key: 'types' },
|
||||
{ title: t('button.action'), dataIndex: 'action', key: 'action' }
|
||||
]
|
||||
|
||||
// 请求类型
|
||||
const reqType = ['GET', 'POST', 'PUT', 'PATCH', 'HEAD', 'DELETE']
|
||||
|
||||
// 取消和确认按钮文本
|
||||
const cancelText = ref(t('button.cancel'))
|
||||
const okText = ref(t('button.confirm'))
|
||||
const platform = ref('')
|
||||
|
||||
// 地址选项 - 实际项目中可以从接口获取
|
||||
const addressOptions = ref([
|
||||
{
|
||||
value: 'beijing',
|
||||
label: '北京',
|
||||
children: [
|
||||
{
|
||||
value: 'haidian',
|
||||
label: '海淀区',
|
||||
children: [
|
||||
{ value: 'zhongguancun', label: '中关村' },
|
||||
{ value: 'wudaokou', label: '五道口' }
|
||||
]
|
||||
},
|
||||
{
|
||||
value: 'chaoyang',
|
||||
label: '朝阳区',
|
||||
children: [
|
||||
{ value: 'cbd', label: 'CBD' },
|
||||
{ value: 'sanlitun', label: '三里屯' }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
value: 'shanghai',
|
||||
label: '上海',
|
||||
children: [
|
||||
{
|
||||
value: 'pudong',
|
||||
label: '浦东新区',
|
||||
children: [
|
||||
{ value: 'lujiazui', label: '陆家嘴' },
|
||||
{ value: 'zhangjiang', label: '张江' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
// 所有可提供的服务
|
||||
const allServices = [
|
||||
{ value: 'meal', label: '助餐' },
|
||||
{ value: 'daycare', label: '日间照料' },
|
||||
{ value: 'equipment', label: '辅具租赁' },
|
||||
{ value: 'entertainment', label: '休闲/娱乐' },
|
||||
{ value: 'health', label: '健康管理' }
|
||||
]
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*/
|
||||
function handleCreate() {
|
||||
formData.value.resources = []
|
||||
formData.value.qualificationFiles = []
|
||||
formData.value.siteImages = []
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '新增服务站点',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加下级
|
||||
*/
|
||||
function handleCreateChild(record = {}) {
|
||||
formData.value.resources = []
|
||||
formData.value.qualificationFiles = []
|
||||
formData.value.siteImages = []
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: '新增服务站点',
|
||||
})
|
||||
formData.value.parent_id = record.id
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
async function handleEdit(record = {}) {
|
||||
showModal({
|
||||
type: 'edit',
|
||||
title: t('pages.system.menu.edit'),
|
||||
})
|
||||
const { data } = await apis.menu.getMenu(record.id).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
formData.value = cloneDeep(data)
|
||||
formData.value.properties = formData.value.properties ? JSON.parse(formData.value.properties) : ''
|
||||
formData.value.resources = formData.value.resources || []
|
||||
formData.value.qualificationFiles = formData.value.qualificationFiles || []
|
||||
formData.value.siteImages = formData.value.siteImages || []
|
||||
platform.value = data.platform
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定提交
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value
|
||||
.validateFields()
|
||||
.then(async (values) => {
|
||||
try {
|
||||
showLoading()
|
||||
const params = {
|
||||
...values,
|
||||
}
|
||||
params.sequence = Number.parseInt(params.sequence) || 0
|
||||
params.properties = JSON.stringify(params.properties)
|
||||
|
||||
// 处理地址数据
|
||||
params.province = params.address[0]
|
||||
params.city = params.address[1]
|
||||
params.district = params.address[2]
|
||||
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
params.platform = storage.local.getItem('platform')
|
||||
result = await apis.menu.createMenu(params).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
break
|
||||
case 'edit':
|
||||
newApiData()
|
||||
params.resources = formData.value.resources
|
||||
params.platform = platform.value
|
||||
result = await apis.menu.updateMenu(formData.value.id, params).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
break
|
||||
}
|
||||
hideLoading()
|
||||
if (config('http.code.success') === result?.success) {
|
||||
hideModal()
|
||||
emit('ok')
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消
|
||||
*/
|
||||
function handleCancel() {
|
||||
hideModal()
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理API数据
|
||||
*/
|
||||
function newApiData() {
|
||||
if (formData.value.resources)
|
||||
formData.value.resources.forEach((item) => {
|
||||
item.menu_id = formData.value.id
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭后重置
|
||||
*/
|
||||
function onAfterClose() {
|
||||
resetForm()
|
||||
hideLoading()
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加API
|
||||
*/
|
||||
function handleAddApi() {
|
||||
formData.value.resources.push({
|
||||
method: 'GET',
|
||||
path: '',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除API
|
||||
*/
|
||||
function handleDelete(index) {
|
||||
formData.value.resources.splice(index, 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理服务点击事件
|
||||
*/
|
||||
function handleServiceClick(value) {
|
||||
if (!formData.value.services) {
|
||||
formData.value.services = []
|
||||
}
|
||||
|
||||
const index = formData.value.services.indexOf(value)
|
||||
if (index > -1) {
|
||||
// 如果已选中,则取消选中
|
||||
formData.value.services.splice(index, 1)
|
||||
} else {
|
||||
// 如果未选中,则添加选中
|
||||
formData.value.services.push(value)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开地图选择器
|
||||
*/
|
||||
function openMapSelector() {
|
||||
// 实际项目中可以调用地图组件或打开地图选择弹窗
|
||||
// 这里使用模拟数据
|
||||
formData.value.location = '北京市海淀区中关村大街1号 (经纬度: 39.9847, 116.3055)'
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传前处理
|
||||
*/
|
||||
function beforeUpload(file) {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
||||
if (!isJpgOrPng) {
|
||||
message.error('只能上传JPG/PNG格式的图片!')
|
||||
return false
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 2
|
||||
if (!isLt2M) {
|
||||
message.error('图片大小不能超过2MB!')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleCreate,
|
||||
handleCreateChild,
|
||||
handleEdit,
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.service-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
// 服务标签选中样式
|
||||
.service-tag {
|
||||
cursor: pointer;
|
||||
|
||||
&.ant-tag-checkable-checked {
|
||||
background-color: #1890ff; // 蓝色背景
|
||||
color: #fff; // 白色文字
|
||||
border-color: #1890ff;
|
||||
|
||||
&:hover {
|
||||
background-color: #40a9ff;
|
||||
border-color: #40a9ff;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.ant-tag-checkable-checked) {
|
||||
&:hover {
|
||||
border-color: #1890ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 信息图标样式
|
||||
.info-icon {
|
||||
margin-left: 4px;
|
||||
color: #1890ff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ant-upload-list {
|
||||
margin-top: 8px;
|
||||
}
|
||||
</style>
|
||||
459
src/views/serviceMenu/nodeAdministration/index.vue
Normal file
459
src/views/serviceMenu/nodeAdministration/index.vue
Normal file
@ -0,0 +1,459 @@
|
||||
<template>
|
||||
<div class="org-management">
|
||||
<!-- <div class="header">
|
||||
<h1>组织管理</h1>
|
||||
<a-button type="primary" @click="showAddModal()">添加根节点</a-button>
|
||||
</div> -->
|
||||
|
||||
<div class="org-table">
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="dataSource"
|
||||
:pagination="false"
|
||||
row-key="orgId"
|
||||
:expand-icon-as-cell="false"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'projectType'">
|
||||
<a-tag :color="record.projectType === 'Supervision' ? 'blue' : 'green'">
|
||||
{{ record.projectType === 'Supervision' ? '监管' : '居家养老床位' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag :color="record.status === 0 ? 'green' : 'red'">
|
||||
{{ record.status === 0 ? '启用' : '禁用' }}
|
||||
</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'actions'">
|
||||
<div class="actions">
|
||||
<a-button
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="showAddModal(record)"
|
||||
v-if="record.projectType === 'Supervision'"
|
||||
>
|
||||
添加子节点
|
||||
</a-button>
|
||||
<a-button
|
||||
size="small"
|
||||
danger
|
||||
@click="handleDelete(record)"
|
||||
>
|
||||
删除
|
||||
</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
|
||||
<!-- 添加节点模态框 -->
|
||||
<a-modal
|
||||
v-model:visible="addModalVisible"
|
||||
:title="isEditing ? '编辑节点' : '添加节点'"
|
||||
@ok="handleAdd"
|
||||
@cancel="handleCancel"
|
||||
:confirm-loading="confirmLoading"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="formState"
|
||||
:rules="rules"
|
||||
layout="vertical"
|
||||
>
|
||||
<a-form-item label="节点名称" name="name">
|
||||
<a-input v-model:value="formState.name" placeholder="请输入节点名称" />
|
||||
</a-form-item>
|
||||
<a-form-item label="节点类型" name="projectType">
|
||||
<a-select v-model:value="formState.projectType" placeholder="请选择节点类型">
|
||||
<a-select-option value="Supervision">监管</a-select-option>
|
||||
<a-select-option value="HomeCareBed">居家养老床位</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="状态" name="status">
|
||||
<a-radio-group v-model:value="formState.status">
|
||||
<a-radio :value="0">启用</a-radio>
|
||||
<a-radio :value="1">禁用</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
|
||||
// 转换数据格式,将 subOrgList 转换为 children
|
||||
const convertData = (data) => {
|
||||
return data.map(item => {
|
||||
const converted = {
|
||||
...item,
|
||||
key: item.orgId, // 使用 orgId 作为 key
|
||||
};
|
||||
|
||||
if (item.subOrgList && item.subOrgList.length > 0) {
|
||||
converted.children = convertData(item.subOrgList);
|
||||
}
|
||||
|
||||
return converted;
|
||||
});
|
||||
};
|
||||
|
||||
// 原始数据
|
||||
const originalData = ref([
|
||||
{
|
||||
"id": 5066,
|
||||
"orgId": "1813150290069417984",
|
||||
"name": "南通市通州区互联网+智慧养老居家上门服务项目",
|
||||
"path": "/0/1813150290069417984",
|
||||
"parentId": "0",
|
||||
"status": 0,
|
||||
"tenantId": "1813150290048446464",
|
||||
"projectType": "Supervision",
|
||||
"subOrgList": [
|
||||
{
|
||||
"id": 5093,
|
||||
"orgId": "1813400548804390913",
|
||||
"name": "东社镇",
|
||||
"parentId": "1813150290069417984",
|
||||
"path": "/0/1813150290069417984/1813400548804390913",
|
||||
"status": 0,
|
||||
"tenantId": "1813150290048446464",
|
||||
"projectType": "Supervision",
|
||||
"createBy": "1694238554834726912",
|
||||
"createTime": "2024-07-17T10:29:17",
|
||||
"updateBy": "1694238554834726912",
|
||||
"updateTime": "2024-07-17T10:29:17",
|
||||
"subOrgList": [
|
||||
{
|
||||
"id": 5094,
|
||||
"orgId": "1813400640336556032",
|
||||
"name": "东社镇服务站",
|
||||
"parentId": "1813400548804390913",
|
||||
"path": "/0/1813150290069417984/1813400548804390913/1813400640336556032",
|
||||
"status": 0,
|
||||
"tenantId": "1813150290048446464",
|
||||
"projectType": "HomeCareBed",
|
||||
"createBy": "1694238554834726912",
|
||||
"createTime": "2024-07-17T10:29:39",
|
||||
"updateBy": "1694238554834726912",
|
||||
"updateTime": "2024-07-17T10:29:39",
|
||||
"subOrgList": [],
|
||||
"disabled": false
|
||||
}
|
||||
],
|
||||
"disabled": false
|
||||
},
|
||||
{
|
||||
"id": 5071,
|
||||
"orgId": "1813396942931881985",
|
||||
"name": "二甲镇",
|
||||
"parentId": "1813150290069417984",
|
||||
"path": "/0/1813150290069417984/1813396942931881985",
|
||||
"status": 0,
|
||||
"tenantId": "1813150290048446464",
|
||||
"projectType": "Supervision",
|
||||
"createBy": "1694238554834726912",
|
||||
"createTime": "2024-07-17T10:14:57",
|
||||
"updateBy": "1694238554834726912",
|
||||
"updateTime": "2024-07-17T10:14:57",
|
||||
"subOrgList": [
|
||||
{
|
||||
"id": 5072,
|
||||
"orgId": "1813397035642646528",
|
||||
"name": "二甲镇服务站",
|
||||
"parentId": "1813396942931881985",
|
||||
"path": "/0/1813150290069417984/1813396942931881985/1813397035642646528",
|
||||
"status": 0,
|
||||
"tenantId": "1813150290048446464",
|
||||
"projectType": "HomeCareBed",
|
||||
"createBy": "1694238554834726912",
|
||||
"createTime": "2024-07-17T10:15:19",
|
||||
"updateBy": "1694238554834726912",
|
||||
"updateTime": "2024-07-17T10:15:19",
|
||||
"subOrgList": [],
|
||||
"disabled": false
|
||||
}
|
||||
],
|
||||
"disabled": false
|
||||
},
|
||||
{
|
||||
"id": 5091,
|
||||
"orgId": "1813400338249674753",
|
||||
"name": "五接镇",
|
||||
"parentId": "1813150290069417984",
|
||||
"path": "/0/1813150290069417984/1813400338249674753",
|
||||
"status": 0,
|
||||
"tenantId": "1813150290048446464",
|
||||
"projectType": "Supervision",
|
||||
"createBy": "1694238554834726912",
|
||||
"createTime": "2024-07-17T10:28:27",
|
||||
"updateBy": "1694238554834726912",
|
||||
"updateTime": "2024-07-17T10:28:27",
|
||||
"subOrgList": [
|
||||
{
|
||||
"id": 5092,
|
||||
"orgId": "1813400446438469632",
|
||||
"name": "五接镇服务站",
|
||||
"parentId": "1813400338249674753",
|
||||
"path": "/0/1813150290069417984/1813400338249674753/1813400446438469632",
|
||||
"status": 0,
|
||||
"tenantId": "1813150290048446464",
|
||||
"projectType": "HomeCareBed",
|
||||
"createBy": "1694238554834726912",
|
||||
"createTime": "2024-07-17T10:28:53",
|
||||
"updateBy": "1694238554834726912",
|
||||
"updateTime": "2024-07-17T10:28:53",
|
||||
"subOrgList": [],
|
||||
"disabled": false
|
||||
}
|
||||
],
|
||||
"disabled": false
|
||||
}
|
||||
],
|
||||
"disabled": false
|
||||
}
|
||||
]);
|
||||
|
||||
// 数据源
|
||||
const dataSource = ref([]);
|
||||
|
||||
// 模态框状态
|
||||
const addModalVisible = ref(false);
|
||||
const isEditing = ref(false);
|
||||
const currentParent = ref(null);
|
||||
const confirmLoading = ref(false);
|
||||
|
||||
// 表单状态
|
||||
const formState = reactive({
|
||||
name: '',
|
||||
projectType: 'Supervision',
|
||||
status: 0
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
name: [
|
||||
{ required: true, message: '请输入节点名称', trigger: 'blur' }
|
||||
],
|
||||
projectType: [
|
||||
{ required: true, message: '请选择节点类型', trigger: 'change' }
|
||||
]
|
||||
};
|
||||
|
||||
// 表格列定义
|
||||
const columns = [
|
||||
{
|
||||
title: '组织名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
},
|
||||
{
|
||||
title: '组织类型',
|
||||
dataIndex: 'projectType',
|
||||
key: 'projectType',
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '更新时间',
|
||||
dataIndex: 'updateTime',
|
||||
key: 'updateTime',
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'actions',
|
||||
width: 200,
|
||||
},
|
||||
];
|
||||
|
||||
// 初始化数据
|
||||
const initData = () => {
|
||||
dataSource.value = convertData(originalData.value);
|
||||
};
|
||||
|
||||
// 删除节点
|
||||
const handleDelete = (record) => {
|
||||
Modal.confirm({
|
||||
title: '确认删除',
|
||||
content: `确定要删除"${record.name}"吗?${record.children && record.children.length > 0 ? '此操作将同时删除所有子节点。' : ''}`,
|
||||
onOk() {
|
||||
deleteNode(originalData.value, record.orgId);
|
||||
initData();
|
||||
message.success('删除成功');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 递归删除节点
|
||||
const deleteNode = (data, orgId) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].orgId === orgId) {
|
||||
data.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
if (data[i].subOrgList && data[i].subOrgList.length > 0) {
|
||||
if (deleteNode(data[i].subOrgList, orgId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 显示添加模态框
|
||||
const showAddModal = (parent = null) => {
|
||||
currentParent.value = parent;
|
||||
isEditing.value = false;
|
||||
// 重置表单
|
||||
Object.assign(formState, {
|
||||
name: '',
|
||||
projectType: 'Supervision',
|
||||
status: 0
|
||||
});
|
||||
addModalVisible.value = true;
|
||||
};
|
||||
|
||||
// 处理添加节点
|
||||
const handleAdd = async () => {
|
||||
if (!formState.name) {
|
||||
message.error('请输入节点名称');
|
||||
return;
|
||||
}
|
||||
|
||||
confirmLoading.value = true;
|
||||
|
||||
try {
|
||||
// 模拟异步操作
|
||||
await new Promise(resolve => setTimeout(resolve, 500));
|
||||
|
||||
const newNode = {
|
||||
id: Date.now(),
|
||||
orgId: `new_${Date.now()}`,
|
||||
name: formState.name,
|
||||
parentId: currentParent.value ? currentParent.value.orgId : '0',
|
||||
path: currentParent.value ? `${currentParent.value.path}/${formState.name}` : `/0/${formState.name}`,
|
||||
status: formState.status,
|
||||
tenantId: "1813150290048446464",
|
||||
projectType: formState.projectType,
|
||||
createBy: "system",
|
||||
createTime: new Date().toISOString().split('T')[0],
|
||||
updateBy: "system",
|
||||
updateTime: new Date().toISOString().split('T')[0],
|
||||
subOrgList: [],
|
||||
disabled: false
|
||||
};
|
||||
|
||||
if (currentParent.value) {
|
||||
// 添加到父节点的 subOrgList
|
||||
addChildNode(originalData.value, currentParent.value.orgId, newNode);
|
||||
} else {
|
||||
// 添加为根节点
|
||||
originalData.value.push(newNode);
|
||||
}
|
||||
|
||||
// 重新初始化数据以触发响应式更新
|
||||
initData();
|
||||
addModalVisible.value = false;
|
||||
message.success('添加成功');
|
||||
} catch (error) {
|
||||
console.error('添加失败:', error);
|
||||
message.error('添加失败');
|
||||
} finally {
|
||||
confirmLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 递归添加子节点
|
||||
const addChildNode = (data, parentId, newNode) => {
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].orgId === parentId) {
|
||||
if (!data[i].subOrgList) {
|
||||
data[i].subOrgList = [];
|
||||
}
|
||||
data[i].subOrgList.push(newNode);
|
||||
return true;
|
||||
}
|
||||
if (data[i].subOrgList && data[i].subOrgList.length > 0) {
|
||||
if (addChildNode(data[i].subOrgList, parentId, newNode)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// 取消添加
|
||||
const handleCancel = () => {
|
||||
addModalVisible.value = false;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.org-management {
|
||||
margin: 0 auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.org-table {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.header h1 {
|
||||
margin: 0;
|
||||
color: #1f1f1f;
|
||||
font-size: 24px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
:deep(.ant-table-thead > tr > th) {
|
||||
background-color: #fafafa;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
:deep(.ant-table-row-level-0) {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
:deep(.ant-table-row-level-1) {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
:deep(.ant-table-row-level-2) {
|
||||
font-weight: 400;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,283 @@
|
||||
<template>
|
||||
<!-- 主弹框:标题显示当前组织名称 -->
|
||||
<a-modal
|
||||
:title="`${orgRecord.orgName || '组织'} - 设备管理`"
|
||||
v-model:visible="visible"
|
||||
:maskClosable="false"
|
||||
:width="800"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<!-- 顶部添加设备按钮 -->
|
||||
<div class="flex justify-end mb-4" style="margin: 10px 0;">
|
||||
<a-button type="primary" @click="showAddModal = true">
|
||||
<plus-outlined />
|
||||
添加设备
|
||||
</a-button>
|
||||
</div>
|
||||
|
||||
<!-- 设备表格 -->
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="devices"
|
||||
row-key="deviceId"
|
||||
:pagination="false"
|
||||
>
|
||||
<!-- 连接状态列:用徽章显示 -->
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'online'">
|
||||
<a-badge :status="record.online ? 'success' : 'error'">
|
||||
{{ record.online ? '在线' : '离线' }}
|
||||
</a-badge>
|
||||
</template>
|
||||
<!-- 操作列:编辑/删除 -->
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-button size="small" type="link" @click="handleEdit(record)">
|
||||
编辑
|
||||
</a-button>
|
||||
<a-button size="small" type="link" danger @click="handleDelete(record)">
|
||||
删除
|
||||
</a-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<!-- 添加/编辑设备子弹框 -->
|
||||
<a-modal
|
||||
:title="isEditing ? '编辑设备' : '添加设备'"
|
||||
v-model:visible="showAddModal"
|
||||
:maskClosable="false"
|
||||
@cancel="showAddModal = false"
|
||||
@ok="handleFormSubmit"
|
||||
>
|
||||
<a-form
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
ref="formRef"
|
||||
layout="horizontal"
|
||||
:label-col="{ span: 6 }"
|
||||
:wrapper-col="{ span: 16 }"
|
||||
>
|
||||
<a-form-item
|
||||
name="deviceId"
|
||||
label="设备ID"
|
||||
:rules="[{ required: true, message: '请输入设备ID' }]"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="formData.deviceId"
|
||||
placeholder="请输入设备ID"
|
||||
:disabled="isEditing"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
name="deviceName"
|
||||
label="设备名称"
|
||||
:rules="[{ required: true, message: '请输入设备名称' }]"
|
||||
>
|
||||
<a-input
|
||||
v-model:value="formData.deviceName"
|
||||
placeholder="请输入设备名称"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
name="deviceType"
|
||||
label="设备类型"
|
||||
:rules="[{ required: true, message: '请选择设备类型' }]"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="formData.deviceType"
|
||||
placeholder="请选择设备类型"
|
||||
>
|
||||
<a-select-option value="sensor">传感器</a-select-option>
|
||||
<a-select-option value="controller">控制器</a-select-option>
|
||||
<a-select-option value="gateway">网关</a-select-option>
|
||||
<a-select-option value="camera">摄像头</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
name="deviceManufacturer"
|
||||
label="设备供应商"
|
||||
:rules="[{ required: true, message: '请选择设备供应商' }]"
|
||||
>
|
||||
<a-select
|
||||
v-model:value="formData.deviceManufacturer"
|
||||
placeholder="请选择设备供应商"
|
||||
>
|
||||
<a-select-option value="vendor1">供应商A</a-select-option>
|
||||
<a-select-option value="vendor2">供应商B</a-select-option>
|
||||
<a-select-option value="vendor3">供应商C</a-select-option>
|
||||
<a-select-option value="vendor4">供应商D</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, defineProps, defineEmits, defineExpose } from 'vue';
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { message, Form } from 'ant-design-vue';
|
||||
|
||||
// 1. 定义props:接收父组件传递的组织信息
|
||||
const props = defineProps({
|
||||
orgRecord: {
|
||||
type: Object,
|
||||
default: () => ({ orgName: '默认组织' }), // 默认值防止空值报错
|
||||
required: false
|
||||
}
|
||||
})
|
||||
|
||||
// 弹框状态
|
||||
const visible = ref(false);
|
||||
const showAddModal = ref(false);
|
||||
const formRef = ref(null);
|
||||
const isEditing = ref(false);
|
||||
|
||||
// 2. 设备表格列配置(优化显示文本)
|
||||
const columns = ref([
|
||||
{ title: '设备ID', dataIndex: 'deviceId', key: 'deviceId', align: 'center' },
|
||||
{ title: '设备名称', dataIndex: 'deviceName', key: 'deviceName', align: 'center' },
|
||||
{
|
||||
title: '设备类型',
|
||||
dataIndex: 'deviceType',
|
||||
key: 'deviceType',
|
||||
align: 'center',
|
||||
render: (type) => {
|
||||
const typeMap = {
|
||||
'sensor': '传感器', 'controller': '控制器',
|
||||
'gateway': '网关', 'camera': '摄像头'
|
||||
};
|
||||
return typeMap[type] || type;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '设备供应商',
|
||||
dataIndex: 'deviceManufacturer',
|
||||
key: 'deviceManufacturer',
|
||||
align: 'center',
|
||||
render: (vendor) => {
|
||||
const vendorMap = {
|
||||
'vendor1': '供应商A', 'vendor2': '供应商B',
|
||||
'vendor3': '供应商C', 'vendor4': '供应商D'
|
||||
};
|
||||
return vendorMap[vendor] || vendor;
|
||||
}
|
||||
},
|
||||
{ title: '连接状态', dataIndex: 'online', key: 'online', align: 'center' },
|
||||
{ title: '操作', key: 'action', align: 'center', fixed: 'right', width: 120 }
|
||||
]);
|
||||
|
||||
// 设备数据(后续可替换为接口请求:根据orgRecord.id获取该组织的设备)
|
||||
const devices = ref([
|
||||
{ deviceId: 'DEV001', deviceName: '温度传感器', deviceType: 'sensor', deviceManufacturer: 'vendor1', online: true },
|
||||
{ deviceId: 'DEV002', deviceName: '智能控制器', deviceType: 'controller', deviceManufacturer: 'vendor2', online: false },
|
||||
{ deviceId: 'DEV003', deviceName: '网络网关', deviceType: 'gateway', deviceManufacturer: 'vendor3', online: true },
|
||||
]);
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
deviceId: '',
|
||||
deviceName: '',
|
||||
deviceType: '',
|
||||
deviceManufacturer: '',
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const formRules = reactive({
|
||||
deviceId: [{ required: true, message: '请输入设备ID' }],
|
||||
deviceName: [{ required: true, message: '请输入设备名称' }],
|
||||
deviceType: [{ required: true, message: '请选择设备类型' }],
|
||||
deviceManufacturer: [{ required: true, message: '请选择设备供应商' }],
|
||||
});
|
||||
|
||||
// 3. 暴露给父组件的方法:打开弹框(可接收参数)
|
||||
function open(options = {}) {
|
||||
const { orgRecord } = options;
|
||||
if (orgRecord) {
|
||||
// 更新当前组织信息(父组件传递的组织数据)
|
||||
props.orgRecord = orgRecord;
|
||||
}
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
// 关闭主弹框
|
||||
function handleCancel() {
|
||||
visible.value = false;
|
||||
// 关闭主弹框时同时关闭子弹框并重置表单
|
||||
showAddModal.value = false;
|
||||
resetForm();
|
||||
}
|
||||
|
||||
// 提交表单(添加/编辑设备)
|
||||
async function handleFormSubmit() {
|
||||
try {
|
||||
// 表单验证
|
||||
await formRef.value.validate();
|
||||
|
||||
if (isEditing.value) {
|
||||
// 编辑设备:更新现有数据
|
||||
const index = devices.value.findIndex(dev => dev.deviceId === formData.deviceId);
|
||||
if (index !== -1) {
|
||||
devices.value[index] = { ...formData, online: devices.value[index].online };
|
||||
message.success('设备编辑成功');
|
||||
}
|
||||
} else {
|
||||
// 添加设备:检查ID唯一性
|
||||
const isExist = devices.value.some(dev => dev.deviceId === formData.deviceId);
|
||||
if (isExist) {
|
||||
message.error('设备ID已存在');
|
||||
return;
|
||||
}
|
||||
// 新增设备(默认离线)
|
||||
devices.value.push({ ...formData, online: false });
|
||||
message.success('设备添加成功');
|
||||
}
|
||||
|
||||
// 关闭子弹框并重置表单
|
||||
showAddModal.value = false;
|
||||
resetForm();
|
||||
} catch (error) {
|
||||
console.log('表单验证失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
function resetForm() {
|
||||
if (formRef.value) {
|
||||
formRef.value.resetFields();
|
||||
}
|
||||
isEditing.value = false;
|
||||
formData.deviceId = '';
|
||||
formData.deviceName = '';
|
||||
formData.deviceType = '';
|
||||
formData.deviceManufacturer = '';
|
||||
}
|
||||
|
||||
// 编辑设备:加载当前设备数据到表单
|
||||
function handleEdit(record) {
|
||||
isEditing.value = true;
|
||||
formData.deviceId = record.deviceId;
|
||||
formData.deviceName = record.deviceName;
|
||||
formData.deviceType = record.deviceType;
|
||||
formData.deviceManufacturer = record.deviceManufacturer;
|
||||
showAddModal.value = true;
|
||||
}
|
||||
|
||||
// 删除设备
|
||||
function handleDelete(record) {
|
||||
devices.value = devices.value.filter(dev => dev.deviceId !== record.deviceId);
|
||||
message.success('设备已删除');
|
||||
}
|
||||
|
||||
// 4. 暴露方法给父组件调用
|
||||
defineExpose({
|
||||
open,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 可选:调整弹框内边距 */
|
||||
.ant-modal-body {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,15 +4,26 @@
|
||||
<a-form :label-col="{ style: { width: '100px' } }" :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'站点名称'" name="name">
|
||||
<a-input :placeholder="'请输入站点名称'" v-model:value="searchFormData.name"></a-input>
|
||||
<a-form-item :label="'所在区域'" name="area">
|
||||
<a-input :placeholder="'请选择区域'" v-model:value="searchFormData.area"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'站点类型'" name="name">
|
||||
<a-select ref="select" v-model:value="searchFormData.name" @focus="focus"
|
||||
@change="handleChange">
|
||||
<a-form-item :label="'组织名称'" name="name">
|
||||
<a-input :placeholder="'请输组织名称'" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'负责人'" name="contactPerson">
|
||||
<a-input :placeholder="'请输负责人'" v-model:value="searchFormData.contactPerson"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'等级'" name="level">
|
||||
<a-select v-model:value="searchFormData.level" @change="handleChange">
|
||||
<a-select-option value="jack">已结单</a-select-option>
|
||||
<a-select-option value="lucy">已作废</a-select-option>
|
||||
</a-select>
|
||||
@ -20,22 +31,26 @@
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'所在区域'" name="name">
|
||||
<a-input :placeholder="'请选择区域'" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'所在节点'" name="name">
|
||||
<a-select ref="select" v-model:value="searchFormData.name" @focus="focus"
|
||||
@change="handleChange">
|
||||
<a-form-item :label="'可用钱包'" name="wallet">
|
||||
<a-select v-model:value="searchFormData.wallet" @change="handleChange">
|
||||
<a-select-option value="jack">已结单</a-select-option>
|
||||
<a-select-option value="lucy">已作废</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan" style="text-align: right;">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'收否中标'" name="bidStatus">
|
||||
<a-select v-model:value="searchFormData.bidStatus" @change="handleChange">
|
||||
<a-select-option value="jack">已结单</a-select-option>
|
||||
<a-select-option value="lucy">已作废</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="gutter" justify="end" style="margin-top: 20px;">
|
||||
<a-col>
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
@ -44,7 +59,7 @@
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar>
|
||||
@ -52,41 +67,10 @@
|
||||
<a-card>
|
||||
<!-- 添加标题和横线 -->
|
||||
<div class="title-container">
|
||||
<h3>服务站点列表</h3>
|
||||
<h3>服务组织列表</h3>
|
||||
<div class="title-line"></div>
|
||||
</div>
|
||||
|
||||
<x-action-bar class="mb-8-2">
|
||||
<!-- 增加按钮之间的间距 -->
|
||||
<a-space :size="12">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
新建
|
||||
</a-button>
|
||||
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
导入
|
||||
</a-button>
|
||||
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<UnorderedListOutlined />
|
||||
</template>
|
||||
导入记录
|
||||
</a-button>
|
||||
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
导出
|
||||
</a-button>
|
||||
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<UnorderedListOutlined />
|
||||
</template>
|
||||
导出记录
|
||||
</a-button>
|
||||
</a-space>
|
||||
</x-action-bar>
|
||||
|
||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'menuType' === column.key">
|
||||
@ -115,72 +99,76 @@
|
||||
</a-tag>
|
||||
</template>
|
||||
|
||||
<template v-if="'action' === column.key">
|
||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.menu.edit') }}</template>
|
||||
<edit-outlined />
|
||||
</a-tooltip>
|
||||
</x-action-button>
|
||||
|
||||
<x-action-button @click="$refs.editDialogRef.handleCreateChild(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.menu.button.addChild') }}</template>
|
||||
<plus-circle-outlined />
|
||||
</a-tooltip>
|
||||
</x-action-button>
|
||||
<x-action-button @click="handleDelete(record)">
|
||||
<a-tooltip>
|
||||
<template #title>{{ $t('pages.system.delete') }}</template>
|
||||
<delete-outlined style="color: #ff4d4f" />
|
||||
</a-tooltip>
|
||||
</x-action-button>
|
||||
<template v-if="'actions' === column.key">
|
||||
<span class="action-buttons">
|
||||
<a-button type="link" size="small" @click="handleEdit(record)">编辑</a-button>
|
||||
<a-divider type="vertical" />
|
||||
<a-button type="link" size="small" @click="handleDetail(record)">详情</a-button>
|
||||
<a-divider type="vertical" />
|
||||
<a-button type="link" size="small" @click="handleToggleStatus(record)">
|
||||
{{ record.status === 'active' ? '停用' : '启用' }}
|
||||
</a-button>
|
||||
<a-divider type="vertical" />
|
||||
<a-button type="link" size="small" @click="handleDeviceManagement(record)">设备管理</a-button>
|
||||
</span>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-card>
|
||||
|
||||
<edit-dialog @ok="onOk" ref="editDialogRef" />
|
||||
<!-- 设备管理弹框组件 -->
|
||||
<device-management-modal ref="deviceManagementModalRef" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Modal, message } from 'ant-design-vue'
|
||||
import { Modal, message, Divider } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import { UnorderedListOutlined } from '@ant-design/icons-vue'
|
||||
import { UnorderedListOutlined, EditOutlined, PlusCircleOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
|
||||
import { usePagination, useForm } from '@/hooks'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
// 导入设备管理组件
|
||||
import DeviceManagementModal from './components/AddEquipments.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import storage from '@/utils/storage'
|
||||
|
||||
defineOptions({
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
name: 'menu',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
|
||||
// 控制导入弹框显示/隐藏的变量
|
||||
const showImportModal = ref(false)
|
||||
|
||||
// 定义设备管理弹框的ref引用 - 这是修复错误的关键
|
||||
const deviceManagementModalRef = ref(null)
|
||||
// 编辑对话框的ref引用
|
||||
const editDialogRef = ref(null)
|
||||
|
||||
const columns = ref([
|
||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
||||
{ title: '身份证号', dataIndex: 'type', key: 'menuType', width: 240 },
|
||||
{ title: '联系方式1', dataIndex: 'status', key: 'statusType', width: 240 },
|
||||
{ title: '联系方式2', dataIndex: 'sequence', width: 240 },
|
||||
{ title: '计划服务时间', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '计划服务时常(分钟)', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务项目', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '所属区域', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务地址', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务组织', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '服务人员', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '下单员', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '下单时间', dataIndex: 'created_at', key: 'createAt', width: 240 },
|
||||
{ title: '序号', dataIndex: 'serialNumber', key: 'serialNumber', fixed: true, width: 180 },
|
||||
{ title: '机构编号', dataIndex: 'orgCode', key: 'orgCode', width: 240 },
|
||||
{ title: '节点编号', dataIndex: 'nodeCode', key: 'nodeCode', width: 240 },
|
||||
{ title: '机构名称', dataIndex: 'orgName', key: 'orgName', width: 240 },
|
||||
{ title: '联系人', dataIndex: 'contactPerson', key: 'contactPerson', width: 240 },
|
||||
{ title: '联系电话', dataIndex: 'contactPhone', key: 'contactPhone', width: 240 },
|
||||
{ title: '机构类型', dataIndex: 'orgType', key: 'orgType', width: 240 },
|
||||
{ title: '机构性质', dataIndex: 'orgNature', key: 'orgNature', width: 240 },
|
||||
{ title: '状态', dataIndex: 'status', key: 'status', width: 240 },
|
||||
{ title: '等级', dataIndex: 'level', key: 'level', width: 240 },
|
||||
{ title: '营业执照注册号', dataIndex: 'businessLicenseNo', key: 'businessLicenseNo', width: 240 },
|
||||
{ title: '所在区域', dataIndex: 'region', key: 'region', width: 240 },
|
||||
{ title: '详细地址', dataIndex: 'addressDetail', key: 'addressDetail', width: 240 },
|
||||
{ title: '操作', dataIndex: 'actions', key: 'actions', width: 320 },
|
||||
])
|
||||
|
||||
const { listData, loading, showLoading, hideLoading, searchFormData, paginationState, resetPagination } =
|
||||
usePagination()
|
||||
const { resetForm } = useForm()
|
||||
const editDialogRef = ref()
|
||||
|
||||
getMenuList()
|
||||
|
||||
@ -191,7 +179,6 @@ getMenuList()
|
||||
async function getMenuList() {
|
||||
try {
|
||||
showLoading()
|
||||
// const { current } = paginationState
|
||||
const platform = storage.local.getItem('platform')
|
||||
const { data, success, total } = await apis.menu
|
||||
.getMenuList({
|
||||
@ -213,14 +200,15 @@ async function getMenuList() {
|
||||
hideLoading()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
// resetForm()
|
||||
resetPagination()
|
||||
getMenuList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
@ -229,6 +217,7 @@ function handleResetSearch() {
|
||||
resetPagination()
|
||||
getMenuList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
@ -266,7 +255,115 @@ async function onOk() {
|
||||
await getMenuList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理下载模板
|
||||
*/
|
||||
function handleDownloadTemplate() {
|
||||
// 调用API下载模板
|
||||
apis.downloadTemplate().then(() => {
|
||||
message.success('模板下载成功')
|
||||
}).catch(() => {
|
||||
message.error('模板下载失败')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理文件上传
|
||||
* @param file 选中的文件
|
||||
*/
|
||||
async function handleFileUpload(file) {
|
||||
try {
|
||||
showLoading()
|
||||
// 创建FormData对象
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
|
||||
// 调用上传API
|
||||
const { success } = await apis.uploadServiceSite(formData)
|
||||
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
message.success('文件上传成功')
|
||||
showImportModal.value = false
|
||||
// 重新获取列表数据
|
||||
await getMenuList()
|
||||
} else {
|
||||
message.error('文件上传失败')
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
message.error('文件上传失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 处理选择框变化
|
||||
function handleChange() {
|
||||
// 可以添加选择框变化后的逻辑
|
||||
}
|
||||
|
||||
// 新增操作方法
|
||||
function handleEdit(record) {
|
||||
editDialogRef.value.open({ record, mode: 'edit' })
|
||||
}
|
||||
|
||||
function handleDetail(record) {
|
||||
// 查看详情逻辑
|
||||
editDialogRef.value.open({ record, mode: 'view' })
|
||||
}
|
||||
|
||||
function handleToggleStatus(record) {
|
||||
// 根据当前状态决定操作文本
|
||||
const isActivate = record.status !== 'active';
|
||||
const actionText = isActivate ? '启用' : '停用';
|
||||
const confirmText = isActivate ? '确定要启用该组织吗?' : '确定要停用该组织吗?';
|
||||
|
||||
Modal.confirm({
|
||||
title: `${actionText}组织`,
|
||||
content: confirmText,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
okType: isActivate ? 'primary' : 'danger',
|
||||
onOk: async () => {
|
||||
try {
|
||||
// 模拟API调用
|
||||
console.log(`${actionText}操作执行`, record);
|
||||
|
||||
// 这里应该调用实际的API
|
||||
// const { success } = await apis.org.toggleStatus({ id: record.id, status: isActivate ? 'active' : 'inactive' });
|
||||
|
||||
// 模拟成功响应
|
||||
const success = true;
|
||||
|
||||
if (success) {
|
||||
message.success(`${actionText}成功`);
|
||||
// 更新本地数据状态
|
||||
record.status = isActivate ? 'active' : 'inactive';
|
||||
// 刷新列表
|
||||
await getMenuList();
|
||||
} else {
|
||||
message.error(`${actionText}失败`);
|
||||
}
|
||||
} catch (error) {
|
||||
message.error(`${actionText}过程中发生错误: ${error.message}`);
|
||||
}
|
||||
},
|
||||
onCancel() {
|
||||
console.log('取消操作');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// 设备管理按钮点击事件
|
||||
function handleDeviceManagement(record) {
|
||||
// 检查设备管理弹框引用是否存在
|
||||
if (deviceManagementModalRef.value) {
|
||||
// 调用弹框的open方法,并传递当前组织记录
|
||||
deviceManagementModalRef.value.open({ orgRecord: record });
|
||||
} else {
|
||||
console.error('设备管理弹框组件未正确初始化');
|
||||
message.error('设备管理功能加载失败,请刷新页面重试');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@ -282,11 +379,16 @@ async function onOk() {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
// 按钮间距已经通过a-space的size属性设置,这里可以作为备选方案
|
||||
// :deep(.ant-btn) {
|
||||
// margin-right: 8px;
|
||||
// &:last-child {
|
||||
// margin-right: 0;
|
||||
// }
|
||||
// }
|
||||
// 操作按钮样式
|
||||
.action-buttons {
|
||||
.ant-btn-link {
|
||||
padding: 0 4px;
|
||||
height: auto;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
.ant-divider {
|
||||
margin: 0 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -1,152 +1,482 @@
|
||||
<template>
|
||||
<a-modal :width="640" :open="modal.open" :title="modal.title" :confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||
<a-modal
|
||||
:width="800"
|
||||
:open="modal.open"
|
||||
:title="modal.title"
|
||||
:confirm-loading="modal.confirmLoading"
|
||||
:after-close="onAfterClose"
|
||||
:cancel-text="cancelText"
|
||||
:ok-text="okText"
|
||||
@ok="handleOk"
|
||||
@cancel="handleCancel"
|
||||
>
|
||||
<a-form layout="vertical" ref="formRef" :model="formData" :rules="formRules">
|
||||
<a-card class="mb-8-2">
|
||||
<a-row :gutter="12">
|
||||
<a-card class="mb-4">
|
||||
<a-row :gutter="16">
|
||||
<!-- 基本信息区域 -->
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="$t('pages.system.menu.form.parent_name')" name="parent_id">
|
||||
<a-tree-select v-model:value="formData.parent_id" tree-default-expand-all></a-tree-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="$t('pages.system.menu.form.type')" name="type">
|
||||
<a-radio-group v-model:value="formData.type"
|
||||
:options="menuTypeEnum.getOptions()"></a-radio-group>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="$t('pages.system.menu.form.name')" name="name">
|
||||
<a-form-item :label="'站点名称'" name="name" :required="true">
|
||||
<a-input v-model:value="formData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="$t('pages.system.menu.resource.form.path')" name="path">
|
||||
<a-input v-model:value="formData.path"></a-input>
|
||||
<a-form-item :label="'所在节点'" name="nodeType" :required="true">
|
||||
<a-select v-model:value="formData.nodeType" @change="handleChange">
|
||||
<a-select-option value="jack">已结单</a-select-option>
|
||||
<a-select-option value="lucy">已作废</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item name="code">
|
||||
<template #label>
|
||||
<span class="mr-4-1">{{ $t('pages.system.menu.form.code') }}</span>
|
||||
<a-tooltip :title="$t('pages.system.menu.form.code')">
|
||||
<question-circle-outlined class="color-secondary"></question-circle-outlined>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<a-form-item :label="'机构代码'" name="code" :required="true">
|
||||
<a-input v-model:value="formData.code"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="$t('pages.system.menu.form.status')" name="status">
|
||||
<a-radio-group v-model:value="formData.status"
|
||||
:options="statusTypeEnum.getOptions()"></a-radio-group>
|
||||
<a-form-item :label="'站点类型'" name="type" :required="true">
|
||||
<a-select v-model:value="formData.type" @change="handleChange">
|
||||
<a-select-option value="type1">社区服务中心</a-select-option>
|
||||
<a-select-option value="type2">养老服务站</a-select-option>
|
||||
<a-select-option value="type3">综合服务中心</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item style="width: 200px" :label="$t('pages.system.menu.form.sequence')"
|
||||
name="sequence">
|
||||
<a-input :defaultValue="0" type="number" v-model:value="formData.sequence"></a-input>
|
||||
<a-form-item :label="'负责人姓名'" name="manager" :required="true">
|
||||
<a-input v-model:value="formData.manager"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="$t('pages.system.menu.form.description')" name="description">
|
||||
<a-input v-model:value="formData.description"></a-input>
|
||||
<a-form-item :label="'联系电话'" name="phone" :required="true">
|
||||
<a-input v-model:value="formData.phone" placeholder="请输入联系电话"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="$t('pages.system.menu.form.properties')" name="properties">
|
||||
<a-textarea v-model:value="formData.properties"></a-textarea>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'星级等级'" name="starLevel">
|
||||
<a-select v-model:value="formData.starLevel">
|
||||
<a-select-option value="1">一星</a-select-option>
|
||||
<a-select-option value="2">二星</a-select-option>
|
||||
<a-select-option value="3">三星</a-select-option>
|
||||
<a-select-option value="4">四星</a-select-option>
|
||||
<a-select-option value="5">五星</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'人员编制(个)'" name="staffCount">
|
||||
<a-input-number v-model:value="formData.staffCount" min="0" style="width: 100%"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
<a-card :title="$t('pages.system.menu.resource.form.title')">
|
||||
<a-table :columns="columns" :data-source="formData.resources" :pagination="false" row-key="id">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'types'">
|
||||
<a-form-item :label="$t('pages.system.menu.resource.form.method')">
|
||||
<a-input-group style="display: inline-block; vertical-align: middle" :compact="true">
|
||||
<a-form-item-rest>
|
||||
<a-select v-model:value="record.method" :default-value="record.method || 'GET'"
|
||||
style="width: 100px">
|
||||
<a-select-option v-for="item of reqType" :key="item" :value="item">{{ item
|
||||
}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item-rest>
|
||||
<a-input v-model:value="record.path" :style="{ width: 'calc(100% - 100px)' }" />
|
||||
</a-input-group>
|
||||
</a-form-item>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<x-action-button @click="handleDelete(index)"> {{ $t('button.delete') }}</x-action-button>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
<a-button @click="handleAddApi" block class="mt-8-2" type="dashed">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
{{ $t('button.add') }}
|
||||
</a-button>
|
||||
<!-- 地址信息区域 -->
|
||||
<a-card class="mb-4" title="地址信息">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'服务中心地址'" name="address">
|
||||
<a-cascader
|
||||
v-model:value="formData.address"
|
||||
:options="addressOptions"
|
||||
placeholder="请选择省/市/区"
|
||||
style="width: 100%"
|
||||
></a-cascader>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'详细地址'" name="detailAddress">
|
||||
<a-input v-model:value="formData.detailAddress" placeholder="请输入详细地址"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'地图定位地址'" name="location">
|
||||
<a-row :gutter="8">
|
||||
<a-col :span="18">
|
||||
<a-input
|
||||
v-model:value="formData.location"
|
||||
placeholder="请选择地图位置"
|
||||
readonly
|
||||
></a-input>
|
||||
</a-col>
|
||||
<a-col :span="6">
|
||||
<a-button type="primary" block @click="openMapSelector">选择地图位置</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
<template v-if="menuTypeEnum.is('menu', formData.type)"> </template>
|
||||
<template v-if="statusTypeEnum.is('enabled', formData.status)"> </template>
|
||||
|
||||
<!-- 站点信息区域 -->
|
||||
<a-card class="mb-4" title="站点信息">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'建成时间'" name="buildTime">
|
||||
<a-date-picker
|
||||
v-model:value="formData.buildTime"
|
||||
format="YYYY-MM-DD"
|
||||
placeholder="请选择建成时间"
|
||||
></a-date-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'建筑面积(平方米)'" name="area">
|
||||
<a-input-number
|
||||
v-model:value="formData.area"
|
||||
min="0"
|
||||
style="width: 100%"
|
||||
placeholder="请输入建筑面积"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item :label="'服务介绍'" name="description">
|
||||
<a-textarea
|
||||
v-model:value="formData.description"
|
||||
rows="4"
|
||||
placeholder="请输入服务介绍"
|
||||
></a-textarea>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<!-- 服务信息区域 -->
|
||||
<a-card class="mb-4" title="服务信息">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'开始营业时间'" name="openTime">
|
||||
<a-time-picker
|
||||
v-model:value="formData.openTime"
|
||||
format="HH:mm"
|
||||
placeholder="请选择开始营业时间"
|
||||
></a-time-picker>
|
||||
<a-time-picker
|
||||
v-model:value="formData.closeTime"
|
||||
format="HH:mm"
|
||||
placeholder="请选择结束营业时间"
|
||||
></a-time-picker>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'营业状态'" name="businessStatus">
|
||||
<a-select v-model:value="formData.businessStatus">
|
||||
<a-select-option value="open">营业中</a-select-option>
|
||||
<a-select-option value="closed">已关闭</a-select-option>
|
||||
<a-select-option value="suspended">暂停营业</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24">
|
||||
<a-form-item name="services">
|
||||
<template #label>
|
||||
<span>
|
||||
提供服务
|
||||
<a-tooltip>
|
||||
<template #title>
|
||||
勾选以下服务类型在小程序可见
|
||||
</template>
|
||||
<question-circle-outlined class="info-icon" />
|
||||
</a-tooltip>
|
||||
</span>
|
||||
</template>
|
||||
<div class="service-tags">
|
||||
<a-tag
|
||||
v-for="service in allServices"
|
||||
:key="service.value"
|
||||
:checked="formData.services?.includes(service.value)"
|
||||
@click="handleServiceClick(service.value)"
|
||||
:class="{'ant-tag-checkable-checked': formData.services?.includes(service.value)}"
|
||||
class="service-tag"
|
||||
>
|
||||
{{ service.label }}
|
||||
</a-tag>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'是否有厨房'" name="hasKitchen">
|
||||
<a-select v-model:value="formData.hasKitchen">
|
||||
<a-select-option value="yes">是</a-select-option>
|
||||
<a-select-option value="no">否</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'提供餐饮'" name="provideMeal">
|
||||
<a-select v-model:value="formData.provideMeal">
|
||||
<a-select-option value="yes">是</a-select-option>
|
||||
<a-select-option value="no">否</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'支持送餐'" name="supportDelivery">
|
||||
<a-select v-model:value="formData.supportDelivery">
|
||||
<a-select-option value="yes">是</a-select-option>
|
||||
<a-select-option value="no">否</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'助餐点名称'" name="mealPointName">
|
||||
<a-input v-model:value="formData.mealPointName" placeholder="请输入助餐点名称"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'床位数'" name="bedCount" :required="true">
|
||||
<a-input-number v-model:value="formData.bedCount" placeholder="请输入床位数" min="0" style="width: 100%"></a-input-number>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'日间照料中心名称'" name="daycareCenterName">
|
||||
<a-input v-model:value="formData.daycareCenterName" placeholder="请输入日间照料中心名称"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
<!-- 图片上传区域 -->
|
||||
<a-card class="mb-4" title="图片上传">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'资质附件'" name="qualificationFiles">
|
||||
<a-upload
|
||||
list-type="picture-card"
|
||||
v-model:file-list="formData.qualificationFiles"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div v-if="formData.qualificationFiles.length < 5">
|
||||
<plus-outlined />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
</div>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item :label="'站点图片'" name="siteImages">
|
||||
<a-upload
|
||||
list-type="picture-card"
|
||||
v-model:file-list="formData.siteImages"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div v-if="formData.siteImages.length < 5">
|
||||
<plus-outlined />
|
||||
<div class="ant-upload-text">上传</div>
|
||||
</div>
|
||||
</a-upload>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-card>
|
||||
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { QuestionCircleOutlined, PlusOutlined } from '@ant-design/icons-vue'
|
||||
import apis from '@/apis'
|
||||
import { useModal, useForm } from '@/hooks'
|
||||
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
|
||||
import { ref } from 'vue'
|
||||
import { ref, reactive } from 'vue'
|
||||
import { config } from '@/config'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import storage from '@/utils/storage'
|
||||
import { message } from 'ant-design-vue'
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
const { formData, formRef, formRules, resetForm } = useForm()
|
||||
|
||||
formRules.value = {
|
||||
name: { required: true, message: t('pages.system.menu.form.name.placeholder') },
|
||||
code: { required: true, message: t('pages.system.menu.form.code.placeholder') },
|
||||
// 初始化表单数据
|
||||
formData.value = {
|
||||
name: '', // 站点名称
|
||||
parent_id: '',
|
||||
nodeType: '',
|
||||
code: '',
|
||||
type: '',
|
||||
manager: '',
|
||||
phone: '',
|
||||
starLevel: '',
|
||||
staffCount: 0,
|
||||
address: [], // 省市区三级联动
|
||||
detailAddress: '',
|
||||
location: '', // 地图定位地址
|
||||
buildTime: null, // 建成时间
|
||||
area: 0, // 建筑面积
|
||||
description: '', // 服务介绍
|
||||
openTime: null, // 开始营业时间
|
||||
closeTime: null, // 结束营业时间
|
||||
businessStatus: '', // 营业状态
|
||||
services: [], // 提供的服务
|
||||
hasKitchen: '', // 是否有厨房
|
||||
provideMeal: '', // 提供餐饮
|
||||
supportDelivery: '', // 支持送餐
|
||||
mealPointName: '', // 助餐点名称
|
||||
bedCount: 0, // 床位数
|
||||
daycareCenterName: '', // 日间照料中心名称
|
||||
qualificationFiles: [], // 资质附件
|
||||
siteImages: [], // 站点图片
|
||||
resources: []
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
formRules.value = {
|
||||
name: [
|
||||
{ required: true, message: '请输入站点名称' }
|
||||
],
|
||||
nodeType: [
|
||||
{ required: true, message: '请选择所在节点' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: '请输入机构代码' }
|
||||
],
|
||||
type: [
|
||||
{ required: true, message: '请选择站点类型' }
|
||||
],
|
||||
manager: [
|
||||
{ required: true, message: '请输入负责人姓名' }
|
||||
],
|
||||
phone: [
|
||||
{ required: true, message: '请输入联系电话' },
|
||||
{
|
||||
pattern: /^1[3-9]\d{9}$/,
|
||||
message: '请输入正确的联系电话'
|
||||
}
|
||||
],
|
||||
bedCount: [
|
||||
{ required: true, message: '请输入床位数' },
|
||||
{
|
||||
validator: (_, value) => {
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
if (typeof value === 'number' && value >= 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(new Error('床位数必须为非负数'));
|
||||
}
|
||||
return Promise.reject(new Error('请输入床位数'));
|
||||
}
|
||||
}
|
||||
],
|
||||
address: { required: true, message: '请选择省市区' },
|
||||
detailAddress: { required: true, message: '请输入详细地址' },
|
||||
buildTime: { required: true, message: '请选择建成时间' },
|
||||
area: {
|
||||
required: true,
|
||||
validator: (_, value) => {
|
||||
if (value && value > 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(new Error('请输入有效的建筑面积'));
|
||||
}
|
||||
},
|
||||
openTime: { required: true, message: '请选择开始营业时间' },
|
||||
closeTime: { required: true, message: '请选择结束营业时间' },
|
||||
businessStatus: { required: true, message: '请选择营业状态' },
|
||||
services: {
|
||||
required: true,
|
||||
validator: (_, value) => {
|
||||
if (value && value.length > 0) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return Promise.reject(new Error('请至少选择一项服务'));
|
||||
}
|
||||
},
|
||||
hasKitchen: { required: true, message: '请选择是否有厨房' },
|
||||
provideMeal: { required: true, message: '请选择是否提供餐饮' }
|
||||
}
|
||||
|
||||
// 表格列定义
|
||||
const columns = [
|
||||
{ title: t('pages.system.menu.form.path'), dataIndex: 'types', key: 'types' },
|
||||
{ title: t('button.action'), dataIndex: 'action', key: 'action' },
|
||||
{ title: t('button.action'), dataIndex: 'action', key: 'action' }
|
||||
]
|
||||
|
||||
// 请求类型
|
||||
const reqType = ['GET', 'POST', 'PUT', 'PATCH', 'HEAD', 'DELETE']
|
||||
|
||||
// 取消和确认按钮文本
|
||||
const cancelText = ref(t('button.cancel'))
|
||||
const okText = ref(t('button.confirm'))
|
||||
const platform=ref('')
|
||||
const platform = ref('')
|
||||
|
||||
// 地址选项 - 实际项目中可以从接口获取
|
||||
const addressOptions = ref([
|
||||
{
|
||||
value: 'beijing',
|
||||
label: '北京',
|
||||
children: [
|
||||
{
|
||||
value: 'haidian',
|
||||
label: '海淀区',
|
||||
children: [
|
||||
{ value: 'zhongguancun', label: '中关村' },
|
||||
{ value: 'wudaokou', label: '五道口' }
|
||||
]
|
||||
},
|
||||
{
|
||||
value: 'chaoyang',
|
||||
label: '朝阳区',
|
||||
children: [
|
||||
{ value: 'cbd', label: 'CBD' },
|
||||
{ value: 'sanlitun', label: '三里屯' }
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
value: 'shanghai',
|
||||
label: '上海',
|
||||
children: [
|
||||
{
|
||||
value: 'pudong',
|
||||
label: '浦东新区',
|
||||
children: [
|
||||
{ value: 'lujiazui', label: '陆家嘴' },
|
||||
{ value: 'zhangjiang', label: '张江' }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
// 所有可提供的服务
|
||||
const allServices = [
|
||||
{ value: 'meal', label: '助餐' },
|
||||
{ value: 'daycare', label: '日间照料' },
|
||||
{ value: 'equipment', label: '辅具租赁' },
|
||||
{ value: 'entertainment', label: '休闲/娱乐' },
|
||||
{ value: 'health', label: '健康管理' }
|
||||
]
|
||||
|
||||
/**
|
||||
* 新建
|
||||
*/
|
||||
function handleCreate() {
|
||||
formData.value.resources = []
|
||||
formData.value.qualificationFiles = []
|
||||
formData.value.siteImages = []
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: t('pages.system.menu.add'),
|
||||
title: '新增服务站点',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加下级
|
||||
* handleCreateChild
|
||||
*/
|
||||
|
||||
function handleCreateChild(record = {}) {
|
||||
formData.value.resources = []
|
||||
formData.value.qualificationFiles = []
|
||||
formData.value.siteImages = []
|
||||
showModal({
|
||||
type: 'create',
|
||||
title: t('pages.system.menu.button.addChild'),
|
||||
title: '新增服务站点',
|
||||
})
|
||||
formData.value.parent_id = record.id
|
||||
}
|
||||
@ -164,12 +494,14 @@ async function handleEdit(record = {}) {
|
||||
})
|
||||
formData.value = cloneDeep(data)
|
||||
formData.value.properties = formData.value.properties ? JSON.parse(formData.value.properties) : ''
|
||||
formData.value.resources = formData.value.resources || (formData.value.resources = [])
|
||||
platform.value=data.platform
|
||||
formData.value.resources = formData.value.resources || []
|
||||
formData.value.qualificationFiles = formData.value.qualificationFiles || []
|
||||
formData.value.siteImages = formData.value.siteImages || []
|
||||
platform.value = data.platform
|
||||
}
|
||||
|
||||
/**
|
||||
* 确定
|
||||
* 确定提交
|
||||
*/
|
||||
function handleOk() {
|
||||
formRef.value
|
||||
@ -182,19 +514,24 @@ function handleOk() {
|
||||
}
|
||||
params.sequence = Number.parseInt(params.sequence) || 0
|
||||
params.properties = JSON.stringify(params.properties)
|
||||
|
||||
// 处理地址数据
|
||||
params.province = params.address[0]
|
||||
params.city = params.address[1]
|
||||
params.district = params.address[2]
|
||||
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
case 'create':
|
||||
params.platform=storage.local.getItem('platform')
|
||||
params.platform = storage.local.getItem('platform')
|
||||
result = await apis.menu.createMenu(params).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
|
||||
break
|
||||
case 'edit':
|
||||
newApiData()
|
||||
params.resources = formData.value.resources
|
||||
params.platform=platform.value
|
||||
params.platform = platform.value
|
||||
result = await apis.menu.updateMenu(formData.value.id, params).catch(() => {
|
||||
throw new Error()
|
||||
})
|
||||
@ -222,7 +559,7 @@ function handleCancel() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 针对API 做一次 menu_id
|
||||
* 处理API数据
|
||||
*/
|
||||
function newApiData() {
|
||||
if (formData.value.resources)
|
||||
@ -232,7 +569,7 @@ function newApiData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭后
|
||||
* 关闭后重置
|
||||
*/
|
||||
function onAfterClose() {
|
||||
resetForm()
|
||||
@ -242,20 +579,64 @@ function onAfterClose() {
|
||||
/**
|
||||
* 添加API
|
||||
*/
|
||||
|
||||
function handleAddApi() {
|
||||
formData.value.resources.push({
|
||||
method: 'GET',
|
||||
path: '',
|
||||
})
|
||||
} /**
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除API
|
||||
*/
|
||||
|
||||
function handleDelete(index) {
|
||||
formData.value.resources.splice(index, 1)
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理服务点击事件
|
||||
*/
|
||||
function handleServiceClick(value) {
|
||||
if (!formData.value.services) {
|
||||
formData.value.services = []
|
||||
}
|
||||
|
||||
const index = formData.value.services.indexOf(value)
|
||||
if (index > -1) {
|
||||
// 如果已选中,则取消选中
|
||||
formData.value.services.splice(index, 1)
|
||||
} else {
|
||||
// 如果未选中,则添加选中
|
||||
formData.value.services.push(value)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开地图选择器
|
||||
*/
|
||||
function openMapSelector() {
|
||||
// 实际项目中可以调用地图组件或打开地图选择弹窗
|
||||
// 这里使用模拟数据
|
||||
formData.value.location = '北京市海淀区中关村大街1号 (经纬度: 39.9847, 116.3055)'
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传前处理
|
||||
*/
|
||||
function beforeUpload(file) {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
||||
if (!isJpgOrPng) {
|
||||
message.error('只能上传JPG/PNG格式的图片!')
|
||||
return false
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 2
|
||||
if (!isLt2M) {
|
||||
message.error('图片大小不能超过2MB!')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
handleCreate,
|
||||
handleCreateChild,
|
||||
@ -263,4 +644,44 @@ defineExpose({
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
<style lang="less" scoped>
|
||||
.service-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
// 服务标签选中样式
|
||||
.service-tag {
|
||||
cursor: pointer;
|
||||
|
||||
&.ant-tag-checkable-checked {
|
||||
background-color: #1890ff; // 蓝色背景
|
||||
color: #fff; // 白色文字
|
||||
border-color: #1890ff;
|
||||
|
||||
&:hover {
|
||||
background-color: #40a9ff;
|
||||
border-color: #40a9ff;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(.ant-tag-checkable-checked) {
|
||||
&:hover {
|
||||
border-color: #1890ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 信息图标样式
|
||||
.info-icon {
|
||||
margin-left: 4px;
|
||||
color: #1890ff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ant-upload-list {
|
||||
margin-top: 8px;
|
||||
}
|
||||
</style>
|
||||
@ -4,28 +4,14 @@
|
||||
<a-form :label-col="{ style: { width: '100px' } }" :model="searchFormData" layout="inline">
|
||||
<a-row :gutter="gutter">
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'姓名'" name="name">
|
||||
<a-input :placeholder="'请选择姓名'" v-model:value="searchFormData.name"></a-input>
|
||||
<a-form-item :label="'站点名称'" name="name">
|
||||
<a-input :placeholder="'请输入站点名称'" v-model:value="searchFormData.name"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item name="code">
|
||||
<template #label>
|
||||
{{ '身份证号' }}
|
||||
<a-tooltip :title="'身份证号'">
|
||||
<question-circle-outlined class="ml-4-1 color-placeholder" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
<a-input :placeholder="'请输入身份证号'" v-model:value="searchFormData.code"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'工单状态'" name="name">
|
||||
<!-- <a-input :placeholder="'请选择工作状态'" v-model:value="searchFormData.name"></a-input> -->
|
||||
<a-select ref="select" v-model:value="searchFormData.name" @focus="focus"
|
||||
@change="handleChange">
|
||||
<a-form-item :label="'站点类型'" name="type">
|
||||
<a-select v-model:value="searchFormData.type" @change="handleChange">
|
||||
<a-select-option value="jack">已结单</a-select-option>
|
||||
<a-select-option value="lucy">已作废</a-select-option>
|
||||
</a-select>
|
||||
@ -33,19 +19,21 @@
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'所在区域'" name="name">
|
||||
<a-input :placeholder="'请选择区域'" v-model:value="searchFormData.name"></a-input>
|
||||
<a-form-item :label="'所在区域'" name="area">
|
||||
<a-input :placeholder="'请选择区域'" v-model:value="searchFormData.area"></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col v-bind="colSpan">
|
||||
<a-form-item :label="'服务时间'" name="name">
|
||||
<a-range-picker v-model:value="searchFormData.date" />
|
||||
<a-form-item :label="'所在节点'" name="node">
|
||||
<a-select v-model:value="searchFormData.node" @change="handleChange">
|
||||
<a-select-option value="jack">已结单</a-select-option>
|
||||
<a-select-option value="lucy">已作废</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="gutter" style="margin-top: 16px;">
|
||||
<a-col :span="24" style="text-align: right;">
|
||||
|
||||
<a-col v-bind="colSpan" style="text-align: right;">
|
||||
<a-space>
|
||||
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||
<a-button ghost type="primary" @click="handleSearch">
|
||||
@ -54,18 +42,50 @@
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
</a-form>
|
||||
</template>
|
||||
</x-search-bar>
|
||||
|
||||
<a-card>
|
||||
<!-- 添加标题和横线 -->
|
||||
<div class="title-container">
|
||||
<h3>服务站点列表</h3>
|
||||
<div class="title-line"></div>
|
||||
</div>
|
||||
|
||||
<x-action-bar class="mb-8-2">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<plus-outlined></plus-outlined>
|
||||
</template>
|
||||
{{ $t('pages.system.menu.add') }}
|
||||
</a-button>
|
||||
<!-- 增加按钮之间的间距 -->
|
||||
<a-space :size="12">
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
新建
|
||||
</a-button>
|
||||
|
||||
<!-- 修改导入按钮的点击事件 -->
|
||||
<a-button v-action="'add'" type="primary" @click="showImportModal = true">
|
||||
导入
|
||||
</a-button>
|
||||
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<UnorderedListOutlined />
|
||||
</template>
|
||||
导入记录
|
||||
</a-button>
|
||||
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
导出
|
||||
</a-button>
|
||||
|
||||
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||
<template #icon>
|
||||
<UnorderedListOutlined />
|
||||
</template>
|
||||
导出记录
|
||||
</a-button>
|
||||
</a-space>
|
||||
</x-action-bar>
|
||||
|
||||
<a-table rowKey="id" :loading="loading" :pagination="true" :columns="columns" :data-source="listData">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="'menuType' === column.key">
|
||||
@ -120,25 +140,38 @@
|
||||
</a-card>
|
||||
|
||||
<edit-dialog @ok="onOk" ref="editDialogRef" />
|
||||
|
||||
<!-- 导入弹框组件 -->
|
||||
<import-modal
|
||||
v-model:visible="showImportModal"
|
||||
@download="handleDownloadTemplate"
|
||||
@upload="handleFileUpload"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { Modal, message } from 'ant-design-vue'
|
||||
import { ref } from 'vue'
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'
|
||||
import { UnorderedListOutlined, EditOutlined, PlusCircleOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import apis from '@/apis'
|
||||
import { config } from '@/config'
|
||||
import { menuTypeEnum, statusTypeEnum } from '@/enums/system'
|
||||
import { usePagination, useForm } from '@/hooks'
|
||||
import { formatUtcDateTime } from '@/utils/util'
|
||||
import EditDialog from './components/EditDialog.vue'
|
||||
// 引入导入组件
|
||||
import ImportModal from '@/components/Import/index.vue' // 假设你的导入组件路径是这个
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import storage from '@/utils/storage'
|
||||
|
||||
defineOptions({
|
||||
// eslint-disable-next-line vue/no-reserved-component-names
|
||||
name: 'menu',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
|
||||
// 控制导入弹框显示/隐藏的变量
|
||||
const showImportModal = ref(false)
|
||||
|
||||
const columns = ref([
|
||||
{ title: '工单号', dataIndex: 'name', key: 'name', fixed: true, width: 280 },
|
||||
{ title: '服务对象', dataIndex: 'code', key: 'code', width: 240 },
|
||||
@ -169,7 +202,6 @@ getMenuList()
|
||||
async function getMenuList() {
|
||||
try {
|
||||
showLoading()
|
||||
// const { current } = paginationState
|
||||
const platform = storage.local.getItem('platform')
|
||||
const { data, success, total } = await apis.menu
|
||||
.getMenuList({
|
||||
@ -195,7 +227,6 @@ async function getMenuList() {
|
||||
* 搜索
|
||||
*/
|
||||
function handleSearch() {
|
||||
// resetForm()
|
||||
resetPagination()
|
||||
getMenuList()
|
||||
}
|
||||
@ -236,12 +267,74 @@ function handleDelete({ id }) {
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑完成
|
||||
*/
|
||||
async function onOk() {
|
||||
await getMenuList()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 处理下载模板
|
||||
*/
|
||||
function handleDownloadTemplate() {
|
||||
// 调用API下载模板
|
||||
apis.downloadTemplate().then(() => {
|
||||
message.success('模板下载成功')
|
||||
}).catch(() => {
|
||||
message.error('模板下载失败')
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理文件上传
|
||||
* @param file 选中的文件
|
||||
*/
|
||||
async function handleFileUpload(file) {
|
||||
try {
|
||||
showLoading()
|
||||
// 创建FormData对象
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
|
||||
// 调用上传API
|
||||
const { success } = await apis.uploadServiceSite(formData)
|
||||
|
||||
hideLoading()
|
||||
if (config('http.code.success') === success) {
|
||||
message.success('文件上传成功')
|
||||
showImportModal.value = false
|
||||
// 重新获取列表数据
|
||||
await getMenuList()
|
||||
} else {
|
||||
message.error('文件上传失败')
|
||||
}
|
||||
} catch (error) {
|
||||
hideLoading()
|
||||
message.error('文件上传失败,请重试')
|
||||
}
|
||||
}
|
||||
|
||||
// 处理选择框变化
|
||||
function handleChange() {
|
||||
// 可以添加选择框变化后的逻辑
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
<style lang="less" scoped>
|
||||
// 标题和横线样式
|
||||
.title-container {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.title-line {
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
background-color: #e8e8e8; // 灰色横线
|
||||
margin-top: 8px;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user