From be76681e5865d3e05945570f9c1c709db0a4514f Mon Sep 17 00:00:00 2001 From: 13937891274 <kxc0822> Date: 星期四, 04 八月 2022 18:01:44 +0800 Subject: [PATCH] 数据对接 --- src/components/checkTemplate/index.vue | 103 +++++++++++++++++++-------------- src/views/contingencyManagement/panManagement/component/abolishLibrary.vue | 24 ++++++++ src/views/contingencyManagement/panManagement/component/openAdd.vue | 44 +++----------- 3 files changed, 93 insertions(+), 78 deletions(-) diff --git a/src/components/checkTemplate/index.vue b/src/components/checkTemplate/index.vue index 24134c3..695cb6d 100644 --- a/src/components/checkTemplate/index.vue +++ b/src/components/checkTemplate/index.vue @@ -5,16 +5,16 @@ <el-col :span="18"> <el-row> <el-col :span="24"> - <el-form ref="ruleFormRef" :model="ruleForm" :inline="true" status-icon> + <el-form ref="ruleFormRef" :inline="true" status-icon> <el-form-item> - <el-input size="default" v-model="ruleForm.pass" placeholder="id" style="max-width: 215px;"/> + <el-input size="default" v-model="listQuery.searchParams.id" placeholder="id" style="max-width: 215px;"/> </el-form-item> <el-form-item> - <el-input size="default" v-model="ruleForm.checkPass" placeholder="队伍名称" style="max-width: 215px;padding: 0 12px;"/> + <el-input size="default" v-model="listQuery.searchParams.teamName" placeholder="队伍名称" style="max-width: 215px;padding: 0 12px;"/> </el-form-item> <el-form-item> - <el-button size="default" type="primary" @click="submitForm(ruleFormRef)">查询</el-button> - <el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button> + <el-button size="default" type="primary" @click="onSubmit">查询</el-button> + <el-button size="default" @click="submitReset">重置</el-button> </el-form-item> </el-form> </el-col> @@ -33,14 +33,11 @@ </el-table> <div class="pages"> <el-pagination - v-model:currentPage="currentPage4" - v-model:page-size="pageSize4" - :page-sizes="[100, 200, 300, 400]" - :small="small" - :disabled="disabled" - :background="background" + v-model:currentPage="pageIndex" + v-model:page-size="pageSize" + :page-sizes="[10, 20, 30, 40]" layout="total, sizes, prev, pager, next, jumper" - :total="400" + :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> @@ -70,11 +67,11 @@ Delete, FullScreen } from '@element-plus/icons-vue'; -interface User { - date: string - name: string - address: string -} +import { + ElMessage, +} from 'element-plus'; +import {contingencyApi} from "/@/api/contingency"; + export default defineComponent({ setup() { const dialogVisible = ref<boolean>(false); @@ -82,36 +79,50 @@ dialogVisible.value = true; }; // 搜索条件 - const ruleForm = reactive({ - pass: '', - checkPass: '', + const listQuery = reactive({ + pageIndex: 1, + pageSize: 10, + searchParams: { + teamName: "", + teamType: "", + } }); + // 列表数据请求 + const onSubmit = async () => { + let res = await contingencyApi().getTeamManagementList(listQuery) + if(res.data.code === '200'){ + tableData.value = res.data.data; + pageIndex.value = res.data.pageIndex; + pageSize.value = res.data.pageSize; + total.value = res.data.total; + }else{ + ElMessage({ + showClose: true, + type:'error', + message:res.data.msg + }) + } + } + // 重置 + const submitReset = () => { + listQuery.searchParams.teamName = ''; + listQuery.searchParams.teamType = ''; + onSubmit(); + }; // 表格 - const tableData = [ - { - date: '6421cbc6cbb5493eabf9b27e83372d78', - name: '应急救援组', - }, - { - date: '6421cbc6cbb5493eabf9b27e83372d78', - name: '工艺抢险组', - }, - { - date: '6421cbc6cbb5493eabf9b27e83372d78', - name: '后勤保障组', - }, - { - date: '6421cbc6cbb5493eabf9b27e83372d78', - name: '应急救援组', - }, - ]; - const pageSize4 = ref(100); + const tableData = ref(); + // 分页 + const pageIndex = ref(); + const pageSize = ref(); + const total = ref(); const handleSizeChange = (val: number) => { - console.log(`${val} items per page`); + listQuery.pageSize = val; + onSubmit(); }; const handleCurrentChange = (val: number) => { - console.log(`current page: ${val}`); - }; + listQuery.pageIndex = val; + onSubmit(); + } // 右方点击添加后显示标签 const dynamicTags = ref(['应急救援组', '工艺抢险组', '后勤保障组']); const handleClose = (tag: string) => { @@ -129,9 +140,9 @@ return { dialogVisible, openDailog, - ruleForm, tableData, - pageSize4, + pageSize, + pageIndex, handleSizeChange, handleCurrentChange, dynamicTags, @@ -140,6 +151,10 @@ toggleFullscreen, FullScreen, full, + onSubmit, + listQuery, + submitReset, + total }; }, }); diff --git a/src/views/contingencyManagement/panManagement/component/abolishLibrary.vue b/src/views/contingencyManagement/panManagement/component/abolishLibrary.vue index 4bab73f..767011f 100644 --- a/src/views/contingencyManagement/panManagement/component/abolishLibrary.vue +++ b/src/views/contingencyManagement/panManagement/component/abolishLibrary.vue @@ -123,6 +123,29 @@ const onCancel = () => { closeDialog(); }; + const onReduction = async (data: any, formEl: FormInstance) => { + isShowDialog.value = false; + emergencyPlanApi() + .addEmergencyPlan(data) + .then((res) => { + if (res.data.code == 200) { + ElMessage({ + showClose: true, + message: res.data.msg, + type: 'success', + }); + emit('myAdd', true); + } else { + ElMessage({ + showClose: true, + message: res.data.msg, + type: 'error', + }); + emit('myAdd', true); + } + formEl.resetFields(); + }); + } // 分页 const pageIndex = ref(); const pageSize = ref(); @@ -163,6 +186,7 @@ // onSubmit, total, emit, + onReduction, }; }, }); diff --git a/src/views/contingencyManagement/panManagement/component/openAdd.vue b/src/views/contingencyManagement/panManagement/component/openAdd.vue index 55f0ef7..209fb2c 100644 --- a/src/views/contingencyManagement/panManagement/component/openAdd.vue +++ b/src/views/contingencyManagement/panManagement/component/openAdd.vue @@ -31,6 +31,7 @@ :props="propse" show-checkbox clearable + check-strictly /> <el-divider /> </el-form-item> @@ -179,8 +180,6 @@ import RegionsDialog from '/@/components/regionsDialog/index.vue' import {emergencyPlanApi} from "/@/api/emergencyPlan"; import {goalManagementApi} from "/@/api/goalManagement"; -import {emergencyPlanLogApi} from "/@/api/emergencyPlanLog"; -import {contingencyApi} from "/@/api/contingency"; export default defineComponent({ name: 'openAdd', @@ -207,22 +206,10 @@ } ], emergencyTeam: '', //应急队伍 - areaList: [ - { - areaId: '', - } - ], //区域列表 - areaName: '', //区域名称 - teamList: [ - { - teamId: '', - } - ], - deptList: [ - { - departmentId: '', - } - ] + areaList: [], //区域列表 + teamList: [], + deptList: [], + abolishStatus: false, }) const titles = ref(); const disabled = ref(); @@ -348,22 +335,10 @@ } ], emergencyTeam: '', //应急队伍 - areaList: [ - { - areaId: '', - } - ], //区域列表 - areaName: '', //区域名称 - teamList: [ - { - teamId: '', - } - ], - deptList: [ - { - departmentId: '', - } - ] + areaList: [], //区域列表 + teamList: [], + deptList: [], + abolishStatus: false, }; } }; @@ -387,6 +362,7 @@ const openUser = () => { userRef.value.openDailog(); }; + //回显 const onUser = (e:any) => { ruleForm.value.authorUid=e.uid }; -- Gitblit v1.9.2