Parcourir la source

Merge remote-tracking branch 'origin/master'

xu il y a 3 mois
Parent
commit
3d292dee21
2 fichiers modifiés avec 171 ajouts et 11 suppressions
  1. 1 1
      server/config.yaml
  2. 170 10
      web/src/view/parking/parkingInfo.vue

+ 1 - 1
server/config.yaml

@@ -125,7 +125,7 @@ mysql:
     config: charset=utf8mb4&parseTime=True&loc=Local
     db-name: lc_garage
     username: root
-    password: root
+    password: 123456
     path: 127.0.0.1
     engine: ""
     log-mode: error

+ 170 - 10
web/src/view/parking/parkingInfo.vue

@@ -10,6 +10,7 @@
             <el-icon
               size="large"
               color="#008000"
+              @click="openRegion('创建区域', '')"
             >
               <Plus />
             </el-icon>
@@ -22,6 +23,17 @@
             </el-icon>
           </div>
         </div>
+        <el-menu default-active="0" background-color="#f5f5f5">
+          <el-menu-item v-for="(item,val) in regionList" :index="val.toString()" :key="item.ID" @click="changeRegion(item)">
+            <div style="display: flex;justify-content: space-between; align-items: center;width: 100%">
+              <span>{{item.lot_name}}}</span>
+              <div>
+                <el-icon @click.stop="openRegion('编辑区域', item)"><edit/></el-icon>
+                <el-icon @click.stop="deleteRegion(item.ID)"><delete/></el-icon>
+              </div>
+            </div>
+          </el-menu-item>
+        </el-menu>
       </div>
     </el-col>
     <el-col
@@ -338,6 +350,11 @@
       width="500"
     >
       <el-form label-width="90">
+        <el-form-item label="停车区域:">
+          <el-select v-model="positionRegionName" placeholder="请选择停车区域">
+            <el-option v-for="item in regionList" :value="item.lot_name" :key="item.ID"></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="岗亭编码:">
           <el-input v-model="positionData.booth_code" />
         </el-form-item>
@@ -494,6 +511,36 @@
         >确定</el-button>
       </template>
     </el-dialog>
+    <el-dialog v-model="regionShow" :title="regionTitle" width="500">
+      <el-form label-width="90">
+        <el-form-item label="区域编码:">
+          <el-input v-model="regionData.lot_code" />
+        </el-form-item>
+        <el-form-item label="区域名称:">
+          <el-input v-model="regionData.lot_name" />
+        </el-form-item>
+        <el-form-item label="区域容量:">
+          <el-input v-model="regionData.capacity" type="number"/>
+        </el-form-item>
+        <el-form-item label="备注:">
+          <el-input
+              v-model="regionData.description"
+              type="textarea"
+          />
+        </el-form-item>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="regionShow = false">取消</el-button>
+          <el-button
+              type="primary"
+              @click="regionOperation"
+          >
+            确认
+          </el-button>
+        </div>
+      </template>
+    </el-dialog>
   </el-row>
 </template>
 
@@ -513,6 +560,7 @@ import {
   deleteChannel
 } from '@/api/channel'
 import { addDevice, obtainDeviceList } from '@/api/device'
+import { addPullOver, editPullOver, obtainPullOverList, removePullOver } from '@/api/pullOver'
 import { ElMessage, ElMessageBox } from 'element-plus'
 
 const activeName = ref('detail')
@@ -522,18 +570,21 @@ const positionOperation = ref(0)
 
 const positionTitle = ref('岗亭新增')
 // 岗亭数据.......................................
+const positionRegionName = ref('')
 const positionData = reactive({
   id: '',
   booth_code: '',
   booth_name: '',
   ip_address: '',
-  description: ''
+  description: '',
+  parking_lot_id: 0
 })
 const guardTotal = ref(0)
 
 const positionList = reactive([])
 const addPosition = () => {
   if (positionTitle.value === '岗亭新增') {
+
     addGuardBooth(positionData).then(res => {
       if (res.code === 0) {
         ElMessage.success('添加成功')
@@ -569,6 +620,7 @@ const openPosition = (head, data) => {
   }
 }
 const searchGuardBooth = reactive({
+  parking_lot_id: 0,
   booth_code: '',
   booth_name: '',
   page: 1,
@@ -631,6 +683,7 @@ const delPosition = (id) => {
 // 通道数据
 const channelShow = ref(false)
 const queryChannelData = reactive({
+  parking_lot_id: 0,
   channel_code: '',
   channel_name: '',
   direction: '',
@@ -702,7 +755,6 @@ const getChannelList = () => {
   obtainChannelList(queryChannelData).then(res => {
     if (res.code === 0) {
       channelList.length = 0
-      console.log(res.data.list)
       channelList.push(...res.data.list)
     }
   })
@@ -710,6 +762,7 @@ const getChannelList = () => {
 
 // 设备管理...............................................
 const deviceData = reactive({
+  parking_lot_id: 0,
   device_code: '',
   device_name: '',
   device_type: 'VLPR',
@@ -744,27 +797,134 @@ const confirmType = () => {
 }
 
 const searchDeviceData = reactive({
+  parking_lot_id: 0,
   device_code: '',
   device_name: '',
-  device_type: '',
-  status: '',
+  status: false,
   page: 1,
   page_size: 10
 })
 const getDeviceList = async() => {
   await obtainDeviceList(searchDeviceData).then(res => {
     if (res.code === 0) {
-      console.log('设备列表', res.data.list)
       deviceList.length = 0
-      deviceList.push(...res.data.list)
+      if (res.data.list !== null) {
+        deviceList.push(...res.data.list)
+      }
     }
   })
 }
 
-onMounted(() => {
-  getGuardBoothList()
-  getChannelList()
-  getDeviceList()
+// 停车区域....................................
+const regionList = reactive([])
+// 查询停车区域
+const getRegionList = async () => {
+  await obtainPullOverList().then(res => {
+    if (res.code === 0) {
+      regionList.length = 0
+      regionList.push(...res.data.list)
+    }
+  })
+}
+// 停车区域操作
+const regionData = reactive({
+  id: 0,
+  lot_code: '',
+  lot_name: '',
+  capacity: 0,
+  description: ''
+})
+const regionShow = ref(false)
+const regionTitle = ref('创建区域')
+const openRegion = (head, data) => {
+  regionTitle.value = head
+  regionShow.value = true
+  if (head === '编辑区域') {
+    regionData.id = data.ID
+    regionData.lot_code = data.lot_code
+    regionData.lot_name = data.lot_name
+    regionData.capacity = data.capacity
+    regionData.description = data.description
+  } else {
+    regionData.lot_code = ''
+    regionData.lot_name = ''
+    regionData.capacity = 0
+    regionData.description = ''
+  }
+}
+const regionOperation = async () => {
+  if (regionTitle.value === '创建区域') {
+    regionData.capacity = Number(regionData.capacity)
+    await addPullOver(regionData).then(res => {
+      if(res.code === 0) {
+        getRegionList()
+        ElMessage.success('创建成功')
+        regionShow.value = false
+      }
+    })
+  } else {
+    await editPullOver(regionData).then(res => {
+      if(res.code === 0) {
+        getRegionList()
+        ElMessage.success('修改成功')
+        regionShow.value = false
+      }
+    })
+  }
+}
+
+const deleteRegion = (id) => {
+  ElMessageBox.confirm(
+      '确定要删除该停车区域吗?',
+      '提示',
+      {
+        confirmButtonText: '确认',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }
+  )
+      .then(() => {
+        removePullOver(id).then(res => {
+          if (res.code === 0) {
+            ElMessage({
+              type: 'success',
+              message: '删除成功',
+            })
+            getRegionList()
+          } else {
+            ElMessage({
+              type: 'error',
+              message: '删除失败',
+            })
+          }
+        })
+      })
+      .catch(() => {
+        ElMessage({
+          type: 'info',
+          message: '取消删除',
+        })
+      })
+}
+
+const changeRegion = async (item) => {
+  searchGuardBooth.parking_lot_id = item.ID
+  queryChannelData.parking_lot_id = item.ID
+  searchDeviceData.parking_lot_id = item.ID
+  await getGuardBoothList()
+  await getChannelList()
+  await getDeviceList()
+}
+onMounted(async () => {
+  await getRegionList()
+  if (regionList.length !== 0) {
+    searchGuardBooth.parking_lot_id = regionList[0].ID
+    queryChannelData.parking_lot_id = regionList[0].ID
+    searchDeviceData.parking_lot_id = regionList[0].ID
+    await getGuardBoothList()
+    await getChannelList()
+    await getDeviceList()
+  }
 })
 </script>