Browse Source

公式选区又不要了

Karsa 1 year ago
parent
commit
1d9b3ad9c7

+ 12 - 15
src/views/datasheet_manage/components/MixedTable.vue

@@ -345,11 +345,11 @@ export default {
       setFocus(e);
       setFocus(e);
 
 
       /* 如果当前有公式单元格在编辑就拼接当前单元格进公式 */
       /* 如果当前有公式单元格在编辑就拼接当前单元格进公式 */
-      if(this.calculateClickCell && this.calculateClickCell.Uid!==cell.Uid) {
-        console.log(this.calculateClickCell)
-        const { cindex,rindex } = e.target.dataset;
-        this.calculateClickCell.Value += `${cindex}${rindex}`
-      }
+      // if(this.calculateClickCell && this.calculateClickCell.Uid!==cell.Uid) {
+      //   console.log(this.calculateClickCell)
+      //   const { cindex,rindex } = e.target.dataset;
+      //   this.calculateClickCell.Value += `${cindex}${rindex}`
+      // }
 
 
       //是插值单元格时寻找关联依赖的单元格 设置选框
       //是插值单元格时寻找关联依赖的单元格 设置选框
       if([4,5,7].includes(cell.DataType)) {
       if([4,5,7].includes(cell.DataType)) {
@@ -530,11 +530,11 @@ export default {
         }else if(value.startsWith('=')) { //公式单元格
         }else if(value.startsWith('=')) { //公式单元格
           cell.DataType = 6;
           cell.DataType = 6;
           let calculateVal = await this.getValueByFormula(value);
           let calculateVal = await this.getValueByFormula(value);
+          if(!calculateVal) return
           cell.ShowValue = calculateVal;
           cell.ShowValue = calculateVal;
           //处理公式关系
           //处理公式关系
           this.$set(cell,'Extra',this.dealFormulaConstruction(value))
           this.$set(cell,'Extra',this.dealFormulaConstruction(value))
           
           
-          console.log(cell)
 
 
         }else {//自定义值
         }else {//自定义值
           cell.DataType = 3;
           cell.DataType = 3;
@@ -636,9 +636,9 @@ export default {
       console.log(factors)
       console.log(factors)
       
       
       //根据因数找单元格
       //根据因数找单元格
-      let isAllCell = factors.some(_ => findCellByFactor(_)=== null)
+      let isAllCell = factors.some(_ => findCellByFactor(_)===null||isNaN(findCellByFactor(_)))
       if(isAllCell) {
       if(isAllCell) {
-        this.$message.warning('公式有误,参数不存在')
+        this.$message.warning('公式参数有误')
         return '';
         return '';
       } 
       } 
 
 
@@ -828,7 +828,6 @@ export default {
         this.config.data.splice(index,1)
         this.config.data.splice(index,1)
 
 
       }
       }
-      // console.log(this.insertRelationArr)
     },
     },
 
 
     /* 删除时清除关联关系 和删除单元格有关联的插入值单元格和 */
     /* 删除时清除关联关系 和删除单元格有关联的插入值单元格和 */
@@ -1057,20 +1056,18 @@ export default {
         this.$refs[`inputRef${e.target.dataset.key}`]&&this.$refs[`inputRef${e.target.dataset.key}`][0].close()
         this.$refs[`inputRef${e.target.dataset.key}`]&&this.$refs[`inputRef${e.target.dataset.key}`][0].close()
 
 
         cell.DataType===6 && this.$set(cell,'CanEdit',false)
         cell.DataType===6 && this.$set(cell,'CanEdit',false)
-        this.calculateClickCell = null
-        resetDialogCellStyle()
+        // this.calculateClickCell = null
       }
       }
     },
     },
 
 
     /* 支持公式单元格双击切换状态 */
     /* 支持公式单元格双击切换状态 */
     dblClickCellHandle(e,cell) {
     dblClickCellHandle(e,cell) {
-      if(this.disabled || cell.DataType!==6 || this.calculateClickCell) return
+      if(this.disabled || cell.DataType!==6) return
 
 
       this.$set(cell,'CanEdit',true)
       this.$set(cell,'CanEdit',true)
 
 
-      this.calculateClickCell = cell;
-
-      setRelationStyle({ key:cell.Uid },'td-choose-insert-target')
+      // this.calculateClickCell = cell;
+      // setRelationStyle({ key:cell.Uid },'td-choose-insert-target')
 
 
       this.$nextTick(() => {
       this.$nextTick(() => {
         if(e.target.childNodes[0].childNodes[0].childNodes[1].nodeName==='INPUT') e.target.childNodes[0].childNodes[0].childNodes[1].focus();
         if(e.target.childNodes[0].childNodes[0].childNodes[1].nodeName==='INPUT') e.target.childNodes[0].childNodes[0].childNodes[1].focus();

+ 20 - 5
src/views/datasheet_manage/components/calculateEdbDia.vue

@@ -70,7 +70,7 @@
 								style="width: 100px"
 								style="width: 100px"
 								placeholder=""
 								placeholder=""
 								size="mini"
 								size="mini"
-								@change="refreshTarget"
+								@change="changeParams"
 							>
 							>
 								<el-option
 								<el-option
 									v-for="item in moveTypeOpions"
 									v-for="item in moveTypeOpions"
@@ -87,13 +87,14 @@
 								size="mini"
 								size="mini"
 								v-model="formData.moveVal"
 								v-model="formData.moveVal"
 								@keyup.native="filterCode(formData)"
 								@keyup.native="filterCode(formData)"
+                @change="changeParams"
 							></el-input>
 							></el-input>
 							<el-select
 							<el-select
 								v-model="formData.moveUnit"
 								v-model="formData.moveUnit"
 								size="mini"
 								size="mini"
 								placeholder=""
 								placeholder=""
 								style="width: 100px"
 								style="width: 100px"
-								@change="refreshTarget"
+                @change="changeParams"
 							>
 							>
 								<el-option
 								<el-option
 									v-for="item in fre_options"
 									v-for="item in fre_options"
@@ -111,7 +112,7 @@
 								style="width: 200px"
 								style="width: 200px"
 								placeholder="请输入N数值"
 								placeholder="请输入N数值"
 								type="number"
 								type="number"
-								@change="NchangeHandle"
+								@change="changeParams"
 							/>
 							/>
 						</el-form-item>
 						</el-form-item>
 
 
@@ -120,7 +121,7 @@
 								v-model="formData.calendarType"
 								v-model="formData.calendarType"
 								placeholder="请选择日历"
 								placeholder="请选择日历"
 								style="width: 200px"
 								style="width: 200px"
-								@change="NchangeHandle"
+								@change="changeParams"
 							>
 							>
 								<el-option
 								<el-option
 									v-for="item in calendarOptions"
 									v-for="item in calendarOptions"
@@ -138,6 +139,7 @@
 								placeholder="请选择频度"
 								placeholder="请选择频度"
 								style="width: 200px"
 								style="width: 200px"
 								clearable
 								clearable
+                @change="changeParams"
 							>
 							>
 								<el-option
 								<el-option
 									v-for="item in frequencyArr"
 									v-for="item in frequencyArr"
@@ -154,6 +156,7 @@
 								v-model="formData.valueType"
 								v-model="formData.valueType"
 								placeholder="请选择数据取值类型"
 								placeholder="请选择数据取值类型"
 								style="width: 200px"
 								style="width: 200px"
+                @change="changeParams"
 							>
 							>
 								<el-option key="期末值" label="期末值" value="期末值"/>
 								<el-option key="期末值" label="期末值" value="期末值"/>
 								<el-option key="平均值" label="平均值" value="平均值"/>
 								<el-option key="平均值" label="平均值" value="平均值"/>
@@ -165,6 +168,7 @@
                 v-model="formData.alphaValue" 
                 v-model="formData.alphaValue" 
                 placeholder="请选择alpha值"
                 placeholder="请选择alpha值"
                 style="width: 200px"
                 style="width: 200px"
+                @change="changeParams"
               />
               />
 						</el-form-item>
 						</el-form-item>
 					</el-form>
 					</el-form>
@@ -365,6 +369,11 @@ export default {
       
       
     },
     },
 
 
+    /* 已计算过改参数重新计算 */
+    changeParams() {
+      this.showResult && this.calculateHandle()
+    },
+
     /* 插入值 */
     /* 插入值 */
     insertData() {
     insertData() {
 
 
@@ -402,7 +411,13 @@ export default {
       const res = await dataBaseInterface.targetDetail({EdbInfoId:item.EdbInfoId})
       const res = await dataBaseInterface.targetDetail({EdbInfoId:item.EdbInfoId})
       if(res.Ret !== 200) return
       if(res.Ret !== 200) return
 
 
-      const { EdbInfoId,EdbInfoType,EdbName } = res.Data;
+      const { EdbInfoId,EdbInfoType,EdbName,Frequency } = res.Data;
+
+      if(this.formData.source===1&&Frequency!=='月度') return this.$message.warning('只能选择月度指标')
+      else if(this.formData.source===8&&Frequency==='日度') return this.$message.warning('不能选择日度指标')
+      else if(this.formData.source===14&&Frequency==='年度') return this.$message.warning('不能选择年度指标')
+
+
       this.search_edb = EdbName;
       this.search_edb = EdbName;
       this.selectTargetHandle({EdbInfoId,EdbInfoType,EdbName})
       this.selectTargetHandle({EdbInfoId,EdbInfoType,EdbName})
     },
     },