Browse Source

update

dev
unknown 4 years ago
parent
commit
5b24923ab7
4 changed files with 21 additions and 6 deletions
  1. +4
    -0
      src/services/template.js
  2. +13
    -3
      src/views/manage_company/template/detail.vue
  3. +2
    -1
      src/views/manage_company/template/index.vue
  4. +2
    -2
      src/views/manage_company/template/market.vue

+ 4
- 0
src/services/template.js View File

@@ -5,6 +5,10 @@ export async function queryTemplateList() {
return await fetchApi('template/queryTemplateList');
}

export async function queryTemplateByCompanyId(companyId) {
return await fetchApi('template/queryTemplateByCompanyId', { companyId });
}

/**
* 上传xmind文件
* @param {File} file


+ 13
- 3
src/views/manage_company/template/detail.vue View File

@@ -16,7 +16,7 @@
<template #center>{{templateName}}</template>
<template #right>
<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>
</template>
</template>
@@ -71,9 +71,10 @@
<script>
import appHeader from "@/components/app-header/app-header.vue";
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 { queryAllIndustry } from '@/services/industry';
import { addTemplateToCompany } from './tool';

export default {
components: { appHeader, nodesViewer },
@@ -107,7 +108,7 @@ import { queryAllIndustry } from '@/services/industry';
const [res, indList, addedTemplateRes] = await Promise.all([
queryTemplateById(this.templateId),
queryAllIndustry(),
this.$fetchApi('template/queryTemplateByCompanyId', { companyId: this.companyId }),
queryTemplateByCompanyId(this.companyId),
]);
console.log(res, indList, addedTemplateRes);
const industryHash = indList.reduce((h, ind) => {
@@ -128,6 +129,15 @@ import { queryAllIndustry } from '@/services/industry';
if(!targetInd) return;
const industryCN = targetInd.LevelId.split('-').map(id => industryHash[id]?.Name).join(' / ');
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;
}
}
};


+ 2
- 1
src/views/manage_company/template/index.vue View File

@@ -75,6 +75,7 @@
<script>
import { wrapErrorHint } from '@/utils/request';
import { firstCharToLowerCase } from '@/utils/tool';
import { queryTemplateByCompanyId } from '@/services/template';
export default {
data() {
return {
@@ -116,7 +117,7 @@ import { firstCharToLowerCase } from '@/utils/tool';
* 加载企业模板列表
*/
async loadlistTemp() {
const res = await this.$fetchApi('template/queryTemplateByCompanyId', { companyId: this.companyId });
const res = await queryTemplateByCompanyId(this.companyId);
wrapErrorHint(res);
if(res.Code) { return; }
this.listTemp = (res.Data || []).map(item => firstCharToLowerCase(item));


+ 2
- 2
src/views/manage_company/template/market.vue View File

@@ -82,7 +82,7 @@
<script>
import appHeader from '@/components/app-header/app-header.vue';
import { queryAllIndustry } from "@/services/industry";
import { queryTemplateList } from '@/services/template';
import { queryTemplateByCompanyId, queryTemplateList } from '@/services/template';
import { firstCharToLowerCase } from '@/utils/tool';
import { addTemplateToCompany } from './tool';

@@ -136,7 +136,7 @@ export default {
const [templateListRes, indList, addedTemplateRes] = await Promise.all([
queryTemplateList(),
queryAllIndustry(),
this.$fetchApi('template/queryTemplateByCompanyId', { companyId: this.companyId }),
queryTemplateByCompanyId(this.companyId)
]);
const [tree] = composeIndustryAndTemplate(
templateListRes.Data || [],


Loading…
Cancel
Save