From aa9ed4ac9790b3512572f40b66d44b68f2b0c1aa Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: 星期三, 03 八月 2022 15:45:17 +0800
Subject: [PATCH] 对接

---
 src/views/goalManagement/targetDecompositionYear/component/Dailog.vue |   77 ++++++++++++++++++++++++++------------
 1 files changed, 52 insertions(+), 25 deletions(-)

diff --git a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
index 797b644..04d74fe 100644
--- a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
+++ b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
@@ -40,7 +40,7 @@
 			<el-table-column align="center" property="dutyDepartmentId" label="责任部门" width="180" />
 			<el-table-column align="center" property="value" label="考核指标" width="180" />
 			<el-table-column align="center" property="makerDepartmentId" label="制定人部门" />
-			<el-table-column align="center" property="makeDate" label="制定日期" />
+			<el-table-column align="center" property="makeDate" :formatter="timeDate(makeDate)" label="制定日期" />
 			<el-table-column align="center" property="commitPersonId" label="上报人" />
 			<el-table-column align="center" property="操作">
 				<template #default="scope">
@@ -67,11 +67,18 @@
 import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext } from 'element-plus';
 import DailogSearch from '../../../../components/DailogSearch/DailogSearch.vue';
 import { goalManagementApi } from '/@/api/goalManagement';
+import { emit } from 'process';
 export default defineComponent({
 	components: { DailogAdd, DailogSearch },
-	setup() {
+	setup(props,{emit}) {
 		const dialogVisible = ref<boolean>(false);
-		const form = ref({});
+		const form = ref({
+			qName: '',
+			indexNum: '',
+			year: '',
+			value: '',
+			targetDivideDetailList:[]
+		});
 		const targetType = ref();
 		const disabled = ref(false);
 		const titles = ref();
@@ -86,14 +93,15 @@
 					.then((res) => {
 						if (res.data.code == 200) {
 							form.value = res.data.data;
+							formUp.targetDivideDetailList=form.value.targetDivideDetailList
 						} else {
 							ElMessage.error(res.data.msg);
 						}
 					});
 			}
 		};
-		const onNumber = (e: object) => {
-			form.value = e;
+		const onNumber = (val: object) => {
+			form.value = val;
 		};
 		// 导航
 		const activeName = ref('1');
@@ -101,9 +109,9 @@
 		const tableData = ref([]);
 		// 新增弹窗
 		const Show = ref();
-		const daiAdd = (title:string,data: any) => {
-			console.log(data)
-			Show.value.openDailog(title,data);
+		const daiAdd = (title: string, data: any) => {
+			console.log(data);
+			Show.value.openDailog(title, data);
 		};
 		const formUp = reactive({
 			targetId: '', //关联的目标指标/外键
@@ -116,6 +124,7 @@
 		};
 		// 新增
 		const submitForm = () => {
+			formUp.delTargetDivideDetails=arr.value.toString()
 			formUp.targetId = form.value.id;
 			goalManagementApi()
 				.gettargetDivideDetail(formUp)
@@ -125,29 +134,30 @@
 							message: res.data.msg,
 							type: 'success',
 						});
-						dialogVisible.value=false
+						dialogVisible.value = false;
+						emit("addList")
 					} else {
 						ElMessage.error(res.data.msg);
 					}
 				});
+				form.value = {
+				qName: '',
+				indexNum: '',
+				year: '',
+				value: '',
+				targetDivideDetailList:[]
+			};
+			tableData.value = [];
+			formUp.targetId = '';
+			formUp.delTargetDivideDetails = '';
+			formUp.targetDivideDetailList = [];
 		};
+		const arr=ref([])
 		// 删除
 		const Delete = (data: any) => {
-			formUp.targetId= data.targetId
-			formUp.delTargetDivideDetails = data.id;
-			// formUp.targetDivideDetailList=data
-			goalManagementApi()
-				.gettargetDivideDetail(formUp)
-				.then((res) => {
-					if (res.data.code == 200) {
-						ElMessage({
-							message: res.data.msg,
-							type: 'success',
-						});
-					} else {
-						ElMessage.error(res.data.msg);
-					}
-				});
+			formUp.targetDivideDetailList.splice(form.value.targetDivideDetailList.indexOf(data), 1);
+			formUp.targetId = data.targetId;
+			arr.value.push(data.id)
 		};
 		// 安全目标指标弹窗
 		const Shows = ref();
@@ -157,8 +167,17 @@
 		// 关闭
 		const resetForm = () => {
 			dialogVisible.value = false;
-			form.value = {};
+			form.value = {
+				qName: '',
+				indexNum: '',
+				year: '',
+				value: '',
+				targetDivideDetailList:[]
+			};
 			tableData.value = [];
+			formUp.targetId = '';
+			formUp.delTargetDivideDetails = '';
+			formUp.targetDivideDetailList = [];
 		};
 		//全屏
 		const full = ref(false);
@@ -169,7 +188,15 @@
 				full.value = false;
 			}
 		};
+		// 时间格式处理
+		const timeDate = (data: any) => {
+			console.log('xxxxxxxxxxx',data)
+			let result = new Date(data).getTime();
+			return result;
+		};
 		return {
+			arr,
+			timeDate,
 			form,
 			dialogVisible,
 			openDailog,

--
Gitblit v1.9.2