feat : 文章管理crud功能完成

This commit is contained in:
2024-09-21 21:59:12 +08:00
parent 090e9a1ea8
commit 4f594b0bfd
7 changed files with 362 additions and 228 deletions

View File

@@ -10,14 +10,14 @@
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {deleteAllocation} from "@/api/expense-manage";
import {deleteArticle} from "@/api/article";
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
const router = useRouter();
const researchFundSearchConfig = reactive([
{
label: '文章标题',
prop: 'projectName',
prop: 'articleTitle',
component: 'el-input',
props: {
placeholder: '请输入文章标题查询',
@@ -28,7 +28,7 @@ const researchFundSearchConfig = reactive([
},
{
label: '文章类型',
prop: 'state',
prop: 'articleType',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择文章类型',
@@ -41,30 +41,17 @@ const researchFundSearchConfig = reactive([
},
{
label: '时间',
prop: 'apportionmentMonth',
prop: 'createTime',
component: 'el-date-picker',
props: {
placeholder: '请选择时间',
clearable: true,
type: 'month',
format: 'YYYY-MM',
valueFormat: "YYYY-MM"
type: 'date',
format: 'YYYY-MM-DD',
valueFormat: "YYYY-MM-DD"
},
colProps: {}
},
{
label: '阅读状态',
prop: 'state',
component: shallowRef(fvSelect),
props: {
placeholder: '请选择阅读状态',
clearable: true,
filterable: true,
checkStrictly: true,
cacheKey: 'read_state',
remote: true
}
},
])
const tableIns = ref()
const researchFundTableConfig = reactive({
@@ -80,41 +67,33 @@ const researchFundTableConfig = reactive({
}
},
{
prop: 'shareName',
prop: 'articleTitle',
label: '文章标题',
align: 'center'
},
{
prop: 'state',
prop: 'articleType',
label: '文章类型',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.state == undefined || row.state == 0) {
if (row.articleType == undefined || row.articleType == null) {
return '--'
} else {
return (<Tag dictType={'article_type'} value={row.state}/>)
return (<Tag dictType={'article_type'} value={row.articleType}/>)
}
}
},
{
prop: 'state',
label: '阅读状态',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
if (row.state == undefined || row.state == 0) {
return '--'
} else {
return (<Tag dictType={'read_state'} value={row.state}/>)
}
}
},
{
prop: 'apportionmentMonth',
prop: 'createTime',
label: '时间',
align: 'center'
},
{
prop: 'remarks',
label: '备注',
align: 'center'
},
{
prop: 'oper',
label: '操作',
@@ -123,12 +102,8 @@ const researchFundTableConfig = reactive({
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = []
let buttons
if (row.buttons) {
buttons = new Set(Array.from(row.buttons))
}
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'})
btn.push({label: '编辑', prem: ['mosr:requirement:resubmit'], func: () => handleEdit(row), type: 'primary'})
btn.push({label: '详情', func: () => handleDetail(row), type: 'primary'})
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
return (
<div style={{width: '100%'}}>
{
@@ -144,16 +119,15 @@ const researchFundTableConfig = reactive({
))
}
{
<popover-delete name={row.shareName} type={'研发投入资金'} btnType={'danger'}
<popover-delete name={row.articleTitle} type={'文章'} btnType={'danger'}
onDelete={() => handleDelete(row)}/>
}
</div>
)
}
}
],
api: '',
api: '/workflow/mosr/article/list',
btns: [
{name: '新增', key: 'add', color: '#DED0B2'}
],
@@ -178,28 +152,28 @@ const headBtnClick = (key) => {
}
const handleAdd = () => {
router.push({
name: 'Share/add',
name: 'Article/add',
query: {}
})
}
const handleDetail = (row) => {
router.push({
name: 'Share/detail',
name: 'Article/detail',
query: {
id: row.allocationId
id: row.articleId
}
})
}
const handleEdit = (row) => {
router.push({
name: 'Share/edit',
name: 'Article/edit',
query: {
id: row.allocationId
id: row.articleId
}
})
}
const handleDelete = (row) => {
deleteAllocation(row.allocationId).then(res => {
deleteArticle(row.articleId).then(res => {
ElNotification({
title: '提示',
message: res.msg,