浏览代码

区间分析

jwyu 7 月之前
父节点
当前提交
4039a7fe4f

+ 263 - 54
src/views/intervalAnalysis/components/batchSelectEdb.vue

@@ -1,67 +1,246 @@
 <template>
-  <el-dialog :visible.sync="isShow" :close-on-click-modal="false" :modal-append-to-body="false" @close="handleClose" custom-class="batch-computed-dialog fit-screen-dialog" center top="5vh" v-dialogDrag title="批量选择指标">
+  <el-dialog
+    :visible.sync="isShow"
+    :close-on-click-modal="false"
+    :modal-append-to-body="false"
+    @close="handleClose"
+    custom-class="batch-computed-dialog fit-screen-dialog"
+    center
+    top="5vh"
+    v-dialogDrag
+    title="批量选择指标"
+  >
     <div class="batch-computed-wrap">
       <div class="filter-wrap" style="margin-top: 20px">
-        <div style="position: relative;top: -20px;">
-          <el-radio-group v-model="edbType">
-            <el-radio :label="0" style="margin-right: 15px"><!-- ETA指标 -->{{ $t("Edb.eta_name") }}</el-radio>
-            <el-radio :label="1"><!-- ETA预测指标 -->{{ $t("Edb.eta_predictor_name") }}</el-radio>
+        <div style="position: relative; top: -20px">
+          <el-radio-group v-model="edbType" :disabled="selectList.length > 0" @change="edbTypeChange">
+            <el-radio :label="0" style="margin-right: 15px"
+              ><!-- ETA指标 -->{{ $t("Edb.eta_name") }}</el-radio
+            >
+            <el-radio :label="1"
+              ><!-- ETA预测指标 -->{{ $t("Edb.eta_predictor_name") }}</el-radio
+            >
           </el-radio-group>
         </div>
         <div>
-          <el-cascader key="isAssociativeSub" v-if="isAssociativeSub" v-model="filter.classify" :options="classifyOpt" :props="classifyProps" clearable collapse-tags :placeholder="$t('EtaBasePage.label_classify')" style="width: 200px" @change="handleFilter" />
-          <el-cascader key="notAssociativeSub" v-else v-model="filter.classify" :options="classifyOpt" :props="classifyProps" clearable collapse-tags :placeholder="$t('EtaBasePage.label_classify')" style="width: 200px" @change="handleFilter" />
+          <!-- 预测指标库分类选择 -->
+          <template v-if="edbType === 1">
+            <el-cascader
+              key="isAssociativeSub"
+              v-if="isAssociativeSub"
+              v-model="filter.classify"
+              :options="preDictClassifyOpt"
+              :props="classifyProps"
+              clearable
+              collapse-tags
+              :placeholder="$t('EtaBasePage.label_classify')"
+              style="width: 200px"
+              @change="handleFilter"
+            />
+            <el-cascader
+              key="notAssociativeSub"
+              v-else
+              v-model="filter.classify"
+              :options="preDictClassifyOpt"
+              :props="classifyProps"
+              clearable
+              collapse-tags
+              :placeholder="$t('EtaBasePage.label_classify')"
+              style="width: 200px"
+              @change="handleFilter"
+            />
+          </template>
+          <template v-else>
+            <el-cascader
+              key="isAssociativeSub"
+              v-if="isAssociativeSub"
+              v-model="filter.classify"
+              :options="classifyOpt"
+              :props="classifyProps"
+              clearable
+              collapse-tags
+              :placeholder="$t('EtaBasePage.label_classify')"
+              style="width: 200px"
+              @change="handleFilter"
+            />
+            <el-cascader
+              key="notAssociativeSub"
+              v-else
+              v-model="filter.classify"
+              :options="classifyOpt"
+              :props="classifyProps"
+              clearable
+              collapse-tags
+              :placeholder="$t('EtaBasePage.label_classify')"
+              style="width: 200px"
+              @change="handleFilter"
+            />
+          </template>
+
           <span>
             <span>关联子分类</span>
-            <el-switch v-model="isAssociativeSub" @change="handleAssociativeSubChange"></el-switch>
+            <el-switch
+              v-model="isAssociativeSub"
+              @change="handleAssociativeSubChange"
+            ></el-switch>
           </span>
-          <el-select v-model="filter.frequency" :placeholder="$t('EtaBasePage.select_frequency')" style="width: 140px" clearable multiple collapse-tags @change="handleFilter">
-            <el-option v-for="item in frequencyArr" :key="item.value" :label="item.value" :value="item.value">
+          <el-select
+            v-model="filter.frequency"
+            :placeholder="$t('EtaBasePage.select_frequency')"
+            style="width: 140px"
+            clearable
+            multiple
+            collapse-tags
+            @change="handleFilter"
+          >
+            <el-option
+              v-for="item in frequencyArr"
+              :key="item.value"
+              :label="item.value"
+              :value="item.value"
+            >
             </el-option>
           </el-select>
-          <el-cascader v-model="filter.user" :placeholder="$t('EtaBasePage.table_col_creator')" :options="sysUserOpts" :props="sysUserProps" collapse-tags :show-all-levels="false" clearable filterable
-            style="width: 240px" @change="handleFilter" />
-          <el-input :placeholder="$t('Edb.InputHolderAll.input_name_orid')" v-model="filter.keyword" style="width: 200px" @keydown.enter.native="handleFilter">
+          <el-cascader
+            v-model="filter.user"
+            :placeholder="$t('EtaBasePage.table_col_creator')"
+            :options="sysUserOpts"
+            :props="sysUserProps"
+            collapse-tags
+            :show-all-levels="false"
+            clearable
+            filterable
+            style="width: 240px"
+            @change="handleFilter"
+          />
+          <el-input
+            :placeholder="$t('Edb.InputHolderAll.input_name_orid')"
+            v-model="filter.keyword"
+            style="width: 200px"
+            @keydown.enter.native="handleFilter"
+          >
             <i slot="prefix" class="el-input__icon el-icon-search"></i>
           </el-input>
-          <el-checkbox :label="$t('EtaBasePage.label_all_check')" v-model="isCheckAll" :indeterminate="isCheckIndeterminate" style="margin-left: 10px" @change="listCheckAllChange" />
+          <el-checkbox
+            :label="$t('EtaBasePage.label_all_check')"
+            v-model="isCheckAll"
+            :indeterminate="isCheckIndeterminate"
+            style="margin-left: 10px"
+            @change="listCheckAllChange"
+          />
         </div>
       </div>
       <div class="table-wrap">
         <div class="left-box">
-          <el-table :data="list" border @sort-change="sortChange" @selection-change="selectionChange" ref="edbDataRef" @select="selectHandle" @select-all="selectAllHandle" height="500px" v-loading="listLoading">
-            <el-table-column type="selection" min-width="50" align="center" :selectable="filterEdbAuth" />
-            <el-table-column :label="$t('EtaBasePage.full_metric_name')" show-overflow-tooltip align="center" :prop="$parent.currentLang === 'en' ? 'EdbNameEn' : 'EdbName'" />
-            <el-table-column :label="$t('Edb.Detail.e_latest_date')" align="center" prop="EndDate" width="120px" />
-            <el-table-column :label="$t('Edb.Detail.e_latest_value')" align="center" show-overflow-tooltip prop="EndValue" width="80px" />
-            <el-table-column :label="$t('EtaBasePage.table_col_creator')" align="center" show-overflow-tooltip prop="SysUserRealName" width="80px" />
-            <el-table-column :label="$t('Edb.Detail.e_fre')" align="center" prop="Frequency" width="50px">
+          <el-table
+            :data="list"
+            border
+            @sort-change="sortChange"
+            @selection-change="selectionChange"
+            ref="edbDataRef"
+            @select="selectHandle"
+            @select-all="selectAllHandle"
+            height="500px"
+            v-loading="listLoading"
+          >
+            <el-table-column
+              type="selection"
+              min-width="50"
+              align="center"
+              :selectable="filterEdbAuth"
+            />
+            <el-table-column
+              :label="$t('EtaBasePage.full_metric_name')"
+              show-overflow-tooltip
+              align="center"
+              :prop="$parent.currentLang === 'en' ? 'EdbNameEn' : 'EdbName'"
+            />
+            <el-table-column
+              :label="$t('Edb.Detail.e_latest_date')"
+              align="center"
+              prop="EndDate"
+              width="120px"
+            />
+            <el-table-column
+              :label="$t('Edb.Detail.e_latest_value')"
+              align="center"
+              show-overflow-tooltip
+              prop="EndValue"
+              width="80px"
+            />
+            <el-table-column
+              :label="$t('EtaBasePage.table_col_creator')"
+              align="center"
+              show-overflow-tooltip
+              prop="SysUserRealName"
+              width="80px"
+            />
+            <el-table-column
+              :label="$t('Edb.Detail.e_fre')"
+              align="center"
+              prop="Frequency"
+              width="50px"
+            >
               <template slot-scope="scope">
                 <span>{{ getFrequencyTrans(scope.row.Frequency) }}</span>
               </template>
             </el-table-column>
-            <el-table-column :label="$t('Edb.Detail.e_unit')" show-overflow-tooltip align="center" :prop="$parent.currentLang === 'en' ? 'UnitEn' : 'Unit'" width="50px">
+            <el-table-column
+              :label="$t('Edb.Detail.e_unit')"
+              show-overflow-tooltip
+              align="center"
+              :prop="$parent.currentLang === 'en' ? 'UnitEn' : 'Unit'"
+              width="50px"
+            >
               <template slot-scope="scope">
                 <span>{{ getUnitTrans(scope.row.Unit) }}</span>
               </template>
             </el-table-column>
           </el-table>
-          <m-page style="margin-top: 10px" class="table-page" v-show="total" :total="total" :pageSize="pageSize" :page_no="page" :pagercount="5" @handleCurrentChange="pageNumberChange" />
+          <m-page
+            style="margin-top: 10px"
+            class="table-page"
+            v-show="total"
+            :total="total"
+            :pageSize="pageSize"
+            :page_no="page"
+            :pagercount="5"
+            @handleCurrentChange="pageNumberChange"
+          />
         </div>
         <div style="padding-top: 200px; margin: 0 30px">
-          <el-button type="primary" :loading="addLoading" @click="getAddEdbListData">
+          <el-button
+            type="primary"
+            :loading="addLoading"
+            @click="getAddEdbListData"
+          >
             {{ $t("EtaBasePage.add_to_selections") }}
           </el-button>
         </div>
         <div class="right-box">
           <el-table :data="selectList" border height="500px">
-            <el-table-column :label="$t('EtaBasePage.full_metric_name')" show-overflow-tooltip align="center" :prop="$parent.currentLang === 'en' ? 'EdbNameEn' : 'EdbName'" />
+            <el-table-column
+              :label="$t('EtaBasePage.full_metric_name')"
+              show-overflow-tooltip
+              align="center"
+              :prop="$parent.currentLang === 'en' ? 'EdbNameEn' : 'EdbName'"
+            />
             <el-table-column width="50px" align="center">
               <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="" />
+                <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 @click="handleDelSelect(scope)" 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>
@@ -71,9 +250,13 @@
         <el-button type="primary" plain @click="handleClose">{{
           $t("Dialog.cancel_btn")
         }}</el-button>
-        <el-button type="primary" @click="handleNextStep">{{ $t("Dialog.confirm_btn") }}</el-button>
-        <div style="float:right;width: 300px;display: flex;align-items: center;">
-          <span style="flex-shrink: 0;">指标系列名称</span>
+        <el-button type="primary" @click="handleNextStep">{{
+          $t("Dialog.confirm_btn")
+        }}</el-button>
+        <div
+          style="float: right; width: 300px; display: flex; align-items: center"
+        >
+          <span style="flex-shrink: 0">指标系列名称</span>
           <el-input v-model="seriesName"></el-input>
         </div>
       </div>
@@ -84,8 +267,9 @@
 <script>
 import { dataBaseInterface, departInterence } from '@/api/api.js';
 import mPage from '@/components/mPage.vue'
+import * as preDictEdbInterface from '@/api/modules/predictEdbApi.js';
 export default {
-  components:{mPage},
+  components: { mPage },
   props: {
     isShow: {
       type: Boolean,
@@ -122,29 +306,23 @@ export default {
         }
       ]
     },
-    classifyProps(){
+    classifyProps() {
       return {
         label: 'ClassifyName',
         value: 'ClassifyId',
         children: 'Children',
         multiple: true,
         emitPath: false,
-        checkStrictly:!this.isAssociativeSub
+        checkStrictly: !this.isAssociativeSub
       }
     }
   },
   data() {
     return {
-      MAXAddNUM:100,
+      MAXAddNUM: 100,
 
       edbType: 0,//0指标库 1预测指标库
 
-      select_target: '',
-      searchOptions: [],//指标列表
-      search_have_more: false,
-      search_page: 1,
-      current_search: '',
-
       filter: {
         classify: '',
         frequency: '',
@@ -154,6 +332,7 @@ export default {
 
       isAssociativeSub: true,//是否关联子分类
       classifyOpt: [],
+      preDictClassifyOpt: [],//预测指标库分类
       sysUserOpts: [],
       sysUserProps: {
         value: "AdminId",
@@ -180,43 +359,54 @@ export default {
       selectList: [],//添加到右侧的数据
       addLoading: false,
 
-      seriesName:'Series',
+      seriesName: 'Series',
 
     }
   },
   mounted() {
     this.getClassifyOpt()
+    this.getPreDictClassifyOpt()
     this.getSysUserList()
     this.getEDBList()
   },
   methods: {
-    initData(e){
-      this.selectList=e.edbList
-      this.seriesName=e.seriesName
+    initData(e) {
+      this.selectList = e.edbList
+      this.seriesName = e.seriesName
     },
-    handleNextStep(){
-      if(this.selectList.length===0){
+    handleNextStep() {
+      if (this.selectList.length === 0) {
         this.$message.warning(/* "请选择指标"  */this.$t('Edb.InputHolderAll.input_select_edb'))
         return
       }
-      if(!this.seriesName){
+      if (!this.seriesName) {
         this.$message.warning(this.$t('Chart.Vailds.serie_name_msg'))
         return
       }
-      this.$emit('success',{
-        seriesName:this.seriesName,
-        edbList:this.selectList
+      this.$emit('success', {
+        seriesName: this.seriesName,
+        edbList: this.selectList
       })
       this.$emit('close')
     },
 
-
     handleClose() {
       this.$emit('close')
     },
 
-    handleAssociativeSubChange(){
-      this.filter.classify=''
+    // 指标类型切换
+    edbTypeChange(){
+      this.filter={
+        classify:'',
+        frequency:'',
+        user:'',
+        keyword:''
+      }
+      this.handleFilter()
+    },
+
+    handleAssociativeSubChange() {
+      this.filter.classify = ''
     },
 
     // 点击加入已选指标库
@@ -288,6 +478,14 @@ export default {
       this.classifyOpt = res.Data.AllNodes || [];
     },
 
+    // 获取预测指标库分类
+    async getPreDictClassifyOpt() {
+      const res = await preDictEdbInterface.classifyListV2()
+      if (res.Ret !== 200) return
+      this.filterNodes(res.Data.AllNodes || []);
+      this.preDictClassifyOpt = res.Data.AllNodes || [];
+    },
+
     // 获取所有系统用户
     async getSysUserList() {
       const res = await departInterence.getQuestionAdminList();
@@ -306,6 +504,7 @@ export default {
         ClassifyIds: this.filter.classify ? this.filter.classify.join(',') : '',
         Keyword: this.filter.keyword,
         Frequency: this.filter.frequency ? this.filter.frequency.join(',') : '',
+        EdbInfoType:this.edbType
       })
       this.listLoading = false
       if (res.Ret === 200) {
@@ -463,7 +662,17 @@ export default {
 
     filterEdbAuth(row) {
       return row.HaveOperaAuth
-    }
+    },
+
+    // 删除已选指标库指标
+    handleDelSelect(e) {
+      if (e === 'all') {
+        this.selectList = []
+        return
+      }
+      const index = e.$index
+      this.selectList.splice(index, 1)
+    },
   }
 }
 </script>

+ 1 - 1
src/views/intervalAnalysis/components/edbComputedWrap.vue

@@ -588,7 +588,7 @@ export default {
           ManualDateConf: this.dateList.filter(i => i.date).map(i => {
             return {
               StartDate: i.date[0],
-              EndDayte: i.date[1]
+              EndDate: i.date[1]
             }
           }),
           YearDateConf: {//跨年划分

+ 2 - 2
src/views/intervalAnalysis/components/saveMultipleEdb.vue

@@ -1,6 +1,6 @@
 <template>
 	<el-dialog :modal-append-to-body="false" title="保存指标" :visible.sync="isShow" :close-on-click-modal="false" @close="cancelHandle" center v-dialogDrag>
-		<div class="save-chart-wrap">
+		<div class="save-multiple-edb-wrap">
 			<el-table :data="list" border height="500px">
 				<el-table-column :label="$t('EtaBasePage.full_metric_name')" align="center" :prop="$parent.currentLang === 'en' ? 'EdbNameEn' : 'EdbName'" />
 				<el-table-column :label="$t('EtaBasePage.gen_metric_name_label')" align="center">
@@ -140,7 +140,7 @@ export default {
 	max-width: 1200px;
   width: 90vw;
 }
-.save-chart-wrap {
+.save-multiple-edb-wrap {
 	.el-input {
 		width: 100%;
 	}