|
@@ -7,22 +7,45 @@
|
|
|
<template #type="{display}">
|
|
|
{{ translateType(display) }}
|
|
|
</template>
|
|
|
+ <template #action="{row}">
|
|
|
+ <div>
|
|
|
+ <el-button v-if="row.type == paperWorkType.value" type="text" icon="el-icon-edit"
|
|
|
+ @click="clickEditPaper(row)">编辑
|
|
|
+ </el-button>
|
|
|
+ <el-button type="text" icon="el-icon-connection" @click="clickPublish(row)">发布</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</dynamic-table>
|
|
|
<pagination v-if="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
|
|
@pagination="getList"></pagination>
|
|
|
+ <upload-dialog
|
|
|
+ v-if="uploadOption.dialogVisible"
|
|
|
+ scene="发布"
|
|
|
+ :title="uploadOption.title"
|
|
|
+ :pageName="uploadOption.pageName"
|
|
|
+ :isZdy="false"
|
|
|
+ :selectType="uploadOption.selectType"
|
|
|
+ :dialogVisible="uploadOption.dialogVisible"
|
|
|
+ @handleClose="handleUploadReady"
|
|
|
+ @dialogVisibleClose="uploadOption.dialogVisible=false"
|
|
|
+ ></upload-dialog>
|
|
|
</el-card>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import DynamicTable from '@/components/dynamic-table/index'
|
|
|
-import { getHomeworks } from '@/api/webApi/homework'
|
|
|
+import { getHomeworks, publicStudentHomework } from '@/api/webApi/homework'
|
|
|
import consts from '@/common/mx-const'
|
|
|
+import { download, listCustomerPaperQeustions } from '@/api/webApi/webQue'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
|
|
|
export default {
|
|
|
name: 'paper-work-publish',
|
|
|
components: { DynamicTable },
|
|
|
data() {
|
|
|
return {
|
|
|
+ extraData: { type: consts.enum.generateScene.paperWork.value },
|
|
|
+ paperWorkType: Object.freeze(consts.enum.homeworkTypes.find(t => t.value == 1)),
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
|
pageSize: 20
|
|
@@ -32,11 +55,21 @@ export default {
|
|
|
{ prop: 'type', label: '类型', width: '120px', slotBody: 'type' },
|
|
|
{ prop: 'title', label: '标题' },
|
|
|
{ prop: 'createTime', label: '创建时间', width: '180px' },
|
|
|
- { prop: 'action', label: '操作', width: '80px' }],
|
|
|
+ { prop: 'action', label: '操作', width: '120px', slotBody: 'action' }],
|
|
|
rows: [],
|
|
|
- total: 0
|
|
|
+ total: 0,
|
|
|
+ uploadWork: null,
|
|
|
+ uploadOption: {
|
|
|
+ title: '发布作业',
|
|
|
+ pageName: '',
|
|
|
+ selectType: '',
|
|
|
+ dialogVisible: false
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['period'])
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.getList()
|
|
|
},
|
|
@@ -53,6 +86,41 @@ export default {
|
|
|
translateType(type) {
|
|
|
const enumType = consts.enum.homeworkTypes.find(t => t.value == type)
|
|
|
return enumType?.label || type
|
|
|
+ },
|
|
|
+ clickEditPaper(paper) {
|
|
|
+ listCustomerPaperQeustions(paper.content).then((res) => {
|
|
|
+ localStorage.setItem(
|
|
|
+ 'paperData',
|
|
|
+ JSON.stringify({
|
|
|
+ paperId: paper.content,
|
|
|
+ paperTitle: paper.name || paper.title,
|
|
|
+ subjectId: paper.subjectid
|
|
|
+ })
|
|
|
+ )
|
|
|
+ localStorage.setItem('questionList', JSON.stringify(res.rows))
|
|
|
+ this.$router.push({
|
|
|
+ path: '/question-center/generatingPaperCenter/paper',
|
|
|
+ query: this.extraData
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ clickDownloadPaper(paperId) {
|
|
|
+ download(paperId, this.period)
|
|
|
+ },
|
|
|
+ clickPublish(work) {
|
|
|
+ this.uploadWork = work
|
|
|
+ this.uploadOption.selectType = 'student'
|
|
|
+ this.uploadOption.dialogVisible = true
|
|
|
+ },
|
|
|
+ async handleUploadReady(type, name, selectData) {
|
|
|
+ const commit = {
|
|
|
+ workId: this.uploadWork.id,
|
|
|
+ stuIds: selectData.checkedStudent,
|
|
|
+ remark: selectData.remark
|
|
|
+ }
|
|
|
+ await publicStudentHomework(commit)
|
|
|
+ this.uploadOption.dialogVisible = false
|
|
|
+ this.msgSuccess('发布成功')
|
|
|
}
|
|
|
}
|
|
|
}
|