From 1b9fea7d4af68d8f933b2dc42bf6084b9646f64c Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 04 三月 2025 08:39:55 +0800
Subject: [PATCH] 修改作业等级名称

---
 src/views/goalManagement/targetDecompositionYear/component/Dailog.vue |   71 ++++++++++++++++++++++++-----------
 1 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
index 8960533..c728ad6 100644
--- a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
+++ b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
@@ -37,12 +37,12 @@
 			</el-tab-pane>
 		</el-tabs>
 		<el-table :data="formUp.targetDivideDetailList" style="width: 100%">
-			<el-table-column align="center" property="dutyDepartmentId" label="责任部门" width="180" />
+			<el-table-column align="center" property="dutyDepartmentName" 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="制定日期" :formatter="timeDate"/>
+			<el-table-column align="center" property="makerDepartmentName" label="制定人部门" />
+			<el-table-column align="center" property="makeDate" :formatter="timeDate" label="制定日期" />
 			<el-table-column align="center" property="commitPersonName" label="上报人" />
-			<el-table-column align="center" property="操作">
+			<el-table-column align="center" label="操作">
 				<template #default="scope">
 					<el-button link type="primary" @click="daiAdd('查看', scope.row)">查看</el-button>
 					<el-button link :disabled="disabled" type="primary" @click="daiAdd('修改', scope.row)">修改</el-button>
@@ -62,23 +62,24 @@
 </template>
 <script lang="ts">
 import { defineComponent, ref, reactive } from 'vue';
-import {timeDate} from '/@/assets/index.ts'
+import { timeDate } from '/@/assets/index.ts';
 import { Search, FullScreen } from '@element-plus/icons-vue';
 import DailogAdd from './DailogAdd.vue';
 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';
+import { deepClone } from '/@/utils/other';
 export default defineComponent({
-	components: { DailogAdd, DailogSearch},
-	setup(props,{emit}) {
+	components: { DailogAdd, DailogSearch },
+	setup(props, { emit }) {
 		const dialogVisible = ref<boolean>(false);
 		const form = ref({
 			qName: '',
 			indexNum: '',
 			year: '',
 			value: '',
-			targetDivideDetailList:[]
+			targetDivideDetailList: [],
 		});
 		const targetType = ref();
 		const disabled = ref(false);
@@ -94,12 +95,28 @@
 					.then((res) => {
 						if (res.data.code == 200) {
 							form.value = res.data.data;
-							formUp.targetDivideDetailList=form.value.targetDivideDetailList
+							formUp.targetDivideDetailList = form.value.targetDivideDetailList;
+							for(let i=0;i<formUp.targetDivideDetailList.length;i++){
+								formUp.targetDivideDetailList[i].makeDate=timeC(formUp.targetDivideDetailList[i].makeDate)
+							}
 						} else {
 							ElMessage.error(res.data.msg);
 						}
 					});
 			}
+		};
+		const timeC = (timestamp: any) => {
+			let a = new Date(timestamp).getTime();
+			const date = new Date(a);
+			const Y = date.getFullYear() + '-';
+			const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+			const D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '  ';
+			const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+			const m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
+			const s = date.getSeconds(); // 秒
+			const dateString = Y + M + D + h + m +`:${s}`;
+			// console.log('dateString', dateString); // > dateString 2021-07-06 14:23
+			return dateString;
 		};
 		const onNumber = (val: object) => {
 			form.value = val;
@@ -109,7 +126,7 @@
 		// 表格
 		const tableData = ref([]);
 		// 新增弹窗
-		const index=ref<any>()
+		const index = ref<any>();
 		const Show = ref();
 		const daiAdd = (title: string, data: any) => {
 			index.value = formUp.targetDivideDetailList.indexOf(data);
@@ -120,19 +137,27 @@
 			delTargetDivideDetails: '', //要删除的目标指标分解ID,多个用逗号隔开
 			targetDivideDetailList: [], //目标指标分解列表
 		});
+
 		const add = (val: any) => {
-            if(index.value==-1){
-				formUp.targetDivideDetailList.push(val);
-			}else{
-				formUp.targetDivideDetailList[index.value] = val;
+			const item = deepClone(val);
+			console.log(item)
+			if (index.value == -1) {
+				formUp.targetDivideDetailList.push(item);
+			} else {
+				formUp.targetDivideDetailList[index.value] = item;
 			}
-			
+
 			// let obj=JSON.parse(JSON.stringify(form.value))
 		};
 		// 新增
 		const submitForm = () => {
-			formUp.delTargetDivideDetails=arr.value.toString()
+			formUp.delTargetDivideDetails = arr.value.toString();
 			formUp.targetId = form.value.id;
+			dialogVisible.value = false;
+			for(let i=0;i<formUp.targetDivideDetailList.length;i++){
+				delete formUp.targetDivideDetailList[i].dutyDepartmentName
+				delete formUp.targetDivideDetailList[i].makerDepartmentName
+			}
 			goalManagementApi()
 				.gettargetDivideDetail(formUp)
 				.then((res) => {
@@ -141,30 +166,29 @@
 							message: res.data.msg,
 							type: 'success',
 						});
-						dialogVisible.value = false;
-						emit("addList")
+						emit('addList');
 					} else {
 						ElMessage.error(res.data.msg);
 					}
 				});
-				form.value = {
+			form.value = {
 				qName: '',
 				indexNum: '',
 				year: '',
 				value: '',
-				targetDivideDetailList:[]
+				targetDivideDetailList: [],
 			};
 			tableData.value = [];
 			formUp.targetId = '';
 			formUp.delTargetDivideDetails = '';
 			formUp.targetDivideDetailList = [];
 		};
-		const arr=ref([])
+		const arr = ref([]);
 		// 删除
 		const Delete = (data: any) => {
 			formUp.targetDivideDetailList.splice(form.value.targetDivideDetailList.indexOf(data), 1);
 			formUp.targetId = data.targetId;
-			arr.value.push(data.id)
+			arr.value.push(data.id);
 		};
 		// 安全目标指标弹窗
 		const Shows = ref();
@@ -179,7 +203,7 @@
 				indexNum: '',
 				year: '',
 				value: '',
-				targetDivideDetailList:[]
+				targetDivideDetailList: [],
 			};
 			tableData.value = [];
 			formUp.targetId = '';
@@ -201,6 +225,7 @@
 		// 	return result;
 		// };
 		return {
+			timeC,
 			index,
 			timeDate,
 			arr,

--
Gitblit v1.9.2