From 09a7d782235db3192db6cd0013e96a3a9265a3fd Mon Sep 17 00:00:00 2001
From: shj <1790240199@qq.com>
Date: Wed, 27 Jul 2022 17:49:33 +0800
Subject: [PATCH] 对接
---
src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue | 79 ++++++++++++++++++++++++++++-----------
1 files changed, 57 insertions(+), 22 deletions(-)
diff --git a/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue b/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue
index f47e4ef..cb66dc1 100644
--- a/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue
+++ b/src/views/goalManagement/IncentiveRecording/component/DailogAdd.vue
@@ -1,7 +1,7 @@
<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="员工姓名" size="default">
@@ -49,8 +49,8 @@
</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">确定</el-button>
</span>
</template>
</el-dialog>
@@ -61,27 +61,59 @@
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 openDailog = (type: string, value: any, projectList: any, projectId: string) => {
+ const form = ref({});
+ const titles = ref();
+ const disabled = ref(false);
+ // 打开弹窗
+ const openDailog = (title: string, value: any, id: number) => {
dialogVisible.value = true;
+ titles.value = `${title}奖惩标准设定`;
+ disabled.value = title == '查看' ? true : false;
+ if (title == '查看' || title == '修改')
+ goalManagementApi()
+ .getrewardPunishmentDetail(id)
+ .then((res) => {
+ if (res.data.code == 200) {
+ form.value = res.data.data;
+ } else {
+ ElMessage.error(res.data.msg);
+ }
+ });
};
- // 导航
- const activeName = ref('1');
- // 表格
+ // 提交
+ const submitForm = () => {
+ dialogVisible.value = false;
+ 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 = {
+
+ }
+ };
+ // 取消
+ const resetForm = () => {
+ dialogVisible.value = false;
+ form.value = {
+
+ };
+ };
// 安全目标指标弹窗
const Shows = ref();
@@ -102,17 +134,20 @@
}
};
return {
- form,
dialogVisible,
+ form,
+ titles,
+ disabled,
openDailog,
- activeName,
+ submitForm,
+ resetForm,
Shows,
daiInpt,
Show,
daiInpts,
- Search,
full,
toggleFullscreen,
+ Search,
FullScreen,
};
},
--
Gitblit v1.9.2