From 1f772a6c7834eef35ff4c9f2c8ed734a4c2be76a Mon Sep 17 00:00:00 2001
From: 13937891274 <kxc0822>
Date: 星期二, 02 八月 2022 11:09:16 +0800
Subject: [PATCH] 数据对接

---
 src/components/equipmentDailog/DailogS.vue |  366 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 230 insertions(+), 136 deletions(-)

diff --git a/src/components/equipmentDailog/DailogS.vue b/src/components/equipmentDailog/DailogS.vue
index 6da1e53..5e33533 100644
--- a/src/components/equipmentDailog/DailogS.vue
+++ b/src/components/equipmentDailog/DailogS.vue
@@ -1,6 +1,6 @@
 <template>
-	<el-dialog :fullscreen="full" v-model="isShowDialog" :title="titles" width="60%">
-			<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
+	<el-dialog :fullscreen="full" v-model="dialogVisible" draggable :title="titles" width="60%">
+		<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
 		<el-form :model="form" label-width="130px" :disabled="disabled">
 			<el-row>
 				<el-col :span="11">
@@ -120,7 +120,7 @@
 				<el-col :span="24">
 					<el-form-item label="现场图片">
 						<el-upload
-              v-model="form.scenePic"
+							v-model="form.scenePic"
 							class="avatar-uploader"
 							action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
 							:show-file-list="false"
@@ -141,22 +141,22 @@
 		</el-form>
 		<el-tabs v-model="activeName" class="demo-tabs">
 			<el-tab-pane label="设备保养" name="first">
-				<el-button type="primary" size="default" @click="openMaintenance">新增</el-button>
-				<el-table :data="tableData" style="width: 100%">
+				<el-button type="primary" size="default" @click="openMaintenance('新增', '')">新增</el-button>
+				<el-table :data="form.takecareDetailList" style="width: 100%">
 					<el-table-column align="center" prop="takecareMemo" label="保养情况" />
 					<el-table-column align="center" prop="leadingPersonId" label="保养负责人" />
 					<el-table-column align="center" prop="takecareDate" label="保养日期" />
 					<el-table-column align="center" prop="leadingPersonDepartmentId" label="保养负责人单位" />
 					<el-table-column align="center" label="操作">
-						<template #default>
-							<el-button link type="primary" size="small">查看</el-button>
+						<template #default="scope">
+							<el-button link type="primary" @click="openMaintenance('查看', scope.row)" size="small">查看</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
 			</el-tab-pane>
 			<el-tab-pane label="设备检测" name="second">
 				<el-button type="primary" size="default" @click="openDetect">新增</el-button>
-				<el-table :data="tableData" style="width: 100%">
+				<el-table :data="form.testDetailList" style="width: 100%">
 					<el-table-column align="center" prop="testPersonId" label="检测人" />
 					<el-table-column align="center" prop="testDate" label="检测日期" />
 					<el-table-column align="center" prop="testPersonDepartmentId" label="检测人单位" />
@@ -165,14 +165,14 @@
 					<el-table-column align="center" prop="testStatus" label="检测状态" />
 					<el-table-column align="center" label="操作">
 						<template #default>
-							<el-button link type="primary" size="small">查看</el-button>
+							<el-button link type="primary" @click="openDetect('查看', scope.row)" size="small">查看</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
 			</el-tab-pane>
 			<el-tab-pane label="设备维修" name="third">
 				<el-button type="primary" size="default" @click="openRepair">新增</el-button>
-				<el-table :data="tableData" style="width: 100%">
+				<el-table :data="form.repaireDetailList" style="width: 100%">
 					<el-table-column align="center" prop="exceptionInfo" label="设施异常项" />
 					<el-table-column align="center" prop="repairStatus" label="维修状态" />
 					<el-table-column align="center" prop="repairMemo" label="维修情况" />
@@ -181,15 +181,16 @@
 					<el-table-column align="center" prop="repairStartDate" label="维修开始日期" />
 					<el-table-column align="center" prop="repairEndDate" label="维修结束日期" />
 					<el-table-column align="center" label="操作">
-						<template #default>
-							<el-button link type="primary" size="small">查看</el-button>
+						<template #default="scope">
+							<el-button link type="primary" @click="openRepair('查看', scope.row)" size="small">查看</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
 			</el-tab-pane>
-			<el-tab-pane label="检查标准设置" name="fourth">checkContent
+			<el-tab-pane label="检查标准设置" name="fourth"
+				>checkContent
 				<el-button type="primary" size="default" @click="openStandard">新增</el-button>
-				<el-table :data="tableData" style="width: 100%">
+				<el-table :data="form.checkStandardeDetailList" style="width: 100%">
 					<el-table-column align="center" type="indexNum" label="序号" width="75" />
 					<el-table-column align="center" prop="checkContent" label="检查内容" />
 					<el-table-column align="center" prop="checkTarget" label="检查指标" />
@@ -197,14 +198,14 @@
 					<el-table-column align="center" prop="checkPart" label="巡检部位" />
 					<el-table-column align="center" prop="rate" label="频次" />
 					<el-table-column align="center" label="操作">
-						<template #default>
-							<el-button link type="primary" size="small">查看</el-button>
+						<template #default="scope">
+							<el-button link type="primary" @click="openStandard('查看', scope.row)" size="small">查看</el-button>
 						</template>
 					</el-table-column>
 				</el-table>
 			</el-tab-pane>
 			<el-tab-pane label="巡检记录" name="five">
-				<el-table :data="tableData" style="width: 100%">
+				<el-table :data="name" style="width: 100%">
 					<el-table-column align="center" type="selection" width="75" />
 					<el-table-column align="center" sortable prop="name" label="任务编号" />
 					<el-table-column align="center" sortable prop="address" label="任务名称" />
@@ -235,22 +236,22 @@
 		</el-tabs>
 		<template #footer>
 			<span class="dialog-footer">
-				<el-button @click="resetForm(ruleFormRef)">关闭</el-button>
-				<el-button type="primary" v-if="disabled == true ? false : true" @click="submitForm(titles, ruleFormRef)">确定</el-button>
+				<el-button @click="resetForm">关闭</el-button>
+				<el-button type="primary" @click="submitForm">确定</el-button>
 			</span>
 		</template>
 	</el-dialog>
 	<categoryDailog ref="categoryShow"></categoryDailog>
 	<planDailog ref="planShow"></planDailog>
 	<DailogSearchUser ref="UserShow"></DailogSearchUser>
-	<maintenanceDailog ref="maintenanceShow"></maintenanceDailog>
-	<detectDailog ref="detectShow"></detectDailog>
-	<repairDailog ref="repairShow"></repairDailog>
-	<standardDailog ref="standardShow"></standardDailog>
+	<maintenanceDailog ref="maintenanceShow" @onMain="main"></maintenanceDailog>
+	<detectDailog ref="detectShow" @onDelect="delect"></detectDailog>
+	<repairDailog ref="repairShow" @onRepair="Repair"></repairDailog>
+	<standardDailog ref="standardShow" @onStand="Stand"></standardDailog>
 </template>
 <script lang="ts">
-import { defineComponent, ref, reactive } from 'vue';
-import { Search,Plus,FullScreen, FormInstance, } from '@element-plus/icons-vue';
+import { defineComponent, ref } from 'vue';
+import { Search, Plus, FullScreen } from '@element-plus/icons-vue';
 import categoryDailog from './categoryDailog.vue';
 import planDailog from './planDailog.vue';
 import maintenanceDailog from './maintenanceDailog.vue';
@@ -260,101 +261,176 @@
 import DailogSearchUser from '/@/components/DailogSearchUser/index.vue';
 import { ElMessage, ElMessageBox } from 'element-plus';
 import type { UploadProps, UploadUserFile } from 'element-plus';
-import {releaseDrillPlanApi} from "/@/api/emergencyDrillPlan";
-import {facilityManagementApi} from "/@/api/facilityManagement";
+import { facilityManagementApi } from '/@/api/facilityManagement';
 export default defineComponent({
 	components: { categoryDailog, planDailog, DailogSearchUser, maintenanceDailog, detectDailog, repairDailog, standardDailog },
-	setup() {
-		const isShowDialog = ref(false);
-		const form = reactive({
-      equipmentTypeId: '',
-      treatment: '',
-      inputPersonId: '',
-      departmentId: '',
-      delRepaireDetailList: [],
-      delTestDetailList: [],
-      takecareDetailList: [{
-        leadingPersonId:'',
-        takecareDate:'',
-        leadingPersonDepartmentId:'',
-        equipmentId: '',
-        takecareMemo: '',
-      }],
-      checkDetailList:[],
-      responsibilityPersonId: '',
+	setup(props, { emit }) {
+		const dialogVisible = ref(false);
+		const form = ref({
+			equipmentTypeId: '3',
+
+			treatment: '发生的',
+
+			inputPersonId: 0,
+
+			departmentId: 0,
+
+			delRepaireDetailList: [],
+
+			delTestDetailList: [],
+
+			takecareDetailList: [
+				{
+          leadingPersonDepartmentId: '',
+
+          takecareDate: '',
+
+          equipmentId: '',
+
+          leadingPersonId: '',
+
+          takecareMemo: '',
+				},
+			],
+      checkDetailList: [],
+
+      responsibilityPersonId: 0,
+
       delTakecareStardardeDetailList: [],
-      connectPersonId:'',
-      scenePic:'',
-      partType:'',
-      toDangerous:'',
-      dangerousElement:'',
+
+      connectPersonId: 0,
+
+      scenePic: '',
+
+      partType: 0,
+
+      toDangerous: '份12',
+
+      dangerousElement: '',
+
       takecareStardardeDetailList: [
-        {
-          filePath: '',
-        }
-      ],
-      testDetailList:[{
-        testMemo:'',
-        testPersonDepartmentId:'',
-        testPersonId:'',
-        testStatus:'',
-        testResult:'',
-        testDate:'',
-      }],
+				{
+					filePath: '123',
+				},
+			],
+      testDetailList: [
+				{
+          testMemo: '',
+
+          testPersonDepartmentId: 0,
+
+          testStatus: '',
+
+          testPersonId: 0,
+
+          testResult: 0,
+
+          testDate: 1658284314185 ,
+				},
+			],
       checkCycle: '',
-      repaireDetailList:[{
-        repairStatus:'',
-        repairPersonDepartmentId:'',
-        repairMemo:'',
-        infoTpe:'',
-        repairPersonId:'',
-        repairEndDate:'',
-        repairStartDate:'',
-        exceptionInfo:'',
-      }],
-      delCheckStandardeDetailList:[],
-      leadingPersonName: '',
-      name: '',
-      delTakecareDetailList:[],
-      position:'',
-      emergencePlanId: '',
-      checkStandardeDetailList: [{
-        checkContent:'',
-        checkTarget:'',
-        unit:'',
-        checkPart:'',
-        rate:'',
-        indexNum:'',
-      }],
-      delCheckStandardeDetails: '',
-      delTakecareStardardeDetails: '',
-      delTakecareDetails: '',
-      delRepaireDetails: '',
-      delTestDetails: '',
+      repaireDetailList: [
+				{
+          repairStatus: 0,
+          repairPersonDepartmentId: 0,
+          repairMemo: '',
+          infoTpe: 0,
+          repairPersonId: 0,
+          repairEndDate: 1658284314184,
+          repairStartDate: 1658284314184,
+          exceptionInfo: '',
+				},
+			],
+      delCheckStandardeDetailList: [],
+
+      leadingPersonName: '312',
+
+      name: '3123',
+
+			delTakecareDetailList: [],
+
+      position: '312',
+
+      emergencePlanId: 0,
+
+      checkStandardeDetailList: [
+				{
+          indexNum: '1',
+
+          checkTarget: '3',
+
+          checkPart: '5',
+
+          checkContent: '2',
+
+          unit: '4',
+
+          rate: '6',
+				},
+			],
+      delCheckStandardeDetails: '1,2',
+
+      delTakecareStardardeDetails: '1,2',
+
+      delTakecareDetails: '1,2',
+
+      delRepaireDetails: '1,2',
+
+      delTestDetails: '1,2',
 		});
-		const Dailogtype = ref(false);
-		const openDailog = (type: boolean) => {
-      isShowDialog.value = true;
-			Dailogtype.value = type;
-		};
-    const ruleFormRef = ref<FormInstance>()
-		const activeName = ref('first');
     const titles = ref();
-    const disabled = ref();
-    // 打开弹窗
-    const openDialog = (title: string, id: number, type: boolean) => {
-      isShowDialog.value = true;
-      titles.value = title;
-      disabled.value = type;
-      if (title == '查看仪器仪表' || title == '修改仪器仪表') {
-        facilityManagementApi()
-            .getkeypointEquipmentInfoDetail(id)
-            .then((res) => {
-              if (res.data.code == 200) {
-                form.value = res.data.data;
-              }
-            });
+    const disabled = ref(false);
+    const Dailogtype = ref(false);
+		const openDailog = (title: string, type: boolean, id: number, num: any) => {
+			dialogVisible.value = true;
+			Dailogtype.value = type;
+      if (num == 0) {
+        titles.value = `${title}仪表信息`;
+      } else if (num == 1) {
+        titles.value = `${title}设备设施`;
+      } else if (num == 2) {
+        titles.value = `${title}设备设施`;
       }
+
+      disabled.value = title == '查看' ? true : false;
+      if (title == '查看' || title == '修改')
+        facilityManagementApi()
+        .getkeypointEquipmentInfoDetail(id)
+        .then((res) => {
+          if (res.data.code == 200) {
+            form.value = res.data.data;
+          } else {
+            ElMessage.error(res.data.msg);
+          }
+        });
+		};
+    // 提交
+    const submitForm = () => {
+      dialogVisible.value = false;
+      facilityManagementApi()
+          .getkeypointEquipmentInfoAddOrUpdate(form.value)
+          .then((res) => {
+            if (res.data.code == 200) {
+              ElMessage({
+                message: res.data.msg,
+                type: 'success',
+              });
+              emit('navAddorUpdata');
+            } else {
+              ElMessage.error(res.data.msg);
+            }
+          });
+      // form.value = null;
+    };
+    //   取消
+    const resetForm = () => {
+      dialogVisible.value = false;
+    };
+		const activeName = ref('first');
+
+    const categoryShow = ref();
+    const opencategory = () => {
+      categoryShow.value.openDailog();
     };
 
 		const tableData = [
@@ -379,10 +455,7 @@
 				address: 'No. 189, Grove St, Los Angeles',
 			},
 		];
-		const categoryShow = ref();
-		const opencategory = () => {
-			categoryShow.value.openDailog();
-		};
+
 		const planShow = ref();
 		const openPlan = () => {
 			planShow.value.openDailog();
@@ -392,20 +465,20 @@
 			UserShow.value.openDailog();
 		};
 		const maintenanceShow = ref();
-		const openMaintenance = () => {
-			maintenanceShow.value.openDailog();
+		const openMaintenance = (title: string, data: any) => {
+			maintenanceShow.value.openDailog(title, data);
 		};
 		const detectShow = ref();
-		const openDetect = () => {
-			detectShow.value.openDailog();
+		const openDetect = (title: string, data: any) => {
+			detectShow.value.openDailog(title, data);
 		};
 		const repairShow = ref();
-		const openRepair = () => {
-			repairShow.value.openDailog();
+		const openRepair = (title: string, data: any) => {
+			repairShow.value.openDailog(title, data);
 		};
 		const standardShow = ref();
-		const openStandard = () => {
-			standardShow.value.openDailog();
+		const openStandard = (title: string, data: any) => {
+			standardShow.value.openDailog(title, data);
 		};
 		// 上传
 		const fileList = ref<UploadUserFile[]>([
@@ -437,6 +510,20 @@
 				() => false
 			);
 		};
+    // 回传
+    const main = (val: any) => {
+      form.value.takecareDetailList.push(val);
+    };
+    const delect = (val: any) => {
+      form.value.testDetailList.push(val);
+    };
+    const Repair= (val:any)=>{
+      form.value.repaireDetailList.push(val);
+    }
+    const Stand=(val:any)=>{
+      form.value.checkStandardeDetailList.push(val);
+    }
+
 		//图片提交
 		const imageUrl = ref('');
 
@@ -454,21 +541,27 @@
 			}
 			return true;
 		};
-			//全屏
+
+		//全屏
 		const full = ref(false);
 		const toggleFullscreen = () => {
 			if (full.value == false) {
 				full.value = true;
-			}else{
-        full.value = false;
-      }
+			} else {
+				full.value = false;
+			}
 		};
 		return {
-      isShowDialog,
+			submitForm,
+			dialogVisible,
 			Dailogtype,
 			form,
 			openDailog,
 			Search,
+      main,
+      delect,
+      Repair,
+      Stand,
 			activeName,
 			tableData,
 			categoryShow,
@@ -489,24 +582,25 @@
 			handleRemove,
 			handlePreview,
 			handleExceed,
+      disabled,
+      titles,
 			beforeRemove,
 			imageUrl,
 			handleAvatarSuccess,
 			beforeAvatarUpload,
 			Plus,
-				full,
+			full,
 			toggleFullscreen,
 			FullScreen,
-      ruleFormRef,
-      openDialog,
+			resetForm,
 		};
 	},
 });
 </script>
 <style scoped>
- .el-row{
-	 padding: 0 0 20px 0;
- }
+.el-row {
+	padding: 0 0 20px 0;
+}
 .avatar-uploader .avatar {
 	width: 178px;
 	height: 178px;
@@ -514,7 +608,7 @@
 }
 </style>
 <style>
-	.avatar-uploader .el-upload {
+.avatar-uploader .el-upload {
 	border: 1px dashed var(--el-border-color);
 	border-radius: 6px;
 	cursor: pointer;

--
Gitblit v1.9.2