From 1ca46431ab9faea036ec8b2ae54b20b720f7bad6 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: 星期一, 25 七月 2022 18:29:48 +0800
Subject: [PATCH] 添加修改页面

---
 src/views/specialWorkSystem/approveProcessManagement/approveLinkSettings/approveLinkSetting/index.vue |  243 +++++++++++++++++++++++-------------------------
 1 files changed, 116 insertions(+), 127 deletions(-)

diff --git a/src/views/specialWorkSystem/approveProcessManagement/approveLinkSettings/approveLinkSetting/index.vue b/src/views/specialWorkSystem/approveProcessManagement/approveLinkSettings/approveLinkSetting/index.vue
index f1b1bbc..e0c5c65 100644
--- a/src/views/specialWorkSystem/approveProcessManagement/approveLinkSettings/approveLinkSetting/index.vue
+++ b/src/views/specialWorkSystem/approveProcessManagement/approveLinkSettings/approveLinkSetting/index.vue
@@ -6,7 +6,6 @@
 				<el-row class="cardTop">
 					<el-col :span="12" class="mainCardBtn">
 						<el-button type="primary" :icon="Plus" size="default" @click="dialogAddRecord=true">新建审批环节</el-button>
-<!--						<el-button type="warning" :icon="Edit" size="default" plain>修改</el-button>-->
 						<el-button type="danger" :icon="Delete" size="default" plain>删除</el-button>
 					</el-col>
 					<el-button type="primary" :icon="Refresh" size="default"/>
@@ -142,134 +141,124 @@
 	interface type {
 
 	}
-	// export default defineComponent({
-	// 	name: 'workCheckinRecord',
-	// 	setup() {
-			const userInfo = useUserInfo()
-			const { userInfos } = storeToRefs(userInfo);
-			const state  = reactive<stateType>({});
-			const currentPage = ref(1)
-			const pageSize = ref(10)
-			const chosenIndex = ref(-1)
-			const handleSizeChange = (val: number) => {
-				console.log(`${val} items per page`)
-			}
-			const handleCurrentChange = (val: number) => {
-				console.log(`current page: ${val}`)
-			}
-			const tableData = reactive(
-					[
-					{
-						processName: '作业负责人审批',
-						approveType: '上报审批意见',
-						creater: '李四',
-						createTime: '2021-04-22 15:21:31',
-						updater: '吴海涛',
-						updateTime: '2022-04-22 15:21:31',
-					},
-					{
-						processName: '作业负责人审批',
-						approveType: '上报气体检测数据',
-						creater: '李四',
-						createTime: '2021-04-22 15:21:31',
-						updater: '吴海涛',
-						updateTime: '2022-04-22 15:21:31',
-					},
-				]
-			)
-			const timeForm = {
-				hour12: false,
-				year: 'numeric',
-				month: '2-digit',
-				day: '2-digit',
-				hour: '2-digit',
-				minute: '2-digit',
-				second: '2-digit'
-			}
-			const addRef = ref<FormInstance>()
-			const addRules = reactive<FormRules>({
-				processName:[{required: true, message: '该内容不能为空',trigger:'blur'}],
-				approveType:[{required: true, message: '该内容不能为空',trigger:'blur'}]
-			})
-			const dialogDetails = ref(false)
-			const dialogAddRecord = ref(false)
-			const deleteDialog = ref(false)
-			const addRecord = 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
-			}
-			const conFirmDelete = ()=> {
-				tableData.splice(chosenIndex.value,1)
-				deleteDialog.value = false
-			}
-			const confirmAddRecord = async (formEl: FormInstance | undefined) =>{
-				if (!formEl) return
-				await formEl.validate((valid, fields) => {
-					if (valid) {
-						if(chosenIndex.value == -1){
-							addRecord.value.createTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-')
-							addRecord.value.updateTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-')
-							tableData.push(addRecord.value)
-						}else{
-							addRecord.value.updateTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-')
-							tableData[chosenIndex.value] = addRecord.value
-						}
-						dialogAddRecord.value =false
-					} else {
-						console.log('error submit!', fields)
-					}
-				})
+	const userInfo = useUserInfo()
+	const { userInfos } = storeToRefs(userInfo);
 
+	// 分页
+	const currentPage = ref(1)
+	const pageSize = ref(10)
+
+	const handleSizeChange = (val: number) => {
+		console.log(`${val} items per page`)
+	}
+	const handleCurrentChange = (val: number) => {
+		console.log(`current page: ${val}`)
+	}
+
+	// 判断新增和修改
+	const chosenIndex = ref(-1)
+
+	const tableData = reactive(
+			[
+			{
+				processName: '作业负责人审批',
+				approveType: '上报审批意见',
+				creater: '李四',
+				createTime: '2021-04-22 15:21:31',
+				updater: '吴海涛',
+				updateTime: '2022-04-22 15:21:31',
+			},
+			{
+				processName: '作业负责人审批',
+				approveType: '上报气体检测数据',
+				creater: '李四',
+				createTime: '2021-04-22 15:21:31',
+				updater: '吴海涛',
+				updateTime: '2022-04-22 15:21:31',
+			},
+		]
+	)
+
+	// 时间格式化
+	const timeForm = {
+		hour12: false,
+		year: 'numeric',
+		month: '2-digit',
+		day: '2-digit',
+		hour: '2-digit',
+		minute: '2-digit',
+		second: '2-digit'
+	}
+
+	const addRef = ref<FormInstance>()
+	const addRules = reactive<FormRules>({
+		processName:[{required: true, message: '该内容不能为空',trigger:'blur'}],
+		approveType:[{required: true, message: '该内容不能为空',trigger:'blur'}]
+	})
+	const dialogDetails = ref(false)
+	const dialogAddRecord = ref(false)
+	const deleteDialog = ref(false)
+	const addRecord = 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
+	}
+	const conFirmDelete = ()=> {
+		tableData.splice(chosenIndex.value,1)
+		deleteDialog.value = false
+	}
+
+	// 新增修改记录
+	const confirmAddRecord = async (formEl: FormInstance | undefined) =>{
+		if (!formEl) return
+		await formEl.validate((valid, fields) => {
+			if (valid) {
+				if(chosenIndex.value == -1){
+					addRecord.value.createTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-')
+					addRecord.value.updateTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-')
+					tableData.push(addRecord.value)
+				}else{
+					addRecord.value.updateTime = new Date().toLocaleString('zh', timeForm).replace(/\//g,'-')
+					tableData[chosenIndex.value] = addRecord.value
+				}
+				dialogAddRecord.value =false
+			} else {
+				console.log('error submit!', fields)
 			}
-			const closeAdd =()=>{
-				addRecord.value={}
-				chosenIndex.value = -1
-			}
-			const indexClear = ()=>{
-				chosenIndex.value = -1
-			}
-			const editRecord =(index, row)=>{
-				dialogAddRecord.value = true
-				chosenIndex.value = index
-				addRecord.value = JSON.parse(JSON.stringify(row))
-			}
-			// 折线图
-			const renderMenu = async (value: string) => {
-				Session.set('projectId',value)
-				userInfos.value.projectId = value
-				await initBackEndControlRoutes();
-			};
-			// return {
-			// 	renderMenu,
-			// 	multipleTableRef,
-			// 	tableData,
-			// 	currentPage,
-			// 	pageSize,
-			// 	dialogDetails,
-			// 	details,
-			// 	deleteDialog,
-			// 	dialogAddRecord,
-			// 	viewRecord,
-			// 	deleteRecord,
-			// 	handleSizeChange,
-			// 	handleCurrentChange,
-			// 	Plus,
-			// 	Edit,
-			// 	Delete,
-			// 	Search,
-			// 	Download,
-			// 	handleSelectionChange,
-			// 	Refresh,
-			// 	...toRefs(state),
-			// };
-	// 	},
-	// });
+		})
+
+	}
+
+	// 编辑弹窗关闭时数据初始化处理
+	const closeAdd =()=>{
+		addRecord.value={}
+		chosenIndex.value = -1
+	}
+	const indexClear = ()=>{
+		chosenIndex.value = -1
+	}
+
+	// 修改记录
+	const editRecord =(index, row)=>{
+		dialogAddRecord.value = true
+		chosenIndex.value = index
+		addRecord.value = JSON.parse(JSON.stringify(row))
+	}
+	// 折线图
+	const renderMenu = async (value: string) => {
+		Session.set('projectId',value)
+		userInfos.value.projectId = value
+		await initBackEndControlRoutes();
+	};
 </script>
 
 <style scoped lang="scss">

--
Gitblit v1.9.2