From d1a430e88df40d76558a14f890ac0dbd3181f3a0 Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: 星期二, 06 九月 2022 14:30:14 +0800
Subject: [PATCH] 对接

---
 src/views/accidentManagementSystem/workInjuryDeclaration/component/accidentName.vue |  368 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 226 insertions(+), 142 deletions(-)

diff --git a/src/views/accidentManagementSystem/workInjuryDeclaration/component/accidentName.vue b/src/views/accidentManagementSystem/workInjuryDeclaration/component/accidentName.vue
index 724e8ef..86cd9a6 100644
--- a/src/views/accidentManagementSystem/workInjuryDeclaration/component/accidentName.vue
+++ b/src/views/accidentManagementSystem/workInjuryDeclaration/component/accidentName.vue
@@ -1,162 +1,246 @@
 <template>
-  <el-dialog v-model="dialogVisible" title="选择事故名称" width="900px" draggable>
-    <el-row>
-      <el-col :span="18">
-        <el-row>
-          <el-form ref="ruleFormRef" :model="ruleForm" :inline="true" status-icon>
-            <el-form-item>
-              <el-input size="default" v-model="ruleForm.pass" placeholder="id"  style="min-width: 215px;"/>
-            </el-form-item>
-            <el-form-item>
-              <el-input size="default" v-model="ruleForm.pass" placeholder="事故名称"  style="min-width: 215px;"/>
-            </el-form-item>
-            <el-form-item>
-              <el-input size="default" v-model="ruleForm.pass" placeholder="事故部门"  style="min-width: 215px;"/>
-            </el-form-item>
-            <el-form-item>
-              <el-input size="default" v-model="ruleForm.pass" placeholder="发生地点"  style="min-width: 215px;"/>
-            </el-form-item>
-            <el-form-item>
-              <el-input size="default" v-model="ruleForm.pass" placeholder="发生时间"  style="min-width: 215px;"/>
-            </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" :icon="Delete">清除选择</el-button>
-            </el-form-item>
-          </el-form>
-        </el-row>
-        <el-table :data="tableData" style="width: 100%;margin-top:20px">
-          <el-table-column type="selection" width="55" />
-          <el-table-column align="center" prop="date" label="id" />
-          <el-table-column align="center" prop="name" label="事故名称"/>
-          <el-table-column align="center" prop="date" label="事故部门" />
-          <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="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>
-			<span class="dialog-footer">
-				<el-button @click="dialogVisible = false" size="default">关闭</el-button>
-				<el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button>
-			</span>
-    </template>
-  </el-dialog>
+	<div>
+		<el-dialog v-model="dialogVisible" title="选择事故名称" width="900px" draggable :fullscreen="full" @close="handleClose">
+			<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
+			<el-row>
+				<el-col :span="18">
+					<el-row>
+						<el-form ref="ruleFormRef" :model="ruleForm" :inline="true" status-icon>
+							<!--<el-form-item>-->
+							<!--<el-input size="default" v-model="listQuery.searchParams.id" placeholder="id"  style="min-width: 215px;"/>-->
+							<!--</el-form-item>-->
+							<el-form-item>
+								<el-input size="default" v-model="listQuery.searchParams.accidentName" placeholder="事故名称" style="min-width: 215px" />
+							</el-form-item>
+							<!--<el-form-item>-->
+							<!--<el-input size="default" v-model="listQuery.searchParams.deptName" placeholder="事故部门"  style="min-width: 215px;"/>-->
+							<!--</el-form-item>-->
+							<!--<el-form-item>-->
+							<!--<el-input size="default" v-model="listQuery.searchParams.occurrencePlace" placeholder="发生地点"  style="min-width: 215px;"/>-->
+							<!--</el-form-item>-->
+							<!--<el-form-item>-->
+							<!--<el-input size="default" v-model="listQuery.searchParams.occurrenceTime" placeholder="发生时间"  style="min-width: 215px;"/>-->
+							<!--</el-form-item>-->
+							<el-form-item>
+								<el-button size="default" type="primary" @click="listApi">查询</el-button>
+								<el-button size="default" @click="submitReset">重置</el-button>
+								<el-button size="default" :icon="Delete" @click="handleClose">清除选择</el-button>
+							</el-form-item>
+						</el-form>
+					</el-row>
+					<!--<el-table :data="tableData" style="width: 100%;margin-top:20px">-->
+					<!--<el-table-column type="selection" width="55" />-->
+					<!--<el-table-column align="center" prop="date" label="id" />-->
+					<!--<el-table-column align="center" prop="name" label="事故名称"/>-->
+					<!--<el-table-column align="center" prop="date" label="事故部门" />-->
+					<!--<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="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-table :data="tableData" style="width: 100%" ref="multipleTableRef">
+						<el-table-column align="center">
+							<template #default="scope">
+								<el-radio-group v-model="radio1">
+									<el-radio :label="scope.row.id" size="large" @click="checkedItem(scope.row)">{{ null }}</el-radio>
+								</el-radio-group>
+							</template>
+						</el-table-column>
+						<!--<el-table-column prop="id" label="id" show-overflow-tooltip></el-table-column>-->
+						<el-table-column prop="accidentName" label="事故名称" show-overflow-tooltip></el-table-column>
+						<el-table-column prop="deptName" label="事故部门" show-overflow-tooltip></el-table-column>
+						<el-table-column prop="occurrencePlace" label="发生地点" show-overflow-tooltip></el-table-column>
+						<el-table-column prop="occurrenceTime" label="发生时间" show-overflow-tooltip></el-table-column>
+					</el-table>
+					<div class="pages">
+						<el-pagination
+							v-model:currentPage="pageIndex"
+							v-model:page-size="pageSize"
+							:page-sizes="[10, 20, 30]"
+							:pager-count="5"
+							layout="total, sizes, prev, pager, next, jumper"
+							:total="total"
+							@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.accidentName }}
+					</el-tag>
+				</el-col>
+			</el-row>
+			<template #footer>
+				<span class="dialog-footer">
+					<el-button @click="closeDialog()" size="default">关闭</el-button>
+					<el-button type="primary" @click="submitForm" size="default">确定</el-button>
+				</span>
+			</template>
+		</el-dialog>
+	</div>
 </template>
 <script lang="ts">
 import { defineComponent, reactive, ref } from 'vue';
-import { Delete } from '@element-plus/icons-vue';
+import { Delete, FullScreen } from '@element-plus/icons-vue';
+import {
+	// ElTable,
+	ElMessage,
+} from 'element-plus';
+import { accidentManagementSystemApi } from '/@/api/workInjuryDeclaration';
 export default defineComponent({
-  setup() {
-    const dialogVisible = ref<boolean>(false);
-    const openDailog = () => {
-      dialogVisible.value = true;
-    };
-    // 搜索条件
-    const ruleForm = reactive({
-      pass: '',
-    });
-    // 表格
-    const tableData = [
-      {
-        date: '6421cbc6cbb5493eabf9b27e83372d78',
-        name: '应急救援组',
-      },
-      {
-        date: '6421cbc6cbb5493eabf9b27e83372d78',
-        name: '工艺抢险组',
-      },
-      {
-        date: '6421cbc6cbb5493eabf9b27e83372d78',
-        name: '后勤保障组',
-      },
-      {
-        date: '6421cbc6cbb5493eabf9b27e83372d78',
-        name: '应急救援组',
-      },
-    ];
-    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);
-    };
-    return {
-      dialogVisible,
-      openDailog,
-      ruleForm,
-      tableData,
-      pageSize4,
-      handleSizeChange,
-      handleCurrentChange,
-      dynamicTags,
-      handleClose,
-      Delete,
-    };
-  },
+	setup(props, { emit }) {
+		const dialogVisible = ref<boolean>(false);
+		const openDailog = () => {
+			dialogVisible.value = true;
+			listApi();
+		};
+		// 搜索条件
+		const ruleForm = reactive({
+			pass: '',
+		});
+		// 定义表格数据
+		const tableData = ref([]);
+		// 列表参数
+		const listQuery = reactive({
+			pageIndex: 1,
+			pageSize: 10,
+			searchParams: {
+				accidentName: '',
+			},
+		});
+		//单选按钮
+		const radio1 = ref('');
+		// 分页
+		const pageIndex = ref();
+		const pageSize = ref();
+		const total = ref();
+		// 分页改变
+		const handleSizeChange = (val: number) => {
+			listQuery.pageSize = val;
+		};
+		// 分页未改变
+		const handleCurrentChange = (val: number) => {
+			listQuery.pageIndex = val;
+		};
+		const checkedItem = (row: object) => {
+			dynamicTags.value = [row];
+		};
+		// 重置
+		const submitReset = () => {
+			listQuery.searchParams = {};
+			listApi();
+		};
+		const submitForm = () => {
+			emit('selectItem', dynamicTags.value);
+			dialogVisible.value = false;
+			radio1.value=''
+		};
+		//查询list数据
+		const listApi = async () => {
+			let res = await accidentManagementSystemApi().accidentList(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.error(res.data.msg);
+			}
+		};
+		// 右方点击添加后显示标签
+		const dynamicTags = ref([]);
+		const closeDialog=()=>{
+			dialogVisible.value = false
+			handleClose()
+		};
+		const handleClose = () => {
+			dynamicTags.value = [];
+			radio1.value = '';
+		};
+		//全屏
+		const full = ref(false);
+		const toggleFullscreen = () => {
+			if (full.value == false) {
+				full.value = true;
+			} else {
+				full.value = false;
+			}
+		};
+		return {
+			dialogVisible,
+			openDailog,
+			ruleForm,
+			tableData,
+			handleSizeChange,
+			handleCurrentChange,
+			dynamicTags,
+			handleClose,
+			Delete,
+			toggleFullscreen,
+			FullScreen,
+			full,
+			pageIndex,
+			pageSize,
+			total,
+			listApi,
+			listQuery,
+			radio1,
+			checkedItem,
+			submitReset,
+			submitForm,
+			closeDialog
+		};
+	},
 });
 </script>
 <style scoped>
-.el-form--inline .el-form-item{
-  margin-bottom: 18px!important;
-  margin-right: 12px;
+.el-form--inline .el-form-item {
+	margin-bottom: 18px !important;
+	margin-right: 12px;
 }
 /*分页*/
-.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