소스 검색

Merge branch 'V0.0.6_iot' of http://10.87.21.221:8000/jzyd_yyds/soc_app into V0.0.6_iot

zhulu 1 년 전
부모
커밋
b874c9f94c

+ 1 - 0
src/api/iot/donghuan.js

@@ -36,6 +36,7 @@ export function getDonghuanBadge(orgId){
   return request({
     url: `/iot/sensor/app/badge/${orgId}`,
     method: 'get',
+    hideLoading:true
   });
 }
 // // 获取某天的录像完整性

+ 13 - 0
src/api/iot/dvrRecorder.js

@@ -9,6 +9,19 @@ export function list(query) {
   })
 }
 
+/**
+ * 获取角标
+ * @param {} orgId 
+ * @returns 
+ */
+ export function getDvrRecorderBadge(orgId){
+  return request({
+    url: `/iot/dvrdisk/app/badge/${orgId}`,
+    method: 'get',
+    hideLoading:true
+  });
+}
+
 // // 查询详情
 // export function detail(hostCode, channelCode) {
 //   return request({

+ 13 - 0
src/api/iot/videoDiagnosis.js

@@ -25,3 +25,16 @@ export function integrity(hostCode, channelCode,date) {
   });
 }
 
+
+/**
+ * 获取角标
+ * @param {} orgId 
+ * @returns 
+ */
+ export function getVideoDiagnosisBadge(orgId){
+  return request({
+    url: `/iot/VideoDiagnosis/app/badge/${orgId}`,
+    method: 'get',
+    hideLoading:true
+  });
+}

+ 15 - 2
src/components/timeCell/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="date-cell">
-    <van-cell v-if="disabled" :title="title" :value="isRow ? label : ''" :label="!isRow ? label : ''" />
+    <van-cell v-if="disabled" :title="title" :value="isRow ? label : ''" :label="!isRow ? label : ''" title-class="date-cell-title" value-class="date-cell-value" />
     <van-cell
       v-else
       :title="title"
@@ -9,6 +9,8 @@
       :value="isRow ? label : ''"
       :label="!isRow ? label : ''"
       @click="clickItem"
+      title-class="date-cell-title" 
+      value-class="date-cell-value" 
     >
       <template #right-icon>
         <van-icon name="notes-o" class="date-icon" />
@@ -27,6 +29,7 @@
         @cancel="cancelPicker"
         @confirm="pickerConfirm"
         confirm-button-text="确定"
+        :max-date="maxDate"
       />
     </van-popup>
   </div>
@@ -44,7 +47,7 @@ export default {
     },
     //默认值
     value: {
-      type: String,
+      type: [String,Date],
       default: null
     },
     //标题
@@ -75,6 +78,9 @@ export default {
     }, 
     valueFormatter:{
       type:String
+    },
+    maxDate:{
+      type:Date
     }
   },
   data() {
@@ -203,6 +209,13 @@ export default {
   color: #323233;
   background-color: #fff;
 }
+.date-cell-title{
+  max-width:35%;
+}
+
+.date-cell-value{
+  width:65%;
+}
 .date-cell::after {
   position: absolute;
   box-sizing: border-box;

+ 8 - 4
src/views/home/menu.vue

@@ -39,6 +39,8 @@ import Card from '@/components/card'
 import { mapGetters } from 'vuex'
 import { getMenu, getTheAreaWeather } from '@/api/public'
 import { getDonghuanBadge } from '@/api/iot/donghuan.js'
+import { getDvrRecorderBadge } from '@/api/iot/dvrRecorder.js'
+import { getVideoDiagnosisBadge } from '@/api/iot/videoDiagnosis.js'
 export default {
   name: 'menus',
   components: { TopBar, Scroll, Card },
@@ -61,7 +63,9 @@ export default {
       getMenu().then(res => {
         this.menuList = res.data
         this.$refs.Scroll.refresh()
-        this.getBadge('/iot/donghuan', getDonghuanBadge)        
+        this.getBadge('/iot/donghuan', getDonghuanBadge)
+        this.getBadge('/iot/dvrDisk', getDvrRecorderBadge)
+        this.getBadge('/iot/videoDiagnosis', getVideoDiagnosisBadge)
       })
     },
     getBadge(url, method) {
@@ -82,12 +86,12 @@ export default {
       if (menu) {
         method(this.orgId).then(r => {
           if (r.data) {
-            menu.badge = r.data
+            menu.badge = r.data > 99 ? '99+' : r.data
           } else {
             menu.badge = null
           }
-          
-          this.$forceUpdate();
+
+          this.$forceUpdate()
         })
       }
     },

+ 14 - 12
src/views/menu/iot/dvrRecorder/components/item.vue

@@ -3,10 +3,13 @@
     <van-cell-group>
       <van-cell :title="data.equipmentName" @click="onTitleClicked">
         <template #default>
-          <van-tag v-if="data.state == 0" type="success">正常</van-tag>
-          <van-tag v-else-if="data.state == 1" type="warning">异常</van-tag>
-          <van-tag v-else type="primary">未知</van-tag>
-          <van-icon style="margin-left: 10px" :name="expanded ? 'arrow-up' : 'arrow-down'"></van-icon>
+          <span v-if="data.diskInfos && data.diskInfos.length > 0">
+            <van-tag v-if="data.state == 0" type="success">正常</van-tag>
+            <van-tag v-else-if="data.state == 1" type="warning">异常</van-tag>
+            <van-tag v-else type="primary">未知</van-tag>
+            <van-icon style="margin-left: 10px" :name="expanded ? 'arrow-up' : 'arrow-down'"></van-icon>
+          </span>
+          <van-tag v-else type="primary">无硬盘</van-tag>
         </template>
       </van-cell>
       <van-cell title="所属机构" :value="data.orgName" />
@@ -97,8 +100,8 @@ export default {
     //   this.$router.push(`/iot/videoDiagnosis/detail?hostCode=${hostCode}&channelCode=${channelCode}`)
     // },
 
-    onTitleClicked(){
-      this.expanded=!this.expanded
+    onTitleClicked() {
+      this.expanded = !this.expanded
     },
     renderDiskDesc(disk, index) {
       return `(${index + 1})${(disk.available / 1024).toFixed(0)}G剩余/(共${(disk.total / 1024).toFixed(0)}G)`
@@ -139,18 +142,17 @@ export default {
 .cell-disklist {
   width: 100%;
 
-  >div{
+  > div {
     width: 50%;
-  display: inline-block;
-  margin-bottom: 3vw;
+    display: inline-block;
+    margin-bottom: 3vw;
   }
 
-  >div:nth-child(odd){
+  > div:nth-child(odd) {
     padding-right: 3vw;
   }
-  >div:nth-child(even){
+  > div:nth-child(even) {
     padding-left: 3vw;
   }
 }
-
 </style>

+ 17 - 7
src/views/menu/iot/subsystem/components/dialog.stateChange.vue

@@ -1,10 +1,19 @@
 <template>
   <van-dialog @confirm="onConfirm" v-model="show" show-cancel-button>
-    <div style="margin:10px;">
+    <div style="margin: 10px">
       <div>
         <div>是否更新{{ stateText }}时间?</div>
       </div>
-      <time-cell required is-row title="更新时间" v-model="time" dateType="time" textFormatter="H时m分"/>
+      <time-cell
+        v-if="show"
+        required
+        is-row
+        title="更新时间"
+        v-model="time"
+        dateType="datetime"
+        textFormatter="YYYY年M月D日H时m分"
+        :max-date="new Date()"
+      />
     </div>
   </van-dialog>
 </template>
@@ -20,19 +29,20 @@ export default {
       show: false,
       subSystem: {},
       stateText: '',
-      time:dayjs(new Date()) .format("H:m")
+      time: new Date()
     }
   },
   props: {},
   methods: {
     dayjs,
-    onConfirm() {  
-      this.$emit('success',this.subSystem,this.state,`${dayjs().format("YYYY-MM-DD")} ${this.time}:00`)
+    onConfirm() {
+      this.$emit('success', this.subSystem, this.state, this.time)
     },
-    open(subSystem,state, stateText) {
+    open(subSystem, state, stateText) {
       this.subSystem = subSystem
-      this.state=state,
+      this.state = state
       this.stateText = stateText
+      this.time = new Date()
       this.show = true
     }
   }

+ 4 - 3
src/views/menu/iot/subsystem/components/item.vue

@@ -12,7 +12,7 @@
               return false
             "
             v-if="data.status != '1' && data.orgId == orgId"
-            >布防时间登记</van-button
+            >布防登记</van-button
           >
           <van-button
             size="mini"
@@ -23,7 +23,7 @@
               return false
             "
             v-if="data.status != '0' && data.orgId == orgId"
-            >撤防时间登记</van-button
+            >撤防登记</van-button
           >
         </template>
       </van-cell>
@@ -92,10 +92,11 @@ export default {
       //   })
     },
     updateStatus(data, status,changeTime) {      
-      api.updateStatus(data.id, status,changeTime).then(r => {
+      api.updateStatus(data.id, status,dayjs(changeTime).format('YYYY-MM-DD HH:mm:00')).then(r => {
         if (r.data) {
           data.status = status
           data.statusChangeTime = dayjs(changeTime).format('YYYY-MM-DD HH:mm')
+          data.statusUpdatorName=this.$store.getters.userName
         }
       })
     },

+ 103 - 30
src/views/menu/iot/subsystem/index.vue

@@ -6,12 +6,53 @@
         <org-tree v-model="search.orgId" @changeItem="changeTree" @checked="orgCheckChanged" showChecked></org-tree>
       </van-col>
     </van-row>
+    <van-row>
+      <van-col span="10">
+        <!-- <van-field
+            v-model="fieldValue"
+            label-width="3em"
+            clearable
+            :disabled="showStatus"
+            label="状态"
+            placeholder=""
+            @click="showStatus = true"
+            ><van-icon name="arrow-down" slot="button"
+          /></van-field> -->
+        <van-cell title="状态" @click="showStatus = true" is-link arrow-direction="down" :value="defaultStatus" />
+
+        <van-popup v-model="showStatus" round position="bottom">
+          <van-picker
+            title="状态"
+            show-toolbar
+            :columns="statusOptions"
+            @confirm="onStatusConfirm"
+            @cancel="onCancel"
+            default-index="0"
+            :close-on-click-overlay="false"
+          />
+        </van-popup>
+      </van-col>
+      <van-col span="14">
+        <van-cell title="上报时间" @click="showHour = true" is-link arrow-direction="down" :value="defaultHour"/>
+
+        <van-popup v-model="showHour" round position="bottom">
+          <van-picker
+            title="上报时间"
+            show-toolbar
+            :columns="hourOptions.map(o => o.text)"
+            @confirm="onTimeConfirm"
+            @cancel="onCancel"
+            :close-on-click-overlay="false"
+          />
+        </van-popup>
+      </van-col>
+    </van-row>
     <!-- <van-search v-model="search.key" placeholder="请输入搜索关键词" maxlength="50" /> -->
-    <van-dropdown-menu>
-      <!-- <van-dropdown-item :title="selectedOrgName" @open="onItemClick" /> -->
-      <van-dropdown-item v-model="search.status" :options="statusOptions" />
+    <!-- <van-dropdown-menu> -->
+    <!-- <van-dropdown-item :title="selectedOrgName" @open="onItemClick" /> -->
+    <!-- <van-dropdown-item v-model="search.status" :options="statusOptions" />
       <van-dropdown-item v-model="search.hour" :options="hourOptions" />
-    </van-dropdown-menu>
+    </van-dropdown-menu> -->
     <!-- <div>
       <van-picker show-toolbar title="选择" :columns="statusOptions"/>
     </div> -->
@@ -39,13 +80,13 @@ import KList from '@/components/list/index.vue'
 import Item from './components/item.vue'
 import OrgTree from '@/components/orgTree'
 export default {
-  components: { NavBar, KList, Item ,OrgTree},
+  components: { NavBar, KList, Item, OrgTree },
   data() {
     return {
       options: [],
       search: {
         orgId: this.orgId,
-        checkSub:false,
+        checkSub: false,
         status: null,
         hour: null,
         key: null,
@@ -53,11 +94,14 @@ export default {
         pageNum: 1,
         pageSize: 10
       },
-      showOrg: false,
+      // showOrg: false,
       selectedOrgName: null,
-
+      showStatus: false,
+      showHour: false,
+      defaultStatus: '全部',
+      defaultHour: '全部',
       hourOptions: [
-        { value: null, text: '上报时间' },
+        { value: null, text: '全部' },
         { value: 1, text: '1小时内' },
         { value: 2, text: '2小时内' },
         { value: 3, text: '3小时内' },
@@ -73,12 +117,12 @@ export default {
       //     text: ''
       //   }
       // ],
-      fieldNames: {
-        text: 'shortName',
-        value: 'id',
-        children: 'children'
-      },
-      dicts: ["protection_status"]
+      // fieldNames: {
+      //   text: 'shortName',
+      //   value: 'id',
+      //   children: 'children'
+      // },
+      dicts: ['protection_status']
     }
   },
   watch: {
@@ -95,7 +139,7 @@ export default {
     //   }
     // }
   },
-  created() { },
+  created() {},
   mounted() {
     this.getTreeList()
     this.search.orgId = this.orgId
@@ -106,18 +150,26 @@ export default {
   computed: {
     ...mapGetters(['orgName', 'orgId', 'dictionary']),
     statusOptions() {
-      let r = [
-        { value: null, text: '布撤防状态' }
-      ]
-
-      let dict = this.getDictItem('protection_status');
+      let r = ['全部']
+      let dict = this.getDictItem('protection_status')
       if (dict) {
         dict.forEach(element => {
-          r.push({ value: element.dictValue, text: element.dictLabel })
-        });
+          r.push(element.dictLabel)
+        })
       }
 
-      return r;
+      // let r = [
+      //   { value: null, text: '所有布撤防状态' }
+      // ]
+
+      // let dict = this.getDictItem('protection_status');
+      // if (dict) {
+      //   dict.forEach(element => {
+      //     r.push({ value: element.dictValue, text: element.dictLabel })
+      //   });
+      // }
+
+      return r
     }
   },
   methods: {
@@ -131,8 +183,30 @@ export default {
         // console.log(res,'3333')
       })
     },
-    onItemClick() {
-      this.showOrg = true
+    onStatusConfirm(text) {
+      let dict = this.getDictItem('protection_status')
+      for (let item of dict) {
+        if (item.dictLabel === text) {
+          this.search.status = item.dictValue
+        }
+      }
+      this.showStatus=false;
+    },
+
+    onTimeConfirm(text) {
+      for (let item of this.hourOptions) {
+        if (item.text === text) {
+          this.search.hour = item.value
+        }
+      }
+      this.showHour=false;
+    },
+    // onItemClick() {
+    //   this.showOrg = true
+    // },
+    onCancel() {
+      this.showHour = false
+      this.showStatus = false
     },
     //改变机构后将重新发起请求
     changeTree(node) {
@@ -142,11 +216,11 @@ export default {
       this.search.orgId = node.id
       this.selectedOrgName = node.shortName
     },
-    orgCheckChanged(v){
-      this.search.checkSub=v;
+    orgCheckChanged(v) {
+      this.search.checkSub = v
     },
     onFinish({ selectedOptions }) {
-      this.showOrg = false
+      // this.showOrg = false
     }
   }
 }
@@ -158,7 +232,6 @@ export default {
   display: block;
 
   .container {
-
     // overflow: auto;
     // height: calc(100vh - 11rem);
     .k-content-repair {

+ 7 - 4
src/views/menu/iot/videoDiagnosis/components/item.vue

@@ -3,11 +3,14 @@
     <van-cell-group>
       <van-cell :title="data.hostName">
         <template #default>
-          <van-tag v-if="data.state == 0" type="success">正常</van-tag>
-          <van-tag v-else-if="data.state == 1" type="warning">异常</van-tag>
-          <van-tag v-else type="primary">未知</van-tag>
+          <span v-if="data.channels && data.channels.length > 0">
+            <van-tag v-if="data.state == 0" type="success">正常</van-tag>
+            <van-tag v-else-if="data.state == 1" type="warning">异常</van-tag>
+            <van-tag v-else type="primary">未知</van-tag></span
+          >
+          <van-tag v-else type="primary">无通道</van-tag>
         </template>
-        <template #right-icon>
+        <template #right-icon v-if="data.channels && data.channels.length > 0">
           <van-icon
             style="margin-left: 10px"
             :name="expanded ? 'arrow-up' : 'arrow-down'"