同步源模型(待还原)

Branch_d40a2540
yujialong 1 year 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`,
demoHiddenOpen: `nakadai/model/demo/hidden/batchOpen`,
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`,

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

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

@ -13,7 +13,6 @@
icon="el-icon-refresh"
@click="syncModel">同步原始模型列表</el-button>
<el-button v-auth="'/expSystem/list:进入:模型列表管理:新增分类'"
v-if="!orgList.length"
type="text"
@click="addType(0)">添加</el-button>
</div>
@ -95,7 +94,8 @@ export default {
categoryName: [
{ required: true, message: "请输入分类名称", trigger: "blur" }
]
}
},
promises: []
};
},
components: {
@ -147,21 +147,6 @@ export default {
}).catch(err => { })
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 () {
if (this.orgList.length) {
this.$confirm('同步后当前的组织架构将会被删除,是否继续?', '提示', {
@ -173,6 +158,65 @@ export default {
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) {
//

@ -237,7 +237,7 @@ export default {
},
//
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) {

Loading…
Cancel
Save