Browse Source

ETA2.0.7汾渭数据页面

chenlei 7 months ago
parent
commit
bd146492b7

+ 4 - 0
src/api/modules/thirdBaseApi.js

@@ -833,6 +833,7 @@ const yongyiInterface={
 	},
 }
 
+
 /* 汾渭煤炭树 */
 const fwmtInterface={
 		/**
@@ -853,6 +854,9 @@ const fwmtInterface={
 		getTargetDataList:params=>{
 			return http.get('/datamanage/fenwei/single_data',params);
 		},
+		searchEdbBatch : params => {
+			return http.get('/datamanage/fenwei/search_list',params);
+		},
 		// 搜索
 		getTargetListByName:params=>{
 			return http.get('/datamanage/fenwei/search_list',params);

+ 8 - 1
src/components/lzTable.vue

@@ -22,7 +22,7 @@
 									: frequencyMap.get(data[item])
 								: data[item] 
 							}}
-							<span v-if="item==='Opt'&&$route.path==='/steelChemical'&&data['IndexCode'] ">
+							<span v-if="item==='Opt' && operateRouteList.includes($route.path) && data['IndexCode'] ">
 								<el-button type="text" @click.stop="$emit('addToLib',data)"
 									v-if="!data.EdbInfoId&&permissionBtn.isShowBtn('dataSourcePermission','mysteelData_addEdb')"
 								>{{$t('ManualEdbListPage.add_tobase_btn')}}</el-button>
@@ -97,6 +97,9 @@ export default {
 				}
 			}else if(sourceTypeOne.includes(this.source)){
 				arr=['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+				if(this.$route.path==='/fwmtData'){
+					arr.push('Opt')
+				}
 			}
 
 			return arr
@@ -137,6 +140,9 @@ export default {
 					['Unit', this.$t('Edb.Detail.e_unit')],
 					['ModifyTime', this.$t('Edb.Detail.e_update_time')],
 				])
+				if(this.$route.path==='/fwmtData'){
+					temMap.set('Opt',this.$t('Table.column_operations'))
+				}
 			}
 
 			return temMap
@@ -184,6 +190,7 @@ export default {
 	},
 	data() {
 		return {
+			operateRouteList: ['/steelChemical', '/fwmtData'] // 操作路由列表
 			// dynamic_key: (this.source === 'smm'||this.source ==='baiinfo')? 'Value' 
 			// :this.source==='coal'?'Value': 'InputValue',
 	// 		headerArr: this.source === 'gl' 

+ 159 - 8
src/views/dataEntry_manage/thirdBase/FwmtData.vue

@@ -16,9 +16,12 @@
             <i :class="{'el-icon-d-arrow-left':isLeftWrapShow,'el-icon-d-arrow-right':!isLeftWrapShow}"></i>
         </span>
       <div class="left-top">
+        <el-button style="margin-left: 0;margin-bottom: 10px;" v-permission="permissionBtn.dataSourcePermission.mysteelData_batchAddEdb"
+          type="primary" size="medium" @click="isBatchAddIndicsDiaShow = true"
+            ><!-- 批量加入指标库 -->{{$t('SteelChemicalPage.batch_add_edb_btn')}}</el-button
+          >
         <el-button
           v-permission="permissionBtn.dataSourcePermission.yyzxData_export"
-          style="width: 100%"
           type="primary"
           plain
           size="medium"
@@ -57,13 +60,27 @@
             label: 'ClassifyName',
             children: 'Child',
           }"
+          :default-expanded-keys="defaultShowNodes"
           :current-node-key="select_classify"
           :expand-on-click-node="false"
           check-strictly
           highlight-current
           empty-text="暂无分类"
+          lazy
+          :load="getLazyTreeData"
+          @node-expand="handleNodeExpand"
+          @node-collapse="handleNodeCollapse"
           @current-change="nodeChangeHandle"
         >
+          <div slot-scope="{ node, data }" class="custom-tree-node">
+            <div class="text_oneLine" style="width:100%">
+              <span v-if="data.IndexCode">{{data.IndexName}}</span>
+              <span v-else>
+                <!-- {{ currentLang==='zh' ? data.ClassifyName : data.ClassifyNameEn }} -->
+                {{ data.ClassifyName }}
+              </span>
+            </div>
+          </div>
         </el-tree>
       </div>
       <span
@@ -88,6 +105,7 @@
               tableType="header"
               ref="table"
               source="yyzx"
+              @addToLib="addToLib"
               @editTarget="editTargetByTable"
             />
           </div>
@@ -101,20 +119,40 @@
           </div>
           <div v-else class="nodata"></div>
         </div>
+        <el-button style="margin-left: 10px;margin-top: 20px;" plain
+          type="primary" size="medium" @click=""
+            ><!-- 批量加入指标库 -->周度</el-button
+          >
       </template>
       <div v-else class="nodata-cont">
         <tableNoData :text="$t('Table.prompt_slogan')"/>
       </div>
     </div>
+    <!-- 批量添加至指标库弹窗 -->
+    <batchAddIndicsDia 
+      :isOpenDialog="isBatchAddIndicsDiaShow"
+      @close="isBatchAddIndicsDiaShow=false"
+    />
+    <!-- 单个添加至指标库弹窗 -->
+    <addIndicsDia 
+      :isOpenDialog="isAddIndicsDiaShow"
+      :edbData="currentIndicData"
+      @close="isAddIndicsDiaShow=false;"
+      @addCallback="intoBaseBack"
+    />
   </div>
 </template>
 
 <script>
 import lzTable from "@/components/lzTable.vue";
 import { fwmtInterface } from "@/api/api.js";
+import batchAddIndicsDia from "./components/batchAddIndicsDia"
+import addIndicsDia from './components/addIndicsDia.vue';
+import leftMixin from "./mixins/leftMixin.js";
 export default {
   name: "Fwmt",
-  components: { lzTable },
+  mixins: [leftMixin],
+  components: { lzTable, batchAddIndicsDia, addIndicsDia },
   data() {
     return {
       isLeftWrapShow:true,
@@ -133,6 +171,11 @@ export default {
       leftSearchVal: "", //左侧搜索值
       leftSearchTradeCode: "", //如果是搜索选择的 则有此code
       isShowSingleData: false, //右侧是否展示的是单个指标数据
+      isBatchAddIndicsDiaShow: false, //批量添加指标弹窗
+      currentIndicData:{}, //当前选中指标
+      isAddIndicsDiaShow: false, //单个添加指标弹窗
+      defaultShowNodes: [],
+      repetition: null, // 是否重复请求
     };
   },
   methods: {
@@ -269,6 +312,65 @@ export default {
         $(".right-box")[0].scrollLeft = 0;
       });
     },
+
+    //指标懒加载
+    async getLazyTreeData(node,resolve){
+      let arr=[]
+      if(node.level===2||node.data.ClassifyId === 0){
+        const res=await fwmtInterface.dataList({
+          ClassifyId: node.data.ClassifyId
+        })
+        if(res.Ret===200){
+          const temarr=res.Data||[]
+          arr=temarr.map(item=>{
+            delete item.ClassifyId
+            return {
+              ...item,
+              isLeaf:true
+            }
+          })
+        }
+      }else{
+        arr=node.data.Child||[]
+      }     
+      resolve(arr)
+    },
+    // 树节点展开
+    handleNodeExpand(data) {
+      // 保存当前展开的节点
+      let flag = this.defaultShowNodes.some((item) => item === data.UniqueCode);
+
+      if (!flag) {
+        // 不存在则存到数组里
+        this.defaultShowNodes.push(data.UniqueCode);
+      }
+    },
+    // 树节点关闭
+    handleNodeCollapse(data) {
+      this.defaultShowNodes.some((item, index) => {
+        if (item === data.UniqueCode) {
+          // 删除关闭节点
+          this.defaultShowNodes.length = index;
+        }
+      });
+    },
+
+    // 获取选中指标数据
+    addToLib(data){
+        //添加前校验 ID是否已存在指标库中
+        //打开弹窗
+        this.currentIndicData = data
+        this.isAddIndicsDiaShow = true
+    },
+    //添加指标到库
+    intoBaseBack() {
+      this.isAddIndicsDiaShow = false
+      if(this.selectedEdb){
+        this.$refs.edbDetailRef.getEdbDetail()
+      }else {
+        this.getDataList()
+      }
+    },
     /* 无频度的异常显示处理 7*12*/
     nodataDeal() {
       this.tableOption = [];
@@ -332,6 +434,16 @@ export default {
       this.getTargetDataList(e.IndexCode);
     },
 
+    /* 添加指标 */
+    addTargetBatch() {
+      this.batchAddDiaShow = true;
+    },
+    /* 添加后回调 */
+    addSuccessCallback({ code, id,selectClassifyNodes,indexCode }) {
+      indexCode && (this.index_code = indexCode)
+      this.getClassify({ code, id,selectClassifyNodes });
+    },
+
     getTargetData(code, arr) {
       for (const item of arr) {
         if (item.BaseFromBaiinfoIndexCode === code) return item;
@@ -348,16 +460,15 @@ export default {
   
     //改变选中节点
     nodeChangeHandle(data, node) {
-      if (data.ClassifyId === this.select_classify) return;
+      if (data.ClassifyId === this.repetition || data.IndexCode === this.repetition) return;
       this.select_classify = data.ClassifyId;
-      if(data.ParentId===0&&data.Child){
-        this.rightShow=false
-        return
-      }
+      this.repetition = data.ClassifyId || data.IndexCode
       this.leftSearchVal=''
       this.page_no = 1;
       this.page_size = 20;
-      this.getDataList()
+      if (!data.IndexCode)this.getDataList()
+      // 获取单独指标数据
+      else this.getTargetDataList(data.IndexCode);
     },
    
   },
@@ -539,4 +650,44 @@ export default {
   display: flex;
   justify-content: center;
 }
+</style>
+<style lang="scss">
+.smmTarget-container {
+  .el-tree__drop-indicator {
+    height: 3px;
+    background-color: #409eff;
+  }
+  .el-tree-node__content {
+    margin-bottom: 14px !important;
+  }
+  .el-tree-node__children {
+    .el-tree-node {
+      margin-bottom: 0px !important;
+      padding-left: 18px;
+    }
+    .el-tree-node__content {
+      margin-bottom: 5px !important;
+      padding-left: 0 !important;
+    }
+  }
+  .expanded.el-icon-caret-right:before {
+    content: url("~@/assets/img/set_m/down.png") !important;
+  }
+  .el-icon-caret-right:before {
+    content: url("~@/assets/img/set_m/slide.png") !important;
+  }
+  .el-tree-node__expand-icon.is-leaf.el-icon-caret-right:before {
+    content: "" !important;
+  }
+  .el-tree-node__expand-icon.expanded {
+    -webkit-transform: rotate(0deg);
+    transform: rotate(0deg);
+  }
+  .el-tree-node.is-current > .el-tree-node__content {
+    background-color: #f0f4ff !important;
+  }
+  .el-tree-node__content {
+    padding-right: 10px !important;
+  }
+}
 </style>

+ 34 - 13
src/views/dataEntry_manage/thirdBase/components/batchAddIndicsDia.vue

@@ -16,13 +16,7 @@
             <div class="select-box">
                 <el-cascader v-model="searchClassify"
                     :options="classifyList"
-                    :props="{
-                        children:'Children',
-                        label:'ClassifyName',
-                        value:'BaseFromMysteelChemicalClassifyId',
-                        multiple:true,
-                        emitPath:false,
-                    }"
+                    :props="selectProps"
                     :placeholder="$t('Edb.InputHolderAll.input_classify')"
                     @change="getEdbList"
                 ></el-cascader>
@@ -138,7 +132,7 @@
 </template>
 
 <script>
-import { steelInterface } from "@/api/modules/thirdBaseApi";
+import { steelInterface, fwmtInterface } from "@/api/modules/thirdBaseApi";
 import { dataBaseInterface } from '@/api/api.js';
 import selectUnit from '@/components/selectUnit.vue';
 import { frequencySelectList } from '@/utils/defaultOptions';
@@ -183,6 +177,14 @@ export default {
             hintList:[],
             hintText:'',
             btnloading:false,
+
+            // 下拉选择框配置
+            selectProps: {},
+            // 根据路由信息返回要请求的接口
+            handleApiMap: {
+                '/steelChemical':steelInterface,
+                '/fwmtData': fwmtInterface
+            }
         };
     },
     methods: {
@@ -201,9 +203,28 @@ export default {
         },
         //获取钢联化工数据库目录
         getClassifyList(){
-            steelInterface.classifyList().then((res) => {
+            const steelChemicalProps = {
+                children:'Children',
+                label:'ClassifyName',
+                value:'BaseFromMysteelChemicalClassifyId',
+                multiple:true,
+                emitPath:false
+            }
+            const fwmtDataProps = {
+                children:'Child',
+                label:'ClassifyName',
+                value:'ClassifyId',
+                multiple:true,
+                emitPath:false
+            }
+            const handlePropsMap = {
+                '/steelChemical':steelChemicalProps,
+                '/fwmtData': fwmtDataProps
+            }
+            this.handleApiMap[this.$route.path].classifyList().then((res) => {
                 if(res.Ret!==200) return 
                 this.classifyList = res.Data||[]
+                this.selectProps = handlePropsMap[this.$route.path]
             })
         },
         filterNodes(arr) {
@@ -229,7 +250,7 @@ export default {
             this.classifyType = 1
             //tableData
             this.tableLoading = true
-            steelInterface.searchEdbBatch({
+            this.handleApiMap[this.$route.path].searchEdbBatch({
                 BaseFromMysteelChemicalClassifyIds:Array.isArray(this.searchClassify)?this.searchClassify.join(','):'',
                 Keyword:this.searchName||''
             }).then(res=>{
@@ -280,7 +301,7 @@ export default {
 
             this.btnloading = true
             //添加检测
-            steelInterface.batchAddEdbCheck({
+            this.handleApiMap[this.$route.path].batchAddEdbCheck({
                 IndexCodes:this.selectEdbList.map(i=>i.edbId)
             }).then(res=>{
                 if(res.Ret!==200) return (this.btnloading=false)
@@ -304,7 +325,7 @@ export default {
                 const item = this.selectEdbList.find(s=>s.edbId===i)
                 item&&checkList.push(item)
             })
-            steelInterface.batchCheckEdbName(checkList.map(i=>{
+            this.handleApiMap[this.$route.path].batchCheckEdbName(checkList.map(i=>{
                 return {
                     EdbCode:i.edbId,
                     EdbName:i.edbName,
@@ -341,7 +362,7 @@ export default {
         //添加进指标库
         batchAddEdb(afterAddList=[],checkList){
             //checkList
-            steelInterface.batchAddToLib(checkList.map(i=>{
+            this.handleApiMap[this.$route.path].batchAddToLib(checkList.map(i=>{
                 return {
                     EdbCode:i.edbId,
                     EdbName:i.edbName,