feat(F006): 资讯列表状态列 + 弹窗1200px + 暂存/发布双按钮
This commit is contained in:
parent
00650f487a
commit
34b9a31e0f
@ -24,6 +24,7 @@ interface Info {
|
||||
content: string
|
||||
images: string
|
||||
createTime: string
|
||||
status?: number
|
||||
}
|
||||
|
||||
const list = ref<Info[]>([])
|
||||
@ -54,6 +55,7 @@ const columns = [
|
||||
{ prop: 'id', label: 'ID', width: 90 },
|
||||
{ prop: 'title', label: '资讯标题', minWidth: 260 },
|
||||
{ prop: 'categoryName', label: '分类', width: 120, formatter: (r: Info) => r.categoryName || '--' },
|
||||
{ prop: 'status', label: '状态', width: 90, formatter: (r: Info) => r.status === 0 ? '草稿' : '已发布' },
|
||||
{ prop: 'createTime', label: '发布时间', width: 170 },
|
||||
]
|
||||
|
||||
@ -67,7 +69,7 @@ const imgStyle = computed(() => ({
|
||||
async function load() {
|
||||
loading.value = true
|
||||
try {
|
||||
const params: any = { page: query.page, limit: query.limit }
|
||||
const params: any = { page: query.page, limit: query.limit, status: 'all' }
|
||||
if (search.title.trim()) params.title = search.title.trim()
|
||||
const resp: any = await httpGet('/other/information/page', params)
|
||||
list.value = resp?.list || []
|
||||
@ -113,7 +115,7 @@ function onCategoryChange(id: string) {
|
||||
const c = categories.value.find(x => x.id === id)
|
||||
editForm.categoryName = c?.name || ''
|
||||
}
|
||||
async function submit() {
|
||||
async function submit(status: number) {
|
||||
if (!editForm.title.trim()) { ElMessage.warning('请填写标题'); return }
|
||||
if (!editForm.categoryId) { ElMessage.warning('请选择分类'); return }
|
||||
saving.value = true
|
||||
@ -124,6 +126,7 @@ async function submit() {
|
||||
categoryName: editForm.categoryName,
|
||||
content: richEditorRef.value?.getContent?.() ?? editForm.content,
|
||||
images: editForm.images,
|
||||
status,
|
||||
}
|
||||
if (editMode.value === 'create') {
|
||||
await httpPost('/other/information/save', payload)
|
||||
@ -217,7 +220,7 @@ async function customUpload(opt: any) {
|
||||
</div>
|
||||
|
||||
<!-- 新增/编辑弹窗 -->
|
||||
<el-dialog v-model="dialogVisible" :title="editMode === 'create' ? '新增资讯' : '编辑资讯'" width="640px" destroy-on-close>
|
||||
<el-dialog v-model="dialogVisible" :title="editMode === 'create' ? '新增资讯' : '编辑资讯'" width="1200px" destroy-on-close>
|
||||
<el-form label-width="90px" label-position="right">
|
||||
<el-form-item label="标题" required>
|
||||
<el-input v-model="editForm.title" placeholder="资讯标题" maxlength="50" show-word-limit />
|
||||
@ -246,7 +249,8 @@ async function customUpload(opt: any) {
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="submit">保存</el-button>
|
||||
<el-button :loading="saving" @click="submit(0)">暂存</el-button>
|
||||
<el-button type="primary" :loading="saving" @click="submit(1)">发布</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user