|
@@ -9,49 +9,50 @@
|
|
|
<div class="main">
|
|
|
|
|
|
<section class="main-top">
|
|
|
- <el-radio-group v-model="formData.edbFromSource" @change="initData">
|
|
|
- <el-radio :label="1">表格指标</el-radio>
|
|
|
- <el-radio :label="2">ETA指标&预测指标</el-radio>
|
|
|
- </el-radio-group>
|
|
|
-
|
|
|
- <template v-if="info.fromEdbKey===5">
|
|
|
- <el-divider direction="vertical" style="margin: 0 20px;"/>
|
|
|
-
|
|
|
- <el-radio-group
|
|
|
- v-model="formData.source"
|
|
|
- >
|
|
|
- <el-radio :label="1">累计值转月</el-radio>
|
|
|
- <el-radio :label="2">累计值转季值</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template v-else-if="info.fromEdbKey===62">
|
|
|
- <el-divider direction="vertical" style="margin: 0 20px;"/>
|
|
|
- <el-radio-group
|
|
|
- v-model="formData.source"
|
|
|
- >
|
|
|
- <el-radio :label="62">累计值</el-radio>
|
|
|
- <el-radio :label="63">年初至今累计值</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </template>
|
|
|
+
|
|
|
+ <template v-if="info.fromEdbKey===5">
|
|
|
+ <el-radio-group
|
|
|
+ v-model="formData.source"
|
|
|
+ @change="changeSource"
|
|
|
+ >
|
|
|
+ <el-radio :label="1">累计值转月</el-radio>
|
|
|
+ <el-radio :label="2">累计值转季值</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-else-if="info.fromEdbKey===62">
|
|
|
+ <el-divider direction="vertical" style="margin: 0 20px;"/>
|
|
|
+ <el-radio-group
|
|
|
+ v-model="formData.source"
|
|
|
+ @change="changeSource"
|
|
|
+ >
|
|
|
+ <el-radio :label="62">累计值</el-radio>
|
|
|
+ <el-radio :label="63">年初至今累计值</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </template>
|
|
|
|
|
|
<selectTarget
|
|
|
- v-show="formData.edbFromSource===2"
|
|
|
:defaultId="search_edb"
|
|
|
:defaultOpt="searchOptions"
|
|
|
ref="selectRef"
|
|
|
- @select="e => { selectEdbInfo = e ||null }"
|
|
|
+ @select="selectTargetHandle"
|
|
|
:filter="false"
|
|
|
style="margin: 20px 0"
|
|
|
/>
|
|
|
- </section>
|
|
|
|
|
|
- <tableEdbListSection
|
|
|
- v-if="formData.edbFromSource===1"
|
|
|
- />
|
|
|
+ <!-- 表格已存在的指标列表 -->
|
|
|
+ <div class="edb-list">
|
|
|
+ <el-tag
|
|
|
+ :effect="selectEdbInfo&&selectEdbInfo.EdbInfoId===item.EdbInfoId?'dark':'plain'"
|
|
|
+ v-for="(item,index) in edbArrFromTable"
|
|
|
+ :key="index"
|
|
|
+ @click="selectTableEdbHandle(item)"
|
|
|
+ >{{ item.ShowValue }}</el-tag>
|
|
|
+ </div>
|
|
|
+ </section>
|
|
|
|
|
|
- <edbDetailSection
|
|
|
- v-if="formData.edbFromSource===2"
|
|
|
+ <!-- 指标详情 -->
|
|
|
+ <edbDetailSection
|
|
|
:tableData="selectEdbInfo?[selectEdbInfo]:[]"
|
|
|
/>
|
|
|
|
|
@@ -154,18 +155,24 @@
|
|
|
</section>
|
|
|
|
|
|
<!-- 计算结果 -->
|
|
|
- <section class="result-section" v-if="calculateResult.List">
|
|
|
+ <section class="result-section" v-if="showResult">
|
|
|
<label>计算结果:</label>
|
|
|
- <ul class="data-cont">
|
|
|
- <li v-for="(item,index) in result.List" :key="index" :class="[{'choose': item.DataTime===result.Date},'data-li']">
|
|
|
+ <ul class="data-cont" v-if="calculateShowData.length">
|
|
|
+ <li
|
|
|
+ v-for="(item,index) in calculateShowData"
|
|
|
+ :key="index"
|
|
|
+ :class="[{'choose': item.DataTime===chooseItem.Date || (!chooseItem.Date&&index===0)},'data-li']"
|
|
|
+ >
|
|
|
<span>{{item.DataTime}}</span>
|
|
|
<span style="min-width:150px">{{item.Value}}</span>
|
|
|
</li>
|
|
|
</ul>
|
|
|
+
|
|
|
+ <tableNoData text="无对应的数据" size="mini" v-else/>
|
|
|
</section>
|
|
|
|
|
|
<section class="bot">
|
|
|
- <el-button type="primary" @click="insertData" v-if="chooseItem">插入值</el-button>
|
|
|
+ <el-button type="primary" @click="insertData" v-if="showResult">插入值</el-button>
|
|
|
<el-button type="primary" @click="calculateHandle" v-else>计算</el-button>
|
|
|
<el-button type="primary" plain @click="cancelHandle">取消</el-button>
|
|
|
|
|
@@ -173,15 +180,16 @@
|
|
|
|
|
|
</div>
|
|
|
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import { dataBaseInterface } from '@/api/api.js';
|
|
|
+import * as sheetInterface from "@/api/modules/sheetApi.js";
|
|
|
+import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
|
|
|
import { resetDialogCellStyle } from "../common/customTable";
|
|
|
import selectTarget from '@/views/chartRelevance_manage/components/selectTarget.vue';
|
|
|
import edbDetailSection from './edbDetailSection.vue';
|
|
|
-import tableEdbListSection from './tableEdbListSection.vue';
|
|
|
import { formRules } from '@/views/dataEntry_manage/databaseComponents/util';
|
|
|
export default {
|
|
|
props: {
|
|
@@ -192,17 +200,40 @@ export default {
|
|
|
type: Object
|
|
|
}
|
|
|
},
|
|
|
- components: { selectTarget,edbDetailSection,tableEdbListSection },
|
|
|
+ components: { selectTarget,edbDetailSection },
|
|
|
+ computed: {
|
|
|
+ edbArrFromTable() {
|
|
|
+ return this.$parent.config.data.flat().filter(_ =>_.DataType === 2)
|
|
|
+ },
|
|
|
+ calculateShowData() {
|
|
|
+ if(this.chooseItem.Date) {
|
|
|
+ let index = this.calculateAllResult.findIndex(_ => _.DataTime===this.chooseItem.Date)
|
|
|
+ if(index === -1) return []
|
|
|
+
|
|
|
+ return this.calculateAllResult.slice(index-2,index+2);
|
|
|
+
|
|
|
+ }else {
|
|
|
+ return this.calculateAllResult.slice(0,5);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
watch: {
|
|
|
isShow(nval) {
|
|
|
- const { source } = this.info
|
|
|
+ if(!nval) return
|
|
|
+ console.log(this.info)
|
|
|
+ const { source,formStr,EdbInfoId } = this.info;
|
|
|
+
|
|
|
this.formData.source = source;
|
|
|
+ //回显
|
|
|
+ if(EdbInfoId) {
|
|
|
+ this.formData = { ...JSON.parse(formStr) }
|
|
|
+ this.selectTableEdbHandle({EdbInfoId})
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
formData: {
|
|
|
- edbFromSource: 1,
|
|
|
source: this.info.fromEdbKey,
|
|
|
nNum: 1,
|
|
|
moveType: 1,
|
|
@@ -210,11 +241,15 @@ export default {
|
|
|
moveVal: '',
|
|
|
calendarType: '公历',
|
|
|
valueType: '期末值',
|
|
|
+ alphaValue: 0,
|
|
|
},
|
|
|
formRules,
|
|
|
|
|
|
- calculateResult: {},
|
|
|
- chooseItem: null,
|
|
|
+ showResult: false,
|
|
|
+ calculateAllResult: [], //计算全部数据
|
|
|
+ chooseItem: {
|
|
|
+ Date: ''
|
|
|
+ },//要插入表格的项
|
|
|
|
|
|
search_edb: '',
|
|
|
searchOptions: [],
|
|
@@ -241,28 +276,118 @@ export default {
|
|
|
|
|
|
},
|
|
|
methods:{
|
|
|
- /* 计算 */
|
|
|
+ /* 计算结果 */
|
|
|
async calculateHandle() {
|
|
|
await this.$refs.form.validate();
|
|
|
+
|
|
|
+ const {
|
|
|
+ source,
|
|
|
+ nNum,
|
|
|
+ moveType,
|
|
|
+ moveUnit,
|
|
|
+ calendarType,
|
|
|
+ } = this.formData;
|
|
|
+
|
|
|
+ const valueMap = {
|
|
|
+ 22: 'moveVal',
|
|
|
+ 51: 'valueType',
|
|
|
+ 'alpha': 'alphaValue'
|
|
|
+ }
|
|
|
+
|
|
|
+ let Date = this.$parent.selectCell.DataType === 1 ? this.$parent.selectCell.ShowValue : ''
|
|
|
+
|
|
|
+ const res = await sheetInterface.getMixedCalculateData({
|
|
|
+ Date,
|
|
|
+ Source: source,
|
|
|
+ Formula: valueMap[this.info.fromEdbKey] ? String(this.formData[valueMap[this.info.fromEdbKey]]) : String(nNum),
|
|
|
+ EdbInfoId: this.selectEdbInfo.EdbInfoId,
|
|
|
+ MoveFrequency: moveUnit,
|
|
|
+ MoveType: moveType,
|
|
|
+ Calendar: calendarType
|
|
|
+ })
|
|
|
+ if(res.Ret!==200) return
|
|
|
+
|
|
|
+ this.showResult = true;
|
|
|
+ this.calculateAllResult = res.Data || [];
|
|
|
+
|
|
|
+ // if(!this.result.Date && Date) return this.$message.warning('所选指标所选日期无值')
|
|
|
+ this.chooseItem = {
|
|
|
+ Date,
|
|
|
+ EdbInfoId: this.selectEdbInfo.EdbInfoId,
|
|
|
+ insertValue: Date ? this.calculateAllResult.find(_ => _.DataTime===Date).Value : this.calculateAllResult[0].Value,
|
|
|
+ str: JSON.stringify(this.formData)
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
|
|
|
/* 插入值 */
|
|
|
insertData() {
|
|
|
- if(this.$parent.selectCell.DataType !== 1){
|
|
|
- this.$message.warning('请在表格中选择日期')
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
+ // if(this.$parent.selectCell.DataType !== 1) return this.$message.warning('请在表格中选择日期')
|
|
|
+
|
|
|
+ if(!this.calculateShowData.length) return this.$message.warning('该日期无数据')
|
|
|
+
|
|
|
this.$emit('insert',this.chooseItem)
|
|
|
this.cancelHandle();
|
|
|
},
|
|
|
|
|
|
+ /* 设置关联表格的日期 */
|
|
|
+ setChooseDate(cell) {
|
|
|
+ if(cell.DataType !== 1) {
|
|
|
+ this.chooseItem.Date = '';
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ this.chooseItem.Date = cell.DataTime;
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 选择指标 */
|
|
|
+ async selectTargetHandle(e) {
|
|
|
+ this.changeSource();
|
|
|
+ if(!e) {
|
|
|
+ this.selectEdbInfo = null
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const res = e.EdbInfoType === 1
|
|
|
+ ? await preDictEdbInterface.edbDataInfo({EdbInfoId:e.EdbInfoId,CurrentIndex: 1})
|
|
|
+ : await dataBaseInterface.targetList({EdbInfoId:e.EdbInfoId,CurrentIndex: 1})
|
|
|
+
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+
|
|
|
+ const { EdbInfoId,EdbCode,EdbName,Frequency,Unit,StartDate,ModifyTime,SourceName,PredictDataList,DataList } = res.Data.Item;
|
|
|
+ this.selectEdbInfo = {
|
|
|
+ EdbCode,EdbName,Frequency,Unit,StartDate,ModifyTime,SourceName,EdbInfoId,
|
|
|
+ DataList: PredictDataList ? [...PredictDataList,...DataList].slice(0,5) : DataList.slice(0,5)
|
|
|
+ };
|
|
|
+ console.log(this.selectEdbInfo)
|
|
|
+ },
|
|
|
+
|
|
|
+ /* 选择表格指标 */
|
|
|
+ async selectTableEdbHandle(item) {
|
|
|
+ const res = await dataBaseInterface.targetDetail({EdbInfoId:item.EdbInfoId})
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+
|
|
|
+ const { EdbInfoId,EdbInfoType,EdbName } = res.Data;
|
|
|
+ this.search_edb = EdbName;
|
|
|
+ this.selectTargetHandle({EdbInfoId,EdbInfoType,EdbName})
|
|
|
+ },
|
|
|
+
|
|
|
+ /* */
|
|
|
+ changeSource() {
|
|
|
+ this.showResult = false;
|
|
|
+ this.calculateAllResult = [];
|
|
|
+ this.chooseItem = { Date: '' };
|
|
|
+ },
|
|
|
+
|
|
|
initData() {
|
|
|
this.search_edb='';
|
|
|
- this.calculateResult = {};
|
|
|
- this.chooseItem = null;
|
|
|
+ this.selectEdbInfo = null;
|
|
|
+ this.showResult = false;
|
|
|
+ this.calculateAllResult = [];
|
|
|
+ this.chooseItem = { Date: '' };
|
|
|
this.formData = {
|
|
|
- edbFromSource: this.formData.edbFromSource,
|
|
|
+ source: this.formData.source,
|
|
|
nNum: 1,
|
|
|
moveType: 1,
|
|
|
moveUnit: '天',
|
|
@@ -307,9 +432,19 @@ export default {
|
|
|
|
|
|
.main {
|
|
|
padding: 20px;
|
|
|
+ max-height: calc(100vh - 350px);
|
|
|
+ min-height: 300px;
|
|
|
+ overflow-y: auto;
|
|
|
.main-top {
|
|
|
margin-bottom: 20px;
|
|
|
}
|
|
|
+ .edb-list {
|
|
|
+ display: flex;
|
|
|
+ gap: 10px;
|
|
|
+ .el-tag {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
.form-section { margin: 20px 0; }
|
|
|
.bot {
|
|
|
display: flex;
|