From cc7b9c7caec6044f6c789a7a4146cd4df0a968a2 Mon Sep 17 00:00:00 2001 From: 21819 Date: Sat, 20 Jan 2024 15:49:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=A6=E6=83=85=E8=B7=AF=E7=94=B1=E7=BC=96?= =?UTF-8?q?=E5=86=99=EF=BC=8C=E7=95=8C=E9=9D=A2UI=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + src/components/MailDetail.vue | 22 +++++++ src/components/ManageMail.vue | 105 ++++++++++++++++++---------------- src/main.js | 1 + src/router/index.js | 4 ++ vite.config.js | 2 +- 6 files changed, 87 insertions(+), 49 deletions(-) create mode 100644 src/components/MailDetail.vue diff --git a/package.json b/package.json index cbe87fb..dde5118 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,11 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.3.1", + "axios": "^1.6.5", "element-plus": "^2.5.1", "pinia": "^2.1.7", "vue": "^3.3.11", + "vue-json-excel": "^0.3.0", "vue-router": "^4.2.5" }, "devDependencies": { diff --git a/src/components/MailDetail.vue b/src/components/MailDetail.vue new file mode 100644 index 0000000..2bb9329 --- /dev/null +++ b/src/components/MailDetail.vue @@ -0,0 +1,22 @@ + + + \ No newline at end of file diff --git a/src/components/ManageMail.vue b/src/components/ManageMail.vue index cbef8ac..d0120b8 100644 --- a/src/components/ManageMail.vue +++ b/src/components/ManageMail.vue @@ -2,52 +2,55 @@ + end-placeholder="结束日期" value-format="YYYY-MM-DD"> - + - + - + - + - + - + 搜索 - 重置 + 重置 导出信件 - + - + - + - + - + - + - + - 详情 + import { ref } from 'vue' - +import axios from 'axios' +import { onMounted } from 'vue'; +import router from '../router'; const form = ref({ date: '', - name: '', - phone: '', - id_card: '', - mail_id: '', - mail_context: '', - mail_appraise: '' + contactName: '', + contactPhone: '', + contactIdCard: '', + id: '', + content: '', + evaluate: '' +}) + +// 定义可变的tableData变量,并用axios请求数据 +const tableData = ref([]) + + +onMounted(() => { + axios.get('api/mailbox/list') + .then(function (response) { + console.log(response); + tableData.value = response.data; + totalSize.value = response.data.length; + }) + .catch(function (error) { console.log(error) }) }) const currentPage = ref(1) -const totalSize = ref(100) -const tableData = ref([ - { - id: 1, - date: '2022-01-01', - source: '信访部门', - status: '已办结', - level: '一级', - category: '群众来信', - unit: '信访室', - title: '关于信访事项的投诉举报' - }, - { - id: 2, - date: '2022-01-02', - source: '信访部门', - status: '已办结', - level: '一级', - category: '群众来信', - unit: '信访室', - title: '关于信访事项的投诉举报' - },] -) +const totalSize = ref(2) const flexColumnWidth = (label, prop) => { @@ -101,8 +98,14 @@ const flexColumnWidth = (label, prop) => { return `${width}px` } -const handleEdit = (index) => { +const handleDetail = (index) => { console.log(index) + console.log(tableData.value[index - 1].id) + router.push('/mailbox/detail/' + tableData.value[index - 1].id) +} + +const handleSizeChange = (size) => { + console.log(size) } const handlePageChange = (currentPage) => { @@ -110,7 +113,13 @@ const handlePageChange = (currentPage) => { } const search = () => { - console.log(form.value) + const data = JSON.stringify(form.value) + console.log(data) + axios.post('api/mailbox/list-submit', data) + .then(function (response) { + console.log(response); + }) + .catch(function (error) { console.log(error) }) } const reset = () => { diff --git a/src/main.js b/src/main.js index 684e32d..7641f0d 100644 --- a/src/main.js +++ b/src/main.js @@ -8,6 +8,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' import './assets/style/style.scss' + createApp(App) .use(router) .use(ElementPlus, { locale: zhCn }) diff --git a/src/router/index.js b/src/router/index.js index ba7a8d4..b7445ab 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -21,6 +21,10 @@ const constantRoutes = [ { path: '/mailbox', component: () => import('@/components/ManageMail.vue'), + }, + { + path: '/mailbox/detail/:id', + component: () => import('@/components/MailDetail.vue') } ] }, diff --git a/vite.config.js b/vite.config.js index bad8d25..cdfb000 100644 --- a/vite.config.js +++ b/vite.config.js @@ -45,7 +45,7 @@ export default defineConfig({ host: '0.0.0.0', proxy: { '/api': { - target: 'http://127.0.0.1:8081', + target: 'http://127.0.0.1:8083', changeOrigin: true, rewrite: (p) => p.replace(/^\/api/, '') }