格式化

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