lct
Your Name
2022-08-08 fe4005fe29aafa104485ffa2392598bd8dccd347
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
205
206
<template>
    <el-dialog v-model="dialogVisible" :fullscreen="full" title="奖惩类型" width="50%" draggable>
        <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
        <el-row>
            <el-col :span="17">
                <el-form ref="ruleFormRef" :model="ruleForm" status-icon>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item size="default">
                                <el-input v-model="ruleForm.searchParams.standardType" placeholder="奖惩类型" />
                            </el-form-item>
                        </el-col>
                        <!-- <el-col :span="6" :offset="1">
                    <el-form-item>
                        <el-input v-model="ruleForm.checkPass" placeholder="目标指标编号" />
                    </el-form-item>
                </el-col> -->
                        <el-col :span="11" :offset="1">
                            <el-form-item>
                                <el-button size="default" type="primary" @click="listApi">查询</el-button>
                                <el-button size="default" @click="resetForm">重置</el-button>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <el-button size="default" :icon="Delete" @click="clear">清除选择</el-button>
                <el-table :data="tableData" style="width: 100%; margin-top: 20px" @cell-click="radio">
                        <el-table-column align="center">
                        <template #default="scope">
                            <el-radio-group v-model="radio1">
                                <el-radio :label="scope.row.id" size="large">{{ null }}</el-radio>
                            </el-radio-group>
                        </template>
                    </el-table-column>
                    <el-table-column align="center" prop="qname" label="奖惩名称" width="180" />
                    <el-table-column align="center" label="奖惩类型" width="180">
                        <template #default="scope">
              <span v-if="scope.row.standardType==1">奖励</span>
              <span v-if="scope.row.standardType==2">惩罚</span>
              <span></span>
                        </template>
                    </el-table-column>    
                    <el-table-column align="center" prop="content" label="奖惩内容" />
                </el-table>
                <el-pagination
                    style="padding: 20px 0; border-bottom: 1px solid #dedede"
                    v-model:currentPage="currentPage4"
                    v-model:page-size="pageSize4"
                    :page-sizes="[10, 20, 30, 40]"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total"
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                />
            </el-col>
            <el-col :span="7">
            <div v-if="dynamicTags[0]==''?false:true">
                <el-tag
                    v-for="tag in dynamicTags"
                    :key="tag"
                    class="mx-1"
                    style="margin: 5px"
                    closable
                    :disable-transitions="false"
                    @close="handleClose(tag)"
                >
                    {{ tag.qname }}
                </el-tag>
                </div>
            </el-col>
        </el-row>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="dialogVisible = false" size="default">关闭</el-button>
                <el-button type="primary" @click="submitForm" size="default">确定</el-button>
            </span>
        </template>
    </el-dialog>
</template>
<script lang="ts">
import { defineComponent, reactive, ref,onMounted } from 'vue';
import { Delete, FullScreen } from '@element-plus/icons-vue';
import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext, FormInstance } from 'element-plus';
import { goalManagementApi } from '/@/api/goalManagement';
export default defineComponent({
    setup(props,{emit}) {
        // 搜索条件
        const ruleForm = reactive({
            pageSize: 10,
            pageIndex: 1,
            searchParams: {
                standardType: '', ////奖惩类型 1:奖励 2:惩罚
            },
        });
        // 重置
        const resetForm = () => {
            ruleForm.searchParams.standardType = '';
            listApi();
        };
        const listApi = () => {
            goalManagementApi()
                .getrewardPunishmentStandardList(ruleForm)
                .then((res) => {
                    if (res.data.code == 200) {
                        tableData.value = res.data.data;
                        currentPage4.value = res.data.pageIndex;
                        pageSize4.value = res.data.pageSize;
                        total.value = res.data.total;
                    } else {
                        ElMessage.error(res.data.msg);
                    }
                });
        };
        //
        const handleClick = (val: any) => {
            let targetType = JSON.parse(JSON.stringify(val));
            ruleForm.searchParams.standardType = targetType.paneName;
            listApi();
        };
        onMounted(() => {
            
        });
        // const onAddorUpdata = () => {
        //     listApi();
        // };
        // 表格
        const tableData = ref();
        const currentPage4 = ref();
        const pageSize4 = ref();
        const total = ref();
        const handleSizeChange = (val: number) => {
            // console.log(`${val} items per page`);
            ruleForm.pageSize = val;
            listApi();
        };
        const handleCurrentChange = (val: number) => {
            // console.log(`current page: ${val}`);
            ruleForm.pageIndex = val;
            listApi();
        };
        // 打开弹窗
        const dialogVisible=ref(false)
        const openDailog=()=>{
            dialogVisible.value=true
            listApi();
        }
            // 右方点击添加后显示标签
        const dynamicTags = ref(['']);
        const handleClose = (tag: string) => {
            dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
            radio1.value = '';
        };
        const radio1 = ref('');
        const radio = (event: any) => {
            dynamicTags.value[0] = event;
        };
        const clear=()=>{
            dynamicTags.value=['']
            radio1.value=""
        }
            const submitForm=()=>{
            let obj=JSON.parse(JSON.stringify(dynamicTags.value))
            emit("backNum",obj[0])
            dialogVisible.value = false
        }
        //全屏
        const full = ref(false);
        const toggleFullscreen = () => {
            if (full.value == false) {
                full.value = true;
            } else {
                full.value = false;
            }
        };
        return {
            submitForm,
            radio,
            radio1,
            clear,
            dialogVisible,
            openDailog,
            ruleForm,
            resetForm,
            tableData,
            currentPage4,
            pageSize4,
            total,
            handleSizeChange,
            handleCurrentChange,
            dynamicTags,
            listApi,
            handleClick,
            handleClose,
            Delete,
            full,
            toggleFullscreen,
            FullScreen,
        };
    },
});
</script>
<style scoped>
.el-row {
    padding: 0 0 20px 0;
}
</style>