|
@ -7,39 +7,22 @@ |
|
|
<a-space style="margin-left: 16px;"> |
|
|
<a-space style="margin-left: 16px;"> |
|
|
<a-button @click="classticSearch">查询</a-button> |
|
|
<a-button @click="classticSearch">查询</a-button> |
|
|
<a-button type="primary" ghost @click="openModal('add')">新增</a-button> |
|
|
<a-button type="primary" ghost @click="openModal('add')">新增</a-button> |
|
|
<a-modal v-model:open="formOpen" title="Basic Modal" cancelText="取消" okText="确定" @ok="formModal"> |
|
|
<ClassticFormView/> |
|
|
<a-form :model="classticform" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"> |
|
|
|
|
|
<a-form-item label="语录标题" name="header" |
|
|
|
|
|
:rules="[{ required: true, message: 'Please input your username!' }]"> |
|
|
|
|
|
<a-input v-model:value="classticform.header" /> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
<a-form-item label="语录内容" name="text" |
|
|
|
|
|
:rules="[{ required: true, message: 'Please input your username!' }]"> |
|
|
|
|
|
<a-input v-model:value="classticform.text" /> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
<a-form-item label="备注" name="descr" |
|
|
|
|
|
:rules="[{ required: true, message: 'Please input your username!' }]"> |
|
|
|
|
|
<a-input v-model:value="classticform.descr" /> |
|
|
|
|
|
</a-form-item> |
|
|
|
|
|
</a-form> |
|
|
|
|
|
</a-modal> |
|
|
|
|
|
</a-space> |
|
|
</a-space> |
|
|
</div> |
|
|
</div> |
|
|
<div class="table"> |
|
|
<div class="table"> |
|
|
<a-table bordered :data-source="classticContent.classticlist" :columns="columns"> |
|
|
<a-table bordered :data-source="classticlist" :columns="columns"> |
|
|
<template #bodyCell="{ column, record }"> |
|
|
<template #bodyCell="{ column, record }"> |
|
|
<template v-if="column.dataIndex === 'operation'"> |
|
|
<template v-if="column.dataIndex === 'operation'"> |
|
|
<a-space> |
|
|
<a-space> |
|
|
<div> |
|
|
<div> |
|
|
<a-button size="small" danger @click="delModal">删除</a-button> |
|
|
<a-button size="small" danger @click="delModal">删除</a-button> |
|
|
<a-modal v-model:open="delOpen" title="提示" ok-text="确认" cancel-text="取消" |
|
|
<a-modal v-model:open="modal.open" title="提示" ok-text="确认" cancel-text="取消" |
|
|
@ok="del(record.id)"> |
|
|
@ok="del(record.id)"> |
|
|
<p>确认删除吗?</p> |
|
|
<p>确认删除吗?</p> |
|
|
</a-modal> |
|
|
</a-modal> |
|
|
</div> |
|
|
</div> |
|
|
<a-button size="small" type="primary" ghost |
|
|
<a-button size="small" type="primary" ghost @click="openModal('edit', record.id)">编辑</a-button> |
|
|
@click="openModal('edit', record.id)">编辑</a-button> |
|
|
|
|
|
<a-button size="small" type="primary" ghost>预览</a-button> |
|
|
|
|
|
</a-space> |
|
|
</a-space> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
@ -49,51 +32,35 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang='ts'> |
|
|
<script setup lang='ts'> |
|
|
import { ref, reactive, onMounted } from 'vue'; |
|
|
import { ref, onMounted } from 'vue'; |
|
|
import { classticContentStore,classticFormStore, classticSearchStore, classticDelStore } from "@/stores" |
|
|
import { indexStore } from "@/stores" |
|
|
const classticContent = classticContentStore() |
|
|
import { classticStore } from "@/stores/index" |
|
|
const { classticSearch, searchValue } = classticSearchStore() |
|
|
import { classticSearch, classticList, classticlist,classticDel } from "@/services/admin/classtic" |
|
|
const { classticDel } = classticDelStore() |
|
|
import ClassticFormView from "@/views/admin/classticmanage/ClassticFormView.vue" |
|
|
const {classticform,onSubmit}=classticFormStore() |
|
|
const { searchValue } = classticStore() |
|
|
|
|
|
const { modal } = indexStore() |
|
|
const formOpen = ref<boolean>(false); |
|
|
const openModal = (mode: string, id?: any) => { |
|
|
const formList = reactive({ |
|
|
modal.mode = mode; |
|
|
mode: "" |
|
|
modal.open = true; |
|
|
}) |
|
|
modal.ids = id; |
|
|
|
|
|
if (id) { |
|
|
const idRef = ref<any>(); |
|
|
modal.title="编辑" |
|
|
|
|
|
|
|
|
const openModal = (mode: string, itemid?: any) => { |
|
|
|
|
|
formList.mode = mode |
|
|
|
|
|
formOpen.value = true; |
|
|
|
|
|
idRef.value = itemid; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const formModal = () => { |
|
|
|
|
|
if (idRef.value) { |
|
|
|
|
|
onSubmit(idRef.value) |
|
|
|
|
|
formOpen.value = false; |
|
|
|
|
|
}else{ |
|
|
}else{ |
|
|
onSubmit() |
|
|
modal.title="新增" |
|
|
formOpen.value = false; |
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 语录删除 |
|
|
|
|
|
const del = (id: any) => { |
|
|
const del = (id: any) => { |
|
|
classticDel(id) |
|
|
classticDel(id) |
|
|
delOpen.value = false; |
|
|
modal.open = false; |
|
|
} |
|
|
} |
|
|
const delOpen = ref<boolean>(false); |
|
|
|
|
|
const delModal = () => { |
|
|
const delModal = () => { |
|
|
delOpen.value = true; |
|
|
modal.open = true; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取列表 |
|
|
// 获取列表 |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
classticContent.classticList() |
|
|
classticList() |
|
|
}); |
|
|
}); |
|
|
const columns = [ |
|
|
const columns = [ |
|
|
{ |
|
|
{ |
|
|
xxxxxxxxxx