|
|
@ -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) { |
|
|
|
// 查询源模型分类 |
|
|
|
// 查询源模型分类 |
|
|
|