Karsa 3 ヶ月 前
コミット
0f1dc33f1f

+ 3 - 0
src/utils/buttonConfig.js

@@ -300,9 +300,12 @@ export const dataSourcePermission = {
 
     /* 卓创红期 */
     sciHongqi_batch_addBase: 'sciHongqi:batch:addBase',//批量添加到指标库
+    sciHongqi_batch_del: 'sciHongqi:batch:del',//批量删除
+    sciHongqi_batch_edit: 'sciHongqi:batch:edit',//批量编辑
     sciHongqi_view: 'sciHongqi:view',//查看
     sciHongqi_export: 'sciHongqi:export',//导出Excel
     sciHongqi_classify_edit: 'sciHongqi:classify:edit',//分类编辑
+    sciHongqi_classify_add: 'sciHongqi:classify:add',//分类添加
     sciHongqi_classify_move: 'sciHongqi:classify:move',//分类移动
     sciHongqi_classify_del: 'sciHongqi:classify:del',//分类删除
     sciHongqi_opera_addBase: 'sciHongqi:opera:addBase',//指标入库

+ 191 - 33
src/views/dataEntry_manage/thirdBase/zhuochuangRedStageBase.vue

@@ -3,25 +3,27 @@
     <div class="header">
       <div class="left-btn">
         <el-button
-          v-permission="permissionBtn.dataSourcePermission.mysteelData_batchAddEdb"
+          v-permission="permissionBtn.dataSourcePermission.sciHongqi_batch_addBase"
           type="primary" 
           size="medium" 
           @click="isBatchAddIndicsDiaShow = true"
         ><!-- 批量加入指标库 -->{{$t('SteelChemicalPage.batch_add_edb_btn')}}</el-button>
         <el-button
-          v-permission="permissionBtn.dataSourcePermission.mysteelData_batchAddEdb"
+          v-permission="permissionBtn.dataSourcePermission.sciHongqi_batch_del"
           type="primary" 
-          size="medium" 
+          size="medium"
+          plain
           @click="isBatchAddIndicsDiaShow = true"
         >批量删除</el-button>
         <el-button
-          v-permission="permissionBtn.dataSourcePermission.mysteelData_batchAddEdb"
+          v-permission="permissionBtn.dataSourcePermission.sciHongqi_batch_edit"
           type="primary" 
-          size="medium" 
+          size="medium"
+          plain
           @click="isBatchAddIndicsDiaShow = true"
         >批量编辑</el-button>
         <el-button
-          v-permission="permissionBtn.dataSourcePermission.mysteelData_export"
+          v-permission="permissionBtn.dataSourcePermission.sciHongqi_export"
           type="primary"
           plain
           size="medium"
@@ -95,42 +97,44 @@
             @node-collapse="handleNodeCollapse"
             @current-change="nodeChangeHandle"
             @node-drop="dropOverHandle"
-            @node-drag-end="dropMouseLeave"
-            @node-drag-leave="dropMouseLeave"
-            @node-drag-enter="dropMouseOver"
           >
             <div class="custom-tree-node" slot-scope="{ node, data }">
-              <span
+              <div
                 class="text_oneLine"
                 :style="`width:${
                   (select_node === data.UniqueCode && node.Nodewidth) || ''
                 }`"
-                >{{ currentLang==='zh' ? data.ClassifyName : (data.ClassifyNameEn||data.ClassifyName) }}</span
+              >
+                <span v-if="data.IndexCode">{{data.IndexName}}</span>
+                <span v-else>
+                  {{ currentLang==='zh' ? data.ClassifyName : data.ClassifyNameEn }}
+                </span>
+              </div
               >
               <div v-if="select_node === data.UniqueCode">
                 <img
                   src="~@/assets/img/data_m/move_ico.png"
-                  v-if="data.Button.MoveButton"
-                  alt=""
+                  v-if="permissionBtn.isShowBtn('dataSourcePermission','sciHongqi_classify_move')"
                   style="width: 14px; height: 14px; margin-right: 5px"
                   @click.stop="clickClassifyHandle('move', data, node)"
                 />
                 <img
                   src="~@/assets/img/set_m/add.png"
-                  style="width: 14px; height: 14px; margin-right: 5px"
+                  style="width: 14px; height: 14px; 
+                  margin-right: 5px"
+                  v-if="node.level===1"
                   @click.stop="clickClassifyHandle('add', data, node)"
-                  v-if="data.Button.AddButton&&permissionBtn.isShowBtn('dataSourcePermission','mysteelData_classifyOpt_add')"
                 />
                 <img
                   src="~@/assets/img/set_m/edit.png"
-                  v-if="data.Button.OpButton&&permissionBtn.isShowBtn('dataSourcePermission','mysteelData_classifyOpt_edit')"
+                  v-if="permissionBtn.isShowBtn('dataSourcePermission','sciHongqi_classify_edit')"
                   alt=""
                   style="width: 14px; height: 14px; margin-right: 5px"
                   @click.stop="clickClassifyHandle('edit', data, node)"
                 />
                 <img
                   src="~@/assets/img/set_m/del.png"
-                  v-if="data.Button.DeleteButton&&permissionBtn.isShowBtn('dataSourcePermission','mysteelData_classifyOpt_delete')"
+                  v-if="permissionBtn.isShowBtn('dataSourcePermission','sciHongqi_classify_del')"
                   alt=""
                   style="width: 14px; height: 14px"
                   @click.stop="clickClassifyHandle('del', data, node)"
@@ -139,7 +143,8 @@
             </div>
           </el-tree>
 
-          <div class="add-cont" @click="addClassifyHandle" v-if="permissionBtn.isShowBtn('dataSourcePermission','mysteelData_classifyOpt_add')">
+          <div class="add-cont" @click="addClassifyHandle" >
+            <!-- v-if="permissionBtn.isShowBtn('dataSourcePermission','sciHongqi_classify_add')" -->
             <img
               src="~@/assets/img/set_m/add_ico.png"
               alt=""
@@ -313,7 +318,7 @@ export default {
       return [
         {  label: this.$t('Edb.Detail.e_id'),key: 'IndexCode' },
         {  label: this.$t('Edb.Detail.e_name'),key: 'IndexName',minwidthsty:'150px' },
-        {  label: this.$t('Edb.Detail.e_fre'),key: 'Frequency',widthsty:'100px' },
+        {  label: this.$t('Edb.Detail.e_fre'),key: 'Frequency' },
         {  label: this.$t('Edb.Detail.e_unit'),key: 'Unit', },
         {  label: this.$t('Edb.Detail.e_update_time'),key: 'ModifyTime', },
       ]
@@ -323,14 +328,11 @@ export default {
     return {
       isLeftWrapShow:true,
       dataloading: false,
-      exportBase:
-        process.env.VUE_APP_API_ROOT +
-        "/datamanage/mysteel_chemical/export/dataList", //数据导出接口
+      exportBase:process.env.VUE_APP_API_ROOT + "/datamanage/export/sciHqList", //数据导出接口
 
       selectClassify:0,
       leftSearchVal: "",
       classifyList: [],
-      dynamicNode: null,
       defaultShowNodes: [], //展开节点
     
       selectEdb: 0,
@@ -435,21 +437,14 @@ export default {
 
     /* 改变节点 */
     nodeChangeHandle(data, node) {
-      if (this.dataloading)
-        return this.$message(this.$t('MsgPrompt.request_frequency'));
-      this.dynamicNode = node;
+     
       this.select_node = data.UniqueCode;
       this.selectClassify = data.ClassifyId;
       this.selectEdb = data.BaseFromSciHqIndexId;
-      this.index_code = data.IndexCode
-
-      this.rightShow = false;
-      this.leftSearchVal = "";
-
-      this.resetNodeStyle(node);
+      this.index_code = data.IndexCode;
     },
 
-    /* 钢联数据导出 */
+    /* 数据导出 */
     exportClick() {
       this.btnload = true;
 
@@ -636,6 +631,169 @@ export default {
     escapeStr(str) {
       return str.replace(/#/g, escape("#")).replace(/;/g, escape(";"));
     },
+
+     // 树节点展开
+    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;
+        }
+      });
+    },
+
+    /* 判断节点是否能被拖拽 */
+    canDragHandle({data}) {
+      return true
+    },
+
+    /* 判断节点是否能被拖入 */
+    canDropHandle(draggingNode, dropNode, type) {
+      let canDrop = false;
+      // 移动的是一级目录
+      if (draggingNode.level === 1 && dropNode.level === 1 &&type!=='inner') {
+        canDrop = true;
+      }
+
+      // 二级
+      if (draggingNode.level === 2) {
+        if (
+          (dropNode.level === 1 && type === "inner") ||
+          (dropNode.level === 2 && type !== "inner")
+        ) {
+          canDrop = true;
+        }
+      }
+
+      //三级指标层
+			if(draggingNode.level===3){
+				if(
+          (dropNode.level===2&&type==='inner')||
+          (dropNode.level===3&&type!=='inner')
+        ) {
+					canDrop=true
+				}
+			}
+
+      return canDrop;
+    },
+
+
+    /* 拖拽完成 */
+    dropOverHandle(b, a, i, e) {
+      // console.log(i, a);
+      // 被拖拽节点对应的 Node、结束拖拽时最后进入的节点、被拖拽节点的放置位置
+      // 一/二级目录
+      if ([1,2].includes(b.level)) this.handleMoveCatalogue(b, a, i, e);
+
+      // 指标层
+      if (b.level === 3) this.handleMoveEdb(b, a, i, e);
+    },
+
+    // 移动的为一二级目录
+    handleMoveCatalogue(b, a, i, e) {
+      let list = a.parent.childNodes,
+        targetIndex = 0,
+        PrevClassifyId = 0,
+        NextClassifyId = 0,
+        ParentClassifyId=0;
+
+      list.forEach((item, index) => {
+        if (item.data.ClassifyId === b.data.ClassifyId) {
+          targetIndex = index;
+          return;
+        }
+      });
+
+      if(targetIndex===0){
+				PrevClassifyId=0
+				NextClassifyId=list[targetIndex+1].data.ClassifyId
+			}else if(targetIndex===list.length-1){
+				PrevClassifyId=list[targetIndex-1].data.ClassifyId
+				NextClassifyId=0
+			}else{
+				PrevClassifyId=list[targetIndex-1].data.ClassifyId
+				NextClassifyId=list[targetIndex+1].data.ClassifyId
+			}
+
+			if(b.level===2){
+				if(i==='inner'){
+					ParentClassifyId=a.data.ClassifyId
+					PrevClassifyId=0
+					NextClassifyId=a.data.Children.length>1?a.data.Children[1].ClassifyId:0
+				}else{
+					ParentClassifyId=a.data.ParentId
+				}
+			}
+
+			zhuochuangRedStageInterface.classifyMove({
+          ClassifyId: b.data.ClassifyId,
+          PrevClassifyId: PrevClassifyId,
+          NextClassifyId: NextClassifyId,
+          ParentClassifyId: ParentClassifyId
+        })
+        .then((res) => {
+          if (res.Ret !== 200) return;
+          this.$message.success(this.$t('MsgPrompt.move_success_msg'));
+          this.getClassify();
+        });
+
+    },
+
+    // 移动指标
+    handleMoveEdb(b, a, i, e) {
+      let PrevEdbId = 0,
+        NextEdbId = 0,
+        targetIndex = 0,
+        list = a.parent.data.Children;
+      if (i === "inner") {
+        PrevEdbId = 0;
+        NextEdbId =
+          a.data.Children.length > 1 ? a.data.Children[1].BaseFromSciHqIndexId : 0;
+      } else {
+        list.forEach((item, index) => {
+          if (item.BaseFromSciHqIndexId === b.data.BaseFromSciHqIndexId) {
+            targetIndex = index;
+            return;
+          }
+        });
+
+        if (targetIndex === 0) {
+          PrevEdbId = 0;
+          NextEdbId = list[targetIndex + 1].BaseFromSciHqIndexId;
+        } else if (targetIndex === list.length - 1) {
+          PrevEdbId = list[targetIndex - 1].BaseFromSciHqIndexId;
+          NextEdbId = 0;
+        } else {
+          PrevEdbId = list[targetIndex - 1].BaseFromSciHqIndexId;
+          NextEdbId = list[targetIndex + 1].BaseFromSciHqIndexId;
+        }
+      }
+
+      zhuochuangRedStageInterface.edbMove({
+          ClassifyId: a.data.ClassifyId,
+          BaseFromSciHqIndexId: b.data.BaseFromSciHqIndexId,
+          PrevBaseFromSciHqIndexId: PrevEdbId,
+          NextBaseFromSciHqIndexId: NextEdbId,
+        })
+        .then((res) => {
+          if (res.Ret !== 200) return;
+          this.$message.success(this.$t('MsgPrompt.move_success_msg'));
+          this.getClassify();
+        });
+
+    },
   },
 
 };