From c60ce7e35c2c4e2f4c8b2aa24aab839a931f3a62 Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: Thu, 11 Aug 2022 15:11:14 +0800
Subject: [PATCH] 对接
---
src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue | 153 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 116 insertions(+), 37 deletions(-)
diff --git a/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue b/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue
index 8f011ba..c0a5906 100644
--- a/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue
+++ b/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue
@@ -1,87 +1,143 @@
<template>
- <el-dialog v-model="dialogVisible" :fullscreen="full" title="新建奖惩记录" width="50%" draggable>
+ <el-dialog v-model="dialogVisible" :before-close="resetForm" :fullscreen="full" :title="titles" width="50%" draggable>
<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
- <el-form :model="form" label-width="120px">
+ <el-form :model="form" :disabled="disabled" label-width="120px">
<el-row>
<el-col :span="24">
- <el-form-item label="员工姓名">
- <el-input v-model="form.name" placeholder="请选择">
- <template #append> <el-button :icon="Search" @click="daiInpts" /> </template
+ <el-form-item label="员工姓名" size="default">
+ <el-input v-model="form.personName" placeholder="请选择">
+ <template #append> <el-button :icon="Search" @click="daiInpts(0)" /> </template
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="11">
- <el-form-item label="奖惩名称">
- <el-input v-model="form.name" placeholder="请选择">
+ <el-form-item label="奖惩名称" size="default">
+ <el-input v-model="form.rewardPunishmentStandardName" placeholder="请选择">
<template #append> <el-button :icon="Search" @click="daiInpt" /> </template
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
- <el-form-item label="奖惩类型">
- <el-input v-model="form.name" />
+ <el-form-item label="奖惩类型" size="default">
+ <el-select v-model="form.standardType" disabled size="default" style="width: 100%" placeholder="请选择">
+ <el-option label="奖励" :value="1" />
+ <el-option label="惩罚" :value="2" />
+ </el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
- <el-form-item label="奖惩内容">
- <el-input v-model="form.name" placeholder="请填写奖惩内容" />
+ <el-form-item label="奖惩内容" size="default">
+ <el-input disabled v-model="form.content" placeholder="请填写奖惩内容" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
- <el-form-item label="依据">
- <el-input v-model="form.name" placeholder="请填写奖惩依据" />
+ <el-form-item label="依据" size="default">
+ <el-input disabled v-model="form.reason" placeholder="请填写奖惩依据" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注信息">
- <el-input v-model="form.name" type="textarea" />
+ <el-input v-model="form.memo" type="textarea" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<span class="dialog-footer">
- <el-button @click="dialogVisible = false" size="default">关闭</el-button>
- <el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button>
+ <el-button @click="resetForm" size="default">关闭</el-button>
+ <el-button type="primary" @click="submitForm" size="default" :disabled="disabled">确定</el-button>
</span>
</template>
</el-dialog>
- <DailogSearchUser ref="Show"></DailogSearchUser>
- <DailogSearch ref="Shows"></DailogSearch>
+ <DailogSearchUser ref="Show" @SearchUser="UserId"></DailogSearchUser>
+ <DailogSearch ref="Shows" @backNum="numberId"></DailogSearch>
</template>
<script lang="ts">
import { defineComponent, ref, reactive } from 'vue';
import { Search, FullScreen } from '@element-plus/icons-vue';
import DailogSearch from './DailogSearch.vue';
+import { goalManagementApi } from '/@/api/goalManagement';
import DailogSearchUser from '/@/components/DailogSearchUser/index.vue';
+import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext } from 'element-plus';
export default defineComponent({
components: { DailogSearch, DailogSearchUser },
- setup() {
+ setup(props, { emit }) {
const dialogVisible = ref<boolean>(false);
- const form = reactive({
- name: '',
- region: '',
- date1: '',
- date2: '',
- delivery: false,
- type: [],
- resource: '',
- desc: '',
+ const form = ref({
+ rewardPunishmentStandardId: '', //奖惩标准/外键
+ rewardPunishmentStandardName: '',
+ memo: '', ////备注信息
+ personId: '', ////员工(多个用逗号隔开)
+ personName: '',
});
- const openDailog = (type: string, value: any, projectList: any, projectId: string) => {
+ const titles = ref();
+ const disabled = ref(false);
+ // 打开弹窗
+ const openDailog = (title: string, value: any, data: any) => {
dialogVisible.value = true;
+ titles.value = `${title}奖惩标准设定`;
+ disabled.value = title == '查看' ? true : false;
+ if (title == '查看' || title == '修改')
+ goalManagementApi()
+ .getrewardPunishmentDetail(data.id)
+ .then((res) => {
+ if (res.data.code == 200) {
+ form.value = res.data.data;
+ form.value.standardType = data.standardType;
+ form.value.content = data.content;
+ form.value.reason = data.reason;
+ } else {
+ ElMessage.error(res.data.msg);
+ }
+ });
};
- // 导航
- const activeName = ref('1');
- // 表格
+ // 提交
+ const submitForm = () => {
+ dialogVisible.value = false;
+ delete form.value.standardType;
+ delete form.value.content;
+ delete form.value.reason;
+ delete form.value.rewardPunishmentStandardName
+ goalManagementApi()
+ .getrewardPunishmentAddOrUpdate(form.value)
+ .then((res) => {
+ if (res.data.code == 200) {
+ ElMessage({
+ message: res.data.msg,
+ type: 'success',
+ });
+ emit('navAddorUpdata');
+ } else {
+ ElMessage.error(res.data.msg);
+ }
+ });
+ form.value = {
+ rewardPunishmentStandardId: '', //奖惩标准/外键
+ rewardPunishmentStandardName: '',
+ memo: '', ////备注信息
+ personId: '', ////员工(多个用逗号隔开)
+ personName: '',
+ };
+ };
+ // 取消
+ const resetForm = () => {
+ dialogVisible.value = false;
+ form.value = {
+ rewardPunishmentStandardId: '', //奖惩标准/外键
+ rewardPunishmentStandardName: '',
+ memo: '', ////备注信息
+ personId: '', ////员工(多个用逗号隔开)
+ personName: '',
+ };
+ };
// 安全目标指标弹窗
const Shows = ref();
@@ -89,8 +145,26 @@
Shows.value.openDailog();
};
const Show = ref();
- const daiInpts = () => {
- Show.value.openDailog();
+ const daiInpts = (type: any) => {
+ Show.value.openDailog(type);
+ };
+ const numberId = (val: any) => {
+ console.log(val);
+ form.value.rewardPunishmentStandardId = val.id;
+ form.value.rewardPunishmentStandardName = val.qname;
+ form.value.standardType = val.standardType;
+ form.value.content = val.content;
+ form.value.reason = val.reason;
+ };
+ const UserId = (val: any) => {
+ let arr = [];
+ let arrId = [];
+ for (let i = 0; i < val.length; i++) {
+ arr.push(val[i].realName);
+ arrId.push(val[i].uid);
+ }
+ form.value.personName = arr.toString();
+ form.value.personId = arrId.toString();
};
//全屏
const full = ref(false);
@@ -102,17 +176,22 @@
}
};
return {
- form,
dialogVisible,
+ UserId,
+ form,
+ titles,
+ disabled,
openDailog,
- activeName,
+ submitForm,
+ numberId,
+ resetForm,
Shows,
daiInpt,
Show,
daiInpts,
- Search,
full,
toggleFullscreen,
+ Search,
FullScreen,
};
},
--
Gitblit v1.9.2