|
@@ -9,6 +9,7 @@
|
|
|
width="1200px"
|
|
|
top="3vh"
|
|
|
v-dialogDrag
|
|
|
+ class="smooth-edb-dialog"
|
|
|
>
|
|
|
<div slot="title" style="display: flex; align-items: center">
|
|
|
<img
|
|
@@ -163,7 +164,7 @@
|
|
|
<span class="li-tag">{{ list.tag }}</span>
|
|
|
<el-select v-model="list.target" v-loadMore="searchLoad" :filterable="!list.target" clearable
|
|
|
placeholder="请输入指标名称" style="width: 400px" @change="(val)=>{chooseTargetList(val,index)}"
|
|
|
- @clear="clearHandle(index)" remote :remote-method="searchTarget"
|
|
|
+ @clear="clearHandle(index)" remote :remote-method="getTarget"
|
|
|
@click.native="inputFocusHandle">
|
|
|
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
|
|
<el-option v-for="item in searchOptions" :key="item.EdbInfoId"
|
|
@@ -196,30 +197,38 @@
|
|
|
<el-form-item prop="targetName">
|
|
|
<el-input
|
|
|
v-model="targetList[index].targetName"
|
|
|
- style="width: 340px"
|
|
|
+ style="width: 240px"
|
|
|
placeholder="请输入指标名称"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="unit">
|
|
|
- <selectUnit
|
|
|
- v-model="targetList[index].unit"
|
|
|
- style="width: 340px"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
<el-form-item prop="menu">
|
|
|
<el-cascader v-if="isOpenSmooth"
|
|
|
v-model="targetList[index].menu"
|
|
|
:options="catalogArr"
|
|
|
:props="levelProps"
|
|
|
+ style="width: 200px"
|
|
|
clearable
|
|
|
placeholder="请选择指标目录"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item prop="unit">
|
|
|
+ <selectUnit
|
|
|
+ v-model="targetList[index].unit"
|
|
|
+ style="width: 160px"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="alphaValue">
|
|
|
+ <el-input
|
|
|
+ v-model.trim="targetList[index].alphaValue"
|
|
|
+ style="width: 180px"
|
|
|
+ placeholder="请输入alpha值"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
<el-form-item prop="frequency">
|
|
|
<el-select
|
|
|
v-model="targetList[index].frequency"
|
|
|
placeholder="请选择频度"
|
|
|
- style="width: 340px"
|
|
|
+ style="width: 180px"
|
|
|
clearable
|
|
|
>
|
|
|
<el-option
|
|
@@ -231,13 +240,7 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="alphaValue">
|
|
|
- <el-input
|
|
|
- v-model.trim="targetList[index].alphaValue"
|
|
|
- style="width: 340px"
|
|
|
- placeholder="请输入alpha值"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
+
|
|
|
</el-form>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -246,7 +249,7 @@
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
style="margin-right: 20px"
|
|
|
- @click="saveHandle"
|
|
|
+ @click="saveBtnClick"
|
|
|
:loading="loading"
|
|
|
>指数修匀计算</el-button
|
|
|
>
|
|
@@ -265,6 +268,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { dataBaseInterface } from '@/api/api.js';
|
|
|
+import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
|
|
|
import { formRules } from './util';
|
|
|
const tag_arr = [];
|
|
|
for(let i=0;i<26;i++) tag_arr.push(String.fromCharCode(65+i));
|
|
@@ -284,6 +288,10 @@ export default {
|
|
|
edb_id:'',
|
|
|
oldedb_id:''
|
|
|
}}
|
|
|
+ },
|
|
|
+ isPredict:{ //是不是预测指标
|
|
|
+ type:Boolean,
|
|
|
+ default:false,
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
@@ -314,6 +322,7 @@ export default {
|
|
|
|
|
|
tableData:[],
|
|
|
page_no:1,
|
|
|
+ haveMore:false,
|
|
|
tableColums:[
|
|
|
{
|
|
|
label: '指标ID',
|
|
@@ -391,17 +400,19 @@ export default {
|
|
|
if(!this.search_have_more) return;
|
|
|
this.searchApi(this.current_search,++this.search_page)
|
|
|
},
|
|
|
- searchApi(query,page=1){
|
|
|
- dataBaseInterface.targetSearchByPage({
|
|
|
+ async searchApi(query,page=1){
|
|
|
+ const params = {
|
|
|
KeyWord:query,
|
|
|
CurrentIndex: page,
|
|
|
- }).then(res => {
|
|
|
- if(res.Ret !== 200) return
|
|
|
- const { List,Paging } = res.Data;
|
|
|
- this.search_have_more = page < Paging.Pages;
|
|
|
- let arr = page === 1 ? List : this.searchOptions.concat(List);
|
|
|
- this.searchOptions = arr;
|
|
|
- })
|
|
|
+ }
|
|
|
+ const res = this.isPredict
|
|
|
+ ? await preDictEdbInterface.edbSearch(params)
|
|
|
+ : await dataBaseInterface.targetSearchByPage(params)
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ const { List,Paging } = res.Data;
|
|
|
+ this.search_have_more = page < Paging.Pages;
|
|
|
+ let arr = page === 1 ? List : this.searchOptions.concat(List);
|
|
|
+ this.searchOptions = arr;
|
|
|
},
|
|
|
/* 指标列表 */
|
|
|
getTarget(query) {
|
|
@@ -416,12 +427,12 @@ export default {
|
|
|
this.searchApi(this.current_search);
|
|
|
},
|
|
|
/* 获取目录结构 */
|
|
|
- getMenu() {
|
|
|
- dataBaseInterface.menuListV3().then((res) => {
|
|
|
- if (res.Ret === 200) {
|
|
|
- this.catalogArr = res.Data.AllNodes || [];
|
|
|
- }
|
|
|
- });
|
|
|
+ async getMenu() {
|
|
|
+ const res = this.isPredict
|
|
|
+ ? await preDictEdbInterface.classifyListV2()
|
|
|
+ : await dataBaseInterface.menuListV3()
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ this.catalogArr = res.Data.AllNodes || [];
|
|
|
},
|
|
|
/* 选择指标 */
|
|
|
chooseTarget(val) {
|
|
@@ -440,15 +451,11 @@ export default {
|
|
|
chooseTargetList(val,index){
|
|
|
if(val){
|
|
|
const obj = this.searchOptions.find(item => item.EdbInfoId === val);
|
|
|
- const {tag,target} = this.targetList[index]
|
|
|
- this.targetList[index] = {
|
|
|
- tag,target,
|
|
|
- targetName:`${obj.EdbName}指数修匀`,
|
|
|
- unit:obj.Unit,
|
|
|
- frequency:obj.Frequency,
|
|
|
- menu:obj.ClassifyId||'',
|
|
|
- alphaValue:obj.Formula||''
|
|
|
- }
|
|
|
+ this.targetList[index].targetName = `${obj.EdbName}指数修匀`
|
|
|
+ this.targetList[index].unit = obj.Unit
|
|
|
+ this.targetList[index].frequency = obj.Frequency
|
|
|
+ this.targetList[index].menu = obj.ClassifyId||''
|
|
|
+ this.targetList[index].alphaValue =obj.Formula||''
|
|
|
}
|
|
|
},
|
|
|
setDefaultOption(obj,type){
|
|
@@ -460,24 +467,25 @@ export default {
|
|
|
alphaValue:obj.Formula||''
|
|
|
}
|
|
|
},
|
|
|
- getDataList(){
|
|
|
- dataBaseInterface.targetList({
|
|
|
+ async getDataList(){
|
|
|
+ const params = {
|
|
|
PageSize: 10,
|
|
|
CurrentIndex: this.page_no,
|
|
|
EdbInfoId: this.select_target,
|
|
|
- }).then(res => {
|
|
|
- if(res.Ret === 200) {
|
|
|
- if(res.Data) {
|
|
|
- res.Data.Item.ModifyTime = res.Data.Item.ModifyTime.substr(0,10);
|
|
|
- this.tableData = [res.Data.Item] || [];
|
|
|
- this.haveMore = this.page_no < res.Data.Paging.Pages ? true : false;
|
|
|
- this.dataList = this.page_no === 1 ? (res.Data.Item.DataList || []) : this.dataList.concat(res.Data.Item.DataList);
|
|
|
- }else {
|
|
|
- this.tableData = [];
|
|
|
- this.dataList = [];
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ const res = this.isPredict
|
|
|
+ ? await preDictEdbInterface.edbDataInfo(params)
|
|
|
+ : await dataBaseInterface.targetList(params)
|
|
|
+ if(res.Ret!==200) return
|
|
|
+ if(res.Data){
|
|
|
+ res.Data.Item.ModifyTime = res.Data.Item.ModifyTime.substr(0,10);
|
|
|
+ this.tableData = [res.Data.Item] || [];
|
|
|
+ this.haveMore = this.page_no < res.Data.Paging.Pages ? true : false;
|
|
|
+ this.dataList = this.page_no === 1 ? (res.Data.Item.DataList || []) : this.dataList.concat(res.Data.Item.DataList);
|
|
|
+ }else{
|
|
|
+ this.tableData = [];
|
|
|
+ this.dataList = [];
|
|
|
+ }
|
|
|
},
|
|
|
handleSelectBtnClick(){
|
|
|
//计算指标打开弹窗,基础指标打开新页面
|
|
@@ -489,13 +497,28 @@ export default {
|
|
|
window.open(href,'_blank');
|
|
|
}
|
|
|
},
|
|
|
- scrollHandle(){},
|
|
|
- delTarget(){},
|
|
|
+ scrollHandle(e){
|
|
|
+ const dom = e.target
|
|
|
+ let scrollTop = dom.scrollTop; //滑入屏幕上方的高度
|
|
|
+ let windowHeitht = dom.clientHeight; //页面的高度
|
|
|
+ let scrollHeight = dom.scrollHeight; //整个div的高度
|
|
|
+ let total = scrollTop + windowHeitht
|
|
|
+ if(total >= scrollHeight && this.haveMore){
|
|
|
+ this.page_no ++;
|
|
|
+ this.getDataList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 删除已选指标 */
|
|
|
+ delTarget() {
|
|
|
+ this.tableData = [];
|
|
|
+ this.dataList = [];
|
|
|
+ this.select_target = '';
|
|
|
+ this.page_no = 1;
|
|
|
+ },
|
|
|
delTargetList(index){
|
|
|
this.targetList.splice(index, 1);
|
|
|
},
|
|
|
clearHandle(index){
|
|
|
- console.log('?clear',index)
|
|
|
const item = {...{tag:tag_arr[index],target:''},..._.cloneDeep(this.formData)}
|
|
|
this.targetList.splice(index,1,item)
|
|
|
},
|
|
@@ -514,6 +537,10 @@ export default {
|
|
|
const item = {...{tag:tag_arr[index+1],target:''},..._.cloneDeep(this.formData)}
|
|
|
this.targetList.push(item)
|
|
|
},
|
|
|
+ saveBtnClick(){
|
|
|
+ this.computedSource===1?this.saveHandle():this.saveListHandle()
|
|
|
+ },
|
|
|
+ //常规编辑/保存指标
|
|
|
async saveHandle(){
|
|
|
if(!this.select_target){
|
|
|
this.$message.warning('指标不能为空')
|
|
@@ -532,16 +559,85 @@ export default {
|
|
|
Formula:alphaValue,
|
|
|
FromEdbInfoId:this.select_target
|
|
|
}
|
|
|
- const res = this.operationForm.edb_id
|
|
|
- ? await dataBaseInterface.calculateTargetEdit({ ...params,EdbInfoId: this.operationForm.edb_id })
|
|
|
- : await dataBaseInterface.calculateTargetSave(params)
|
|
|
+
|
|
|
+ let res = null
|
|
|
+ if(this.isPredict){
|
|
|
+ let edit_params = { ...params,EdbInfoId: this.operationForm.edb_id }
|
|
|
+ res = await preDictEdbInterface.operateEdbSave(this.operationForm.edb_id ? edit_params : params)
|
|
|
+ }else{
|
|
|
+ res = this.operationForm.edb_id
|
|
|
+ ? await dataBaseInterface.calculateTargetEdit({ ...params,EdbInfoId: this.operationForm.edb_id })
|
|
|
+ : await dataBaseInterface.calculateTargetSave(params)
|
|
|
+ }
|
|
|
if(res.Ret!==200) return
|
|
|
this.$message.success(res.Msg)
|
|
|
this.operationForm.edb_id
|
|
|
? this.$emit('addCallBack','edit')
|
|
|
: this.$emit('addCallBack','add',{ code:res.Data.UniqueCode,id:res.Data.EdbInfoId,classifyId:params.ClassifyId });
|
|
|
this.init();
|
|
|
+ this.loading = false;
|
|
|
+
|
|
|
+ },
|
|
|
+ //批量添加指标
|
|
|
+ async saveListHandle(){
|
|
|
+ //判断是否都选择了指标
|
|
|
+ const targetCheck = this.targetList.filter(item=>item.target)
|
|
|
+ if(targetCheck.length!==this.targetList.length){
|
|
|
+ this.$message.warning('请选择指标')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //判断每一项form-rules
|
|
|
+ for(let i = 0;i<targetCheck.length;i++){
|
|
|
+ await this.$refs[`list_form_${i}`][0].validate();
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ const params = targetCheck.map(item=>{
|
|
|
+ return {
|
|
|
+ CalculateId: item.tag,
|
|
|
+ CalculateInfo: {
|
|
|
+ ClassifyId: item.menu,
|
|
|
+ EdbName: item.targetName,
|
|
|
+ Formula: item.alphaValue,
|
|
|
+ Frequency:item.frequency,
|
|
|
+ FromEdbInfoId: item.target,
|
|
|
+ Source:this.$route.path==='/database'?72:73,
|
|
|
+ Unit: item.unit
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ const res = this.$route.path==='/database'
|
|
|
+ ? await dataBaseInterface.batchCalculateTargetAdd(params)
|
|
|
+ : await preDictEdbInterface.batchCalculateTargetAdd(params)
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ const { Fail,Success } = res.Data;
|
|
|
+ if(Fail.length) {
|
|
|
+ let message = '';
|
|
|
+ Fail.forEach(item => {
|
|
|
+ message+=`${item.CalculateId}:${item.Msg}</br>`
|
|
|
+ })
|
|
|
|
|
|
+ this.$message({
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ this.dealFailHandle(Fail)
|
|
|
+ }else {
|
|
|
+ this.$message.success('添加成功');
|
|
|
+ this.init();
|
|
|
+ this.$emit('addCallBack','add',{ code:Success[0].UniqueCode,id:Success[0].EdbInfoId,classifyId:Success[0].ClassifyId});
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dealFailHandle(arr){
|
|
|
+ //从targetList中剔除成功的指标,重新赋予剩下的指标tag
|
|
|
+ const failTagArr = arr.map(_ =>_.CalculateId);
|
|
|
+ this.targetList = this.targetList.filter(_ => failTagArr.includes(_.tag));
|
|
|
+ this.targetList.forEach((item,index)=>{
|
|
|
+ item.tag = tag_arr[index]
|
|
|
+ })
|
|
|
+ this.loading = false;
|
|
|
},
|
|
|
cancelHandle(type) {
|
|
|
this.init();
|
|
@@ -553,6 +649,12 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
+.smooth-edb-dialog{
|
|
|
+ .el-dialog__body{
|
|
|
+ padding: 25px 25px 30px !important;
|
|
|
+ padding-bottom: 5px !important;
|
|
|
+ }
|
|
|
+}
|
|
|
.smooth-edb-dialog-wrap{
|
|
|
.el-cascader .el-input {
|
|
|
width: 340px;
|
|
@@ -618,5 +720,59 @@ export default {
|
|
|
color: #409EFF;
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
+ .batch-wrap{
|
|
|
+ padding:0 40px;
|
|
|
+ .target-ul {
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: space-between;
|
|
|
+ .target-li {
|
|
|
+ position: relative;
|
|
|
+ margin-bottom: 30px;
|
|
|
+ .li-tag {
|
|
|
+ font-size: 16px;
|
|
|
+ margin-right: 8px;
|
|
|
+ }
|
|
|
+ .del-tag {
|
|
|
+ position: absolute;
|
|
|
+ right: -30px;
|
|
|
+ top: 12px;
|
|
|
+ font-size: 16px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .target-date {
|
|
|
+ color: #5882ef;
|
|
|
+ position: absolute;
|
|
|
+ bottom: -25px;
|
|
|
+ left: 24px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .add-icon {
|
|
|
+ font-size: 16px;
|
|
|
+ color: #5882ef;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .form-ul {
|
|
|
+ padding-top: 20px;
|
|
|
+ margin-top: 20px;
|
|
|
+ border-top: 1px dashed #AAB4CC;
|
|
|
+ .form-li {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-bottom: 15px;
|
|
|
+ .el-cascader>.el-input{
|
|
|
+ width:100%;
|
|
|
+ }
|
|
|
+ .el-form-item{
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+ .li-tag{
|
|
|
+ margin-right: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
</style>
|