feat:情报论坛-市情报指有置顶功能
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
getItem,
|
getItem,
|
||||||
setItem
|
setItem
|
||||||
} from '@/utils/storage';
|
} from '@/utils/storage';
|
||||||
import {
|
import {
|
||||||
TOKEN_TIMEOUT_VSLUE,
|
TOKEN_TIMEOUT_VSLUE,
|
||||||
TIME_STAMP
|
TIME_STAMP
|
||||||
@ -75,3 +75,9 @@ export function spliceString(targetArr){
|
|||||||
}
|
}
|
||||||
return currentStr
|
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'
|
||||||
|
}
|
||||||
|
|||||||
@ -21,7 +21,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="post-images">
|
<div class="post-images">
|
||||||
<div class="image-list">
|
<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>
|
<el-image :src="setAddress(img)" show-progress>
|
||||||
<template #error>
|
<template #error>
|
||||||
<div class="image-slot error">
|
<div class="image-slot error">
|
||||||
@ -34,7 +35,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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-button type="text" size="small" class="action-btn edit-btn" @click.stop="handleEdit(item)">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Edit />
|
<Edit />
|
||||||
@ -45,6 +46,12 @@
|
|||||||
<Delete />
|
<Delete />
|
||||||
</el-icon> 删除
|
</el-icon> 删除
|
||||||
</el-button>
|
</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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -63,19 +70,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<Release v-model="showModel" :ItemData="ItemData" @SaveReport="SaveReport" title="帖子发布" :showCancel="false"
|
<Release v-model="showModel" :ItemData="ItemData" @SaveReport="SaveReport" title="帖子发布" :showCancel="false"
|
||||||
:heightNumber="436"></Release>
|
:heightNumber="436"></Release>
|
||||||
<Particulars ref="particulars"/>
|
<Particulars ref="particulars" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import Release from './release.vue'
|
import Release from './release.vue'
|
||||||
import { setAddress } from '@/utils/tools'
|
import { setAddress } from '@/utils/tools'
|
||||||
import { ref, reactive, onMounted } from 'vue'
|
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 { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
import { Edit, Delete, Document } from '@element-plus/icons-vue'
|
import { Edit, Delete, Document } from '@element-plus/icons-vue'
|
||||||
import { getItem } from '@/utils/storage.js'
|
import { getItem } from '@/utils/storage.js'
|
||||||
import Particulars from "./particulars.vue";
|
import Particulars from "./particulars.vue";
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
|
import { isShiQingZhi } from "@/utils/auth.js"
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const particulars = ref()
|
const particulars = ref()
|
||||||
const showModel = ref(false)
|
const showModel = ref(false)
|
||||||
@ -88,7 +97,7 @@ const list = ref([])
|
|||||||
const showActions = ref({})
|
const showActions = ref({})
|
||||||
const sfzh = ref()
|
const sfzh = ref()
|
||||||
const ItemData = ref()
|
const ItemData = ref()
|
||||||
const cs=ref(false)//需要删除
|
const cs = ref(false)//需要删除
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
sfzh.value = getItem('idEntityCard')
|
sfzh.value = getItem('idEntityCard')
|
||||||
SaveReport()
|
SaveReport()
|
||||||
@ -96,11 +105,11 @@ onMounted(() => {
|
|||||||
tbGsxtXxltHfid(route.query.id).then(res => {
|
tbGsxtXxltHfid(route.query.id).then(res => {
|
||||||
ItemData.value = res
|
ItemData.value = res
|
||||||
particulars.value.init(ItemData.value)
|
particulars.value.init(ItemData.value)
|
||||||
cs.value=true
|
cs.value = true
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
cs.value=true
|
cs.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
const SaveReport = () => {
|
const SaveReport = () => {
|
||||||
@ -113,7 +122,7 @@ const SaveReport = () => {
|
|||||||
total.value = res.total || 0
|
total.value = res.total || 0
|
||||||
// 初始化所有操作按钮为隐藏状态
|
// 初始化所有操作按钮为隐藏状态
|
||||||
const actions = {}
|
const actions = {}
|
||||||
list.value = data
|
list.value = data
|
||||||
list.value.forEach((_, index) => {
|
list.value.forEach((_, index) => {
|
||||||
actions[index] = false
|
actions[index] = false
|
||||||
})
|
})
|
||||||
@ -156,6 +165,31 @@ const handleDelete = (item) => {
|
|||||||
ElMessage({ message: '已取消删除', type: 'info' })
|
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 = () => {
|
const load = () => {
|
||||||
|
|
||||||
if (listQuery.pageCurrent * listQuery.pageSize < total.value) {
|
if (listQuery.pageCurrent * listQuery.pageSize < total.value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user