jwyu 1 سال پیش
والد
کامیت
fb5f807448

+ 8 - 0
src/api/modules/chartApi.js

@@ -410,6 +410,14 @@ const dataBaseInterface = {
 	edbAddBatch: params => {
 		return http.post('/datamanage/edb_info/batch/add',params)
 	},
+	// 批量计算指标时获取当前筛选条件下选择的指标
+	getBatchFilterAddEdbList:params=>{
+		return http.get('/datamanage/edb_info/calculate/multi/choice',params)
+	},
+	//批量计算指标时待选指标的搜索列表
+	getBatchAddEdbSearchList:params=>{
+		return http.get('/datamanage/edb_info/calculate/multi/search',params)
+	},
 	//========================================chart
 	// /**
 	//  * 

+ 24 - 3
src/views/dataEntry_manage/databaseComponents/batchComputedSave.vue

@@ -63,11 +63,15 @@
 <script>
 import { dataBaseInterface } from '@/api/api.js';
 export default {
+    props:{
+        selectList:null,
+        formData:null,
+    },
     data() {
         return {
             frequencyArr: ['日度', '周度','旬度','月度', '季度', '年度'],
 
-            list:[{name:'',EdbName:'',unit:'',menu:''},{name:'',EdbName:'',unit:'',menu:''}],
+            list:[],
 
             classifyType:0,
             classifyOpt: [],
@@ -80,9 +84,14 @@ export default {
         }
     },
     mounted() {
+        this.initData()
         this.getClassifyOpt()
     },
     methods: {
+        initData(){
+            
+        },
+
         handleClose(){
             this.$emit('close')
         },
@@ -106,6 +115,18 @@ export default {
 }
 </script>
 
-<style>
-
+<style lang="scss">
+.batch-computed-save-wrap{
+    .el-input{
+        input{
+            border: none;
+        }
+    }
+    .el-table tr{
+        background-color: #fff !important;
+        &:hover>td{
+            background-color: transparent !important; /* 或者其他想要的颜色值 */
+        }
+    }
+}
 </style>

+ 92 - 14
src/views/dataEntry_manage/databaseComponents/batchComputedV2.vue

@@ -207,7 +207,7 @@
             </div>
             </el-form>
             <div class="filter-wrap" style="margin-top:20px">
-                <p style="margin-bottom:10px">待选指标(选择指标数量不超过50)</p>
+                <p style="margin-bottom:10px">待选指标(选择指标数量不超过{{MAXAddNUM}})</p>
                 <div>
                     <el-cascader
 						v-model="filter.classify"
@@ -217,6 +217,7 @@
                         collapse-tags
 						placeholder="指标分类"
                         style="width: 240px"
+                        @change="handleFilter"
 					/>
                     <el-select
 						v-model="filter.frequency"
@@ -225,6 +226,7 @@
 						clearable
                         multiple
                         collapse-tags
+                        @change="handleFilter"
 					>
 						<el-option
 							v-for="item in frequencyArr"
@@ -244,12 +246,13 @@
                         clearable
                         filterable
                         style="width:240px"
+                        @change="handleFilter"
                     />
                     <el-input 
                         placeholder="指标ID/指标名称" 
                         v-model="filter.keyword"
                         style="width: 200px"
-                        @blur="handleFilter"
+                        @keydown.enter.native="handleFilter"
                     >
                         <i slot="prefix" class="el-input__icon el-icon-search"></i>
                     </el-input>
@@ -273,12 +276,13 @@
                         @select="selectHandle" 
                         @select-all="selectAllHandle"
                         height="500px"
+                        v-loading="listLoading"
                     >
                         <el-table-column type="selection" min-width="50" align="center" />
                         <el-table-column label="指标全称" show-overflow-tooltip align="center" prop="EdbName"/>
                         <el-table-column label="最新日期" align="center" prop="LatestDate" sortable="custom" width="120px" />
-                        <el-table-column label="最新值" align="center" prop="LatestValue" width="80px"/>
-                        <el-table-column label="创建人" align="center" prop="SysUserRealName" width="80px"/>
+                        <el-table-column label="最新值" align="center" show-overflow-tooltip prop="LatestValue" width="80px"/>
+                        <el-table-column label="创建人" align="center" show-overflow-tooltip prop="SysUserRealName" width="80px"/>
                         <el-table-column label="频度" align="center" prop="Frequency" width="50px"/>
                         <el-table-column label="单位" show-overflow-tooltip align="center" prop="Unit" width="50px"/>
                     </el-table>
@@ -294,7 +298,7 @@
                     />
                 </div>
                 <div style="padding-top:200px;margin:0 30px">
-                    <el-button type="primary">加入已选指标</el-button>
+                    <el-button type="primary" @click="getAddEdbListData">加入已选指标</el-button>
                 </div>
                 <div class="right-box">
                     <el-table 
@@ -305,10 +309,10 @@
                         <el-table-column label="指标全称" show-overflow-tooltip align="center" prop="EdbName"/>
                         <el-table-column width="50px" align="center">
                             <template slot="header" slot-scope="scope">
-                                <img style="width:15px;height:15px;cursor: pointer;" src="~@/assets/img/ai_m/delete.png" alt="">
+                                <img @click="handleDelSelect('all')" style="width:15px;height:15px;cursor: pointer;" src="~@/assets/img/ai_m/delete.png" alt="">
                             </template>
                             <template slot-scope="scope">
-                                <img style="width:15px;height:15px;cursor: pointer;" src="~@/assets/img/ai_m/delete.png" alt="">
+                                <img @click="handleDelSelect(scope)" style="width:15px;height:15px;cursor: pointer;" src="~@/assets/img/ai_m/delete.png" alt="">
                             </template>
                         </el-table-column>
                     </el-table>
@@ -316,11 +320,11 @@
             </div>
             <div style="text-align:center;margin:60px 0 40px 0">
                 <el-button type="primary" plain @click="handleClose">取消</el-button>
-                <el-button type="primary" @click="showSave=true">下一步</el-button>
+                <el-button type="primary" @click="handleNextStep">下一步</el-button>
             </div>
         </div>
         <!-- 结果保存 -->
-        <batchComputedSave @close="handleClose" v-else/>
+        <batchComputedSave :selectList="selectList" :formData="formData" @close="showSave=false" v-else/>
     </el-dialog>
 </template>
 
@@ -337,6 +341,14 @@ export default {
         },
     },
     computed:{
+        // 最大添加指标的上限
+        MAXAddNUM(){
+            let num=50
+            if(this.computedType=='multipleEDB'){
+                num=100
+            }
+            return num
+        },
         /* max空值处理显示 当输入的公式包含MAX、MIN且空值处理为0时,输入公式失焦后出现右侧选项; */
 		showMaxNullDeal() {
 			let haveMaxOrMin =  this.formData.formula.toUpperCase().includes('MAX') || this.formData.formula.toUpperCase().includes('MIN')
@@ -382,7 +394,8 @@ export default {
 				label: 'ClassifyName',
 				value: 'ClassifyId',
 				children: 'Children',
-				multiple: true
+				multiple: true,
+                emitPath:false
 			},
             sysUserOpts:[],
             sysUserProps:{
@@ -426,6 +439,7 @@ export default {
             checkAllStatus:false,
             selectionReactCancel:false,// 是否不触发 selection的逻辑
 
+            listLoading:false,
             page:1,
             pageSize:20,
             total:0,
@@ -434,7 +448,7 @@ export default {
             tableDataCheckedList:[],
             tableDataIds:[],
 
-            isAddList:[],//添加到右侧的数据
+            selectList:[],//添加到右侧的数据
 
 
         }
@@ -446,6 +460,64 @@ export default {
     },
     
     methods: {
+        // 跳转下一步
+        handleNextStep(){
+            if(this.selectList.length===0){
+                this.$message.warning('请选择指标')
+                return
+            }
+
+            this.showSave=true
+        },
+
+        // 点击加入已选指标库
+        async getAddEdbListData(){
+            if(!(this.isCheckAll || this.isCheckIndeterminate ) || (!(this.list && this.list.length>0))){
+                this.$message.warning('请选择指标')
+                return
+            }
+            if(this.selectList.length>=this.MAXAddNUM){
+                this.$message.warning('已达批量添加指标数量上限')
+                return
+            }
+            const params={
+                SysUserIds:this.filter.user?this.filter.user.join(','):'',
+                ClassifyIds:this.filter.classify?this.filter.classify.join(','):'',
+                Keyword:this.filter.keyword,
+                Frequency:this.filter.frequency?this.filter.frequency.join(','):'',
+                SelectAll:this.checkAllStatus,
+                EdbInfoIds:this.tableDataCheckedList.join(',')
+            }
+            const res=await dataBaseInterface.getBatchFilterAddEdbList(params)
+            if(res.Ret!=200) return
+            // 加入到已选指标中 要去重
+            const arr=res.Data.SearchItem||[]
+            const temArr=this.mergeAndDistinct(this.selectList,arr)
+            // 截取数组 防止数量溢出
+            this.selectList=temArr.slice(0,this.MAXAddNUM)
+        },
+        mergeAndDistinct(arr1, arr2) {
+            // 合并两个数组
+            const mergedArray = arr1.concat(arr2);
+
+            // 根据 EdbInfoId 字段进行去重
+            const distinctArray = mergedArray.filter((item, index, self) => {
+                return index === self.findIndex(t => t.EdbInfoId === item.EdbInfoId);
+            });
+
+            return distinctArray;
+        },
+
+        // 删除已选指标库指标
+        handleDelSelect(e){
+            if(e==='all'){
+                this.selectList=[]
+                return
+            }
+            const index=e.$index
+            this.selectList.splice(index,1)
+        },
+
         // 切换计算类型
         handleComputedTypeChange(){
             this.subComputedType=''
@@ -536,12 +608,18 @@ export default {
 
         // 获取指标列表
         async getEDBList(type){
-            const res=await dataBaseInterface.targetSearchByPage({
+            this.listLoading=true
+            const res=await dataBaseInterface.getBatchAddEdbSearchList({
                 CurrentIndex:this.page,
                 PageSize: this.pageSize,
+                SysUserIds:this.filter.user?this.filter.user.join(','):'',
+                ClassifyIds:this.filter.classify?this.filter.classify.join(','):'',
+                Keyword:this.filter.keyword,
+                Frequency:this.filter.frequency?this.filter.frequency.join(','):'',
             })
+            this.listLoading=false
             if(res.Ret===200){
-                this.list=res.Data.List||[]
+                this.list=res.Data.SearchItem||[]
                 this.total=res.Data.Paging.Totals||0
 
                 if(this.list.length>0){
@@ -568,7 +646,7 @@ export default {
             this.getEDBList('adjustSelection')
         },
 
-        handleFilter(){
+        handleFilter(e){
             this.page=1
             this.list=[]
             this.getEDBList('adjustSelection')

+ 7 - 0
src/views/dataEntry_manage/databaseComponents/computedDialog.vue

@@ -352,6 +352,13 @@ export default {
 					EdbName: item.edb_name,
 				}))
 
+				if(this.calulateForm.Extra){
+					const ExtraObj=JSON.parse(this.calulateForm.Extra)
+					this.selectTimeSeriesVal=ExtraObj.DateTag
+				}
+				
+
+
 				this.getNewestDate();
 			}
 		},

+ 17 - 0
src/views/dataEntry_manage/databaseComponents/operationDialog.vue

@@ -181,6 +181,7 @@
 								style="width: 340px"
 								clearable
 								:disabled="[5,14,61,63].includes(type)||(!operationForm.edb_id&&[6,7,75].includes(type))"
+								@change="handleFrequencyChange"
 							>
 								<el-option
 									v-for="item in frequencyArr"
@@ -315,6 +316,11 @@ export default {
 				}
 				this.getDataList();
 
+				if(backData.Extra){
+					const ExtraObj=JSON.parse(backData.Extra)
+					this.formData.new_value=ExtraObj.LastValType==1?'均值填充':''
+				}
+
 				//回显时的默认options
 				this.searchOptions = [
 					{
@@ -684,6 +690,17 @@ export default {
 			this.formData.targetName = name_map[this.type] || '';
 		},
 
+		// 频度变化 修改指标名
+		handleFrequencyChange(){
+			if(!this.select_target||this.operationForm.edb_id) return;
+			let obj = this.searchOptions.find(item => item.EdbInfoId === this.select_target);
+			const name_map = {
+				51: `${obj.EdbName}/${this.formData.frequency.substr(0,1)}频`,
+				62:  `${obj.EdbName}累计值/${this.formData.frequency}`,
+			}
+			this.formData.targetName=name_map[this.type] || ''
+		},
+
 		/* 单位默认同步基础指标
 		同比 同差 频度同步 单位无 
 		转月 平均值 频度单位同步

+ 3 - 1
src/views/dataEntry_manage/databaseList.vue

@@ -1719,7 +1719,7 @@ export default {
 						end_date: item.EndDate
 					}
 				})
-				const { EdbInfoId,CalculateFormula,EdbName,Unit,Frequency,EmptyType,MaxEmptyType } = res.EdbInfoDetail;
+				const { EdbInfoId,CalculateFormula,EdbName,Unit,Frequency,EmptyType,MaxEmptyType,Extra } = res.EdbInfoDetail;
 				/* 公式和表单 */
 				this.calulateForm =  {
 					edb_id: EdbInfoId,
@@ -1730,6 +1730,7 @@ export default {
 					frequency: Frequency,
 					emptyType: EmptyType,
 					maxEmptyType: MaxEmptyType,
+					Extra,
 					view
 				};
 			} else  {
@@ -1742,6 +1743,7 @@ export default {
 					frequency: dataInfo.Frequency,
 					unit: dataInfo.Unit,
 					menu: menuArrId||[],
+					Extra:dataInfo.Extra,
 					view
 				}