Przeglądaj źródła

Merge branch 'ETA1.6.5'

jwyu 1 rok temu
rodzic
commit
5d86fa667c

+ 4 - 0
src/views/dataEDB/Detail.vue

@@ -101,6 +101,10 @@ function handleEdit(){
     }
     // 计算指标
     if(data.EdbType === 2 && ![27,40,58,59].includes(data.Source)){
+        if([81,82].includes(data.Source)){
+            showToast('请在pc端操作')
+            return
+        }
         router.push({
             path:'/dataEDB/calculate/detail',
             query:{

+ 4 - 0
src/views/dataEDB/Index.vue

@@ -213,6 +213,10 @@ function handleEDBOpt(type,data){
 
     //查看计算指标
     if(type==='see'){
+        if([81,82].includes(data.Source)){
+            showToast('请在PC端操作')
+            return
+        }
         router.push({
             path:'/dataEDB/calculate/detail',
             query:{

+ 4 - 4
src/views/dataEDB/calculate/Index.vue

@@ -52,17 +52,17 @@ function handleGoBatchDetail(item){
                         :key="item.type"
                         @click="handleGoDetail(item)"
                     >
-                        <div class="tips-box" @click.stop="handleShowTips(item)"> 
+                        <!-- <div class="tips-box" @click.stop="handleShowTips(item)"> 
                             <svg xmlns="http://www.w3.org/2000/svg" width="20" height="21" viewBox="0 0 20 21" fill="none">
                                 <path d="M18.75 10.5C18.75 15.3325 14.8325 19.25 10 19.25C5.16751 19.25 1.25 15.3325 1.25 10.5C1.25 5.66751 5.16751 1.75 10 1.75C14.8325 1.75 18.75 5.66751 18.75 10.5ZM10.625 5.50038H9.375V12.375H10.625V5.50038ZM9.24286 14.25V15.75H10.7429V14.25H9.24286Z" fill="#0052D9"/>
                             </svg>
                             <span>公式说明</span>
-                        </div>
+                        </div> -->
                         <h3 class="name">{{item.name}}</h3>
                     </li>
                 </ul>
             </van-tab>
-            <van-tab title="批量计算">
+            <!-- <van-tab title="批量计算">
                 <ul class="type-list-wrap">
                     <li 
                         class="type-item" 
@@ -79,7 +79,7 @@ function handleGoBatchDetail(item){
                         <h3 class="name">{{item.name}}</h3>
                     </li>
                 </ul>
-            </van-tab>
+            </van-tab> -->
         </van-tabs>
     </div>
     <!-- 公式说明 -->

+ 6 - 11
src/views/dataEDB/calculate/components/DiffusionIndexCalcualate.vue

@@ -7,7 +7,8 @@ import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
 import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
 import SelectEDBFrequency from '../../components/SelectEDBFrequency.vue'
 import EDBHistory from '@/views/dataEDB/components/EDBHistory.vue'
-import {calculateTypeTipsMap} from '../../util/config'
+import {calculateTypeTipsMap,MAXADDEDBNUM} from '../../util/config'
+import {generateSeriesArray} from '@/views/dataEDB/util/util.js'
 import { useRoute, useRouter } from 'vue-router';
 import moment from 'moment';
 import {useToHistoryPage} from '@/hooks/edb/useToHistoryPage'
@@ -62,13 +63,7 @@ const showTips=ref(false)
 const tipsContent=ref(calculateTypeTipsMap.get(Number(route.query.source))||'')
 
 
-const letterOpts = [];//字母数据
-function initLetterOpt(){
-    for(let i=0;i<26;i++){
-        letterOpts.push(String.fromCharCode(65+i));
-    }
-}
-initLetterOpt()
+const letterOpts = generateSeriesArray()||[];//字母数据
 
 //选择的指标集合
 const edbList=ref([
@@ -90,7 +85,7 @@ const edbList=ref([
     }
 ])
 function handleAddEdbList(){
-    if(edbList.value.length>=26){
+    if(edbList.value.length>=MAXADDEDBNUM){
         showToast('添加指标个数已达上限')
         return
     }
@@ -154,7 +149,7 @@ const dateRange=computed(()=>{
 const edbNameInputFocus=ref(false)
 const baseInfo=reactive({
     name:'',
-    unit:'',
+    unit:'',
     classify:'',
     frequency:''
 })
@@ -350,7 +345,7 @@ function handleShowEDBHistory(item){
                 :right-icon="!isPreview?'arrow':''"
                 required
                 @click-input="showSelectUnit=true"
-                :disabled="isPreview"
+                disabled
             />
             <van-field 
                 :modelValue="classifyStr"

+ 3 - 0
src/views/dataEDB/calculate/components/FittingResidualsCalculate.vue

@@ -113,6 +113,9 @@ function handleShowSelectEDB(type){
 function handleConfirmSelectEDB(e){
     if(currentSelectEDBType==='independent'){
         independentEDBInfo.value=e
+        baseInfo.unit=e.Unit
+        baseInfo.frequency=e.Frequency
+        selectEDBClassifyINS.value?.getSelectClassifyOpt(e.ClassifyId)
     }else{
         dependentEDBInfo.value=e
     }

+ 73 - 11
src/views/dataEDB/calculate/components/FormulaCalculate.vue

@@ -7,7 +7,8 @@ import EDBHistory from '@/views/dataEDB/components/EDBHistory.vue'
 import SelectEDBClassify from '../../components/SelectEDBClassify.vue'
 import SelectEDBUnit from '../../components/SelectEDBUnit.vue'
 import SelectEDBFrequency from '../../components/SelectEDBFrequency.vue'
-import {calculateTypeTipsMap} from '../../util/config'
+import {calculateTypeTipsMap,MAXADDEDBNUM} from '../../util/config'
+import {generateSeriesArray} from '@/views/dataEDB/util/util.js'
 import { useRoute, useRouter } from 'vue-router';
 import {useToHistoryPage} from '@/hooks/edb/useToHistoryPage'
 const {toHistoryPage} = useToHistoryPage()
@@ -52,6 +53,12 @@ watch(
             nullWayStr.value = nullWayOptions.value.find(_ =>_.value===baseInfo.nullValueWay).label
             maxNullStr.value = maxNullWayOptions.value.find(_=>_.value===baseInfo.maxNullWay).label
 
+            if(props.edbInfo.EdbInfoDetail.Extra){
+                const ExtraObj=JSON.parse(props.edbInfo.EdbInfoDetail.Extra)
+                baseInfo.timeSeriesVal=ExtraObj.DateTag
+                timeSeriesVal.value=timeSeriesOpts.value.find(_=>_.value===baseInfo.timeSeriesVal).label
+            }
+
             setTimeout(() => {
                 selectEDBClassifyINS.value?.getSelectClassifyOpt(props.edbInfo.EdbInfoDetail.ClassifyId)//获取选择的分类目录
             }, 1000);
@@ -62,13 +69,7 @@ watch(
 // 预览页面
 const isPreview=ref(route.query.type==='preview'||false)
 
-const letterOpts = [];//字母数据
-function initLetterOpt(){
-    for(let i=0;i<26;i++){
-        letterOpts.push(String.fromCharCode(65+i));
-    }
-}
-initLetterOpt()
+const letterOpts = generateSeriesArray()||[];//字母数据
 
 //公式说明
 const showTips=ref(false)
@@ -111,7 +112,7 @@ const edbList=ref([
     }
 ])
 function handleAddEdbList(){
-    if(edbList.value.length>=26){
+    if(edbList.value.length>=MAXADDEDBNUM){
         showToast('添加指标个数已达上限')
         return
     }
@@ -177,7 +178,8 @@ const baseInfo=reactive({
     classify:'',
     frequency:'',
     nullValueWay: 1,
-    maxNullWay: 1
+    maxNullWay: 1,
+    timeSeriesVal:'',
 })
 
 // 选择单位
@@ -290,6 +292,33 @@ function onConfirmMaxNullWay(e) {
 }
 
 
+// 生成指标时间序列
+const timeSeriesVal=ref('')
+const showTimeSeries=ref(false)
+const timeSeriesOpts=computed(()=>{
+    let arr=[]
+    arr=edbList.value.filter(item=>item.target).map(item=>{
+        return {
+            label:`指标${item.tag}`,
+            value:item.tag
+        }
+    })
+
+    arr.push(
+        {
+			label:'所有指标时间序列并集',
+			value:'all',
+		}
+    )
+
+    return arr
+})
+function onConfirmTimeSeries(e){
+    baseInfo.timeSeriesVal=e.selectedValues[0]
+    timeSeriesVal.value=e.selectedOptions[0].label
+    showTimeSeries.value=false
+}
+
 //一些文案提示
 const formTips = ref({
     'null-val': `1、查找前后35天最近值:在参与计算的日期序列上某指标无值时,该指标往前/往后找距离最近的值作为当天的值进行计算,遍历允许跨年,往前最多35天,往后最多35天<br>
@@ -348,7 +377,10 @@ async function handleSave(){
         Unit:baseInfo.unit,
         EdbInfoIdArr:arr,
         EmptyType:baseInfo.nullValueWay,
-        MaxEmptyType:baseInfo.maxNullWay
+        MaxEmptyType:baseInfo.maxNullWay,
+        Extra:JSON.stringify({
+			DateTag:baseInfo.timeSeriesVal
+		})
     }
     const edbInfoId=route.query.edbInfoId
     const res=edbInfoId?await apiDataEDB.editCalculateFormula({...params,EdbInfoId:Number(edbInfoId)}):await apiDataEDB.addCalculateFormula(params)
@@ -442,6 +474,18 @@ async function handleSave(){
                         </span>
                     </template>
                 </van-field>
+
+                <van-field
+                    v-model="timeSeriesVal"
+                    input-align="right"
+                    readonly
+                    @click-input="showTimeSeries = true"
+                    :right-icon="!isPreview?'arrow':''"
+                    :disabled="isPreview"
+                    label="生成指标时间序列"
+                    label-width="140px"
+                    placeholder="请选择"
+                />
             </div>
 
             <div class="van-cell formula-wrap">
@@ -626,6 +670,24 @@ async function handleSave(){
         />
     </van-popup>
 
+    <!-- 选择生成指标时间序列 -->
+    <van-popup 
+        :show="showTimeSeries" 
+        round 
+        position="bottom"
+    >
+        <van-picker
+            title=""
+            :columns="timeSeriesOpts"
+            :columns-field-names="{
+                text: 'label',
+                value: 'value'
+            }"
+            @cancel="showTimeSeries=false"
+            @confirm="onConfirmTimeSeries"
+        />
+    </van-popup>
+
 
 </template>
 

+ 9 - 0
src/views/dataEDB/calculate/components/JointCalculate.vue

@@ -96,6 +96,7 @@ function handleTabChange(){
     baseInfo.unit=''
     baseInfo.classify=''
     baseInfo.frequency=''
+    classifyStr.value=''
 }
 
 //拼接日期
@@ -128,6 +129,14 @@ function handleConfirmSelectEDB(e){
     }else{
         afterEBDInfo.value=e
     }
+    // 初始化值
+    if((tabActive.value===1&&currentSelectEDBType==='after')||(tabActive.value===2&&currentSelectEDBType==='before')){
+        baseInfo.name=`${e.EdbName}/拼接`
+        baseInfo.unit=e.Unit
+        baseInfo.frequency=e.Frequency
+        selectEDBClassifyINS.value?.getSelectClassifyOpt(e.ClassifyId)//获取选择的分类目录
+    }
+
 }
 
 // 基础信息

+ 71 - 12
src/views/dataEDB/calculate/components/OtherCalculate.vue

@@ -1,5 +1,5 @@
 <script setup>
-import {ref,reactive,watch} from 'vue'
+import {ref,reactive,watch, computed} from 'vue'
 import { useRoute, useRouter } from "vue-router";
 import EDBHistory from '@/views/dataEDB/components/EDBHistory.vue'
 import SelectEDB from './SelectEDB.vue'
@@ -53,6 +53,10 @@ watch(
             if([72].includes(edbInfoData.Source)){//指数修匀
                 baseInfo.alphaVal=Number(edbInfoData.CalculateFormula)
             }
+            if([62].includes(edbInfoData.Source)){//最新值处理
+                const ExtraObj=JSON.parse(edbInfoData.Extra)
+                baseInfo.newVal=ExtraObj.LastValType==1?'均值填充':'默认'
+            }
 
             setTimeout(() => {
                 selectEDBClassifyINS.value?.getSelectClassifyOpt(props.edbInfo.EdbInfoDetail.ClassifyId)//获取选择的分类目录
@@ -149,27 +153,35 @@ function updateBaseInfoData(data){
 		['年度','Y'],
 	])
 	const name_map = {
-		5: data.EdbName,
+		5: `${data.EdbName}转月值`,
 		8: `${data.EdbName}/${baseInfo.numberN}${tMap.get(data.Frequency)}MA`,
-		14: `${data.EdbName}/${data.Frequency}升频`,
+		14: `${data.EdbName}/频`,
 		6: `${data.EdbName}同比`,
 		7: `${data.EdbName}同差`,
 		12: `${data.EdbName}${baseInfo.numberN}${data.Frequency.slice(0,1)}环比`,
 		13: `${data.EdbName}${baseInfo.numberN}${data.Frequency.slice(0,1)}环差`,
 		35: `${data.EdbName}超季节性/${baseInfo.numberN}年${baseInfo.calendarType==='公历'?'':'/'+baseInfo.calendarType}`,
-		52: `${data.EdbName}年化`,
-		51: `${data.EdbName}/${data.Frequency}频`,
-		61:  data.EdbName,
-		62:  data.EdbName,
-		63:  data.EdbName,
+		52: `${data.EdbName}年化`,
+		51: `${data.EdbName}/${data.Frequency.substr(0,1)}频`,
+		61: `${data.EdbName}转季值`,
+		62: `${data.EdbName}累计值/${data.Frequency}`,
+		63: `${data.EdbName}年初至今累计值`,
         72: `${data.EdbName}指数修匀`,
-        75: `${data.EdbName}日均值`
+        75: `${data.EdbName}日均值`,
+        22:`${data.EdbName}${getMoveTypeName(baseInfo.moveType)}${baseInfo.moveVal}${baseInfo.moveUnit}`
 	}
     baseInfo.name=name_map[source.value]||''
-    baseInfo.unit=[5,8,14,7,35,72,75].includes(source.value) ? data.Unit : '无',
-    baseInfo.frequency=source.value === 14 ? '日度' : source.value === 61 ? '季度' : source.value === 62 ? '' : data.Frequency
+    baseInfo.unit=[5,8,13,14,7,35,72,75,61,62,63,52].includes(source.value) ? data.Unit : '无'
+    if(source.value === 14){
+        baseInfo.frequency='日度'
+    }else if(source.value === 61){
+        baseInfo.frequency='季度'
+    }else{
+        baseInfo.frequency=data.Frequency
+    }
+    // baseInfo.frequency=source.value === 14 ? '日度' : source.value === 61 ? '季度' : source.value === 62 ? '' : data.Frequency
 
-    if([72,75].includes(source.value)){//指数修匀目录默认和选择的指标在同一个目录
+    if([5,6,7,8,12,13,14,22,35,51,52,61,62,63,72,75].includes(source.value)){//目录默认和选择的指标在同一个目录
         selectEDBClassifyINS.value?.getSelectClassifyOpt(data.ClassifyId)//获取选择的分类目录
     }
     
@@ -191,6 +203,7 @@ const baseInfo=reactive({
     calendarType:'公历',
     valueType:'期末值',
     alphaVal:'',
+    newVal:'默认',
 })
 
 // 选择单位
@@ -218,6 +231,14 @@ function handleConfirmClassify({value,selectedOptions}){
 const showSelectFrequency=ref(false)
 function handleConfirmFrequency(value){
     baseInfo.frequency=value
+
+    // 修改指标名称
+    if(!selectEDBinfo.value||editEdbInfoId.value) return
+    const name_map = {
+		51: `${selectEDBinfo.value.EdbName}/${baseInfo.frequency.substr(0,1)}频`,
+		62:  `${selectEDBinfo.value.EdbName}累计值/${baseInfo.frequency}`,
+	}
+    baseInfo.name=name_map[source.value]||''
 }
 
 //移动方式类型选择
@@ -244,6 +265,25 @@ const showDataValSelect=ref(false)
 //查看指标数据详情
 const showSeeEDBDataList=ref(false)
 
+//选择最新值处理方式
+const showNewValSelect=ref(false)
+const newValOpts=ref([{name:'默认'}])
+const frequencyChangeFlag=computed(()=>{
+    return selectEDBinfo.value?.Frequency+'转'+baseInfo.frequency
+})
+watch(
+    ()=>frequencyChangeFlag.value,
+    (n)=>{
+        const arr=['日度转周度','日度转旬度','周度转旬度']
+        if(n&&arr.includes(n)){
+            newValOpts.value=[{name:'默认'}]
+            baseInfo.newVal=''
+        }else{
+            newValOpts.value=[{name:'默认'},{name:'均值填充'}]
+        }
+    }
+)
+
 // 提交计算
 const saveBtnLoading=ref(false)
 async function handleSave(){
@@ -290,6 +330,9 @@ async function handleSave(){
 		MoveFrequency: baseInfo.moveUnit,
 		MoveType: baseInfo.moveType, 
 		Calendar: baseInfo.calendarType,
+        Extra:JSON.stringify({
+			LastValType:baseInfo.newVal==='均值填充'?1:0
+		})
     }
 
     saveBtnLoading.value=true
@@ -325,6 +368,7 @@ function handleTabChange(){
     baseInfo.moveUnit='天'
     baseInfo.calendarType='公历'
     baseInfo.valueType='期末值'
+    baseInfo.newVal='默认'
     classifyStr.value=''
 
 }
@@ -536,6 +580,18 @@ function handleShowEDBHistory(data){
                     <svg-icon v-if="!isPreview" class="edit-icon" name="edit" :color="alphaValInputFocus?'#0052D9':'#333333'"/>
                 </template>
             </van-field>
+            <!-- 最新值处理 -->
+            <van-field
+                v-if="[62,63].includes(source)"
+                :modelValue="baseInfo.newVal||'默认'"
+                readonly
+                label="最新值处理" 
+                placeholder="请选择"
+                input-align="right"
+                :right-icon="!isPreview?'arrow':''"
+                @click-input="showNewValSelect=true"
+                :disabled="isPreview"
+            />
         </section>
 
         <div class="formula-intro-btn" @click="showTips=true">
@@ -579,6 +635,9 @@ function handleShowEDBHistory(data){
 
     <!-- 降频数据取值 -->
     <van-action-sheet v-model:show="showDataValSelect" close-on-click-action :actions="[{name:'期末值'},{name:'平均值'}]" @select="e=>baseInfo.valueType=e.name" />
+
+    <!-- 最新值处理选项 -->
+    <van-action-sheet v-model:show="showNewValSelect" close-on-click-action :actions="newValOpts" @select="e=>baseInfo.newVal=e.name" />
     
     <!-- 指标溯源 -->
     <EDBHistory v-model:show="showEDBHistory" :edbInfoId="edbHistoryId"/>

+ 7 - 4
src/views/dataEDB/util/config.js

@@ -1,3 +1,6 @@
+//添加指标进行计算的最大指标数量
+export const MAXADDEDBNUM=50
+
 //指标频率配置项
 export const edbFrequencyOpts=['日度','周度','旬度','月度','季度','年度']
 
@@ -251,15 +254,15 @@ export const calculateType=[
 		type:7
 	},
 	{
-		name:'N数值移动平均计算',
+		name:'N期移动均值',
 		type:8
 	},
 	{
-		name:'N数值环比值',
+		name:'N环比值',
 		type:12
 	},
 	{
-		name:'N数值环差值',
+		name:'N环差值',
 		type:13
 	},
 	{
@@ -283,7 +286,7 @@ export const calculateType=[
 		type: 37
 	},
 	{
-		name: '年化',
+		name: '年化',
 		type: 52
 	},
 	{

+ 17 - 0
src/views/dataEDB/util/util.js

@@ -25,4 +25,21 @@ export function deleteClassifyItemEmpty(arr){
             delete item.Children
         }
     })
+}
+
+//生成指标序列数据
+export function generateSeriesArray(){
+	let result = [];
+	const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+	for(let i=0;i<26;i++) result.push(String.fromCharCode(65+i))
+	for (let i = 0; i < 26; i++) {
+		const firstChar = alphabet[i];
+
+		for (let j = 0; j < 26; j++) {
+			const secondChar = alphabet[j];
+			result.push(firstChar + secondChar);
+		}
+	}
+
+	return result;
 }