Browse Source

fix(附加数据):优化

xiebeibei 3 years ago
parent
commit
9d3a925d76
3 changed files with 282 additions and 132 deletions
  1. 254 124
      src/views/equipment/addDataDialog.vue
  2. 13 5
      src/views/equipment/addDataTable.vue
  3. 15 3
      src/views/equipment/index.vue

+ 254 - 124
src/views/equipment/addDataDialog.vue

@@ -71,7 +71,7 @@
                    <div>
                        <el-button @click="modalStatusTip = true"  size="small" style="margin-right: 12px;width: 80px;" >取 消</el-button>
                        <el-popover placement="top" width="280" :disabled="visibleDisabled" v-model="visible">
-                           <p style="padding: 7px 12px 34px">数量超出正常范围,请核实?</p>
+                           <p style="padding: 7px 12px 34px">红框内数量超出正常范围,请核实?</p>
                            <div style="text-align: right; margin: 0;padding: 0 12px;">
                                <el-button size="mini" @click="visible = false">修改</el-button>
                                <el-button type="primary" size="mini" @click="handelConfirm">已核实</el-button>
@@ -267,7 +267,7 @@
                             var child = self.$createElement("el-tooltip", {
                                 attrs:{
                                     placement:"top",
-                                    content:'仅允许填写大于等于0的整数,请按规则填写',
+                                    content:row.tooltipMsgContent1?'仅允许填写大于等于0的整数,请按规则填写':'数量不得超过9999',
                                     manual:true,
                                     disabled:row.tooltipMsg1,
                                     value:!row.tooltipMsg1,
@@ -282,12 +282,15 @@
                                         class:row.errorMsg1?'input-box':'input-box input-box-error'
                                     },
                                     on:{
+                                        paste(e){
+                                            e.returnValue = false;
+                                        },
                                         keydown(e){
                                             self.keydown(e,index,'tooltipMsg1','errorMsg1');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
-                                                self.input(e);
+                                                self.input(e,'tooltipMsg1','tooltipMsgContent1',index);
                                                 self.$set(self.addDataTableData[index], 'smokeCount',e.target.value);
                                             }
                                         },
@@ -317,7 +320,7 @@
                             var child = self.$createElement("el-tooltip", {
                                 attrs:{
                                     placement:"top",
-                                    content:'仅允许填写大于等于0的整数,请按规则填写',
+                                    content:row.tooltipMsgContent2?'仅允许填写大于等于0的整数,请按规则填写':'数量不得超过9999',
                                     manual:true,
                                     disabled:row.tooltipMsg2,
                                     value:!row.tooltipMsg2,
@@ -332,12 +335,15 @@
                                         class:row.errorMsg2?'input-box':'input-box input-box-error'
                                     },
                                     on:{
+                                        paste(e){
+                                            e.returnValue = false;
+                                        },
                                         keydown(e){
                                             self.keydown(e,index,'tooltipMsg2','errorMsg2');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
-                                                self.input(e);
+                                                self.input(e,'tooltipMsg2','tooltipMsgContent2',index);
                                                 self.$set(self.addDataTableData[index], 'warmCount',e.target.value);
                                             }
                                         },
@@ -367,7 +373,7 @@
                             var child = self.$createElement("el-tooltip", {
                                 attrs:{
                                     placement:"top",
-                                    content:'仅允许填写大于等于0的整数,请按规则填写',
+                                    content:row.tooltipMsgContent3?'仅允许填写大于等于0的整数,请按规则填写':'数量不得超过9999',
                                     manual:true,
                                     disabled:row.tooltipMsg3,
                                     value:!row.tooltipMsg3,
@@ -382,12 +388,15 @@
                                         class:row.errorMsg3?'input-box':'input-box input-box-error'
                                     },
                                     on:{
+                                        paste(e){
+                                            e.returnValue = false;
+                                        },
                                         keydown(e){
                                             self.keydown(e,index,'tooltipMsg3','errorMsg3');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
-                                                self.input(e);
+                                                self.input(e,'tooltipMsg3','tooltipMsgContent3',index);
                                                 self.$set(self.addDataTableData[index], 'handNewCount',e.target.value);
                                             }
                                         },
@@ -417,7 +426,7 @@
                             var child = self.$createElement("el-tooltip", {
                                 attrs:{
                                     placement:"top",
-                                    content:'仅允许填写大于等于0的整数,请按规则填写',
+                                    content:row.tooltipMsgContent4?'仅允许填写大于等于0的整数,请按规则填写':'数量不得超过9999',
                                     manual:true,
                                     disabled:row.tooltipMsg4,
                                     value:!row.tooltipMsg4,
@@ -432,12 +441,15 @@
                                         class:row.errorMsg4?'input-box':'input-box input-box-error'
                                     },
                                     on:{
+                                        paste(e){
+                                            e.returnValue = false;
+                                        },
                                         keydown(e){
                                             self.keydown(e,index,'tooltipMsg4','errorMsg4');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
-                                                self.input(e);
+                                                self.input(e,'tooltipMsg4','tooltipMsgContent4',index);
                                                 self.$set(self.addDataTableData[index], 'fireHydrantCount',e.target.value);
                                             }
                                         },
@@ -467,7 +479,7 @@
                             var child = self.$createElement("el-tooltip", {
                                 attrs:{
                                     placement:"top",
-                                    content:'仅允许填写大于等于0的整数,请按规则填写',
+                                    content:row.tooltipMsgContent5?'仅允许填写大于等于0的整数,请按规则填写':'数量不得超过9999',
                                     manual:true,
                                     disabled:row.tooltipMsg5,
                                     value:!row.tooltipMsg5,
@@ -482,12 +494,15 @@
                                         class:row.errorMsg5?'input-box':'input-box input-box-error'
                                     },
                                     on:{
+                                        paste(e){
+                                            e.returnValue = false;
+                                        },
                                         keydown(e){
                                             self.keydown(e,index,'tooltipMsg5','errorMsg5');
                                         },
                                         input(e){
                                             if(row.isFm=='1') {
-                                                self.input(e);
+                                                self.input(e,'tooltipMsg5','tooltipMsgContent5',index);
                                                 self.$set(self.addDataTableData[index], 'moduleCount',e.target.value);
                                             }
                                         },
@@ -513,76 +528,138 @@
                             return obj;
                         },},
                     {dataIndex: 'action', title: '操作', align: 'center',customRender: (value, row, index) => {
+                            let self = this;
+                            var child = self.$createElement("div", {
+                            },[
+                                self.$createElement("span", {
+                                    domProps: {
+                                        innerHTML: index==0?'':'删除'
+                                    },
+                                    style:{
+                                        color:'#0C68B9',
+                                        'font-size':'14px',
+                                        'margin-right':'10px',
+                                        cursor:'pointer'
+                                    },
+                                    on:{
+                                        click:  () =>{
+                                            this.deleteFun(index);
+                                        }
+                                    }
+                                }),self.$createElement("span", {
+                                    domProps: {
+                                        innerHTML: '清空'
+                                    },
+                                    style:{
+                                        color:'#0C68B9',
+                                        'font-size':'14px',
+                                        cursor:'pointer'
+                                    },
+                                    on:{
+                                        click:  () =>{
+                                            this.clearFun(index);
+                                        }
+                                    }
+                                })
+                            ]);
                             return {
-                                children:  <i class='el-icon-remove' style='color:red;font-size:16px'></i>,
+                                // children:  <i class='el-icon-remove' style='color:red;font-size:16px'></i>,
+                                children:  child,
                         };
-                        },customCell:(record, rowIndex)=>{
-                            return {
-                                on: {
-                                    click:  () =>{
-                                        this.deleteFun(rowIndex);
-                                    }
-                                }
-                            }
                         }
                     },
                 ],
                 examplesTableData: [ //样例消防系统的表体数据
                     {
                         key: 0,
-                        fireZone: 'C1-9',
+                        fireZone: '1-1',
                         isFm: '1',
-                        hostNum: '6',
-                        loopNum: '6',
-                        smokeCount: '6',
-                        warmCount: 6,
-                        handNewCount: '6',
-                        fireHydrantCount: '6',
-                        moduleCount: '6',
+                        hostNum: '3',
+                        loopNum: '5',
+                        smokeCount: '53',
+                        warmCount: 2,
+                        handNewCount: '4',
+                        fireHydrantCount: '10',
+                        moduleCount: '65',
                     },
                     {
                         key: 1,
-                        fireZone: 'C1-10',
+                        fireZone: '1-2',
                         isFm: '1',
-                        hostNum: '6',
+                        hostNum: '3',
                         loopNum: '6',
-                        smokeCount: '6',
-                        warmCount: 6,
-                        handNewCount: '6',
-                        fireHydrantCount: '6',
-                        moduleCount: '6'
+                        smokeCount: '35',
+                        warmCount: 0,
+                        handNewCount: '1',
+                        fireHydrantCount: '3',
+                        moduleCount: '23'
+                    },
+                    {
+                        key: 1,
+                        fireZone: '1-3',
+                        isFm: '1',
+                        hostNum: '3',
+                        loopNum: '1、2、3、4',
+                        smokeCount: '455',
+                        warmCount: 22,
+                        handNewCount: '50',
+                        fireHydrantCount: '54',
+                        moduleCount: '256'
                     },{
                         key: 2,
-                        fireZone: 'C1-11',
+                        fireZone: '1-4',
                         isFm: '0',
-                        manageScope: '写字楼管理范围',
+                        manageScope: '写字楼物业管理范围',
                     },
                 ],
                 examplesTableDataR: [ //弱电系统样例表体数据
                     {
                         key: 0,
-                        fireZone: 'C区',
+                        fireZone: '1号门区',
                         system: '监控系统',
-                        monitorCount: 9
+                        monitorCount: 23
                     },
                     {
                         key: 1,
                         fireZone: 'C区',
                         system: 'BA系统',
-                        baCount: 9
+                        baCount: 6
                     },
                     {
                         key: 2,
                         fireZone: 'C区',
                         system: 'DDC',
-                        ddcCount: 9
+                        ddcCount: 4
                     },
                     {
                         key: 3,
                         fireZone: 'C区',
                         system: '门禁系统',
-                        accessCount: 9
+                        accessCount: 0
+                    }, {
+                        key: 4,
+                        fireZone: '中庭区',
+                        system: '监控系统',
+                        monitorCount: 12
+                    },
+                    {
+                        key: 5,
+                        fireZone: '中庭区',
+                        system: 'BA系统',
+                        baCount: 4
+                    },
+                    {
+                        key: 6,
+                        fireZone: '中庭区',
+                        system: 'DDC',
+                        ddcCount: 1
                     },
+                    {
+                        key: 7,
+                        fireZone: '中庭区',
+                        system: '门禁系统',
+                        accessCount: 0
+                    }
                 ],
                 examplesTableHeaderREdit: [
                     {dataIndex: 'fireZone', title: '分区', align: 'center',  customRender: (text, row, index) => {
@@ -640,7 +717,7 @@
                          var child = self.$createElement("el-tooltip", {
                              attrs:{
                                  placement:"top",
-                                 content:'仅允许填写大于等于0的整数,请按规则填写',
+                                 content:row.tooltipMsgContent?'仅允许填写大于等于0的整数,请按规则填写':'数量不得超过9999',
                                  manual:true,
                                  disabled:row.tooltipMsg,
                                  value:!row.tooltipMsg,
@@ -655,11 +732,15 @@
                                      class:row.errorMsg?'input-box':'input-box input-box-error'
                                  },
                                  on:{
+                                     paste(e){
+                                         e.returnValue = false;
+                                     },
                                      keydown(e){
                                          self.keydown(e,index,'tooltipMsg','errorMsg');
                                      },
                                      input(e){
-                                         self.input(e);
+                                         self.input(e,'tooltipMsg','tooltipMsgContent',index);
+
                                          self.$set(self.addDataTableData[index], row.system =='监控系统'?'monitorCount':row.system=='BA系统'?'baCount':row.system=='DDC'?'ddcCount':'accessCount',  e.target.value);
                                      },
                                      blur(e){
@@ -682,17 +763,52 @@
                         },
                     },
                     {dataIndex: 'action', title: '操作', align: 'center',customRender: (value, row, index) => {
+                        let self = this;
+                            var child = self.$createElement("div", {
+                            },[
+                                self.$createElement("span", {
+                                    domProps: {
+                                        innerHTML: index==0?'':'删除'
+                                    },
+                                    style:{
+                                        color:'#0C68B9',
+                                        'font-size':'14px',
+                                       'margin-right':'10px',
+                                        cursor:'pointer'
+                                    },
+                                    on:{
+                                        click:  () =>{
+                                            this.deleteFun(index);
+                                        }
+                                    }
+                                }),self.$createElement("span", {
+                                    domProps: {
+                                        innerHTML: '清空'
+                                    },
+                                    style:{
+                                        color:'#0C68B9',
+                                        'font-size':'14px',
+                                        cursor:'pointer'
+                                    },
+                                    on:{
+                                        click:  () =>{
+                                            this.clearFun(index);
+                                        }
+                                    }
+                                })
+                            ]);
                             return {
-                                children:  <i class='el-icon-remove' style='color:red;font-size:16px'></i>,
+                                // children:  <i class='el-icon-remove' style='color:red;font-size:16px'></i> ,
+                                children:  child ,
                             attrs:{
                                 rowSpan:  index %4== 0? 4:0
                             }
                         }},customCell:(record, rowIndex)=>{
                             return {
                                 on: {
-                                    click:  () =>{
-                                        this.deleteFun(rowIndex);
-                                    }
+                                    // click:  () =>{
+                                    //     this.deleteFun(rowIndex);
+                                    // }
                                 }
                             }
                         }},
@@ -709,6 +825,7 @@
                 this.addDataTableData.map((item,index) => {
                     item.errorMsg = true;
                     item.tooltipMsg = true;
+                    item.tooltipMsgContent = true;
                     item.tooltipDisableFize = true;
                     item.key = ''+ new Date().getTime()+index;
                 })
@@ -726,6 +843,11 @@
                     item.errorMsg3 = true;
                     item.errorMsg4 = true;
                     item.errorMsg5 = true;
+                    item.tooltipMsgContent1 = true;
+                    item.tooltipMsgContent2 = true;
+                    item.tooltipMsgContent3 = true;
+                    item.tooltipMsgContent4 = true;
+                    item.tooltipMsgContent5 = true;
                     item.tooltipDisableFize = true;
                     item.tooltipDisablHost = true;
                     item.tooltipDisablLoop = true;
@@ -764,7 +886,6 @@
                 if(e.key=='-'||e.key=='+'||e.key=='e'||e.key=='.'){
                     e.preventDefault()
                 }
-                console.log(e.key);
                 if(e.key!='ArrowUp'&&e.key!='ArrowDown'&&e.key!='ArrowRight'&&e.key!='ArrowLeft'&&e.key!='Backspace'&&e.key!='Delete'&&  e.key!=0&& e.key!=1&& e.key!=2&& e.key!=3&& e.key!=4&& e.key!=5&& e.key!=6&& e.key!=7&& e.key!=8&& e.key!=9){
                     this.$set( this.addDataTableData[index],nametip,false);
                     this.$set( this.addDataTableData[index],namered,false)
@@ -775,7 +896,7 @@
                 this.$forceUpdate();
             },
             //输入事件
-            input(e){
+            input(e,namered,nameContent,index){
                 if( e.target.value =='00'){
                     e.target.value = 0;
                 }
@@ -785,9 +906,17 @@
                         e.target.value =  e.target.value.toString().slice(1,5)
                     }
                 }
+                if(e.target.value>9999){
+                    this.$set( this.addDataTableData[index],namered,false)
+                    this.$set( this.addDataTableData[index],nameContent,false)
+                }else{
+                    // this.$set( this.addDataTableData[index],namered,true)
+                    this.$set( this.addDataTableData[index],nameContent,true)
+                }
                 if(e.target.value.toString().length>4){
                     e.target.value =  e.target.value.toString().slice(0,4)
                 }
+                this.$forceUpdate();
             },
             //防火分区
             getFireZoneFun(text,index){
@@ -835,82 +964,83 @@
             //删除数据
             deleteFun(index){
                 if(this.systemName=='弱电系统'){
-                    if( this.addDataTableData.length==4){
-                        this.addDataTableData.splice(index,4)
-                        let arr =   [
-                            {
-                                fireZone: '',
-                                system: '监控系统',
-                                monitorCount: '',
-                                errorMsg:true,
-                                tooltipMsg:true,
-                                tooltipDisableFize: true
-                            },
-                            {
-                                fireZone: '',
-                                system: 'BA系统',
-                                baCount: '',
-                                errorMsg:true,
-                                tooltipMsg:true,
-                                tooltipDisableFize: true
-                            },
-                            {
-                                fireZone: '',
-                                system: 'DDC',
-                                ddcCount: '',
-                                errorMsg:true,
-                                tooltipMsg:true,
-                                tooltipDisableFize: true
-                            },
-                            {
-                                fireZone: '',
-                                system: '门禁系统',
-                                accessCount: '',
-                                errorMsg:true,
-                                tooltipMsg:true,
-                                tooltipDisableFize: true
-                            },
-                        ];
-                        this.addDataTableData.push(...arr);
-                        this.$forceUpdate();
-                    }else{
-                        this.addDataTableData.splice(index,4)
-                    }
-                                    }
+                    this.addDataTableData.splice(index,4)
+                }
                 if(this.systemName=='消防系统'){
 
-                   if( this.addDataTableData.length==1){
-                       this.addDataTableData.splice(index,1);
-                       let obj =  {
-                           fireZone:"",
-                           isFm: "1",
-                           hostNum:"",
-                           loopNum:"",
-                           smokeCount:"",
-                           warmCount:"",
-                           handNewCount:"",
-                           fireHydrantCount:"",
-                           moduleCount:"",
-                           manageScope:'',
-                           manageScopeType:'',
-                           errorMsg1:true,
-                           errorMsg2:true,
-                           errorMsg3:true,
-                           errorMsg4:true,
-                           errorMsg5:true,
-                           tooltipDisableFize : true,
-                           tooltipDisablHost : true,
-                           tooltipDisablLoop : true,
-                           tooltipMsg1 : true,
-                           tooltipMsg2 : true,
-                           tooltipMsg3 : true,
-                           tooltipMsg4 : true,
-                           tooltipMsg5 : true,
-                       };
-                       this.addDataTableData.push(obj)
-                   }else{
-                       this.addDataTableData.splice(index,1);
-                   }
+                    this.addDataTableData.splice(index,1);
+                }
+            },
+            //清除数据
+            clearFun(index){
+                if(this.systemName=='弱电系统'){
+                    let arr =   [
+                        {
+                            fireZone: '',
+                            system: '监控系统',
+                            monitorCount: '',
+                            errorMsg:true,
+                            tooltipMsg:true,
+                            tooltipDisableFize: true
+                        },
+                        {
+                            fireZone: '',
+                            system: 'BA系统',
+                            baCount: '',
+                            errorMsg:true,
+                            tooltipMsg:true,
+                            tooltipDisableFize: true
+                        },
+                        {
+                            fireZone: '',
+                            system: 'DDC',
+                            ddcCount: '',
+                            errorMsg:true,
+                            tooltipMsg:true,
+                            tooltipDisableFize: true
+                        },
+                        {
+                            fireZone: '',
+                            system: '门禁系统',
+                            accessCount: '',
+                            errorMsg:true,
+                            tooltipMsg:true,
+                            tooltipDisableFize: true
+                        },
+                    ];
+                    this.addDataTableData.splice(index,index+4,...arr);
+                    this.$forceUpdate();
+                }
+                if(this.systemName=='消防系统'){
+
+
+                        let obj =  {
+                            fireZone:"",
+                            isFm: "1",
+                            hostNum:"",
+                            loopNum:"",
+                            smokeCount:"",
+                            warmCount:"",
+                            handNewCount:"",
+                            fireHydrantCount:"",
+                            moduleCount:"",
+                            manageScope:'',
+                            manageScopeType:'',
+                            errorMsg1:true,
+                            errorMsg2:true,
+                            errorMsg3:true,
+                            errorMsg4:true,
+                            errorMsg5:true,
+                            tooltipDisableFize : true,
+                            tooltipDisablHost : true,
+                            tooltipDisablLoop : true,
+                            tooltipMsg1 : true,
+                            tooltipMsg2 : true,
+                            tooltipMsg3 : true,
+                            tooltipMsg4 : true,
+                            tooltipMsg5 : true,
+                        };
+                    this.addDataTableData.splice(index,1,obj);
                 }
             },
             //添加数据

+ 13 - 5
src/views/equipment/addDataTable.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <el-table  v-if="systemName=='弱电系统'"
+        <el-table  v-if="systemName=='弱电系统'" :class="!examplesBoo?'heightCell':''"
                    :data="tableData"
                    border
                    :show-summary="!examplesBoo"  max-height="450"
@@ -28,12 +28,12 @@
                 </template>
             </el-table-column>
         </el-table>
-        <el-table  v-if="systemName=='消防系统'"
+        <el-table  v-if="systemName=='消防系统'" id="tables"
                    :data="tableData"
                    border   max-height="450"
                    :show-summary="!examplesBoo"
                    style="width: 100%;" :header-cell-style="()=>{return { background:'#E5EEF6'  } }" :cell-style="({row, column, rowIndex, columnIndex})=>{
-                        return { background:examplesBoo&&rowIndex==2&&columnIndex==1?'#EFF0F1':'#fff'  }
+                        return { background:examplesBoo&&rowIndex==3&&columnIndex==1?'#EFF0F1':'#fff' }
                      }"   :span-method="objectSpanMethod" :tooltip-effect="'dark'">
             <el-table-column
                     prop="fireZone"
@@ -227,8 +227,8 @@
 <style scoped lang="less">
     /deep/ .el-table{
         .cell{
-            height: 30px!important;
-            line-height:30px!important;
+            height: 16px!important;
+            line-height:16px!important;
             color: #000000!important;
             text-align: center!important;
         }
@@ -250,4 +250,12 @@
             background-color: unset;
         }
     }
+   /deep/ #tables{
+       .cell{
+           height: 30px!important;
+           line-height:30px!important;
+           color: #000000!important;
+           text-align: center!important;
+       }
+    }
 </style>

+ 15 - 3
src/views/equipment/index.vue

@@ -74,7 +74,7 @@
                 ref="additionalBox"
                 v-if="fqPic.length > 0 && (smsxt == '1003' || smsxt == '1004')"
               >
-                  <a-tooltip   placement="bottomRight"  overlayClassName="additional-box-tooltip" >
+                  <a-tooltip  v-if="visibleTooltip"  placement="bottomRight"  overlayClassName="additional-box-tooltip" >
                       <template slot="title">
                           <span>数据填写不完整,请检查并完善</span>
                       </template>
@@ -93,6 +93,17 @@
                 </a-tooltip>
 
 
+               <div v-else>
+                   <div v-if="showView === 3"
+                        class="additional2"
+                        @click="additionalColl"
+                   >
+                       <img src="../../assets/imgs/bg2.png" alt />
+                   </div>
+                   <div class="additional" @click="additionalColl" v-else>
+                       <img src="../../assets/imgs/bg.png" alt />
+                   </div>
+               </div>
 
 
 
@@ -851,10 +862,11 @@ export default {
             right: 32px;
             top: 142px;
             /deep/ .el-badge__content.is-dot{
-              width: 12px;
-              height: 12px;
+              width: 19px;
+              height: 19px;
               background: #F54E45;
               cursor: pointer!important;
+                right: 10px!important;
             }
           }
           .additional-box {