2024-12-11 17:43:35 +08:00
|
|
|
|
<!-- 景点列表 -->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="p-2">
|
|
|
|
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
|
|
|
|
<div v-show="showSearch" class="mb-[10px]" id="search_div">
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="70px">
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-form-item :label="`${queryParams.type == '0' ? '景点' : '商家'}名称`" prop="name">
|
|
|
|
|
<el-input class="inputWidth" v-model="queryParams.name" placeholder="请输入景点名称" clearable @keyup.enter="handleQuery" />
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-form-item label="推荐语" prop="recommend">
|
|
|
|
|
<el-input class="inputWidth" v-model="queryParams.recommend" placeholder="请输入推荐语" clearable @keyup.enter="handleQuery" />
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-form-item label="发布状态" prop="status">
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-select v-model="queryParams.status" placeholder="请选择发布状态" clearable class="inputWidth">
|
|
|
|
|
<el-option label="已发布" value="1"></el-option>
|
|
|
|
|
<el-option label="未发布" value="0"></el-option>
|
|
|
|
|
</el-select>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-form-item label="景点等级" prop="level" v-if="queryParams.type == '0'">
|
|
|
|
|
<el-select v-model="queryParams.level" placeholder="请选择等级" clearable class="inputWidth">
|
|
|
|
|
<el-option v-for="item in levelList" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
|
|
</el-select>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="是否开放" prop="isOpen">
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-select v-model="queryParams.isOpen" placeholder="请选择开放状态" clearable class="inputWidth">
|
|
|
|
|
<el-option label="已开放" value="1"></el-option>
|
|
|
|
|
<el-option label="未开放" value="0"></el-option>
|
|
|
|
|
</el-select>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-form-item :label="`${queryParams.type == '0' ? '景点' : '商家'}属性`" prop="attribute">
|
|
|
|
|
<el-select v-model="queryParams.attribute" placeholder="请选择属性" clearable class="inputWidth">
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-option :label="queryParams.type == '0' ? '标志性景点' : '标志性商家'" value="1"></el-option>
|
|
|
|
|
<el-option :label="queryParams.type == '0' ? '非标志性景点' : '非标志性商家'" value="0"></el-option>
|
2024-12-16 15:38:26 +08:00
|
|
|
|
</el-select>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-form-item label="标签" prop="tagId">
|
|
|
|
|
<!-- <el-input class="inputWidth" v-model="queryParams.tagId" placeholder="请输入景点标签" clearable @keyup.enter="handleQuery" /> -->
|
|
|
|
|
<el-select class="inputWidth" v-model="queryParams.tagId" placeholder="请选择标签" clearable>
|
|
|
|
|
<el-option v-for="dict in sys_user_tagOptions" :key="dict.id" :label="dict.title" :value="dict.id" />
|
|
|
|
|
</el-select>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
|
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
|
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:article:add']">新增</el-button>
|
|
|
|
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:article:edit']"
|
|
|
|
|
>修改</el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:article:remove']"
|
|
|
|
|
>删除</el-button
|
|
|
|
|
>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</transition>
|
|
|
|
|
|
2024-12-12 18:08:47 +08:00
|
|
|
|
<el-table :height="autoTableHeight" v-loading="loading" :data="articleList" @selection-change="handleSelectionChange" border>
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-table-column label="ID" align="center" prop="id" fixed v-if="false" width="50px" />
|
|
|
|
|
<el-table-column label="景点名称" align="center" prop="name" fixed v-if="queryParams.type == '0'" width="180px" />
|
|
|
|
|
<el-table-column label="商家名称" align="center" prop="name" fixed v-if="queryParams.type != '0'" width="180px" />
|
|
|
|
|
<el-table-column label="排序" align="center" prop="orderNum" v-if="queryParams.type != '2'" width="60px" />
|
|
|
|
|
<el-table-column label="等级" align="center" prop="level" v-if="queryParams.type == '0'">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ formatLevel(scope.row.level) }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="queryParams.type == '0' ? '景点icon' : '商家icon'" align="center" prop="icon" />
|
|
|
|
|
<el-table-column label="是否营业" align="center" prop="isOpen">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ scope.row.isOpen == 0 ? '否' : '是' }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column :label="queryParams.type == '0' ? '景点属性' : '商家属性'" align="center" prop="attribute" width="120px">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{
|
|
|
|
|
scope.row.attribute == '1'
|
|
|
|
|
? `${queryParams.type == '0' ? '标志性景点' : '标志性商家'}`
|
|
|
|
|
: `${queryParams.type == '0' ? '非标志性景点' : '非标志性商家'}`
|
|
|
|
|
}}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="地理坐标" align="center" prop="" width="200px">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
{{ scope.row.longitude + ',' + scope.row.latitude }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="地址信息" align="center" prop="address" width="180px" />
|
|
|
|
|
<el-table-column label="联系电话" align="center" prop="number" width="120px" />
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-table-column label="标签" align="center" prop="tagId">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ formatTag(scope.row.tagId) }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-table-column label="推荐语" align="center" prop="recommend" width="180px" />
|
|
|
|
|
<el-table-column :label="queryParams.type == '0' ? '景点详情' : '详情'" align="center" prop="remark">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" @click="handleDetail(scope.row)">查看</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="喜欢数量" align="center" prop="likeNumber" />
|
|
|
|
|
<el-table-column label="收藏数量" align="center" prop="collectNumber" />
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-table-column label="相关笔记" align="center" prop="noteNumber">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button link type="primary" @click="handleNote(scope.row)">{{ scope.row.noteNumber }}</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-table-column label="笔记评论数" align="center" prop="commentNumber" width="90px" />
|
|
|
|
|
<el-table-column label="笔记点赞数" align="center" prop="likeNoteNumber" width="90px" />
|
|
|
|
|
<!-- 0-未发布 1-审核中 2-发布 -->
|
|
|
|
|
<el-table-column label="发布状态" align="center" prop="status">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<span>{{ scope.row.status == 0 ? '未发布' : scope.row.status == 1 ? '审核中' : '已发布' }}</span>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<!-- <el-table-column label="介绍" align="center" prop="intro" /> -->
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="170px">
|
2024-12-12 18:08:47 +08:00
|
|
|
|
<template #default="scope">
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-button link type="primary" v-if="scope.row.status == 0" @click="updateRow(scope.row, '2')" v-hasPermi="['system:article:edit']"
|
|
|
|
|
>发布</el-button
|
|
|
|
|
>
|
|
|
|
|
<el-button link type="primary" v-if="scope.row.status == 2" @click="updateRow(scope.row, '0')" v-hasPermi="['system:article:edit']"
|
|
|
|
|
>撤销发布</el-button
|
|
|
|
|
>
|
2024-12-12 18:08:47 +08:00
|
|
|
|
<el-tooltip content="修改" placement="top">
|
|
|
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:article:edit']"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
<el-tooltip content="删除" placement="top">
|
|
|
|
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:article:remove']"></el-button>
|
|
|
|
|
</el-tooltip>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
|
2024-12-12 18:08:47 +08:00
|
|
|
|
<pagination
|
|
|
|
|
v-show="total > 0"
|
|
|
|
|
id="table_page"
|
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNum"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
<!-- 添加或修改景点、租赁管理对话框 -->
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="900px" append-to-body>
|
2024-12-11 17:43:35 +08:00
|
|
|
|
<el-form ref="articleFormRef" :model="form" :rules="rules" label-width="80px">
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item :label="queryParams.type == '0' ? '景点名称' : '商家名称'" prop="name">
|
|
|
|
|
<el-input placeholder="请输入名称" v-model="form.name" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12" v-if="queryParams.type == '0'">
|
|
|
|
|
<el-form-item label="景区等级" prop="level">
|
|
|
|
|
<el-input-number v-model="form.level" :min="1" :max="5" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="推荐语" prop="recommend">
|
|
|
|
|
<el-input v-model="form.recommend" placeholder="请输入推荐语" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="排序" prop="orderNum">
|
|
|
|
|
<el-input-number v-model="form.orderNum" :min="1" :max="1000" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="是否开放" prop="isOpen">
|
|
|
|
|
<el-radio-group v-model="form.isOpen">
|
|
|
|
|
<el-radio value="1" size="large">开放中</el-radio>
|
|
|
|
|
<el-radio value="0" size="large">未开放</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item :label="queryParams.type == '0' ? '景点属性' : '商家属性'" prop="attribute">
|
|
|
|
|
<el-checkbox v-model="form.attribute" :label="queryParams.type == '0' ? '标志性景点' : '标志性商家'" value="1" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="标签" prop="tagId">
|
|
|
|
|
<el-select class="inputWidth" v-model="form.tagId" placeholder="请选择标签" clearable>
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-option v-for="dict in sys_user_tagOptions" :key="dict.id" :label="dict.title" :value="dict.id" />
|
2024-12-16 15:38:26 +08:00
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="联系电话" prop="number">
|
|
|
|
|
<el-input v-model="form.number" placeholder="请输入电话" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-col :span="24">
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-form-item label="地理位置" prop="introduce">
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<!-- <el-input v-model="searchLocation" type="text" placeholder="请输入地址信息" clearable /> -->
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="searchLocation"
|
|
|
|
|
placeholder="请输入地址信息"
|
|
|
|
|
class="input-with-select"
|
|
|
|
|
@keyup.enter="debouncedSearch(searchLocation)"
|
|
|
|
|
>
|
|
|
|
|
<template #append>
|
|
|
|
|
<el-button @click="debouncedSearch(searchLocation)" :icon="Search" />
|
|
|
|
|
</template>
|
|
|
|
|
</el-input>
|
2024-12-16 15:38:26 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<tlbs-map
|
|
|
|
|
style="margin-left: 80px"
|
|
|
|
|
ref="map"
|
|
|
|
|
api-key="
|
|
|
|
|
6XFBZ-SAVLT-JGIX2-VOLMK-6S2H3-XUBGO"
|
|
|
|
|
:center="center"
|
|
|
|
|
:zoom="zoom"
|
|
|
|
|
:control="control"
|
|
|
|
|
@click="onClick"
|
|
|
|
|
>
|
|
|
|
|
<tlbs-multi-marker :geometries="geometries" :styles="styles" :options="options" />
|
|
|
|
|
</tlbs-map>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
2024-12-17 11:12:36 +08:00
|
|
|
|
<el-form-item label="详细地址" prop="address" style="margin-top: 15px">
|
|
|
|
|
<el-input v-model="form.address" placeholder="输入地理位置或点击度图上的地点" disabled />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="经度" prop="longitude">
|
|
|
|
|
<el-input v-model="form.longitude" placeholder="输入地理位置或点击度图上的地点" disabled />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="纬度" prop="latitude">
|
|
|
|
|
<el-input v-model="form.latitude" placeholder="输入地理位置或点击度图上的地点" disabled />
|
|
|
|
|
</el-form-item>
|
2024-12-16 15:38:26 +08:00
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item :label="`${queryParams.type == '0' ? '景点' : '商家'}照片/视频`" prop="">
|
|
|
|
|
<el-upload
|
|
|
|
|
class="upload-demo el-upload"
|
|
|
|
|
drag
|
|
|
|
|
:headers="upload.headers"
|
|
|
|
|
:action="uploadImgUrl"
|
|
|
|
|
v-model:file-list="fileList_1"
|
|
|
|
|
multiple
|
|
|
|
|
:on-success="(res, file) => returnContractSuccess('oss_1', res, file)"
|
|
|
|
|
:on-preview="handlePictureCardPreview"
|
|
|
|
|
:on-remove="
|
|
|
|
|
(res, file) => {
|
|
|
|
|
handleRemove(res, file, 'oss_1');
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
list-type="picture-card"
|
|
|
|
|
>
|
|
|
|
|
<el-icon class="el-icon--upload" :class="{}">
|
|
|
|
|
<Plus />
|
|
|
|
|
</el-icon>
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-form-item :label="`${queryParams.type == '0' ? '景点' : '商家'}简介`" prop="intro">
|
|
|
|
|
<editor v-model="form.intro" :min-height="150" :height="200" />
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<div class="dialog-footer">
|
|
|
|
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup name="Article" lang="ts">
|
2024-12-17 11:12:36 +08:00
|
|
|
|
import { listTag } from '@/api/manage/tag';
|
|
|
|
|
|
2024-12-16 15:38:26 +08:00
|
|
|
|
import { listArticle, getArticle, delArticle, addArticle, updateArticle, geocoder } from '@/api/manage/article';
|
2024-12-11 17:43:35 +08:00
|
|
|
|
import { ArticleVO, ArticleQuery, ArticleForm } from '@/api/manage/article/types';
|
2024-12-16 15:38:26 +08:00
|
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
import { getToken } from '@/utils/auth';
|
|
|
|
|
import { debounce } from '@/utils/debounce.js';
|
|
|
|
|
import { jsonp } from 'vue-jsonp';
|
2024-12-17 11:12:36 +08:00
|
|
|
|
import { Search } from '@element-plus/icons-vue';
|
2024-12-16 15:38:26 +08:00
|
|
|
|
import type { UploadProps, UploadUserFile } from 'element-plus';
|
|
|
|
|
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
|
|
|
|
const uploadImgUrl = ref(baseUrl + '/resource/oss/upload'); // 上传的图片服务器地址
|
2024-12-11 17:43:35 +08:00
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const autoTableHeight = ref<number>(750);
|
|
|
|
|
const articleList = ref<ArticleVO[]>([]);
|
|
|
|
|
const buttonLoading = ref(false);
|
|
|
|
|
const loading = ref(true);
|
|
|
|
|
const showSearch = ref(true);
|
|
|
|
|
const ids = ref<Array<string | number>>([]);
|
|
|
|
|
const single = ref(true);
|
|
|
|
|
const multiple = ref(true);
|
|
|
|
|
const total = ref(0);
|
2024-12-17 11:12:36 +08:00
|
|
|
|
const sys_user_tagOptions = ref([]); //标签库
|
2024-12-16 15:38:26 +08:00
|
|
|
|
const fileList_1 = ref<UploadUserFile[]>([]);
|
2024-12-11 17:43:35 +08:00
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
|
|
const articleFormRef = ref<ElFormInstance>();
|
|
|
|
|
const dialog = reactive<DialogOption>({
|
|
|
|
|
visible: false,
|
|
|
|
|
title: ''
|
|
|
|
|
});
|
2024-12-16 15:38:26 +08:00
|
|
|
|
const dialogImageUrl = ref('');
|
|
|
|
|
const dialogVisible = ref(false);
|
|
|
|
|
const upload = reactive({
|
|
|
|
|
// 是否显示弹出层(用户导入)
|
|
|
|
|
returnContractShow: false,
|
|
|
|
|
// 是否禁用上传
|
|
|
|
|
isUploading: false,
|
|
|
|
|
// 是否更新已经存在的用户数据
|
|
|
|
|
updateSupport: 0,
|
|
|
|
|
// 设置上传的请求头部
|
|
|
|
|
headers: {
|
|
|
|
|
Clientid: import.meta.env.VITE_APP_CLIENT_ID,
|
|
|
|
|
Authorization: 'Bearer ' + getToken()
|
|
|
|
|
}
|
|
|
|
|
});
|
2024-12-17 11:12:36 +08:00
|
|
|
|
const levelList = ref([
|
|
|
|
|
{ label: 'A级', value: 1 },
|
|
|
|
|
{ label: 'AA级', value: 2 },
|
|
|
|
|
{ label: 'AAA级', value: 3 },
|
|
|
|
|
{ label: 'AAAA级', value: 4 },
|
|
|
|
|
{ label: 'AAAAA级', value: 5 }
|
|
|
|
|
]);
|
2024-12-11 17:43:35 +08:00
|
|
|
|
const initFormData: ArticleForm = {
|
2024-12-16 15:38:26 +08:00
|
|
|
|
name: undefined,
|
2024-12-11 17:43:35 +08:00
|
|
|
|
id: undefined,
|
|
|
|
|
type: undefined,
|
|
|
|
|
secondType: undefined,
|
|
|
|
|
isOpen: undefined,
|
2024-12-16 15:38:26 +08:00
|
|
|
|
attribute: '0',
|
2024-12-11 17:43:35 +08:00
|
|
|
|
status: undefined,
|
2024-12-16 15:38:26 +08:00
|
|
|
|
province: '海南省',
|
|
|
|
|
city: '东方市',
|
2024-12-11 17:43:35 +08:00
|
|
|
|
remark: undefined,
|
|
|
|
|
memberLevel: undefined,
|
|
|
|
|
tagId: undefined,
|
|
|
|
|
recommend: undefined,
|
|
|
|
|
intro: undefined,
|
|
|
|
|
address: undefined,
|
|
|
|
|
longitude: undefined,
|
|
|
|
|
latitude: undefined,
|
2024-12-16 15:38:26 +08:00
|
|
|
|
orderNum: 0,
|
|
|
|
|
level: 0,
|
|
|
|
|
mediaBoList: undefined
|
2024-12-11 17:43:35 +08:00
|
|
|
|
};
|
|
|
|
|
const data = reactive<PageData<ArticleForm, ArticleQuery>>({
|
|
|
|
|
queryParams: {
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10,
|
2024-12-16 15:38:26 +08:00
|
|
|
|
name: undefined,
|
2024-12-11 17:43:35 +08:00
|
|
|
|
type: undefined,
|
|
|
|
|
secondType: undefined,
|
|
|
|
|
isOpen: undefined,
|
|
|
|
|
attribute: undefined,
|
|
|
|
|
status: undefined,
|
|
|
|
|
province: undefined,
|
|
|
|
|
city: undefined,
|
|
|
|
|
memberLevel: undefined,
|
|
|
|
|
tagId: undefined,
|
|
|
|
|
recommend: undefined,
|
|
|
|
|
intro: undefined,
|
|
|
|
|
address: undefined,
|
|
|
|
|
longitude: undefined,
|
|
|
|
|
latitude: undefined,
|
|
|
|
|
orderNum: undefined,
|
|
|
|
|
level: undefined,
|
|
|
|
|
params: {}
|
|
|
|
|
},
|
2024-12-16 15:38:26 +08:00
|
|
|
|
form: { ...initFormData },
|
2024-12-11 17:43:35 +08:00
|
|
|
|
rules: {
|
|
|
|
|
id: [{ required: true, message: '景点ID/租赁ID/游艇ID不能为空', trigger: 'blur' }],
|
2024-12-16 15:38:26 +08:00
|
|
|
|
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
|
|
|
|
number: [{ required: true, message: '电话不能为空', trigger: 'blur' }],
|
|
|
|
|
|
|
|
|
|
isOpen: [{ required: true, message: '请选择开放状态', trigger: 'change' }],
|
|
|
|
|
attribute: [{ required: false, message: '景点属性/商家属性不能为空', trigger: 'blur' }],
|
|
|
|
|
// remark: [{ required: true, message: '个人简介不能为空', trigger: 'blur' }],
|
|
|
|
|
// memberLevel: [{ required: true, message: '会员等级不能为空', trigger: 'blur' }],
|
2024-12-11 17:43:35 +08:00
|
|
|
|
tagId: [{ required: true, message: '标签不能为空', trigger: 'blur' }],
|
|
|
|
|
recommend: [{ required: true, message: '推荐语不能为空', trigger: 'blur' }],
|
|
|
|
|
address: [{ required: true, message: '详细地址不能为空', trigger: 'blur' }],
|
|
|
|
|
longitude: [{ required: true, message: '经度不能为空', trigger: 'blur' }],
|
|
|
|
|
latitude: [{ required: true, message: '纬度不能为空', trigger: 'blur' }],
|
|
|
|
|
orderNum: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
|
2024-12-16 15:38:26 +08:00
|
|
|
|
level: [{ required: true, message: '景区等级不能为空', trigger: 'blur' }],
|
|
|
|
|
intro: [{ required: true, message: '简介不能为空', trigger: 'blur' }]
|
2024-12-11 17:43:35 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const { queryParams, form, rules } = toRefs(data);
|
2024-12-17 11:12:36 +08:00
|
|
|
|
const map = ref(null);
|
|
|
|
|
const center = ref({ lat: form.value.latitude || 39.145902, lng: form.value.longitude || 117.17546 });
|
|
|
|
|
const zoom = ref(20);
|
|
|
|
|
const control = reactive({
|
|
|
|
|
scale: {},
|
|
|
|
|
zoom: {
|
|
|
|
|
position: 'topLeft'
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const searchLocation = ref(''); // 搜索地点
|
|
|
|
|
const geometries = ref([{ styleId: 'marker', position: { lat: form.value.latitude || 39.145902, lng: form.value.longitude || 117.17546 } }]);
|
|
|
|
|
const styles = reactive({
|
|
|
|
|
marker: {
|
|
|
|
|
width: 20,
|
|
|
|
|
height: 30,
|
|
|
|
|
anchor: { x: 10, y: 30 }
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
const options = reactive({
|
|
|
|
|
minZoom: 5,
|
|
|
|
|
maxZoom: 20
|
|
|
|
|
});
|
|
|
|
|
// 监听输入框内容变化,调用防抖后的搜索函数
|
|
|
|
|
watch(searchLocation, (newValue) => {
|
|
|
|
|
// debouncedSearch(newValue);
|
|
|
|
|
});
|
2024-12-16 15:38:26 +08:00
|
|
|
|
// 路由监听================================================
|
|
|
|
|
let router = useRouter();
|
|
|
|
|
watch(
|
|
|
|
|
() => router.currentRoute.value,
|
|
|
|
|
() => {
|
|
|
|
|
let query = router.currentRoute.value.query;
|
|
|
|
|
if (query) {
|
|
|
|
|
queryParams.value.type = query.type as string;
|
|
|
|
|
}
|
|
|
|
|
console.log('路由信息:', router.currentRoute.value);
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
);
|
2024-12-11 17:43:35 +08:00
|
|
|
|
onMounted(() => {
|
2024-12-17 11:12:36 +08:00
|
|
|
|
getTag(); //标签库
|
2024-12-11 17:43:35 +08:00
|
|
|
|
getList();
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
autoTableHeight.value = proxy?.autoTableHeight();
|
|
|
|
|
});
|
|
|
|
|
window.onresize = () => {
|
|
|
|
|
autoTableHeight.value = proxy?.autoTableHeight();
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-12-17 11:12:36 +08:00
|
|
|
|
const getTag = async () => {
|
|
|
|
|
const res = await listTag({ pageNum: 1, pageSize: 1000 });
|
|
|
|
|
sys_user_tagOptions.value = res.rows; //标签库
|
|
|
|
|
};
|
|
|
|
|
//输入位置,搜索位置
|
|
|
|
|
const performSearch = async (text) => {
|
|
|
|
|
// 这里简单模拟延迟,模拟真实的异步请求耗时
|
|
|
|
|
// await new Promise((resolve) => setTimeout(resolve, 500));
|
|
|
|
|
// 假设这里根据输入的文本去查找匹配的数据,实际中替换成真实逻辑
|
|
|
|
|
if (text === '') {
|
|
|
|
|
console.log('搜索内容为空');
|
|
|
|
|
} else {
|
|
|
|
|
console.log('搜索内容为:', text);
|
|
|
|
|
// 调用腾讯地图API进行搜索,并展示在地图上
|
|
|
|
|
// geocoder(text).then((result) => {
|
|
|
|
|
// console.log(result);
|
|
|
|
|
// });
|
|
|
|
|
jsonp(`https://apis.map.qq.com/ws/geocoder/v1/?address=${text}&key=${'6XFBZ-SAVLT-JGIX2-VOLMK-6S2H3-XUBGO'}&output=jsonp`, {}).then((data) => {
|
|
|
|
|
console.log(data);
|
|
|
|
|
if (data.status == 0) {
|
|
|
|
|
center.value.lat = data.result.location.lat;
|
|
|
|
|
center.value.lng = data.result.location.lng;
|
|
|
|
|
form.value.address = data.result.address;
|
|
|
|
|
form.value.latitude = data.result.location.lat;
|
|
|
|
|
form.value.longitude = data.result.location.lng;
|
|
|
|
|
geometries.value = [{ styleId: 'marker', position: { lat: data.result.location.lat, lng: data.result.location.lng } }];
|
|
|
|
|
} else if (data.status == 348) {
|
|
|
|
|
//地址信息不明确,需弹出提示
|
|
|
|
|
proxy?.$modal.msgError('未查询到地点,请补充详细地址信息');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// 点击地点,获取经纬度及地址信息
|
|
|
|
|
const onClick = (e: any) => {
|
|
|
|
|
jsonp(
|
|
|
|
|
`https://apis.map.qq.com/ws/geocoder/v1/?key=${'6XFBZ-SAVLT-JGIX2-VOLMK-6S2H3-XUBGO'}&location=${e.latLng.lat},${e.latLng.lng}&output=jsonp`,
|
|
|
|
|
{}
|
|
|
|
|
).then((data) => {
|
|
|
|
|
if (data.status == 0) {
|
|
|
|
|
if (form.value) {
|
|
|
|
|
form.value.address = data.result.address;
|
|
|
|
|
form.value.latitude = data.result.location.lat;
|
|
|
|
|
form.value.longitude = data.result.location.lng;
|
|
|
|
|
center.value.lat = data.result.location.lat;
|
|
|
|
|
center.value.lng = data.result.location.lng;
|
|
|
|
|
searchLocation.value = data.result.formatted_addresses.recommend;
|
|
|
|
|
geometries.value = [{ styleId: 'marker', position: { lat: data.result.location.lat, lng: data.result.location.lng } }];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const debouncedSearch = debounce(performSearch, 300); // 创建防抖后的搜索函数,延迟设为300毫秒
|
|
|
|
|
|
2024-12-11 17:43:35 +08:00
|
|
|
|
/** 查询景点、租赁管理列表 */
|
|
|
|
|
const getList = async () => {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
const res = await listArticle(queryParams.value).finally(() => (loading.value = false));
|
|
|
|
|
articleList.value = res.rows;
|
|
|
|
|
total.value = res.total;
|
|
|
|
|
loading.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 取消按钮 */
|
|
|
|
|
const cancel = () => {
|
|
|
|
|
reset();
|
|
|
|
|
dialog.visible = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 表单重置 */
|
|
|
|
|
const reset = () => {
|
2024-12-17 11:12:36 +08:00
|
|
|
|
searchLocation.value = '';
|
2024-12-11 17:43:35 +08:00
|
|
|
|
form.value = { ...initFormData };
|
|
|
|
|
articleFormRef.value?.resetFields();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
|
|
|
|
queryParams.value.pageNum = 1;
|
|
|
|
|
getList();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
|
|
const resetQuery = () => {
|
|
|
|
|
queryFormRef.value?.resetFields();
|
|
|
|
|
handleQuery();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 多选框选中数据 */
|
|
|
|
|
const handleSelectionChange = (selection: ArticleVO[]) => {
|
|
|
|
|
ids.value = selection.map((item) => item.id);
|
|
|
|
|
single.value = selection.length != 1;
|
|
|
|
|
multiple.value = !selection.length;
|
|
|
|
|
};
|
2024-12-16 15:38:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 等级格式化
|
|
|
|
|
*/
|
|
|
|
|
const formatLevel = (level: number | string) => {
|
|
|
|
|
switch (level) {
|
|
|
|
|
case 1:
|
|
|
|
|
return 'A';
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
return 'AA';
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
return 'AAA';
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
return 'AAAA';
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
return 'AAAAA';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-12-17 11:12:36 +08:00
|
|
|
|
/**
|
|
|
|
|
* 标签格式化
|
|
|
|
|
*/
|
|
|
|
|
const formatTag = (tagId: string) => {
|
|
|
|
|
for (let i = 0; i < sys_user_tagOptions.value.length; i++) {
|
|
|
|
|
const element = sys_user_tagOptions.value[i];
|
|
|
|
|
if (element.id == tagId) {
|
|
|
|
|
return element.title;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2024-12-11 17:43:35 +08:00
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
const handleAdd = () => {
|
|
|
|
|
reset();
|
|
|
|
|
dialog.visible = true;
|
2024-12-16 15:38:26 +08:00
|
|
|
|
if (queryParams.value.type == '0') {
|
|
|
|
|
dialog.title = '添加景点';
|
|
|
|
|
} else {
|
|
|
|
|
dialog.title = '添加商家';
|
|
|
|
|
}
|
2024-12-11 17:43:35 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
|
|
const handleUpdate = async (row?: ArticleVO) => {
|
|
|
|
|
reset();
|
|
|
|
|
const _id = row?.id || ids.value[0];
|
|
|
|
|
const res = await getArticle(_id);
|
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
|
dialog.visible = true;
|
2024-12-17 11:12:36 +08:00
|
|
|
|
dialog.title = queryParams.value.type == '0' ? '修改景点' : '修改商家';
|
|
|
|
|
center.value = { lat: row.latitude, lng: row.longitude };
|
|
|
|
|
geometries.value = [{ styleId: 'marker', position: { lat: row.latitude, lng: row.longitude } }];
|
2024-12-11 17:43:35 +08:00
|
|
|
|
};
|
|
|
|
|
|
2024-12-16 15:38:26 +08:00
|
|
|
|
/** 新增景点,商家提交按钮 */
|
2024-12-11 17:43:35 +08:00
|
|
|
|
const submitForm = () => {
|
|
|
|
|
articleFormRef.value?.validate(async (valid: boolean) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
buttonLoading.value = true;
|
2024-12-16 15:38:26 +08:00
|
|
|
|
if (!form.value.attribute) {
|
|
|
|
|
form.value.attribute = '0';
|
|
|
|
|
} else if (form.value.attribute == true) {
|
|
|
|
|
form.value.attribute = '1';
|
|
|
|
|
}
|
|
|
|
|
form.value.type = queryParams.value.type;
|
2024-12-11 17:43:35 +08:00
|
|
|
|
if (form.value.id) {
|
|
|
|
|
await updateArticle(form.value).finally(() => (buttonLoading.value = false));
|
|
|
|
|
} else {
|
|
|
|
|
await addArticle(form.value).finally(() => (buttonLoading.value = false));
|
|
|
|
|
}
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
dialog.visible = false;
|
|
|
|
|
await getList();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
2024-12-17 11:12:36 +08:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param row 发布,撤销发布
|
|
|
|
|
* @param type
|
|
|
|
|
*/
|
|
|
|
|
const updateRow = async (row: any, type: string) => {
|
|
|
|
|
await proxy?.$modal.confirm('是否确认' + (type == '0' ? '撤销发布' : '发布') + '名称为"' + row.name + '"的数据项?');
|
|
|
|
|
row.status = type;
|
|
|
|
|
buttonLoading.value = true;
|
|
|
|
|
await updateArticle(row).finally(() => (buttonLoading.value = false));
|
|
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
getList();
|
|
|
|
|
};
|
2024-12-11 17:43:35 +08:00
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
const handleDelete = async (row?: ArticleVO) => {
|
|
|
|
|
const _ids = row?.id || ids.value;
|
2024-12-17 11:12:36 +08:00
|
|
|
|
await proxy?.$modal.confirm('是否确认删除编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
2024-12-11 17:43:35 +08:00
|
|
|
|
await delArticle(_ids);
|
|
|
|
|
proxy?.$modal.msgSuccess('删除成功');
|
|
|
|
|
await getList();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 导出按钮操作 */
|
|
|
|
|
const handleExport = () => {
|
|
|
|
|
proxy?.download(
|
|
|
|
|
'system/article/export',
|
|
|
|
|
{
|
|
|
|
|
...queryParams.value
|
|
|
|
|
},
|
|
|
|
|
`article_${new Date().getTime()}.xlsx`
|
|
|
|
|
);
|
|
|
|
|
};
|
2024-12-16 15:38:26 +08:00
|
|
|
|
// 图像上传成功回调
|
|
|
|
|
const returnContractSuccess = (type: string, response: any, uploadFile: UploadFile) => {
|
|
|
|
|
// console.log(type, response, uploadFile);
|
|
|
|
|
if (response.code == 200) {
|
|
|
|
|
proxy?.$modal.msgSuccess('上传成功');
|
|
|
|
|
let typeFlag = false;
|
|
|
|
|
let obj = {
|
|
|
|
|
mediaType: type,
|
|
|
|
|
mediaOssId: response.data.ossId
|
|
|
|
|
};
|
2024-12-17 11:12:36 +08:00
|
|
|
|
form.value.mediaBoList.push(obj);
|
2024-12-16 15:38:26 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param uploadFile 预览文件
|
|
|
|
|
*/
|
|
|
|
|
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
|
|
|
|
dialogImageUrl.value = uploadFile.url!;
|
|
|
|
|
dialogVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param uploadFile 删除文件
|
|
|
|
|
* @param uploadFiles
|
|
|
|
|
* @param type
|
|
|
|
|
*/
|
|
|
|
|
const handleRemove = (uploadFile, uploadFiles, type) => {
|
|
|
|
|
console.log(uploadFile, uploadFiles, type);
|
2024-12-17 11:12:36 +08:00
|
|
|
|
form.value.mediaBoList.forEach((item, index) => {
|
2024-12-16 15:38:26 +08:00
|
|
|
|
if (type == item.mediaType) {
|
2024-12-17 11:12:36 +08:00
|
|
|
|
form.value.mediaBoList.splice(index, 1);
|
2024-12-16 15:38:26 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</script>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.el-card :deep(.el-card__body) {
|
|
|
|
|
padding-bottom: 0px !important;
|
|
|
|
|
}
|
|
|
|
|
#table_page {
|
|
|
|
|
height: 50px !important;
|
|
|
|
|
margin-top: 10px !important;
|
|
|
|
|
padding-bottom: 10px !important;
|
|
|
|
|
}
|
2024-12-16 15:38:26 +08:00
|
|
|
|
.el-upload {
|
|
|
|
|
:deep(.el-upload-dragger) {
|
|
|
|
|
padding: 0;
|
|
|
|
|
height: 100%;
|
|
|
|
|
i {
|
|
|
|
|
top: 30%;
|
|
|
|
|
left: 50%;
|
|
|
|
|
position: absolute;
|
|
|
|
|
transform: translateX(-50%);
|
|
|
|
|
font-size: 45px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-11 17:43:35 +08:00
|
|
|
|
</style>
|