From cefcb88c6cd0690052e503d5f1c943cb7f8a03cb Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期三, 30 十一月 2022 09:18:32 +0800
Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/gtqt
---
src/views/goalManagement/Incentivestandard/index.vue | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 283 insertions(+), 0 deletions(-)
diff --git a/src/views/goalManagement/Incentivestandard/index.vue b/src/views/goalManagement/Incentivestandard/index.vue
index e69de29..c0aadc8 100644
--- a/src/views/goalManagement/Incentivestandard/index.vue
+++ b/src/views/goalManagement/Incentivestandard/index.vue
@@ -0,0 +1,283 @@
+<template>
+ <div>
+ <el-form ref="ruleFormRef" :model="ruleForm" status-icon label-width="20px" class="topTitle">
+ <el-row>
+ <el-col :span="4">
+ <el-form-item>
+ <el-select v-model="ruleForm.searchParams.standardType" size="default" style="width: 100%" placeholder="请选择">
+ <el-option label="奖励" value="1" />
+ <el-option label="惩罚" value="2" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <!-- <el-col :span="4">
+ <el-form-item>
+ <el-input v-model="ruleForm.checkPass" placeholder="目标指标编号" />
+ </el-form-item>
+ </el-col> -->
+ <el-col :span="4">
+ <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>
+ <div class="minCenter">
+ <div class="btns">
+ <div>
+ <el-button size="default" type="primary" :icon="Plus" @click="openD('新建')" >新建</el-button>
+ <el-button size="default" type="warning" :disabled="warning" plain :icon="EditPen"
+ @click="openD('修改', deletAll[0])">修改 </el-button>
+ <el-button size="default" type="danger" :disabled="danger" :icon="Delete" plain @click="handleSelectionChange">删除</el-button>
+ </div>
+ <div>
+ <!-- <el-button size="default" :icon="Upload" @click="upButton"></el-button>
+ <el-button size="default" :icon="Download"></el-button>
+ <el-button size="default" :icon="Refresh"></el-button> -->
+ </div>
+ </div>
+ <el-table ref="multipleTableRef" :data="tableData" @selection-change="handleSelectionChange" style="width: 100%">
+ <el-table-column type="selection" align="center" width="55" />
+ <el-table-column property="qname" align="center" label="奖惩名称" sortable />
+ <el-table-column property="name" align="center" label="奖惩类型" sortable>
+ <template #default="scope">
+ <span v-if="scope.row.standardType == 1">奖励</span>
+ <span v-if="scope.row.standardType == 2">惩罚</span>
+ </template>
+ </el-table-column>
+ <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 property="memo" 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="Delete" @click="onDelete(scope.row.id)">删除 </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div class="pages">
+ <el-pagination
+ 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"
+ />
+ </div>
+ <DailogAdd ref="openAdd" @navAddorUpdata="onAddorUpdata"></DailogAdd>
+ <!-- <upData ref="upShow"></upData> -->
+ </div>
+ </div>
+</template>
+<script lang="ts">
+import DailogAdd from './component/DailogAdd.vue';
+import upData from '../../../components/updata/updata.vue';
+import { ref, toRefs, reactive, onMounted, defineComponent } from 'vue';
+import { ElMessageBox, ElMessage, ElButton, ElInput, TabsPaneContext, FormInstance } from 'element-plus';
+import { Plus, Delete, Upload, Download, Refresh, View, EditPen } from '@element-plus/icons-vue';
+import type { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults';
+import { goalManagementApi } from '/@/api/goalManagement';
+export default defineComponent({
+ components: { ElButton, ElInput, upData, DailogAdd },
+ setup() {
+ // 搜索条件
+ 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(() => {
+ listApi();
+ });
+ 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 openAdd = ref();
+ const openD = (title: String, id: number) => {
+ openAdd.value.openDailog(title, ruleForm.searchParams.standardType, id);
+ };
+ // 删除
+ const onDelete = (id: number) => {
+ let arr=[]
+ arr.push(id)
+ ElMessageBox.confirm('确定删除所选项吗?', 'Warning', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ goalManagementApi()
+ .getrewardPunishmentStandardDelete(arr)
+ .then((res) => {
+ if (res.data.code == 200) {
+ ElMessage({
+ message: res.data.msg,
+ type: 'success',
+ });
+ listApi();
+ } else {
+ ElMessage.error(res.data.msg);
+ }
+ });
+ })
+ .catch(() => {
+ ElMessage({
+ type: 'info',
+ message: 'Delete canceled',
+ });
+ });
+ };
+ // 批量删除
+ const warning = ref(true);
+ const danger = ref(true);
+ const deletAll = ref();
+ const handleSelectionChange = (val: any) => {
+ 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;
+ if (val.length == 1) {
+ warning.value = false;
+ danger.value = false;
+ } else if (val.length == 0) {
+ warning.value = true;
+ danger.value = true;
+ } else {
+ warning.value = true;
+ danger.value = false;
+ }
+ };
+ const onDeleteAll = () => {
+ ElMessageBox.confirm('确定删除所选项吗?', 'Warning', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning',
+ })
+ .then(() => {
+ goalManagementApi()
+ .getrewardPunishmentStandardDelete(deletAll.value)
+ .then((res) => {
+ if (res.data.code == 200) {
+ ElMessage({
+ message: res.data.msg,
+ type: 'success',
+ });
+ listApi();
+ } else {
+ ElMessage.error(res.data.msg);
+ }
+ });
+ })
+ .catch(() => {
+ // ElMessage({
+ // type: 'info',
+ // message: 'Delete canceled',
+ // });
+ });
+ };
+ return {
+ ruleForm,
+ resetForm,
+ listApi,
+ handleClick,
+ onAddorUpdata,
+ tableData,
+ currentPage4,
+ pageSize4,
+ total,
+ handleSizeChange,
+ handleCurrentChange,
+ openAdd,
+ openD,
+ onDelete,
+ warning,
+ danger,
+ deletAll,
+ handleSelectionChange,
+ onDeleteAll,
+ Plus,
+ Delete,
+ Upload,
+ Download,
+ Refresh,
+ View,
+ EditPen,
+ };
+ },
+});
+</script>
+<style scoped>
+.minCenter {
+ width: 100%;
+ background-color: #fff;
+ margin-top: 10px;
+ padding: 0 20px;
+}
+
+.topTitle {
+ background-color: #fff;
+ padding: 20px 0px 20px 0px;
+ margin-bottom: 10px;
+}
+
+.btns {
+ padding: 10px 0px 10px 0px;
+ display: flex;
+ justify-content: space-between;
+}
+
+.pages {
+ padding: 20px 0;
+ display: flex;
+ justify-content: right;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.2