This commit is contained in:
@jyuhsin
2025-10-13 10:33:38 +08:00
parent 8dad7c09ba
commit 3d7a081eb3
3 changed files with 610 additions and 0 deletions
@@ -0,0 +1,219 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="search">
<div class="search-item">
<div class="search-item-label">活动名称:</div>
<div class="search-item-option">
<el-select placeholder="请选择活动" v-model="pageForm.activityId" style="width: 100%;" clearable filterable
@change="selectCourse(); doSearch(); courseChange()">
<el-option v-for="item in activityOptions" :label="item.activityName" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">{{ trainType }}</div>
<div class="search-item-option">
<el-select :placeholder="'请选择' + trainType" v-model="pageForm.courseId" style="width: 100%;" clearable filterable>
<el-option v-for="item in courseOptions" :label="item.courseName" :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="mt10">
<table-tool :app="this" label="表格数据">
<template #func>
<el-button @click="onImport" size="small" type="primary">导入数据</el-button>
<el-button @click="onExport" size="small" type="primary">导出数据</el-button>
</template>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder">
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type="index" width="60"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
</el-table-column>
<el-table-column label="操作" width="100">
<template scope="{row}">
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<template v-for="item,index in infoData">
<vi-title2 :title="'数据创建顺序' + (index + 1)">
<template #func>
<el-button @click="onDelete(item)" size="mini" type="danger">删除</el-button>
</template>
</vi-title2>
<el-descriptions border class="mb20">
<el-descriptions-item label="来源">
{{ item.source === 1 ? '活动报名' : '数据导入' }}
</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ item.signUpTime }}</el-descriptions-item>
<el-descriptions-item v-for="column in item.mobileColumnsValue" :label="column.columnName">
{{ column.columnValue }}
</el-descriptions-item>
</el-descriptions>
</template>
</template>
</guava>
<el-dialog
top="40px"
title="导入数据"
:visible.sync="exportVisible"
:close-on-click-modal="false"
width="60%">
<file-import ref="importRef" :temp_url="'/platform/trainSignUp/data/downLoad?courseId=' + pageForm.courseId"
:post_url="'/platform/trainSignUp/data/importData?courseId=' + pageForm.courseId"
:is_show_radio="false" @flush="doSearch"></file-import>
</el-dialog>
</div>
<script>
const vue = new Vue({
el: '#app',
dicts: ['trainSignUpType'],
mixins: [initTableMixins],
data() {
return {
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
courseId: '',
},
tableColumns: [
{prop: 'userName', label: '姓名'},
{prop: 'loginName', label: '工号'},
{prop: 'unitName', label: '所属单位'},
{prop: 'unionName', label: "所属工会"},
{prop: 'signUpTime', label: "报名时间"},
{prop: 'count', label: "记录数"},
],
activityOptions: [],
courseOptions: [],
trainType: '',
exportVisible: false,
infoData: [],
}
},
components: {
'file-import': httpVueLoader('/components/plugins/FileImport.vue')
},
methods: {
onDelete(row) {
this.$confirm('您确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const res = await $.post('/platform/trainSignUp/data/delete', {id: row.id})
if (res.code === 0) {
this.$message.success(res.msg)
this.onView(row)
} else {
this.$message.warning(res.msg)
}
}).catch(() => {})
},
onView(row) {
$.post('/platform/trainSignUp/data/view', {activityId: row.activityId, userId: row.userId})
.then(res => {
if(res.code === 0) {
this.infoData = res.data
this.$refs.guava.view()
} else {
this.$message.error(res.msg)
}
})
},
onImport() {
if(!this.pageForm.activityId) {
this.$message.warning('请选择活动')
return
}
if(!this.pageForm.courseId) {
this.$message.warning('请选择' + this.trainType)
return
}
this.exportVisible = true
},
onExport() {
if(!this.pageForm.activityId) {
this.$message.warning('请选择活动')
return
}
this.$downLoad('/platform/trainSignUp/data/doExport', this.pageForm)
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
this.exportVisible = false
},
async selectActivity() {
const res = await $.post(loc() + '/selectActivity')
if (res.code === 0) {
this.activityOptions = res.data
if(this.activityOptions.length > 0) {
this.$set(this.pageForm, 'activityId', this.activityOptions[0].id)
}
}
},
async selectCourse() {
const res = await $.post(loc() + '/selectCourse', { activityId: this.pageForm.activityId })
if (res.code === 0) {
this.courseOptions = res.data
}
},
pageData() {
$.post(loc() + '/pageData', this.pageForm).then(res => {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
})
},
courseChange() {
const activity = this.activityOptions.find(o => o.id === this.pageForm.activityId)
const type = this.dict.type.trainSignUpType.find(o => o.value === activity.trainType)
this.trainType = type ? type.label : ''
}
},
async created() {
await this.selectActivity()
await this.selectCourse()
this.pageData()
this.courseChange()
}
})
</script>
<!--#
}
#-->