fix : 修复实施图片

This commit is contained in:
2025-07-09 22:56:09 +08:00
parent 64e2ff0647
commit 973dc0f2e4
338 changed files with 62195 additions and 62193 deletions

View File

@@ -1,298 +1,298 @@
<template>
<div v-loading="loading" class="add-block">
<baseTitle title="文章信息录入"></baseTitle>
<el-form :model="formData" ref="fundForm" :rules="rules" style="margin-left: 5px;margin-bottom: -18px">
<el-row gutter="30">
<el-col :span="6" style="margin-left: 10px">
<el-form-item label="文章标题" prop="articleTitle">
<el-input v-model="formData.articleTitle" placeholder="请输入文章标题" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="文章类型" prop="articleType">
<el-select v-model="formData.articleType" placeholder="请选择文章类型" clearable filterable>
<el-option
v-for="item in cacheStore.getDict('article_type')"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="发文单位" prop="remarks">
<el-input v-model="formData.remarks" placeholder="请输入发文单位" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-left: 10px">
<el-form-item label="文章内容" prop="articleContent">
<!-- link-->
<Tinymce v-model:value="formData.articleContent"
imageUrl="/workflow/process/file/upload" :height="500" v-if="showTinymce"
:toolbar="['undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | image axupimgs']"/>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-bottom: -10px">
<el-form-item label="附件上传" prop="" style="margin-left: 20px;">
<file-upload @getFile="getFiles"/>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-left:90px;">
<!-- <el-form-item label="公告附件列表" prop=""-->
<!-- style="display: flex;flex-direction: column;justify-content: flex-start;">-->
<!-- <template #label>-->
<!-- <div style="width: 100%;display: flex;align-items: center;justify-content: flex-start">-->
<!-- <el-icon size="16">-->
<!-- <Paperclip/>-->
<!-- </el-icon>-->
<!-- 公告附件列表-->
<!-- </div>-->
<!-- </template>-->
<el-col :span="24" style="margin-left: -15px">
<div style="display: flex;flex-direction: column">
<div v-for="(item,index) in formData.fileList" style="display: flex;align-items: center;margin-bottom: 5px">
附件{{ index + 1 }} <a :href="item.url" style="color: #409eff;" class="a-style" target="_blank">{{ item.originalFileName }}</a>
<el-icon size="18" style="margin:0 20px;cursor: pointer" color="#409eff" @click="handleDelete(item,index)">
<CircleClose/>
</el-icon>
<el-button type="primary" link @click="handleDownload(item)" style="font-size: 16px;margin-left: 10px">下载</el-button>
</div>
</div>
</el-col>
<!-- </el-form-item>-->
</el-col>
</el-row>
</el-form>
<div class="oper-page-btn">
<el-button color="#DED0B2" v-if="routerName === 'Article/add'" @click="handleSubmit(fundForm)">提交</el-button>
<el-button color="#DED0B2" v-else @click="handleResubmit">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</div>
</div>
</template>
<script setup lang="jsx">
import {ElMessageBox, ElNotification} from "element-plus";
import {addArticle, editArticle, getArticleDetail} from "@/api/article";
import {useTagsView} from '@/stores/tagsview.js'
import {useCacheStore} from "@/stores/cache.js";
import {deleteFile, downloadFile} from "../../api/project-demand";
import FileUpload from "../../components/FileUpload.vue";
import Tinymce from "../../components/Tinymce.vue";
const cacheStore = useCacheStore();
const tagsViewStore = useTagsView()
const router = useRouter()
const route = useRoute()
const loading = ref(false)
const showTinymce = ref(true)
const fundForm = ref()
const formData = ref({
fileList:[]
})
const routerName = ref(router.currentRoute.value.name)
const rules = reactive({
articleTitle: [{required: true, message: '请输入文章标题', trigger: ['blur', 'change']}],
articleType: [{required: true, message: '请输入文章类型', trigger: ['blur', 'change']}],
articleContent: [{required: true, message: '请输入文章内容', trigger: ['blur', 'change']}],
})
const handleDelete = (row,index) => {
ElMessageBox.confirm(`确认删除名称为${row.originalFileName}的文件吗?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteFile(row.fileId).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
formData.value.fileList.splice(index, 1)
}
})
})
}
const handleBack = () => {
history.back()
}
const getFiles = (val) => {
console.log("🚀 ~ file:val ", val)
val.originalFileName=val.originalFilename
let file = compositeParam(val)
formData.value.fileList.push(file)
}
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
const submitParam = (item) => {
console.log("🚀 ~ file:item.fileList ", item.fileList)
item.fileList= item.fileList.map((it)=>{
return {
...it,
articleId:item.articleId
}
})
return {
articleContent: item.articleContent,
articleTitle: item.articleTitle,
articleType: item.articleType,
remarks: item.remarks,
articleId: item.articleId,
fileList: item.fileList
}
}
const compositeParam = (item) => {
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: 'article'
}
}
const handleSubmit = async (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) {
ElNotification({
title: '提示',
message: '请完善数据,再提交!',
type: 'error'
})
return;
}
const {msg, code} = await addArticle(submitParam(formData.value))
ElNotification({
title: '提示',
message: msg,
type: code === 1000 ? 'success' : 'error'
})
if (code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Manage'
})
}
})
}
const handleResubmit = () => {
if (!route.query.id) return
let params = {
articleId: route.query.id,
...submitParam(formData.value)
}
console.log('params', params)
editArticle(params).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Manage'
})
}
})
}
const getDetailInfo = async () => {
loading.value = true
getArticleDetail(route.query.id).then(res => {
if (res.code === 1000) {
formData.value = res.data
loading.value = false
showTinymce.value = false
nextTick(() => {
showTinymce.value = true
})
} else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
onMounted(async () => {
if (route.query.id) {
await getDetailInfo()
}
})
</script>
<style scoped lang="scss">
.a-style:hover{
text-decoration: underline !important;
}
.company-select {
:deep(.el-form-item__content .el-select__wrapper ) {
width: 750px;
}
.company-style {
//width: 98%;
min-height: 30px;
max-height: 60px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.company {
color: #fff;
height: auto;
}
}
:deep(.el-table--fit ) {
height: 300px !important;
}
.add-block {
padding: 0 30px;
}
:deep(.el-input-number) {
width: 88.5%;
.el-input__wrapper {
padding: 1px 11px !important;
}
.el-input__inner {
text-align: left;
}
}
:deep(.el-table__header) {
.is-leaf:first-child {
.cell {
margin-left: -20px !important;
}
}
}
:deep(.el-table__body) {
.el-table__cell:first-child {
.cell {
margin-left: -10px !important;
}
}
}
</style>
<template>
<div v-loading="loading" class="add-block">
<baseTitle title="文章信息录入"></baseTitle>
<el-form :model="formData" ref="fundForm" :rules="rules" style="margin-left: 5px;margin-bottom: -18px">
<el-row gutter="30">
<el-col :span="6" style="margin-left: 10px">
<el-form-item label="文章标题" prop="articleTitle">
<el-input v-model="formData.articleTitle" placeholder="请输入文章标题" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="文章类型" prop="articleType">
<el-select v-model="formData.articleType" placeholder="请选择文章类型" clearable filterable>
<el-option
v-for="item in cacheStore.getDict('article_type')"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="发文单位" prop="remarks">
<el-input v-model="formData.remarks" placeholder="请输入发文单位" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-left: 10px">
<el-form-item label="文章内容" prop="articleContent">
<!-- link-->
<Tinymce v-model:value="formData.articleContent"
imageUrl="/workflow/process/file/upload" :height="500" v-if="showTinymce"
:toolbar="['undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | image axupimgs']"/>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-bottom: -10px">
<el-form-item label="附件上传" prop="" style="margin-left: 20px;">
<file-upload @getFile="getFiles"/>
</el-form-item>
</el-col>
<el-col :span="24" style="margin-left:90px;">
<!-- <el-form-item label="公告附件列表" prop=""-->
<!-- style="display: flex;flex-direction: column;justify-content: flex-start;">-->
<!-- <template #label>-->
<!-- <div style="width: 100%;display: flex;align-items: center;justify-content: flex-start">-->
<!-- <el-icon size="16">-->
<!-- <Paperclip/>-->
<!-- </el-icon>-->
<!-- 公告附件列表-->
<!-- </div>-->
<!-- </template>-->
<el-col :span="24" style="margin-left: -15px">
<div style="display: flex;flex-direction: column">
<div v-for="(item,index) in formData.fileList" style="display: flex;align-items: center;margin-bottom: 5px">
附件{{ index + 1 }} <a :href="item.url" style="color: #409eff;" class="a-style" target="_blank">{{ item.originalFileName }}</a>
<el-icon size="18" style="margin:0 20px;cursor: pointer" color="#409eff" @click="handleDelete(item,index)">
<CircleClose/>
</el-icon>
<el-button type="primary" link @click="handleDownload(item)" style="font-size: 16px;margin-left: 10px">下载</el-button>
</div>
</div>
</el-col>
<!-- </el-form-item>-->
</el-col>
</el-row>
</el-form>
<div class="oper-page-btn">
<el-button color="#DED0B2" v-if="routerName === 'Article/add'" @click="handleSubmit(fundForm)">提交</el-button>
<el-button color="#DED0B2" v-else @click="handleResubmit">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</div>
</div>
</template>
<script setup lang="jsx">
import {ElMessageBox, ElNotification} from "element-plus";
import {addArticle, editArticle, getArticleDetail} from "@/api/article";
import {useTagsView} from '@/stores/tagsview.js'
import {useCacheStore} from "@/stores/cache.js";
import {deleteFile, downloadFile} from "../../api/project-demand";
import FileUpload from "../../components/FileUpload.vue";
import Tinymce from "../../components/Tinymce.vue";
const cacheStore = useCacheStore();
const tagsViewStore = useTagsView()
const router = useRouter()
const route = useRoute()
const loading = ref(false)
const showTinymce = ref(true)
const fundForm = ref()
const formData = ref({
fileList:[]
})
const routerName = ref(router.currentRoute.value.name)
const rules = reactive({
articleTitle: [{required: true, message: '请输入文章标题', trigger: ['blur', 'change']}],
articleType: [{required: true, message: '请输入文章类型', trigger: ['blur', 'change']}],
articleContent: [{required: true, message: '请输入文章内容', trigger: ['blur', 'change']}],
})
const handleDelete = (row,index) => {
ElMessageBox.confirm(`确认删除名称为${row.originalFileName}的文件吗?`, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteFile(row.fileId).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
formData.value.fileList.splice(index, 1)
}
})
})
}
const handleBack = () => {
history.back()
}
const getFiles = (val) => {
console.log("🚀 ~ file:val ", val)
val.originalFileName=val.originalFilename
let file = compositeParam(val)
formData.value.fileList.push(file)
}
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
const submitParam = (item) => {
console.log("🚀 ~ file:item.fileList ", item.fileList)
item.fileList= item.fileList.map((it)=>{
return {
...it,
articleId:item.articleId
}
})
return {
articleContent: item.articleContent,
articleTitle: item.articleTitle,
articleType: item.articleType,
remarks: item.remarks,
articleId: item.articleId,
fileList: item.fileList
}
}
const compositeParam = (item) => {
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
newFile: true,
tag: 'article'
}
}
const handleSubmit = async (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) {
ElNotification({
title: '提示',
message: '请完善数据,再提交!',
type: 'error'
})
return;
}
const {msg, code} = await addArticle(submitParam(formData.value))
ElNotification({
title: '提示',
message: msg,
type: code === 1000 ? 'success' : 'error'
})
if (code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Manage'
})
}
})
}
const handleResubmit = () => {
if (!route.query.id) return
let params = {
articleId: route.query.id,
...submitParam(formData.value)
}
console.log('params', params)
editArticle(params).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Manage'
})
}
})
}
const getDetailInfo = async () => {
loading.value = true
getArticleDetail(route.query.id).then(res => {
if (res.code === 1000) {
formData.value = res.data
loading.value = false
showTinymce.value = false
nextTick(() => {
showTinymce.value = true
})
} else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
onMounted(async () => {
if (route.query.id) {
await getDetailInfo()
}
})
</script>
<style scoped lang="scss">
.a-style:hover{
text-decoration: underline !important;
}
.company-select {
:deep(.el-form-item__content .el-select__wrapper ) {
width: 750px;
}
.company-style {
//width: 98%;
min-height: 30px;
max-height: 60px;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: 2;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.company {
color: #fff;
height: auto;
}
}
:deep(.el-table--fit ) {
height: 300px !important;
}
.add-block {
padding: 0 30px;
}
:deep(.el-input-number) {
width: 88.5%;
.el-input__wrapper {
padding: 1px 11px !important;
}
.el-input__inner {
text-align: left;
}
}
:deep(.el-table__header) {
.is-leaf:first-child {
.cell {
margin-left: -20px !important;
}
}
}
:deep(.el-table__body) {
.el-table__cell:first-child {
.cell {
margin-left: -10px !important;
}
}
}
</style>

View File

@@ -1,152 +1,152 @@
<template>
<div v-loading="loading" class="article-detail">
<el-form :model="formData">
<h2 class="article-title">{{ formData.articleTitle }}</h2>
<div class="article-title">
<Tag dictType="article_type" :value="formData.articleType"/>
<span>{{ formData.articleTime }}</span>
<span>发文单位{{ formData.remarks }}</span>
</div>
<el-row gutter="20">
<el-col :span="24">
<el-form-item>
<div class="article-a" v-html="formData.articleContent" @click="clickHandle"></div>
</el-form-item>
</el-col>
<el-col :span="24">
<div style="display: flex;flex-direction: column">
<div v-for="(item,index) in formData.fileList" style="display: flex;align-items: center;margin-bottom: 5px">
附件{{ index + 1 }} <a :href="item.url" style="color: #409eff;" class="a-style" target="_blank">{{ item.originalFileName }}</a>
<el-button type="primary" link @click="handleDownload(item)" style="font-size: 16px;margin-left: 10px">下载</el-button>
</div>
</div>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script setup>
import {ElLoading, ElNotification} from "element-plus";
import {getArticleDetail} from "@/api/article";
import {downloadFile} from "@/api/project-demand";
const loading = ref(false)
const formData = ref({})
const route = useRoute()
const clickHandle = (e) => {
if (e.target.nodeName == "A") {
e.preventDefault()
let url = e.target.href.split('?')[0];
const searchParams = new URLSearchParams(e.target.href.split('?')[1])
const fileId = searchParams.get('fileId');
const fileName = searchParams.get('fileName');
// if(localStorage.getItem("fileUrlList")){
// let fileUrlList=JSON.parse(localStorage.getItem("fileUrlList"));
// fileUrlList.forEach(item=>{
// if(item.url == e.target.href){
// console.info("🚀 ~method:item -----", item)
let item = {
url,
fileName
}
// handleDownload(fileId,fileName)
// download(item)
// }else {
// e.preventDefault()
// }
// })
// }
}
}
// const handleDownload = (fileId,fileName) => {
// const loading = ElLoading.service({fullscreen: true})
// downloadFile(fileId).then(res => {
// const blob = new Blob([res])
// let a = document.createElement('a')
// a.href = URL.createObjectURL(blob)
// nextTick(() => {
// a.download = fileName
// a.click()
// loading.close()
// })
// })
// }
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
const download = (row) => {
const x = new window.XMLHttpRequest();
x.open('GET', row.url, true);
x.responseType = 'blob';
x.onload = () => {
const url = window.URL.createObjectURL(x.response);
const a = document.createElement('a');
a.href = url;
a.download = row.fileName;
a.click();
window.open(row.url,'_blank')
};
x.send();
}
const getDetailInfo = async () => {
loading.value = true
getArticleDetail(route.query.id).then(res => {
if (res.code === 1000) {
formData.value = res.data
loading.value = false
} else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
onMounted(async () => {
if (route.query.id) {
await getDetailInfo()
}
})
</script>
<style lang="scss">
.article-a {
a {
color: #409eff !important;
&:hover {
text-decoration: underline !important;
}
}
}
</style>
<style scoped lang="scss">
.a-style:hover{
text-decoration: underline !important;
}
.article-detail {
padding: 0 30px;
padding-top: 15px;
width: 100%;
height: 100%;
.article-title {
display: flex;
justify-content: center;
align-items: center;
> span:nth-child(2) {
margin: 15px;
}
}
}
</style>
<template>
<div v-loading="loading" class="article-detail">
<el-form :model="formData">
<h2 class="article-title">{{ formData.articleTitle }}</h2>
<div class="article-title">
<Tag dictType="article_type" :value="formData.articleType"/>
<span>{{ formData.articleTime }}</span>
<span>发文单位{{ formData.remarks }}</span>
</div>
<el-row gutter="20">
<el-col :span="24">
<el-form-item>
<div class="article-a" v-html="formData.articleContent" @click="clickHandle"></div>
</el-form-item>
</el-col>
<el-col :span="24">
<div style="display: flex;flex-direction: column">
<div v-for="(item,index) in formData.fileList" style="display: flex;align-items: center;margin-bottom: 5px">
附件{{ index + 1 }} <a :href="item.url" style="color: #409eff;" class="a-style" target="_blank">{{ item.originalFileName }}</a>
<el-button type="primary" link @click="handleDownload(item)" style="font-size: 16px;margin-left: 10px">下载</el-button>
</div>
</div>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script setup>
import {ElLoading, ElNotification} from "element-plus";
import {getArticleDetail} from "@/api/article";
import {downloadFile} from "@/api/project-demand";
const loading = ref(false)
const formData = ref({})
const route = useRoute()
const clickHandle = (e) => {
if (e.target.nodeName == "A") {
e.preventDefault()
let url = e.target.href.split('?')[0];
const searchParams = new URLSearchParams(e.target.href.split('?')[1])
const fileId = searchParams.get('fileId');
const fileName = searchParams.get('fileName');
// if(localStorage.getItem("fileUrlList")){
// let fileUrlList=JSON.parse(localStorage.getItem("fileUrlList"));
// fileUrlList.forEach(item=>{
// if(item.url == e.target.href){
// console.info("🚀 ~method:item -----", item)
let item = {
url,
fileName
}
// handleDownload(fileId,fileName)
// download(item)
// }else {
// e.preventDefault()
// }
// })
// }
}
}
// const handleDownload = (fileId,fileName) => {
// const loading = ElLoading.service({fullscreen: true})
// downloadFile(fileId).then(res => {
// const blob = new Blob([res])
// let a = document.createElement('a')
// a.href = URL.createObjectURL(blob)
// nextTick(() => {
// a.download = fileName
// a.click()
// loading.close()
// })
// })
// }
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href = URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
const download = (row) => {
const x = new window.XMLHttpRequest();
x.open('GET', row.url, true);
x.responseType = 'blob';
x.onload = () => {
const url = window.URL.createObjectURL(x.response);
const a = document.createElement('a');
a.href = url;
a.download = row.fileName;
a.click();
window.open(row.url,'_blank')
};
x.send();
}
const getDetailInfo = async () => {
loading.value = true
getArticleDetail(route.query.id).then(res => {
if (res.code === 1000) {
formData.value = res.data
loading.value = false
} else {
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
})
}
onMounted(async () => {
if (route.query.id) {
await getDetailInfo()
}
})
</script>
<style lang="scss">
.article-a {
a {
color: #409eff !important;
&:hover {
text-decoration: underline !important;
}
}
}
</style>
<style scoped lang="scss">
.a-style:hover{
text-decoration: underline !important;
}
.article-detail {
padding: 0 30px;
padding-top: 15px;
width: 100%;
height: 100%;
.article-title {
display: flex;
justify-content: center;
align-items: center;
> span:nth-child(2) {
margin: 15px;
}
}
}
</style>

View File

@@ -1,239 +1,239 @@
<template>
<fvSearchForm :searchConfig="articleSearchConfig" @search="searchArticle" searchProp="articleType" :searchValue="routeArticleType"
style="margin-left: 16px"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="articleTableConfig" @headBtnClick="headBtnClick">
<template #empty>
<el-empty description="暂无数据"/>
</template>
</fvTable>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {deleteArticle} from "@/api/article";
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
const router = useRouter();
const route = useRoute();
const routeArticleType = ref(route.query.type)
const articleSearchConfig = reactive([
{
label: '文章标题',
prop: 'articleTitle',
component: 'el-input',
props: {
placeholder: '请输入文章标题查询',
clearable: true,
filterable: true,
checkStrictly: true
}
},
{
label: '文章类型',
prop: 'articleType',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择文章类型',
clearable: true,
filterable: true,
checkStrictly: true,
cacheKey: 'article_type',
remote: true
}
},
{
label: '时间',
prop: 'articleTime',
component: 'el-date-picker',
props: {
placeholder: '请选择时间',
clearable: true,
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: "YYYY-MM-DD"
},
colProps: {}
},
])
const tableIns = ref()
const articleTableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: 85,
index: index => {
return (tableIns.value.getQuery().pageNum - 1) * tableIns.value.getQuery().pageSize + index + 1
}
},
{
prop: 'articleTitle',
label: '文章标题',
align: 'center'
},
{
prop: 'articleType',
label: '文章类型',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.articleType == undefined || row.articleType == null) {
return '--'
} else {
return (<Tag dictType={'article_type'} value={row.articleType}/>)
}
}
},
{
prop: 'articleTime',
label: '时间',
align: 'center'
},
{
prop: 'remarks',
label: '发文单位',
align: 'center',
currentRender: ({row, index}) => {
if (!row.remarks|| row.remarks == undefined || row.remarks == null) {
return '--'
} else {
return row.remarks
}
}
},
{
prop: 'oper',
label: '操作',
align: 'center',
fixed: 'right',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = []
btn.push({label: '详情', func: () => handleDetail(row), type: 'primary'})
btn.push({label: '编辑', prem: ['mosr:article:edit'], func: () => handleEdit(row), type: 'primary'})
return (
<div style={{width: '100%'}}>
{
btn.map(item => (
item.prem ?
<el-button
type={item.type}
v-perm={item.prem}
onClick={() => item.func()}
link
>
{item.label}
</el-button> :
<el-button
type={item.type}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
{
<popover-delete name={row.articleTitle} type={'文章'} btnType={'danger'} perm={['mosr:article:del']}
onDelete={() => handleDelete(row)}/>
}
</div>
)
}
}
],
api: '/workflow/mosr/article/list',
btns: [
{name: '新增', key: 'add', color: '#DED0B2', auth: ['mosr:article:add']}
],
params: {}
})
const searchArticle = (val) => {
let obj = {...val}
if (obj.dateValue) {
obj.startGenerationTime = obj.dateValue[0]
obj.endGenerationTime = obj.dateValue[1]
delete obj.dateValue
}
articleTableConfig.params = obj
tableIns.value.refresh()
}
const init = async () => {
if(routeArticleType.value){
nextTick(()=>{
console.info("🚀 ~method:articleSearchConfig -----", articleSearchConfig[1].component.props)
searchArticle({articleType:routeArticleType.value})
})
}
}
init()
const headBtnClick = (key) => {
switch (key) {
case 'add':
handleAdd()
break;
}
}
const handleAdd = () => {
router.push({
name: 'Article/add',
query: {}
})
}
const handleDetail = (row) => {
router.push({
name: 'Article/detail',
query: {
id: row.articleId
}
})
}
const handleEdit = (row) => {
router.push({
name: 'Article/edit',
query: {
id: row.articleId
}
})
}
const handleDelete = (row) => {
deleteArticle(row.articleId).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tableIns.value.refresh()
}
});
}
</script>
<style scoped lang="scss">
:deep(.el-table__header) {
.is-leaf:first-child {
.cell {
margin-left: -25px !important;
}
}
}
:deep(.el-table__body) {
.el-table__cell:first-child {
.cell {
margin-left: -13px !important;
}
}
}
:deep(.el-date-editor--month) {
width: 100%;
}
</style>
<template>
<fvSearchForm :searchConfig="articleSearchConfig" @search="searchArticle" searchProp="articleType" :searchValue="routeArticleType"
style="margin-left: 16px"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="articleTableConfig" @headBtnClick="headBtnClick">
<template #empty>
<el-empty description="暂无数据"/>
</template>
</fvTable>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {deleteArticle} from "@/api/article";
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
const router = useRouter();
const route = useRoute();
const routeArticleType = ref(route.query.type)
const articleSearchConfig = reactive([
{
label: '文章标题',
prop: 'articleTitle',
component: 'el-input',
props: {
placeholder: '请输入文章标题查询',
clearable: true,
filterable: true,
checkStrictly: true
}
},
{
label: '文章类型',
prop: 'articleType',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择文章类型',
clearable: true,
filterable: true,
checkStrictly: true,
cacheKey: 'article_type',
remote: true
}
},
{
label: '时间',
prop: 'articleTime',
component: 'el-date-picker',
props: {
placeholder: '请选择时间',
clearable: true,
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: "YYYY-MM-DD"
},
colProps: {}
},
])
const tableIns = ref()
const articleTableConfig = reactive({
columns: [
{
prop: 'index',
type: 'index',
label: '序号',
align: 'center',
width: 85,
index: index => {
return (tableIns.value.getQuery().pageNum - 1) * tableIns.value.getQuery().pageSize + index + 1
}
},
{
prop: 'articleTitle',
label: '文章标题',
align: 'center'
},
{
prop: 'articleType',
label: '文章类型',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.articleType == undefined || row.articleType == null) {
return '--'
} else {
return (<Tag dictType={'article_type'} value={row.articleType}/>)
}
}
},
{
prop: 'articleTime',
label: '时间',
align: 'center'
},
{
prop: 'remarks',
label: '发文单位',
align: 'center',
currentRender: ({row, index}) => {
if (!row.remarks|| row.remarks == undefined || row.remarks == null) {
return '--'
} else {
return row.remarks
}
}
},
{
prop: 'oper',
label: '操作',
align: 'center',
fixed: 'right',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = []
btn.push({label: '详情', func: () => handleDetail(row), type: 'primary'})
btn.push({label: '编辑', prem: ['mosr:article:edit'], func: () => handleEdit(row), type: 'primary'})
return (
<div style={{width: '100%'}}>
{
btn.map(item => (
item.prem ?
<el-button
type={item.type}
v-perm={item.prem}
onClick={() => item.func()}
link
>
{item.label}
</el-button> :
<el-button
type={item.type}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
{
<popover-delete name={row.articleTitle} type={'文章'} btnType={'danger'} perm={['mosr:article:del']}
onDelete={() => handleDelete(row)}/>
}
</div>
)
}
}
],
api: '/workflow/mosr/article/list',
btns: [
{name: '新增', key: 'add', color: '#DED0B2', auth: ['mosr:article:add']}
],
params: {}
})
const searchArticle = (val) => {
let obj = {...val}
if (obj.dateValue) {
obj.startGenerationTime = obj.dateValue[0]
obj.endGenerationTime = obj.dateValue[1]
delete obj.dateValue
}
articleTableConfig.params = obj
tableIns.value.refresh()
}
const init = async () => {
if(routeArticleType.value){
nextTick(()=>{
console.info("🚀 ~method:articleSearchConfig -----", articleSearchConfig[1].component.props)
searchArticle({articleType:routeArticleType.value})
})
}
}
init()
const headBtnClick = (key) => {
switch (key) {
case 'add':
handleAdd()
break;
}
}
const handleAdd = () => {
router.push({
name: 'Article/add',
query: {}
})
}
const handleDetail = (row) => {
router.push({
name: 'Article/detail',
query: {
id: row.articleId
}
})
}
const handleEdit = (row) => {
router.push({
name: 'Article/edit',
query: {
id: row.articleId
}
})
}
const handleDelete = (row) => {
deleteArticle(row.articleId).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
tableIns.value.refresh()
}
});
}
</script>
<style scoped lang="scss">
:deep(.el-table__header) {
.is-leaf:first-child {
.cell {
margin-left: -25px !important;
}
}
}
:deep(.el-table__body) {
.el-table__cell:first-child {
.cell {
margin-left: -13px !important;
}
}
}
:deep(.el-date-editor--month) {
width: 100%;
}
</style>