ming il y a 3 ans
Parent
commit
ba5112593d

+ 3 - 1
src/store/index.js

@@ -44,7 +44,9 @@ export default createStore({
 
 
         basicInfoSiteName: '', // 站点基本信息
-        basicInfoConst:1,// 站点弹窗
+        basicInfoConst: 1, // 站点弹窗
+
+        siteManageLabelCom: '', //站点管理,树结构label传值
     },
     mutations: {
         /**

+ 41 - 20
src/views/siteManage/basicInfo/index.vue

@@ -131,7 +131,7 @@
           <el-form-item label="故障动态:" prop="faultStatus">
             <el-select v-model="ruleForm.faultStatus" placeholder="请选择">
               <el-option
-                v-for="(item, index) in dropData"
+                v-for="(item, index) in dropData2"
                 :key="index"
                 :label="item.variableName"
                 :value="item.variableCoding"
@@ -142,7 +142,7 @@
           <el-form-item label="实时负荷:" prop="realTimeLoad">
             <el-select v-model="ruleForm.realTimeLoad" placeholder="请选择">
               <el-option
-                v-for="(item, index) in dropData2"
+                v-for="(item, index) in dropData"
                 :key="index"
                 :label="item.variableName"
                 :value="item.variableCoding"
@@ -153,7 +153,7 @@
           <el-form-item label="总用电量:" prop="totalElectricity">
             <el-select v-model="ruleForm.totalElectricity" placeholder="请选择">
               <el-option
-                v-for="(item, index) in dropData2"
+                v-for="(item, index) in dropData"
                 :key="index"
                 :label="item.variableName"
                 :value="item.variableCoding"
@@ -164,7 +164,7 @@
           <el-form-item label="功率因数:" prop="powerFactor">
             <el-select v-model="ruleForm.powerFactor" placeholder="请选择">
               <el-option
-                v-for="(item, index) in dropData2"
+                v-for="(item, index) in dropData"
                 :key="index"
                 :label="item.variableName"
                 :value="item.variableCoding"
@@ -213,7 +213,11 @@
             </div>
             <br />
             <el-form-item>
-              <el-button type="primary" @click="submitForm('formInfo')">
+              <el-button
+                type="primary"
+                @click="submitForm('formInfo')"
+                :disabled="isDisable"
+              >
                 保存
               </el-button>
               <el-button @click="resetForm('formInfo')">取消</el-button>
@@ -239,10 +243,12 @@ export default defineComponent({
     siteId: Number,
     siteName: String,
     groupingId: Number,
+    activeName: String,
   },
   setup(props, context) {
     const fileImages = ref(window.PLATFROM_CONFIG.images)
     const store = useStore()
+    const isDisable = ref(false)
     const routeDropData = ref([])
     const formInfo = ref(null)
     const formStatus = ref('')
@@ -305,14 +311,14 @@ export default defineComponent({
 
     // 动态属性下拉请求
     function dynamicPropertiesDroplist(dataArea) {
-      api.dynamicPropertiesDroplist({ dataArea: dataArea }).then((requset) => {
+      api.dynamicPropertiesDroplist({ dataArea: dataArea,siteId:props.siteId }).then((requset) => {
         if (requset.status === 'SUCCESS') {
           if (dataArea == 1) {
             //模拟量
-            dropData2.value = requset.data
+            dropData.value = requset.data
           } else {
             //状态量
-            dropData.value = requset.data
+            dropData2.value = requset.data
           }
         } else {
           ElMessage.error(requset.msg)
@@ -382,7 +388,7 @@ export default defineComponent({
             })
           }
           if (store.state.basicInfoSiteName) {
-            alert('props.siteName')
+            // alert('props.siteName')
             ruleForm.value.siteName = store.state.basicInfoSiteName
           }
 
@@ -413,6 +419,11 @@ export default defineComponent({
 
       formInfo.value.validate((valid) => {
         if (valid) {
+          isDisable.value = true
+          setTimeout(() => {
+            isDisable.value = false //点击一次时隔两秒后才能再次点击
+          }, 10000)
+
           store
           //  store.commit('TimeAll_function')
           // const time = store.state.Time_Data
@@ -459,7 +470,7 @@ export default defineComponent({
           }
 
           if (formStatus.value == '新增') {
-            params.site.groupingId = props.groupingId;
+            params.site.groupingId = props.groupingId
           }
 
           api.siteAdd(params).then((requset) => {
@@ -486,15 +497,24 @@ export default defineComponent({
     watch(
       () => props.siteId,
       (newVal) => {
+        // alert(newVal)
         console.log('newVal')
         console.log(newVal)
-        getSite()
+        if (props.activeName == 'first') {
+          getSite()
+        }
+      }
+    )
+    watch(
+      () => props.activeName,
+      (newVal) => {
+        if (newVal == 'first') {
+          getSite()
+        }
       }
     )
 
     onMounted(() => {
-      // alert(props.groupingId)
-
       if (props.siteName && !props.siteId) {
         // alert('新增站点不带模板')
         formStatus.value = '新增'
@@ -506,15 +526,15 @@ export default defineComponent({
         getSite()
       }
       if (store.state.basicInfoSiteName === '') {
-        // alert('修改站点')
         formStatus.value = '修改'
-        getSite() 
+        getSite()
+      }
+      if (props.activeName == 'first' && props.siteId) {
+        platformList()
+        routeDroplist()
+        dynamicPropertiesDroplist(2)
+        dynamicPropertiesDroplist(1)
       }
-
-      platformList()
-      routeDroplist()
-      dynamicPropertiesDroplist(2)
-      dynamicPropertiesDroplist(1)
     })
 
     return {
@@ -643,6 +663,7 @@ export default defineComponent({
       handleUpAvatar,
       fileImages,
       getSite,
+      isDisable,
     }
   },
 })

+ 27 - 17
src/views/siteManage/camera/index.vue

@@ -4,7 +4,9 @@
     <div class="filter-container mb-20">
       <div class="left">
         <div>
-          <a class="" style="margin-right: 30px">【测试站点1】站点的所有变量</a>
+          <a class="" style="margin-right: 30px">
+            【{{ labelCom }}】站点的所有摄像头设备
+          </a>
           <el-button icon="el-icon-plus" type="success" @click="addItem()">
             新增
           </el-button>
@@ -23,7 +25,7 @@
             accessToken: [accessToken],
           }"
           :file-list="fileList"
-          style="margin-right:10px;display:inline-block"
+          style="margin-right: 10px; display: inline-block"
         >
           <el-button size="small" type="primary">导入</el-button>
         </el-upload>
@@ -164,7 +166,7 @@
 
 <script>
 import { useStore } from 'vuex'
-import { defineComponent, ref, reactive, onMounted,watch } from 'vue'
+import { defineComponent, ref, reactive, onMounted, watch } from 'vue'
 // import * as api from '@/api/siteManage/watchDog.js'
 import * as api from '@/api/siteManage/camera.js'
 import { ElMessage } from 'element-plus'
@@ -176,7 +178,10 @@ import axios from 'axios'
 
 export default defineComponent({
   components: { DialogComponent, checkVideo },
-  props:[ 'siteId'],
+  props: {
+    siteId: Number,
+    activeName: String,
+  },
   setup(props, { emit }) {
     const store = useStore()
     store
@@ -205,6 +210,7 @@ export default defineComponent({
     const fileUrl = ref(window.PLATFROM_CONFIG.baseUrl)
     const fileList = ref([])
     const accessToken = ref(store.state.user.accessToken)
+    const labelCom = ref(store.state.siteManageLabelCom)
 
     //监控设备列表
     function videoMonitoringDeviceList() {
@@ -259,7 +265,6 @@ export default defineComponent({
 
     // 查看视频
     const checkVideo = () => {
-      alert(1)
       tableItem.value = {
         id: '',
         stationName: '',
@@ -319,7 +324,6 @@ export default defineComponent({
     }
 
     const chk_video = () => {
-   
       axios
         .post(
           'https://fire.usky.cn:8443/YtIoT/cgi-bin/demo2.cgi',
@@ -377,13 +381,11 @@ export default defineComponent({
       videoMonitoringDeviceList()
     }
 
-
-
-     //导出
+    //导出
     const DataReportExport = () => {
       api
         .deviceExport({
-           siteId: props.siteId,
+          siteId: props.siteId,
         })
         .then((requset) => {
           if (requset.status === 'SUCCESS') {
@@ -398,22 +400,29 @@ export default defineComponent({
         })
     }
 
-
     //监听变化
     watch(
       () => props.siteId,
       (newVal) => {
         console.log('newVal')
         console.log(newVal)
-        videoMonitoringDeviceList()
+        labelCom.value = store.state.siteManageLabelCom
+        if (props.activeName == 'five') {
+           videoMonitoringDeviceList()
+        }
+      }
+    )
+    watch(
+      () => props.activeName,
+      (newVal) => {
+        if (newVal == 'five') {
+          videoMonitoringDeviceList()
+        }
       }
     )
 
     onMounted(() => {
-      //   console.log('props.siteId')
-      // console.log(props.siteId)
-      
-      videoMonitoringDeviceList()
+     
     })
 
     return {
@@ -450,7 +459,6 @@ export default defineComponent({
       handleSizeChange,
       handleCurrentChange,
 
-
       DataReportExport,
 
       fileList,
@@ -458,6 +466,8 @@ export default defineComponent({
       accessToken,
       handleProgress,
       handleUpAvatar,
+
+      labelCom,
     }
   },
 })

+ 14 - 6
src/views/siteManage/index.vue

@@ -103,12 +103,13 @@
             :groupingId="groupingId"
             :siteName="siteName"
             @func="getMsgFormSon2"
+             :activeName="activeName"
           ></basic-info>
         </el-tab-pane>
         <el-tab-pane label="监控设备" name="second">
           <watch-dog
             v-on:success="success(res)"
-            :avtiveName="activeName"
+            :activeName="activeName"
             @func="getMsgFormSon"
             :siteId="siteId"
           ></watch-dog>
@@ -117,13 +118,14 @@
           <variable-list
             :activeName="activeName"
             :siteId="siteId"
+            :labelCom="labelCom"
           ></variable-list>
         </el-tab-pane>
         <el-tab-pane label="摄像头" name="five">
-          <camera :siteId="siteId"></camera>
+          <camera :siteId="siteId" :activeName="activeName"></camera>
         </el-tab-pane>
         <el-tab-pane label="电能质量评分配置" name="six">
-          <power-Score :siteId="siteId"></power-Score>
+          <power-Score :siteId="siteId" :activeName="activeName"></power-Score>
         </el-tab-pane>
       </el-tabs>
 
@@ -199,7 +201,8 @@ export default defineComponent({
     const dialogTitle = ref('')
     const treeLevel = ref(3)
     const groupingId = ref(1)
-    const siteId = ref(368)
+    const siteId = ref(0)
+    const labelCom=ref('')
     const siteName = ref('')
     const label = ref('')
     const activeName = ref('first')
@@ -277,13 +280,17 @@ export default defineComponent({
       label.value = obj.data.label
       console.log('obj.data')
       console.log(obj)
-      console.log(groupingId.value)
+      // console.log(groupingId.value)
+      labelCom.value=obj.data.label
+      store.state.siteManageLabelCom = obj.data.label
+      // console.log('labelCom.value')
+      // console.log(labelCom.value)
 
       if (treeLevel.value == 3) {
         siteId.value = obj.data.id
       }
       if (treeLevel.value == 2 && groupingId.value == 0) {
-        // console.log(obj.data)
+        // console.log(obj.data)  
         siteId.value = obj.data.id
       }
     }
@@ -407,6 +414,7 @@ export default defineComponent({
       tableItem,
       groupingId,
       siteId,
+      labelCom,
       label,
       flag2,
       showTree,

+ 34 - 7
src/views/siteManage/powerScore/index.vue

@@ -57,7 +57,11 @@
           <el-input v-model="ruleForm.powerFactorTwo"></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" @click="submitForm('ruleForm')">
+          <el-button
+            type="primary"
+            @click="submitForm('ruleForm')"
+            :disabled="isDisable"
+          >
             保存
           </el-button>
         </el-form-item>
@@ -73,12 +77,15 @@ import { ElMessage } from 'element-plus'
 
 export default defineComponent({
   name: 'PowerScore',
-  props: ['siteId'],
+  props: {
+    siteId: Number,
+    activeName: String,
+  },
   setup(props) {
-    
     const formInfo = ref(null)
     const formStatus = ref('')
     const ruleForm = ref({})
+    const isDisable = ref(false)
 
     //评分配置详情查询
     function powerQualityList() {
@@ -106,6 +113,9 @@ export default defineComponent({
       ruleForm.value.siteId = props.siteId
       formInfo.value.validate((valid) => {
         if (valid) {
+          
+          isDisable.value = true
+
           if (formStatus.value == 'add') {
             //新增
             api.powerQualityAdd(ruleForm.value).then((requset) => {
@@ -114,6 +124,9 @@ export default defineComponent({
                   message: '新增成功',
                   type: 'success',
                 })
+                setTimeout(() => {
+                  isDisable.value = false
+                }, 5000)
               } else {
                 ElMessage.error(requset.msg)
               }
@@ -126,6 +139,9 @@ export default defineComponent({
                   message: '修改成功',
                   type: 'success',
                 })
+                setTimeout(() => {
+                  isDisable.value = false
+                }, 5000)
               } else {
                 ElMessage.error(requset.msg)
               }
@@ -145,14 +161,24 @@ export default defineComponent({
         console.log('newVal')
         console.log(newVal)
         ruleForm.value.siteId = newVal
-        powerQualityList()
+        if (props.activeName == 'six') {
+          powerQualityList()
+        }
+      }
+    )
+    watch(
+      () => props.activeName,
+      (newVal) => {
+        if (newVal == 'six') {
+          powerQualityList()
+        }
       }
     )
 
     onMounted(() => {
-      powerQualityList()
-      console.log('props.siteId')
-      console.log(props.siteId)
+      // powerQualityList()
+      // console.log('props.siteId')
+      // console.log(props.siteId)
     })
 
     return {
@@ -183,6 +209,7 @@ export default defineComponent({
         ],
       },
       submitForm,
+      isDisable,
     }
   },
 })

+ 26 - 24
src/views/siteManage/variableList/index.vue

@@ -4,7 +4,9 @@
     <div class="filter-container mb-20">
       <div class="left">
         <div>
-          <a class="" style="margin-right: 30px">【测试站点1】站点的所有变量</a>
+          <a class="" style="margin-right: 30px">
+            【{{ labelCom }}】 站点的所有变量
+          </a>
           <el-button icon="el-icon-plus" type="success" @click="addItem()">
             新增
           </el-button>
@@ -56,7 +58,7 @@
             accessToken: [accessToken],
           }"
           :file-list="fileList"
-          style="margin-right:10px;display:inline-block"
+          style="margin-right: 10px; display: inline-block"
         >
           <el-button size="small" type="primary">导入</el-button>
         </el-upload>
@@ -89,13 +91,13 @@
       <el-table-column
         prop="variableCoding"
         label="变量编号"
-          width="150px"
+        width="150px"
         sortable
       ></el-table-column>
       <el-table-column
         prop="monitorDeviceName"
         label="监控设备"
-          width="150px"
+        width="150px"
       ></el-table-column>
       <el-table-column
         prop="deviceName"
@@ -161,7 +163,6 @@
         :page-size="pageSize"
         layout="total, sizes, prev, pager, next, jumper"
         :total="total"
-        
       ></el-pagination>
     </div>
     <!-- 分页end -->
@@ -189,6 +190,8 @@ export default defineComponent({
   name: 'VariableList',
   props: {
     siteId: Number,
+    labelCom: String,
+    activeName: String,
   },
 
   components: { DialogComponent },
@@ -240,8 +243,6 @@ export default defineComponent({
       query()
     }
 
-
-
     //是否删除  ---- 否
     const cancelEvent = () => {
       console.log('cancel!')
@@ -274,16 +275,21 @@ export default defineComponent({
     //监听变化
     watch(
       () => props.siteId,
+      () => {
+        if (props.activeName == 'third') {
+          query()
+        }
+      }
+    )
+    watch(
+      () => props.activeName,
       (newVal) => {
-        console.log('newVal')
-        console.log(newVal)
-        query()
+        if (newVal == 'third') {
+          query()
+        }
       }
     )
-
-    onMounted(() => {
-      query()
-    })
+    onMounted(() => {})
 
     const handleSizeChange = (val) => {
       console.log(`每页 ${val} 条`)
@@ -312,8 +318,8 @@ export default defineComponent({
     // 添加操作
     const addItem = () => {
       tableItem.value = {
-        monitoringEquipment:'',
-        communicationEquipment:''
+        monitoringEquipment: '',
+        communicationEquipment: '',
         // dataArea:'1'
       }
       dialogTitle.value = '新增'
@@ -325,28 +331,26 @@ export default defineComponent({
       //   dataArea: row.dataArea.toString(),
       //   monitoringEquipment: row.monitoringEquipment,
       //   communicationEquipment: row.communicationEquipment,
-       
+
       // }
 
       tableItem.value = row
       tableItem.value.dataArea = row.dataArea.toString()
       tableItem.value.monitoringEquipment = row.monitoringEquipment
-      tableItem.value.communicationEquipment =
-        row.communicationEquipment
+      tableItem.value.communicationEquipment = row.communicationEquipment
       dialogTitle.value = '编辑'
       showDialog.value = true
     }
-    
+
     // 关闭操作
     const closeDialog = () => {
       showDialog.value = false
       query()
     }
 
-
     //删除操作
     const handleDelete = (row) => {
-       api.variableListDel({ id: row.id }).then((requset) => {
+      api.variableListDel({ id: row.id }).then((requset) => {
         if (requset.status === 'SUCCESS') {
           ElMessage.success({
             message: '删除成功',
@@ -357,8 +361,6 @@ export default defineComponent({
           ElMessage.error(requset.msg)
         }
       })
-
-
     }
     // 获取数据
     const getVariableListone = () => {

+ 57 - 37
src/views/siteManage/watchDog/index.vue

@@ -2,7 +2,7 @@
   <div class="siteManage-main watchDog">
     <!-- 筛选start -->
     <div class="filter-container mb-20">
-      <a class="">【测试站点1】站点的所有监控设备</a>
+      <a class="">【{{ labelCom }}】站点的所有监控设备</a>
       <!-- <el-button icon="el-icon-plus" type="success" @click="addItem()">新增</el-button > -->
 
       <div>
@@ -17,11 +17,11 @@
             accessToken: [accessToken],
           }"
           :file-list="fileList"
-          style="margin-right:10px;display:inline-block"
+          style="margin-right: 10px; display: inline-block"
         >
           <el-button size="small" type="primary">导入</el-button>
         </el-upload>
-        <el-button type="primary"  @click="DataReportExport()">导出</el-button>
+        <el-button type="primary" @click="DataReportExport()">导出</el-button>
       </div>
     </div>
     <!-- 筛选end -->
@@ -92,20 +92,20 @@
             编辑
           </el-button>
           <el-popconfirm
-              confirm-button-text="是"
-              cancel-button-text="否"
-              icon="el-icon-info"
-              icon-color="red"
-              title="确定删除?"
-              @confirm="handleDelete(scope.row)"
-              @cancel="cancelEvent"
-            >
-              <template #reference>
-                <el-button type="text" size="small" class="delete-text">
-                  删除
-                </el-button>
-              </template>
-            </el-popconfirm>
+            confirm-button-text="是"
+            cancel-button-text="否"
+            icon="el-icon-info"
+            icon-color="red"
+            title="确定删除?"
+            @confirm="handleDelete(scope.row)"
+            @cancel="cancelEvent"
+          >
+            <template #reference>
+              <el-button type="text" size="small" class="delete-text">
+                删除
+              </el-button>
+            </template>
+          </el-popconfirm>
         </template>
       </el-table-column>
 
@@ -160,7 +160,7 @@
 
 <script>
 import { useStore } from 'vuex'
-import { defineComponent, ref, reactive, onMounted,watch } from 'vue'
+import { defineComponent, ref, reactive, onMounted, watch } from 'vue'
 import * as api from '@/api/siteManage/watchDog.js'
 import { ElMessage } from 'element-plus'
 
@@ -169,7 +169,10 @@ import Clone from './clone'
 
 export default defineComponent({
   components: { DialogComponent, Clone },
-  props:[ 'siteId'],
+  props: {
+    siteId: Number,
+    activeName: String,
+  },
   setup(props, { emit }) {
     const store = useStore()
     store
@@ -187,6 +190,8 @@ export default defineComponent({
     const showDialog = ref(false)
     const tableData = ref([])
 
+    const labelCom = ref(store.state.siteManageLabelCom)
+
     function goSiteList(params) {
       goSiteListParam.value = params.id
       pageShow.value = !pageShow.value
@@ -202,7 +207,7 @@ export default defineComponent({
     function deviceNewsList() {
       api
         .deviceNewsList({
-          siteId:props.siteId,
+          siteId: props.siteId,
           size: pageSize.value,
           current: currentPage.value,
         })
@@ -271,7 +276,7 @@ export default defineComponent({
       console.log('cancel!')
     }
 
-     const handleProgress = (file, fileList) => {
+    const handleProgress = (file, fileList) => {
       file
       if (
         !(
@@ -300,21 +305,7 @@ export default defineComponent({
       deviceNewsList()
     }
 
-    //监听变化
-    watch(
-      () => props.siteId,
-      (newVal) => {
-        console.log('newVal')
-        console.log(newVal)
-        deviceNewsList()
-      }
-    )
-
-    onMounted(() => {
-      //  console.log('props.siteId')
-      // console.log(props.siteId)
-      deviceNewsList()
-    })
+   
 
     function goVariableList() {
       emit('func')
@@ -337,7 +328,7 @@ export default defineComponent({
     const DataReportExport = () => {
       api
         .deviceAttributeExport({
-           siteId:props.siteId,
+          siteId: props.siteId,
         })
         .then((requset) => {
           if (requset.status === 'SUCCESS') {
@@ -351,6 +342,33 @@ export default defineComponent({
           }
         })
     }
+
+     //监听变化
+    watch(
+      () => props.siteId,
+      (newVal) => {
+        console.log('newVal')
+        console.log(newVal)
+        labelCom.value = store.state.siteManageLabelCom
+        if (props.activeName == 'second') {
+          deviceNewsList()
+        }
+      }
+    )
+    watch(
+      () => props.activeName,
+      (newVal) => {
+        if (newVal == 'second') {
+          deviceNewsList()
+        }
+      }
+    )
+
+     onMounted(() => {
+      // console.log('props.siteId')
+      // console.log(props.siteId)
+    })
+
     return {
       tableData,
       showDialog,
@@ -388,6 +406,8 @@ export default defineComponent({
       accessToken,
       handleProgress,
       handleUpAvatar,
+
+      labelCom,
     }
   },
 })