完成调查问卷
This commit is contained in:
@@ -41,31 +41,50 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="标题" align="center" prop="titile" />
|
||||
<el-table-column label="作者" align="center" prop="author" />
|
||||
<el-table-column label="发布状态 0未发布 1已发布" align="center" prop="status" />
|
||||
<el-table-column label="发布状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<DictTag :value="scope.row.status" :options="com_publish_status"></DictTag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="浏览量" align="center" prop="pageViews" />
|
||||
<el-table-column label="发布人" align="center" prop="createName" />
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<el-table-column label="操作" align="center" width="300px" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-tooltip content="修改" placement="top">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['activity:activity:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['activity:activity:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-button v-if="scope.row.status === '0'" link type="primary" @click="handleSend(scope.row)">发布</el-button>
|
||||
<el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['activity:activity:edit']">修改</el-button>
|
||||
<el-button link type="primary" @click="handleDelete(scope.row)" v-hasPermi="['activity:activity:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
|
||||
<el-form ref="activityFormRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="发布人姓名" prop="createName">
|
||||
<el-input v-model="form.createName" placeholder="请输入发布人姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发布后状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="item in com_publish_status" :key="item.value" :label="item.label" :value="item.value"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Activity" lang="ts">
|
||||
import { listActivity, getActivity, delActivity, addActivity, updateActivity } from '@/api/system/Activity/index';
|
||||
import { listActivity, delActivity, updateActivity } from '@/api/system/Activity/index';
|
||||
import { ActivityVO, ActivityQuery, ActivityForm } from '@/api/system/Activity/type';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_publish_status } = toRefs<any>(proxy?.useDict('com_publish_status'));
|
||||
|
||||
const activityList = ref<ActivityVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
@@ -81,7 +100,7 @@ const activityFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
title: '发布活动'
|
||||
});
|
||||
|
||||
const initFormData: ActivityForm = {
|
||||
@@ -107,7 +126,7 @@ const data = reactive<PageData<ActivityForm, ActivityQuery>>({
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '活动管理表id不能为空', trigger: 'blur' }]
|
||||
createName: [{ required: true, message: '发布人姓名不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -121,7 +140,15 @@ const getList = async () => {
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 发布按钮 */
|
||||
const handleSend = (row: ActivityVO) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...row
|
||||
};
|
||||
console.log(form.value);
|
||||
dialog.visible = true;
|
||||
};
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
@@ -173,13 +200,10 @@ const handleUpdate = async (row?: ActivityVO) => {
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
activityFormRef.value?.validate(async (valid: boolean) => {
|
||||
console.log(valid);
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateActivity(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addActivity(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
await updateActivity(form.value).finally(() => (buttonLoading.value = false));
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
|
||||
Reference in New Issue
Block a user