同步源模型(待还原)

Branch_d40a2540
yujialong 2 years ago
parent 6008670bc8
commit 7b74f1a498
  1. 2
      src/api/index.js
  2. 5
      src/pages/expSystem/backstage/addModel.vue
  3. 6
      src/pages/expSystem/backstage/model.vue
  4. 78
      src/pages/expSystem/backstage/modelType.vue
  5. 2
      src/pages/expSystem/backstage/sourceModel.vue

@ -458,6 +458,8 @@ export default {
systemModelByTeacher: `nakadai/nakadai/model/reference/demo/systemModelByTeacher`, systemModelByTeacher: `nakadai/nakadai/model/reference/demo/systemModelByTeacher`,
demoHiddenOpen: `nakadai/model/demo/hidden/batchOpen`, demoHiddenOpen: `nakadai/model/demo/hidden/batchOpen`,
demoHiddenClose: `nakadai/model/demo/hidden/batchShutdown`, demoHiddenClose: `nakadai/model/demo/hidden/batchShutdown`,
teacherModelList: `nakadai/nakadai/model/reference/demo/teacherModelList`,
saveModel: `nakadai/nakadai/model/reference/demo/save`,
// 教师评语 // 教师评语
addComment: `evaluation/cevaluation/comment/addComment`, addComment: `evaluation/cevaluation/comment/addComment`,

@ -54,6 +54,7 @@ export default {
return { return {
systemId: +this.$route.query.systemId, systemId: +this.$route.query.systemId,
categoryId: +this.$route.query.categoryId, categoryId: +this.$route.query.categoryId,
founder: +this.$route.query.founder,
id: +this.$route.query.id, id: +this.$route.query.id,
postStatus: +this.$route.query.postStatus, postStatus: +this.$route.query.postStatus,
isDetail: Boolean(this.$route.query.show), // isDetail: Boolean(this.$route.query.show), //
@ -115,7 +116,7 @@ export default {
}, },
// //
getType () { getType () {
this.$post(this.api.sourceModelClassification + '?founder=1').then(({ data }) => { this.$post(this.api.sourceModelClassification + '?founder=' + (this.isDetail ? this.founder : 1)).then(({ data }) => {
// children // children
const handleLeaf = list => { const handleLeaf = list => {
list.map(e => { list.map(e => {
@ -131,7 +132,7 @@ export default {
if (this.id) { if (this.id) {
this.getData() this.getData()
} else { } else {
this.handleId(data, this.categoryId) this.handleId(data[0].children, this.categoryId)
} }
}).catch(res => { }) }).catch(res => { })
}, },

@ -56,7 +56,7 @@
<el-table-column label="状态" <el-table-column label="状态"
align="center"> align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.isOpen ? '禁用' : '启用' }} {{ scope.row.isClose ? '禁用' : '启用' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作"
@ -158,10 +158,11 @@ export default {
methods: { methods: {
getList () { getList () {
const curNode = this.$refs.tree.$refs.tree.getCurrentNode() // const curNode = this.$refs.tree.$refs.tree.getCurrentNode() //
if (curNode) {
this.isTopLevel = !curNode.level this.isTopLevel = !curNode.level
// //
if (this.isTopLevel) { if (this.isTopLevel) {
this.$post(this.api.getAllModelList, { this.$post(this.api.teacherModelList, {
founder: 1, founder: 1,
modelName: this.keyword, modelName: this.keyword,
pageNum: this.page, pageNum: this.page,
@ -183,6 +184,7 @@ export default {
this.total = res.data.total this.total = res.data.total
}).catch(res => { }) }).catch(res => { })
} }
}
}, },
getData () { getData () {
clearInterval(this.timer) clearInterval(this.timer)

@ -13,7 +13,6 @@
icon="el-icon-refresh" icon="el-icon-refresh"
@click="syncModel">同步原始模型列表</el-button> @click="syncModel">同步原始模型列表</el-button>
<el-button v-auth="'/expSystem/list:进入:模型列表管理:新增分类'" <el-button v-auth="'/expSystem/list:进入:模型列表管理:新增分类'"
v-if="!orgList.length"
type="text" type="text"
@click="addType(0)">添加</el-button> @click="addType(0)">添加</el-button>
</div> </div>
@ -95,7 +94,8 @@ export default {
categoryName: [ categoryName: [
{ required: true, message: "请输入分类名称", trigger: "blur" } { required: true, message: "请输入分类名称", trigger: "blur" }
] ]
} },
promises: []
}; };
}, },
components: { components: {
@ -147,21 +147,6 @@ export default {
}).catch(err => { }) }).catch(err => { })
this.$emit('initData') this.$emit('initData')
}, },
syncModelData () {
//
this.$post(`${this.api.delModelInfoBySystemId}?systemId=${this.systemId}&founder=1`).then(res => {
this.$post(`${this.api.synchronizationMdelByOccupationlab}?systemId=${this.systemId}`).then(res => {
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
categoryId: ''
}
})
this.getType()
})
}).catch(() => { })
},
syncModel () { syncModel () {
if (this.orgList.length) { if (this.orgList.length) {
this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', { this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', {
@ -173,6 +158,65 @@ export default {
this.syncModelData() this.syncModelData()
} }
}, },
//
async syncModelData () {
//
await this.$post(`${this.api.delModelInfoBySystemId}?systemId=${this.systemId}&founder=1`)
/**
* 先调同步接口把老师端源模型里面的内置模型同步过来这一步后端做
* 然后接口会返回全部这个分类的id然后把本校分类及模型全部加到全部这个分类下
*/
const { id } = await this.$post(`${this.api.synchronizationMdelByOccupationlab}?systemId=${this.systemId}`)
const { data } = await this.$post(this.api.sourceModelClassification + '?founder=1') //
this.handleCatetory(data[0].children, id)
Promise.all(this.promises).then(() => {
this.getType()
this.$router.push({
path: 'backstage',
query: {
...this.$route.query,
categoryId: ''
}
})
}).catch(e => { })
},
//
handleCatetory (list, parentId) {
this.promises.push(...list.map(async e => {
//
const res = await this.$post(this.api.saveReferenceCategory, {
parentId,
categoryName: e.categoryName,
systemId: this.systemId,
level: e.level,
founder: 1
})
//
const { data } = await this.$post(this.api.InstitutionSourceModel, {
pageNum: 1,
pageSize: 10000,
systemId: this.systemId,
founder: 1,
categoryId: e.id
})
// id
data.records.map(async n => {
await this.$post(this.api.saveModel, {
categoryId: res.referenceCategoryId,
copyId: n.id,
modelName: n.modelName,
modelDemo: n.modelDemo,
postStatus: n.postStatus,
systemId: this.systemId,
founder: 1
})
})
e.children && this.handleCatetory(e.children, res.referenceCategoryId)
}))
},
// //
async addData (id) { async addData (id) {
// //

@ -237,7 +237,7 @@ export default {
}, },
// //
show (row) { show (row) {
this.$router.push(`addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1`) this.$router.push(`addModel?categoryId=${this.$refs.tree.$refs.tree.getCurrentKey()}&id=${row.id}&show=1&founder=${this.isSystem ? 0 : 1}`)
}, },
// //
edit (row) { edit (row) {

Loading…
Cancel
Save