feat:情报论坛-市情报指有置顶功能

This commit is contained in:
2025-12-13 17:17:00 +08:00
parent 93c9715e78
commit 5ab71f95b0
2 changed files with 50 additions and 10 deletions

View File

@ -1,7 +1,7 @@
import {
getItem,
setItem
} from '@/utils/storage';
} from '@/utils/storage';
import {
TOKEN_TIMEOUT_VSLUE,
TIME_STAMP
@ -75,3 +75,9 @@ export function spliceString(targetArr){
}
return currentStr
}
/** 是否是市情指(市情报指挥) */
export function isShiQingZhi() {
const { deptBizType, deptLevel } = getItem('deptId')?.[0] || {}
const Jb = deptLevel?.[0] == '2' ? '01' : deptLevel?.[0] == '3' ? '02' : '03'
return deptBizType == '23' && Jb == '01'
}

View File

@ -21,7 +21,8 @@
</div>
<div class="post-images">
<div class="image-list">
<div v-for="(img, imgIndex) in item.tp" :key="imgIndex" class="image-item" v-if="item.tp && item.tp.length > 0">
<div v-for="(img, imgIndex) in item.tp" :key="imgIndex" class="image-item"
v-if="item.tp && item.tp.length > 0">
<el-image :src="setAddress(img)" show-progress>
<template #error>
<div class="image-slot error">
@ -34,7 +35,7 @@
</div>
</div>
</div>
<div style="display: flex;justify-content: flex-end;margin-bottom: 10px;" v-if="sfzh == item.fbrsfzh">
<div style="display: flex;justify-content: flex-end;margin-bottom: 10px;" v-if="sfzh == item.fbrsfzh||isShiQingZhi()">
<el-button type="text" size="small" class="action-btn edit-btn" @click.stop="handleEdit(item)">
<el-icon>
<Edit />
@ -45,6 +46,12 @@
<Delete />
</el-icon> 删除
</el-button>
<el-button v-if="isShiQingZhi()" type="text" size="small" class="action-btn delete-btn"
@click.stop="handleSetTop(item)">
<el-icon>
<Top />
</el-icon> {{ item.sfzd == 1 ? '取消置顶' : '置顶' }}
</el-button>
</div>
</div>
</div>
@ -63,19 +70,21 @@
</div>
<Release v-model="showModel" :ItemData="ItemData" @SaveReport="SaveReport" title="帖子发布" :showCancel="false"
:heightNumber="436"></Release>
<Particulars ref="particulars"/>
<Particulars ref="particulars" />
</template>
<script setup>
import Release from './release.vue'
import { setAddress } from '@/utils/tools'
import { ref, reactive, onMounted } from 'vue'
import { tbGsxtXxltSelectPage, tbGsxtXxltDelete ,tbGsxtXxltHfid} from '@/api/tbGsxtXxltHf'
import { tbGsxtXxltSelectPage, tbGsxtXxltDelete, tbGsxtXxltHfid, tbGsxtXxltUpdate } from '@/api/tbGsxtXxltHf'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Edit, Delete, Document } from '@element-plus/icons-vue'
import { getItem } from '@/utils/storage.js'
import Particulars from "./particulars.vue";
import { useRouter, useRoute } from 'vue-router'
import { isShiQingZhi } from "@/utils/auth.js"
const route = useRoute()
const particulars = ref()
const showModel = ref(false)
@ -88,7 +97,7 @@ const list = ref([])
const showActions = ref({})
const sfzh = ref()
const ItemData = ref()
const cs=ref(false)//需要删除
const cs = ref(false)//需要删除
onMounted(() => {
sfzh.value = getItem('idEntityCard')
SaveReport()
@ -96,11 +105,11 @@ onMounted(() => {
tbGsxtXxltHfid(route.query.id).then(res => {
ItemData.value = res
particulars.value.init(ItemData.value)
cs.value=true
cs.value = true
})
} else {
cs.value=true
}
cs.value = true
}
})
const SaveReport = () => {
@ -113,7 +122,7 @@ const SaveReport = () => {
total.value = res.total || 0
// 初始化所有操作按钮为隐藏状态
const actions = {}
list.value = data
list.value = data
list.value.forEach((_, index) => {
actions[index] = false
})
@ -156,6 +165,31 @@ const handleDelete = (item) => {
ElMessage({ message: '已取消删除', type: 'info' })
})
}
/** 置顶帖子 */
const handleSetTop = (item) => {
ElMessageBox.confirm(
`确定要置顶帖子「${item.title}」吗?`,
'置顶确认',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}
).then(async () => {
const detail = await tbGsxtXxltHfid(item.id)
detail.sfzd = item.sfzd === 1 ? 0 : 1
tbGsxtXxltUpdate(detail).then(res => {
if (res) {
ElMessage({ message: `帖子「${item.title}」已置顶`, type: 'success' })
SaveReport() // 置顶后刷新列表
} else {
ElMessage({ message: `置顶帖子「${item.title}」失败:${res.msg || '未知错误'}`, type: 'error' })
}
})
}).catch(() => {
ElMessage({ message: '已取消置顶', type: 'info' })
})
}
const load = () => {
if (listQuery.pageCurrent * listQuery.pageSize < total.value) {