From f93a3a605d6d949515bedbcdc633c5f454014f02 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: 星期二, 26 七月 2022 17:07:06 +0800
Subject: [PATCH] 添加修改页面

---
 src/views/IntelligentXjSys/inspectionTaskManagement/index.vue |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/views/IntelligentXjSys/inspectionTaskManagement/index.vue b/src/views/IntelligentXjSys/inspectionTaskManagement/index.vue
index e2cd7d9..5f1e4a9 100644
--- a/src/views/IntelligentXjSys/inspectionTaskManagement/index.vue
+++ b/src/views/IntelligentXjSys/inspectionTaskManagement/index.vue
@@ -583,6 +583,8 @@
 			const addRef = ref<FormInstance>()
 			const addShiftRef = ref<FormInstance>()
 			const addInspectionRef = ref<FormInstance>()
+
+	// 表单校验
 			const addRules = reactive<FormRules>({
 				name:[{required: true, message: '该内容不能为空',trigger:'blur'}],
 				type:[{required: true, message: '该内容不能为空',trigger:'blur'}],
@@ -611,10 +613,14 @@
 			const addShift = ref({})
 			const addInspection = ref({})
 			const details = ref({})
+
+	// 查看记录
 			const viewRecord = (row) =>{
 				details.value = JSON.parse(JSON.stringify(row))
 				dialogDetails.value = true
 			}
+
+			// 删除记录
 			const deleteRecord = (index) =>{
 				chosenIndex.value = index
 				deleteDialog.value = true
@@ -622,6 +628,13 @@
 			const conFirmDelete = ()=> {
 				tableData.splice(chosenIndex.value,1)
 				deleteDialog.value = false
+			}
+
+			// 修改添加记录
+			const editRecord =(index, row)=>{
+				chosenIndex.value = index
+				dialogAddRecord.value = true
+				addRecord.value = JSON.parse(JSON.stringify(row))
 			}
 			const confirmAddRecord = async (formEl: FormInstance | undefined) =>{
 				if (!formEl) return
@@ -649,7 +662,7 @@
 								addRecord.value.createTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-')
 								addRecord.value.chainLength = addRecord.value.shiftSteps.length
 								addRecord.value.status = '开启'
-								tableData.push(addRecord.value)
+								tableData.unshift(addRecord.value)
 							}
 						}else{
 							if(addRecord.value.shiftSteps.length == 0){
@@ -680,9 +693,13 @@
 				})
 
 			}
+
+			// 添加弹窗打开前预操作
 			const openAdd =()=>{
 				addRecord.value.unit = '小时'
 			}
+
+			// 弹窗关闭后判断数据初始化
 			const closeAdd =()=>{
 				addRecord.value={}
 				chosenIndex.value = -1
@@ -699,11 +716,6 @@
 				chosenInspectionIndex.value = -1
 				chosenShiftIndex.value = -1
 			}
-			const editRecord =(index, row)=>{
-				chosenIndex.value = index
-				dialogAddRecord.value = true
-				addRecord.value = JSON.parse(JSON.stringify(row))
-			}
 
 			// 排序
 			function compare(key){
@@ -719,6 +731,8 @@
 				dialogAddShift.value = true
 				chosenShiftIndex.value = index
 			}
+
+			// 删除巡检区域
 			const deleteFlow = (index) => {
 				deleteShiftDialog.value = true
 				chosenShiftIndex.value = index
@@ -727,6 +741,7 @@
 				addRecord.value.shiftSteps.splice( chosenShiftIndex.value,1)
 				deleteShiftDialog.value = false
 			}
+
 			const confirmAddShift = async (formEl: FormInstance | undefined) => {
 				if (!formEl) return
 				await formEl.validate((valid, fields) => {
@@ -742,8 +757,9 @@
 						console.log('error submit!', fields)
 					}
 				})
-
 			}
+
+
 			const addSysInspection =(index)=>{
 				dialogAddInspection.value = true
 				chosenShiftIndex.value = index

--
Gitblit v1.9.2