Commit 71412585 authored by whlviolin's avatar whlviolin

update

parent b8450f21
<template>
<div class="index-container">
<div style="background:#e8f1f2">
<vab-breadcrumb class="hidden-xs-only" :style="{'height':'30px', 'line-height':'30px', 'margin-left':'20px'}" />
</div>
<div style="width: 100%; height:100%;width: 100%;height: 100%;display: flex;flex-direction: row;">
<div class="sel-algo" style="width: 240px;border-right: 3px solid #d7d7d754;">
<div class="title">
<span style="margin-left: 14px;">算法列表 - {{project.fileName}}</span>
</div>
<div class="body">
<div v-for="item in algos">
<div class="entry" style="height: 30px;line-height:30px;display: flex;justify-content: space-between;"
@click="item.expand=!item.expand">
<span style="margin-left:15px;"><span style="margin-right:10px"><i
:class="item.icon"></i></span>{{item.name}}</span>
<div style="margin-right:5px;"><i :class="item.expand?'el-icon-caret-bottom':'el-icon-caret-right'"></i>
</div>
</div>
<div v-show="item.expand" style="width: 100%; line-height:16px;min-height:50px">
<template v-for="ch in item.child">
<div class="algo-item" style="font-size:13px;height:26px; line-height:26px;" @click="useAlgo(ch)"
:class="ch.id == selectAlgo.id?'active-item':''">
<span style="margin-left:38px">{{ch.name}}</span>
</div>
</template>
</div>
</div>
</div>
</div>
<div style="flex: 1; display: flex; flex-direction: row; overflow: auto;" v-if="selectAlgo.id && !hasResult">
<div v-if="selectAlgo.key != 'AHPSimple'" class="sel-args" style="width: 30%;border-right: 3px solid #d7d7d754;">
<div class="title" >
<span style="margin-left: 14px;">选择变量</span>
</div>
<div class="body" >
<!-- 调用组件 -->
<draggable v-model="args" v-bind="{sort: false}" :group="{ name:'person', pull: true, put:false }"
:clone="cloneItem">
<div v-for="item in args">
<div class="entry" style="height: 30px;line-height:30px;display: flex;justify-content: space-between;">
<span style="margin-left:15px;"><span style="margin-right:10px"><i
:class="item.icon"></i></span>{{item.name}}</span>
</div>
</div>
</draggable>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;overflow: auto;" v-if="selectAlgo.key == 'AHPSimple'">
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="margin:50px;">
<el-table
border
height="100%"
:data=AHPSimpletableData
:style="{'width': '100%'}">
<template v-for="item in AHPSimpleHeader">
<el-table-column
:prop="item"
align="center"
:label="item"
:sortable="true"
min-width="200">
</el-table-column>
</template>
</el-table>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;overflow:auto;overflow-scrolling: inherit" v-else-if="selectAlgo.key == 'DEA'"> <!-- 这是包络分析定制的参数 -->
<div style="height:3%;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:7%;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 87%; flex: 1;">
<div style="width: 100%; height:100%; display: flex;flex-direction: column;">
<div style="height:5%;line-height:40px;margin-left: 20px;">放入投入指标 [定量] 变量(变量数≥1)</div>
<div style="width: 95%; height: 27%; overflow: scroll;border:1px dashed #cdcdcd;margin-top: 8px;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args1" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args1" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry1(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:5%;line-height:40px;margin-left: 20px;">放入产出指标 [定量] 变量(变量数≥1)</div>
<div style="width: 95%;height: 27%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-top: 8px;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args2" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args2" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry2(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:5%;line-height:40px;margin-left: 20px;">放入索引项 [定类] 变量(变量数≤1)</div>
<div style="width: 95%;height: 10%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-top: 8px;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args3" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args3" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry3(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height: 5%; margin-top: 8px;">
<span style="margin-left: 25px;">DEA类型</span>
<span style="margin-left: 15px;"><el-select v-model="chooseDEA" clearable placeholder="请选择">
<el-option
v-for="item in DEAList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
</div>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-else-if="selectAlgo.key == 'TOPSIS'"> <!-- 这是包络分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="width: 100%; height:100%; display: flex;flex-direction: column;">
<div style="height:40px;line-height:40px;margin-left: 20px;">放入正向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 95%; height: 33%; overflow: scroll;border:1px dashed #cdcdcd;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args1" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args1" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry1(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:40px;line-height:40px;margin-left: 20px;">放入负向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 95%;height: 30%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args2" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args2" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry2(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:30px;line-height:40px;margin-left: 20px;">放入 [定类] 变量(变量数≤1)</div>
<div style="width: 95%;height: 10%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args3" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args3" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry3(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div >
<span style="margin-left: 25px;">变量权重</span>
<span style="margin-left: 15px;"><el-select v-model="chooseVariableWeight" clearable placeholder="请选择">
<el-option
v-for="item in variableWeightList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
</div>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-else-if="selectAlgo.key == 'RSR'"> <!-- 这是包络分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="width: 100%; height:100%; display: flex;flex-direction: column;">
<div style="height:40px;line-height:40px;margin-left: 20px;">放入正向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 100%; height:100%; ">
<div style="width: 95%; height: 33%; overflow: scroll;border:1px dashed #cdcdcd;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args1" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args1" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry1(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:40px;line-height:40px;margin-left: 20px;">放入负向指标 [定量] 变量(正向指标+负向指标≥2)</div>
<div style="width: 95%;height: 30%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args2" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args2" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry2(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="height:30px;line-height:40px;margin-left: 20px;">放入索引 [定类] 变量(变量数≤1)</div>
<div style="width: 95%;height: 10%; ;border:1px dashed #cdcdcd;overflow-y: auto;margin-left: 20px;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args3" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args3" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry3(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
<div style="margin-left: 20px;height:35px;">
<span>编秩方法</span>
<span style="margin-left: 15px;"><el-select v-model="chooseRankingMethod" clearable placeholder="请选择">
<el-option
v-for="item in rsrRankingMethodList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
<span style="margin-left: 25px;">分档数量</span>
<span style="margin-left: 15px;"><el-select v-model="chooseQuantitiesCategory" clearable placeholder="请选择">
<el-option
v-for="item in rsrQuantitiesCategories"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
<span style="margin-left: 25px;">变量权重</span>
<span style="margin-left: 15px;"><el-select v-model="chooseRSRVariableWeight" clearable placeholder="请选择">
<el-option
v-for="item in RSRVariableWeightList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</span>
</div>
</div>
</div>
</div>
</div>
<div style="width:100%;display: flex; flex-direction: column;" v-else> <!-- 这是相关性分析定制的参数 -->
<div style="height:41px;line-height:41px; font-size:16px;font-weight:600">
<span style="margin-left:30px">{{selectAlgo.name}}</span>
</div>
<div style="height:50px;line-height:50px;margin-bottom:20px;">
<span style="margin-left:20px">{{selectAlgo.desc}}</span>
</div>
<div style="height: 100%; flex: 1;">
<div style="height: 30px; line-height: 30px;">
<span style="margin-left:25px">放入变量</span>
</div>
<div style="width: 100%; height:100%; display: flex;flex-direction: row;justify-content: center;">
<div style="width: 95%; height:77%;border:1px dashed #cdcdcd;margin-left: 20px;overflow-y: auto;position: relative;">
<draggable class="mdc_right" :group="{name:'person'}" v-model="choose_args" @start="dragItem"
@add="addItem">
<div v-for="(item,index) in choose_args" v-bind:key="index" style="display: flex;position: relative;">
<div><span style="margin-left:20px">{{item.name}}</span></div>
<div class="del-entry" style="position: absolute;right: 10px;" @click="delEntry(item)"><i class="el-icon-circle-close"></i></div>
</div>
</draggable>
</div>
</div>
</div>
</div>
</div>
<div style="width:100%;height:100%;display:flex;flex-direction: column;">
<div style="height:56px;border-bottom:1px solid #e1e1e1c4;">
<div style="display: flex; flex-direction: row;">
<template v-for="item in tabHead" >
<div class="tab-entry" :class="item.key == activateTab.key?'active-entry':''" @click="choseTab(item)">
<span>{{item.title}}</span>
</div>
</template>
</div>
</div>
<component :is="activateTab.component"></component>
</div>
<div style="flex: 1;" v-if="hasResult">
<component :is="selectAlgo.component" :algoName="selectAlgo.name" :loading="loading" :algoRes="algoRes" :algoAllHeader="algoAllHeader"/>
</div>
</div>
</div>
</template>
<script>
import {
runAlgo, getDataHeader, runDEAAlgo, readFile, getTOPSISList, getRSRList, getDEAList, getAHPList, createAnalysisResult, getAnalysisResult
} from '@/api/data'
import VabChart from '@/plugins/echarts'
import draggable from 'vuedraggable'
import VueMarkdown from 'vue-markdown'
import uploadForm from "mockjs";
import myData from "@/views/algorithmModel/components/myData.vue";
import sysAllData from "@/views/algorithmModel/components/sysAllData.vue";
export default {
name: 'Index',
components: {
VabChart,
draggable,
myData,
sysAllData,
VueMarkdown
},
data() {
return {
hasResult: false,
loading:false,
algoRes: {},
selectAlgo: {},
algoAllHeader:[],
project: {},
AHPSimpleHeader:[],
AHPSimpletableData:[],
chooseRankingMethod: '非整秩方法',
chooseVariableWeight: '熵权法',
chooseQuantitiesCategory: '3',
rankingMethodList:[{id:'no_integer_rank',name:'非整秩方法'}],//编秩方法
quantitiesCategories:[{id:'3',name:'3挡'}],//分档数量
variableWeightList:[{id:'entropy_method',name:'熵权法'}],//变量权重
chooseRSRVariableWeight:'熵权法',
RSRVariableWeightList:[{id:'entropy_method',name:'熵权法'},{id:'no_weight',name:'不设置权重'},{id:'custom_weight',name:'自定义权重'}],//变量权重
rsrRankingMethodList:[{id:'integer_rank',name:'整秩方法'},{id:'no_integer_rank',name:'非整秩方法'}],//编秩方法
rsrQuantitiesCategories:[{id:'3',name:'3档'},{id:'4',name:'4档'},{id:'5',name:'5档'}],//分档数量
chooseDEA:'BBC',
DEAList:[{id:'bbc',name:'BBC'},{id:'ccr',name:'CCR'}],
choose_args: [],
choose_args1: [],
choose_args2: [],
choose_args3: [],
activateTab: {
"key": "myData",
"component": "my-data"
},
tabHead: [
{
"title": "算法描述",
"key": "myData",
"component": "my-data"
},
{
"title": "算法示例",
"key": "dataSource",
"component": "sysAllData"
}
],
args: [{
"id": "1",
"name": "时间",
"key": "time",
"type": ""
},
{
"id": "2",
"name": "区域",
"key": "address",
"type": ""
},
{
"id": "3",
"name": "总人口(万人)",
"key": "total",
"type": ""
},
{
"id": "4",
"name": "男性人口(万人)",
"key": "man_total",
"type": ""
},
{
"id": "5",
"name": "女性人口(万人)",
"key": "woman_total",
"type": ""
}
],
algos: [
{
"id": "2",
"name": "综合评价",
"key": "dea",
"icon": "iconfont icon-database-set",
"expand": false,
"child": [{
"id": '21',
"name": "数据包络分析(DEA)",
"key": "DEA",
"component": "dea"
},
{
"id": '22',
"name": "层次分析法(AHP简化版)",
"key": "AHPSimple",
"component": "ahpsimple"
},
{
"id": '23',
"name": "优劣解距离法(TOPSIS)",
"key": "TOPSIS",
"component": "topsis"
},
{
"id": '24',
"name": "秩和比综合评价法(RSR)",
"key": "RSR",
"component": "rsr"
},
]
},
{
"id": "3",
"name": "相关性分析",
"key": "deal",
"icon": "iconfont icon-jiegou",
"expand": false,
"child": [{
"id": '31',
"name": "Pearson相关性分析",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '32',
"name": "Spearman相关性分析",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "spearman",
"component": "res1"
},
{
"id": '33',
"name": "Kendall一致性检验",
"desc": "用于分析服从正态分布的定量变量相关性。",
"key": "deal1",
"algo": "kendall",
"component": "res1"
}
]
},
{
"id": "1",
"name": "数据处理",
"key": "deal",
"icon": "iconfont icon-people-network-full",
"expand": false,
"child": [{
"id": '11',
"name": "数据标签",
"key": "deal1"
},
{
"id": '12',
"name": "数据编码",
"key": "deal1"
},
{
"id": '13',
"name": "异常值处理",
"key": "deal1"
},
{
"id": '14',
"name": "缺失值处理",
"key": "deal1"
}, {
"id": '15',
"name": "数据变换",
"key": "deal1"
}
]
},
{
"id": "4",
"name": "数据预处理",
"key": "deal2",
"icon": "iconfont icon--_shujuyuchuli",
"expand": false,
"child": [{
"id": '41',
"name": "特征提取",
"desc": "特征提取",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '42',
"name": "归一化",
"desc": "归一化",
"key": "deal1",
"algo": "spearman",
"component": "res1"
},
{
"id": '43',
"name": "描述统计",
"desc": "描述统计",
"key": "deal1",
"algo": "kendall",
"component": "res1"
}
]
},
{
"id": "5",
"name": "回归模型",
"key": "deal2",
"icon": "iconfont icon-xianxinghuigui",
"expand": false,
"child": [
{
"id": '51',
"name": "Lasso回归",
"desc": "Lasso回归",
"key": "Lasso",
"algo": "pearson",
"component": "lasso"
},
{
"id": '52',
"name": "线性回归(最小二乘法)",
"desc": "线性回归(最小二乘法)",
"key": "ols",
"algo": "pearson",
"component": "ols"
},
]
},
{
"id": "6",
"name": "分类模型",
"key": "deal2",
"icon": "iconfont icon-fenlei3",
"expand": false,
"child": [{
"id": '61',
"name": "标识对象所属的类别",
"desc": "标识对象所属的类别",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "7",
"name": "聚类算法",
"key": "deal2",
"icon": "iconfont icon-julei",
"expand": false,
"child": [{
"id": '71',
"name": "自动将相似对象归为一组",
"desc": "自动将相似对象归为一组",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "8",
"name": "降维方法",
"key": "deal2",
"icon": "iconfont icon--_shujujiangwei",
"expand": false,
"child": [{
"id": '81',
"name": "减少要考虑的随机变量的数量",
"desc": "减少要考虑的随机变量的数量",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "9",
"name": "统计检验",
"key": "deal2",
"icon": "iconfont icon-tongji2",
"expand": false,
"child": [{
"id": '91',
"name": "t检验",
"desc": "t检验",
"key": "deal1",
"algo": "pearson",
"component": "res1"
},
{
"id": '92',
"name": "正态检验",
"desc": "正态检验",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "10",
"name": "关联分析",
"key": "deal2",
"icon": "iconfont icon-guanlianguize",
"expand": false,
"child": [{
"id": '101',
"name": "用于从数据中挖掘出潜在的关联关系",
"desc": "用于从数据中挖掘出潜在的关联关系",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "11",
"name": "时间序列分析",
"key": "deal2",
"icon": "iconfont icon-guanlian1",
"expand": false,
"child": [{
"id": '111',
"name": "针对时序序列数据的分析预测",
"desc": "针对时序序列数据的分析预测",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "12",
"name": "综合评价",
"key": "deal2",
"icon": "iconfont icon-tongji",
"expand": false,
"child": [{
"id": '121',
"name": "运用多个指标对多个参评单位进行评价的方法",
"desc": "运用多个指标对多个参评单位进行评价的方法",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "13",
"name": "图表分析",
"key": "deal2",
"icon": "iconfont icon-24gf-chartPie",
"expand": false,
"child": [{
"id": '131',
"name": "对数据和结果的可视化分析",
"desc": "对数据和结果的可视化分析",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
},
{
"id": "14",
"name": "领域分析",
"key": "deal2",
"icon": "iconfont icon-icon_xinyong_xianxing_jijin-222",
"expand": false,
"child": [{
"id": '141',
"name": "领域算法分析",
"desc": "领域算法分析",
"key": "deal1",
"algo": "pearson",
"component": "res1"
}
]
}
],
analysisResult:[],
}
},
mounted() {
//this.initdata();
//this.getAnalysisResult();
},
methods: {
uploadForm,
choseTab(item) {
this.activateTab = item;
},
initdata() {
this.project = this.$route.query;
console.log(this.project)
this.getDataInfo()
},
getDataInfo() {
this.args = []
let params = {
"fId": this.project.fId,
"name": this.project.name
}
readFile(params).then(res => {
console.log(res)
this.AHPSimpleHeader = res.data.header;
this.AHPSimpletableData = res.data.data;
}).catch(err => {
console.log(err)
})
getDataHeader(params).then(res => {
let temp = res.data.header;
this.algoAllHeader = temp
for (let entry in temp) {
let obj = {
"name": temp[entry]
}
this.args.push(obj)
}
}).catch(err => {
console.log(err)
})
},
createAnalysisResult(selectAlgo,algoRes){
let args = this.choose_args1.concat(this.choose_args2).concat(this.choose_args3)
let names = selectAlgo.name
args.forEach(function(item) {
let name = item.name;
names = names +"_" + name;
});
let params = {
"name": names,
"userId": '',
"type": selectAlgo.component,
"result": algoRes
}
createAnalysisResult(params).then(res => {
this.getAnalysisResult()
}).catch(err => {
console.log(err)
})
},
getAnalysisResult(){
getAnalysisResult().then(res => {
this.hasAnalysisResult = true
this.analysisResult = res.data;
}).catch(err => {
console.log(err)
})
},
useAlgo(algo) {
console.log("选择算法")
console.log(algo)
this.selectAlgo = algo;
this.hasResult = false;
},
getAnalysisResultDetail(item){
this.hasResult = true;
this.selectAlgo={
"name": item.name,
"component": item.type
}
this.loading=true
this.algoRes = item.result;
},
runCommon() {
let params = {
"name": this.project.fileName,
"fId": this.project.fId,
"algo": this.selectAlgo.algo,
"ar": JSON.stringify(this.choose_args)
}
runAlgo(params).then(res => {
console.log("算法执行结果")
console.log(res)
this.hasResult = true
this.algoRes = JSON.parse(res.data.res);
}).catch(err => {
console.log(err)
})
return this.algoRes
},
runDEA() {
//this.choose_args1 = {aa:'aaa'}
// let params = {
// "name": this.project.name,
// "fId": this.project.fId,
// "args_x": JSON.stringify(this.choose_args1),
// "args_y": JSON.stringify(this.choose_args2),
// "args_z": JSON.stringify(this.choose_args3),
// }
let params = {
'type':this.chooseDEA
}
getDEAList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes)
}).catch(err => {
console.log(err)
})
},
runAHPSimple(){
this.args = []
let params = {
"fileName": this.project.fileName
}
getAHPList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes)
})
},
runTOPSIS(){
let index = this.choose_args3
if(index.length>0)
index = index[0]['name'].replace("\ufeff", "");
else
index = ""
let params = {
"fileName": this.project.fileName,
"positive": this.getArrayObjectStrValue(this.choose_args1),
"negative": this.getArrayObjectStrValue(this.choose_args2),
"index":index
}
getTOPSISList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes)
})
},
runRSR(){
let index = this.choose_args3
if(index.length>0)
index = index[0]['name'].replace("\ufeff", "");
else
index = ""
let params = {
"fileName": this.project.fileName,
"positive": this.getArrayObjectStrValue(this.choose_args1),
"negative": this.getArrayObjectStrValue(this.choose_args2),
"index":index,
'weight_type':this.chooseRSRVariableWeight,
'rank_make_method':this.chooseRankingMethod,
'number_bins':this.chooseQuantitiesCategory
}
getRSRList(params).then(res => {
this.hasResult = true
this.algoRes = res.data;
this.createAnalysisResult(this.selectAlgo, this.algoRes,this.choose_args1,this.choose_args2,this.choose_args3)
})
},
run() {
if(this.selectAlgo.key == "DEA") {
this.runDEA();
} else if(this.selectAlgo.key == "AHPSimple"){
this.runAHPSimple();
} else if(this.selectAlgo.key == "TOPSIS"){
this.runTOPSIS();
}else if(this.selectAlgo.key == "RSR"){
this.runRSR();
}
else {
this.runCommon();
}
},
cloneItem: function (val) {
// 深复制一个节点
return JSON.parse(JSON.stringify(val))
},
dragItem: function (widget) {
console.log(widget);
},
addItem: function (widget) {
console.log(widget);
},
delEntry1(item) {
this.choose_args1 = this.choose_args1.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry2(item) {
this.choose_args2 = this.choose_args2.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry3(item) {
this.choose_args3 = this.choose_args3.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
delEntry(item) {
this.choose_args = this.choose_args.filter(i => {
return i.name != item.name
})
this.args.push(item)
},
getArrayObjectStrValue(myArray){
// 或使用forEach方法
let values = []
myArray.forEach(function(item) {
let name = item.name.replace("\ufeff", "");
values.push(name)
});
return JSON.stringify(values);
}
}
}
</script>
<style scoped>
.index-container {
height: 100%;
}
.result_list .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
/* padding-left: 20px; */
}
.sel-algo .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
/* padding-left: 20px; */
}
.sel-args .title {
width: 100%;
line-height: 40px;
height: 40px;
text-align: left;
font-size: 16px;
font-weight: 700;
border-bottom: 1px solid #e9e9e9;
}
.body .entry:hover {
cursor: pointer;
background: rgb(240, 255, 254);
}
.index-container {
height: 100%;
}
.tab-entry {
line-height:56px;
width:120px;
font-size:17px;
text-align: center;
}
.tab-entry:hover {
cursor: pointer;
color: #005766;
}
.active-entry {
color: #0078D4;
}
.algo-item:hover {
cursor: pointer;
background: rgb(246, 255, 254);
}
.active-item {
background: rgb(228, 228, 228);
}
.mdc_right {
position: absolute;
left: 0px;
right: 0px;
top: 0px;
bottom: 0px;
}
.mdc_right>div {
height: 28px;
line-height: 28px;
margin-top: 6px;
/* border: 1px solid #CCCCCC; */
cursor: move;
margin: 5px 20px;
}
.mdc_right>div:hover {
background: #e6e6e6;
/* box-shadow: 1px 2px 4px #CCCCCC; */
}
.mdc_right>div>span {
display: inline-block;
vertical-align: top;
}
.mdc_right>div>span>img {
height: 30px;
}
.del-entry:hover {
color: red;
cursor: pointer;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment