Your Name
2022-08-11 988558aaa309068fd393cc654be537434b0a15ea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<template>
    <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" :disabled="disabled" label-width="120px">
            <el-row>
                <el-col :span="24">
                    <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="奖惩名称" 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="奖惩类型" 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="奖惩内容" 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="依据" 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.memo" type="textarea" />
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <template #footer>
            <span class="dialog-footer">
                <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" @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(props, { emit }) {
        const dialogVisible = ref<boolean>(false);
        const form = ref({
            rewardPunishmentStandardId: '', //奖惩标准/外键
            rewardPunishmentStandardName: '',
            memo: '', ////备注信息
            personId: '', ////员工(多个用逗号隔开)
            personName: '',
        });
        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 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();
        const daiInpt = () => {
            Shows.value.openDailog();
        };
        const Show = ref();
        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);
        const toggleFullscreen = () => {
            if (full.value == false) {
                full.value = true;
            } else {
                full.value = false;
            }
        };
        return {
            dialogVisible,
            UserId,
            form,
            titles,
            disabled,
            openDailog,
            submitForm,
            numberId,
            resetForm,
            Shows,
            daiInpt,
            Show,
            daiInpts,
            full,
            toggleFullscreen,
            Search,
            FullScreen,
        };
    },
});
</script>
<style scoped>
.el-row {
    padding: 0 0 20px 0;
}
</style>