添加营销配置、评论列表及优化部分字段类型

This commit is contained in:
钊钊 2024-12-23 13:56:37 +08:00
parent 5071d63dcb
commit 7b63f708e6
9 changed files with 850 additions and 61 deletions

View File

@ -0,0 +1,75 @@
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MkConfigVO, MkConfigForm, MkConfigQuery } from '@/api/manage/mkConfig/types';
/**
*
* @param query
* @returns {*}
*/
export const listMkConfig = (query?: MkConfigQuery): AxiosPromise<MkConfigVO[]> => {
return request({
url: '/manage/mkConfig/list',
method: 'get',
params: query
});
};
/**
*
* @param id
*/
export const getMkConfig = (id: string | number): AxiosPromise<MkConfigVO> => {
return request({
url: '/manage/mkConfig/' + id,
method: 'get'
});
};
/**
*
* @param data
*/
export const addMkConfig = (data: MkConfigForm) => {
return request({
url: '/manage/mkConfig',
method: 'post',
data: data
});
};
/**
*
* @param data
*/
export const updateMkConfig = (data: MkConfigForm) => {
return request({
url: '/manage/mkConfig',
method: 'put',
data: data
});
};
/**
*
* @param id
*/
export const delMkConfig = (id: string | number | Array<string | number>) => {
return request({
url: '/manage/mkConfig/' + id,
method: 'delete'
});
};
/**
*
* @param query
* @returns
*/
export const mkRewardUserList = (query: any) => {
return request({
url: '/manage/mkRewardUser/list',
method: 'get',
params: query
});
};

View File

@ -0,0 +1,113 @@
export interface MkConfigVO {
id: number;
/**
*
*/
name: string;
/**
* 0- 1-
*/
type: number;
/**
* 0- 1-
*/
status: number;
/**
*
*/
rewardConfig: string;
/**
*
*/
joinCount: number;
/**
*
*/
awardCount: number;
/**
*
*/
createBy: number;
/**
*
*/
createTime: string;
}
export interface MkConfigForm extends BaseEntity {
/**
*
*/
id: number;
name?: string;
roundConfig?: any;
dailyConfig?: any;
/**
* 0- 1-
*/
type?: number;
/**
* 0- 1-
*/
status?: number;
/**
*
*/
rewardConfig?: string;
/**
*
*/
joinCount?: number;
/**
*
*/
awardCount?: number;
}
export interface MkConfigQuery extends PageQuery {
/**
*
*/
name?: string;
/**
* 0- 1-
*/
type?: string;
/**
* 0- 1-
*/
status?: number;
/**
*
*/
rewardConfig?: string;
/**
*
*/
joinCount?: number;
/**
*
*/
awardCount?: number;
/**
*
*/
params?: any;
}

View File

@ -110,12 +110,12 @@ export interface ArticleForm extends BaseEntity {
/** /**
* *
*/ */
longitude?: number; longitude?: string;
/** /**
* *
*/ */
latitude?: number; latitude?: string;
/** /**
* *
*/ */
@ -173,7 +173,7 @@ export interface ArticleForm extends BaseEntity {
/** /**
* *
*/ */
tagId?: string | number; tagId?: string;
/** /**
* *

View File

@ -0,0 +1,154 @@
<!-- 评论列表 -->
<template>
<div>
<div class="commentList">
<div v-for="comment in commentListData" :key="comment.id" class="comment-item">
<div class="user-info">
<!-- <img :src="comment.avatar" alt="用户昵称" class="avatar"> -->
<image-preview :src="comment.avatar" :width="25" :height="25" />
<div class="username">
<div style="margin-right: 5px;">
{{ comment.nickName }}
</div>
<div v-if="comment.parentId" class="reply-to"></div>
<div v-if="comment.parentId" class="reply-to-username">{{ comment.replyNickName }}</div>
</div>
</div>
<div class="user-details">
<div class="comment-content">{{ comment.content }}</div>
<div class="comment-info">
<span class="comment-time">{{ comment.createTime }}</span>
<span class="ip-address">IP: {{ comment.address?comment.address:'未知' }}</span>
</div>
</div>
<!-- <div v-if="comment.replies && comment.replies.length" class="replies">
<div v-for="reply in comment.replies" :key="reply.id" class="reply-item">
<div class="user-info">
<img :src="reply.avatar" alt="回复用户昵称" class="avatar">
<div class="user-details">
<div class="username">回复 {{ reply.username }}</div>
<div class="comment-content">{{ reply.content }}</div>
<div class="comment-info">
<span class="comment-time">{{ reply.time }}</span>
<span class="ip-address">IP: {{ reply.ipAddress }}</span>
</div>
</div>
</div>
</div>
</div> -->
</div>
</div>
<pagination v-show="total > 0" id="table_page" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getCommentList" />
</div>
</template>
<script setup lang="ts" name="commentList">
import { ref, reactive, onMounted, nextTick } from 'vue';
import {commentList } from '@/api/manage/scenic';
//
const props = defineProps({
bizId:{
type: Number,
default: null,
}
});
const queryParams = reactive({
pageNum: 1,
pageSize: 10,
bizId: null,
status: 0,
});
// tagIds,tagIds
watch(
() => props.bizId,
(newVal, oldVal) => {
console.log(newVal);
queryParams.bizId = newVal;
if (newVal) {
//
nextTick(() => {
getCommentList();
});
}
},
{ immediate: true }
);
const total=ref(0)
const loading = ref(false);
const commentListData = ref([]);
//
const emit = defineEmits(['hideDialog']);
/**
* 获取评论列表
*/
const getCommentList = async () => {
loading.value = true;
let res=await commentList(queryParams).finally(() => (loading.value = false));
console.log('评论列表:',res);
total.value=res.total;
commentListData.value = res.rows;
}
</script>
<style lang="scss" scoped>
.commentList {
height: 500px;
overflow-y: auto;
.comment-item {
padding: 10px 0px;
.user-info {
display: flex;
.username {
display: flex;
color: #000;
font-weight: bold;
margin-left: 10px;
vertical-align: super;
.reply-to {
width: 0;
height: 0;
margin-top: 5px;
border-top: 6px solid transparent;
/* 上边框透明 */
border-bottom: 6px solid transparent;
/* 下边框透明 */
border-left: 6px solid #999;
/* 左边框为箭头颜色,这里设为黑色,可按需更改 */
}
.reply-to-username {
margin-left: 5px;
}
}
}
.user-details {
margin-left: 35px;
.comment-content {
color: #000;
font-size: 16px;
padding: 3px 0px;
}
}
}
}
.ip-address {
margin-left: 15px;
}
#table_page {
height: 50px !important;
margin-top: 10px !important;
padding-bottom: 0px !important;
margin-bottom: 0px !important;
}
</style>

View File

@ -71,12 +71,12 @@
</template> </template>
</el-dialog> </el-dialog>
<!-- 评论详情 --> <!-- 评论详情 -->
<el-dialog title="评论详情" v-model="comment.visible" width="700px" append-to-body> <el-dialog title="评论详情" v-model="comment.visible" width="600px" append-to-body>
<div> <div class="commentList">
11 <commentRows :bizId="comment.bizId"></commentRows>
</div> </div>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer noTopPadding">
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</template> </template>
@ -87,7 +87,7 @@
<script setup lang="ts" name="noteList"> <script setup lang="ts" name="noteList">
import { ref, reactive, onMounted, nextTick } from 'vue'; import { ref, reactive, onMounted, nextTick } from 'vue';
import { string } from 'vue-types'; import { string } from 'vue-types';
import { listByTagIdNotebook,commentList } from '@/api/manage/scenic'; import { listByTagIdNotebook } from '@/api/manage/scenic';
// //
const props = defineProps({ const props = defineProps({
@ -118,8 +118,7 @@ const noteDetail = reactive({
}) })
const comment = reactive({ const comment = reactive({
visible: false, visible: false,
title: '', bizId:null
content: ''
}) })
const queryParams = reactive({ const queryParams = reactive({
pageNum: 1, pageNum: 1,
@ -145,10 +144,7 @@ const handleDetail = (row: any) => {
} }
// //
const handleComment = async (row: any) => { const handleComment = async (row: any) => {
loading.value = true; comment.bizId = row.id;
let res=await commentList({bizId:row.id,status:0}).finally(() => (loading.value = false));
console.log('评论列表:',res);
comment.visible = true; comment.visible = true;
} }
// tagIds,tagIds // tagIds,tagIds
@ -197,4 +193,8 @@ const formatTag = (tagId: string | null) => {
// //
const emit = defineEmits(['hideDialog', 'handleUpdate', 'handleDelete']); const emit = defineEmits(['hideDialog', 'handleUpdate', 'handleDelete']);
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped>
.noTopPadding {
padding-top: 0;
}
</style>

View File

@ -127,7 +127,7 @@
</template> </template>
<script setup name="Article" lang="ts"> <script setup name="Article" lang="ts">
import { listTag } from '@/api/manage/tag'; import { listTag,tagAll } from '@/api/manage/tag';
import { listArticle, getArticle, delArticle, addArticle, updateArticle } from '@/api/manage/article'; import { listArticle, getArticle, delArticle, addArticle, updateArticle } from '@/api/manage/article';
import { ArticleVO, ArticleQuery, ArticleForm } from '@/api/manage/article/types'; import { ArticleVO, ArticleQuery, ArticleForm } from '@/api/manage/article/types';
@ -211,8 +211,8 @@ const cancel = () => {
} }
// //
const getTag = async () => { const getTag = async () => {
const res = await listTag({ pageNum: 1, pageSize: 1000 }); const res = await tagAll();
sys_user_tagOptions.value = res.rows; // sys_user_tagOptions.value = res; //
}; };
/** /**
* 标签格式化 * 标签格式化

View File

@ -0,0 +1,442 @@
<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]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form-item label="任务名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入任务名称" clearable @keyup.enter="handleQuery" />
</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-form-item>
</el-form>
</el-card>
</div>
</transition> -->
<el-table v-loading="loading" :data="mkConfigList" @selection-change="handleSelectionChange">
<el-table-column label="任务名称" align="center" prop="name" />
<el-table-column label="参与人数" align="center" prop="joinCount">
<template #default="scope">
<el-button link type="primary" @click="handleJoin(scope.row)">{{ scope.row.joinCount }}</el-button>
</template>
</el-table-column>
<el-table-column label="获奖人数" align="center" prop="awardCount">
<template #default="scope">
<el-button link type="primary" @click="handleAward(scope.row)">{{ scope.row.awardCount }}</el-button>
</template>
</el-table-column>
<el-table-column label="详情" align="center" prop="">
<template #default="scope">
<el-button link type="primary" @click="handleAward(scope.row)">查看详情</el-button>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<span>{{ scope.row.status == 0 ? '未发布' : '已发布' }}</span>
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="createName" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['manage:mkConfig:edit']"></el-button>
</el-tooltip>
<el-button link type="primary" @click="handleStatus(scope.row,'1')" v-if="scope.row.status == 0"
v-hasPermi="['manage:mkConfig:edit']">发布</el-button>
<el-button link type="primary" @click="handleStatus(scope.row,'0')" v-if="scope.row.status == 1"
v-hasPermi="['manage:mkConfig:edit']">撤销发布</el-button>
</template>
</el-table-column>
</el-table>
<!-- <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getList" /> -->
<!-- 每日任务对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="700px" append-to-body>
<div v-if="queryParams.type == '0'" style="height: 400px;overflow-y: auto;">
<el-form ref="mkConfigFormRef" :model="form" :rules="rules" label-width="110px">
<el-form-item label="每日封顶积分:" prop="name">
<el-input style="width: 150px;" type="number" v-model="form.dailyConfig.dailyLimit" placeholder="请输入积分">
<template #append></template>
</el-input>
</el-form-item>
<el-row v-for="(item, index) in form.dailyConfig.dailyReward" :key="index" :gutter="10"
style="margin-bottom: 10px; margin-right: 5px !important">
<el-col :span="11">
<el-form-item :label="`奖励${index + 1}`" prop="">
<el-select v-model="item.rewardType" placeholder="请选择" style="width: 150px">
<el-option label="服务" :value="1"></el-option>
<el-option label="商品" :value="2"></el-option>
<el-option label="商品2" :value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11">
<el-form-item label="所需积分:">
<el-input style="width: 100px;" v-model="item.rewardNum" type="number" placeholder="请输入积分"
class="no-arrows">
</el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<vxe-button mode="text" v-if="index == 0" icon="vxe-icon-add" class="handle_btn add_btn"
@click="amendDailyReward(index,'add')"></vxe-button>
<vxe-button mode="text" v-else icon="vxe-icon-minus" class="handle_btn rem_btn"
@click="amendDailyReward(index,'remove')"></vxe-button>
</el-col>
</el-row>
</el-form>
</div>
<!-- 大转盘弹层 -->
<div v-else style="height: 400px;overflow-y: auto;">
<el-form ref="dzpFormRef" :model="form" :rules="rules" label-width="70px">
<el-row v-for="(item, index) in form.roundConfig" :key="index" :gutter="10"
style="margin-bottom: 10px; margin-right: 5px !important">
<el-col :span="14">
<el-form-item :label="`奖品${index + 1}`" prop="">
<el-select v-model="item.rewardType" placeholder="请选择" style="width: 120px">
<el-option label="服务" :value="1"></el-option>
<el-option label="商品" :value="2"></el-option>
<el-option label="商品2" :value="3"></el-option>
</el-select>
<span style="margin: 0px 10px;"> + </span>
<el-select v-model="item.goodsId" placeholder="请选择" style="width: 120px">
<el-option label="服务" :value="1"></el-option>
<el-option label="商品" :value="2"></el-option>
<el-option label="商品2" :value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="获奖概率:" label-width="95px">
<el-input style="width: 100px;" v-model="item.rewardNum" type="number" placeholder="请输入概率"
class="no-arrows">
<template #append>%</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<vxe-button mode="text" v-if="index == 0" icon="vxe-icon-add" class="handle_btn add_btn"
@click="amendRoundConfig(index,'add')"></vxe-button>
<vxe-button mode="text" v-else icon="vxe-icon-minus" class="handle_btn rem_btn"
@click="amendRoundConfig(index,'remove')"></vxe-button>
</el-col>
</el-row>
</el-form>
</div>
<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>
<!-- 获奖人员 -->
<el-dialog title="获奖人员" v-model="mkReward.visible" width="600px" append-to-body>
<div>
<el-table :data="mkRewardUserLists" border style="width: 100%">
<el-table-column prop="userId" label="用户ID" width="180" />
<el-table-column prop="nickName" label="昵称" width="170" />
<el-table-column prop="" label="获得奖品" width="100">
<template #default="scope">
<el-button link type="primary" @click="">查看详情</el-button>
</template>
</el-table-column>
<el-table-column prop="" label="邀请人数" width="80">
<template #default="scope">
<el-button link type="primary" @click="">{{ scope.row.inviteCount }}</el-button>
</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="MkConfig" lang="ts">
import { listMkConfig, getMkConfig, delMkConfig, addMkConfig, updateMkConfig,mkRewardUserList } from '@/api/manage/mkConfig';
import { MkConfigVO, MkConfigQuery, MkConfigForm } from '@/api/manage/mkConfig/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const mkConfigList = ref<MkConfigVO[]>([]);
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);
const taskList = ref<Array<string | number>>([]); //
const queryFormRef = ref<ElFormInstance>();
const mkConfigFormRef = ref<ElFormInstance>();
const dzpFormRef = ref<ElFormInstance>();
const mkReward= reactive({
visible: false,
})
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const mkRewardUserParams = reactive({
pageNum: 1,
pageSize: 10,
bizId:null,
})
const initFormData: MkConfigForm = {
id: undefined,
name: undefined,
type: undefined,
status: undefined,
rewardConfig: undefined,
joinCount: undefined,
awardCount: undefined,
dailyConfig: {
dailyLimit: undefined,
dailyReward: []
},
roundConfig: undefined,
}
const data = reactive<PageData<MkConfigForm, MkConfigQuery>>({
form: {...initFormData},
queryParams: {
pageNum: 1,
pageSize: 10,
name: undefined,
type: undefined,
status: undefined,
rewardConfig: undefined,
joinCount: undefined,
awardCount: undefined,
params: {
}
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
// ================================================
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 }
);
/** 查询营销配置列表 */
const getList = async () => {
loading.value = true;
const res = await listMkConfig(queryParams.value);
mkConfigList.value = res.rows;
total.value = res.total;
loading.value = false;
}
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
mkReward.visible = false;
}
/** 表单重置 */
const reset = () => {
form.value = {...initFormData};
mkConfigFormRef.value?.resetFields();
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
}
/** 多选框选中数据 */
const handleSelectionChange = (selection: MkConfigVO[]) => {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = "添加营销配置";
}
/** 修改按钮操作 */
const handleUpdate = async (row?: MkConfigVO) => {
reset();
const _id = row?.id
const res = await getMkConfig(_id);
Object.assign(form.value, res.data);
form.value.id=_id;
dialog.title = `${queryParams.value.type == '1' ? '大转盘' : '每日任务'}`;
dialog.visible = true;
}
/** 提交按钮 */
const submitForm = () => {
if (queryParams.value.type == '0'){//
mkConfigFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
await updateMkConfig(form.value).finally(() => buttonLoading.value = false);
proxy?.$modal.msgSuccess("操作成功");
dialog.visible = false;
await getList();
}
});
}else{ //
let roundConfig_copy=[];
for (let i = 0; i < form.value.roundConfig.length; i++) {
const element = form.value.roundConfig[i];
if (element.rewardType&&element.goodsId&&element.rewardNum) {
roundConfig_copy.push(element);
}else{
proxy?.$modal.msgError(`奖品${i+1}配置不完整`);
return
}
}
dzpFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
await updateMkConfig(form.value).finally(() => buttonLoading.value = false);
proxy?.$modal.msgSuccess("操作成功");
dialog.visible = false;
await getList();
}
});
}
}
/** 删除按钮操作 */
const handleDelete = async (row?: MkConfigVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除营销配置编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
await delMkConfig(_ids);
proxy?.$modal.msgSuccess("删除成功");
await getList();
}
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download('manage/mkConfig/export', {
...queryParams.value
}, `mkConfig_${new Date().getTime()}.xlsx`)
}
/**
* 获取获奖人员列表
* @param row
*/
const mkRewardUserLists=ref([]);
const handleAward = async (row: any) => {
loading.value = true;
mkRewardUserParams.bizId = row.id;
const res = await mkRewardUserList(mkRewardUserParams).finally(() => loading.value = false);
mkRewardUserLists.value= res.rows;
mkReward.visible = true;
// dialog.title = "";
}
//
const handleStatus = async (row: any,type:string) => {
await proxy?.$modal.confirm('是否确认' + (type == '0' ? '撤销发布' : '发布') + '名称为"' + row.name + '"的数据项?');
loading.value = true;
row.status = type;
const res = await updateMkConfig(row).finally(() => loading.value = false);
proxy?.$modal.msgSuccess("操作成功");
await getList();
}
//
const amendDailyReward= async (index:number,type:string) => {
if (type=='add') {
form.value.dailyConfig.dailyReward.push({
rewardNum:null,
rewardType:null
}
)
}else{
form.value.dailyConfig.dailyReward.splice(index,1)
}
}
/**
* 添加 删除大转盘奖品项
* @param index
* @param type
*/
const amendRoundConfig= async (index:number,type:string) => {
if (type=='add') {
form.value.roundConfig.push({
goodsId: null,
rewardNum:null,
rewardType:null
})
}else{
form.value.roundConfig.splice(index,1)
}
}
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
.handle_btn {
cursor: pointer;
border-radius: 5px;
padding: 0px 10px;
}
.add_btn {
color: #1296db;
border: 1px solid #1296db;
}
.rem_btn {
color: #f56c6c;
border: 1px solid #f56c6c;
}
/* 去掉input的上下箭头 */
:deep(.no-arrows input::-webkit-inner-spin-button),
:deep(.no-arrows input::-webkit-outer-spin-button) {
-webkit-appearance: none !important;
}
:deep(.no-arrows input[type='number']) {
-moz-appearance: textfield;
}
:deep(.el-input-group__append) {
padding: 0px 10px;
}
</style>

View File

@ -94,12 +94,12 @@
</el-table-column> </el-table-column>
<el-table-column label="地址信息" align="center" prop="address" width="180px" /> <el-table-column label="地址信息" align="center" prop="address" width="180px" />
<el-table-column label="联系电话" align="center" prop="number" width="120px" /> <el-table-column label="联系电话" align="center" prop="number" width="120px" />
<el-table-column label="标签" align="center" prop="tagId"> <el-table-column label="标签" align="center" prop="tagId" show-overflow-tooltip width="150px">
<template #default="scope"> <template #default="scope">
<span>{{ formatTag(scope.row.tagId) }}</span> <span>{{ formatTag(scope.row.tagId) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="推荐语" align="center" prop="recommend" width="180px" /> <el-table-column label="推荐语" align="center" prop="recommend" width="180px" show-overflow-tooltip />
<el-table-column :label="queryParams.type == '0' ? '景点详情' : '详情'" align="center" prop="remark"> <el-table-column :label="queryParams.type == '0' ? '景点详情' : '详情'" align="center" prop="remark">
<template #default="scope"> <template #default="scope">
<el-button link type="primary" @click="handleDetail(scope.row)">查看</el-button> <el-button link type="primary" @click="handleDetail(scope.row)">查看</el-button>
@ -136,11 +136,11 @@
v-hasPermi="['system:article:edit']">发布</el-button> v-hasPermi="['system:article:edit']">发布</el-button>
<el-button link type="primary" v-if="scope.row.status == 2" @click="updateRow(scope.row, '0')" <el-button link type="primary" v-if="scope.row.status == 2" @click="updateRow(scope.row, '0')"
v-hasPermi="['system:article:edit']">撤销发布</el-button> v-hasPermi="['system:article:edit']">撤销发布</el-button>
<el-tooltip content="修改" placement="top" v-if="scope.row.status == 0"> <el-tooltip content="修改" placement="top" v-if="scope.row.status == 0||scope.row.status == 3">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:article:edit']"></el-button> v-hasPermi="['system:article:edit']"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="删除" placement="top" v-if="scope.row.status == 0"> <el-tooltip content="删除" placement="top" v-if="scope.row.status == 0||scope.row.status == 3">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:article:remove']"></el-button> v-hasPermi="['system:article:remove']"></el-button>
</el-tooltip> </el-tooltip>
@ -161,7 +161,11 @@
</el-col> </el-col>
<el-col :span="12" v-if="queryParams.type == '0'"> <el-col :span="12" v-if="queryParams.type == '0'">
<el-form-item label="景区等级" prop="level"> <el-form-item label="景区等级" prop="level">
<el-input-number v-model="form.level" :min="1" :max="5" /> <!-- <el-input-number v-model="form.level" :min="1" :max="5" /> -->
<el-select v-model="form.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>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -339,10 +343,10 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="标签" prop="tagId"> <el-form-item label="标签" prop="tagId">
<el-select class="inputWidth" v-model="form.tagId" placeholder="请选择标签" clearable disabled> <!-- <el-select class="inputWidth" v-model="form.tagId_copy" placeholder="请选择标签" clearable disabled>
<el-option v-for="dict in sys_user_tagOptions" :key="dict.id" :label="dict.title" <el-option v-for="item in sys_user_tagOptions" :key="item.id" :label="item.title" :value="item.id" />
:value="String(dict.id)" /> </el-select> -->
</el-select> <span>{{ formatTag(form.tagId) }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -463,20 +467,20 @@ const initFormData: ArticleForm = {
attribute: null, attribute: null,
status: undefined, status: undefined,
province: '', province: '',
city: '', city: '460108',
region: '', region: '460108',
regionCode: '', regionCode: '460108',
remark: undefined, remark: undefined,
memberLevel: undefined, memberLevel: undefined,
tagId: undefined, tagId: undefined,
tagId_copy: [], tagId_copy: [],
recommend: undefined, recommend: undefined,
intro: undefined, intro: undefined,
address: undefined, address: '海南省海口市美兰区大英山西二街',
longitude: undefined, longitude: '110.348801',
latitude: undefined, latitude: '20.018883',
orderNum: 0, orderNum: 1,
level: 0, level: null,
mediaBoList: undefined, mediaBoList: undefined,
icon: undefined icon: undefined
}; };
@ -537,8 +541,8 @@ const data = reactive<PageData<ArticleForm, ArticleQuery>>({
}); });
const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data);
const map = ref(null); const map = ref(null);
const center = ref({ lat: form.value.latitude || 39.145902, lng: form.value.longitude || 117.17546 }); const center = ref({ lat: form.value.latitude || 20.018883, lng: form.value.longitude || 110.348801 });
const zoom = ref(20); const zoom = ref(17);
const control = reactive({ const control = reactive({
scale: {}, scale: {},
zoom: { zoom: {
@ -546,7 +550,7 @@ const control = reactive({
} }
}); });
const searchLocation = ref(''); // const searchLocation = ref(''); //
const geometries = ref([{ styleId: 'marker', position: { lat: form.value.latitude || 39.145902, lng: form.value.longitude || 117.17546 } }]); const geometries = ref([{ styleId: 'marker', position: { lat: form.value.latitude || 20.018883, lng: form.value.longitude || 110.348801 } }]);
const styles = reactive({ const styles = reactive({
marker: { marker: {
width: 20, width: 20,
@ -681,11 +685,11 @@ const getList = async () => {
/** 取消按钮 */ /** 取消按钮 */
const cancel = (type: string) => { const cancel = (type: string) => {
reset(type);
if (type == 'preview') { if (type == 'preview') {
previewVisible.value = false; previewVisible.value = false;
return; return;
} }
reset(type);
dialog.visible = false; dialog.visible = false;
noteBookVisible.value = false; noteBookVisible.value = false;
noteBookTagIds.value = ''; // noteBookTagIds.value = ''; //
@ -791,6 +795,7 @@ const handleUpdate = async (row?: any) => {
} else { } else {
res.data.regionCode = res.data.region; res.data.regionCode = res.data.region;
} }
searchLocation.value = res.data.address;
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
dialog.visible = true; dialog.visible = true;
dialog.title = queryParams.value.type == '0' ? '修改景点' : '修改商家'; dialog.title = queryParams.value.type == '0' ? '修改景点' : '修改商家';
@ -805,6 +810,7 @@ const handleDetail = async (row?: ArticleVO) => {
reset(); reset();
const _id = row?.id || ids.value[0]; const _id = row?.id || ids.value[0];
const res = await getArticle(_id); const res = await getArticle(_id);
res.data.tagId_copy = res.data.tagId?.split(',');
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
previewVisible.value = true; previewVisible.value = true;
}; };

View File

@ -1,7 +1,8 @@
<!-- 标签管理 --> <!-- 标签管理 -->
<template> <template>
<div class="p-2"> <div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave"> <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"> <div v-show="showSearch" class="mb-[10px]" id="search_div">
<el-card shadow="hover"> <el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true"> <el-form ref="queryFormRef" :model="queryParams" :inline="true">
@ -14,11 +15,12 @@
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button> <el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['manage:tag:add']">新增</el-button> <el-button type="primary" plain icon="Plus" @click="handleAdd"
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['manage:tag:edit']">修改</el-button> v-hasPermi="['manage:tag:add']">新增</el-button>
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['manage:tag:remove']" <el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()"
>删除</el-button v-hasPermi="['manage:tag:edit']">修改</el-button>
> <el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"
v-hasPermi="['manage:tag:remove']">删除</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
@ -30,7 +32,7 @@
<el-table-column label="标签ID" align="center" prop="id" v-if="false" width="70px" /> <el-table-column label="标签ID" align="center" prop="id" v-if="false" width="70px" />
<el-table-column label="标签名称" align="center" prop="title" /> <el-table-column label="标签名称" align="center" prop="title" />
<el-table-column label="排序" align="center" prop="sort" /> <el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="更新者" align="center" prop="updateBy" /> <el-table-column label="更新者" align="center" prop="updateByName" />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180"> <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
@ -39,23 +41,19 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-tooltip content="修改" placement="top"> <el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['manage:tag:edit']"></el-button> <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
v-hasPermi="['manage:tag:edit']"></el-button>
</el-tooltip> </el-tooltip>
<el-tooltip content="删除" placement="top"> <el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['manage:tag:remove']"></el-button> <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['manage:tag:remove']"></el-button>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination v-show="total > 0" id="table_page" :total="total" v-model:page="queryParams.pageNum"
v-show="total > 0" v-model:limit="queryParams.pageSize" @pagination="getList" />
id="table_page"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改标签对话框 --> <!-- 添加或修改标签对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="tagFormRef" :model="form" :rules="rules" label-width="80px"> <el-form ref="tagFormRef" :model="form" :rules="rules" label-width="80px">
@ -229,6 +227,7 @@ const handleExport = () => {
.el-card :deep(.el-card__body) { .el-card :deep(.el-card__body) {
padding-bottom: 0px !important; padding-bottom: 0px !important;
} }
#table_page { #table_page {
height: 50px !important; height: 50px !important;
margin-top: 10px !important; margin-top: 10px !important;