From 375b6acbd3a8f9cf51f967b09ecd09eccd1a12f3 Mon Sep 17 00:00:00 2001
From: zhaojiale <631455805@qq.com>
Date: 星期四, 18 八月 2022 17:53:29 +0800
Subject: [PATCH] 统计 事故统计

---
 src/views/goalManagement/IncentiveRecording/index.vue |   50 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/src/views/goalManagement/IncentiveRecording/index.vue b/src/views/goalManagement/IncentiveRecording/index.vue
index 0a2f8d9..829190a 100644
--- a/src/views/goalManagement/IncentiveRecording/index.vue
+++ b/src/views/goalManagement/IncentiveRecording/index.vue
@@ -4,7 +4,7 @@
 			<el-row>
 				<el-col :span="4">
 					<el-form-item size="default">
-						<el-input v-model="ruleForm.searchParams.personId" placeholder="请选择被奖惩者">
+						<el-input v-model="personName" placeholder="请选择被奖惩者">
 							<template #append>
 								<el-button :icon="Search" @click="openSearch" />
 							</template>
@@ -28,8 +28,9 @@
 			<div class="btns">
 				<div>
 					<el-button size="default" type="primary" :icon="Plus" @click="openD('新建')">新建</el-button>
-					<el-button size="default" :disabled="warning" type="warning" plain :icon="EditPen">修改</el-button>
-					<el-button size="default" :disabled="danger" type="danger" :icon="Delete" plain @click="handleSelectionChange">删除 </el-button>
+					 <el-button size="default" :disabled="warning" type="warning" plain :icon="EditPen"
+								@click="openD('修改', editRow)">修改</el-button>
+					<el-button size="default" :disabled="danger" type="danger" :icon="Delete" plain @click="onDeleteAll">删除 </el-button>
 				</div>
 				<div>
 					<!-- <el-button size="default" :icon="Download"></el-button>
@@ -38,20 +39,20 @@
 			</div>
 			<el-table ref="multipleTableRef" :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">
 				<el-table-column type="selection" align="center" width="55" />
-				<el-table-column property="createTime" align="center" label="奖惩日期" sortable />
+				<el-table-column property="createTime" align="center" label="奖惩日期" :formatter="timeDate" sortable />
 				<el-table-column label="奖惩类型" align="center" sortable>
 					<template #default="scope">
-					<span v-if="scope.row.standardType==1">奖励</span>
-					<span v-if="scope.row.standardType==2">惩罚</span>
+						<span v-if="scope.row.standardType == 1">奖励</span>
+						<span v-if="scope.row.standardType == 2">惩罚</span>
 					</template>
 				</el-table-column>
-				<el-table-column property="personId" align="center" label="被奖惩者" sortable />
+				<el-table-column property="personName" align="center" label="被奖惩者" sortable />
 				<el-table-column property="content" label="奖惩内容" align="center" sortable show-overflow-tooltip />
 				<el-table-column property="reason" label="奖惩依据" align="center" sortable show-overflow-tooltip />
 				<el-table-column label="操作" align="center" sortable show-overflow-tooltip>
 					<template #default="scope">
-						<el-button link type="primary" size="default" :icon="View" @click="openD('查看', scope.row.id)">查看 </el-button>
-						<el-button link type="primary" size="default" :icon="EditPen" @click="openD('修改', scope.row.id)">修改</el-button>
+						<el-button link type="primary" size="default" :icon="View" @click="openD('查看', scope.row)">查看 </el-button>
+						<el-button link type="primary" size="default" :icon="EditPen" @click="openD('修改', scope.row)">修改</el-button>
 						<el-button link type="primary" size="default" :icon="Delete" @click="onDelete(scope.row.id)">删除 </el-button>
 					</template>
 				</el-table-column>
@@ -68,12 +69,13 @@
 				/>
 			</div>
 			<DailogAdd ref="openAdd" @navAddorUpdata="onAddorUpdata"></DailogAdd>
-			<DailogSearchUser ref="openUser"></DailogSearchUser>
+			<DailogSearchUser ref="openUser" @SearchUser="userId"></DailogSearchUser>
 		</div>
 	</div>
 </template>
 <script lang="ts">
 import DailogAdd from './component/DailogAdd.vue';
+import {timeDate} from '/@/assets/index.ts'
 import DailogSearchUser from '/@/components/DailogSearchUser/index.vue';
 import { ref, toRefs, reactive, onMounted, defineComponent } from 'vue';
 import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext, FormInstance } from 'element-plus';
@@ -87,12 +89,14 @@
 			pageSize: 10,
 			pageIndex: 1,
 			searchParams: {
-				personId: '1', ////员工
+				personId: '', ////员工
 			},
 		});
 		// 重置
+		const personName=ref()
 		const resetForm = () => {
 			ruleForm.searchParams.personId = '';
+	        personName.value = '';
 			listApi();
 		};
 		const listApi = () => {
@@ -143,6 +147,8 @@
 		};
 		// 删除
 		const onDelete = (id: number) => {
+			let arr=[]
+			arr.push(id)
 			ElMessageBox.confirm('确定删除所选项吗?', 'Warning', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -150,7 +156,7 @@
 			})
 				.then(() => {
 					goalManagementApi()
-						.getrewardPunishmentDelete(id)
+						.getrewardPunishmentDelete(arr)
 						.then((res) => {
 							if (res.data.code == 200) {
 								ElMessage({
@@ -174,13 +180,15 @@
 		const warning = ref(true);
 		const danger = ref(true);
 		const deletAll = ref();
+		const editRow = ref()
 		const handleSelectionChange = (val: any) => {
+			editRow.value = val[0]
 			let valId = JSON.parse(JSON.stringify(val));
 			let arr = [];
 			for (let i = 0; i < valId.length; i++) {
 				arr.push(valId[i].id);
 			}
-			deletAll.value = arr.toString();
+			deletAll.value = arr
 			if (val.length == 1) {
 				warning.value = false;
 				danger.value = false;
@@ -220,12 +228,19 @@
 					// });
 				});
 		};
-		const openUser=ref()
-		const openSearch=()=>{
-			openUser.value.openDailog()
-		}
+		const openUser = ref();
+		const openSearch = () => {
+			openUser.value.openDailog();
+		};
+		const userId = (val: any) => {
+			ruleForm.searchParams.personId = val.uid;
+			personName.value = val.realName;
+		};
 		return {
+			timeDate,
+			personName,
 			ruleForm,
+			userId,
 			resetForm,
 			listApi,
 			handleClick,
@@ -254,6 +269,7 @@
 			View,
 			EditPen,
 			Search,
+			editRow
 		};
 	},
 });

--
Gitblit v1.9.2