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. 47
      src/views/trainService/signupStudent.vue

@ -196,3 +196,11 @@ export function setJson(data) {
data, 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(() => { this.$nextTick(() => {
if (row.data) { if (row.data) {
this.$refs.jsontool.jsonData = row.data this.$refs.jsontool.jsonData = row.data
this.$refs.jsontool.formatCode()
} else { } else {
this.$refs.jsontool.jsonData = 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":""}]' '[{"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) { searchUp(rwo) {
// this.activeR = rwo // this.activeR = rwo
// this.getStudentList() // 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() { async getStudentList() {
const res = await searchNum(this.activeR.trainClassId) const res = await searchNum(this.activeR.trainClassId)

@ -21,7 +21,9 @@
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </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 v-if="$route.query.type != 3" :data="studentList" v-loading="loading">
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="序号" align="center" type="index" />
@ -88,7 +90,8 @@
</div> </div>
</template> </template>
<script> <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 // 1 2 3 4 5 status
export default { export default {
name: 'peixunbaoming', name: 'peixunbaoming',
@ -129,18 +132,11 @@ export default {
methods: { methods: {
async getStudentList() { async getStudentList() {
this.loading = true this.loading = true
const res = await searchNum({ if (localStorage.getItem('jsondata')) {
classType: this.$route.query.type, const firstData = JSON.parse(localStorage.getItem('jsondata'))
trainClassId: this.$route.query.id,
...this.queryParamss,
})
if (this.$route.query.type == 3 && res.total > 0) {
// json
if (res.rows[0].data) {
this.headerList = [] this.headerList = []
this.headerData = {} this.headerData = {}
// //
const firstData = JSON.parse(res.rows[0].data)
firstData.forEach((it) => { firstData.forEach((it) => {
// //
this.headerList.push(it.key) this.headerList.push(it.key)
@ -150,6 +146,28 @@ export default {
// //
this.headerList.push('remark') this.headerList.push('remark')
this.headerData.remark = '备注' this.headerData.remark = '备注'
}
const res = await searchNum({
classType: this.$route.query.type,
trainClassId: this.$route.query.id,
...this.queryParamss,
})
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 = ''
// //
const newData = [] const newData = []
// --json // --json
@ -225,6 +243,13 @@ export default {
this.form = {} this.form = {}
this.visibleopen = false this.visibleopen = false
}, },
// excel
exporExcel() {
exportExcelF().then((res) => {
const blob = new Blob([res])
saveAs(blob, this.$route.query.id + '报名表.xlsx')
})
},
}, },
created() {}, created() {},
} }

Loading…
Cancel
Save