From c64c8f43ec1a3d88feb1f915fd488040b6358e7d Mon Sep 17 00:00:00 2001 From: shj <1790240199@qq.com> Date: 星期二, 09 八月 2022 19:04:12 +0800 Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/gtqtOut --- src/views/contingencyManagement/emergencyPlanStartRecord/component/selectEmergencyPlan.vue | 374 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 220 insertions(+), 154 deletions(-) diff --git a/src/views/contingencyManagement/emergencyPlanStartRecord/component/selectEmergencyPlan.vue b/src/views/contingencyManagement/emergencyPlanStartRecord/component/selectEmergencyPlan.vue index b6954a6..da6b207 100644 --- a/src/views/contingencyManagement/emergencyPlanStartRecord/component/selectEmergencyPlan.vue +++ b/src/views/contingencyManagement/emergencyPlanStartRecord/component/selectEmergencyPlan.vue @@ -1,176 +1,242 @@ <template> - <el-dialog v-model="dialogVisible" title="选择应急预案" width="900px" draggable> - <el-row> - <el-col :span="18"> - <el-row> - <el-col :span="24"> - <el-form ref="ruleFormRef" :model="ruleForm" :inline="true" status-icon> - <el-form-item> - <el-input size="default" v-model="ruleForm.pass" placeholder="预案名称" 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-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-form-item> - </el-form> - </el-col> - <el-col :span="24"> - <el-button size="default" :icon="Delete" style="margin-top: 15px;">清除选择</el-button> - </el-col> - </el-row> - <el-table :data="tableData" style="width: 100%;margin-top:20px"> - <el-table-column width="55"> - <template #default="scope"> - <el-radio-group v-model="radio1" @change="radio"> - <el-radio :label="scope.row.pass" size="large">{{null}}</el-radio> - </el-radio-group> - </template> - </el-table-column> - <el-table-column align="center" prop="pass" label="预案名称" /> - <el-table-column align="center" prop="checkPass" label="预案类型"/> - </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" - layout="total, sizes, prev, pager, next, jumper" - :total="400" - @size-change="handleSizeChange" - @current-change="handleCurrentChange" - /> - </div> - </el-col> - <el-col :span="6"> - <el-tag - v-for="tag in dynamicTags" - :key="tag" - class="mx-1" - style="margin: 5px" - closable - :disable-transitions="false" - @close="handleClose(tag)" - > - {{ tag }} - </el-tag> - </el-col> - </el-row> - <template #footer> + <el-dialog v-model="dialogVisible" title="选择应急预案" width="900px" draggable :fullscreen="full"> + <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button> + <el-row> + <el-col :span="18"> + <el-row> + <el-col :span="24"> + <el-form ref="ruleFormRef" :inline="true" :model="ruleForm" status-icon> + <el-form-item> + <el-input size="default" v-model="listQuery.searchParams.name" placeholder="预案名称" style="max-width: 215px" /> + </el-form-item> + <el-form-item> + <el-select + size="default" + v-model="listQuery.searchParams.type" + placeholder="请选择预案类型" + class="ml10" + style="max-width: 215px; margin-right: 12px" + > + <el-option label="综合应急预案" value="1"></el-option> + <el-option label="现场处置方案" value="2"></el-option> + <el-option label="专项应急预案" value="3"></el-option> + <el-option label="其他预案" value="4"></el-option> + </el-select> + </el-form-item> + <el-form-item> + <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> + <el-col :span="24"> + <el-button size="default" :icon="Delete" @click="submitReset" style="margin-top: 15px">清除选择</el-button> + </el-col> + </el-row> + <el-table :data="tableData" style="width: 100%; margin-top: 20px" @cell-click="radio"> + <el-table-column width="55"> + <template #default="scope"> + <el-radio-group v-model="radio1"> + <el-radio :label="scope.row" size="large">{{ null }}</el-radio> + </el-radio-group> + </template> + </el-table-column> + <el-table-column align="center" prop="name" label="预案名称" /> + <el-table-column align="center" prop="type" label="预案类型"> + <template #default="scope"> + <span v-if="scope.row.type == '1'">综合应急预案</span> + <span v-if="scope.row.type == '2'">现场处置方案</span> + <span v-if="scope.row.type == '3'">专项应急预案</span> + <span v-if="scope.row.type == '4'">其他预案</span> + </template> + </el-table-column> + </el-table> + <div class="pages"> + <el-pagination + v-model:currentPage="pageIndex" + v-model:page-size="pageSize" + :page-sizes="[10, 20, 30]" + layout="total, sizes, prev, pager, next, jumper" + :total="total" + @size-change="onHandleSizeChange" + @current-change="onHandleCurrentChange" + /> + </div> + </el-col> + <el-col :span="6"> + <div v-if="dynamicTags[0] == '' ? false : true"> + <el-tag + v-for="tag in dynamicTags" + :key="tag" + class="mx-1" + style="margin: 5px" + closable + :disable-transitions="false" + @close="handleClose(tag)" + > + {{ tag.name }} + </el-tag> + </div> + </el-col> + </el-row> + <template #footer> <span class="dialog-footer"> <el-button @click="dialogVisible = false" size="default">关闭</el-button> - <el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button> + <el-button type="primary" @click="submitForm" size="default">确定</el-button> </span> - </template> - </el-dialog> + </template> + </el-dialog> </template> <script lang="ts"> -import { defineComponent, reactive, ref } from 'vue'; -import { Delete } from '@element-plus/icons-vue'; +import { defineComponent, reactive, ref, onMounted } from 'vue'; +import { ElMessage } from 'element-plus'; +import { Delete, FullScreen } from '@element-plus/icons-vue'; +import { emergencyPlanLogApi } from '/@/api/contingencyManagement/emergencyPlanLog'; +import { emergencyPlanApi } from '/@/api/contingencyManagement/emergencyPlan'; export default defineComponent({ - setup() { - const dialogVisible = ref<boolean>(false); - const openDailog = () => { - dialogVisible.value = true; - }; - // 搜索条件 - const ruleForm = reactive({ - pass: '', - checkPass: '', - }); - // 表格 - const tableData = [ - { - pass: '生产安全事故应急预案202102', - checkPass: '1', - }, - { - pass: '生产安全事故应急预案', - checkPass: '2', - }, - { - pass: '作业人员触电事故现场处置方案', - checkPass: '4', - }, - { - pass: '船舶碰撞码头事故专项应急预案', - checkPass: '2', - }, - ]; - const pageSize4 = ref(100); - const handleSizeChange = (val: number) => { - console.log(`${val} items per page`); - }; - const handleCurrentChange = (val: number) => { - console.log(`current page: ${val}`); - }; - // 右方点击添加后显示标签 - const dynamicTags = ref(['船舶碰撞码头事故专项应急预案']); - const handleClose = (tag: string) => { - dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1); - radio1.value="" - }; - const radio1=ref('生产安全事故应急预案202102') - const radio=(event:any)=>{ - dynamicTags.value[0]=event - } - return { - dialogVisible, - openDailog, - ruleForm, - tableData, - pageSize4, - handleSizeChange, - handleCurrentChange, - dynamicTags, - handleClose, - Delete, - radio1, - radio, - }; - }, + setup(props, { emit }) { + const dialogVisible = ref<boolean>(false); + const openDailog = () => { + dialogVisible.value = true; + onSubmit(); + }; + // 搜索条件 + const listQuery = reactive({ + pageIndex: 1, + pageSize: 10, + searchParams: { + name: '', + type: '', + abolishStatus: false, + }, + }); + // 定义表格数据 + const tableData = ref([]); + // 请求列表数据 + const onSubmit = async () => { + let res = await emergencyPlanApi().getEmergencyPlanList(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.name = ''; + listQuery.searchParams.type = ''; + radio1.value="" + dynamicTags.value[0]="" + onSubmit(); + }; + // 分页 + const pageIndex = ref(); + const pageSize = ref(); + const total = ref(); + // 分页改变 + const onHandleSizeChange = (val: number) => { + listQuery.pageSize = val; + }; + // 分页未改变 + const onHandleCurrentChange = (val: number) => { + listQuery.pageIndex = val; + }; + // 右方点击添加后显示标签 + const dynamicTags = ref(['']); + const handleClose = (tag: string) => { + dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1); + radio1.value = ''; + }; + const radio1 = ref(''); + const radio = (event: any) => { + dynamicTags.value[0] = event; + }; + //全屏 + const full = ref(false); + const toggleFullscreen = () => { + if (full.value == false) { + full.value = true; + } else { + full.value = false; + } + }; + + const submitForm = () => { + let obj = JSON.parse(JSON.stringify(dynamicTags.value)); + emit('SearchUser', obj[0]); + dialogVisible.value = false; + }; + onMounted(() => { + onSubmit(); + }); + return { + dialogVisible, + openDailog, + tableData, + pageSize, + pageIndex, + onHandleSizeChange, + onHandleCurrentChange, + dynamicTags, + handleClose, + Delete, + radio1, + radio, + toggleFullscreen, + FullScreen, + full, + submitReset, + onMounted, + listQuery, + onSubmit, + submitForm, + total, + }; + }, }); </script> <style scoped> -.el-form--inline .el-form-item{ - margin-bottom: 0; - margin-right: 0; +.el-form--inline .el-form-item { + margin-bottom: 0; + margin-right: 0; } /*分页*/ -.pages{ - margin-top: 15px; +.pages { + margin-top: 15px; } ::v-deep .el-pagination .el-pager li { - margin: 0 5px; - background-color: #f4f4f5; - color: #606266; - min-width: 30px; - border-radius: 2px; + margin: 0 5px; + background-color: #f4f4f5; + color: #606266; + min-width: 30px; + border-radius: 2px; } ::v-deep .el-pagination .el-pager li.is-active { - background-color: #409eff; - color: #fff; + background-color: #409eff; + color: #fff; } ::v-deep .el-pagination .btn-prev { - margin: 0 5px; - background-color: #f4f4f5; - color: #606266; - min-width: 30px; - border-radius: 2px; + margin: 0 5px; + background-color: #f4f4f5; + color: #606266; + min-width: 30px; + border-radius: 2px; } -::v-deep .el-pagination button:disabled{ - color: #c0c4cc; +::v-deep .el-pagination button:disabled { + color: #c0c4cc; } -::v-deep .el-pagination .btn-next{ - margin: 0 5px; - background-color: #f4f4f5; - color: #606266; - min-width: 30px; - border-radius: 2px; +::v-deep .el-pagination .btn-next { + margin: 0 5px; + background-color: #f4f4f5; + color: #606266; + min-width: 30px; + border-radius: 2px; } </style> -- Gitblit v1.9.2