|
@@ -2,7 +2,18 @@
|
|
|
<div class="points-container">
|
|
|
<!-- <Button type="info" class="btn-add-point" @click="addPointsModal = true"
|
|
|
v-show="curScope === 'school'">{{$t('evaluation.points.addPoint')}}</Button> -->
|
|
|
- <div class="filter-wrap">
|
|
|
+ <div v-if="curScope != 'school'" style="margin-bottom: 10px;">
|
|
|
+ <span class="manual-filter-label">{{ $t('evaluation.filter.origin') }}:</span>
|
|
|
+ <RadioGroup v-model="radioCode" @on-change="onCodeChange">
|
|
|
+ <Radio label="private">
|
|
|
+ <span>{{ $t('cusMgt.private') }}</span>
|
|
|
+ </Radio>
|
|
|
+ <Radio label="school">
|
|
|
+ <span>{{ $t('cusMgt.school') }}</span>
|
|
|
+ </Radio>
|
|
|
+ </RadioGroup>
|
|
|
+ </div>
|
|
|
+ <div class="filter-wrap" v-if="radioCode === 'school'">
|
|
|
<Select v-model="selectPeriod" @on-change="onPeriodChange" :disabled="curScope === 'school'">
|
|
|
<Option v-for="(item, index) in periodList" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
</Select>
|
|
@@ -11,6 +22,12 @@
|
|
|
<Option v-for="(item, index) in subjectList" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
</Select>
|
|
|
</div>
|
|
|
+ <div class="filter-wrap" v-else>
|
|
|
+ <Select v-model="selectTree" @on-change="getPoints">
|
|
|
+ <Option v-for="(item, index) in treeList" :value="item.id" :key="index">{{ item.name }}</Option>
|
|
|
+ </Select>
|
|
|
+ <Icon type="md-add-circle" color="#40A8F0" size="16" :title="$t('knowledge.addPoint')" style="cursor:pointer; margin-left: 5px;" @click="getKnowledgeTree()" />
|
|
|
+ </div>
|
|
|
|
|
|
<div style="margin-top: 20px;">
|
|
|
<Loading hideMask v-show="isLoading"></Loading>
|
|
@@ -33,10 +50,23 @@
|
|
|
|
|
|
<Modal v-model="addPointsModal" :title="$t('evaluation.points.addPoint')" ref="pointRef" width="400px" class="related-point-modal" style="z-index:99999">
|
|
|
<span>{{$t('evaluation.points.pointName')}}</span>
|
|
|
- <Input v-special-char v-model="newPointName" :placeholder="$t('evaluation.points.inputNewPoint')" style="margin:10px 0" />
|
|
|
+ <span style="display: flex; align-items: center;">
|
|
|
+ <Input v-special-char v-model="newPointName" :placeholder="$t('evaluation.points.inputNewPoint')" style="margin:10px 0" />
|
|
|
+ <Button type="primary" @click="onAddNewPoint" style="margin-left: 10px;">{{ $t('evaluation.points.addLevelOne') }}</Button>
|
|
|
+ </span>
|
|
|
+ <el-tree :data="knowledgeTree" :props="defaultProps" class="tree" node-key="id" :expand-on-click-node="false" check-on-click-node highlight-current accordion ref="pointTree">
|
|
|
+ <span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
+ <span class="tree-node-lable">
|
|
|
+ <span class="text-cut" style="max-width: 60%;display: inline-block;vertical-align: bottom;" :title="data.name">{{ data.name }}</span>
|
|
|
+ </span>
|
|
|
+ <span class="custom-tree-tools">
|
|
|
+ <Icon type="md-add" :title="$t('evaluation.points.addLevel')" v-if="node.level < 4" @click.stop="onAddPoint(node, data)" />
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
<div slot="footer">
|
|
|
<Button type="text" @click="addPointsModal = false">{{$t('evaluation.cancel')}}</Button>
|
|
|
- <Button type="primary" @click="onAddNewPoint" :loading="isAddLoading">{{$t('evaluation.confirm')}}</Button>
|
|
|
+ <Button type="primary" @click="onSureAdd" :loading="isAddLoading">{{ $t('cusMgt.save') }}</Button>
|
|
|
</div>
|
|
|
</Modal>
|
|
|
</div>
|
|
@@ -88,23 +118,33 @@ export default {
|
|
|
id: '0',
|
|
|
name: '0'
|
|
|
}],
|
|
|
+ treeList: [],
|
|
|
+ selectTree: 0,
|
|
|
pointList: [],
|
|
|
- schoolPointList: [],
|
|
|
+ schoolPointList: [], //展示的知识点
|
|
|
checkedList: [],
|
|
|
- originPointList: [],
|
|
|
- originSchoolList: [],
|
|
|
+ originPointList: [], //所有的知识点
|
|
|
+ originSchoolList: [], //所有的知识点
|
|
|
originList: [],
|
|
|
defaultParams: {
|
|
|
code: '',
|
|
|
periodId: null,
|
|
|
subjectId: null,
|
|
|
school_code: null,
|
|
|
- type: 1
|
|
|
+ type: 1
|
|
|
+ },
|
|
|
+ curPointResponse: null,
|
|
|
+ radioCode: '',
|
|
|
+ knowledgeTree: [],
|
|
|
+ defaultProps: {
|
|
|
+ children: 'children',
|
|
|
+ label: 'name'
|
|
|
},
|
|
|
- curPointResponse: null
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ // this.radioCode = this.scope === 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId
|
|
|
+ this.radioCode = this.scope
|
|
|
console.log('period-' + this.period)
|
|
|
console.log('subject-' + this.subject)
|
|
|
console.log('scope-' + this.scope)
|
|
@@ -113,7 +153,12 @@ export default {
|
|
|
this.selectSubject = this.subject
|
|
|
}
|
|
|
this.initSchoolData()
|
|
|
- this.getPoints()
|
|
|
+ // 个人需先获取到知识点树列表,再获取相关的知识点
|
|
|
+ if(this.scope === 'private') {
|
|
|
+ this.getPointList()
|
|
|
+ } else {
|
|
|
+ this.getPoints()
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
// 获取当前学校学段学科等基本信息
|
|
@@ -146,67 +191,125 @@ export default {
|
|
|
onSubjectChange(val) {
|
|
|
this.getPoints()
|
|
|
},
|
|
|
+ onCodeChange(val) {
|
|
|
+ this.searchSchoolPoint = ''
|
|
|
+ this.checkedList = []
|
|
|
+ this.getPoints()
|
|
|
+ },
|
|
|
|
|
|
doReset() {
|
|
|
this.getPoints()
|
|
|
this.checkedList = []
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 获取个人知识点树列表
|
|
|
+ */
|
|
|
+ getPointList() {
|
|
|
+ this.isLoading = true
|
|
|
+ let params = {
|
|
|
+ scope: 'private'
|
|
|
+ }
|
|
|
+ this.$api.knowledge.getPointList(params).then(res => {
|
|
|
+ if(res.datas && res.datas.length) {
|
|
|
+ this.selectTree = res.datas[0].id
|
|
|
+ this.treeList = res.datas
|
|
|
+ if(res.datas.length) this.getPoints()
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
/**
|
|
|
* 获取知识点仓库数据
|
|
|
*/
|
|
|
getPoints() {
|
|
|
+ this.isLoading = true
|
|
|
if (this.periodList.length && this.subjectList.length) {
|
|
|
- this.isLoading = true
|
|
|
// if (this.pointList.length && this.schoolPointList.length) return
|
|
|
this.defaultParams.code = this.$store.state.userInfo.schoolCode
|
|
|
this.defaultParams.school_code = this.$store.state.userInfo.schoolCode
|
|
|
this.defaultParams.periodId = this.selectPeriod
|
|
|
this.defaultParams.subjectId = this.selectSubject
|
|
|
+ }
|
|
|
+ let params = this.radioCode === 'school' ? this.defaultParams : {
|
|
|
+ scope: 'private',
|
|
|
+ kid: this.selectTree,//不填,则返回该教师的所有知识点树的信息
|
|
|
+ owner: this.$store.state.userInfo.TEAMModelId,
|
|
|
+ }
|
|
|
|
|
|
- if (this.defaultParams.periodId && this.defaultParams.subjectId) {
|
|
|
- this.$api.knowledge.GetSchoolPoints(this.defaultParams).then(res => {
|
|
|
- if (!res.error && res.length) {
|
|
|
- this.curPointResponse = res[0]
|
|
|
- this.schoolPointList = res[0].points
|
|
|
- this.originSchoolList = res[0].points
|
|
|
- this.originPointList = this.originPointList.concat(res[0].points)
|
|
|
- } else {
|
|
|
- this.$Message.warning(this.$t('evaluation.noData'),)
|
|
|
- this.uuid = Math.uuid()
|
|
|
- this.schoolPointList = []
|
|
|
- this.originSchoolList = []
|
|
|
- this.originPointList = []
|
|
|
- this.curPointResponse = {
|
|
|
- blocks: [],
|
|
|
- code: `Knowledge-${this.$store.state.userInfo.schoolCode}-${this.uuid}`,
|
|
|
- id: this.uuid,
|
|
|
- owner: this.$store.state.userInfo.schoolCode,
|
|
|
- periodId: this.defaultParams.periodId,
|
|
|
- pk: 'Knowledge',
|
|
|
- points: [],
|
|
|
- scope: 'school',
|
|
|
- subjectId: this.defaultParams.subjectId
|
|
|
- }
|
|
|
+ if (this.radioCode === 'school' ? this.defaultParams.periodId && this.defaultParams.subjectId : true) {
|
|
|
+ this.$api.knowledge.GetSchoolPoints(params).then(res => {
|
|
|
+ if (!res.error && res.length) {
|
|
|
+ this.curPointResponse = res[0]
|
|
|
+ this.schoolPointList = res[0].points
|
|
|
+ this.originSchoolList = res[0].points
|
|
|
+ this.originPointList = this.originPointList.concat(res[0].points)
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(this.$t('evaluation.noData'),)
|
|
|
+ this.uuid = Math.uuid()
|
|
|
+ this.schoolPointList = []
|
|
|
+ this.originSchoolList = []
|
|
|
+ this.originPointList = []
|
|
|
+ this.curPointResponse = {
|
|
|
+ blocks: [],
|
|
|
+ code: `Knowledge-${this.$store.state.userInfo.schoolCode}-${this.uuid}`,
|
|
|
+ id: this.uuid,
|
|
|
+ owner: this.$store.state.userInfo.schoolCode,
|
|
|
+ periodId: this.defaultParams.periodId,
|
|
|
+ pk: 'Knowledge',
|
|
|
+ points: [],
|
|
|
+ scope: 'school',
|
|
|
+ subjectId: this.defaultParams.subjectId
|
|
|
}
|
|
|
- this.isLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- this.isLoading = true
|
|
|
+ }
|
|
|
+ this.isLoading = false
|
|
|
+ })
|
|
|
}
|
|
|
+ this.isLoading = true
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
/** 添加新知识点 */
|
|
|
onAddNewPoint() {
|
|
|
- let newName = this.newPointName
|
|
|
- if (newName) {
|
|
|
- this.curPointResponse.points.push(newName)
|
|
|
- this.savePoint()
|
|
|
- } else {
|
|
|
- this.$Message.warning(this.$t('evaluation.points.noNameTips'))
|
|
|
+ this.knowledgeTree.push({
|
|
|
+ allcids: [],
|
|
|
+ children: [],
|
|
|
+ id: this.knowledgeTree.length ? (Number(this.knowledgeTree[this.knowledgeTree.length - 1].id) + 1).toString() : '1',
|
|
|
+ level: 1,
|
|
|
+ link: 0,
|
|
|
+ name: this.newPointName,
|
|
|
+ pid: this.selectTree,
|
|
|
+ subcids: [],
|
|
|
+ tid: null,
|
|
|
+ used: 0
|
|
|
+ })
|
|
|
+ this.newPointName = ''
|
|
|
+ },
|
|
|
+ onSureAdd() {
|
|
|
+ let params = {
|
|
|
+ knowledgeTree: {
|
|
|
+ id: this.selectTree,
|
|
|
+ owner: this.$store.state.userInfo.TEAMModelId,
|
|
|
+ scope: 'private',
|
|
|
+ periodId: '',
|
|
|
+ subjectId: '',
|
|
|
+ name: this.treeList.find(item => item.id === this.selectTree).name,
|
|
|
+ tree: this.knowledgeTree || [],
|
|
|
+ }
|
|
|
}
|
|
|
+ this.$api.knowledge.upsertPoint(params).then(res => {
|
|
|
+ if(res.knowledgeTree) {
|
|
|
+ this.$Message.success(this.$t('knowledge.saveSuccess'))
|
|
|
+ this.getPoints()
|
|
|
+ this.addPointsModal = false
|
|
|
+ } else {
|
|
|
+ this.$Message.warning(this.$t('knowledge.saveFail'))
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.$Message.error(this.$t('knowledge.saveFail'))
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -258,10 +361,43 @@ export default {
|
|
|
onSearchSchoolChange() {
|
|
|
this.schoolPointList = this.originSchoolList.filter(item => item.toUpperCase().indexOf(this.searchSchoolPoint.toUpperCase()) > -1 || item.toLowerCase().indexOf(this.searchSchoolPoint.toLowerCase()) > -1 || item.indexOf(this.searchSchoolPoint) > -1)
|
|
|
},
|
|
|
+ getKnowledgeTree() {
|
|
|
+ let params = {
|
|
|
+ periodId: '',
|
|
|
+ scope: 'private',
|
|
|
+ school_code: '',
|
|
|
+ id: this.selectTree
|
|
|
+ }
|
|
|
+ this.$api.knowledge.getPointInfo(params).then(res => {
|
|
|
+ if(res.knowledgeTrees) {
|
|
|
+ this.knowledgeTree = res.knowledgeTrees.length ? res.knowledgeTrees[0]?.tree : []
|
|
|
+ this.addPointsModal = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 新增知识点事件
|
|
|
+ onAddPoint(node, data) {
|
|
|
+ let idLast2 = data.children.length ? data.children[data.children.length - 1].id : '-0'
|
|
|
+ let id2 = idLast2.split(`-`)
|
|
|
+ data.children.push({
|
|
|
+ allcids: [],
|
|
|
+ children: [],
|
|
|
+ id: `${data.id}-${Number(id2[id2.length - 1]) + 1}`,
|
|
|
+ level: 1,
|
|
|
+ link: 0,
|
|
|
+ name: this.newPointName,
|
|
|
+ pid: data.id,
|
|
|
+ subcids: [],
|
|
|
+ tid: null,
|
|
|
+ used: 0
|
|
|
+ })
|
|
|
+ this.newPointName = ''
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.points.length) {
|
|
|
this.checkedList = this.points
|
|
|
+ // this.radioCode = this.radioCode === 'private' && this.schoolPointList.includes(this.checkedList[0]) ? 'private' : 'school'
|
|
|
}
|
|
|
this.curScope = this.scope
|
|
|
},
|