From 8bf46f7b6a6b3d81f3194499239c7dae9ccd87c9 Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: 星期四, 11 八月 2022 11:02:10 +0800
Subject: [PATCH] 对接

---
 src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue |   16 ++++++--
 src/views/goalManagement/targetDecompositionYear/component/Dailog.vue    |   50 +++++++++++++------------
 2 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
index 1dd0819..1157f13 100644
--- a/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
+++ b/src/views/goalManagement/targetDecompositionYear/component/Dailog.vue
@@ -37,9 +37,9 @@
 			</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="makerDepartmentName" label="制定人部门" />
 			<el-table-column align="center" property="makeDate" label="制定日期" />
 			<el-table-column align="center" property="commitPersonName" label="上报人" />
 			<el-table-column align="center" property="操作">
@@ -62,24 +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'
+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);
@@ -95,7 +95,7 @@
 					.then((res) => {
 						if (res.data.code == 200) {
 							form.value = res.data.data;
-							formUp.targetDivideDetailList=form.value.targetDivideDetailList
+							formUp.targetDivideDetailList = form.value.targetDivideDetailList;
 						} else {
 							ElMessage.error(res.data.msg);
 						}
@@ -110,7 +110,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);
@@ -122,23 +122,26 @@
 			targetDivideDetailList: [], //目标指标分解列表
 		});
 
-
-
-
 		const add = (val: any) => {
-			const item = deepClone(val)
-            if(index.value==-1){
+			const item = deepClone(val);
+			console.log(item)
+			if (index.value == -1) {
 				formUp.targetDivideDetailList.push(item);
-			}else{
+			} 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) => {
@@ -147,30 +150,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();
@@ -185,7 +187,7 @@
 				indexNum: '',
 				year: '',
 				value: '',
-				targetDivideDetailList:[]
+				targetDivideDetailList: [],
 			};
 			tableData.value = [];
 			formUp.targetId = '';
diff --git a/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue b/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue
index cf55c01..a06417d 100644
--- a/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue
+++ b/src/views/goalManagement/targetDecompositionYear/component/DailogAdd.vue
@@ -5,7 +5,7 @@
 			<el-row>
 				<el-col :span="11">
 					<el-form-item label="责任部门" prop="dutyDepartmentId" size="default">
-						<el-tree-select v-model="form.dutyDepartmentId" check-strictly="true" :data="data" class="w100" :props="propse" placeholder="请选择" />
+						<el-tree-select v-model="form.dutyDepartmentId" check-strictly="true" @current-change="dutyName" :data="data" class="w100" :props="propse" placeholder="请选择" />
 					</el-form-item>
 				</el-col>
 				<el-col :span="11" :offset="2">
@@ -17,7 +17,7 @@
 			<el-row>
 				<el-col :span="11">
 					<el-form-item label="制定人部门" prop="makerDepartmentId" size="default">
-						<el-tree-select v-model="form.makerDepartmentId" :data="data" check-strictly="true" class="w100" :props="propse" placeholder="请选择" />
+						<el-tree-select v-model="form.makerDepartmentId" :data="data" @current-change="makerName" check-strictly="true" class="w100" :props="propse" placeholder="请选择" />
 					</el-form-item>
 				</el-col>
 				<el-col :span="11" :offset="2">
@@ -41,7 +41,7 @@
 			<span class="dialog-footer">
 				
 				<el-button @click="resetForm(ruleFormRef)" size="default">关闭</el-button>
-				<el-button type="primary" @click="submitForm(ruleFormRef)" size="default">确定</el-button>
+				<el-button type="primary" @click="submitForm(ruleFormRef)" :disabled="disabled" size="default">确定</el-button>
 			</span>
 		</template>
 	</el-dialog>
@@ -167,7 +167,7 @@
 		const resetForm = (formEl: FormInstance | undefined) => {
 			// console.log(formEl);
 			if (!formEl) return
-			formEl.resetFields();
+			formEl.clearValidate();
 			dialogVisible.value = false;
 			form.value={}
 		};
@@ -189,8 +189,16 @@
 			form.value.commitPersonId = e.uid;
 			form.value.commitPersonName = e.realName;
 		};
+		const makerName=(data:any)=>{
+			form.value.makerDepartmentName=data.depName
+		}
+		const dutyName=(data:any)=>{
+			form.value.dutyDepartmentName=data.depName
+		}
 		return {
 			disabled,
+			makerName,
+			dutyName,
 			titles,
 			// handleClose,
 			form,

--
Gitblit v1.9.2