|
@@ -1,158 +1,99 @@
|
|
<template>
|
|
<template>
|
|
- <div class="custom-analyse">
|
|
|
|
|
|
+ <div class="height_100 custom-analyse">
|
|
<el-container>
|
|
<el-container>
|
|
<el-aside width="350px">
|
|
<el-aside width="350px">
|
|
- <!-- <el-container>
|
|
|
|
- <el-header class="custom-analyse-tabs">
|
|
|
|
- <el-tabs v-model="activeTab" type="card">
|
|
|
|
- <el-tab-pane label="分析项" name="TabItem"></el-tab-pane>
|
|
|
|
- <el-tab-pane label="数据" name="TabData"></el-tab-pane>
|
|
|
|
- <el-tab-pane label="样式" name="TabStyle"></el-tab-pane>
|
|
|
|
- <el-tab-pane label="辅助线" name="TabLine" :disabled="enable.indexOf(form.setting.type) === -1"></el-tab-pane>
|
|
|
|
- </el-tabs>
|
|
|
|
- </el-header>
|
|
|
|
- <el-main class="nopadding"> -->
|
|
|
|
- <!-- <component
|
|
|
|
- :is="activeTab"
|
|
|
|
- :active-item="activeItem"
|
|
|
|
- @edit="handleEdit"
|
|
|
|
- @delete="handleDelete"
|
|
|
|
- @select="handleSelect"
|
|
|
|
- ></component> -->
|
|
|
|
- <!-- </el-main>
|
|
|
|
- </el-container> -->
|
|
|
|
- <TabItem :active-item="activeItem" @edit="handleEdit" @delete="handleDelete" @select="handleSelect"></TabItem>
|
|
|
|
|
|
+ <TabItem :active-item="activeItem" :treeList="treeList" @edit="handleEdit" @delete="handleDelete" @select="handleSelect" @handleAdd3="handleAdd3"></TabItem>
|
|
</el-aside>
|
|
</el-aside>
|
|
- <el-container>
|
|
|
|
- <el-header>
|
|
|
|
|
|
+ <el-main>
|
|
|
|
+ <el-header style="height:45px !important">
|
|
<template>
|
|
<template>
|
|
<div class="custom-analyse-options">
|
|
<div class="custom-analyse-options">
|
|
- <span class="text">专利数量<span class="number">{{ patentNum }} 件</span></span>
|
|
|
|
- <el-button size="small" type="primary" @click="handleAdd3">添加组</el-button>
|
|
|
|
- <el-dropdown size="small">
|
|
|
|
- <el-button size="small" type="warning">
|
|
|
|
- 更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
- </el-button>
|
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
|
- <el-dropdown-item @click.native="handleScreenshot">截图</el-dropdown-item>
|
|
|
|
- <el-dropdown-item @click.native="handleAdd1(0)">保存修改</el-dropdown-item>
|
|
|
|
- <el-dropdown-item @click.native="handleAdd1(1)">另存为</el-dropdown-item>
|
|
|
|
- <el-dropdown-item @click.native="handleExport">导出数据</el-dropdown-item>
|
|
|
|
- </el-dropdown-menu>
|
|
|
|
- </el-dropdown>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <el-button type="text" size="small" @click="openDrawer(1)">分析栏位</el-button>
|
|
|
|
+ <el-button type="text" size="small" @click="openDrawer(2)">图形配置</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <span class="text">专利数量<span class="number">{{ patentNum }} 件</span></span>
|
|
|
|
+
|
|
|
|
+ <el-dropdown size="small">
|
|
|
|
+ <el-button size="small" type="text">
|
|
|
|
+ 更多菜单<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
|
+ <el-dropdown-item @click.native="handleScreenshot">截图</el-dropdown-item>
|
|
|
|
+ <el-dropdown-item @click.native="handleAdd1(0)">保存修改</el-dropdown-item>
|
|
|
|
+ <el-dropdown-item @click.native="handleAdd1(1)">另存为</el-dropdown-item>
|
|
|
|
+ <el-dropdown-item @click.native="handleExport">导出数据</el-dropdown-item>
|
|
|
|
+ </el-dropdown-menu>
|
|
|
|
+ </el-dropdown>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
</el-header>
|
|
</el-header>
|
|
<el-main class="custom-analyse-chart-img-box">
|
|
<el-main class="custom-analyse-chart-img-box">
|
|
<div v-if="showChart">
|
|
<div v-if="showChart">
|
|
- <chart ref="chartDom" :form="from" :width="form.setting.width + form.setting.widthUnit" :height="form.setting.height + form.setting.heightUnit" />
|
|
|
|
|
|
+ <chart ref="chartDom" :width="form.setting.width + form.setting.widthUnit" :height="form.setting.height + form.setting.heightUnit" />
|
|
</div>
|
|
</div>
|
|
</el-main>
|
|
</el-main>
|
|
- </el-container>
|
|
|
|
|
|
+ </el-main>
|
|
</el-container>
|
|
</el-container>
|
|
-
|
|
|
|
- <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose" :append-to-body="true" :close-on-click-modal="false">
|
|
|
|
- <el-form v-if="dialogVisible" ref="ruleForm" :model="form2" :rules="rules" label-position="left" label-width="100px">
|
|
|
|
- <el-form-item label="所属组" prop="parentId" v-if="form2.type">
|
|
|
|
- <el-select v-model="form2.parentId" filterable allow-create placeholder="请选择" style="width: 100%">
|
|
|
|
- <el-option v-for="item in treeList" :label="item.name" :key="item.id" :value="item.id"></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item :label="`${form2.type ? '项目名称' : '组名称'}`" prop="name">
|
|
|
|
- <el-input v-model="form2.name" placeholder="请输入"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="显示顺序" prop="sort">
|
|
|
|
- <el-input v-model.number="form2.sort" type="number" placeholder="请输入"></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="使用权限" prop="permissions" v-if="form2.type">
|
|
|
|
- <el-select v-model="form2.permissions" placeholder="请选择" style="width: 100%">
|
|
|
|
- <el-option v-for="item in $constants.permissions" :label="item.label" :key="item.value" :value="item.value"></el-option>
|
|
|
|
- </el-select>
|
|
|
|
- </el-form-item>
|
|
|
|
- </el-form>
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
- <el-button @click="cancel">关 闭</el-button>
|
|
|
|
- <el-button type="primary" @click="handleConfirm" :loading="loadingBtn">确 定</el-button>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
|
|
+ <addAnalyseGroup ref="addAnalyseGroup" :projectId="projectId" :treeList="treeList" @save="getTreeList"></addAnalyseGroup>
|
|
<el-drawer
|
|
<el-drawer
|
|
- title="图表配置"
|
|
|
|
|
|
+ :title="title"
|
|
:visible.sync="drawer"
|
|
:visible.sync="drawer"
|
|
direction="rtl"
|
|
direction="rtl"
|
|
:before-close="handleClose"
|
|
:before-close="handleClose"
|
|
size="500px">
|
|
size="500px">
|
|
- <div style="width:500px">
|
|
|
|
- <Style :form="form"></Style>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <el-container>
|
|
|
|
+ <el-main>
|
|
|
|
+ <component :is='components'></component>
|
|
|
|
+ </el-main>
|
|
|
|
+ <el-footer class="footer-common">
|
|
|
|
+ <el-button @click="handleClose">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submit" :loading="loadingBtn">确 定</el-button>
|
|
|
|
+ </el-footer>
|
|
|
|
+ </el-container>
|
|
|
|
+
|
|
</el-drawer>
|
|
</el-drawer>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import Chart from "./components/Charts/index.vue";
|
|
|
|
import { mapGetters } from "vuex";
|
|
import { mapGetters } from "vuex";
|
|
|
|
+import html2canvas from "html2canvas";
|
|
import { downLoad, findChildren, getTreeLastChildren, getTreeDataList, downLoadBase64 } from "@/utils";
|
|
import { downLoad, findChildren, getTreeLastChildren, getTreeDataList, downLoadBase64 } from "@/utils";
|
|
|
|
+import { detectionChartType, getFormPermissions, getTreeNameByIds, getXAxisName, getSourceName } from "@/utils/chart";
|
|
import { customPage } from "./mixins";
|
|
import { customPage } from "./mixins";
|
|
import moment from "moment";
|
|
import moment from "moment";
|
|
-import TreeSelect from '@riophae/vue-treeselect'
|
|
|
|
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
-import { detectionChartType, getFormPermissions, getTreeNameByIds, getXAxisName, getSourceName } from "@/utils/chart";
|
|
|
|
|
|
+import addAnalyseGroup from './components/dialog/addAnalyseGroup.vue'
|
|
|
|
+import Chart from "./components/Charts/index.vue";
|
|
import TabItem from "./components/Tabs/Item";
|
|
import TabItem from "./components/Tabs/Item";
|
|
import TabData from "./components/Tabs/Data";
|
|
import TabData from "./components/Tabs/Data";
|
|
-// import TabLine from "./components/Tabs/Line";
|
|
|
|
-import html2canvas from "html2canvas";
|
|
|
|
-
|
|
|
|
|
|
+import TabStyle from "./components/Tabs/Style";
|
|
export default {
|
|
export default {
|
|
components: {
|
|
components: {
|
|
- TreeSelect,
|
|
|
|
|
|
+ addAnalyseGroup,
|
|
Chart,
|
|
Chart,
|
|
TabItem,
|
|
TabItem,
|
|
TabData,
|
|
TabData,
|
|
- TabStyle,
|
|
|
|
- TabLine
|
|
|
|
|
|
+ TabStyle
|
|
},
|
|
},
|
|
mixins: [customPage],
|
|
mixins: [customPage],
|
|
|
|
+ props: {},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
- activeTab: 'TabItem',
|
|
|
|
- enable: [2, 5, 6, 8, 9, 17],
|
|
|
|
- saveType: 0,
|
|
|
|
- form2: {},
|
|
|
|
- rules: {
|
|
|
|
- parentId: [
|
|
|
|
- {required: true, message: '请选择上级目录', trigger: 'change'},
|
|
|
|
- ],
|
|
|
|
- name: [
|
|
|
|
- {required: true, message: '请输入名称', trigger: 'blur'},
|
|
|
|
- ],
|
|
|
|
- permissions: [
|
|
|
|
- {required: true, message: '请输选择使用权限', trigger: 'change'},
|
|
|
|
- ],
|
|
|
|
- sort: [
|
|
|
|
- {required: true, message: '请输入显示次序', trigger: 'blur'},
|
|
|
|
- ],
|
|
|
|
- },
|
|
|
|
- showChart: true,
|
|
|
|
- showPage: false,
|
|
|
|
- loadingBtn2: false,
|
|
|
|
- loadingBtn3: false,
|
|
|
|
- activeName: '1',
|
|
|
|
- activeItem: [],
|
|
|
|
- loading: false,
|
|
|
|
- loadingBtn: false,
|
|
|
|
- title: '',
|
|
|
|
- chartTitle: '',
|
|
|
|
- dialogVisible: false,
|
|
|
|
- loadData: true,
|
|
|
|
- drawer: false,
|
|
|
|
- tempForm: {
|
|
|
|
- name: '',
|
|
|
|
- sort: 0
|
|
|
|
- },
|
|
|
|
- //图形配置
|
|
|
|
- form:{}
|
|
|
|
- }
|
|
|
|
|
|
+ activeItem:[],
|
|
|
|
+ // treeList:[],
|
|
|
|
+ showChart:false,
|
|
|
|
+ title:'',
|
|
|
|
+ drawer:false,
|
|
|
|
+ components:'TabData',
|
|
|
|
+ saveType: 1,
|
|
|
|
+ loadingBtn:false,
|
|
|
|
+ id:null
|
|
|
|
+ };
|
|
},
|
|
},
|
|
|
|
+ watch: {},
|
|
computed: {
|
|
computed: {
|
|
...mapGetters(['userinfo']),
|
|
...mapGetters(['userinfo']),
|
|
search(){
|
|
search(){
|
|
@@ -169,11 +110,20 @@ export default {
|
|
return this.$route.query.patentNum || 0
|
|
return this.$route.query.patentNum || 0
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
+ created() {},
|
|
mounted() {
|
|
mounted() {
|
|
-
|
|
|
|
this.getData()
|
|
this.getData()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ openDrawer(type){
|
|
|
|
+ var components = {
|
|
|
|
+ 1:'tabData',
|
|
|
|
+ 2:'tabStyle'
|
|
|
|
+ }
|
|
|
|
+ this.title = type == 1?'数据':'样式配置'
|
|
|
|
+ this.components = components[type]
|
|
|
|
+ this.drawer = true
|
|
|
|
+ },
|
|
normalizer(node) {
|
|
normalizer(node) {
|
|
if (node.children && !node.children.length) {
|
|
if (node.children && !node.children.length) {
|
|
delete node.children;
|
|
delete node.children;
|
|
@@ -184,17 +134,8 @@ export default {
|
|
children: node.children
|
|
children: node.children
|
|
};
|
|
};
|
|
},
|
|
},
|
|
- cancel() {
|
|
|
|
- this.saveType = 0
|
|
|
|
- this.dialogVisible = false
|
|
|
|
- },
|
|
|
|
- errorPage() {
|
|
|
|
|
|
|
|
- },
|
|
|
|
- handleClose() {
|
|
|
|
- this.saveType = 0
|
|
|
|
- this.dialogVisible = false
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
reset() {
|
|
reset() {
|
|
|
|
|
|
},
|
|
},
|
|
@@ -205,9 +146,10 @@ export default {
|
|
this.handleAdd()
|
|
this.handleAdd()
|
|
this.showChart = false
|
|
this.showChart = false
|
|
this.saveType = 1
|
|
this.saveType = 1
|
|
|
|
+ this.openDrawer(1)
|
|
} else {
|
|
} else {
|
|
this.activeItem = [this.treeList[0].id]
|
|
this.activeItem = [this.treeList[0].id]
|
|
- await this.handleSelect(this.treeList[0].children[0].uid)
|
|
|
|
|
|
+ await this.handleSelect(this.treeList[0].children[0].id)
|
|
}
|
|
}
|
|
this.showPage = true
|
|
this.showPage = true
|
|
|
|
|
|
@@ -218,13 +160,13 @@ export default {
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(async () => {
|
|
}).then(async () => {
|
|
- const response = await this.$api.deleteCustomItem(value.id)
|
|
|
|
|
|
+ const response = await this.$api.delAnalyseGroup({id:value.id})
|
|
this.$message.success('删除成功')
|
|
this.$message.success('删除成功')
|
|
await this.getTreeList()
|
|
await this.getTreeList()
|
|
if (this.form.id === value.id) {
|
|
if (this.form.id === value.id) {
|
|
const tree = this.treeList.find(item => item.id === value.parentId)
|
|
const tree = this.treeList.find(item => item.id === value.parentId)
|
|
if (tree && tree.children.length) {
|
|
if (tree && tree.children.length) {
|
|
- await this.handleSelect(tree.children[tree.children.length - 1].uid)
|
|
|
|
|
|
+ await this.handleSelect(tree.children[tree.children.length - 1].id)
|
|
} else {
|
|
} else {
|
|
this.handleAdd()
|
|
this.handleAdd()
|
|
}
|
|
}
|
|
@@ -234,7 +176,7 @@ export default {
|
|
// 获取需要进行的每一个分析项
|
|
// 获取需要进行的每一个分析项
|
|
async getTreeList() {
|
|
async getTreeList() {
|
|
this.loading = true
|
|
this.loading = true
|
|
- const response = await this.$api.getCustomTree({ projectId: this.projectId })
|
|
|
|
|
|
+ const response = await this.$api.queryAnalyseGroup({ projectId: this.projectId })
|
|
// 获取到的数据存
|
|
// 获取到的数据存
|
|
this.$store.commit('SET_CHART_TREE', response.data)
|
|
this.$store.commit('SET_CHART_TREE', response.data)
|
|
this.setChildren(this.treeList, 'isDisabled')
|
|
this.setChildren(this.treeList, 'isDisabled')
|
|
@@ -273,16 +215,15 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
handleAdd3() {
|
|
handleAdd3() {
|
|
- this.title = '添加组'
|
|
|
|
- this.form2 = {
|
|
|
|
- parentId: 0,
|
|
|
|
- name: '',
|
|
|
|
- sort: this.treeList.length + 1,
|
|
|
|
- type: 0,
|
|
|
|
- permissions: 2,
|
|
|
|
- projectId: this.projectId
|
|
|
|
- }
|
|
|
|
- this.dialogVisible = true
|
|
|
|
|
|
+ var form = {
|
|
|
|
+ type:1,
|
|
|
|
+ permissions: 2,
|
|
|
|
+ parentId: 0,
|
|
|
|
+ sort: this.treeList.length + 1,
|
|
|
|
+ name: '',
|
|
|
|
+ }
|
|
|
|
+ var title = '添加组'
|
|
|
|
+ this.$refs.addAnalyseGroup.open(title,form)
|
|
},
|
|
},
|
|
async handleScreenshot() {
|
|
async handleScreenshot() {
|
|
const canvas = await html2canvas(this.$refs.chartDom.$el)
|
|
const canvas = await html2canvas(this.$refs.chartDom.$el)
|
|
@@ -291,33 +232,30 @@ export default {
|
|
},
|
|
},
|
|
async handleAdd1(saveType) {
|
|
async handleAdd1(saveType) {
|
|
this.saveType = saveType
|
|
this.saveType = saveType
|
|
- this.onChange()
|
|
|
|
- this.title = '保存自定义分析'
|
|
|
|
- let data = {
|
|
|
|
- parentId: null,
|
|
|
|
- permissions: 2,
|
|
|
|
- name: '',
|
|
|
|
- sort: 0
|
|
|
|
- }
|
|
|
|
- if (this.form.uid) {
|
|
|
|
- const response = await this.$api.getCustomItem(this.form.uid)
|
|
|
|
|
|
+ // this.onChange()
|
|
|
|
+ var title = '保存自定义分析'
|
|
|
|
+ let data = {}
|
|
|
|
+ if(this.saveType == 1){
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ data.id = this.id
|
|
|
|
+ }
|
|
|
|
+ if (this.id && this.saveType == 0) {
|
|
|
|
+ const response = await this.$api.queryAnalyseDetail({id:this.id})
|
|
data = response.data
|
|
data = response.data
|
|
- this.tempForm.name = data.name
|
|
|
|
- this.tempForm.sort = data.sort
|
|
|
|
}
|
|
}
|
|
- this.form2 = {
|
|
|
|
- id: data.id,
|
|
|
|
- parentId: data.parentId,
|
|
|
|
- type: 1,
|
|
|
|
- permissions: data.permissions,
|
|
|
|
- name: data.name,
|
|
|
|
- sort: data.sort,
|
|
|
|
- setting: this.form.setting,
|
|
|
|
- schema: this.form.schema,
|
|
|
|
- source: this.form.source,
|
|
|
|
|
|
+ var form2 = {
|
|
|
|
+ ...data,
|
|
|
|
+ type:2,
|
|
|
|
+ // setting: this.form.setting,
|
|
|
|
+ // schema: this.form.schema,
|
|
|
|
+ // source: this.form.source,
|
|
projectId: this.projectId
|
|
projectId: this.projectId
|
|
}
|
|
}
|
|
- this.dialogVisible = true
|
|
|
|
|
|
+ form2.setting = this.form.setting
|
|
|
|
+ form2.schema = this.form.schema
|
|
|
|
+ form2.source = this.form.source
|
|
|
|
+ this.$refs.addAnalyseGroup.open(title,form2)
|
|
},
|
|
},
|
|
handleAdd() {
|
|
handleAdd() {
|
|
let table = []
|
|
let table = []
|
|
@@ -329,6 +267,7 @@ export default {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
let form = {
|
|
let form = {
|
|
|
|
+ search:this.search,
|
|
setting: {
|
|
setting: {
|
|
type: 1,
|
|
type: 1,
|
|
showType: 0,
|
|
showType: 0,
|
|
@@ -359,10 +298,10 @@ export default {
|
|
splitLine: false,
|
|
splitLine: false,
|
|
splitLine2: false,
|
|
splitLine2: false,
|
|
legend: true,
|
|
legend: true,
|
|
- gridTop: "0",
|
|
|
|
- gridLeft: "0",
|
|
|
|
- gridBottom: "0",
|
|
|
|
- gridRight: "0",
|
|
|
|
|
|
+ gridTop: "10",
|
|
|
|
+ gridLeft: "10",
|
|
|
|
+ gridBottom: "10",
|
|
|
|
+ gridRight: "10",
|
|
labelColor: "#000000",
|
|
labelColor: "#000000",
|
|
legendColor: "#000000",
|
|
legendColor: "#000000",
|
|
legendLocation: "top",
|
|
legendLocation: "top",
|
|
@@ -377,10 +316,10 @@ export default {
|
|
interval2: true,
|
|
interval2: true,
|
|
rotate: "0",
|
|
rotate: "0",
|
|
rotate2: "0",
|
|
rotate2: "0",
|
|
- paddingTop: 0,
|
|
|
|
- paddingBottom: 0,
|
|
|
|
- paddingRight: 0,
|
|
|
|
- paddingLeft: 0,
|
|
|
|
|
|
+ paddingTop: 10,
|
|
|
|
+ paddingBottom: 10,
|
|
|
|
+ paddingRight: 10,
|
|
|
|
+ paddingLeft: 10,
|
|
paddingTop2: 0,
|
|
paddingTop2: 0,
|
|
paddingLeft2: 0,
|
|
paddingLeft2: 0,
|
|
paddingBottom2: 0,
|
|
paddingBottom2: 0,
|
|
@@ -402,7 +341,8 @@ export default {
|
|
},
|
|
},
|
|
schema: {
|
|
schema: {
|
|
x: {
|
|
x: {
|
|
- num: 10
|
|
|
|
|
|
+ num: 10,
|
|
|
|
+ // field:'PA'
|
|
},
|
|
},
|
|
y: {
|
|
y: {
|
|
num: 10
|
|
num: 10
|
|
@@ -413,13 +353,13 @@ export default {
|
|
y: []
|
|
y: []
|
|
},
|
|
},
|
|
}
|
|
}
|
|
- this.form = form
|
|
|
|
this.$store.commit('SET_CHART_FORM', form)
|
|
this.$store.commit('SET_CHART_FORM', form)
|
|
},
|
|
},
|
|
- async handleEdit(value) {
|
|
|
|
- this.title = '编辑组'
|
|
|
|
- this.form2 = { ...value }
|
|
|
|
- this.dialogVisible = true
|
|
|
|
|
|
+ handleEdit(value,type) {
|
|
|
|
+ var title = '编辑组'
|
|
|
|
+ var form = { ...value }
|
|
|
|
+ form.type = type
|
|
|
|
+ this.$refs.addAnalyseGroup.open(title,form)
|
|
},
|
|
},
|
|
getDataCountParams() {
|
|
getDataCountParams() {
|
|
let source = {
|
|
let source = {
|
|
@@ -463,26 +403,112 @@ export default {
|
|
},
|
|
},
|
|
async getDataCount() {
|
|
async getDataCount() {
|
|
if (this.reloadData) {
|
|
if (this.reloadData) {
|
|
- const { source, schema } = this.getDataCountParams()
|
|
|
|
- let params = {
|
|
|
|
- type: this.form.setting.type,
|
|
|
|
- schema: schema,
|
|
|
|
- source: source,
|
|
|
|
- patentKey: this.patentKey,
|
|
|
|
- projectId: this.projectId
|
|
|
|
|
|
+ var data = {}
|
|
|
|
+ var sign = false
|
|
|
|
+ var count = []
|
|
|
|
+ var dimensions = []
|
|
|
|
+ console.log(this.form)
|
|
|
|
+ if(this.form.schema.x.field && this.form.schema.y.field){
|
|
|
|
+ sign = true
|
|
|
|
+ dimensions = ['x','y']
|
|
|
|
+ }else{
|
|
|
|
+ sign = false
|
|
|
|
+ dimensions = ['x']
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (!this.form.setting.type) {
|
|
|
|
+ if(sign){
|
|
|
|
+ this.form.setting.type = 2
|
|
|
|
+ }else{
|
|
|
|
+ this.form.setting.type = 1
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ var chartType = this.$constants.chartType.find(item=>{
|
|
|
|
+ return item.value == this.form.setting.type
|
|
|
|
+ }).type
|
|
|
|
+ if(sign && chartType == 1){
|
|
|
|
+ this.form.setting.type = 2
|
|
|
|
+ }else if(!sign && chartType == 2){
|
|
|
|
+ this.form.setting.type = 1
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ dimensions.forEach(dimension=>{
|
|
|
|
+ var form = this.form
|
|
|
|
+ var obj = form.schema[dimension]
|
|
|
|
+ if(obj.filedKind == 0){
|
|
|
|
+ count.push(
|
|
|
|
+ {
|
|
|
|
+ field:'field',
|
|
|
|
+ fieldId:form.schema[dimension].field,
|
|
|
|
+ topN: form.schema[dimension].num,
|
|
|
|
+ values:this.selected[dimension]
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ }else if(form.schema[dimension].type == 'DateTime'){
|
|
|
|
+ count.push(
|
|
|
|
+ {
|
|
|
|
+ field:form.schema[dimension].field,
|
|
|
|
+ topN: form.schema[dimension].num,
|
|
|
|
+ format:form.schema[dimension].expand,
|
|
|
|
+ values:this.selected[dimension]
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ }else{
|
|
|
|
+ if(['classify'].includes(form.schema[dimension].groupBy)){
|
|
|
|
+ count.push(
|
|
|
|
+ {
|
|
|
|
+ field:form.schema[dimension].expand,
|
|
|
|
+ topN: form.schema[dimension].num,
|
|
|
|
+ values:this.selected[dimension]
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ }else{
|
|
|
|
+ count.push(
|
|
|
|
+ {
|
|
|
|
+ field:form.schema[dimension].field,
|
|
|
|
+ topN: form.schema[dimension].num,
|
|
|
|
+ values:this.selected[dimension]
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ var params = {
|
|
|
|
+ ...this.form.search,
|
|
|
|
+ countVOS:count
|
|
}
|
|
}
|
|
- this.loading = true
|
|
|
|
- try {
|
|
|
|
- const response = await this.$api.getDataCount(params)
|
|
|
|
- this.$store.commit('SET_DATA_COUNT', response.data)
|
|
|
|
- this.refreshChart()
|
|
|
|
- this.$store.commit('SET_RELOAD_DATA', false)
|
|
|
|
- this.loading = false
|
|
|
|
- this.showChart = true
|
|
|
|
|
|
+ try{
|
|
|
|
+ const response = await this.$api.esCountAnalysis(params)
|
|
|
|
+ if(sign){
|
|
|
|
+ var res = Object.keys(response.data.analyseMap)
|
|
|
|
+ for(var i = 0;i<res.length;i++){
|
|
|
|
+ // var x = this.form.source.x[i]
|
|
|
|
+ // data[x.name] = {}
|
|
|
|
+ // for(var j = 0;j<this.form.source.y.length;j++){
|
|
|
|
+ // data[x.name][this.form.source.y[j].name] = this.form.source.y[j].number
|
|
|
|
+ // }
|
|
|
|
+ var analyseMapData = response.data.analyseMap[res[i]]
|
|
|
|
+ var obj = {}
|
|
|
|
+ for(var j =0 ;j<analyseMapData.length;j++){
|
|
|
|
+ obj[analyseMapData[j].name] = analyseMapData[j].number
|
|
|
|
+ }
|
|
|
|
+ data[res[i]] = obj
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ for(var i = 0;i<response.data.detailDTOS.length;i++){
|
|
|
|
+ data[response.data.detailDTOS[i].name] = response.data.detailDTOS[i].number
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
} catch (e) {
|
|
} catch (e) {
|
|
- this.loading = false
|
|
|
|
- this.showChart = false
|
|
|
|
|
|
+ data = []
|
|
}
|
|
}
|
|
|
|
+ this.$store.commit('SET_DATA_COUNT', data)
|
|
|
|
+ this.refreshChart()
|
|
|
|
+ this.$store.commit('SET_RELOAD_DATA', false)
|
|
|
|
+ this.showChart = true
|
|
}
|
|
}
|
|
},
|
|
},
|
|
getTreeAllNode(dimension) {
|
|
getTreeAllNode(dimension) {
|
|
@@ -518,7 +544,7 @@ export default {
|
|
})
|
|
})
|
|
return name.join('/')
|
|
return name.join('/')
|
|
},
|
|
},
|
|
- getExportParams() {
|
|
|
|
|
|
+ getExportParams() {
|
|
const xAxis = getXAxisName(this.patentField, this.form.schema.x.field, this.form.schema.x.expand)
|
|
const xAxis = getXAxisName(this.patentField, this.form.schema.x.field, this.form.schema.x.expand)
|
|
let type = this.form.schema.y.field ? 2 : 1
|
|
let type = this.form.schema.y.field ? 2 : 1
|
|
type = this.form.setting.type === 21 ? 3 : type
|
|
type = this.form.setting.type === 21 ? 3 : type
|
|
@@ -572,14 +598,55 @@ export default {
|
|
return { count, type, xAxis }
|
|
return { count, type, xAxis }
|
|
},
|
|
},
|
|
async handleExport() {
|
|
async handleExport() {
|
|
- this.loadingBtn3 = true
|
|
|
|
- const { count, type, xAxis } = this.getExportParams()
|
|
|
|
- this.$api.exportCustomItem(count, type, xAxis).then(response => {
|
|
|
|
- downLoad(response, moment().format('YYYYMMDDHHmmss') + '.xls')
|
|
|
|
- this.loadingBtn3 = false
|
|
|
|
- }).catch(error => {
|
|
|
|
- this.loadingBtn3 = false
|
|
|
|
- })
|
|
|
|
|
|
+ if(!this.form.schema.x.field && !this.form.schema.y.field){
|
|
|
|
+ this.$message.error('请先添加数据')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ var data = Object.keys(this.count)
|
|
|
|
+ var head = ''
|
|
|
|
+ var body = ''
|
|
|
|
+ if(this.form.schema.x.field && this.form.schema.y.field){
|
|
|
|
+ head = `<td>${this.form.schema.x.name}</td>`
|
|
|
|
+ for(var i = 0;i<this.selected.y.length;i++){
|
|
|
|
+ head = head + `<td>${this.selected.y[i]}</td>`
|
|
|
|
+ }
|
|
|
|
+ for(var i = 0;i<data.length;i++){
|
|
|
|
+ body = body + `<tr><td>${data[i]}</td>`
|
|
|
|
+ for(var j = 0;j<this.selected.y.length;j++){
|
|
|
|
+ body = body + `<td>${this.count[data[i]][this.selected.y[j]]}</td>`
|
|
|
|
+ }
|
|
|
|
+ body = body + '</tr>'
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ head = `<td>${this.form.schema.x.name}</td><td>数量</td>`
|
|
|
|
+ for(var i = 0;i<data.length;i++){
|
|
|
|
+ body = body + `<tr><td>${data[i]}</td><td>${this.count[data[i]]}</td></tr>`
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(!head && !body){
|
|
|
|
+ this.$message.error('导出失败,请重试')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ // return false
|
|
|
|
+ // Worksheet名
|
|
|
|
+ const worksheet = 'Sheet1'
|
|
|
|
+ const uri = 'data:application/vnd.ms-excel;base64,'
|
|
|
|
+
|
|
|
|
+ // 下载的表格模板数据
|
|
|
|
+ const template = `<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
|
|
|
+ xmlns:x="urn:schemas-microsoft-com:office:excel"
|
|
|
|
+ xmlns="http://www.w3.org/TR/REC-html40">
|
|
|
|
+ <head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
|
|
|
|
+ <x:Name>${worksheet}</x:Name>
|
|
|
|
+ <x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet>
|
|
|
|
+ </x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
|
|
|
|
+ </head><body><table><tr>${head}</tr>${body}</table></body></html>`
|
|
|
|
+ // 下载模板
|
|
|
|
+ let link = document.createElement('a')
|
|
|
|
+ link.setAttribute('href', uri + window.btoa(unescape(encodeURIComponent(template))))
|
|
|
|
+ link.setAttribute('download', moment().format('YYYYMMDDHHmmss') + '.xls')
|
|
|
|
+ link.click()
|
|
|
|
+ link = null
|
|
},
|
|
},
|
|
resetChartType() {
|
|
resetChartType() {
|
|
this.form.setting.type = null
|
|
this.form.setting.type = null
|
|
@@ -606,15 +673,14 @@ export default {
|
|
if (op && cg) {
|
|
if (op && cg) {
|
|
this.resetChartType()
|
|
this.resetChartType()
|
|
}
|
|
}
|
|
- if (!this.form.setting.type) {
|
|
|
|
- this.$message.error('请选择图表类型')
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- await this.getDataCount()
|
|
|
|
|
|
+
|
|
|
|
+ this.getDataCount()
|
|
this.refreshChart()
|
|
this.refreshChart()
|
|
this.showChart = true
|
|
this.showChart = true
|
|
|
|
+ this.handleClose()
|
|
},
|
|
},
|
|
async handleSelect(key) {
|
|
async handleSelect(key) {
|
|
|
|
+ this.id = ley
|
|
let source = {
|
|
let source = {
|
|
x: [],
|
|
x: [],
|
|
y: []
|
|
y: []
|
|
@@ -622,7 +688,7 @@ export default {
|
|
this.$store.commit('SET_RELOAD_DATA', true)
|
|
this.$store.commit('SET_RELOAD_DATA', true)
|
|
this.activeName = '1'
|
|
this.activeName = '1'
|
|
this.loading = true
|
|
this.loading = true
|
|
- const response = await this.$api.getCustomItem(key)
|
|
|
|
|
|
+ const response = await this.$api.queryAnalyseDetail({id:key})
|
|
this.$store.commit('SET_CHART_FORM', JSON.parse(JSON.stringify(response.data)))
|
|
this.$store.commit('SET_CHART_FORM', JSON.parse(JSON.stringify(response.data)))
|
|
if (this.enable.indexOf(this.form.setting.type) === -1) {
|
|
if (this.enable.indexOf(this.form.setting.type) === -1) {
|
|
this.form.setting.config.line.enable = false
|
|
this.form.setting.config.line.enable = false
|
|
@@ -656,66 +722,12 @@ export default {
|
|
this.loading = false
|
|
this.loading = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- handleConfirm() {
|
|
|
|
- this.$refs.ruleForm.validate(async (valid) => {
|
|
|
|
- if (valid) {
|
|
|
|
- this.loadingBtn = true
|
|
|
|
- let form = JSON.parse(JSON.stringify(this.form2))
|
|
|
|
- for (let key in form.schema) {
|
|
|
|
- form.schema[key].field = form.schema[key].field || 0
|
|
|
|
- form.schema[key].expand = form.schema[key].expand || 0
|
|
|
|
- if (form.schema[key].type === 6) {
|
|
|
|
- form.source[key] = this.treeKey[key].map(item => { return { name: item, selected: true } })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- let response
|
|
|
|
- if (typeof form.parentId === 'string') {
|
|
|
|
- form.parentName = form.parentId
|
|
|
|
- form.parentId = undefined
|
|
|
|
- }
|
|
|
|
- if (form.type) {
|
|
|
|
- form.permissions = getFormPermissions(form)
|
|
|
|
- }
|
|
|
|
- if (!this.saveType && form.id) {
|
|
|
|
- response = await this.$api.editCustomItem(form)
|
|
|
|
- this.$message.success('编辑成功')
|
|
|
|
- } else {
|
|
|
|
- form.id = null
|
|
|
|
- response = await this.$api.addCustomItem(form)
|
|
|
|
- this.activeItem.push(response.data.parentId)
|
|
|
|
- this.$message.success('添加成功')
|
|
|
|
- if (form.type) {
|
|
|
|
- await this.handleSelect(response.data.uid)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (form.type) {
|
|
|
|
- this.chartTitle = response.data.name
|
|
|
|
- }
|
|
|
|
- await this.getTreeList()
|
|
|
|
- this.loadingBtn = false
|
|
|
|
- this.handleClose()
|
|
|
|
- } catch (e) {
|
|
|
|
- this.loadingBtn = false
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- // console.log('error submit!!');
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
-
|
|
|
|
-<style lang="scss">
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
.custom-analyse {
|
|
.custom-analyse {
|
|
- .custom-analyse-tabs {
|
|
|
|
- .el-tabs__header {
|
|
|
|
- margin-top: 35px !important;
|
|
|
|
- margin-left: 22px;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
.custom-analyse-chart-img-box {
|
|
.custom-analyse-chart-img-box {
|
|
background: #ffffff;
|
|
background: #ffffff;
|
|
}
|
|
}
|
|
@@ -727,6 +739,10 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.custom-analyse-options {
|
|
.custom-analyse-options {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
+ width: 100%;
|
|
padding: 20px;
|
|
padding: 20px;
|
|
.number {
|
|
.number {
|
|
padding-left: 10px;
|
|
padding-left: 10px;
|