This commit is contained in:
helen 2024-12-24 16:06:13 +08:00
parent b8f643abe0
commit b0665d6d40

View File

@ -87,29 +87,30 @@
<el-table-column label="发布状态" align="center" prop="status">
<template #default="scope">
<el-tag v-if="scope.row.status == 0" type="info">未发布</el-tag>
<el-tag v-if="scope.row.status == 1" type="success">审核中</el-tag>
<el-tag v-if="scope.row.status == 2" type="primary">发布</el-tag>
<el-tag v-if="scope.row.status == 1" type="warning">草稿</el-tag>
<el-tag v-if="scope.row.status == 2" type="success">审核中</el-tag>
<el-tag v-if="scope.row.status == 3" type="primary">已发布</el-tag>
<!-- <image-preview :src="scope.row.productImageUrl" /> -->
</template>
</el-table-column>
<el-table-column label="操作人" align="center" prop="updateByName" show-overflow-tooltip />
<el-table-column label="操作时间" align="center" prop="updateTime" width="200px" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150px" >
<template #default="scope">
<el-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="handleUpdate(scope.row)"
<el-button v-if="scope.row.status == 0||scope.row.status == 1" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="handleUpdate(scope.row)"
>编辑</el-button
>
<el-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="fabudata(scope.row)"
<el-button v-if="scope.row.status == 0" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="fabudata(scope.row)"
>发布</el-button
>
<el-button v-if="scope.row.status == 2" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="fabudata(scope.row)"
<el-button v-if="scope.row.status == 3" v-hasPermi="['manage:notebook:edit']" link type="primary" @click="fabudata(scope.row)"
>撤销发布</el-button
>
<!-- <el-tooltip content="发布" placement="top">-->
<!-- <el-button v-hasPermi="['manage:notebook:edit']" link type="primary" icon="Edit" @click="handleUpdate(scope.row)"></el-button>-->
<!-- </el-tooltip>-->
<el-button v-if="scope.row.status != 2" v-hasPermi="['manage:notebook:remove']" link type="primary" @click="handleDelete(scope.row)"
<el-button v-if="scope.row.status == 0||scope.row.status == 1" v-hasPermi="['manage:notebook:remove']" link type="primary" @click="handleDelete(scope.row)"
>删除</el-button
>
</template>
@ -145,11 +146,11 @@
<div style="display: flex; justify-content: space-between">
<div>
<el-button :loading="buttonLoading" type="primary" @click="yulansave"> </el-button>
<el-button @click="cancel">存草稿</el-button>
<el-button @click="submitForm('1')">存草稿</el-button>
</div>
<div>
<el-button @click="cancel"> </el-button>
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button :loading="buttonLoading" type="primary" @click="submitForm('3')"> </el-button>
</div>
</div>
</template>
@ -222,20 +223,12 @@ const props = defineProps({
});
const addressvalue = ref('');
const statusoptions = [
{
value: '1',
label: '审核中'
},
{
value: '2',
label: '已发布'
},
{
value: '0',
label: '未发布'
}
];
const statusoptions = ref([
{ label: '已发布', value: 3 },
{ label: '审核中', value: 2 },
{ label: '未发布', value: 0 },
{ label: '草稿', value: 1 }
]);
const dialog = reactive<DialogOption>({
visible: false,
title: ''
@ -418,12 +411,24 @@ const contenttext = async (row?: NotebookVO) => {
concentdialog.visible = true;
};
/** 提交按钮 */
const submitForm = () => {
const submitForm = async(type) => {
form.value.tagId = tagvalue.value.join(',');
form.value.location = addressvalue.value.join(',');
form.value.cover = '';
form.value.status = 1;
form.value.status = Number(type);
form.value.content = form.value.content == '<p><br></p>' ? '' : form.value.content;
if(type == 1){
buttonLoading.value = true;
if (form.value.id) {
await updateNotebook(form.value).finally(() => (buttonLoading.value = false));
} else {
await addNotebook(form.value).finally(() => (buttonLoading.value = false));
}
console.log(form.value.cover);
proxy?.$modal.msgSuccess('操作成功');
await getList();
}else{
notebookFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
@ -439,6 +444,9 @@ const submitForm = () => {
await getList();
}
});
}
};
/** 删除按钮操作 */