Karsa пре 1 година
родитељ
комит
217980b90c

+ 16 - 5
src/views/chartRelevance_manage/components/selectTarget.vue

@@ -5,7 +5,7 @@
       v-model="targetType"
       placeholder="请选择指标种类"
       @change="targetTypeChange"
-      v-if="selectStyleType===1"
+      v-if="selectStyleType===1&&filter"
     >
       <el-option
         v-for="item in etaTypeOpt"
@@ -15,7 +15,7 @@
       />
     </el-select>
 
-    <div v-else-if="selectStyleType===2">
+    <div v-else-if="selectStyleType===2&&filter">
       <label>选择指标:</label>
       <el-radio-group v-model="targetType" @change="targetTypeChange">
         <el-radio  
@@ -26,7 +26,7 @@
       </el-radio-group>
     </div>
 
-    <div v-else-if="selectStyleType===3" style="display:flex;align-items:center">
+    <div v-else-if="selectStyleType===3&&filter" style="display:flex;align-items:center">
       <el-select
         v-model="targetType"
         placeholder="请选择指标种类"
@@ -73,7 +73,7 @@
       remote
       clearable
       placeholder="请选择指标名称"
-      style="width: 100%; margin-top: 20px"
+      :style="`width: 100%; ${filter?'margin-top: 20px':''}`"
       :remote-method="searchHandle"
       @click.native="inputFocusHandle"
       @change="handleSelectTarget"
@@ -96,6 +96,7 @@
 <script>
 import { dataBaseInterface } from '@/api/api.js';
 import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
+import * as sheetInterface from "@/api/modules/sheetApi.js";
 export default {
     props:{
       defaultId:{
@@ -109,6 +110,9 @@ export default {
       },
       selectStyleType: {
         default: 1
+      },
+      filter: { //是否要预测和eta的筛选
+        default: true
       }
     },
     watch:{
@@ -152,7 +156,14 @@ export default {
                 KeyWord: query,
                 CurrentIndex: page,
             }
-            const res = this.targetType=='1'?await dataBaseInterface.targetSearchByPage(params):await preDictEdbInterface.edbSearch(params)
+
+            let res;
+            if(this.filter) {
+               res = this.targetType=='1'?await dataBaseInterface.targetSearchByPage(params):await preDictEdbInterface.edbSearch(params)
+            }else {
+              res = await sheetInterface.searchTarget(params)
+            }
+            
 
             if (res.Ret !== 200) return
             const { List, Paging } = res.Data;

+ 31 - 7
src/views/datasheet_manage/components/MixedTable.vue

@@ -142,7 +142,7 @@
 
           <!-- 二级菜单 -->
           <div class="subMenu-wrapper" v-if="menu.children">
-            <div slot="reference" class="item" v-for="submenu in menu.children" :key="submenu.key" @click="edbCalculateInsertOpen(menu.key,submenu)">
+            <div slot="reference" class="item" v-for="submenu in menu.children" :key="submenu.key" @click="edbCalculateInsertOpen(submenu)">
                 <el-popover
                   width="300"
                   trigger="hover"
@@ -174,6 +174,12 @@
       :info="insertDateInfo"
       @insert="insertDatehandle"
     />
+
+    <calculateEdbDia
+      :isShow.sync="isInsertCalculate"
+      :info="insertCalculateInfo"
+      @insert="insertCalculateData"
+    />
   </div>
 </template>
 <script>
@@ -197,6 +203,7 @@ import { dataBaseInterface } from '@/api/api.js';
 import md5 from '@/utils/md5.js';
 import selectTargetValueDia from './selectTargetValueDia.vue';
 import insertDateDia from './insertDateDia.vue';
+import calculateEdbDia from './calculateEdbDia.vue';
 import { formulaTip } from '@/views/dataEntry_manage/databaseComponents/util';
 export default {
   props: {
@@ -205,7 +212,7 @@ export default {
       default: false,
     }
   },
-  components: { selectTargetValueDia,insertDateDia },
+  components: { selectTargetValueDia,insertDateDia,calculateEdbDia },
   computed: {
     //列头
     columnHeader() {
@@ -257,6 +264,12 @@ export default {
       insertDateInfo: {
         key: '',
       },
+
+      isInsertCalculate: false,//插入指标计算值
+      insertCalculateInfo: {
+
+      },
+
       formulaTip
     };
   },
@@ -660,13 +673,12 @@ export default {
         'choose-target': this.selectTargetOpen,//选择指标插入值
         'insert-sys-date': this.insertDateOpen,//导入系统日期
         'insert-edb-date': this.insertDateOpen,//导入指标日期
-        // 'insert-edb-calculate': this.edbCalculateInsertOpen,//指标计算
         'reset': this.clearCell, //清空
         'cell-edit': this.insertDateOpen
       }
       keyMap[key] && keyMap[key](key)
       
-      this.hideContextMenu()
+      key!=='insert-edb-calculate' && this.hideContextMenu()
     },
 
     /* 打开选择指标弹窗  
@@ -849,9 +861,21 @@ export default {
       this.insertTargetCell.DataTime = insertValue;
     },
 
-    /* 公式计算弹窗 */
-    edbCalculateInsertOpen(key) {
-      console.log(key)
+    /* 指标计算弹窗 */
+    edbCalculateInsertOpen(item) {
+      this.insertTargetCell = this.selectCell;
+      resetDialogCellStyle();
+      setRelationStyle({ key:this.insertTargetCell.Uid },'td-choose-insert-target');
+
+      this.isInsertCalculate = true;
+      this.insertCalculateInfo = {
+        ...item
+      }
+    },
+
+    /* 导入指标计算值 */
+    insertCalculateData() {
+
     },
 
     /* 初始化8行5列 */

+ 317 - 0
src/views/datasheet_manage/components/calculateEdbDia.vue

@@ -0,0 +1,317 @@
+<template>
+  <div v-dialogDrag v-if="isShow" >
+    <div class="calculate-edb-value-dialog el-dialog" >
+      <div class="header el-dialog__header">
+        <span>{{info.label}}</span>
+        <i class="el-icon-close" @click="cancelHandle"/>
+      </div>
+
+      <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===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>
+
+          <selectTarget
+            v-show="formData.edbFromSource===2"
+            :defaultId="search_edb"
+            :defaultOpt="searchOptions"
+            ref="selectRef"
+            @select="e => { selectEdbInfo = e ||null }"
+            :filter="false"
+            style="margin: 20px 0"
+          />
+        </section>
+
+        <tableEdbListSection 
+          v-if="formData.edbFromSource===1"
+        />
+        
+        <edbDetailSection 
+          v-if="formData.edbFromSource===2"
+          :tableData="selectEdbInfo?[selectEdbInfo]:[]"
+        />
+
+        <section class="form-section">
+          <el-form
+						ref="form"
+						label-position="right"
+						inline
+						label-width="80px"
+						:model="formData"
+						:rules="formRules"
+					>
+						<el-form-item label="移动方式" style="display: block;" v-if="info.fromEdbKey === 22" prop="moveVal">
+							<el-select
+								v-model="formData.moveType"
+								style="width: 100px"
+								placeholder=""
+								size="mini"
+								@change="refreshTarget"
+							>
+								<el-option
+									v-for="item in moveTypeOpions"
+									:key="item.key"
+									:label="item.label"
+									:value="item.key"
+								>
+								</el-option>
+							</el-select>
+							<el-input
+								style="width: 80px"
+								type="number"
+								min="0"
+								size="mini"
+								v-model="formData.moveVal"
+								@keyup.native="filterCode(formData)"
+							></el-input>
+							<el-select
+								v-model="formData.moveUnit"
+								size="mini"
+								placeholder=""
+								style="width: 100px"
+								@change="refreshTarget"
+							>
+								<el-option
+									v-for="item in fre_options"
+									:key="item"
+									:label="item"
+									:value="item"
+								>
+								</el-option>
+							</el-select>
+						</el-form-item>
+
+						<el-form-item label="N等于" prop="nNum" v-if="[8,12,13,35].includes(info.fromEdbKey)">
+							<el-input
+								v-model="formData.nNum"
+								style="width: 200px"
+								placeholder="请输入N数值"
+								type="number"
+								@change="NchangeHandle"
+							/>
+						</el-form-item>
+
+						<el-form-item label="日历" prop="calendarType" v-if="info.fromEdbKey===35">
+							<el-select
+								v-model="formData.calendarType"
+								placeholder="请选择日历"
+								style="width: 200px"
+								@change="NchangeHandle"
+							>
+								<el-option
+									v-for="item in calendarOptions"
+									:key="item.key"
+									:label="item.label"
+									:value="item.label"
+								>
+								</el-option>
+							</el-select>
+						</el-form-item>
+
+						<el-form-item label="数据取值" prop="valueType" v-if="info.fromEdbKey===51">
+							<el-select
+								v-model="formData.valueType"
+								placeholder="请选择数据取值类型"
+								style="width: 200px"
+							>
+								<el-option key="期末值" label="期末值" value="期末值"/>
+								<el-option key="平均值" label="平均值" value="平均值"/>
+							</el-select>
+						</el-form-item>
+
+						<el-form-item label="alpha值" prop="alphaValue" v-if="info.fromEdbKey==='alpha'">
+              <el-input 
+                v-model="formData.alphaValue" 
+                placeholder="请选择alpha值"
+                style="width: 200px"
+              />
+						</el-form-item>
+					</el-form>
+        </section>
+
+        <!-- 计算结果 -->
+        <section class="result-section" v-if="calculateResult.List">
+          <label>计算结果:</label>
+          <ul class="data-cont">
+              <li v-for="(item,index) in result.List" :key="index" :class="[{'choose': item.DataTime===result.Date},'data-li']">
+                <span>{{item.DataTime}}</span>
+                <span style="min-width:150px">{{item.Value}}</span>
+              </li>
+          </ul>
+        </section>
+
+        <section class="bot">
+          <el-button type="primary" @click="insertData" v-if="chooseItem">插入值</el-button>
+          <el-button type="primary" @click="calculateHandle" v-else>计算</el-button>
+          <el-button type="primary" plain @click="cancelHandle">取消</el-button>
+
+        </section>
+
+      </div>
+
+
+    </div>
+  </div>    
+</template>
+<script>
+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: {
+    isShow: {
+      type: Boolean
+    },
+    info: {
+      type: Object
+    }
+  },
+  components: { selectTarget,edbDetailSection,tableEdbListSection },
+  data() {
+    return {
+      formData: {
+        edbFromSource: 2,
+        source: this.info.fromEdbKey,
+        nNum: 1,
+				moveType: 1,
+				moveUnit: '天',
+				moveVal: '',
+				calendarType: '公历',
+				valueType: '期末值',
+      },
+      formRules,
+
+      calculateResult: {},
+      chooseItem: null,
+
+      search_edb: '',
+      searchOptions: [],
+      selectEdbInfo: null,
+
+      moveTypeOpions: [
+				{
+					label: '领先',
+					key: 1
+				},
+				{
+					label: '滞后',
+					key: 2
+				},
+			],
+      fre_options: ['天','周','月','季','年'],
+      calendarOptions: [
+				{label: '公历',key: 1},
+				{label: '农历',key: 2},
+			],
+    }
+  },
+  mounted(){
+
+  },
+  methods:{
+    /* 计算 */
+    async calculateHandle() {
+      await this.$refs.form.validate();
+    },
+
+    /* 插入值 */
+    insertData() {
+      if(this.$parent.selectCell.DataType !== 1){
+        this.$message.warning('请在表格中选择日期')
+        return
+      }
+
+      this.$emit('insert',this.chooseItem)
+      this.cancelHandle();
+    },
+
+    initData() {
+      this.search_edb='';
+      this.calculateResult = {};
+      this.chooseItem = null;
+      this.formData = {
+        edbFromSource: this.formData.edbFromSource,
+        nNum: 1,
+				moveType: 1,
+				moveUnit: '天',
+				moveVal: '',
+				calendarType: '公历',
+				valueType: '期末值'
+      }
+    },
+
+    cancelHandle() {
+      this.initData();
+      this.$emit('update:isShow',false);
+      resetDialogCellStyle();
+    }
+  },
+}
+</script>
+<style scoped lang='scss'>
+@import "~@/styles/theme-vars.scss";
+.calculate-edb-value-dialog {
+  background: #fff;
+  position: fixed;
+  top: 20%;
+  left: 50%;
+  width: 750px;
+  border-radius: 2px;
+  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
+  z-index: 999;
+  .header { 
+    font-size: 16px;
+    background: $theme-color;
+    color: #fff;
+    padding: 15px;
+    display: flex;
+    align-content: center;
+    justify-content: space-between;
+    .el-icon-close {
+      font-size: 20px;
+      cursor: pointer;
+    }
+  }
+
+  .main {
+    padding: 20px;
+    .main-top {
+      margin-bottom: 20px;
+    }
+    .form-section { margin: 20px 0; }
+    .bot {
+      display: flex;
+      justify-content: center;
+      margin: 30px 0;
+    }
+    .data-cont {
+      margin: 15px 0;
+      border: 1px solid #DCDFE6;
+      .data-li {
+        display: flex;
+        padding: 15px;
+        text-align: center;
+        justify-content: space-around;
+        &.choose {
+          background: #ECF5FF;
+        }
+      }
+    }
+  }
+}  
+</style>

+ 136 - 0
src/views/datasheet_manage/components/edbDetailSection.vue

@@ -0,0 +1,136 @@
+<template>
+  <div class="edb-detail">
+    <label>已选指标:</label>
+    <el-table
+      :data="tableData"
+      style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2); margin-top: 10px"
+      border
+    >
+      <el-table-column
+        v-for="item in tableColums"
+        :key="item.label"
+        :label="item.label"
+        :width="item.widthsty"
+        :min-width="item.minwidthsty"
+        align="center"
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row[item.key] }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column
+        width="110"
+        align="center"
+        label="操作"
+      >
+        <template>
+          <!-- <span class="deletesty" @click="delTarget">删除</span> -->
+        </template>
+      </el-table-column>
+      <div slot="empty" style="padding: 20px 0">
+        <tableNoData text="暂无指标" size="mini" />
+      </div>
+    </el-table>
+    <ul
+      class="data-ul"
+      ref="dataUl"
+      v-if="dataList.length"
+    >
+      <li
+        class="value-item"
+        v-for="(item, index) in dataList"
+        :key="item.EdbDataId"
+      >
+        <span class="value-label">
+          <i class="new-tag" v-if="index === 0"></i>
+          {{ item.DataTime }}
+        </span>
+        <span
+          class="value-label"
+          style="min-width: 200px; text-align: center"
+          >{{ item.Value }}</span
+        >
+      </li>
+    </ul>
+  </div>
+</template>
+<script>
+export default {
+  props: {
+    tableData: {
+      type: Array
+    }
+  },
+  data() {
+    return {
+      tableColums:[
+				{
+					label: '指标ID',
+					key: 'EdbCode',
+				},
+				{
+					label: '指标名称',
+					key: 'EdbName',
+				},
+				{
+					label: '频度',
+					key: 'Frequency',
+				},
+				{
+					label: '单位',
+					key: 'Unit',
+				},
+				{
+					label: '起始时间',
+					key: 'StartDate',
+					minwidthsty: '100px'
+				},
+				{
+					label: '更新时间',
+					key: 'ModifyTime',
+					minwidthsty: '110px'
+				},
+				{
+					label: '来源',
+					key: 'SourceName',
+				},
+			],
+      dataList: []
+    };
+  },
+  methods: {},
+};
+</script>
+<style scoped lang="scss">
+.edb-detail {
+  .data-ul {
+    margin-top: 5px;
+    border-bottom: 1px solid #dcdfe6;
+    max-height: 140px;
+    overflow-y: auto;
+    .value-item {
+      /* width: 100%; */
+      padding: 14px 0;
+      border: 1px solid #dcdfe6;
+      border-bottom: none;
+      display: flex;
+      justify-content: space-around;
+      .value-label {
+        position: relative;
+        color: #666;
+      }
+      .new-tag {
+        width: 6px;
+        height: 6px;
+        display: inline-block;
+        position: absolute;
+        left: -12px;
+        top: 50%;
+        transform: translateY(-50%);
+        border-radius: 50%;
+        background: #f00;
+      }
+    }
+  }
+}
+</style>

+ 10 - 58
src/views/datasheet_manage/components/insertDateDia.vue

@@ -83,30 +83,14 @@
           <!-- 导入指标日期 -->
           <ul v-else> 
             <li class="form-item">
-              <el-select
-                v-model="search_edb"
-                v-loadMore="searchLoad"
-                :filterable="!search_edb"
-                remote
-                clearable
-                placeholder="请选择指标名称"
-                style="flex: 1"
-                :remote-method="searchHandle"
-                @click.native="inputFocusHandle"
-                @change="e => { selectEdbInfo = searchOptions.find(_ => _.EdbInfoId === e) || {} } "
-              >
-                <i slot="prefix" class="el-input__icon el-icon-search"></i>
-                <el-option
-                  v-for="item in searchOptions"
-                  :key="item.EdbInfoId"
-                  :label="item.EdbName"
-                  :value="item.EdbInfoId"
-                >
-                  <edbDetailPopover :info="item">
-                    <div slot="reference">{{item.EdbName}}</div>
-                  </edbDetailPopover>
-                </el-option>
-              </el-select>
+
+              <selectTarget
+                :defaultId="search_edb"
+                :defaultOpt="searchOptions"
+                ref="selectRef"
+                @select="e => { selectEdbInfo = e ||{} }"
+                :filter="false"
+              />
 
               <el-tooltip effect="dark" style="margin-left:10px">
                 <div
@@ -136,6 +120,7 @@
 <script>
 import * as sheetInterface from "@/api/modules/sheetApi.js";
 import { dataBaseInterface } from '@/api/api.js';
+import selectTarget from '@/views/chartRelevance_manage/components/selectTarget.vue'
 export default {
   props: {
     isShow: {
@@ -145,6 +130,7 @@ export default {
       type: Object
     }
   },
+  components: { selectTarget },
   watch: {
     isShow : { 
       async handler(nval) {
@@ -214,9 +200,6 @@ export default {
 
       search_edb: '',
       searchOptions:[],
-      search_page: 1,
-      current_search: '',
-      search_have_more: true,
 
       titleMap: {
         'insert-sys-date': '导入系统日期',
@@ -235,37 +218,6 @@ export default {
     }
   },
   methods:{
-    searchHandle(query) {
-        this.search_page = 1;
-        this.current_search = query;
-        this.searchApi(this.current_search)
-    },
-
-    async searchApi(query, page = 1) {
-        let params = {
-            KeyWord: query,
-            CurrentIndex: page,
-        }
-        const res = await sheetInterface.searchTarget(params)
-
-        if (res.Ret !== 200) return
-        const { List, Paging } = res.Data;
-        this.search_have_more = page < Paging.Pages;
-        this.searchOptions = page === 1 ? List : this.searchOptions.concat(List);
-    },
-
-    /* 聚焦获取当前检索 */
-    inputFocusHandle(e) {
-        this.search_page = 1;
-        this.current_search = e.target.value;
-        this.searchApi(this.current_search);
-    },
-
-    searchLoad() {
-        if (!this.search_have_more) return;
-        this.searchApi(this.current_search, ++this.search_page);
-    },
-
     // 保存插入信息
     async saveInsertHandle() {
       

+ 56 - 0
src/views/datasheet_manage/components/tableEdbListSection.vue

@@ -0,0 +1,56 @@
+<template>
+  <el-table
+      :data="tableData"
+      style="box-shadow: 0px 3px 6px rgba(155, 170, 219, 0.2); margin-top: 10px"
+      border
+    >
+      <el-table-column
+        v-for="item in tableColums"
+        :key="item.label"
+        :label="item.label"
+        :width="item.widthsty"
+        :min-width="item.minwidthsty"
+        align="center"
+      >
+        <template slot-scope="scope">
+          <span>{{ scope.row[item.key] }}</span>
+        </template>
+      </el-table-column>
+  </el-table>    
+</template>
+<script>
+export default {
+  data() {
+    return {
+      tableData: [{
+        EdbName: '对我的群无',
+        LatestDate: '2023-05-21',
+        latestValue: '151'
+      }],
+      tableColums: [
+        {
+					label: '指标名称',
+					key: 'EdbName',
+				},
+				{
+					label: '最新日期',
+					key: 'LatestDate',
+				},
+				{
+					label: '最新数据',
+					key: 'latestValue',
+				}
+      ]
+    }
+  },
+  mounted(){
+
+  },
+  methods:{
+
+  },
+}
+</script>
+<style scoped lang='scss'>
+
+</style>