main
lijingyu007 5 months ago
parent db90b2f82a
commit 67b15e0c3c
  1. 9
      src/api/trainService/index.js
  2. 45
      src/components/jsonTool/index.vue
  3. 63
      src/views/trainService/signlist.vue

@ -186,4 +186,13 @@ export function delSign(id) {
url: '/train/trainStuden/del?studentId=' + id, url: '/train/trainStuden/del?studentId=' + id,
method: 'delete', method: 'delete',
}) })
}
// 师资班配置json
export function setJson(data) {
return request({
url: '/train/trainClass/editData',
method: 'post',
data,
})
} }

@ -1,48 +1,25 @@
<template> <template>
<div style="width: 100%; margin-top: 30px"> <div style="width: 100%">
<el-button type="primary" style="margin-bottom: 10px" size="small" @click="formatCode">格式化JSON</el-button>
<b-code-editor <b-code-editor
v-model="jsonData" v-model="jsonData"
:auto-format="true" :auto-format="true"
:smart-indent="true" :smart-indent="true"
theme="dracula" theme="dracula"
:indent-unit="4" :indent-unit="4"
:line-wrap="false" :line-wrap="true"
ref="editor" ref="editor"
></b-code-editor> ></b-code-editor>
<br /> <br />
<!-- <el-button type="primary" @click="onSubumit">提交</el-button> -->
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: {
jsonData: {
type: String,
default: `[
{
"name": "姓名",
"key": "name",
"type": "input",
"value": ""
},
{
"title": "在校职务",
"key": "title",
"type": "input",
"value": ""
},
{
"mobile": "手机号",
"key": "mobile",
"type": "input",
"value": ""
}
]`,
},
},
data() { data() {
return { return {
jsonData: '',
} }
}, },
methods: { methods: {
@ -68,11 +45,21 @@ export default {
this.$message.error(`json格式错误`) this.$message.error(`json格式错误`)
return false return false
} }
this.$message.success('json格式正确') console.log(JSON.parse(this.jsonData))
return true
},
formatCode() {
this.$refs.editor.formatCode()
}, },
}, },
} }
</script> </script>
<style> <style>
.bin-json-editor {
height: 500px !important;
}
.CodeMirror {
height: 500px !important;
}
</style> </style>

@ -83,7 +83,7 @@
</el-table-column> </el-table-column>
<el-table-column label="是否限制人数" align="center" prop="limitApply"> <el-table-column label="是否限制人数" align="center" prop="limitApply">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.limitApply == 1 ? '是': '否' }} {{ scope.row.limitApply == 1 ? '是' : '否' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="已报名/总人数" align="center" prop="classSize"> <el-table-column label="已报名/总人数" align="center" prop="classSize">
@ -103,8 +103,11 @@
<span v-if="scope.row.status == 5">已结束</span> <span v-if="scope.row.status == 5">已结束</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center" width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" v-if="scope.row.classType == 3" @click="setSignTab(scope.row)"
>配置报名表</el-button
>
<el-button size="mini" type="text" @click="modify(scope.row)">修改</el-button> <el-button size="mini" type="text" @click="modify(scope.row)">修改</el-button>
<el-button size="mini" type="text" @click="delrow(scope.row)">删除</el-button> <el-button size="mini" type="text" @click="delrow(scope.row)">删除</el-button>
</template> </template>
@ -170,7 +173,7 @@
<el-option label="高级" :value="2"></el-option> <el-option label="高级" :value="2"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="班级人数" prop="classSize"> <el-form-item label="班级人数" prop="classSize">
<el-input v-model="form.classSize" placeholder="请输入班级人数" clearable size="small" /> <el-input v-model="form.classSize" placeholder="请输入班级人数" clearable size="small" />
</el-form-item> </el-form-item>
@ -237,7 +240,6 @@
/> />
</el-form-item> </el-form-item>
<!-- 编辑json --> <!-- 编辑json -->
<JsonTool ref="jsontool" v-if="form.classType == 3"/>
<el-form-item style="padding-left: 170px"> <el-form-item style="padding-left: 170px">
<el-button <el-button
@ -281,7 +283,21 @@
@pagination="getStudentList" @pagination="getStudentList"
/> />
</el-dialog> </el-dialog>
<!-- json弹层 -->
<el-dialog
title="报名表配置"
:visible.sync="signTable"
:close-on-click-modal="false"
width="800px"
append-to-body
>
<JsonTool ref="jsontool" />
<div>name为标题type为类型(input输入框;radio单选框;textarea文本域)key为标题标识须一致value为单选框选项</div>
<span slot="footer" class="dialog-footer">
<el-button @click="jsoncancle"> </el-button>
<el-button type="primary" @click="jsonsubmit"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
@ -293,6 +309,7 @@ import {
delSignUp, delSignUp,
searchNum, searchNum,
listTeacherAll, listTeacherAll,
setJson,
} from '@/api/trainService/index.js' } from '@/api/trainService/index.js'
import ImageUpload from '@/components/ImgUpload/index.vue' import ImageUpload from '@/components/ImgUpload/index.vue'
import NonimageUpload from '@/views/components/NonimageUpload' import NonimageUpload from '@/views/components/NonimageUpload'
@ -350,12 +367,48 @@ export default {
studentList: [], studentList: [],
studentOpen: false, studentOpen: false,
activeR: {}, activeR: {},
// Json
signTable: false,
activeRowId: '',
} }
}, },
mounted() {}, mounted() {},
methods: { methods: {
// json // json
setSignTab(row) {
this.signTable = true
this.activeRowId = row.trainClassId
if (row.data) {
this.$nextTick(() => {
if (row.data) {
this.$refs.jsontool.jsonData = row.data
} 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":""}]'
}
this.$refs.jsontool.formatCode()
})
}
},
jsoncancle() {
this.signTable = false
},
jsonsubmit() {
const flag = this.$refs.jsontool.onSubumit()
if (flag) {
const jsonstr = this.$refs.jsontool.jsonData
setJson({ data: jsonstr, trainClassId: this.activeRowId })
.then((res) => {
this.$message.success('配置成功')
this.getList()
this.signTable = false
})
.catch((error) => {})
} else {
this.$message.warning('请检查JSON数据格式')
}
},
// json // json
// //
async getTeacherList() { async getTeacherList() {

Loading…
Cancel
Save