From f91c24d2b2b513716ffe9f4259a8a343c841bb00 Mon Sep 17 00:00:00 2001
From: 13937891274 <kxc0822>
Date: 星期六, 30 七月 2022 18:10:28 +0800
Subject: [PATCH] 数据对接

---
 src/views/contingencyManagement/emergencyDrill/implementationOfEmergencyDrill/component/regionsDialog.vue |  266 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 155 insertions(+), 111 deletions(-)

diff --git a/src/views/contingencyManagement/emergencyDrill/implementationOfEmergencyDrill/component/regionsDialog.vue b/src/views/contingencyManagement/emergencyDrill/implementationOfEmergencyDrill/component/regionsDialog.vue
index c30db4a..813c6d2 100644
--- a/src/views/contingencyManagement/emergencyDrill/implementationOfEmergencyDrill/component/regionsDialog.vue
+++ b/src/views/contingencyManagement/emergencyDrill/implementationOfEmergencyDrill/component/regionsDialog.vue
@@ -1,109 +1,142 @@
 <template>
-	<el-dialog
-      v-model="dialogVisible"
-      title="选择演练名称"
-      width="900px"
-      draggable
-      :fullscreen="full"
-  >
+  <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-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="margin-left: 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 type="selection" width="55" />
-			<el-table-column align="center" prop="name" label="演练名称"/>
-		</el-table>
+    <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.drillName" 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">
+                <el-radio :label="scope.row" size="large">{{ null }}</el-radio>
+              </el-radio-group>
+            </template>
+          </el-table-column>
+          <el-table-column align="center" prop="drillName" 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>
-		</el-row>
-		<template #footer>
+      </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.drillName }}
+          </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,
-  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 { emergencyPlanLogApi } from '/@/api/emergencyPlanLog';
+import { emergencyPlanApi } from '/@/api/emergencyPlan';
+import {releaseDrillPlanApi} from "/@/api/emergencyDrillPlan";
 export default defineComponent({
-	setup() {
-		const dialogVisible = ref<boolean>(false);
-		const openDailog = () => {
-			dialogVisible.value = true;
-		};
-		// 搜索条件
-		const ruleForm = reactive({
-			checkPass: '',
-		});
-		// 表格
-		const tableData = [
-			{
-				name: '1#LNG储罐单元',
-			},
-			{
-				name: 'LNG装车区',
-			},
-			{
-				name: '丙烷储罐区',
-			},
-			{
-				name: '4#LNG储罐单元',
-			},
-		];
+  setup(props, { emit }) {
+    const dialogVisible = ref<boolean>(false);
+    const openDailog = () => {
+      dialogVisible.value = true;
+      onSubmit()
+    };
+    // 搜索条件
+    const listQuery = reactive({
+      pageIndex: 1,
+      pageSize: 10,
+      searchParams: {
+        drillName: ''
+      },
+    });
+    // 列表请求数据
+    const onSubmit = async () => {
+      let res = await releaseDrillPlanApi().getReleaseDrillPlanList(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 tableData = ref([]);
+    // 重置
+    const submitReset = () => {
+      listQuery.searchParams.drillName = '';
+      onSubmit();
+    };
     // 分页
-    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(['应急救援组', '工艺抢险组', '后勤保障组']);
-		const handleClose = (tag: string) => {
-			dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
-		};
+    // 右方点击添加后显示标签
+    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 = () => {
@@ -113,38 +146,50 @@
         full.value = false;
       }
     };
-		return {
-			dialogVisible,
-			openDailog,
-			ruleForm,
-			tableData,
-      pageIndex,
+
+    const submitForm = () => {
+      let obj = JSON.parse(JSON.stringify(dynamicTags.value));
+      emit('SearchUser', obj[0]);
+      dialogVisible.value = false;
+    };
+    onMounted(() => {
+      onSubmit();
+    });
+    return {
+      dialogVisible,
+      openDailog,
+      tableData,
       pageSize,
-      handleSizeChange,
-      handleCurrentChange,
-			dynamicTags,
-			handleClose,
-			Delete,
+      pageIndex,
+      onHandleSizeChange,
+      onHandleCurrentChange,
+      dynamicTags,
+      handleClose,
+      Delete,
+      radio1,
+      radio,
       toggleFullscreen,
       FullScreen,
       full,
-		};
-	},
+      submitReset,
+      onMounted,
+      listQuery,
+      submitForm,
+      onSubmit,
+      total,
+    };
+  },
 });
 </script>
 <style scoped>
-.el-row {
-	padding: 0 0 20px 0;
+.el-form--inline .el-form-item {
+  margin-bottom: 0;
+  margin-right: 0;
 }
-.el-form--inline .el-form-item{
-  margin: 0;
+/*分页*/
+.pages {
+  margin-top: 15px;
 }
-/*分页开始*/
-  .pages{
-    display: flex;
-    justify-content: flex-start;
-    margin-top: 15px;
-  }
 ::v-deep .el-pagination .el-pager li {
   margin: 0 5px;
   background-color: #f4f4f5;
@@ -163,15 +208,14 @@
   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;
   min-width: 30px;
   border-radius: 2px;
 }
-/*分页结束*/
 </style>

--
Gitblit v1.9.2