浏览代码

涌益咨询数据模块对接完成

jwyu 1 年之前
父节点
当前提交
4f8a80dec6
共有 5 个文件被更改,包括 189 次插入239 次删除
  1. 4 2
      src/api/api.js
  2. 28 1
      src/api/modules/thirdBaseApi.js
  3. 130 42
      src/components/lzTable.vue
  4. 3 2
      src/utils/buttonConfig.js
  5. 24 192
      src/views/dataEntry_manage/thirdBase/YyzxData.vue

+ 4 - 2
src/api/api.js

@@ -10,7 +10,8 @@ import {
   sciDataInterface,
   baiinfoInterface,
   nationalInterface,
-  databankInterface
+  databankInterface,
+  yongyiInterface
 } from './modules/thirdBaseApi';
 
 //手工指标 手工数据 手工数据权限
@@ -112,7 +113,8 @@ export {
   cloudDiskInterface,
   homeInterface,
   businessTripInterence,
-  reportVarietyENInterence
+  reportVarietyENInterence,
+  yongyiInterface
 };
 
 //老接口 研报 ppt等

+ 28 - 1
src/api/modules/thirdBaseApi.js

@@ -720,6 +720,32 @@ const databankInterface = {
     },
 }
 
+/* 涌益咨询 */
+const yongyiInterface={
+	/**
+	 * 分类列表
+	 * @param {} params 
+	 * @returns 
+	 */
+	classifyList: params => {
+		return http.get('/datamanage/yongyi/classify',params);
+	},
+	/**
+	 * 获取指标列表详情
+	 */
+	dataList: params => {
+		return http.get('/datamanage/yongyi/index/data',params);
+	},
+	//单个指标数据
+	getTargetDataList:params=>{
+		return http.get('/datamanage/yongyi/single_data',params);
+	},
+	// 搜索
+	getTargetListByName:params=>{
+		return http.get('/datamanage/yongyi/search_list',params);
+	},
+}
+
 export { 
 	lzDataInterface,
 	glDataInterface,
@@ -730,5 +756,6 @@ export {
   sciDataInterface,
   baiinfoInterface,
   nationalInterface,
-  databankInterface
+  databankInterface,
+  yongyiInterface
 }

+ 130 - 42
src/components/lzTable.vue

@@ -65,19 +65,107 @@ export default {
 			defalut:'lz'
 		}
 	},
+	computed: {
+		headerArr(){
+			let arr=['QuotaName','LzCode','Frequency','UnitName','ModifyTime']
+
+			if(this.source==='gl'){
+				arr=['IndexName','IndexCode','FrequencyName','UnitName','UpdateTime']
+			}
+			if(this.source==='smm'){
+				arr=['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+			}
+			if(this.source==='coal'){
+				arr=['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+			}
+			if(this.source==='baiinfo'){
+				arr=['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+			}
+			if(this.source==='yyzx'){
+				arr=['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+			}
+
+			return arr
+		},
+		labelArr(){
+			let temMap=new Map([
+				['QuotaName', '指标名称'],
+				['LzCode', '指标ID'],
+				['Frequency', '频度'],
+				['UnitName', '单位'],
+				['ModifyTime', '更新时间'],
+			])
+
+			if(this.source==='gl'){
+				temMap=new Map([
+					['IndexName', '指标名称'],
+					['IndexCode', '指标ID'],
+					['FrequencyName', '频度'],
+					['UnitName', '单位'],
+					['UpdateTime', '更新时间'],
+				])
+			}
+			if(this.source==='smm'){
+				temMap=new Map([
+					['IndexName', '指标名称'],
+					['IndexCode', '指标ID'],
+					['Frequency', '频度'],
+					['Unit', '单位'],
+					['ModifyTime', '更新时间'],
+				])
+			}
+			if(this.source==='coal'){
+				temMap=new Map([
+					['IndexName', '指标名称'],
+					['IndexCode', '指标ID'],
+					['Frequency', '频度'],
+					['Unit', '单位'],
+					['ModifyTime', '更新时间'],
+				])
+			}
+			if(this.source==='baiinfo'){
+				temMap=new Map([
+					['IndexName', '指标名称'],
+					['IndexCode', '指标ID'],
+					['Frequency', '频度'],
+					['Unit', '单位'],
+					['ModifyTime', '更新时间'],
+				])
+			}
+			if(this.source==='yyzx'){
+				temMap=new Map([
+					['IndexName', '指标名称'],
+					['IndexCode', '指标ID'],
+					['Frequency', '频度'],
+					['Unit', '单位'],
+					['ModifyTime', '更新时间'],
+				])
+			}
+
+			return temMap
+		},
+		dynamic_key(){
+			let key='InputValue'
+			if(['smm','baiinfo','coal','yyzx'].includes(this.source)){
+				key='Value'
+			}
+
+			return key
+		}
+	},
 	data() {
 		return {
-			dynamic_key: (this.source === 'smm'||this.source ==='baiinfo')? 'Value' 
-			:this.source==='coal'?'Value': 'InputValue',
-			headerArr: this.source === 'gl' 
-			? ['IndexName','IndexCode','FrequencyName','UnitName','UpdateTime']
-			: this.source === 'smm' 
-			? ['IndexName','IndexCode','Frequency','Unit','ModifyTime']
-			: this.source==='coal'
-			? ['IndexName','IndexCode','Frequency','Unit','ModifyTime']
-      : this.source==='baiinfo'
-      ? ['IndexName','IndexCode','Frequency','Unit','ModifyTime']
-			:['QuotaName','LzCode','Frequency','UnitName','ModifyTime'],
+			// dynamic_key: (this.source === 'smm'||this.source ==='baiinfo')? 'Value' 
+			// :this.source==='coal'?'Value': 'InputValue',
+	// 		headerArr: this.source === 'gl' 
+	// 		? ['IndexName','IndexCode','FrequencyName','UnitName','UpdateTime']
+	// 		: this.source === 'smm' 
+	// 		? ['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+	// 		: this.source==='coal'
+	// 		? ['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+    //   : this.source==='baiinfo'
+    //   ? ['IndexName','IndexCode','Frequency','Unit','ModifyTime']
+	// 		:['QuotaName','LzCode','Frequency','UnitName','ModifyTime'],
 			frequencyType:new Map([
 				[1,'日度'],
 				[2,'周度'],
@@ -86,37 +174,37 @@ export default {
 				[5,'年度'],
 				[99,'无固定频率'],
 			]),
-			labelArr: this.source === 'gl' ? new Map([
-				['IndexName', '指标名称'],
-				['IndexCode', '指标ID'],
-				['FrequencyName', '频度'],
-				['UnitName', '单位'],
-				['UpdateTime', '更新时间'],
-			]): this.source === 'smm' ? new Map([
-				['IndexName', '指标名称'],
-				['IndexCode', '指标ID'],
-				['Frequency', '频度'],
-				['Unit', '单位'],
-				['ModifyTime', '更新时间'],
-			]) :this.source === 'coal' ? new Map([
-				['IndexName', '指标名称'],
-				['IndexCode', '指标ID'],
-				['Frequency', '频度'],
-				['Unit', '单位'],
-				['ModifyTime', '更新时间'],
-			]) :this.source==='baiinfo'?new Map([
-        ['IndexName', '指标名称'],
-				['IndexCode', '指标ID'],
-				['Frequency', '频度'],
-				['Unit', '单位'],
-				['ModifyTime', '更新时间'],
-      ]):new Map([
-				['QuotaName', '指标名称'],
-				['LzCode', '指标ID'],
-				['Frequency', '频度'],
-				['UnitName', '单位'],
-				['ModifyTime', '更新时间'],
-			]),
+			// labelArr: this.source === 'gl' ? new Map([
+			// 	['IndexName', '指标名称'],
+			// 	['IndexCode', '指标ID'],
+			// 	['FrequencyName', '频度'],
+			// 	['UnitName', '单位'],
+			// 	['UpdateTime', '更新时间'],
+			// ]): this.source === 'smm' ? new Map([
+			// 	['IndexName', '指标名称'],
+			// 	['IndexCode', '指标ID'],
+			// 	['Frequency', '频度'],
+			// 	['Unit', '单位'],
+			// 	['ModifyTime', '更新时间'],
+			// ]) :this.source === 'coal' ? new Map([
+			// 	['IndexName', '指标名称'],
+			// 	['IndexCode', '指标ID'],
+			// 	['Frequency', '频度'],
+			// 	['Unit', '单位'],
+			// 	['ModifyTime', '更新时间'],
+			// ]) :this.source==='baiinfo'?new Map([
+        	// 	['IndexName', '指标名称'],
+			// 	['IndexCode', '指标ID'],
+			// 	['Frequency', '频度'],
+			// 	['Unit', '单位'],
+			// 	['ModifyTime', '更新时间'],
+      		// ]):new Map([
+			// 	['QuotaName', '指标名称'],
+			// 	['LzCode', '指标ID'],
+			// 	['Frequency', '频度'],
+			// 	['UnitName', '单位'],
+			// 	['ModifyTime', '更新时间'],
+			// ]),
 		};
 	},
 	methods: {

+ 3 - 2
src/utils/buttonConfig.js

@@ -232,8 +232,9 @@ export const dataSourcePermission = {
     /*--------EIA  STEO报告---- */
     eiaData_export:'eiaData:export',
     /*--------国家统计局---- */
-    gjtjjData_export:'gjtjjData:export'
-
+    gjtjjData_export:'gjtjjData:export',
+    /*--------涌益咨询---- */
+    yyzxData_export:'yyzx:exportData'
 }
 
 /*

+ 24 - 192
src/views/dataEntry_manage/thirdBase/YyzxData.vue

@@ -3,7 +3,7 @@
     <div class="left-cont minHeight" id="left">
       <div class="left-top">
         <el-button
-          v-permission="permissionBtn.dataSourcePermission.bcyfData_export"
+          v-permission="permissionBtn.dataSourcePermission.yyzxData_export"
           style="width: 100%"
           type="primary"
           plain
@@ -36,16 +36,17 @@
       <div class="scroll-wrap">
         <el-tree
           ref="treeRef"
-          class="target_tree custom-tree"
+          class="target_tree"
           :data="classifyList"
-          node-key="UniqueCode"
+          node-key="ClassifyId"
           :props="{
             label: 'ClassifyName',
             children: 'Children',
           }"
-          :current-node-key="select_node"
+          :current-node-key="select_classify"
           :expand-on-click-node="false"
           check-strictly
+          highlight-current
           empty-text="暂无分类"
           @current-change="nodeChangeHandle"
         >
@@ -72,7 +73,7 @@
               :tableOption="tableOption"
               tableType="header"
               ref="table"
-              source="baiinfo"
+              source="yyzx"
               @editTarget="editTargetByTable"
             />
           </div>
@@ -81,7 +82,7 @@
               :tableOption="tableOption"
               tableType="data"
               :dateArr="dateArr"
-              source="baiinfo"
+              source="yyzx"
             />
           </div>
           <div v-else class="nodata"></div>
@@ -96,13 +97,13 @@
 
 <script>
 import lzTable from "@/components/lzTable.vue";
-import { baiinfoInterface } from "@/api/api.js";
+import { yongyiInterface } from "@/api/api.js";
 export default {
   name: "Yyzx",
   components: { lzTable },
   data() {
     return {
-      exportBase:process.env.VUE_APP_API_ROOT + "/datamanage/export/baiinfoList", //ssm数据导出接口
+      exportBase:process.env.VUE_APP_API_ROOT + "/datamanage/yongyi/export", //ssm数据导出接口
       dataloading: false,
       rightShow: false,
       select_classify: 0,
@@ -116,98 +117,24 @@ export default {
 
       leftSearchVal: "", //左侧搜索值
       leftSearchTradeCode: "", //如果是搜索选择的 则有此code
-      select_quota: "", // 选择的指标名
-      select_Unit: "", // 选择的单位
-      select_ModifyTime: "", //选中的更新时间
-      select_breed: "", // 选中的分类名称
       isShowSingleData: false, //右侧是否展示的是单个指标数据
-      singleDataCode: "",
     };
   },
   methods: {
     /* 获取分类 */
     getClassify() {
-      baiinfoInterface.classifyList().then((res) => {
+      yongyiInterface.classifyList().then((res) => {
         if (res.Ret !== 200) return;
-        let Data = res.Data.List || [];
-        //对分类数据做处理:
-        this.classifyList = this.formatClassifyData(Data, 1, 0);
+        this.classifyList = res.Data.List || [];
       });
     },
-    formatClassifyData(arr, level, topParentNodeId) {
-      arr.forEach((item) => {
-        const { ClassifyId, BaseFromBaiinfoIndexId, BaseFromBaiinfoIndexCode } =
-          item;
-        //每条数据添加UniqueCode属性,由ClassifyId BaseFromBaiinfoIndexId BaseFromBaiinfoIndexCode拼接
-        item.UniqueCode = `${ClassifyId}_${BaseFromBaiinfoIndexId}_${BaseFromBaiinfoIndexCode}`;
-        //添加Button属性,用于控制操作栏
-        item.Button = {
-          AddButton: true,
-          OpButton: true,
-          DeleteButton: true,
-          MoveButton: true,
-          cleanButton: false,
-          targetDelButton: false,
-        };
-        //未分类禁用所有操作栏
-        if (item.ClassifyId === 0) {
-          item.Button = {
-            AddButton: false,
-            OpButton: false,
-            DeleteButton: false,
-            MoveButton: false,
-            cleanButton: false,
-            targetDelButton: false,
-          };
-        }
-        //二级分类禁用添加按钮
-        if (item.Level === 2) {
-          item.Button = {
-            AddButton: false,
-            OpButton: true,
-            DeleteButton: true,
-            MoveButton: true,
-            cleanButton: false,
-            targetDelButton: false,
-          };
-        }
-        //指标禁用删除按钮
-        if (item.BaseFromBaiinfoIndexCode) {
-          item.Button = {
-            AddButton: false,
-            OpButton: true,
-            DeleteButton: false,
-            MoveButton: true,
-            cleanButton: true,
-            targetDelButton: true,
-          };
-          //未分类下的指标,禁用清除按钮
-          if (topParentNodeId === 0) {
-            item.Button["cleanButton"] = false;
-          }
-        }
-        //非一级分类添加一级父节点id
-        if (level !== 1) {
-          item.topParentNodeId = topParentNodeId;
-        }
-        if (item.Children && item.Children.length) {
-          this.formatClassifyData(
-            item.Children,
-            level + 1,
-            level === 1 ? item.ClassifyId : item.ParentId
-          );
-        }
-      });
-      return arr;
-    },
     /* 获取数据 */
     getDataList: _.throttle(function () {
       this.isShowSingleData = false;
       this.dataloading = true;
-      baiinfoInterface
+      yongyiInterface
         .dataList({
           ClassifyId: this.select_classify,
-          Frequency: this.select_frequency,
           PageSize: this.page_size,
           CurrentIndex: this.page_no,
         })
@@ -278,7 +205,7 @@ export default {
       this.isShowSingleData = true;
       this.dataloading = true;
       try {
-        const res = await baiinfoInterface.getTargetDataList({
+        const res = await yongyiInterface.getTargetDataList({
           IndexCode: code,
         });
         this.rightShow = true;
@@ -357,21 +284,9 @@ export default {
     exportClick() {
       this.btnload = true;
       const link = document.createElement("a");
-      link.href = this.exportSmmapi;
+      link.href = this.exportDataUrl;
       link.download = "";
       link.click();
-      console.log({
-        IndexName: this.select_quota,
-        IndexCode: this.leftSearchTradeCode,
-        sendIndexCode: this.escapeStr(this.leftSearchTradeCode),
-        TypeName: this.select_breed,
-        sendTypeName: this.escapeStr(this.select_breed),
-        Frequency: this.select_frequency,
-        UnitName: this.select_Unit,
-        ModifyTime: this.select_ModifyTime,
-        sendToken: this.escapeStr(localStorage.getItem("auth") || ""),
-        url: this.exportSmmapi,
-      });
       setTimeout(() => {
         this.btnload = false;
       }, 5000);
@@ -380,7 +295,7 @@ export default {
     async handleLeftSearch(query, cb) {
       cb([]);
       if (!query) return;
-      const res = await baiinfoInterface.getTargetListByName({
+      const res = await yongyiInterface.getTargetListByName({
         Keyword: query,
       });
       if (res.Ret === 200) {
@@ -395,53 +310,13 @@ export default {
     // 选中左侧搜索值
     handleSelectLeftSearchval(e) {
       if (!e.IndexCode) return;
-      //this.select_frequency=e.Frequency
-      //this.select_classify=e.Type2+'#'+e.Type3
       this.leftSearchTradeCode = e.IndexCode;
       this.leftSearchVal = e.IndexName;
-      this.select_quota = e.IndexName;
-      this.select_Unit = e.Unit;
-      this.select_ModifyTime = e.ModifyTime;
-      this.select_breed = "";
-      // 关闭watcher
-      this.isAuto = false;
 
       // 获取单独指标数据
       this.getTargetDataList(e.IndexCode);
-
-      this.$nextTick(() => {
-        //找到父节点并展开
-        const targetData = this.getTargetData(e.IndexCode, this.classifyList);
-        if (targetData) {
-          //一级节点
-          const { topParentNodeId, UniqueCode } = targetData;
-          this.handleNodeExpand({ UniqueCode: `${topParentNodeId}_0_` });
-          //二级节点
-          if (topParentNodeId !== 0) {
-            const secondNodeId = UniqueCode.split("_")[0];
-            this.handleNodeExpand({ UniqueCode: `${secondNodeId}_0_` });
-          }
-          //节点样式变化
-          const tree = $(".target_tree")[0];
-          let width = tree.offsetWidth;
-          let label_width =
-            width > 500 ? "auto" : width <= 500 ? 90 : 0.7 * width;
-          targetData.NodeWidth = label_width;
-          this.select_node = UniqueCode;
-          this.$refs.treeRef.setCurrentNode(targetData);
-          const node = this.$refs.treeRef.getCurrentNode();
-          this.resetNodeStyle(node);
-        }
-        //this.handleScrollLeftWrap()
-      });
-    },
-    // 左侧滚动
-    handleScrollLeftWrap() {
-      let top = $(".act")[0].offsetTop;
-      $(".classify-list").animate({
-        scrollTop: top - 200,
-      });
     },
+
     getTargetData(code, arr) {
       for (const item of arr) {
         if (item.BaseFromBaiinfoIndexCode === code) return item;
@@ -455,72 +330,29 @@ export default {
     escapeStr(str) {
       return str.replace(/#/g, escape("#")).replace(/;/g, escape(";")); 
     },
-    checkNode(data, node) {
-      const { level, parent } = node;
-      const parentNodeId = parent.data.ClassifyId;
-      const Children = data.Children || [];
-      //如果是二级分类 或是一级分类的未分类
-      if (
-        (level === 2 && parentNodeId !== 0 && Children.length) ||
-        (level === 1 && data.ClassifyId === 0 && Children.length)
-      ) {
-        this.getClassifyData(data.ClassifyId);
-        //如果是指标
-      } else if (level === 3 || (level === 2 && parentNodeId === 0)) {
-        this.getBaiinfoData(data.BaseFromBaiinfoIndexCode);
-        //如果是一级分类或空的二级指标
-      } else if (level === 1 || (level === 2 && !Children.length)) {
-        this.rightShow = false;
-        this.isShowSingleData = false;
-      }
-    },
+  
     //改变选中节点
     nodeChangeHandle(data, node) {
-      if (data.UniqueCode === this.select_node) return;
-      this.dynamicNode = node;
-      this.select_node = data.UniqueCode;
+      if (data.ClassifyId === this.select_classify) return;
+      this.select_classify = data.ClassifyId;
+      this.leftSearchVal=''
       this.page_no = 1;
       this.page_size = 20;
-      this.resetNodeStyle(node);
-      this.checkNode(data, node);
-    },
-    //获取二级分类的表格数据
-    async getClassifyData(id) {
-      this.select_classify = id;
-      this.select_frequency = "";
-      await this.getFrequency();
-      this.getDataList();
-    },
-    //获取指标数据
-    getBaiinfoData(code) {
-      this.singleDataCode = code;
-      this.getTargetDataList(code);
+      this.getDataList()
     },
    
   },
   computed: {
-    exportSmmapi() {
-      // smm数据导出接口
+    exportDataUrl() {
+      // 数据导出接口
       let urlStr = this.exportBase;
       // token
       urlStr += `?${localStorage.getItem("auth") || ""}`;
       if (this.isShowSingleData) {
         // 指标id
         urlStr += `&IndexCode=${
-          this.isShowSingleData ? this.singleDataCode : ""
+          this.isShowSingleData ? this.leftSearchTradeCode : ""
         }`;
-        // 指标名称参数
-        urlStr += `&IndexName=${this.select_quota}`;
-        /* // 指标id
-        urlStr+=`&IndexCode=${this.leftSearchTradeCode}` */
-        // 分类名称
-        urlStr += `&TypeName=${this.select_breed}`;
-        // 频度
-        urlStr += `&Frequency=${this.select_frequency}`;
-        // 单位
-        urlStr += `&UnitName=${this.select_Unit}`;
-        // 修改时间
-        urlStr += `&ModifyTime=${this.select_ModifyTime}`;
       } else {
         // 目录id
         urlStr += `&ClassifyId=${