|
@@ -16,7 +16,7 @@ |
|
|
<template #center>{{templateName}}</template> |
|
|
<template #center>{{templateName}}</template> |
|
|
<template #right> |
|
|
<template #right> |
|
|
<template v-if="templateIsAdded !== undefined"> |
|
|
<template v-if="templateIsAdded !== undefined"> |
|
|
<el-button type="primary" v-if="!templateIsAdded">添加模板</el-button> |
|
|
|
|
|
|
|
|
<el-button type="primary" v-if="!templateIsAdded" @click.stop="addTemplate">添加模板</el-button> |
|
|
<el-button v-else disabled>已添加</el-button> |
|
|
<el-button v-else disabled>已添加</el-button> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
|
</template> |
|
@@ -71,9 +71,10 @@ |
|
|
<script> |
|
|
<script> |
|
|
import appHeader from "@/components/app-header/app-header.vue"; |
|
|
import appHeader from "@/components/app-header/app-header.vue"; |
|
|
import nodesViewer from "@/components/nodes-viewer"; |
|
|
import nodesViewer from "@/components/nodes-viewer"; |
|
|
import { queryTemplateById, queryTemplateNodeByTemplateId } from '@/services/template'; |
|
|
|
|
|
|
|
|
import { queryTemplateByCompanyId, queryTemplateById, queryTemplateNodeByTemplateId } from '@/services/template'; |
|
|
import { firstCharToLowerCase } from '@/utils/tool'; |
|
|
import { firstCharToLowerCase } from '@/utils/tool'; |
|
|
import { queryAllIndustry } from '@/services/industry'; |
|
|
import { queryAllIndustry } from '@/services/industry'; |
|
|
|
|
|
import { addTemplateToCompany } from './tool'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
components: { appHeader, nodesViewer }, |
|
|
components: { appHeader, nodesViewer }, |
|
@@ -107,7 +108,7 @@ import { queryAllIndustry } from '@/services/industry'; |
|
|
const [res, indList, addedTemplateRes] = await Promise.all([ |
|
|
const [res, indList, addedTemplateRes] = await Promise.all([ |
|
|
queryTemplateById(this.templateId), |
|
|
queryTemplateById(this.templateId), |
|
|
queryAllIndustry(), |
|
|
queryAllIndustry(), |
|
|
this.$fetchApi('template/queryTemplateByCompanyId', { companyId: this.companyId }), |
|
|
|
|
|
|
|
|
queryTemplateByCompanyId(this.companyId), |
|
|
]); |
|
|
]); |
|
|
console.log(res, indList, addedTemplateRes); |
|
|
console.log(res, indList, addedTemplateRes); |
|
|
const industryHash = indList.reduce((h, ind) => { |
|
|
const industryHash = indList.reduce((h, ind) => { |
|
@@ -128,6 +129,15 @@ import { queryAllIndustry } from '@/services/industry'; |
|
|
if(!targetInd) return; |
|
|
if(!targetInd) return; |
|
|
const industryCN = targetInd.LevelId.split('-').map(id => industryHash[id]?.Name).join(' / '); |
|
|
const industryCN = targetInd.LevelId.split('-').map(id => industryHash[id]?.Name).join(' / '); |
|
|
this.templateInfo.industryCN = industryCN; |
|
|
this.templateInfo.industryCN = industryCN; |
|
|
|
|
|
}, |
|
|
|
|
|
/** |
|
|
|
|
|
* 添加模板 |
|
|
|
|
|
*/ |
|
|
|
|
|
async addTemplate () { |
|
|
|
|
|
const res = await addTemplateToCompany(this.companyId, this.templateId); |
|
|
|
|
|
if(res.Code) { return; } |
|
|
|
|
|
this.$notify({ message: '添加成功', type: 'success' }); |
|
|
|
|
|
this.templateIsAdded = true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|