From 1be21989c76f0eb9a43b9ebcab322d7171dbccd6 Mon Sep 17 00:00:00 2001
From: zhaojiale <631455805@qq.com>
Date: 星期四, 08 九月 2022 17:08:57 +0800
Subject: [PATCH] json转换取消
---
src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue | 221 +++++++++++++++++++++++++++++++------------------------
1 files changed, 124 insertions(+), 97 deletions(-)
diff --git a/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue b/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue
index 2466cb9..07a7b7b 100644
--- a/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue
+++ b/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue
@@ -1,127 +1,144 @@
<template>
- <el-dialog
- v-model="dialogVisible"
- title="选择应急预案"
- width="900px"
- draggable
- :fullscreen="full">
+ <el-dialog v-model="dialogVisible" title="选择应急预案" width="900px" draggable :fullscreen="full" @close="closeDialog">
<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
<el-row>
<el-col :span="18">
- <el-form :inline="true" ref="ruleFormRef" :model="ruleForm" status-icon>
- <el-form-item>
- <el-input size="default" v-model="ruleForm.checkPass" placeholder="预案名称" style="max-width: 215px;" />
- </el-form-item>
- <el-form-item>
- <el-button size="default" type="primary" @click="submitForm(ruleFormRef)" style="padding-right: 12px;">查询</el-button>
- <el-button size="default" @click="resetForm(ruleFormRef)">重置</el-button>
- </el-form-item>
- <el-button size="default" :icon="Delete" style="margin-left: 12px;">清除选择</el-button>
- </el-form>
- <el-table :data="tableData" style="width: 100%;margin-top:20px;">
- <el-table-column align="center" width="55">
+ <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;margin-right: 12px;" />
+ </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" 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" @change="radio">
- <el-radio :label="scope.row.name" size="large">{{null}}</el-radio>
+ <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="name" label="预案名称" />
</el-table>
<div class="pages">
<el-pagination
v-model:currentPage="pageIndex"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 30]"
- :pager-count="5"
- :small="small"
- :disabled="disabled"
- :background="background"
layout="total, sizes, prev, pager, next, jumper"
- :total="40"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
+ :total="total"
+ @size-change="onHandleSizeChange"
+ @current-change="onHandleCurrentChange"
/>
</div>
</el-col>
- <el-col :span="6" style="padding-left: 15px;">
- <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 :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>
<script lang="ts">
-import {
- defineComponent,
- reactive,
- ref
-} from 'vue';
-import {
- Delete,
- FullScreen
-} 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 { emergencyPlanApi } from '/@/api/contingencyManagement/emergencyPlan';
export default defineComponent({
- setup() {
+ setup(props, { emit }) {
const dialogVisible = ref<boolean>(false);
const openDailog = () => {
dialogVisible.value = true;
+ onSubmit()
};
// 搜索条件
- const ruleForm = reactive({
- checkPass: '',
+ const listQuery = reactive({
+ pageIndex: 1,
+ pageSize: 10,
+ searchParams: {
+ name: "", type: "", abolishStatus: false
+ },
});
- // 表格
- const tableData = [
- {
- name: '1#LNG储罐单元',
- },
- {
- name: 'LNG装车区',
- },
- {
- name: '丙烷储罐区',
- },
- {
- name: '4#LNG储罐单元',
- },
- ];
+ // 定义表格数据
+ const tableData = ref([]);
+ // 重置
+ const submitReset = () => {
+ listQuery.searchParams.name = '';
+ onSubmit();
+ };
+
+ // 列表请求数据
+ 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 pageIndex = ref(4);
- const pageSize = ref(10);
+ const pageIndex = ref();
+ const pageSize = ref();
+ const total = ref();
// 分页改变
- const handleSizeChange = (val: number) => {
- console.log(`${val} items per page`);
+ const onHandleSizeChange = (val: number) => {
+ listQuery.pageSize = val;
};
// 分页未改变
- const handleCurrentChange = (val: number) => {
- console.log(`current page: ${val}`);
+ const onHandleCurrentChange = (val: number) => {
+ listQuery.pageIndex = val;
};
// 右方点击添加后显示标签
- const dynamicTags = ref(['LNG储罐单元']);
+ const dynamicTags = ref(['']);
const handleClose = (tag: string) => {
dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
- radio1.value=""
+ radio1.value = '';
};
- const radio1=ref('LNG装车区')
- const radio=(event:any)=>{
- dynamicTags.value[0]=event
+ const closeDialog = () =>{
+ handleClose('')
}
+ const radio1 = ref('');
+ const radio = (event: any) => {
+ dynamicTags.value[0] = event;
+ };
//全屏
const full = ref(false);
const toggleFullscreen = () => {
@@ -131,40 +148,50 @@
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,
- ruleForm,
tableData,
- handleSizeChange,
- handleCurrentChange,
- pageIndex,
pageSize,
- Delete,
+ pageIndex,
+ onHandleSizeChange,
+ onHandleCurrentChange,
+ dynamicTags,
handleClose,
+ Delete,
radio1,
radio,
- dynamicTags,
toggleFullscreen,
FullScreen,
full,
+ submitReset,
+ onMounted,
+ listQuery,
+ onSubmit,
+ submitForm,
+ closeDialog
};
},
});
</script>
<style scoped>
-.el-row {
- padding: 0 0 20px 0;
-}
-.el-form--inline .el-form-item{
- margin: 0;
+.el-form--inline .el-form-item {
+ margin-bottom: 0;
+ margin-right: 0;
}
/*分页*/
- .pages{
- display: flex;
- justify-content: flex-start;
- margin-top: 15px;
- }
+.pages {
+ margin-top: 15px;
+}
::v-deep .el-pagination .el-pager li {
margin: 0 5px;
background-color: #f4f4f5;
@@ -183,10 +210,10 @@
min-width: 30px;
border-radius: 2px;
}
-::v-deep .el-pagination button:disabled{
+::v-deep .el-pagination button:disabled {
color: #c0c4cc;
}
-::v-deep .el-pagination .btn-next{
+::v-deep .el-pagination .btn-next {
margin: 0 5px;
background-color: #f4f4f5;
color: #606266;
--
Gitblit v1.9.2