|
|
|
@ -2,7 +2,7 @@ |
|
|
|
|
<div> |
|
|
|
|
<div> |
|
|
|
|
<div class="front-switch"> |
|
|
|
|
<el-switch v-model="frontShow" :active-value="0" :inactive-value="1" active-text="内置模型按钮前台展示"></el-switch> |
|
|
|
|
<el-switch v-model="modelIsShow" :active-value="0" :inactive-value="1" active-text="内置模型按钮前台展示" @change="changeModelStatus"></el-switch> |
|
|
|
|
</div> |
|
|
|
|
<div class="flex-between m-b-20"> |
|
|
|
|
<el-button type="text" icon="el-icon-refresh" @click="syncModel">同步原始模型列表</el-button> |
|
|
|
@ -61,7 +61,7 @@ export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
systemId: this.$route.query.systemId, |
|
|
|
|
frontShow: false, |
|
|
|
|
modelIsShow: false, |
|
|
|
|
orgList: [], |
|
|
|
|
typeVisible: false, |
|
|
|
|
Form: { |
|
|
|
@ -82,8 +82,10 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getType() |
|
|
|
|
this.getModelStatus() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取分类 |
|
|
|
|
getType() { |
|
|
|
|
this.$post(`${this.api.modelClassList}?systemId=${this.systemId}`).then(res => { |
|
|
|
|
const { data } = res |
|
|
|
@ -94,6 +96,16 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 获取内置模型按钮展示状态 |
|
|
|
|
getModelStatus() { |
|
|
|
|
this.$post(`${this.api.checkIsShowBySystemId}?systemId=${this.systemId}`).then(res => { |
|
|
|
|
this.modelIsShow = res.isShow // 0为展示 1为不展示 |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 改变内置模型按钮展示状态 |
|
|
|
|
changeModelStatus(val) { |
|
|
|
|
this.$post(`${this.api.modifyIsShowState}?systemId=${this.systemId}&isShow=${val}`).then(res => {}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
getSingle() { |
|
|
|
|
this.$emit('initData') |
|
|
|
|
}, |
|
|
|
@ -124,10 +136,10 @@ export default { |
|
|
|
|
const systemId = this.systemId |
|
|
|
|
const promises = [] |
|
|
|
|
// 递归添加源模型分类及模型 |
|
|
|
|
const addType = (list, refId) => { |
|
|
|
|
list.map(e => { |
|
|
|
|
const addType = async (list, refId) => { |
|
|
|
|
for (const e of list) { |
|
|
|
|
// 用promise储存以添加完后更新数据 |
|
|
|
|
promises.push(new Promise(async (resolve, reject) => { |
|
|
|
|
// promises.push(new Promise(async (resolve, reject) => { |
|
|
|
|
// 新增分类 |
|
|
|
|
await this.$post(this.api.saveReferenceCategory, { |
|
|
|
|
id: '', |
|
|
|
@ -159,18 +171,18 @@ export default { |
|
|
|
|
}) |
|
|
|
|
// 新增模型 |
|
|
|
|
this.$post(this.api.saveReferenceDemo, modelData).then(res => { |
|
|
|
|
resolve() |
|
|
|
|
// resolve() |
|
|
|
|
resolve1() |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
// reject() |
|
|
|
|
reject1() |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
resolve() |
|
|
|
|
// resolve() |
|
|
|
|
} |
|
|
|
|
e.children = [...e.children, ...records] |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
// reject() |
|
|
|
|
}) |
|
|
|
|
})) |
|
|
|
|
|
|
|
|
@ -179,10 +191,10 @@ export default { |
|
|
|
|
e.children && e.children.length && addType(e.children, res.referenceCategoryId) |
|
|
|
|
}) |
|
|
|
|
}).catch(res => { |
|
|
|
|
reject() |
|
|
|
|
}) |
|
|
|
|
})) |
|
|
|
|
// reject() |
|
|
|
|
}) |
|
|
|
|
// })) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
addType(data[0].children, id) |
|
|
|
|
Promise.all(promises).then(_ => { |
|
|
|
|