|
|
@ -1,9 +1,14 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
|
|
|
|
<!-- 使用a-card组件,设置bordered属性为false,表示无边框 -->
|
|
|
|
<a-card :bordered="false">
|
|
|
|
<a-card :bordered="false">
|
|
|
|
|
|
|
|
<!-- 定义一个id为toolbar的div,用于放置按钮 -->
|
|
|
|
<div id="toolbar">
|
|
|
|
<div id="toolbar">
|
|
|
|
|
|
|
|
<!-- 新建按钮,点击时调用createQuestionModal的create方法 -->
|
|
|
|
<a-button type="primary" icon="plus" @click="$refs.createQuestionModal.create()">新建</a-button>
|
|
|
|
<a-button type="primary" icon="plus" @click="$refs.createQuestionModal.create()">新建</a-button>
|
|
|
|
|
|
|
|
<!-- 全量刷新按钮,点击时调用loadAll方法 -->
|
|
|
|
<a-button type="primary" icon="reload" @click="loadAll()">全量刷新</a-button>
|
|
|
|
<a-button type="primary" icon="reload" @click="loadAll()">全量刷新</a-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 使用BootstrapTable组件,设置columns、data、options属性 -->
|
|
|
|
<BootstrapTable
|
|
|
|
<BootstrapTable
|
|
|
|
ref="table"
|
|
|
|
ref="table"
|
|
|
|
:columns="columns"
|
|
|
|
:columns="columns"
|
|
|
@ -11,9 +16,13 @@
|
|
|
|
:options="options"
|
|
|
|
:options="options"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<!-- ref是为了方便用this.$refs.modal直接引用,下同 -->
|
|
|
|
<!-- ref是为了方便用this.$refs.modal直接引用,下同 -->
|
|
|
|
|
|
|
|
<!-- 创建问题模态框,设置ref为createQuestionModal,监听ok事件 -->
|
|
|
|
<step-by-step-question-modal ref="createQuestionModal" @ok="handleOk" />
|
|
|
|
<step-by-step-question-modal ref="createQuestionModal" @ok="handleOk" />
|
|
|
|
|
|
|
|
<!-- 更新问题模态框,设置ref为questionUpdateModal,监听ok事件 -->
|
|
|
|
<summernote-update-modal ref="questionUpdateModal" @ok="handleOk" />
|
|
|
|
<summernote-update-modal ref="questionUpdateModal" @ok="handleOk" />
|
|
|
|
|
|
|
|
<!-- 查看问题模态框,设置ref为modalView,监听ok事件 -->
|
|
|
|
<question-view-modal ref="modalView" @ok="handleOk" />
|
|
|
|
<question-view-modal ref="modalView" @ok="handleOk" />
|
|
|
|
|
|
|
|
<!-- 编辑问题模态框,设置ref为modalEdit,监听ok事件 -->
|
|
|
|
<question-edit-modal ref="modalEdit" @ok="handleOk" />
|
|
|
|
<question-edit-modal ref="modalEdit" @ok="handleOk" />
|
|
|
|
</a-card>
|
|
|
|
</a-card>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -36,7 +45,8 @@ export default {
|
|
|
|
QuestionEditModal
|
|
|
|
QuestionEditModal
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data () {
|
|
|
|
data () {
|
|
|
|
const that = this // 方便在bootstrap-table中引用methods
|
|
|
|
const that = this
|
|
|
|
|
|
|
|
// 方便在bootstrap-table中引用methods
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
// 表头
|
|
|
|
// 表头
|
|
|
|
columns: [
|
|
|
|
columns: [
|
|
|
@ -44,7 +54,8 @@ export default {
|
|
|
|
title: '序号',
|
|
|
|
title: '序号',
|
|
|
|
field: 'serial',
|
|
|
|
field: 'serial',
|
|
|
|
formatter: function (value, row, index) {
|
|
|
|
formatter: function (value, row, index) {
|
|
|
|
return index + 1 // 这样的话每翻一页都会重新从1开始,
|
|
|
|
return index + 1
|
|
|
|
|
|
|
|
// 这样的话每翻一页都会重新从1开始,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -81,7 +92,8 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .question-score': function (e, value, row, index) {
|
|
|
|
'click .question-score': function (e, value, row, index) {
|
|
|
|
const $element = $(e.target) // 把元素转换成html对象
|
|
|
|
const $element = $(e.target)
|
|
|
|
|
|
|
|
// 把元素转换成html对象
|
|
|
|
$element.html('<input type="text" value="' + value + '">')
|
|
|
|
$element.html('<input type="text" value="' + value + '">')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -98,8 +110,10 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .question-level': function (e, value, row, index) {
|
|
|
|
'click .question-level': function (e, value, row, index) {
|
|
|
|
const $element = $(e.target) // 把元素转换成html对象
|
|
|
|
const $element = $(e.target)
|
|
|
|
if ($element.children().length > 0) return // 防止重复渲染
|
|
|
|
// 把元素转换成html对象
|
|
|
|
|
|
|
|
if ($element.children().length > 0) return
|
|
|
|
|
|
|
|
// 防止重复渲染
|
|
|
|
getQuestionSelection().then(res => {
|
|
|
|
getQuestionSelection().then(res => {
|
|
|
|
console.log(res)
|
|
|
|
console.log(res)
|
|
|
|
if (res.code === 0) {
|
|
|
|
if (res.code === 0) {
|
|
|
@ -134,8 +148,10 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .question-type': function (e, value, row, index) {
|
|
|
|
'click .question-type': function (e, value, row, index) {
|
|
|
|
const $element = $(e.target) // 把元素转换成html对象
|
|
|
|
const $element = $(e.target)
|
|
|
|
if ($element.children().length > 0) return // 防止重复渲染
|
|
|
|
// 把元素转换成html对象
|
|
|
|
|
|
|
|
if ($element.children().length > 0) return
|
|
|
|
|
|
|
|
// 防止重复渲染
|
|
|
|
getQuestionSelection().then(res => {
|
|
|
|
getQuestionSelection().then(res => {
|
|
|
|
console.log(res)
|
|
|
|
console.log(res)
|
|
|
|
if (res.code === 0) {
|
|
|
|
if (res.code === 0) {
|
|
|
@ -170,8 +186,10 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
events: {
|
|
|
|
events: {
|
|
|
|
'click .question-category': function (e, value, row, index) {
|
|
|
|
'click .question-category': function (e, value, row, index) {
|
|
|
|
const $element = $(e.target) // 把元素转换成html对象
|
|
|
|
const $element = $(e.target)
|
|
|
|
if ($element.children().length > 0) return // 防止重复渲染
|
|
|
|
// 把元素转换成html对象
|
|
|
|
|
|
|
|
if ($element.children().length > 0) return
|
|
|
|
|
|
|
|
// 防止重复渲染
|
|
|
|
getQuestionSelection().then(res => {
|
|
|
|
getQuestionSelection().then(res => {
|
|
|
|
console.log(res)
|
|
|
|
console.log(res)
|
|
|
|
if (res.code === 0) {
|
|
|
|
if (res.code === 0) {
|
|
|
@ -179,7 +197,8 @@ export default {
|
|
|
|
const categories = res.data.categories
|
|
|
|
const categories = res.data.categories
|
|
|
|
let inner = '<select>'
|
|
|
|
let inner = '<select>'
|
|
|
|
for (let i = 0; i < categories.length; i++) {
|
|
|
|
for (let i = 0; i < categories.length; i++) {
|
|
|
|
if (categories[i].name === value) { // 学科还是用名字吧
|
|
|
|
if (categories[i].name === value) {
|
|
|
|
|
|
|
|
// 学科还是用名字吧
|
|
|
|
// 设置默认的选中值为当前的值
|
|
|
|
// 设置默认的选中值为当前的值
|
|
|
|
inner += '<option value ="' + categories[i].id + '" name="' + categories[i].description + '" selected="selected">' + categories[i].name + '</option>'
|
|
|
|
inner += '<option value ="' + categories[i].id + '" name="' + categories[i].description + '" selected="selected">' + categories[i].name + '</option>'
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -221,7 +240,8 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
],
|
|
|
|
tableData: [], // bootstrap-table的数据
|
|
|
|
tableData: [],
|
|
|
|
|
|
|
|
// bootstrap-table的数据
|
|
|
|
// custom bootstrap-table
|
|
|
|
// custom bootstrap-table
|
|
|
|
options: {
|
|
|
|
options: {
|
|
|
|
search: true,
|
|
|
|
search: true,
|
|
|
@ -234,8 +254,10 @@ export default {
|
|
|
|
idTable: 'advancedTable',
|
|
|
|
idTable: 'advancedTable',
|
|
|
|
// 下面是常用的事件,更多的点击事件可以参考:http://www.itxst.com/bootstrap-table-events/tutorial.html
|
|
|
|
// 下面是常用的事件,更多的点击事件可以参考:http://www.itxst.com/bootstrap-table-events/tutorial.html
|
|
|
|
// onClickRow: that.clickRow,
|
|
|
|
// onClickRow: that.clickRow,
|
|
|
|
// onClickCell: that.clickCell // 单元格单击事件
|
|
|
|
// onClickCell: that.clickCell
|
|
|
|
onDblClickCell: that.dblClickCell // 单元格双击事件
|
|
|
|
// 单元格单击事件
|
|
|
|
|
|
|
|
onDblClickCell: that.dblClickCell
|
|
|
|
|
|
|
|
// 单元格双击事件
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -353,4 +375,4 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|