Browse Source

ETA1.3.7 提测

hbchen 1 year ago
parent
commit
cb09a0c4f9

BIN
src/assets/img/add-quadrate-blue.png


BIN
src/assets/img/delete-minus-red.png


+ 1 - 1
src/components/lzTable.vue

@@ -38,7 +38,7 @@
 			>
 				<th>{{date}}</th>
 				<td v-for="(data, sub_index) in tableOption" :key="sub_index">
-					{{data.DataList.find(item => date === item.DataTime) ? 
+					{{data.DataList && data.DataList.find(item => date === item.DataTime) ? 
 					data.DataList.find(item => date === item.DataTime)[dynamic_key]
 					: ''}}
 				</td>

+ 177 - 60
src/views/dataEntry_manage/thirdBase/components/batchAddEdbDia.vue

@@ -8,51 +8,54 @@
     @close="cancelHandle"
     custom-class="dialog"
     center
-    width="800px"
+    width="780px"
+    v-dialogDrag
   >
     <div
     v-loading="isAddLoading"
     element-loading-text="加载时间大概五分钟,关闭弹窗不影响加载"
     element-loading-spinner="el-icon-loading">
       <div class="dialog-main">
+        <el-row :gutter="10" class="row" style="margin-bottom: 15px;">
+          <el-col style="width: 250px;" class="col title-col">指标ID</el-col>
+          <el-col style="width: 382px;" class="col title-col">所属分类</el-col>
+        </el-row>
         <el-form :model="edbForm" ref="edbFormDataListRef" >
-          <el-table :data="edbForm.edbDataList" max-height="500px">
-            <el-table-column label="指标ID">
-              <template slot-scope="{row,$index}">
-                <el-form-item :prop="`edbDataList.${$index}.edbId`" 
-                :rules="[{required:true,message:'指标ID不能为空',trigger:'blur'},
-                          {validator:checkAge,trigger:'blur'}]">
-                  <el-input v-model.trim="row.edbId" placeholder="请输入指标ID"></el-input>
-                </el-form-item>
-              </template>
-            </el-table-column>
-            <el-table-column label="所属分类">
-              <template slot-scope="{row,$index}">
-                <el-form-item :prop="`edbDataList.${$index}.classify`" 
-                :rules="{required:true,message:'所属分类不能为空',trigger:'blur'}">
-                  <el-cascader
-                    class="classify-cascader"
-                    v-model="row.classify"
-                    :options="classifyOptions"
-                    :key="$index"
-                    :props="{
-                      label: 'ClassifyName',
-                      value: 'BaseFromMysteelChemicalClassifyId',
-                      children: 'Children',
-                      emitPath: false,
-                    }"
-                    placeholder="请选择分类"
-                  />
-                </el-form-item>
-              </template>
-            </el-table-column>
-            <el-table-column label="操作" width="80px">
-              <template slot-scope="{row,$index}">
-                <span v-if="edbForm.edbDataList.length>1" @click="delEdbItem($index)">删除</span>
-                <span v-if="$index==(edbForm.edbDataList.length-1)" @click="addEdbItem(row,`edbDataList.${$index}`)">添加</span>
-              </template>
-            </el-table-column>
-          </el-table>
+          <div class="form-box" ref="formBoxRef">
+            <el-row v-for="(item,index) in edbForm.edbDataList" :key="item.edbIndex" :gutter="10" class="row">
+            <el-col class="col edb-col">
+              <el-form-item :prop="`edbDataList.${index}.IndexCode`" 
+              :rules="[{required:true,message:'指标ID不能为空',trigger:'blur'},
+                        {validator:checkAge,trigger:'blur'}]">
+                <el-input v-model.trim="item.IndexCode" placeholder="请输入指标ID"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col class="col classify-col">
+              <el-form-item :prop="`edbDataList.${index}.BaseFromMysteelChemicalClassifyId`" 
+              :rules="{required:true,message:'所属分类不能为空',trigger:'change'}">
+                <el-cascader
+                  class="classify-cascader"
+                  :ref="'classifyCascader'+item.edbIndex"
+                  v-model="item.BaseFromMysteelChemicalClassifyId"
+                  :options="classifyOptions"
+                  :key="item.edbIndex"
+                  :props="{
+                    label: 'ClassifyName',
+                    value: 'BaseFromMysteelChemicalClassifyId',
+                    children: 'Children',
+                    emitPath: false,
+                  }"
+                  placeholder="请选择分类"
+                />
+              </el-form-item>
+            </el-col>
+            <img src="~@/assets/img/delete-minus-red.png" @click="delEdbItem(index)"/>
+          </el-row>
+          </div>
+          <div class="add-box" @click="addEdbItem">
+            <img src="~@/assets/img/add-quadrate-blue.png"/>
+            <span>添加</span>
+          </div>
         </el-form>
       </div>
       <div class="dia-bot">
@@ -66,6 +69,8 @@
 </template>
 
 <script>
+import { steelInterface } from "@/api/modules/thirdBaseApi";
+
   export default {
     props: {
       isOpenDialog: {
@@ -89,31 +94,73 @@
         // 不能输入中文和空格
         let reg = /[\u4e00-\u9fa5]+|\s+/
         if(reg.test(value)){
-          return callback(new Error('不能输入中文和空格'))
+          callback(new Error('不能输入中文和空格'))
+        }else{
+          callback()
         }
       }
       return{
         isAddLoading: false,
         classifyOptions:[],
-        edbForm:{edbDataList:[{edbId:'',classify:''}]}
+        // edbIndex 仅前端使用的唯一标识
+        edbForm:{edbDataList:[{edbIndex:1,IndexCode:'',BaseFromMysteelChemicalClassifyId:''}]},
+        timer:null,
+        emitParams:{},
+        getAddBack:false
       }
     },
     methods:{
       saveHandle(){
         this.$refs.edbFormDataListRef.validate((valid)=>{
           if(valid){
-            console.log('验证通过');
+            // console.log(this.edbForm.edbDataList);
+            steelInterface.edbAdd({List:this.edbForm.edbDataList}).then(res=>{
+                if (res.Ret !== 200) return;
+                this.isAddLoading = true;
+                console.log(this.edbForm.edbDataList);
+                let edbItem = this.edbForm.edbDataList.find(it => it.IndexCode.toUpperCase() == res.Data.IndexCode.toUpperCase())
+                if(!edbItem) return 
+                let edbIndexCurrent = edbItem?edbItem.edbIndex:0
+                let selectClassifyNodes=this.$refs['classifyCascader'+edbIndexCurrent][0].getCheckedNodes()[0].path
+                this.emitParams={
+                  code: res.Data.UniqueCode,
+                  id: res.Data.BaseFromMysteelChemicalIndexId,
+                  selectClassifyNodes
+                }
+                this.getAddBack=true
+                setTimeout(() => {
+                  this.cancelHandle();
+                  
+                }, 5*60000);
+              })
+          
           }else{
             this.$message.error("验证不通过,请检查")
+            let errorElDom = this.$refs.edbFormDataListRef.fields.filter((item) => {
+              return item.validateState === 'error';
+            });
+            let errorOffsetTops = errorElDom.map((item) => {
+              return item.$el
+            })
+            // 滚动到指定节点
+            errorOffsetTops[0].scrollIntoView({
+                // 值有start,center,end,nearest
+                block: 'start'
+            })
           }
         })
       },
       /* 取消 */
       cancelHandle() {
         this.isAddLoading = false;
-        this.edbForm={edbDataList:[{edbId:'',classify:''}]}
+        this.edbForm={edbDataList:[{edbIndex:1,IndexCode:'',BaseFromMysteelChemicalClassifyId:''}]}
         this.$refs.edbFormDataListRef.resetFields();
         this.$emit("update:isOpenDialog", false);
+        if(this.getAddBack){
+          this.getAddBack=false
+          this.$emit("successCallback", this.emitParams);
+        }
+        // clearTimeout(this.timer)
       },
       // 递归改变第三级目录结构
       filterNodes(arr) {
@@ -127,32 +174,88 @@
             }
           });
       },
-      addEdbItem(row,prop){
-        let propArray=Object.keys(row).map(key=> prop+'.'+key )
-        console.log(row,'row',propArray,'propArray');
-        let errorFlag=false
-        this.$refs.edbFormDataListRef.validateField(propArray,(error)=>{
-          if(error){
-            errorFlag=true
+      addEdbItem(){
+        this.$refs.edbFormDataListRef.validate(valid=>{
+          if(valid){
+            if(this.edbForm.edbDataList.length>=100){
+              this.$message.warning('添加数量已达上限(上限100)!')
+              return 
+            }
+            let lastItem = this.edbForm.edbDataList[this.edbForm.edbDataList.length-1]
+            this.edbForm.edbDataList.push({
+              edbIndex:1+lastItem.edbIndex,
+              IndexCode:'',
+              BaseFromMysteelChemicalClassifyId:lastItem.BaseFromMysteelChemicalClassifyId
+            })
+            this.$nextTick(()=>{
+              // console.log(this.$refs.formBoxRef.scrollTop,this.$refs.formBoxRef.scrollHeight,'');
+              this.$refs.formBoxRef.scrollTop = this.$refs.formBoxRef.scrollHeight
+            })
+
+          }else{
+            // console.log(this.$refs.edbFormDataListRef.fields,'this.$refs.edbFormDataListRef.fields');
+            let errorElDom = this.$refs.edbFormDataListRef.fields.filter((item) => {
+              return item.validateState === 'error';
+            });
+            let errorOffsetTops = errorElDom.map((item) => {
+              return item.$el
+            })
+            // 滚动到指定节点
+            errorOffsetTops[0].scrollIntoView({
+                // 值有start,center,end,nearest
+                block: 'start'
+            })
           }
         })
-        if(errorFlag) return 
-        if(this.edbForm.edbDataList.length>=100){
-          this,$message.warning('添加数量已达上限(上限100)!')
-          return 
-        }
-        this.edbForm.edbDataList.push({edbId:'',classify:row.classify})
       },
       delEdbItem(index){
         this.edbForm.edbDataList.splice(index,1)
       }
-    }
+    },
   }
 </script>
 
 <style lang="scss" scoped>
 .dialog-main {
-  padding-left: 50px;
+  padding: 0 35px;
+  .form-box{
+    max-height: 450px;
+    overflow-y: auto;
+    overflow-x: hidden;
+    scroll-behavior: smooth;
+  }
+  .add-box{
+    display: flex;
+    align-items: center;
+    cursor: pointer;
+    margin-top: 10px;
+    img{
+      height: 18px;
+      width: 18px;
+      margin-right: 7px;
+    }
+    span{
+      font-size: 14px;
+      color: #0052D9;
+    }
+  }
+  .row{
+    .title-col{
+      color: #333333;
+    }
+    .edb-col{
+      width: 250px;
+    }
+    .classify-col{
+      width: 382px;
+    }
+    img{
+      height: 18px;
+      width: 18px;
+      margin: 10px 0 0 8px;
+      cursor: pointer;
+    }
+  }
 }
 
 .dia-bot {
@@ -162,7 +265,21 @@
 }
 </style>
 <style lang="scss">
-// .dialog-main .classify-cascader .el-input {
-//   width: 100%;
-// }
+.form-box{
+  .el-form-item{
+    margin-bottom: 18px;
+  }
+}
+.col{
+  .el-input{
+    width: 100%;
+    height: 38px;
+    .el-input__inner{
+      height: 38px;
+    }
+  }
+  .classify-cascader{
+    min-width: 100%;
+  }
+}
 </style>

+ 2 - 2
src/views/dataEntry_manage/thirdBase/components/targetDialog.vue

@@ -196,10 +196,10 @@ export default {
             ...params,
             BaseFromMysteelChemicalIndexId: edb_id,
           })
-        : await steelInterface.edbAdd({
+        : await steelInterface.edbAdd([{
             ...params,
             IndexCode: from_edb_code,
-          });
+          }]);
       if (Ret !== 200) return;
 
       if (!edb_id) {

+ 7 - 3
src/views/dataEntry_manage/thirdBase/mixins/leftMixin.js

@@ -38,11 +38,15 @@ export default {
 
   methods: {
     /* 根据unicode展开树结构并选中 */
-    selectCurrentNode({ code, id, type }) {
+    selectCurrentNode({ code, id, type ,selectClassifyNodes}) {
       let deep_arr = _.cloneDeep(this.classifyList);
       // 查找图表的分类父级id
-      let arr = this.findParentNodeHandle(deep_arr, code).slice(1).reverse(); // 父的父的父-父的父-父
-      this.defaultShowNodes = arr;
+      if(selectClassifyNodes && selectClassifyNodes.length>0){
+        this.defaultShowNodes = selectClassifyNodes;
+      }else{
+        let arr = this.findParentNodeHandle(deep_arr, code).slice(1).reverse(); // 父的父的父-父的父-父
+        this.defaultShowNodes = arr;
+      }
       this.select_node = code;
       this.$refs.treeRef.setCurrentKey(this.select_node);
       // // 重置筛选状态

+ 34 - 7
src/views/dataEntry_manage/thirdBase/steelChemicalbase.vue

@@ -232,9 +232,9 @@
       @successCallback="addSuccessCallback"
     />
     <!-- 批量添加指标弹窗 -->
-    <batch-add-edb-dia :isOpenDialog.sync="batchAddDiaShow" :classifyList="classifyList">
-
-    </batch-add-edb-dia>
+    <batch-add-edb-dia :isOpenDialog.sync="batchAddDiaShow" 
+    :classifyList="classifyList" 
+    @successCallback="addSuccessCallback"/>
   </div>
 </template>
 
@@ -270,6 +270,7 @@ export default {
       isRefresh: false,
 
       edb_id: "", //搜索指标id
+      index_code: "", //添加指标后的code,无论是否加载出来,无论是否加载成功
       select_node: "",
       dynamicNode: null,
       defaultShowNodes: [], //展开节点
@@ -331,7 +332,33 @@ export default {
               : "";
 
           this.page_no = 1;
-          this.select_frequency && this.getDataList();
+          if(!this.select_frequency){
+            if(this.index_code){
+              this.tableOption=[{
+                IndexName:'',
+                IndexCode:this.index_code,
+                FrequencyName:'',
+                UnitName:'',
+                UpdateTime:''
+              }]
+              //为了美观
+              for (let i = 0; i < 6; i++) {
+                this.tableOption.push({
+                  IndexName:'',
+                  IndexCode:'',
+                  FrequencyName:'',
+                  UnitName:'',
+                  UpdateTime:''
+                })
+              }
+              //为了美观
+              this.dateArr=new Array(12).fill('')
+              this.haveMore=false
+              this.rightShow=true
+            }
+          }else{
+            this.getDataList();
+          }
         });
     },
 
@@ -402,7 +429,6 @@ export default {
             }
 
           this.dataloading = false;
-          
           this.rightShow = true;
           this.page_no === 1 &&
             this.$nextTick(() => {
@@ -424,6 +450,7 @@ export default {
       this.select_node = data.UniqueCode;
       this.select_classify = data.BaseFromMysteelChemicalClassifyId;
       this.edb_id = data.BaseFromMysteelChemicalIndexId;
+      this.index_code = data.IndexCode
 
       this.select_frequency = "";
       this.rightShow = false;
@@ -633,8 +660,8 @@ export default {
     },
 
     /* 添加后回调 */
-    addSuccessCallback({ code, id }) {
-      this.getClassify({ code, id });
+    addSuccessCallback({ code, id,selectClassifyNodes}) {
+      this.getClassify({ code, id,selectClassifyNodes});
     },
 
     // 对[# ;]转义