From 2e52dcb4fb8766d7d9c0034b7bba3e1d02e24906 Mon Sep 17 00:00:00 2001
From: zhaojiale <631455805@qq.com>
Date: 星期四, 04 八月 2022 10:43:29 +0800
Subject: [PATCH] 事故报告除图片外完成

---
 src/views/accidentManagementSystem/accidentExpress/component/openAdd.vue |  110 +++++++++++++++++++++++++++++++------------------------
 1 files changed, 62 insertions(+), 48 deletions(-)

diff --git a/src/views/accidentManagementSystem/accidentExpress/component/openAdd.vue b/src/views/accidentManagementSystem/accidentExpress/component/openAdd.vue
index 913ac7f..50a59d7 100644
--- a/src/views/accidentManagementSystem/accidentExpress/component/openAdd.vue
+++ b/src/views/accidentManagementSystem/accidentExpress/component/openAdd.vue
@@ -11,8 +11,14 @@
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="事故部门" placeholder="请选择" prop="accidentDepartmentId">
-							<el-tree-select v-model="ruleForm.accidentDepartmentId" :disabled="disabled"
-											:props="propse" :data="newTreeList" class="w100" placeholder="请选择" />
+							<el-tree-select
+								v-model="ruleForm.accidentDepartmentId"
+								:disabled="disabled"
+								:props="propse"
+								:data="newTreeList"
+								class="w100"
+								placeholder="请选择"
+							/>
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@@ -47,14 +53,18 @@
 								<el-radio :label="true">是</el-radio>
 								<el-radio :label="false">否</el-radio>
 							</el-radio-group>
-							<el-button v-if="ruleForm.casualties" type="primary"
-									   style="margin-left: 20px" :icon="Edit" @click="openDai" round plain />
+							<el-button v-if="ruleForm.casualties" type="primary" style="margin-left: 20px" :icon="Edit" @click="openDai" round plain />
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="事故简要经过" prop="accidentBriefProcess">
-							<el-input v-model="ruleForm.accidentBriefProcess" :disabled="disabled"
-									  type="textarea" placeholder="请填写事故简要经过" maxlength="150"></el-input>
+							<el-input
+								v-model="ruleForm.accidentBriefProcess"
+								:disabled="disabled"
+								type="textarea"
+								placeholder="请填写事故简要经过"
+								maxlength="150"
+							></el-input>
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@@ -70,14 +80,19 @@
 					</el-col>
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="应急防范措施" prop="emergencyPrecautions">
-							<el-input v-model="ruleForm.emergencyPrecautions" :disabled="disabled"
-									  type="textarea" placeholder="请填写应急防范措施" maxlength="150"></el-input>
+							<el-input
+								v-model="ruleForm.emergencyPrecautions"
+								:disabled="disabled"
+								type="textarea"
+								placeholder="请填写应急防范措施"
+								maxlength="150"
+							></el-input>
 						</el-form-item>
 					</el-col>
 					<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
 						<el-form-item label="事故照片" prop="fileList">
 							<!--<el-input v-model="ruleForm.fileList" :disabled="disabled"-->
-									  <!--type="textarea" placeholder="请填写应急防范措施" maxlength="150"></el-input>-->
+							<!--type="textarea" placeholder="请填写应急防范措施" maxlength="150"></el-input>-->
 							<uploaderImg :fileList="fileListDemo"></uploaderImg>
 						</el-form-item>
 					</el-col>
@@ -98,7 +113,7 @@
 </template>
 
 <script lang="ts">
-import { reactive, ref, defineComponent, defineEmits,onMounted} from 'vue';
+import { reactive, ref, defineComponent, defineEmits, onMounted } from 'vue';
 
 import type { UploadUserFile, FormInstance, FormRules } from 'element-plus';
 import { ElMessage } from 'element-plus';
@@ -117,7 +132,7 @@
 		UserSelections,
 		RegionsDialog,
 		NumberOfCasualties,
-		uploaderImg
+		uploaderImg,
 	},
 	setup(props, { emit }) {
 		const isShowDialog = ref(false);
@@ -135,7 +150,7 @@
 			accidentDepartmentId: '',
 			accidentName: '',
 			fileList: [],
-			id:''
+			id: '',
 		});
 		const titles = ref();
 		const disabled = ref();
@@ -167,50 +182,49 @@
 				name: 'food.jpeg',
 				url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100',
 			},
-		])
+		]);
 		// 可选择树
 		const treeSelect = ref();
 
 		//定义树形下拉框
 		const responsibleDepartment = ref();
-		const data = [
-		];
+		const data = [];
 		//el-tree-select回显
 		const propse = {
 			label: 'depName',
-			children: 'children'
+			children: 'children',
 		};
-		const newTreeList = []
+		const newTreeList = [];
 		//得到部门树
-		const department = async() => {
+		const department = async () => {
 			await goalManagementApi()
-					.getTreedepartment()
-					.then((res) => {
-						if (res.data.code == 200) {
-							data.value = res.data.data;
-							getTreeList(res.data.data,newTreeList)
-						} else {
-							ElMessage.error(res.data.msg);
-						}
-					});
+				.getTreedepartment()
+				.then((res) => {
+					if (res.data.code == 200) {
+						data.value = res.data.data;
+						getTreeList(res.data.data, newTreeList);
+					} else {
+						ElMessage.error(res.data.msg);
+					}
+				});
 		};
 		// 递归树状数据且修改字段名
-		const getTreeList = (treeList,newTreeList) => {
-			treeList.map(c=>{
-				let tempData={
-					depName:c.depName,
-					value:c.depId,
-					children:[]
+		const getTreeList = (treeList, newTreeList) => {
+			treeList.map((c) => {
+				let tempData = {
+					depName: c.depName,
+					value: c.depId,
+					children: [],
+				};
+				if (c.children && c.children.length > 0) {
+					tempData.children = [];
+					getTreeList(c.children, tempData.children);
 				}
-				if(c.children && c.children.length>0){
-					tempData.children=[]
-					getTreeList(c.children,tempData.children)
-				}
-				newTreeList.push(tempData)
-			})
-		}
+				newTreeList.push(tempData);
+			});
+		};
 		onMounted(() => {
-			department()
+			department();
 		});
 		// 必填项提示
 		const rules = reactive<FormRules>({
@@ -281,7 +295,7 @@
 				await formEl.validate((valid, fields) => {
 					if (valid) {
 						isShowDialog.value = false;
-						ruleForm.value.id = null
+						ruleForm.value.id = null;
 						accidentManagementSystemApi()
 							.accidentAdd(ruleForm.value)
 							.then((res) => {
@@ -344,7 +358,7 @@
 				formEl.resetFields();
 			}
 			ruleForm.value = {
-				accidentExpressId:'',
+				accidentExpressId: '',
 				emergencyPrecautions: '',
 				accidentCausesPreliminaryAnalysis: '',
 				accidentBriefProcess: '',
@@ -364,16 +378,16 @@
 		};
 		const closeDialog = (formEl: FormInstance | undefined) => {
 			formEl.resetFields();
-			console.log(ruleForm)
-			isShowDialog.value = false
-		}
+			console.log(ruleForm);
+			isShowDialog.value = false;
+		};
 		// 是否有伤亡弹窗
 		const typeChang = () => {
 			console.log('tag', ruleForm);
 		};
 		const ShowUser = ref();
 		const openDai = () => {
-			ShowUser.value.openDialog(ruleForm.value.id,disabled.value);
+			ShowUser.value.openDialog(ruleForm.value.id, disabled.value);
 		};
 		// 应急队伍弹窗
 		const Shows = ref();
@@ -434,7 +448,7 @@
 			getTreeList,
 			newTreeList,
 			closeDialog,
-			fileListDemo
+			fileListDemo,
 		};
 	},
 });

--
Gitblit v1.9.2