新增数据,开始安全巡检模块
This commit is contained in:
@@ -173,6 +173,7 @@ async function handleEdit(id: string | number) {
|
||||
// 保存草稿
|
||||
async function handleSave(data: QuestionnaireForm) {
|
||||
try {
|
||||
console.log(data);
|
||||
// 父组件自己调用接口提交
|
||||
if (userid.value) {
|
||||
await updateQuestionnaire({
|
||||
@@ -181,8 +182,7 @@ async function handleSave(data: QuestionnaireForm) {
|
||||
status: '0', // 草稿状态
|
||||
startTime: timedata.value[0],
|
||||
endTime: timedata.value[1],
|
||||
...form.value,
|
||||
villageId: Number(localStorage.getItem('villageid'))
|
||||
...form.value
|
||||
});
|
||||
} else {
|
||||
await addQuestionnaire({
|
||||
@@ -191,8 +191,7 @@ async function handleSave(data: QuestionnaireForm) {
|
||||
status: '0', // 草稿状态
|
||||
startTime: timedata.value[0],
|
||||
endTime: timedata.value[1],
|
||||
...form.value,
|
||||
villageId: Number(localStorage.getItem('villageid'))
|
||||
...form.value
|
||||
});
|
||||
}
|
||||
ElMessage.success('保存成功');
|
||||
@@ -206,23 +205,24 @@ async function handleSave(data: QuestionnaireForm) {
|
||||
// 发布问卷
|
||||
async function handlePublish(data: QuestionnaireForm) {
|
||||
try {
|
||||
console.log(data);
|
||||
if (userid.value) {
|
||||
await updateQuestionnaire({
|
||||
...data,
|
||||
content: JSON.stringify(data.content),
|
||||
status: '1', // 发布状态
|
||||
startTime: timedata.value[0],
|
||||
villageId: Number(localStorage.getItem('villageid')),
|
||||
endTime: timedata.value[1]
|
||||
endTime: timedata.value[1],
|
||||
...form.value
|
||||
});
|
||||
} else {
|
||||
await addQuestionnaire({
|
||||
...data,
|
||||
content: JSON.stringify(data.content),
|
||||
status: '1', // 发布状态
|
||||
endTime: timedata.value[1],
|
||||
startTime: timedata.value[0],
|
||||
villageId: Number(localStorage.getItem('villageid')),
|
||||
endTime: timedata.value[1]
|
||||
...form.value
|
||||
});
|
||||
}
|
||||
ElMessage.success('发布成功');
|
||||
|
||||
@@ -155,7 +155,7 @@ function cloneComponent(component: ComponentItem): QuestionComponentItem {
|
||||
return {
|
||||
cid: Date.now(), // 生成唯一ID
|
||||
type: component.type,
|
||||
title: 'ces',
|
||||
title: '',
|
||||
required: true,
|
||||
options: component.type === 'radio' || component.type === 'checkbox' ? [{ label: '选项1' }, { label: '选项2' }] : []
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<div class="flex flex-col h-full p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card shadow="never">
|
||||
<el-card class="flex-1" shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
@@ -129,7 +129,6 @@ const initFormData: QuestionnaireForm = {
|
||||
const data = reactive<PageData<QuestionnaireForm, QuestionnaireQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
villageId: Number(localStorage.getItem('villageid')),
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
villageId: undefined,
|
||||
@@ -249,3 +248,8 @@ onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-table {
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user