zhaobao 2 anni fa
parent
commit
11ffb35f03

+ 5 - 1
README.md

@@ -11,4 +11,8 @@ http://syfv.anquanzhuli.com/
 
 
 ### 启动命令
-#### yarn dev
+#### yarn dev
+
+
+前端 /data/wwwroot/goaf/web
+APP /data/wwwroot/goaf/app

+ 1 - 0
src/components/JobSelector/index.vue

@@ -54,6 +54,7 @@ export default {
         const { code, data, msg } = resp
         if (code === 0) {
           this.jobList = data
+          this.jobId = data[0].jobId
         } else {
           this.$message.error(msg)
         }

+ 67 - 0
src/layout/mixin/mqtt.js

@@ -0,0 +1,67 @@
+
+import { mqttUrl } from '@/settings'
+import mqtt from 'mqtt'
+export default {
+  destroyed() {
+    if (this.client.connected) {
+      try {
+        this.client.end(false, () => {
+          console.log('Successfully disconnected!')
+        })
+      } catch (error) {
+        console.log('Disconnect failed', error.toString())
+      }
+    }
+  },
+  methods: {
+    initMqtt(
+      params = {
+        mqttResponse: () => {}
+      }
+    ) {
+      const clientId = new Date().getTime()
+      const options = {
+        clean: true,
+        connectTimeout: 4000,
+        clientId: clientId,
+        username: 'admin',
+        password: 'houyaf1!',
+        will: {
+          topic: 'willTopic',
+          payload: clientId + '与服务器断开连接',
+          retain: false,
+          qos: 0
+        }
+      }
+      const client = mqtt.connect(mqttUrl, options)
+      client.on('connect', function() {
+        console.log('Connected')
+        client.subscribe('topic/alljobactivitys', function(err) {
+          console.log(err)
+          if (!err) {
+            client.publish('topic/1', 'Hello mqtt')
+          } else {
+            client.publish('topic/1', 'Hello mqtt err')
+          }
+        })
+      })
+      client.on('message', function(_topic, message) {
+        console.log('message')
+        if (params.mqttResponse)params.mqttResponse(message)
+      })
+      client.on('reconnect', (error) => {
+        console.log('正在重连:', error)
+      })
+      client.on('error', (error) => {
+        console.log('连接失败:', error)
+      })
+      client.on('close', function() {
+        console.log('Disconnected')
+      })
+      client.on('offline', function() {
+        console.log('offline')
+      })
+      this.client = client
+    }
+  }
+}

+ 12 - 8
src/mixin/mqtt.js

@@ -35,19 +35,23 @@ export default {
       }
       const client = mqtt.connect(mqttUrl, options)
       client.on('connect', function() {
-        console.log('Connected')
-        client.subscribe('topic/alljobactivitys', function(err) {
-          console.log(err)
+        client.subscribe('topic/goaf/waring/person', function(err) {
           if (!err) {
-            client.publish('topic/1', 'Hello mqtt')
+            client.publish('topic/goaf/waring/person', 'Hello mqtt')
           } else {
-            client.publish('topic/1', 'Hello mqtt err')
+            client.publish('topic/goaf/waring/person', 'Hello mqtt err')
+          }
+        })
+        client.subscribe('topic/goaf/waring/sensor', function(err) {
+          if (!err) {
+            client.publish('topic/goaf/waring/sensor', 'Hello mqtt')
+          } else {
+            client.publish('topic/goaf/waring/sensor', 'Hello mqtt err')
           }
         })
       })
-      client.on('message', function(_topic, message) {
-        console.log('message')
-        if (params.mqttResponse)params.mqttResponse(message)
+      client.on('message', function(topic, message) {
+        if (params.mqttResponse)params.mqttResponse(topic, message)
       })
       client.on('reconnect', (error) => {
         console.log('正在重连:', error)

+ 1 - 1
src/router/modules/aqpt.js

@@ -511,7 +511,7 @@ const aqptRouter = [
       {
         path: 'APP_download',
         component: () => import('@/views/system/app/download'),
-        name: 'aqpt_setting_sensor_cat',
+        name: 'aqpt_setting_app_update',
         meta: { title: 'APP升级', noCache: true, permit: 'aqpt_setting_equipment_cat' }
       }
       // {

+ 2 - 2
src/views/aqpt/checkTask/plan/components/CheckDefList.vue

@@ -39,8 +39,8 @@
         <el-table-column prop="accountName" label="执行人" header-align="center" align="center" width="100">
           <template v-slot="{row}">
             <el-popover v-if="row.accountName" trigger="hover" placement="top">
-              <p>部门: {{ row.groupName }}</p>
-              <p>岗位: {{ row.positionName }}</p>
+              <p v-if="row.groupName">部门: {{ row.groupName }}</p>
+              <p v-if="row.positionName">岗位: {{ row.positionName }}</p>
               <div slot="reference" class="name-wrapper">
                 <i class="el-icon-user" />
                 {{ row.accountName }}

+ 2 - 2
src/views/aqpt/checkTask/record/RecordList.vue

@@ -26,8 +26,8 @@
         <el-table-column prop="accountName" label="检查人员" header-align="center" align="center" width="100">
           <template v-slot="{row}">
             <el-popover trigger="hover" placement="top">
-              <p>部门: {{ row.groupName }}</p>
-              <p>岗位: {{ row.positionName }}</p>
+              <p v-if="row.groupName">部门: {{ row.groupName }}</p>
+              <p v-if="row.positionName">岗位: {{ row.positionName }}</p>
               <div slot="reference" class="name-wrapper">
                 <i class="el-icon-user" /> {{ row.accountName }}
               </div>

+ 1 - 1
src/views/goaf/checkTask/manage/CheckTaskList.vue

@@ -25,7 +25,7 @@
         </el-table-column>
         <el-table-column label="采空区">
           <template v-slot="{row}">
-            <span>{{ NumConvertLM(row.goafOrebelt) }}/{{ row.goafOrebody }}/{{ row.goafOreheight }}/{{ row.goafName }}</span>
+            <span>{{ NumConvertLM(row.goafOrebelt) }}-{{ row.goafOrebody }}-{{ row.goafOreheight }}-{{ row.goafName }}</span>
           </template>
         </el-table-column>
         <el-table-column prop="handleAccountName" label="执行人员" header-align="center" align="center" width="100">

+ 12 - 8
src/views/goaf/checkTask/plan/components/CheckDef.vue

@@ -76,21 +76,19 @@
             style="width: 100%"
           />
         </el-form-item>
-        <el-form-item v-if="0" label="调度任务" prop="timeSpan">
-          <JobSelector v-model="formData.jobId" :job-class-id="jobClassId" />
-        </el-form-item>
         <el-form-item label="检查频率">
           <el-row>
             <el-col :span="8"><el-input v-model="formData.checkCount" type="number" /></el-col>
             <el-col :span="4" style="color:#fff;padding-left: 5px;">次数/每</el-col>
-            <el-col :span="8">
-              <el-select v-model="formData.checkCycleUnit" filterable clearable>
+            <el-col :span="11">
+              <JobSelector v-model="formData.jobId" :job-class-id="jobClassId" />
+              <!-- <el-select v-model="formData.checkCycleUnit" filterable clearable>
                 <el-option :value="0" label="非周期" />
                 <el-option :value="1" label="日" />
                 <el-option :value="2" label="周" />
                 <el-option :value="3" label="月" />
                 <el-option :value="4" label="年" />
-              </el-select>
+              </el-select> -->
             </el-col>
           </el-row>
         </el-form-item>
@@ -150,7 +148,7 @@ export default {
         'defEndDate': '',
         'checkCount': 1,
         'checkCycleUnit': 3,
-        'jobId': 0,
+        'jobId': 439094,
         'checkDesc': '',
         'status': 0
       },
@@ -294,7 +292,7 @@ export default {
         'defEndDate': '',
         'checkCount': 1,
         'checkCycleUnit': 3,
-        'jobId': 0,
+        'jobId': 439094,
         'checkDesc': '',
         'status': 0
       }
@@ -305,6 +303,12 @@ export default {
       const { startDate, endDate } = this.formData
       if (startDate === null) this.formData.startDate = ''
       if (endDate === null) this.formData.endDate = ''
+
+      if (this.formData.jobId === 439094) { this.formData.checkCycleUnit = 1 }
+      if (this.formData.jobId === 439103) { this.formData.checkCycleUnit = 2 }
+      if (this.formData.jobId === 439105) { this.formData.checkCycleUnit = 3 }
+      if (this.formData.jobId === 439106) { this.formData.checkCycleUnit = 4 }
+
       this.$refs[formName].validate((valid) => {
         if (valid) {
           switch (this.actionType) {

+ 18 - 2
src/views/goaf/info/components/GoafInfo.vue

@@ -25,7 +25,7 @@
       </el-col>
     </el-row>
     <el-row class="m-top-15">
-      <el-table v-loading="listLoading" class="page-table" border fit :data="dataList">
+      <el-table v-loading="listLoading" class="page-table" border fit :data="dataList" @cell-dblclick="cellDblclick">
         <el-table-column prop="goafOrebelt" label="矿带">
           <template v-slot="{row}">
             <span>{{ convertNum(row.goafOrebelt) }}</span>
@@ -39,7 +39,17 @@
         <el-table-column prop="goafRockLithology" label="围岩岩性" />
         <el-table-column prop="goafRockStability" label="围岩稳定性" />
         <el-table-column prop="goafCanfillVolume" label="可充填体积(m³)" width="150" />
-        <el-table-column prop="goafRemainVolume" label="剩余可充填体积(m³)" width="180" />
+        <el-table-column prop="goafRemainVolume" label="剩余可充填体积(m³)" width="280">
+          <template v-slot="{row}">
+            <!-- <span v-if="row.status===1" style="color:'#49E86C'">
+              <el-input-number v-model="row.goafRemainVolume" placeholder="剩余可充填体积(m³)" :controls="false" size="mini" @blur="row.status=0" />
+              <input type="number" name="" >
+              <el-button type="primary">提交</el-button>
+            </span>
+            <span v-else>{{ row.goafRemainVolume }}</span> -->
+            <span>{{ row.goafRemainVolume }}</span>
+          </template>
+        </el-table-column>
         <el-table-column prop="goafIsFill" label="是否充填" width="80">
           <template v-slot="{row}">
             <span v-if="row.goafIsFill==0" style="color:'#49E86C'">是</span>
@@ -269,6 +279,12 @@ export default {
         goafRockLithology: '围岩岩性', goafRockStability: '围岩稳定性', goafFormationTime: '形成时间'
       }
     },
+    cellDblclick(row, cell) {
+      if (cell.property === 'goafRemainVolume') {
+        row.status = 1
+        row.goafRemainVolume = row.goafRemainVolume.toFixed()
+      }
+    },
     unique(arr = [], name = 'name') {
       const res = new Map()
       return arr.filter((item) => !res.has(item[name]) && res.set(item[name], 1))

+ 75 - 7
src/views/goaf/map/components/VisualEditor.vue

@@ -113,11 +113,15 @@ const markerIcon = L.icon({
   popupAnchor: [1, -38]
 })
 L.Marker.prototype.options.icon = markerIcon
+import mixins from '@/mixin/mqtt.js'
+import { NumConvertLM, Uint8ArrayToString } from '@/utils'
+const iconSize = [110, 110]
 export default {
   name: 'GoafVisualEditor',
   components: {
     MapSelector
   },
+  mixins: [mixins],
   data() {
     return {
       viewData: {},
@@ -195,11 +199,16 @@ export default {
   },
   methods: {
     init() {
-      this.initMap()
       getGoafBaseInfo().then((res) => {
         this.goaf = res.data
         this.goafOrebelts = this.unique(res.data, 'goafOrebelt')
       })
+      this.$nextTick(() => {
+        this.initMap()
+        this.initMqtt({
+          mqttResponse: this.mqttResponse
+        })
+      })
     },
 
     // 加载数据
@@ -288,7 +297,7 @@ export default {
           const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"></div>`
           var icon = L.divIcon({
             html,
-            iconSize: [50, 50]
+            iconSize
           })
           layer.setIcon(icon)
         }
@@ -300,7 +309,7 @@ export default {
           const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"></div>`
           var icon = L.divIcon({
             html,
-            iconSize: [50, 50]
+            iconSize
           })
           layer.setIcon(icon)
           self.layer = layer
@@ -355,15 +364,24 @@ export default {
         L.geoJSON(feature, {
           pointToLayer: function(_feature, latlng) {
             const goafInfo = _feature.properties.goafInfo
+            const goafOrebelt = _feature.properties.goafOrebelt
+            const goafOrebody = _feature.properties.goafOrebody
+            const goafOreheight = _feature.properties.goafOreheight
+            const goafName = _feature.properties.goafName
+            var goafAlarmStatus = ''
             let Volume = 0
             if (goafInfo) {
               Volume = (goafInfo.goafCanfillVolume - goafInfo.goafRemainVolume) / goafInfo.goafCanfillVolume
               Volume = (Volume * 100).toFixed(2)
             }
-            const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"><div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
+            if (_feature.properties.goafAlarmStatus === '1') {
+              goafAlarmStatus = 'ico-warning'
+            }
+            const goaf_icon_tag = `<div class="goaf-icon-tag" title="${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}">${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}</div>`
+            const html = `<div class="goaf-icon-box ${goafAlarmStatus}" style="width:100%;height:100%;position: relative;">${goaf_icon_tag}<div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
             var icon = L.divIcon({
               html,
-              iconSize: [50, 50]
+              iconSize
             })
             return L.marker(latlng, { icon })
           },
@@ -492,10 +510,15 @@ export default {
             }
             let Volume = (goafNames[i].goafCanfillVolume - goafNames[i].goafRemainVolume) / goafNames[i].goafCanfillVolume
             Volume = (Volume * 100).toFixed(2)
-            const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"><div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
+            const goafOrebelt = goafNames[i].goafOrebelt
+            const goafOrebody = goafNames[i].goafOrebody
+            const goafOreheight = goafNames[i].goafOreheight
+            const goafName = goafNames[i].goafName
+            const goaf_icon_tag = `<div class="goaf-icon-tag" title="${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}">${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}</div>`
+            const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;">${goaf_icon_tag}<div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
             var icon = L.divIcon({
               html,
-              iconSize: [50, 50]
+              iconSize
             })
             layer.setIcon(icon)
             this.saveForm.goafId = goafNames[i].goafId
@@ -567,6 +590,7 @@ export default {
           'goafOrebody': this.saveForm.goafOrebody,
           'goafOreheight': this.saveForm.goafOreheight,
           'goafName': this.saveForm.goafName,
+          'goafAlarmStatus': '0',
           'mapId': this.formData.mapId,
           'layerId': '',
           'layerCatId': '',
@@ -684,6 +708,14 @@ export default {
       }
       return geojson
     },
+    mqttResponse(message) {
+      const data = message ? Uint8ArrayToString(message) : ''
+      this.$nextTick(() => {
+        if (data.topictype === 'add' || data.topictype === 'completed') {
+          this.getLayers()
+        }
+      })
+    },
     unique(arr = [], name = 'name') {
       const res = new Map()
       return arr.filter((item) => !res.has(item[name]) && res.set(item[name], 1))
@@ -855,5 +887,41 @@ export default {
               background-image: url("./goaf/stone.png");
             }
         }
+        .goaf-icon-tag{
+    width: 100%;
+    display: inline-block;
+    background: linear-gradient(90deg, #21649c 0.21%, #060F1E 100%);
+    background-color: rgba(33, 100, 156,0.6);
+    overflow:hidden;
+    text-overflow:ellipsis;
+    white-space:nowrap;
+    color: #fff;
+    text-align: center;
+  }
+  /*动画*/
+.ico-warning {
+  position: relative;
+  &::after{
+    display: block;
+    content: "";
+    height: 60%;
+    width: 60%;
+    background-image: radial-gradient(yellow,red);
+    border-radius: 50% 50% 10% 10%;
+    animation: twinkle 0.5s infinite alternate;
+    position: absolute;
+    transform: translate(-50%,-50%);
+    left: 50%;
+    top: 50%;
+    box-shadow: 0 0 20px red;
+    z-index: 9999;
+  }
+}
+
+@keyframes twinkle {
+    0% {opacity: 0.9;}
+    50% {opacity: 0.5;}
+    100% {opacity: 0;}
+}
   </style>
 

+ 2 - 2
src/views/login/index.vue

@@ -72,8 +72,8 @@ export default {
   name: 'Login',
   data() {
     const validateUsername = (rule, value, callback) => {
-      if (value.length < 4) {
-        callback(new Error('请输入正确的用户名'))
+      if (value.length < 1) {
+        callback(new Error('用户名不能为空'))
       } else {
         callback()
       }

+ 7 - 7
src/views/system/group/user/User.vue

@@ -29,8 +29,8 @@
           <el-form-item label="工号" prop="accountStaffNo">
             <el-input v-model="formData.accountStaffNo" max="11" placeholder="输入工号" />
           </el-form-item>
-
-          <el-form-item v-show="viewData.isFixed!==1" label="岗位" prop="positionId">
+          <!-- v-show="viewData.isFixed!==1" -->
+          <el-form-item v-if="false" label="岗位" prop="positionId">
             <position-selector v-model="formData.positionId" />
           </el-form-item>
 
@@ -88,7 +88,7 @@ export default {
         accountRealName: '', // 姓名
         accountStaffNo: '', // 工号
         accountPhone: '', // 手机号
-        positionId: undefined, // 岗位,
+        positionId: 406192, // 岗位,
         accountIntro: ''
       },
       viewData: {
@@ -108,10 +108,10 @@ export default {
         ],
         accountStaffNo: [
           { required: false, message: '请输入工号', trigger: 'blur' }
-        ],
-        positionId: [
-          { required: true, message: '请选择岗位', trigger: 'blur' }
         ]
+        //, positionId: [
+        //   { required: true, message: '请选择岗位', trigger: 'blur' }
+        // ]
       },
       actionType: ''
     }
@@ -153,7 +153,7 @@ export default {
         password: '888888', // 密码
         accountRealName: '', // 姓名
         accountPhone: '', // 手机号
-        positionId: undefined// 岗位
+        positionId: 406192// 岗位
       }
     },
 

+ 2 - 2
src/views/system/group/user/UserList.vue

@@ -54,11 +54,11 @@
           </template>
         </el-table-column>
 
-        <el-table-column align="center" width="100" label="岗位">
+        <!-- <el-table-column align="center" width="100" label="岗位">
           <template v-slot="{row}">
             <span>{{ row.positionName }}</span>
           </template>
-        </el-table-column>
+        </el-table-column> -->
 
         <el-table-column align="center" label="状态" width="140">
           <template v-slot="{row}">