Karsa пре 6 месеци
родитељ
комит
2ddf308d05
1 измењених фајлова са 37 додато и 13 уклоњено
  1. 37 13
      src/views/dataEntry_manage/thirdBase/components/addToBaseDia.vue

+ 37 - 13
src/views/dataEntry_manage/thirdBase/components/addToBaseDia.vue

@@ -18,24 +18,27 @@
             height="500px"
           >
             <el-table-column :label="$t('Edb.Detail.e_id')" align="center" prop="IndexCode"/>
-            <el-table-column :label="$t('Edb.Detail.e_name')" align="center">
+            <el-table-column :label="$t('Edb.Detail.e_name')" align="center" width="210px">
                 <template slot-scope="scope">
+                  <div class="name-cell">
                       <el-input 
                         v-model="scope.row.IndexName" 
                         placeholder="请填写指标名称" 
-                        style="width:100%"
+                        style="width:100%;margin:5px 0;"
+                        :class="existNameArr.includes(scope.row.IndexName)&&'error-ipt'"
                       />
-                      <div class="error">
-                        <!-- <span>指标名称已存在,请重新填写</span> -->
-                      </div>
+                    <div class="error" v-if="existNameArr.includes(scope.row.IndexName)">
+                      <span>指标名称已存在,请重新填写</span>
+                    </div>
+                  </div>
                 </template>
             </el-table-column>
-            <el-table-column :label="$t('Edb.Detail.e_unit')" align="center" width="200px">
+            <el-table-column :label="$t('Edb.Detail.e_unit')" align="center" width="150px">
                 <template slot-scope="scope">
                     <selectUnit v-model="scope.row.Unit"/>
                 </template>
             </el-table-column>
-            <el-table-column :label="$t('Edb.Detail.e_fre')" align="center" width="200px">
+            <el-table-column :label="$t('Edb.Detail.e_fre')" align="center" width="120px">
               <template slot-scope="scope">
                 <el-select
                   v-model="scope.row.Frequency"
@@ -51,8 +54,8 @@
                 </el-select>
               </template>
             </el-table-column>
-            <el-table-column align="center" width="300px">
-                <template slot="header">
+            <el-table-column align="center" width="280px">
+                <template slot="header" slot-scope="scope">
                     <span style="margin-right:40px;display:inline-block">目录</span>
                     <el-radio-group 
                       v-model="classifyType"
@@ -117,6 +120,8 @@ export default {
 				checkStrictly: true,
         emitPath:false
 			},
+
+      existNameArr:[]
     };
   },
   watch: {
@@ -151,6 +156,7 @@ export default {
     },
 
     cancelHandle() {
+      this.existNameArr = [];
       this.$emit('update:isShow',false)
     },
 
@@ -176,16 +182,16 @@ export default {
           this.tableData.map(_=>({EdbCode:_.IndexCode,EdbName:_.IndexName}))
       ).then(res=>{
           if(res.Ret!==200) return 
-          this.existNameArr = res.Data.filter(i=>i.Exist)
+          this.existNameArr = res.Data.filter(i=>i.Exist).map(_=>_.EdbName)
 
-          if(this.existNameArr.length) return
+          if(this.existNameArr.length) return 
           this.handleSave()
       })
     },
 
     handleSave() {
 
-      let haveIncomplete = this.tableData.some(_ => !_.IndexName||!_.ClassifyId)
+      let haveIncomplete = this.tableData.some(_ => !_.IndexName||!_.ClassifyId||!_.Unit)
       if(haveIncomplete) return this.$message.warning('指标信息填写不完整')
 
       this.saveLoading = true;
@@ -211,10 +217,28 @@ export default {
   },
 };
 </script>
+<style lang="scss" scoped>
+.add-dialog-wrap {
+  .name-cell {
+    position: relative;
+    .error {
+      position: absolute;
+      bottom: -16px;
+      color: #f00;
+    }
+  }
+}
+</style>
 <style lang="scss">
 .add-dialog-wrap {
-   .el-cascader .el-input{
+    .error-ipt .el-input__inner{
+      border-color: #f00;
+    }
+    .el-cascader .el-input{
       width: 100%;
     }
+    .el-table .cell {
+      overflow: visible;
+    }
 }
 </style>