quanyawei
2024-01-10 e13367edf304cb78f978e321f1679299a66b3a23
pages/actionChange/secondLevelData/index.vue
@@ -4,16 +4,16 @@
         <view class="ridoaBox">
            <u-radio-group v-model="value" placement="row" :size='radioOption.size'
               :labelColor='radioOption.labelColor' :labelSize='radioOption.labelSize' @change='changeSearchType'>
               <u-radio activeColor="#19be6b" label="Mac号询" name="1" :labelSize='radioOption.labelSize'
               <u-radio activeColor="#19be6b" label="Mac号/站点名称" name="1" :labelSize='radioOption.labelSize'
                  :labelColor='radioOption.labelColor'></u-radio>
               <u-radio activeColor="#19be6b" label="站点查询" name="0" :labelSize='radioOption.labelSize'
               <u-radio activeColor="#19be6b" label="站点" name="0" :labelSize='radioOption.labelSize'
                  :labelColor='radioOption.labelColor'></u-radio>
               <u-radio activeColor="#19be6b" label="特殊设备查询" name="2" :labelSize='radioOption.labelSize'
               <u-radio activeColor="#19be6b" label="特殊设备" name="2" :labelSize='radioOption.labelSize'
                  :labelColor='radioOption.labelColor'></u-radio>
            </u-radio-group>
         </view>
         <view class="" v-if="value==='1'">
            <u-input placeholder="请输入Mac号" :placeholderStyle='placeholderStyle' color="#fff"
            <u-input placeholder="请输入Mac号/站点名称" :placeholderStyle='placeholderStyle' color="#fff"
               customStyle="margin: 0 5px;" v-model='macName'>
               <template slot="suffix">
                  <u-button @tap="searchMacList" text="查询" type="success" size="small"></u-button>
@@ -45,10 +45,17 @@
               @cancel="showeEscalationTime = false"></u-picker>
         </view>
      </view>
      <view v-if="wsData2">
         <u-cell title="风向:" :value="windDirData"></u-cell>
      <view class="timeStyle">
         {{currentTime}}
      </view>
      <view>
         <u-cell title="站点:" :value="orgMacName"></u-cell>
      </view>
      <view class="boxPadd">
         <view class="windDirBox" v-if="showData.length>0">
            <view class=""> 风向: </view>
            <view class=""> {{windDirData}} </view>
         </view>
         <u-list v-if="showData.length>0">
            <u-list-item v-for="(item, index) in showData" :key="index">
               <u-row customStyle="margin-bottom: 10px">
@@ -65,18 +72,18 @@
            </u-list-item>
         </u-list>
      </view>
      <u-toast ref="uToast"></u-toast>
      <u-modal :show="showModel" title='请选择Mac号' showCancelButton @cancel='showModel=false' @confirm='selectMac'>
         <view class="slot-content">
            <u-radio-group v-model="modeleMacSelect" iconPlacement="right" placement='column' borderBottom='true'
               @change='clickMac'>
               <view v-for="(item,index) in macList" :key="index" class="ridioBox">
                  <u-radio activeColor="#19be6b" :label="`${item.typeName}: ${item.mac}`"
                  <u-radio activeColor="#19be6b" :label="`${item.typeName}: ${item.name}  \\n Mac号:${item.mac}`"
                     :name="item.mac"></u-radio>
               </view>
            </u-radio-group>
         </view>
      </u-modal>
      <u-toast ref="uToast"></u-toast>
   </view>
</template>
<script>
@@ -110,6 +117,7 @@
            },
            placeholderStyle: 'color: #fff',
            macName: '',
            orgMacName: '',
            defaultMonitorItems: [],
            chartSensorKey: [],
            coreMonitorItems: [],
@@ -118,7 +126,7 @@
            alarmLevel: null,
            aqi: 0,
            baseUrl: '',
            windDir: 'null',
            windDir: '',
            windDeg: 180,
            wsData2: null,
            // 报警进度条
@@ -128,6 +136,7 @@
            // 报警圆环图片
            alarmBg: {},
            timer: '',
            currentTime: new Date(),
            isLoading: true,
            specialType: '3'
         }
@@ -141,7 +150,7 @@
      },
      computed: {
         windDirData() {
            if (this.wsData2) {
            if (this.wsData2 && this.windDir) {
               return `${this.windDir} (${this.wsData2.a01008})`
            } else {
               return ''
@@ -153,6 +162,7 @@
      },
      created() {
         this.getOrgs()
         this.getTime()
      },
      onUnload() {
         let that = this
@@ -161,7 +171,22 @@
         that.timer = ''
      },
      methods: {
         getTime() {
            var _this = this // 声明一个变量指向Vue实例this,保证作用域一致
            this.timer = setInterval(function() {
               _this.currentTime = // 修改数据date
                  _this.appendZero(new Date().getFullYear()) + '-' + _this.appendZero(new Date().getMonth() +
                     1) + '-' + _this.appendZero(new Date().getDate()) + ' ' + _this.appendZero(new Date()
                     .getHours()) + ': ' + _this.appendZero(new Date().getMinutes()) + ': ' + _this
                  .appendZero(new Date().getSeconds())
            }, 1000)
         },
         appendZero(obj) {
            return obj < 10 ? '0' + obj : obj
         },
         clickMac(e) {
            this.macName = ''
            this.orgMacName = ''
            this.specialType = this.macList.find(item => item.mac === e).specialType
            console.log('specialType', this.specialType)
         },
@@ -171,16 +196,20 @@
            this.sensorLayout()
         },
         changeSearchType() {
            this.macName = ''
            if (this.value === '2') {
               this.getSpeciallist()
            }
            if (this.value === '0') {
               this.getOrgs()
            }
            if (this.value === '1') {
               this.macName = ''
            }
         },
         selectMac() {
            this.macName = this.modeleMacSelect
            this.orgMacName = this.macList.find(item => item.mac === this.modeleMacSelect).name
            console.log('this.orgMacName', this.orgMacName)
            this.showModel = false
            if (this.socketTask) {
               this.socketTask.close()
@@ -192,6 +221,7 @@
               mac: this.macName
            }).then(res => {
               this.macList = []
               this.modeleMacSelect = ''
               if (res.data && res.data.length > 0) {
                  this.macList = res.data
                  this.showModel = true
@@ -228,6 +258,7 @@
               'name': name,
               'id': id
            }
            this.getOrgs()
         },
         selectBack(e) {
            if (this.selectForm.name === 'orgName') {
@@ -239,6 +270,8 @@
               }
            } else {
               this.macName = e.value[0].mac
               this.orgMacName = e.value[0].name
               console.log('e', e)
               if (this.socketTask) {
                  this.socketTask.close()
               }
@@ -588,4 +621,19 @@
      max-height: 300px;
      overflow: auto;
   }
   .windDirBox {
      display: flex;
      justify-content: space-between;
      padding: 5px;
      margin-bottom: 5px;
      border-bottom: 1px solid;
   }
   .timeStyle {
      text-align: center;
      margin: 5px;
      font-size: 18px;
      color: #ef9790;
   }
</style>