|
@@ -98,7 +98,7 @@
|
|
<a-tab-pane v-for="(item,index) in tabRouteList" :key="index + 1 + ''">
|
|
<a-tab-pane v-for="(item,index) in tabRouteList" :key="index + 1 + ''">
|
|
<span slot="tab">
|
|
<span slot="tab">
|
|
<span style="margin:0 12px 0 20px;">{{ item.name }}</span>
|
|
<span style="margin:0 12px 0 20px;">{{ item.name }}</span>
|
|
- <a-icon type="form" :style="{ color: '#000' }" @click.stop="handleEditTabClick(item)"/>
|
|
|
|
|
|
+ <a-icon type="form" :style="{ color: '#000' }" @click.stop="handleEditTabClick(item,index)"/>
|
|
<a-icon type="close" :style="{ color: '#000' }" @click.stop="handleDelTabClick(index)"/>
|
|
<a-icon type="close" :style="{ color: '#000' }" @click.stop="handleDelTabClick(index)"/>
|
|
</span>
|
|
</span>
|
|
<a-button type="dashed" style="width: 100%;" @click.stop="addLearnInfo"><a-icon type="plus" />新增学习内容</a-button>
|
|
<a-button type="dashed" style="width: 100%;" @click.stop="addLearnInfo"><a-icon type="plus" />新增学习内容</a-button>
|
|
@@ -136,7 +136,7 @@
|
|
<a-input v-model="routeForm.name" :maxLength="10" placeholder="请输入路径名称(10个汉字以内)"/>
|
|
<a-input v-model="routeForm.name" :maxLength="10" placeholder="请输入路径名称(10个汉字以内)"/>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
<a-form-model-item label="路径排序">
|
|
<a-form-model-item label="路径排序">
|
|
- <a-input v-model="routeForm.sort" :min="1" />
|
|
|
|
|
|
+ <a-input-number :disabled="showRouteTitle == '编辑学习路径'" v-model="routeForm.sort" :min="1" />
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-form-model>
|
|
</a-form-model>
|
|
</a-modal>
|
|
</a-modal>
|
|
@@ -289,6 +289,7 @@ export default {
|
|
tabsKeys: '1',
|
|
tabsKeys: '1',
|
|
tabRouteList:[],
|
|
tabRouteList:[],
|
|
showRouteTitle:'',
|
|
showRouteTitle:'',
|
|
|
|
+ chooseRouteIndex: 0,
|
|
showRouteFlag: false,
|
|
showRouteFlag: false,
|
|
routeForm:{
|
|
routeForm:{
|
|
name:'',
|
|
name:'',
|
|
@@ -324,13 +325,13 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.mapForm = Object.assign({},this.$options.data().mapForm)
|
|
|
|
let pkId = this.$route.query.pkId
|
|
let pkId = this.$route.query.pkId
|
|
if(pkId) {
|
|
if(pkId) {
|
|
this.pkId = pkId
|
|
this.pkId = pkId
|
|
this.load(pkId);
|
|
this.load(pkId);
|
|
|
|
+ } else {
|
|
|
|
+ this.load();
|
|
}
|
|
}
|
|
- this.load();
|
|
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
load(pkId = false) {
|
|
load(pkId = false) {
|
|
@@ -366,7 +367,7 @@ export default {
|
|
this.mapForm.groupId = info.groupId.split(',')
|
|
this.mapForm.groupId = info.groupId.split(',')
|
|
this.mapForm.groupSummary = info.groupSummary
|
|
this.mapForm.groupSummary = info.groupSummary
|
|
this.mapForm.groupPurview = info.groupPurview.toString()
|
|
this.mapForm.groupPurview = info.groupPurview.toString()
|
|
- if(info.routes.length) {
|
|
|
|
|
|
+ if(info.routes && info.routes.length) {
|
|
let disposeRoutes = info.routes
|
|
let disposeRoutes = info.routes
|
|
disposeRoutes.forEach(item => {
|
|
disposeRoutes.forEach(item => {
|
|
if(!item.contents) {
|
|
if(!item.contents) {
|
|
@@ -377,7 +378,6 @@ export default {
|
|
} else {
|
|
} else {
|
|
this.tabRouteList = []
|
|
this.tabRouteList = []
|
|
}
|
|
}
|
|
- console.log(this.tabRouteList)
|
|
|
|
if(this.mapForm.groupPurview == 2) {
|
|
if(this.mapForm.groupPurview == 2) {
|
|
let queryParam = {
|
|
let queryParam = {
|
|
pageNo: 1,
|
|
pageNo: 1,
|
|
@@ -445,7 +445,14 @@ export default {
|
|
item.createTime = getTimeNow()
|
|
item.createTime = getTimeNow()
|
|
})
|
|
})
|
|
this.showUserFlag = false
|
|
this.showUserFlag = false
|
|
- this.userList = [...res]
|
|
|
|
|
|
+ if(this.pkId) {
|
|
|
|
+ this.userList = [ ...this.userList, ...res ]
|
|
|
|
+ const map = new Map()
|
|
|
|
+ let filterList = this.userList.filter(el => !map.has(el.userId) && map.set(el.userId,true))
|
|
|
|
+ this.userList = filterList
|
|
|
|
+ } else {
|
|
|
|
+ this.userList = [ ...res ]
|
|
|
|
+ }
|
|
},
|
|
},
|
|
// 移除指定员工
|
|
// 移除指定员工
|
|
handleRemoveUserClick(record){
|
|
handleRemoveUserClick(record){
|
|
@@ -472,17 +479,45 @@ export default {
|
|
handleSaveRouteOk() {
|
|
handleSaveRouteOk() {
|
|
if(!this.routeForm.name) {
|
|
if(!this.routeForm.name) {
|
|
this.$message.error('请输入路径名称')
|
|
this.$message.error('请输入路径名称')
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- this.tabRouteList.push({
|
|
|
|
- ...this.routeForm,
|
|
|
|
- contents: []
|
|
|
|
- })
|
|
|
|
- this.tabRouteList = this.tabRouteList.sort((a,b)=>{ return a.sort-b.sort})
|
|
|
|
|
|
+ if(this.tabRouteList.some(item => item.name == this.routeForm.name)) {
|
|
|
|
+ this.$message.error('路径名已存在')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(this.showRouteTitle == '编辑学习路径') {
|
|
|
|
+ this.tabRouteList.splice(this.chooseRouteIndex,1,{
|
|
|
|
+ ...this.routeForm,
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ // 找到tabRouteList中大于等于routeForm.sort的索引
|
|
|
|
+ let itemIndex = this.tabRouteList.findIndex(item => item.sort >= this.routeForm.sort)
|
|
|
|
+ if(itemIndex == -1) {
|
|
|
|
+ this.tabRouteList.push({
|
|
|
|
+ ...this.routeForm,
|
|
|
|
+ contents: []
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ this.tabRouteList.splice(itemIndex,0,{
|
|
|
|
+ ...this.routeForm,
|
|
|
|
+ contents: []
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 直接push后排序
|
|
|
|
+ // this.tabRouteList.push({
|
|
|
|
+ // ...this.routeForm,
|
|
|
|
+ // contents: []
|
|
|
|
+ // })
|
|
|
|
+ // this.tabRouteList = this.tabRouteList.sort((a,b)=>{ return a.sort-b.sort})
|
|
this.showRouteFlag = false
|
|
this.showRouteFlag = false
|
|
},
|
|
},
|
|
// 编辑学习路径
|
|
// 编辑学习路径
|
|
- handleEditTabClick(item){
|
|
|
|
- this.routeForm = item
|
|
|
|
|
|
+ handleEditTabClick(item,index){
|
|
|
|
+ this.chooseRouteIndex = index
|
|
|
|
+ this.routeForm = JSON.parse(JSON.stringify(item))
|
|
this.showRouteTitle = '编辑学习路径'
|
|
this.showRouteTitle = '编辑学习路径'
|
|
this.showRouteFlag = true
|
|
this.showRouteFlag = true
|
|
},
|
|
},
|
|
@@ -571,7 +606,7 @@ export default {
|
|
this.$refs.learnRef.validate(valid => {
|
|
this.$refs.learnRef.validate(valid => {
|
|
if(valid) {
|
|
if(valid) {
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- if(this.learnForm.type == 1) {
|
|
|
|
|
|
+ if(this.learnForm.type == 1) {
|
|
this.tabRouteList[parseInt(this.tabsKeys)-1].contents.push({
|
|
this.tabRouteList[parseInt(this.tabsKeys)-1].contents.push({
|
|
...this.learnForm
|
|
...this.learnForm
|
|
})
|
|
})
|