格式化

main
zouyiqing 2023-10-17 16:10:12 +08:00
parent f53ec5ac2d
commit 9bced410f9
1 changed files with 60 additions and 41 deletions

View File

@ -1,50 +1,52 @@
<script setup lang="ts"> <script setup lang="ts">
import AppBlock from '@/components/AppBlock.vue' import AppBlock from "@/components/AppBlock.vue";
import HomeHead from '@/views/home/components/HomeHead.vue' import HomeHead from "@/views/home/components/HomeHead.vue";
// import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue' // import HomeHeadSearch from '@/views/home/components/HomeHeadSearch.vue'
import { useMessage, NModal } from 'naive-ui' import { useMessage, NModal } from "naive-ui";
import { useUserStore } from '@/stores/modules/user' import { useUserStore } from "@/stores/modules/user";
import { boardMsgList, deleteMsgById } from '@/api/daikin/base' import { boardMsgList, deleteMsgById } from "@/api/daikin/base";
const message = useMessage() const message = useMessage();
const store = useUserStore() const store = useUserStore();
const { push } = useRouter() const { push } = useRouter();
const header = { 'token': store.user.token } const header = { token: store.user.token };
const dataA = ref([]) const dataA = ref([]);
const editA = ref() const editA = ref();
async function gettopList() { async function gettopList() {
const { rows: _rowA } = await boardMsgList() const { rows: _rowA } = await boardMsgList();
dataA.value = _rowA dataA.value = _rowA;
if (_rowA && _rowA.length > 0) { if (_rowA && _rowA.length > 0) {
dataA.value = _rowA.map((i: { filePathList: { name: any; originalFileName: any }[] }) => { dataA.value = _rowA.map(
if (i.filePathList && i.filePathList.length > 0) { (i: { filePathList: { name: any; originalFileName: any }[] }) => {
i.filePathList.forEach((file: { name: any; originalFileName: any }) => { if (i.filePathList && i.filePathList.length > 0) {
file.name = file.originalFileName; i.filePathList.forEach(
}); (file: { name: any; originalFileName: any }) => {
file.name = file.originalFileName;
}
);
}
return i;
} }
return i );
}) console.log(dataA.value);
console.log(dataA.value)
} }
} }
onMounted(async () => { onMounted(async () => {
gettopList(); gettopList();
}) });
const handleEditA = (index: number, row: any) => { const handleEditA = (index: number, row: any) => {
push({ name: "InfosEdit", query: { id: row.id}}) push({ name: "InfosEdit", query: { id: row.id } });
} };
const handleDeleteA = (index, row) => { const handleDeleteA = (index, row) => {
deleteMsgById(row.id).then(res => { deleteMsgById(row.id).then((res) => {
gettopList(); gettopList();
}) });
} };
</script> </script>
<template> <template>
<HomeHead class="top"> <HomeHead class="top">
@ -57,21 +59,38 @@ const handleDeleteA = (index, row) => {
<!-- <img src="./images/logo.svg" class="h56px mr21px" /> --> <!-- <img src="./images/logo.svg" class="h56px mr21px" /> -->
<div class="text-36px text-#000">留言板列表</div> <div class="text-36px text-#000">留言板列表</div>
</div> </div>
<div class=" cont relative w100% h800px overflow-y-auto"> <div class="cont relative w100% h800px overflow-y-auto">
<el-table :data="dataA" style="width: 95%" <el-table
:header-cell-style="{ background: '#2A7BF7', color: '#fff', height: '60px', textAlign: 'center', 'font-size': '24px' }" :data="dataA"
:cell-style="{ 'text-align': 'center' }"> style="width: 95%"
:header-cell-style="{
background: '#2A7BF7',
color: '#fff',
height: '60px',
textAlign: 'center',
'font-size': '24px',
}"
:cell-style="{ 'text-align': 'center' }"
>
<el-table-column label="时间" prop="createTime" /> <el-table-column label="时间" prop="createTime" />
<el-table-column label="标题" prop="title" /> <el-table-column label="标题" prop="title" />
<el-table-column label="操作" width="200px"> <el-table-column label="操作" width="200px">
<template #default="scope"> <template #default="scope">
<el-button size="small" @click="handleEditA(scope.$index, scope.row)">编辑</el-button> <el-button
<el-button size="small" type="danger" @click="handleDeleteA(scope.$index, scope.row)">删除</el-button> size="small"
<el-button size="small" >回复</el-button> @click="handleEditA(scope.$index, scope.row)"
</template> >编辑</el-button
>
<el-button
size="small"
type="danger"
@click="handleDeleteA(scope.$index, scope.row)"
>删除</el-button
>
<el-button size="small">回复</el-button>
</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</AppBlock> </AppBlock>
</template> </template>