commit
This commit is contained in:
+81
@@ -0,0 +1,81 @@
|
||||
package com.budwk.app.module.activity.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.budwk.app.base.result.Result;
|
||||
import com.budwk.app.module.activity.models.ActGroup;
|
||||
import com.budwk.app.module.activity.models.Activity;
|
||||
import com.budwk.app.module.activity.service.ActivityManageService;
|
||||
import com.budwk.app.module.activity.vo.page.ActScoreEnterPageForm;
|
||||
import com.budwk.app.module.activity.vo.page.ActSignInUserPageForm;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/4/29 15:56
|
||||
* @description 成绩录入
|
||||
*/
|
||||
@IocBean
|
||||
@At("/platform/activity/scoreEnter")
|
||||
@Ok("json:full")
|
||||
public class ActScoreEnterController {
|
||||
|
||||
|
||||
@Inject
|
||||
private Dao dao;
|
||||
@Inject
|
||||
private ActivityManageService activityService;
|
||||
|
||||
@At("")
|
||||
@SaCheckPermission("activity.scoreEnter")
|
||||
@Ok("beetl:/platform/activity/scoreEnter/index.html")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At()
|
||||
@SaCheckPermission("activity.scoreEnter")
|
||||
public Result getActivityOptions(Integer year) {
|
||||
return Result.success(activityService.dao().query(Activity.class, Cnd.NEW().andEX("YEAR(startTime)", "=", year)));
|
||||
}
|
||||
|
||||
@At()
|
||||
@SaCheckPermission("activity.scoreEnter")
|
||||
public Result pageData(ActScoreEnterPageForm pageForm) {
|
||||
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
t1.*
|
||||
FROM
|
||||
`activity_item` t1
|
||||
WHERE t1.activityId=@id
|
||||
ORDER BY t1.sort asc
|
||||
""").setParam("id", pageForm.getActivityId());
|
||||
|
||||
return Result.success(activityService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(),sql));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取分组列表
|
||||
* @param activityId
|
||||
* @return
|
||||
*/
|
||||
@At()
|
||||
@SaCheckPermission("activity.scoreEnter")
|
||||
public Result getGroupList(Long activityId){
|
||||
List<ActGroup> groupList = activityService.dao().query(ActGroup.class, Cnd.where(ActGroup::getActivityId, "=", activityId));
|
||||
return Result.success(groupList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.budwk.app.module.activity.models;
|
||||
|
||||
import com.budwk.app.base.model.BaseModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.nutz.dao.entity.annotation.*;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/4/29 16:41
|
||||
* @description 活动成绩
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("activity_item")
|
||||
@TableMeta("{'mysql-charset':'utf8mb4'}")
|
||||
@Comment("活动成绩")
|
||||
@Data
|
||||
public class ActivityItemScore extends BaseModel {
|
||||
|
||||
@Id
|
||||
@Comment("ID")
|
||||
private Long id;
|
||||
|
||||
@Column
|
||||
@Comment("活动ID")
|
||||
@ColDefine(type = ColType.INT)
|
||||
private Long activityId;
|
||||
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.budwk.app.module.activity.vo.page;
|
||||
|
||||
import com.budwk.app.base.page.PageForm;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author zhf
|
||||
* @date 2025/4/29 16:08
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ActScoreEnterPageForm extends PageForm {
|
||||
|
||||
// 活动ID
|
||||
private Long activityId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
const addOrUpdate = {
|
||||
template: /*language=HTML*/ `
|
||||
<el-dialog title="录入成绩" :visible.sync="visible" width="70%">
|
||||
|
||||
<el-table show-overflow-tooltip :data="tableData" height="500">
|
||||
<el-table-column label="序号" type="index" header-align="center" align="center"
|
||||
width="50"></el-table-column>
|
||||
<el-table-column label="团队名称" prop="groupId">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.groupId" placeholder="请选择" style="width: 100%">
|
||||
<el-option v-for="item in groupList" :key="item.id" :label="item.groupName"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成绩" prop="score">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number v-model="scope.row.score"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="得分" prop="fraction">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number v-model="scope.row.fraction"></el-input-number>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="150">
|
||||
<template slot="header" slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="tableData.push({})">添加</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
`,
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
visible: false,
|
||||
infoData: {},
|
||||
tableData: [],
|
||||
groupList: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onOpen(row) {
|
||||
this.infoData = row
|
||||
this.getGroupList()
|
||||
this.visible = true
|
||||
|
||||
},
|
||||
getGroupList() {
|
||||
$.get('/platform/activity/scoreEnter/getGroupList', {activityId: this.infoData.activityId}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.groupList = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
onSubmit() {
|
||||
$.post('/platform/activity/scoreEnter/addOrUpdate', {
|
||||
activityId: this.infoData.activityId,
|
||||
itemId: this.infoData.id,
|
||||
scores: JSON.stringify(this.tableData)
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success('保存成功')
|
||||
this.visible = false
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<!--#
|
||||
layout("/layouts/platform_1.html"){
|
||||
#-->
|
||||
<div id="app">
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
placeholder="选择年"
|
||||
style="width: 100%"
|
||||
@change="getActivityOptions"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">所属活动</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.activityId" placeholder="请选择活动">
|
||||
<el-option
|
||||
v-for="item in activityOptions"
|
||||
:key="item.id"
|
||||
:label="item.title"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="never" class="mt-3">
|
||||
<el-table v-loading="tableLoading" show-overflow-tooltip :data="tableData">
|
||||
<el-table-column label="序号" prop="index" header-align="center" align="center" width="50">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目名称" prop="name"></el-table-column>
|
||||
<el-table-column label="操作" width="200">
|
||||
<template slot-scope="{row}">
|
||||
<el-button type="text" @click="$refs.addOrUpdateRef.onOpen(row)">录入成绩</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
<add-or-update ref="addOrUpdateRef" @refresh="doSearch"></add-or-update>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
<!--#include('addOrUpdate.js'){}#-->
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
components: {
|
||||
"add-or-update": addOrUpdate,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageForm: {
|
||||
year: new Date().getFullYear() + ""
|
||||
},
|
||||
activityOptions: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getActivityOptions() {
|
||||
$.post("/platform/activity/scoreEnter/getActivityOptions", {year: this.pageForm.year}).then(res => {
|
||||
if (res.code === 0) {
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.$set(this.pageForm, "activityId", res.data[0].id)
|
||||
} else {
|
||||
this.$set(this.pageForm, "activityId", "")
|
||||
}
|
||||
this.activityOptions = res.data;
|
||||
this.doSearch()
|
||||
} else {
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getActivityOptions()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user