first commit

This commit is contained in:
2026-09-08 19:49:21 +08:00
commit ebffbab428
7320 changed files with 1477614 additions and 0 deletions
@@ -0,0 +1,868 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" class="platform" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">&emsp;&emsp;</div>
<div class="search-item-option">
<el-date-picker
@change="yearChange"
v-model="pageForm.year"
type="year"
value-format="yyyy" style="width: 100%"
placeholder="选择年">
</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="请选择活动名称" filterable clearable
style="width: 100%" @change="doSearchS">
<el-option
v-for="item in activityList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">活动项目</div>
<div class="search-item-option">
<el-select v-model="pageForm.eventId" placeholder="请选择活动项目" filterable clearable
style="width: 100%" @change="doSearchS">
<el-option
v-for="item in events"
:key="item.eventId"
:label="item.allName"
:value="item.eventId">
</el-option>
</el-select>
</div>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="项目列表" :app="this">
<template #label_end>
<!--<el-radio-group v-model="pageForm.isMenWomen" @change="doSearch"
style="margin-left: 10px">
<el-radio-button :label="1">全部</el-radio-button>
<el-radio-button :label="2">男子</el-radio-button>
<el-radio-button :label="3">女子</el-radio-button>
<el-radio-button :label="4">团体</el-radio-button>
</el-radio-group>-->
<el-checkbox-group @change="doSearch" class="mr10" v-model="pageForm.isMenWomen">
<el-checkbox-button :key="2" :label="2">男子</el-checkbox-button>
<el-checkbox-button :key="3" :label="3">女子</el-checkbox-button>
</el-checkbox-group>
<el-checkbox-group @change="doSearch" v-model="pageForm.isMenWomen">
<el-checkbox-button :key="4" :label="4">单项</el-checkbox-button>
<el-checkbox-button :key="5" :label="5">团体</el-checkbox-button>
</el-checkbox-group>
<div class="search-item-option">
<el-select v-model="pageForm.groupName" placeholder="请选择组别"
filterable clearable
style="width: 100%;margin-bottom: 5px;margin-left: 10px" @change="doSearch">
<el-option
v-for="item in groupList"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</div>
</template>
</table-tool>
<el-table :data="tableData" style="width: 100%;margin-bottom: 20px" row-key="id"
@sort-change="pageOrder" v-loading="tableLoading" :size="tableSize" class="vi-table">
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column prop="allName" align="center" header-align="center"
label="项目名称"></el-table-column>
<el-table-column prop="rs" align="center" header-align="center"
label="获奖数量"></el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center" label="操作" width="150px">
<template scope="{row}">
<el-dropdown @command="dropdownCommand">
<el-button size="mini" :loading="row.loading">
<i class="ti-settings"></i>
<span class="ti-angle-down"></span>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{type:'input',row}">
录入成绩
</el-dropdown-item>
<el-dropdown-item :command="{type:'view',row}">
&emsp;&emsp;
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #edit_func>
<el-button type="primary" @click="openAdd" v-if="awardsMode==1">临时获奖人员添加</el-button>
<el-button type="primary" @click="doAdd">确 定</el-button>
</template>
<template #edit>
<template>
<vi-title title="录入成绩"></vi-title>
<el-form :model="formData" ref="addForm" label-width="120px"
label-suffix="">
<el-row gutter="40">
<el-col :span="12">
<el-form-item prop="name" label="活动名称">
<el-input maxlength="200" disabled v-model="name"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="allName" label="活动项目">
<el-input maxlength="200" disabled v-model="allName"
type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
<div style="display: flex;margin: 20px 0">
<el-divider content-position="left">获奖名次列表</el-divider>
<div style="padding-left: 10px;padding-top: 10px;">
<el-tooltip class="item" effect="dark" content="点击添加活动人员" placement="top">
<el-button style="float: right;margin-bottom: 10px" type="primary" icon="el-icon-plus"
size="mini"
@click="openAddUser">
添加
</el-button>
</el-tooltip>
</div>
</div>
<el-table style="margin-bottom: 20px" border stripe :data="userData" size="small"
v-loading="userTabLoading">
<el-table-column
type="index" label="序号" header-align="center" align="center" width="100">
</el-table-column>
<el-table-column align="center" header-align="center"
:label="awardsMode==1?'姓名':'分工会'"
prop="id">
<template scope="{$index,row}">
<el-select v-model="row.userId" @change="(val)=>{userDetailsChange(val,row)}"
placeholder="请输入姓名" filterable clearable
style="width: 100%" size="small" v-if="awardsMode==1">
<el-option
v-for="item in userList"
:disabled="item.disabled"
:key="item.id"
:label="item.username+''+item.loginname+''+item.sex"
:value="item.id">
</el-option>
</el-select>
<el-select v-model="row.unionId" @change="(val)=>{unionDetailsChange(val,row)}"
placeholder="请输入分工会" filterable clearable
style="width: 100%" size="small" v-if="awardsMode==2">
<el-option
v-for="item in unionList"
:disabled="item.disabled"
:key="item.id"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="名次" prop="ranking">
<template scope="{$index,row}">
<el-select v-model="row.ranking" @change="rankingChange(row)"
placeholder="请输入名次" filterable clearable
style="width: 100%" size="small">
<el-option
v-for="item in rankingList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="积分" prop="integral">
<template scope="{row}">
<el-input-number v-model="row.integral"
type="text"></el-input-number>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="人数" prop="numberOfPeople"
v-if="awardsMode==2">
<template scope="{row}">
<el-input-number v-model="row.numberOfPeople"
type="text"></el-input-number>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="分工会" prop="unionname"
v-if="awardsMode==1">
<template scope="{row}">
<el-input v-model="row.unionname" disabled placeholder="分工会"
type="text"></el-input>
</template>
</el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center" label="操作"
width="150px">
<template scope="{$index,row}">
<el-button type="danger" icon="el-icon-delete" circle
@click="delUser($index,row)"></el-button>
</template>
</el-table-column>
</el-table>
</el-form>
</template>
</template>
<template #view>
<el-form :model="formData" ref="addForm" label-width="120px" label-suffix="">
<el-row gutter="40">
<el-col :span="12">
<el-form-item prop="name" label="活动名称">
<el-input maxlength="200" disabled v-model="name"
type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="allName" label="活动项目">
<el-input maxlength="200" disabled v-model="allName"
type="text"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="display: flex;margin: 20px 0">
<el-divider content-position="left">获奖名次列表</el-divider>
</div>
<el-table style="margin-bottom: 20px" border stripe :data="viewData" size="small"
v-loading="userTabLoading">
<el-table-column
type="index" label="序号" header-align="center" align="center" width="100">
</el-table-column>
<el-table-column align="center" header-align="center"
:label="awardsMode==1?'姓名':'分工会'"
prop="id">
<template scope="{$index,row}">
<el-select v-model="row.userId" @change="(val)=>{userDetailsChange(val,row)}"
placeholder="请输入姓名" filterable clearable disabled
style="width: 100%" size="small" v-if="awardsMode==1">
<el-option
v-for="item in userList"
:key="item.id"
:label="item.username+''+item.loginname+''+item.sex"
:value="item.id">
</el-option>
</el-select>
<el-select v-model="row.unionId" @change="(val)=>{unionDetailsChange(val,row)}"
placeholder="请输入分工会" filterable clearable disabled
style="width: 100%" size="small" v-if="awardsMode==2">
<el-option
v-for="item in unionList"
:key="item.id"
:label="item.unionname"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="名次" prop="ranking">
<template scope="{$index,row}">
<el-select v-model="row.ranking" @change="rankingChange(row)"
placeholder="请输入名次" filterable clearable disabled
style="width: 100%" size="small">
<el-option
v-for="item in rankingList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="积分" prop="integral">
<template scope="{row}">
<el-input v-model="row.integral" disabled type="text"></el-input>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="人数" prop="numberOfPeople"
v-if="awardsMode==2">
<template scope="{row}">
<el-input v-model="row.numberOfPeople" disabled type="text"></el-input>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="分工会" prop="unionname"
v-if="awardsMode==1">
<template scope="{row}">
<el-input v-model="row.unionname" disabled placeholder="分工会"
type="text"></el-input>
</template>
</el-table-column>
</el-table>
</template>
</guava>
<el-dialog
title="添加人员"
:visible.sync="dialogVisible"
width="40%"
:close-on-click-modal="false"
>
<el-form :model="formData" ref="form" :rules="formRules" label-width="100px">
<!-- <el-form-item prop="loginname" label="工&emsp;&emsp;号">
<el-input maxlength="50" placeholder="请填写工号" v-model="formData.loginname"
type="text" @blur="userBlur"></el-input>
</el-form-item>
<el-form-item prop="username" label="姓&emsp;&emsp;名">
<el-input maxlength="50" placeholder="请填写姓名" v-model="formData.username"
type="text"></el-input>
</el-form-item>-->
<el-form-item prop="mobile" label="姓名或工号">
<el-select
style="width: 100%"
v-model="formData.userid"
filterable
clearable
remote
reserve-keyword
allow-create
default-first-option
placeholder="请输入姓名或工号查找"
:remote-method="userRemoteMethod"
@change="userChange2">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.username+''+item.loginname+''"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="loginname" label="工&emsp;&emsp;号">
<el-input maxlength="50" placeholder="请填写工号" v-model="formData.loginname"
type="text"></el-input>
</el-form-item>
<el-form-item prop="mobile" label="电&emsp;&emsp;话">
<el-input maxlength="50" placeholder="请填写电话" v-model="formData.mobile"
type="text"></el-input>
</el-form-item>
<el-form-item prop="sex" label="性&emsp;&emsp;别">
<el-radio-group v-model="formData.sex">
<el-radio :label="'男'" border></el-radio>
<el-radio :label="'女'" border></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item prop="unitId" label="所在单位">
<el-select v-model="formData.unitId" placeholder="请选择所在单位" clearable @change="unitChange" filterable
style="width: 100%">
<el-option
v-for="item in unitOptions"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="unionname" label="所属工会">
<el-input disabled placeholder="所属工会" v-model="formData.unionname"
type="text"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doAddUser">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
userOptions: [],
groupList: [
{value: 1, name: "甲组"},
{value: 2, name: "乙组"},
{value: 3, name: "丙组"},
{value: 4, name: "丁组"}
],
dialogVisible: false,
viewData: [],
userTabLoading: false,
awardsMode: "",
isMenWomen: "",
allName: "",
name: "",
eventId: "",
activityId: "",
userData: [],
userList: [],
userList2: [],
unionList: [],
unionList2: [],
activityList: [],
events: [],
unitOptions: [],
rankingList: [
{name: "第一名", id: 1},
{name: "第二名", id: 2},
{name: "第三名", id: 3},
{name: "第四名", id: 4},
{name: "第五名", id: 5},
{name: "第六名", id: 6},
{name: "第七名", id: 7},
{name: "第八名", id: 8}],
sexList: [{sex: "男", id: 1}, {sex: "女", id: 2}],
pageForm: {
isMenWomen: [],
year: new Date().getFullYear() + "",
},
formRules: {
unitId: [{required: true, message: '必填', trigger: ['blur', 'change']}],
username: [{required: true, message: '必填', trigger: ['blur', 'change']}],
loginname: [{required: true, message: '必填', trigger: ['blur', 'change']}],
}
}
},
components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
},
methods: {
dropdownCommand(command) {
const {type, row} = command
if (type === 'view') {
this.openView(row)
} else if (type === 'input') {
this.openInput(row)
}
},
async userRemoteMethod(query) {
if (query) {
const userData = await searchUser(query, null, null, null, null)
this.userOptions = userData
}
},
userChange2(userid) {
const aa = this.userOptions.find(v => v.id === userid)
if (aa != undefined) {
this.$set(this.formData, "username", aa.username)
this.$set(this.formData, "loginname", aa.loginname)
this.$set(this.formData, "mobile", aa.mobile)
this.$set(this.formData, "unitId", aa.unitid)
this.$set(this.formData, "unionId", aa.unionid)
this.$set(this.formData, "unionname", aa.unionname)
this.$set(this.formData, "sex", aa.sex)
} else {
this.$set(this.formData, "username", userid)
}
},
async unitChange() {
const uniotData = this.unitOptions.find(v => v.id == this.formData.unitId)
this.$set(this.formData, "unionname", uniotData.unionname)
this.$set(this.formData, "unionId", uniotData.unionid)
this.$set(this.formData, "unitname", uniotData.name)
},
async openAdd() {
this.unitOptions = await getUnits(null)
this.$set(this.formData, "activityId", this.activityId)
this.$set(this.formData, "eventId", this.eventId)
this.$set(this.formData, "awardsMode", this.awardsMode)
this.$set(this.formData, "identity", ['1'])
this.$set(this.formData, "status", 2)
this.$set(this.formData, "sex", "男")
this.dialogVisible = true
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
async doAddUser() {
this.$refs["form"].validate(async (valid) => {
if (valid) {
if (this.userList.some(v => v.id === this.formData.userid)) {
this.notifyWarning("您添加的运动员已经是远动员!")
return
}
await $.post(loc() + "/doAdd", {
activityResults: JSON.stringify(this.userData),
activityId: this.activityId,
eventId: this.eventId
})
const pageForm = clone(this.formData)
pageForm.identity = JSON.stringify(this.formData.identity)
const resp = await $.post(loc() + "/doAddUser", pageForm)
if(resp.code===0){
await this.userChange()
this.userDetailsChange()
this.dialogVisible = false
}else{
this.notifyWarning(resp.msg)
}
}
})
},
async yearChange() {
this.activityList = []
this.events = []
this.$set(this.pageForm, "activityId", "")
this.$set(this.pageForm, "eventId", "")
const {data} = await $.get("/platform/activity/score/statistics/getActivitys", {year: this.pageForm.year})
this.activityList = data
if (data.length > 0) {
this.pageForm.activityId = this.activityList[0].id
}
await this.doSearchS()
},
async changeActivit() {
const resp = await $.post("/platform/activity/apply/getEvents", {activityId: this.pageForm.activityId})
this.events = resp
},
async doAdd() {
const loading = this.$loading({
lock: true,
text: '正在提交...',
spinner: 'el-icon-loading',
background: COVER_LAYER_COLOR
});
this.userData.activityId = this.activityId
this.userData.eventId = this.eventId
const resp = await $.post(loc() + "/doAdd", {
activityResults: JSON.stringify(this.userData),
activityId: this.activityId,
eventId: this.eventId
})
loading.close()
if(resp.code===0){
this.pageData()
this.$refs.guava.index()
}else{
this.notifyWarning(resp.msg)
}
},
rankingChange() {
for (let ranking = 1; ranking <= 8; ranking++) {
let size = 0
let indexArray = [];
this.userData.forEach((v, index) => {
if (ranking == v.ranking) {
size++
indexArray.push(index)
}
})
if (size == 1) {
/*
if (this.awardsMode == 2) {
this.userData[indexArray[0]].integral = (this.calScore(ranking) / 2).toFixed(2);
console.log(this.calScore(ranking),2)
} else {
this.userData[indexArray[0]].integral = this.calScore(ranking).toFixed(2);
console.log(this.calScore(ranking),1)
}*/
this.userData[indexArray[0]].integral = this.calScore(ranking).toFixed(2);
} else {
var scoreArray = 0;
for (var i = 0; i < size; i++) {
scoreArray += this.calScore(ranking * 1 + i * 1);
}
/* if (this.awardsMode == 2) {
scoreArray = scoreArray / size / 2;
console.log(scoreArray, 2)
} else {
scoreArray = scoreArray / size;
console.log(scoreArray, 1)
}*/
scoreArray = scoreArray / size;
indexArray.forEach(v => {
this.userData[v].integral = scoreArray.toFixed(2);
})
}
}
},
calScore(ranking) {
let score;
if (ranking < 5) {// 1 2 3 4
if (ranking < 3) {//1 2
if (ranking == 1) {
score = this.awardsMode == 1 ? 9 : 9 * 2;
} else if (ranking == 2) {
score = this.awardsMode == 1 ? 7 : 7 * 2;
}
} else {//3 4
if (ranking == 3) {
score = this.awardsMode == 1 ? 6 : 6 * 2;
} else if (ranking == 4) {
score = this.awardsMode == 1 ? 5 : 5 * 2;
}
}
} else {//5 6 7 8
if (ranking < 7) {//5 6
if (ranking == 5) {
score = this.awardsMode == 1 ? 4 : 4 * 2;
} else if (ranking == 6) {
score = this.awardsMode == 1 ? 3 : 3 * 2;
}
} else {//7 8 9
if (ranking == 7) {
score = this.awardsMode == 1 ? 2 : 2 * 2;
} else if (ranking == 8) {
score = this.awardsMode == 1 ? 1 : 1 * 2;
} else if (ranking == 9) {
score = this.awardsMode == 1 ? 1 : 1 * 2;
}
}
}
return score;
},
userDetailsChange(val, row) {
const useridArr = this.userData.map(v => v.userId)
console.log(useridArr)
this.userList.forEach(v => {
v.disabled = useridArr.includes(v.id)
if (row && row.userId === v.id) {
const o = {
unionId: v.unionid,
activityId: this.activityId,
eventId: this.eventId,
isTeamPersonal: 1,
unionname: v.unionname
}
Object.assign(row, o)
}
})
console.log(this.userList)
},
async unionDetailsChange(val, row) {
let data = ''
if (row) {
const {unionId} = row
data = await $.get(loc() + "/getUnionDetails", {
activityId: this.activityId,
eventId: this.eventId,
unionId: unionId
})
}
this.$nextTick(() => {
const unionIdArr = this.userData.map(v => v.unionId)
this.unionList.forEach(v => {
v.disabled = unionIdArr.includes(v.id)
if (row && row.unionId === v.id) {
const o = {
numberOfPeople: data.data,
activityId: this.activityId,
eventId: this.eventId,
isTeamPersonal: 2
}
Object.assign(row, o)
}
})
})
},
delUser(index, row) {
this.userData.splice(index, 1)
this.userDetailsChange()
this.unionDetailsChange()
},
async getUserList() {
const {data} = await $.get(loc() + "/getUserList", {
activityId: this.activityId,
eventId: this.eventId,
isMenWomen: this.isMenWomen
})
return data;
},
async getUnionList(row) {
const {activityId, eventId} = row
const {data} = await $.get(loc() + "/getUnionList", {
activityId: activityId,
eventId: eventId
})
return data;
},
openAddUser() {
this.userData.push({})
},
async userChange() {
this.userList = await this.getUserList()
this.userList2 = this.userList
this.userData = []
const {data} = await $.get(loc() + "/getUserData", {
activityId: this.activityId,
eventId: this.eventId,
isMenWomen: this.isMenWomen
})
if (data.length > 0) {
this.userData = data
this.viewData = data
}
this.$forceUpdate();
},
async getUnionData(row) {
const {activityId, eventId} = row
const {data} = await $.get(loc() + "/getUnionData", {
activityId: activityId,
eventId: eventId
})
return data
},
async openView(row) {
this.isMenWomen = ""
this.userData = []
this.viewData = []
this.userList = []
this.awardsMode = row.awardsMode
this.name = row.name
this.allName = row.allName
this.activityId = row.activityId
this.eventId = row.eventId
if (row.awardsMode == 2) {
this.unionList = await this.getUnionList(row)
this.viewData = await this.getUnionData(row)
await this.unionDetailsChange(row)
} else {
await this.userChange()
this.userDetailsChange()
}
this.$refs.guava.view()
},
async openInput(row) {
this.isMenWomen = ""
this.userData = []
this.userList = []
this.awardsMode = row.awardsMode
this.name = row.name
this.allName = row.allName
this.activityId = row.activityId
this.eventId = row.eventId
this.isMenWomen = row.isMenWomen
if (row.awardsMode == 2) {
this.unionList = await this.getUnionList(row)
this.userData = await this.getUnionData(row)
await this.unionDetailsChange()
} else {
await this.userChange()
this.userDetailsChange()
}
this.$refs.guava.edit()
},
async getActivitys() {
const {data} = await $.get("/platform/activity/remind/getActivitys")
return data;
},
async doSearchS() {
this.doSearch()
await this.changeActivit()
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
pageData() {
sublime.showLoadingbar();
this.tabLoading = true
const pageForm = clone(this.pageForm)
pageForm.isMenWomen = JSON.stringify(pageForm.isMenWomen)
$.post(base + "/platform/activity/results/input/pageData", pageForm, (data) => {
sublime.closeLoadingbar();
this.tabLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
},
async created() {
this.yearChange()
this.pageData()
/* this.activityList = await this.getActivitys()
if (this.activityList.length) {
this.pageForm.activityId = this.activityList[0].id
}
await this.changeActivit()
this.pageData()*/
}
})
</script>
<!--#
}
#-->