json带去报名列表

main
lijingyu007 5 months ago
parent ed891d2d44
commit 0f5d062786
  1. 8
      src/api/trainService/index.js
  2. 5
      src/views/trainService/signlist.vue
  3. 55
      src/views/trainService/signupStudent.vue

@ -195,4 +195,12 @@ export function setJson(data) {
method: 'post',
data,
})
}
// 导出excel
export function exportExcelF(id) {
return request({
url: '/personal/download/resume/' + id,
method: 'get',
responseType: 'blob',
})
}

@ -384,6 +384,7 @@ export default {
this.$nextTick(() => {
if (row.data) {
this.$refs.jsontool.jsonData = row.data
this.$refs.jsontool.formatCode()
} else {
this.$refs.jsontool.jsonData =
'[{"name":"姓名","type":"input","key":"name","value":""},{"title":"在校职务","type":"input","key":"title","value":""},{"mobile":"手机号","type":"input","key":"mobile","value":""},{"college":"院校全称","type":"input","key":"college","value":""},{"address":"院校所在地址","type":"input","key":"address","value":""},{"payType":"培训付款方式","type":"radio","key":"payType","value":["公对公转账,请于报到前提供截图","现场支付(公务卡、微信、支付宝、现金)"]},{"sex":"性别","type":"radio","key":"sex","value":["男","女"]},{"hotel":"是否需要统一安排住宿","type":"radio","key":"hotel","value":["大床房(付房费全额)","标间(独立居住、付全额房费)","标间(拼房、付房费一半),无指定合住人员","标间(拼房、付房费一半),指定合住人员","其他,请说明,包括非指定日期的订房","无须订房,自行安排"]},{"addWeixin":"是否添加业务负责人微信","type":"radio","key":"addWeixin","value":["是","否"]},{"suggestion":"针对此次培训,您还有什么建议","type":"textarea","key":"suggestion","value":""}]'
@ -516,7 +517,9 @@ export default {
searchUp(rwo) {
// this.activeR = rwo
// this.getStudentList()
this.$router.push(`/signupStudent?id=${rwo.trainClassId}&type=${rwo.classType}`)
this.$router.push(`/signupStudent?id=${rwo.trainClassId}&type=${rwo.classType}&name=${rwo.trainClassName}`)
rwo.data && localStorage.setItem('jsondata', rwo.data)
},
async getStudentList() {
const res = await searchNum(this.activeR.trainClassId)

@ -21,7 +21,9 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- <el-button icon="el-icon-download" type="warning" size="small" style="margin-bottom: 20px" @click="exporExcel"
>导出为excel</el-button
> -->
<!-- 详细学生信息弹层 -->
<el-table v-if="$route.query.type != 3" :data="studentList" v-loading="loading">
<el-table-column label="序号" align="center" type="index" />
@ -88,7 +90,8 @@
</div>
</template>
<script>
import { searchNum, addRemarkI, delSign } from '@/api/trainService/index.js'
import { searchNum, addRemarkI, delSign, exportExcelF } from '@/api/trainService/index.js'
import { saveAs } from 'file-saver'
// 1 2 3 4 5 status
export default {
name: 'peixunbaoming',
@ -129,6 +132,21 @@ export default {
methods: {
async getStudentList() {
this.loading = true
if (localStorage.getItem('jsondata')) {
const firstData = JSON.parse(localStorage.getItem('jsondata'))
this.headerList = []
this.headerData = {}
//
firstData.forEach((it) => {
//
this.headerList.push(it.key)
//
this.headerData[it.key] = it[it.key]
})
//
this.headerList.push('remark')
this.headerData.remark = '备注'
}
const res = await searchNum({
classType: this.$route.query.type,
trainClassId: this.$route.query.id,
@ -137,19 +155,19 @@ export default {
if (this.$route.query.type == 3 && res.total > 0) {
// json
if (res.rows[0].data) {
this.headerList = []
this.headerData = {}
//
const firstData = JSON.parse(res.rows[0].data)
firstData.forEach((it) => {
//
this.headerList.push(it.key)
//
this.headerData[it.key] = it[it.key]
})
//
this.headerList.push('remark')
this.headerData.remark = '备注'
// this.headerList = []
// this.headerData = {}
// //
// const firstData = JSON.parse(res.rows[0].data)
// firstData.forEach((it) => {
// //
// this.headerList.push(it.key)
// //
// this.headerData[it.key] = it[it.key]
// })
// //
// this.headerList.push('remark')
// this.headerData.remark = ''
//
const newData = []
// --json
@ -225,6 +243,13 @@ export default {
this.form = {}
this.visibleopen = false
},
// excel
exporExcel() {
exportExcelF().then((res) => {
const blob = new Blob([res])
saveAs(blob, this.$route.query.id + '报名表.xlsx')
})
},
},
created() {},
}

Loading…
Cancel
Save