فهرست منبع

指标批量计算编辑

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

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

@@ -847,6 +847,11 @@ const dataBaseInterface = {
 		return http.post('/datamanage/edb_info/calculate/batch/save/batch',params)
 	},
 
+	//批量计算编辑
+	batchCalculateTargetEdit: params => {
+		return http.post('/datamanage/edb_info/calculate/batch/edit/batch',params)
+	},
+
 	/**
 	 * 获取计算指标与基础指标关联信息
 	 * @param EdbInfoId

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

@@ -8,12 +8,12 @@
             <el-table-column label="指标全称" align="center" prop="EdbName"/>
             <el-table-column label="生成指标名称" align="center">
                 <template slot-scope="scope">
-                    <el-input v-model="scope.row.name" placeholder="请填写指标名称" style="width:100%"/>
+                    <el-input :disabled="operationForm.view" v-model="scope.row.name" placeholder="请填写指标名称" style="width:100%"/>
                 </template>
             </el-table-column>
             <el-table-column label="单位" align="center" width="200px">
                 <template slot-scope="scope">
-                    <selectUnit v-model="scope.row.unit"/>
+                    <selectUnit :disabled="operationForm.view" v-model="scope.row.unit"/>
                 </template>
             </el-table-column>
             <el-table-column label="频度" align="center" width="200px">
@@ -22,6 +22,7 @@
 						v-model="scope.row.frequency"
 						placeholder="请选择频率"
                         @change="handleFrequencyChange(scope)"
+                        :disabled="operationForm.view"
 					>
 						<el-option
 							v-for="item in frequencyArr"
@@ -36,7 +37,7 @@
             <el-table-column align="center" width="300px">
                 <template slot="header" slot-scope="scope">
                     <span style="margin-right:40px;display:inline-block">目录</span>
-                    <el-radio-group v-model="classifyType">
+                    <el-radio-group :disabled="operationForm.view" v-model="classifyType">
                         <el-radio :label="0">分目录</el-radio>
                         <el-radio :label="1">同目录</el-radio>
                     </el-radio-group>
@@ -47,13 +48,13 @@
 						:options="classifyOpt"
 						:props="levelProps"
 						placeholder="请选择指标目录"
-                        :disabled="classifyType===1&&$index>0"
+                        :disabled="(classifyType===1&&$index>0)||operationForm.view"
                         @change="handleClassifyChange(row,$index)"
 					/>
                 </template>
             </el-table-column>
         </el-table>
-        <div style="text-align:center;margin:60px 0 40px 0">
+        <div style="text-align:center;margin:60px 0 40px 0" v-if="!operationForm.view">
             <el-button type="primary" plain @click="handleClose">取消</el-button>
             <el-button type="primary" @click="handleSubmit" :loading="loading">{{loading ? '批量计算中...' : '批量计算'}}</el-button>
         </div>
@@ -70,7 +71,9 @@ export default {
         subComputedType:null,
         selectList:null,
         formData:null,
-        select_target:null
+        select_target:null,
+        operationForm:null,
+        isEdit:false
     },
     computed: {
         sourceTypeVal(){
@@ -112,6 +115,18 @@ export default {
             // 如果是多指标求和\平均
             if(this.computedType==='multipleEDB'){
                 this.computedArr=this.selectList
+                // 如果是编辑时
+                if(this.isEdit){
+                    this.list=[{
+                        EdbName:this.operationForm.EdbInfoDetail.EdbName,
+                        EdbInfoId:this.operationForm.EdbInfoDetail.EdbInfoId,
+                        name:this.operationForm.EdbInfoDetail.EdbName,
+                        unit:this.operationForm.EdbInfoDetail.Unit,
+                        frequency:this.operationForm.EdbInfoDetail.Frequency,
+                        classify:this.operationForm.EdbInfoDetail.ClassifyId
+                    }]
+                    return
+                }
                 arr=[{...this.selectList[0]}]
             }else{
                 arr=this.selectList
@@ -213,7 +228,8 @@ export default {
                     EdbName:item.name,
                     Frequency:item.frequency,
                     Unit:item.unit,
-                    FromEdbInfoId:item.EdbInfoId
+                    FromEdbInfoId:this.isEdit?0:item.EdbInfoId,
+                    EdbInfoId:this.isEdit?item.EdbInfoId:0
                 }
             })
             const valueMap = {
@@ -253,7 +269,7 @@ export default {
 
             this.loading=true
             this.$message.success('请等待计算完成,该过程可能持续2-3分钟')
-            const res=await dataBaseInterface.batchCalculateTargetAdd(params)
+            const res=this.isEdit?await dataBaseInterface.batchCalculateTargetEdit(params) : await dataBaseInterface.batchCalculateTargetAdd(params)
             this.loading=false
             
             if(res.Ret !== 200) return

+ 45 - 8
src/views/dataEntry_manage/databaseComponents/batchComputedV2.vue

@@ -11,11 +11,11 @@
         :title="showSave?'批量计算-结果保存':'批量计算-选择指标和计算公式'"
 	>
         <div class="batch-computed-wrap" v-if="!showSave">
-            <el-form inline>
+            <el-form inline :disabled="operationForm.view">
             <div class="type-wrap">
                 <div style="margin-right:50px">
                     <span>计算公式</span>
-                    <el-select v-model="computedType" @change="handleComputedTypeChange" placeholder="请选择">
+                    <el-select :disabled="isEdit" v-model="computedType" @change="handleComputedTypeChange" placeholder="请选择">
                         <el-option 
                             v-for="opt in computedBatchTypes" 
                             :key="opt.type" 
@@ -170,7 +170,7 @@
                     <!-- 多指标求和/平均 -->
                     <template v-if="computedType=='multipleEDB'">
                     <el-form-item style="margin-right:30px">
-                    <el-radio-group v-model="subComputedType">
+                    <el-radio-group :disabled="isEdit" v-model="subComputedType">
                         <el-radio :label="81">求和</el-radio>
                         <el-radio :label="82">求平均</el-radio>
                     </el-radio-group>
@@ -262,6 +262,7 @@
                         :indeterminate="isCheckIndeterminate" 
                         style="margin-left:10px"
                         @change="listCheckAllChange"
+                        :disabled="operationForm.view"
                     />
                 </div>
             </div>
@@ -278,10 +279,10 @@
                         height="500px"
                         v-loading="listLoading"
                     >
-                        <el-table-column type="selection" min-width="50" align="center" />
+                        <el-table-column type="selection" min-width="50" align="center" v-if="!operationForm.view"/>
                         <el-table-column label="指标全称" show-overflow-tooltip align="center" prop="EdbName"/>
-                        <el-table-column label="最新日期" align="center" prop="LatestDate" width="120px" />
-                        <el-table-column label="最新值" align="center" show-overflow-tooltip prop="LatestValue" width="80px"/>
+                        <el-table-column label="最新日期" align="center" prop="EndDate" width="120px" />
+                        <el-table-column label="最新值" align="center" show-overflow-tooltip prop="EndValue" 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"/>
@@ -298,7 +299,7 @@
                     />
                 </div>
                 <div style="padding-top:200px;margin:0 30px">
-                    <el-button type="primary" :loading="addLoading" @click="getAddEdbListData">加入已选指标</el-button>
+                    <el-button type="primary" :disabled="operationForm.view" :loading="addLoading" @click="getAddEdbListData">加入已选指标</el-button>
                 </div>
                 <div class="right-box">
                     <el-table 
@@ -312,7 +313,7 @@
                             </template>
                         </el-table-column>
                         <el-table-column label="指标全称" show-overflow-tooltip align="center" prop="EdbName"/>
-                        <el-table-column width="50px" align="center">
+                        <el-table-column width="50px" align="center" v-if="!operationForm.view">
                             <template slot="header" slot-scope="scope">
                                 <img @click="handleDelSelect('all')" style="width:15px;height:15px;cursor: pointer;" src="~@/assets/img/ai_m/delete.png" alt="">
                             </template>
@@ -335,6 +336,8 @@
             :subComputedType="subComputedType" 
             :selectList="selectList" 
             :formData="formData" 
+            :isEdit="isEdit"
+            :operationForm="operationForm"
             @close="showSave=false" 
             @addCallBack="handleAddSuccess"
             v-else
@@ -355,6 +358,12 @@ export default {
         isShow:{
             type: Boolean
         },
+        operationForm: {
+			type: Object,
+		},
+        type: {
+			type: Number
+		},
     },
     filters:{
         getNoText(e){
@@ -420,6 +429,7 @@ export default {
                 this.isCheckIndeterminate=false
                 this.checkAllStatus=false
                 this.selectionReactCancel=false
+                this.isEdit=false
                 this.filter={
                     classify:'',
                     frequency:'',
@@ -438,6 +448,11 @@ export default {
                     nullValueWay:0,
                     maxNullWay:1,
                 }
+            }else{
+                // 编辑多指标求和\平均
+                if([81,82].includes(this.type)){
+                    this.initData()
+                }
             }
         }
     },
@@ -516,6 +531,8 @@ export default {
             selectList:[],//添加到右侧的数据
             addLoading:false,
 
+            isEdit:false,//是否为多指标求和等编辑
+
         }
     },
     mounted() {
@@ -525,6 +542,25 @@ export default {
     },
     
     methods: {
+        // 编辑时初始化数据
+        initData(){
+            this.isEdit=true
+            const arr=this.operationForm.CalculateList||[]
+            this.selectList=arr.map(item=>{
+                return {
+                    ClassifyId:item.ClassifyId,
+                    EdbInfoId:item.FromEdbInfoId,
+                    EdbName:item.FromEdbName,
+                    Frequency:item.Frequency,
+                    Unit:item.Unit
+                }
+            })
+            this.computedType='multipleEDB'
+            this.subComputedType=this.type
+            this.formData.timeSeriesVal=this.operationForm.EdbInfoDetail.Extra?JSON.parse(this.operationForm.EdbInfoDetail.Extra).DateTag:'A'
+            this.formData.nullValueWay=this.operationForm.EdbInfoDetail.EmptyType||0
+
+        },
         //批量计算成功回调
         handleAddSuccess(type,params){
             this.$emit('addCallBack',type,params)
@@ -609,6 +645,7 @@ export default {
 
         // 删除已选指标库指标
         handleDelSelect(e){
+            if(this.operationForm.view) return
             if(e==='all'){
                 this.selectList=[]
                 return

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

@@ -81,6 +81,7 @@
 								:props="{emitPath:false}"
 								:show-all-levels="false"
 								placeholder="请选择"
+								:disabled="calulateForm.view"
 							></el-cascader>
 						</div>
 						

+ 8 - 0
src/views/dataEntry_manage/databaseList.vue

@@ -504,6 +504,8 @@
 		<!-- 批量计算指标 -->
 		<batchComputedV2 
 			:isShow="showBatchComputedPop" 
+			:type="computed_type"
+			:operationForm="operationForm"
 			@close="showBatchComputedPop=false" 
 			@addCallBack="addComputedCallBack"
 		/>
@@ -1620,6 +1622,7 @@ export default {
 			this.calulateList = [];
 			this.calulateForm = {};
 			this.operationForm = {};
+			this.computed_type=0
 			this.isOpenComputed = true;
 		},
 		/* 新增计算指标回调 */
@@ -1787,6 +1790,11 @@ export default {
 						view
 					}
 				}
+				// 多指标求和求平均
+				if([81,82].includes(type)){
+					this.operationForm={...res,view}
+					this.showBatchComputedPop=true
+				}
 			}
 		},