浏览代码

feat(前端):前端页面-站点信息,整合油机关联油枪信息

Zhenghanjv 3 月之前
父节点
当前提交
69b6226957
共有 22 个文件被更改,包括 767 次插入31 次删除
  1. 5 0
      Edge.Core/Domain/FccNozzleInfo/FccNozzleInfo.cs
  2. 57 0
      Edge.Core/Domain/FccNozzleInfo/Input/UploadNozzleInfoInput.cs
  3. 14 2
      Edge.Core/Domain/FccNozzleInfo/Output/DetailsNozzleInfoOutput.cs
  4. 13 0
      Edge.Core/Domain/FccNozzleInfo/Output/SimpleNozzleInfoOutput.cs
  5. 12 4
      HengshanPaymentTerminal/HengshanPayTermHandler.cs
  6. 20 0
      HengshanPaymentTerminal/Http/Request/HttpRequest.cs
  7. 7 0
      src/FccLife.Web/Controller/TankController.cs
  8. 7 0
      src/FccLife.Web/Repositories/FccNozzleInfo/INozzleInfoReposity.cs
  9. 33 0
      src/FccLife.Web/Repositories/FccNozzleInfo/NozzleInfoReposity.cs
  10. 1 1
      src/FccLife.Web/Repositories/FccOrderInfo/OrderInfoReposity.cs
  11. 7 0
      src/FccLife.Web/Services/FccNozzleInfo/INozzleInfnService.cs
  12. 52 8
      src/FccLife.Web/Services/FccNozzleInfo/NozzleInfoServiceImpl.cs
  13. 16 0
      src/FccWeb/admin.ui.plus-master/src/api/FormValidation.ts
  14. 35 0
      src/FccWeb/admin.ui.plus-master/src/api/api.ts
  15. 二进制
      src/FccWeb/admin.ui.plus-master/src/assets/machine.png
  16. 二进制
      src/FccWeb/admin.ui.plus-master/src/assets/nozzle.png
  17. 二进制
      src/FccWeb/admin.ui.plus-master/src/assets/tank.png
  18. 90 0
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/addMachine.vue
  19. 92 0
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/editMachine.vue
  20. 162 0
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/editOilGunFromMachine.vue
  21. 131 13
      src/FccWeb/admin.ui.plus-master/src/views/admin/components/oilcanDetail.vue
  22. 13 3
      src/FccWeb/admin.ui.plus-master/src/views/admin/station/station.vue

+ 5 - 0
Edge.Core/Domain/FccNozzleInfo/FccNozzleInfo.cs

@@ -18,6 +18,11 @@ namespace Edge.Core.Domain.FccNozzleInfo
         ///// </summary>
         //public int Port { get; set; }
 
+        /// <summary>
+        /// 云端油枪id
+        /// </summary>
+        public long CloundNozzleId { get; set; } = 0;
+
         /// <summary>
         /// 加油点
         /// </summary>

+ 57 - 0
Edge.Core/Domain/FccNozzleInfo/Input/UploadNozzleInfoInput.cs

@@ -49,4 +49,61 @@
             };
         }
     }
+
+    public class UploadNozzleInfoForMazhineInput
+    {
+        /// <summary>
+        /// 油枪id
+        /// </summary>
+        public long? Id { get; set; }
+
+        /// <summary>
+        /// 云端油枪id
+        /// </summary>
+        public long? CloundNozzleId { get; set; }
+
+        /// <summary>
+        /// 加油点
+        /// </summary>
+        public int FuelPoint { get; set; }
+
+        /// <summary>
+        /// 内部枪号
+        /// </summary>
+        public int InternalNum { get; set; }
+
+        /// <summary>
+        /// 外部枪号
+        /// </summary>
+        public int NozzleNum { get; set; }
+
+        /// <summary>
+        /// 关联油罐id
+        /// </summary>
+        public long TankId { get; set; }
+
+        /// <summary>
+        /// 关联油罐号
+        /// </summary>
+        public int TankNum { get; set; }
+
+        /// <summary>
+        /// 油机id
+        /// </summary>
+        public long MachineId { get; set; }
+
+        public FccNozzleInfo ToComponent()
+        {
+            return new FccNozzleInfo()
+            {
+                CloundNozzleId = this.CloundNozzleId ?? 0,
+                FuelPoint = this.FuelPoint,
+                InternalNum = this.InternalNum,
+                ExternalNum = this.NozzleNum,
+                TankId = this.TankId,
+                TankNum = this.TankNum,
+                MachineId = this.MachineId
+            };
+        }
+    }
 }

+ 14 - 2
Edge.Core/Domain/FccNozzleInfo/Output/DetailsNozzleInfoOutput.cs

@@ -8,9 +8,9 @@
         public long Id { get; set; }
 
         /// <summary>
-        /// 油机连接FCC端口
+        /// 云端油枪id
         /// </summary>
-        public int Port { get; set; }
+        public long CloundNozzleId { get; set; }
 
         /// <summary>
         /// 加油点
@@ -42,16 +42,28 @@
         /// </summary>
         public List<RelatableTank> RelatableTanks { get; set; }
 
+        /// <summary>
+        /// 油机id
+        /// </summary>
+        public long MachineId { get; set; }
+
+        /// <summary>
+        /// 油品名
+        /// </summary>
+        public string OilName { get; set; }
+
         public DetailsNozzleInfoOutput() { }
 
         public DetailsNozzleInfoOutput(FccNozzleInfo fccNozzleInfo)
         {
             this.Id = fccNozzleInfo.Id;
+            this.CloundNozzleId = fccNozzleInfo.CloundNozzleId;
             this.FuelPoint = fccNozzleInfo.FuelPoint;
             this.InternalNum = fccNozzleInfo.InternalNum;
             this.NozzleNum = fccNozzleInfo.ExternalNum;
             this.TankId = fccNozzleInfo.TankId;
             this.TankNum = fccNozzleInfo.TankNum;
+            this.MachineId = fccNozzleInfo.MachineId;
         }
         public class RelatableTank
         {

+ 13 - 0
Edge.Core/Domain/FccNozzleInfo/Output/SimpleNozzleInfoOutput.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Edge.Core.Domain.FccNozzleInfo.Output
+{
+    public class SimpleNozzleInfoOutput
+    {
+        public long Id { get; set; }
+    }
+}

+ 12 - 4
HengshanPaymentTerminal/HengshanPayTermHandler.cs

@@ -704,11 +704,19 @@ namespace HengshanPaymentTerminal
         /// <summary>
         /// 获取站点信息
         /// </summary>
-        private void GetInfo()
+        private async void GetInfo()
         {
             Edge.Core.Domain.FccStationInfo.FccStationInfo? fccStationInfo = MysqlDbContext.FccStationInfos.FirstOrDefault();
             if(fccStationInfo != null) stationInfo = new StationInfo(fccStationInfo);
-            nozzleInfoList = MysqlDbContext.NozzleInfos.ToList().Select(n => new DetailsNozzleInfoOutput(n)).ToList();
+            Edge.Core.Domain.FccMachineInfo.FccMachineInfo? fccMachineInfo = await MysqlDbContext.FccMachineInfos.FirstOrDefaultAsync(machine => machine.Port == serverPort);
+            if(fccMachineInfo == null)
+            {
+                nozzleInfoList = new List<DetailsNozzleInfoOutput>();
+            } else
+            {
+                nozzleInfoList = MysqlDbContext.NozzleInfos.Where(nozzle => nozzle.MachineId == fccMachineInfo.Id).Select(n => new DetailsNozzleInfoOutput(n)).ToList();
+            }
+            
         }
 
         /// <summary>
@@ -766,8 +774,8 @@ namespace HengshanPaymentTerminal
                 return;
             }
 
-            List<DetailsNozzleInfoOutput> nozzles = nozzleInfoList.FindAll(nozzle => nozzle.Port == serverPort);
-            foreach (var item in nozzles)
+            
+            foreach (var item in nozzleInfoList)
             {
                 //List<Byte> list = new List<Byte>();
                 //byte[] commandAndNozzle = { 0x63, (byte)item.NozzleNum };

+ 20 - 0
HengshanPaymentTerminal/Http/Request/HttpRequest.cs

@@ -36,6 +36,16 @@ namespace HengshanPaymentTerminal.Http.Request
             this.ProductId = fccTankInfo?.OilId ?? 0;
         }
 
+        public SendNozzleInfo(long id, UploadNozzleInfoForMazhineInput uploadNozzleInfoInput, FccTankInfo? fccTankInfo)
+        {
+            this.NozzleId = id;
+            this.PumpId = uploadNozzleInfoInput.FuelPoint;
+            this.InternalGunNumber = uploadNozzleInfoInput.InternalNum;
+            this.ExternalGunNumber = uploadNozzleInfoInput.NozzleNum;
+            this.TankID = fccTankInfo?.Id ?? 0;
+            this.ProductId = fccTankInfo?.OilId ?? 0;
+        }
+
         /// <summary>
         /// fcc油枪id
         /// </summary>
@@ -82,6 +92,16 @@ namespace HengshanPaymentTerminal.Http.Request
             this.ProductId = fccTankInfo?.OilId ?? 0;
         }
 
+        public UpdateNozzleInfo(long id, UploadNozzleInfoForMazhineInput uploadNozzleInfoInput, FccTankInfo? fccTankInfo)
+        {
+            this.NozzleId = id;
+            this.PumpId = uploadNozzleInfoInput.FuelPoint;
+            this.InternalGunNumber = uploadNozzleInfoInput.InternalNum;
+            this.ExternalGunNumber = uploadNozzleInfoInput.NozzleNum;
+            this.TankID = fccTankInfo?.Id ?? 0;
+            this.ProductId = fccTankInfo?.OilId ?? 0;
+        }
+
         /// <summary>
         /// fcc油枪id
         /// </summary>

+ 7 - 0
src/FccLife.Web/Controller/TankController.cs

@@ -72,6 +72,13 @@ namespace FccLite.Web.Controller
             return Ok(result);
         }
 
+        [HttpPost("uploadDetailsNozzleInfoForMachine")]
+        public async Task<IActionResult> UploadDetailsNozzleInfoForMachine(UploadNozzleInfoForMazhineInput uploadNozzleInfoInput)
+        {
+            SetNozzleInfoOutput result = await _nozzleInfnService.UploadDetailsNozzleInfoForMachine(uploadNozzleInfoInput);
+            return Ok(result);
+        }
+
         [HttpPost("deleteNozzle")]
         public async Task<IActionResult> DeleteNozzle(long id)
         {

+ 7 - 0
src/FccLife.Web/Repositories/FccNozzleInfo/INozzleInfoReposity.cs

@@ -18,6 +18,13 @@ namespace FccLite.Web.Repositories.FccNozzleInfo
         /// <returns></returns>
         Task<long> UploadNozzleInfo(UploadNozzleInfoInput uploadNozzleInfoInput);
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="uploadNozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        Task<long> UploadNozzleInfoFroMachine(UploadNozzleInfoForMazhineInput uploadNozzleInfoInput);
+
         /// <summary>
         /// 根据id 删除油枪信息
         /// </summary>

+ 33 - 0
src/FccLife.Web/Repositories/FccNozzleInfo/NozzleInfoReposity.cs

@@ -55,6 +55,37 @@ namespace FccLite.Web.Repositories.FccNozzleInfo
             return info.Id;
         }
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="uploadNozzleInfoInput">油枪信息</param>
+        /// <returns>油枪id</returns>
+        public async Task<long> UploadNozzleInfoFroMachine(UploadNozzleInfoForMazhineInput uploadNozzleInfoInput)
+        {
+            if (uploadNozzleInfoInput.Id != null)
+            {
+                Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo? fccNozzleInfo = await _dbContext.NozzleInfos.FirstOrDefaultAsync(info => info.Id == uploadNozzleInfoInput.Id);
+                if (fccNozzleInfo == null)
+                {
+                    Logger.Info($"find nozzle info with id : {uploadNozzleInfoInput.Id} for update by machine, result is null");
+                    return 0;
+                }
+                fccNozzleInfo.FuelPoint = uploadNozzleInfoInput.FuelPoint;
+                fccNozzleInfo.InternalNum = uploadNozzleInfoInput.InternalNum;
+                fccNozzleInfo.ExternalNum = uploadNozzleInfoInput.NozzleNum;
+                fccNozzleInfo.TankId = uploadNozzleInfoInput.TankId;
+                fccNozzleInfo.TankNum = uploadNozzleInfoInput.TankNum;
+                fccNozzleInfo.MachineId = uploadNozzleInfoInput.MachineId;
+                if(uploadNozzleInfoInput.CloundNozzleId != null) fccNozzleInfo.CloundNozzleId = (long)uploadNozzleInfoInput.CloundNozzleId;
+                await _dbContext.SaveChangesAsync();
+                return fccNozzleInfo.Id;
+            }
+
+            Edge.Core.Domain.FccNozzleInfo.FccNozzleInfo info = uploadNozzleInfoInput.ToComponent();
+            _dbContext.NozzleInfos.Add(info);
+            await _dbContext.SaveChangesAsync();
+            return info.Id;
+        }
         /// <summary>
         /// 根据id 删除油枪信息
         /// </summary>
@@ -83,5 +114,7 @@ namespace FccLite.Web.Repositories.FccNozzleInfo
         {
             return await _dbContext.NozzleInfos.Where(nozzle => nozzle.MachineId == machineId).ToListAsync();
         }
+
+       
     }
 }

+ 1 - 1
src/FccLife.Web/Repositories/FccOrderInfo/OrderInfoReposity.cs

@@ -23,7 +23,7 @@ namespace FccLite.Web.Repositories.FccOrderInfo
             IQueryable<Edge.Core.Domain.FccOrderInfo.FccOrderInfo> query = _dbContext.FccOrderInfos.AsQueryable();
 
             query = query.Where(order => order.IsDelete == 0);
-            query = query.WhereIf(orderInfoPageInput.oilName != null && "".Equals(orderInfoPageInput.oilName),order => order.OilName.Equals(orderInfoPageInput.oilName));
+            query = query.WhereIf(orderInfoPageInput.oilName != null && !"".Equals(orderInfoPageInput.oilName),order => order.OilName.Equals(orderInfoPageInput.oilName));
             query = query.WhereIf(orderInfoPageInput.nozzleNum != null, order => order.NozzleNum == orderInfoPageInput.nozzleNum);
             //query = query.WhereIf(orderInfoPageInput.ttc != null, order => order.Ttc == orderInfoPageInput.ttc);
             if (orderInfoPageInput.startCheckTime != null && orderInfoPageInput.endCheckTime != null)

+ 7 - 0
src/FccLife.Web/Services/FccNozzleInfo/INozzleInfnService.cs

@@ -12,6 +12,13 @@ namespace FccLite.Web.Services.FccNozzleInfo
         /// <returns></returns>
         Task<SetNozzleInfoOutput> UploadDetailsNozzleInfo(UploadNozzleInfoInput nozzleInfoInput);
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="nozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        Task<SetNozzleInfoOutput> UploadDetailsNozzleInfoForMachine(UploadNozzleInfoForMazhineInput nozzleInfoInput);
+
         /// <summary>
         /// 根据id获取油枪信息
         /// </summary>

+ 52 - 8
src/FccLife.Web/Services/FccNozzleInfo/NozzleInfoServiceImpl.cs

@@ -33,7 +33,6 @@ namespace FccLite.Web.Services.FccNozzleInfo
         /// <returns></returns>
         public async Task<SetNozzleInfoOutput> UploadDetailsNozzleInfo(UploadNozzleInfoInput nozzleInfoInput)
         {
-            await _httpClientUtils.SendNozzleStatu("[{\"NozzleId\":68,\"Status\":3},{\"NozzleId\":63,\"Status\":3},{\"NozzleId\":64,\"Status\":3},{\"NozzleId\":65,\"Status\":3},{\"NozzleId\":66,\"Status\":3},{\"NozzleId\":69,\"Status\":3}]");
             long id = await _nozzleInfoReposity.UploadNozzleInfo(nozzleInfoInput);
             Logger.Info($"upload nozzle info , id {id}");
 
@@ -74,6 +73,54 @@ namespace FccLite.Web.Services.FccNozzleInfo
             };
         }
 
+        /// <summary>
+        /// 新增、修改油枪信息
+        /// </summary>
+        /// <param name="nozzleInfoInput">油枪信息</param>
+        /// <returns></returns>
+        public async Task<SetNozzleInfoOutput> UploadDetailsNozzleInfoForMachine(UploadNozzleInfoForMazhineInput nozzleInfoInput)
+        {
+            long id = await _nozzleInfoReposity.UploadNozzleInfoFroMachine(nozzleInfoInput);
+            Logger.Info($"upload nozzle info for machine , id {id}");
+
+            if (id > 0)
+            {
+                try
+                {
+                    Edge.Core.Domain.FccTankInfo.FccTankInfo? fccTankInfo = await _tankReposity.GetDetailsTankByTankIdAsync(nozzleInfoInput.TankId);
+                    if (nozzleInfoInput.Id == null)
+                    {
+                        SendNozzleInfo sendNozzleInfo = new SendNozzleInfo(id, nozzleInfoInput, fccTankInfo);
+                        var requestJson = JsonConvert.SerializeObject(sendNozzleInfo);
+                        HttpResponseMessage httpResponseMessage = await _httpClientUtils.SendNozzleInfo(requestJson);
+                        Logger.Info($"send nozzle response : {httpResponseMessage.Content}");
+                    }
+                    else
+                    {
+                        UpdateNozzleInfo updateNozzleInfo = new UpdateNozzleInfo(id, nozzleInfoInput, fccTankInfo);
+                        var requestJson = JsonConvert.SerializeObject(updateNozzleInfo);
+                        HttpResponseMessage httpResponseMessage = await _httpClientUtils.UpdateNozzleInfo(requestJson);
+                        Logger.Info($"update nozzle response : {httpResponseMessage.Content}");
+                    }
+                }
+                catch (Exception e)
+                {
+                    Logger.Error($"send nozzle to cloud error:{e.Message}", e);
+                }
+                return new SetNozzleInfoOutput()
+                {
+                    Result = true,
+                    Message = "保存成功"
+                };
+            }
+
+            return new SetNozzleInfoOutput()
+            {
+                Result = true,
+                Message = "无更新"
+            };
+        }
+
         /// <summary>
         /// 根据id获取油枪信息
         /// </summary>
@@ -90,14 +137,9 @@ namespace FccLite.Web.Services.FccNozzleInfo
             List<DetailsNozzleInfoOutput.RelatableTank> tanks = await _tankReposity.GetTankInfo();
             Logger.Info($"find all tanks info for nozzle info details,count is {tanks.Count}");
 
-            return new DetailsNozzleInfoOutput()
+            return new DetailsNozzleInfoOutput(fccNozzleInfo)
             {
-                Id = fccNozzleInfo.Id,
-                NozzleNum = fccNozzleInfo.ExternalNum,
-                FuelPoint = fccNozzleInfo.FuelPoint,
-                InternalNum = fccNozzleInfo.InternalNum,
-                TankId = fccNozzleInfo.TankId,
-                TankNum = fccNozzleInfo.TankNum,
+                
                 RelatableTanks = tanks,
             };
             
@@ -141,5 +183,7 @@ namespace FccLite.Web.Services.FccNozzleInfo
                 Message = "删除失败"
             };
         }
+
+        
     }
 }

+ 16 - 0
src/FccWeb/admin.ui.plus-master/src/api/FormValidation.ts

@@ -23,6 +23,12 @@ const addStationRules = reactive({
     capacity: [{ required: true, message: '请输入罐容量', trigger: 'blur', }],
   })
   
+  // 验证规则 - 添加油机
+  const addMachineRules = reactive({
+    name: [{ required: true, message: '请输入油机名称', trigger: 'blur', }],
+    port: [{ required: true, message: '请输入连接FCC端口', trigger: 'blur', }],
+  })
+
   // 验证规则 - 编辑油品
   const editOilRules = reactive({
     code: [{ required: true, message: '请输入油品码', trigger: 'blur', }],
@@ -39,10 +45,20 @@ const addStationRules = reactive({
     tankId: [{ required: true, message: '请输入关联油罐ID', trigger: 'blur', }],
     tankNum: [{ required: true, message: '请输入关联油罐号', trigger: 'blur', }],
   })
+
+  // 验证规则 - 编辑油枪(油机页)
+  const editOilGunForMachineRules = reactive({
+    nozzleNum: [{ required: true, message: '请输入油枪号', trigger: 'blur', }],
+    fuelPoint: [{ required: true, message: '请输入加油点', trigger: 'blur', }],
+    internalNum: [{ required: true, message: '请输入内部油枪号', trigger: 'blur', }],
+    // tankName: [{ required: true, message: '请选择油罐号', trigger: 'blur', }],
+  })
   
   export {
     addStationRules,
     addDeviceRules,
     editOilRules,
     editOilGunRules,
+    addMachineRules,
+    editOilGunForMachineRules,
   }

+ 35 - 0
src/FccWeb/admin.ui.plus-master/src/api/api.ts

@@ -74,6 +74,32 @@ export const deleteTank = (data:any)=>{
 	})
 }
 
+/** ----- 油机 ----- */
+//获取油机
+export const getMachine = (data:any)=>{
+	return request({
+		url:'/qrFueling/machine/getMachineInfo',
+		method:'get',
+		params:data
+	})
+}
+//更新油机信息
+export const uploadMaichine = (data:any)=>{
+	return request({
+		url:'/qrFueling/machine/uploadMachineInfo',
+		method:'post',
+		data:data
+	})
+}
+//删除油机
+export const deleteMachine = (data:any)=>{
+	return request({
+		url:'/qrFueling/machine/deleteMaichineInfo',
+		method:'post',
+		params:data
+	})
+}
+
 /** ----- 油枪 ----- */
 // 获取油枪信息
 export const getNozzleInfo = (data:any)=>{
@@ -93,6 +119,15 @@ export const uploadNozzleInfo = (data:any)=>{
 	})
 }
 
+// 添加油枪信息(油机页)
+export const uploadNozzleInfoForMachine = (data:any)=>{
+	return request({
+		url:'/qrFueling/tank/uploadDetailsNozzleInfoForMachine',
+		method:'post',
+		data:data
+	})
+}
+
 // 删除油枪信息
 export const deleteNozzle = (data:any)=>{
 	return request({

二进制
src/FccWeb/admin.ui.plus-master/src/assets/machine.png


二进制
src/FccWeb/admin.ui.plus-master/src/assets/nozzle.png


二进制
src/FccWeb/admin.ui.plus-master/src/assets/tank.png


+ 90 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/components/addMachine.vue

@@ -0,0 +1,90 @@
+<!-- 
+** 新增设备 - 油罐
+-->
+<template>
+    <el-dialog title="新增油机" v-model="isDisplay.isShowDialog" class="main-content" width="769px">
+        <el-form :model="dataList" ref="ruleFormRef" label-width="5em" :rules="addMachineRules" size="default">
+            <el-row :gutter="35">
+                <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油站ID" :required="true" prop="stationId">
+                        <el-input v-model="dataList.stationId" disabled placeholder="油站ID" clearable />
+                    </el-form-item>
+                </el-col> -->
+                <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10" class="mb20">
+                    <el-form-item label="油机号" :required="true" prop="name">
+                        <el-input v-model="dataList.name" placeholder="油机号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="13" :md="13" :lg="13" :xl="13" class="mb20">
+                    <el-form-item label="连接FCC端口" prop="port">
+                        <el-input v-model="dataList.port" placeholder="连接FCC端口" clearable />
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+        <el-row justify="end" class="submit-button">
+            <el-button type="primary" @click="submit">确定</el-button>
+        </el-row>
+    </el-dialog>
+</template>
+<script setup lang="ts">
+import { ref, defineExpose, reactive, onMounted } from 'vue';
+import { uploadMaichine } from "/@/api/api"
+import { addMachineRules } from '/@/api/FormValidation';
+import eventBus from "/@/utils/mitt";
+
+
+
+const isDisplay = reactive({
+    isShowDialog: false,
+    loading: false
+})
+const data = reactive({
+    oilsList: <any>[],
+    NameList: <any>[]
+})
+
+// 定义 所需添加数据
+let dataList = reactive({
+    /** 油站 */
+    stationId: null,
+    /** 油机号 */
+    name: null,
+    /** 连接FCC的端口 */
+    port: null,
+})
+
+// 创建表单实例
+const ruleFormRef = ref()
+// 提交 油罐添加信息
+const submit = async () => {
+    ruleFormRef.value.validate(async (valid: boolean) => {
+        // 表单验证不成功,不进行任何操作
+        if (!valid) return
+
+        isDisplay.loading = true
+        await uploadMaichine(dataList).then((res) => {
+            console.log(res)
+            isDisplay.loading = false
+        })
+
+        dataList.stationId = null
+        dataList.name = null
+        dataList.port = null
+        eventBus.emit('refreshViewMachine')
+        isDisplay.isShowDialog = false
+    })
+
+}
+
+const openDialog = (id: any) => {
+    dataList.stationId = id
+    isDisplay.isShowDialog = true
+
+}
+defineExpose({
+    openDialog,
+})
+</script>
+
+<style lang="scss"></style>

+ 92 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/components/editMachine.vue

@@ -0,0 +1,92 @@
+<!-- 
+** 编辑设备 - 油罐
+-->
+<template>
+    <el-dialog title="编辑油机" v-model="isDisplay.isShowDialog" width="769px" class="main-content">
+        <el-form :model="dataList" v-loading="isDisplay.loading" ref="ruleFormRef" label-width="5em" :rules="addMachineRules">
+            <el-row :gutter="35">
+                <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油罐号" :required="true" @focus="getOil" prop="number">
+                        <el-input v-model="dataList.number" />
+                    </el-form-item>
+                </el-col> -->
+                <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10" class="mb20">
+                    <el-form-item label="油机号" :required="true" prop="name">
+                        <el-input v-model="dataList.name" placeholder="油机号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="13" :md="13" :lg="13" :xl="13" class="mb20">
+                    <el-form-item label="连接FCC端口" prop="port">
+                        <el-input v-model="dataList.port" placeholder="连接FCC端口" clearable />
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+        <el-row justify="end" class="submit-button">
+            <el-button type="primary" @click="submit">确定</el-button>
+        </el-row>
+
+    </el-dialog>
+</template>
+<script setup lang="ts">
+import { ref, defineExpose, reactive, onMounted } from 'vue';
+import { uploadMaichine,deleteMachine } from "/@/api/api"
+import { addMachineRules } from '/@/api/FormValidation'
+import eventBus from "/@/utils/mitt";
+
+// 子 传数据给父
+const emit = defineEmits(['getDialogData'])
+const isDisplay = reactive({
+    isShowDialog: false,
+    loading: false
+})
+const data = reactive({
+    oilsList: <any>[],
+    NameList: <any>[]
+
+})
+
+// 定义 所需添加数据
+let dataList = reactive({
+    /** 油站 */
+    stationId: null,
+    /** 油机id */
+    id: null,
+    /** 油机号 */
+    name: null,
+    /** 连接FCC的端口 */
+    port: null,
+})
+
+// 创建表单实例
+const ruleFormRef = ref()
+// 提交 油罐编辑信息
+const submit = async () => {
+    ruleFormRef.value.validate(async (valid: boolean) => {
+        // 表单验证不成功,不进行任何操作
+        if (!valid) return
+
+        isDisplay.loading = true
+        await uploadMaichine(dataList).then((res) => {
+            console.log(res)
+            isDisplay.loading = false
+            eventBus.emit('refreshViewMachine')
+            isDisplay.isShowDialog = false
+        })
+    })
+}
+
+const openDialog = (data: any) => {
+    dataList.stationId = data.stationId
+    dataList.id = data.id
+    dataList.name = data.name
+    dataList.port = data.port
+    isDisplay.isShowDialog = true
+}
+defineExpose({
+    openDialog,
+})
+</script>
+
+<style lang="scss">
+// @import url('@/theme/form.scss');</style>

+ 162 - 0
src/FccWeb/admin.ui.plus-master/src/views/admin/components/editOilGunFromMachine.vue

@@ -0,0 +1,162 @@
+<!-- 
+** 修改油枪信息(油机页)
+-->
+
+<template>
+    <el-dialog :title=title v-model="isDisplay.isShowDialog" class="main-content" width="769px">
+        <el-form :model="dataList" v-loading="isDisplay.loading" ref="ruleFormRef" label-width="6em" :rules="editOilGunForMachineRules">
+            <el-row :gutter="35">
+                <!-- <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油罐号" prop="tankNum">
+                        <el-input v-model="dataList.tankNum" disabled placeholder="请输入油罐号" clearable />
+                    </el-form-item>
+                </el-col> -->
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="加油点" prop="fuelPoint">
+                        <el-input v-model="dataList.fuelPoint" placeholder="请输入加油点" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="内部枪号" prop="internalNum">
+                        <el-input v-model="dataList.internalNum" placeholder="请输入内部油枪号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油枪号" :required="true" prop="nozzleNum">
+                        <el-input v-model="dataList.nozzleNum" placeholder="请输入油枪号" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col v-if="dataInfos.flag == 1" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="云端油枪id" prop="cloundNozzleId">
+                        <el-input v-model="dataList.cloundNozzleId" placeholder="请输入云端油枪id" clearable />
+                    </el-form-item>
+                </el-col>
+                <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+                    <el-form-item label="油罐" prop="tankName">
+                        <el-select v-model="dataList.tankId" placeholder="请选择绑定油罐" @change="getTank(dataList.tankId)">
+                            <el-option v-for="(item) in dataInfos.tankDatas.value" :key="item.id" :label="getLable(item)"
+                                :value="item.id" />
+                        </el-select>
+                    </el-form-item>
+                </el-col>
+            </el-row>
+        </el-form>
+        <el-row justify="end" class="submit-button">
+            <el-button type="primary" @click="submit">确定</el-button>
+        </el-row>
+
+    </el-dialog>
+</template>
+<script setup lang="ts">
+import { ref, defineExpose, reactive } from 'vue';
+import { getTankInfo,uploadNozzleInfoForMachine, getNozzleInfo } from '/@/api/api'
+import { editOilGunForMachineRules } from '/@/api/FormValidation'
+import eventBus from "/@/utils/mitt";
+
+const isDisplay = reactive({
+    isShowDialog: false,
+    loading: false
+})
+const dataInfos = reactive({
+    /** 站点id */
+    stationId:null,
+    /** 操作:0:新增;1:编辑 */
+    flag:0,
+    /** 油罐列表 */
+    tankDatas:[]
+})
+let title = ref('')
+
+
+let dataList = reactive({
+    /** 油枪id */
+    id: null,
+    /** 油枪号 */
+    nozzleNum: null,
+    /** 加油点 */
+    fuelPoint: null,
+    /** 内部油枪号 */
+    internalNum: null,
+    /** 关联油罐id */
+    tankId: null as any,
+    /** 关联油罐号 */
+    tankNum: null,
+    /** 关联的油机id */
+    machineId:null,
+    /** 关联的云端油枪id */
+    cloundNozzleId:null
+})
+// 创建表单实例
+const ruleFormRef = ref()
+
+// 获取油罐信息
+const getInfo = async () => {
+    await getTankInfo({ 'id': dataInfos.stationId }).then((res) => {
+        dataInfos.tankDatas.value = res
+        console.log("获取到油罐信息",dataInfos.tankDatas.value)
+    })
+}
+
+/** 拼接下拉框选项 */
+const getLable = (row:any) => {
+    return row.number + "号油罐(" + row.oilName + ")"
+}
+// 获取绑定的油罐信息 
+const getTank = (tankId:number) => {
+    const tankInfo = dataInfos.tankDatas.value.find(tank => tank.id == tankId)
+    dataList.tankNum = tankInfo.number
+}
+
+// 添加油枪数据
+const submit = async () => {
+    ruleFormRef.value.validate(async (valid: boolean) => {
+        // 表单验证不成功,不进行任何操作
+        if (!valid) return
+
+        isDisplay.loading = true
+        await uploadNozzleInfoForMachine(dataList).then((res) => {
+            console.log(res)
+            isDisplay.loading = false
+            eventBus.emit('refreshViewNozzle')
+            isDisplay.isShowDialog = false
+            
+        })
+    })
+}
+
+const openDialog = async (data: any) => {
+    dataInfos.flag = data.flag
+    dataInfos.stationId = data.stationId
+    await getInfo()
+    if (data.flag == 0) {
+        title.value = '新增油枪'
+        dataList.id = null
+        dataList.nozzleNum = null
+        dataList.fuelPoint = null
+        dataList.internalNum = null
+        dataList.tankId = null
+        dataList.tankNum = null
+        dataList.cloundNozzleId = null
+        dataList.machineId = data.machineId
+    } else {
+        title.value = '编辑油枪'
+        await getNozzleInfo({ 'id': data.nozzleId }).then((res: any) => {
+            console.log(res)
+            dataList.id = res.id
+            dataList.nozzleNum = res.nozzleNum
+            dataList.fuelPoint = res.fuelPoint
+            dataList.internalNum = res.internalNum
+            dataList.tankId = res.tankId
+            dataList.tankNum = res.number
+            dataList.cloundNozzleId = res.cloundNozzleId
+            dataList.machineId = res.machineId
+        })
+    }
+    isDisplay.isShowDialog = true
+}
+defineExpose({
+    openDialog,
+})
+</script>
+
+<style lang="scss"></style>

+ 131 - 13
src/FccWeb/admin.ui.plus-master/src/views/admin/components/oilcanDetail.vue

@@ -9,12 +9,18 @@
             <Loading />
             </el-icon>
         </div>
-        <el-row v-for="(item, index) in TableData" :key="index" style="margin-bottom: 10px;height: 150px;">
+
+        <div class="switch" @click.stop="switchDisplay()">
+            <el-icon size="30"><Switch /></el-icon>
+            <el-text>切换显示设备</el-text>
+        </div>
+
+        <el-row v-if="displayData.isShowTank" v-for="(item, index) in TableDataTank" :key="index" style="margin-bottom: 10px;height: 150px;">
             <el-col :span="6">
                 <el-card style="height: 100%;display: flex;align-items: center;">
                     <el-row>
                         <el-col :span="8">
-                            <img :src="url" style="width: 70px;height:70px;">
+                            <img :src="tankImgUrl" style="width: 70px;height:70px;">
                         </el-col>
                         <el-col :span="8">
                             <div style="margin-left: 1em;">
@@ -27,7 +33,7 @@
                         <el-col :span="8">
                             <div style="margin-left: 1em;">
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
-                                    icon="ele-Edit" @click.stop="editStation(item.id)"> 编辑 </el-link>
+                                    icon="ele-Edit" @click.stop="editTank(item.id)"> 编辑 </el-link>
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
                                     icon="ele-Delete" @click.stop="deleteDevice(item.id)">删除</el-link>
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
@@ -42,7 +48,7 @@
                 <el-row>
                     <el-col :span="7" v-for="itemm in item.associatedNozzles" :key="itemm"
                         style="text-align: center;padding: 10px;background-color: #fff; margin: 10px; border-radius: 5px; display: flex;align-items: center;">
-                        <img :src="url" style="width: 30px;height:30px;">
+                        <img :src="nozzleImgUrl" style="width: 30px;height:30px;">
                         <div style="margin-left: 1em;">
                             <div>油枪号</div>
                             <div>{{ itemm.nozzleNum }}</div>
@@ -60,33 +66,100 @@
                 </el-row>
             </el-col>
         </el-row>
+
+        <el-row v-if="!displayData.isShowTank" v-for="(item, index) in TableDataMachine" :key="index" style="margin-bottom: 10px;height: 150px;">
+            <el-col :span="6">
+                <el-card style="height: 100%;display: flex;align-items: center;">
+                    <el-row>
+                        <el-col :span="8">
+                            <img :src="machineImgUrl" style="width: 70px;height:70px;">
+                        </el-col>
+                        <el-col :span="8">
+                            <div style="margin-left: 1em;">
+                                <div>油机号</div>
+                                <div>{{ item.name }}</div>
+                                <div>连接端口</div>
+                                <div>{{ item.port }}</div>
+                            </div>
+                        </el-col>
+                        <el-col :span="8">
+                            <div style="margin-left: 1em;">
+                                <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Edit" @click.stop="editMachine(item)"> 编辑 </el-link>
+                                <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Delete" @click.stop="deleteMachineInfo(item.id)">删除</el-link>
+                                <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Plus"
+                                    @click.stop="editOilGunFromMachine({ 
+                                        'flag': 0, 
+                                        'stationId':displayData.inputId,
+                                        'machineId': item.id })">油枪</el-link>
+                            </div>
+                        </el-col>
+                    </el-row>
+                </el-card>
+            </el-col>
+            
+            <el-col :span="18" style="width: 100%;height: 100%;background-color: #ebebeb;">
+                <el-row>
+                    <el-col :span="7" v-for="itemm in item.nozzles" :key="itemm"
+                        style="text-align: center;padding: 10px;background-color: #fff; margin: 10px; border-radius: 5px; display: flex;align-items: center;">
+                        <img :src="nozzleImgUrl" style="width: 30px;height:30px;">
+                        <div style="margin-left: 1em;">
+                            <div>油枪号</div>
+                            <div>{{ itemm.nozzleNumer }}</div>
+                        </div>
+                        <div style="margin-left: 1em;">
+                            <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                icon="ele-Edit"
+                                @click.stop="editOilGunFromMachine({ 'flag': 1,'stationId':displayData.inputId, 'nozzleId': itemm.id })">
+                                编辑
+                            </el-link>
+                            <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                icon="ele-Delete" @click.stop="deleteOilGun(itemm.id)">删除</el-link>
+                        </div>
+                    </el-col>
+                </el-row>
+            </el-col>
+            
+        </el-row>
         <EditDialog ref="editDialogRef" />
+        <EditNozzleFromMachineDialog ref="editNozzleFromMachineDialogRef" />
         <DeviceDialog ref="DeviceDialogRef" />
+        <MachineDialog ref="MachineDialogRef" />
 
     </el-dialog>
 </template>
 <script setup lang="ts">
 import { defineAsyncComponent, onBeforeMount, onMounted, reactive, ref } from 'vue';
-import { getTankInfo, deleteTank, getDetailsTankInfo, deleteNozzle } from "/@/api/api"
+import { getTankInfo, deleteTank, getDetailsTankInfo, deleteNozzle, getMachine,deleteMachine } from "/@/api/api"
 import eventBus from "/@/utils/mitt";
 import { tr } from 'element-plus/es/locale';
-import { ElLoading } from 'element-plus';
+import { ElLoading, ElSwitch } from 'element-plus';
 
 // 引入组件
 const EditDialog = defineAsyncComponent(() => import('/@/views/admin/components/editOilGun.vue'))
+const EditNozzleFromMachineDialog = defineAsyncComponent(() => import('/@/views/admin/components/editOilGunFromMachine.vue'))
 const DeviceDialog = defineAsyncComponent(() => import('/@/views/admin/components/editDevice.vue'))
-import { Loading } from '@element-plus/icons-vue'; // 引入加载图标
+const MachineDialog = defineAsyncComponent(() => import('/@/views/admin/components/editMachine.vue'))
+import { Loading, Switch } from '@element-plus/icons-vue'; // 引入加载图标
 import { watch } from 'fs';
 const editDialogRef = ref()
+const editNozzleFromMachineDialogRef = ref()
 const DeviceDialogRef = ref()
+const MachineDialogRef = ref()
 
-const url = ref('/src/assets/logo-com.png')
+const machineImgUrl = ref('/src/assets/machine.png')
+const tankImgUrl = ref('/src/assets/tank.png')
+const nozzleImgUrl = ref('/src/assets/nozzle.png')
 const displayData = reactive({
     isShowDialog: false,
+    isShowTank:true,
     inputId: 0,
     loading:false
 })
-let TableData = ref([]) as any
+let TableDataTank = ref([]) as any
+let TableDataMachine = ref([]) as any
 const removeKey = ref(0)
 
 let loadingInstance: any = null; // 保存 Loading 实例
@@ -96,27 +169,46 @@ const dialogRef = ref(); // 用于获取对话框的 DOM 元素
 onBeforeMount(() => {
     eventBus.off('refreshViewNozzle')
     eventBus.off('refreshViewDevice')
+    eventBus.off('refreshViewMachine')
 })
 
 // 挂载时
 onMounted(async () => {
     await getInfo()
+    await getMachineInfo()
     eventBus.off('refreshViewNozzle')
     eventBus.off('refreshViewDevice')
+    eventBus.off('refreshViewMachine')
     eventBus.on('refreshViewNozzle', async () => {
         await getInfo()
+        await getMachineInfo()
     })
     eventBus.on('refreshViewDevice', async () => {
         await getInfo()
     })
+    eventBus.on('refreshViewMachine', async () => {
+        await getMachineInfo()
+    })
 })
 
+// 切换显示内容
+const switchDisplay = () =>{
+    displayData.isShowTank = !displayData.isShowTank
+}
+
+//-- 获取油机信息。通过station中传过来的 油站id,将油机信息获取出来。
+const getMachineInfo = async () => {
+    await getMachine({'stationId':displayData.inputId}).then((res) => {
+        TableDataMachine.value = res
+        console.log("获取到的油枪信息",res,TableDataMachine.value)
+    })
+}
 
 // -- 获取油罐信息。通过station中传过来的 油站id,将油罐信息获取出来。
 // 获取油罐信息
 const getInfo = async () => {
     await getTankInfo({ 'id': displayData.inputId }).then((res) => {
-        TableData.value = res
+        TableDataTank.value = res
         console.log(res)
     })
 }
@@ -141,7 +233,7 @@ const deleteDevice = async (id: number) => {
 }
 
 // 编辑油罐
-const editStation = async (id: number) => {
+const editTank = async (id: number) => {
     // 调用查询接口获取 数据
     await getDetailsTankInfo({ 'id': id }).then((res: any) => {
         DeviceDialogRef.value.openDialog(res)
@@ -156,19 +248,39 @@ const editOilGun = (row: any) => {
 // 删除油枪
 const deleteOilGun = async (id: number) => {
     displayData.loading = true
-    console.log('id')
-    console.log(id)
     await deleteNozzle({ 'id': id }).then((res) => {
         console.log(res)
     })
     await getInfo()
+    await getMachineInfo()
+    displayData.loading = false
+}
+
+// 编辑油机
+const editMachine = async (row: any) => {
+    // 调用查询接口获取 数据
+    MachineDialogRef.value.openDialog(row)
+}
+
+const deleteMachineInfo = async (id:number) => {
+    displayData.loading = true
+    await deleteMachine({ 'machineId': id }).then((res) => {
+        console.log(res)
+    })
+    await getInfo()
+    await getMachineInfo()
     displayData.loading = false
 }
+// 添加油枪(油机页)
+const editOilGunFromMachine = (row: any) => {
+    editNozzleFromMachineDialogRef.value.openDialog(row)
+}
 
 const openDialog = async (id: number) => {
     displayData.inputId = id
     displayData.isShowDialog = true
     await getInfo()
+    await getMachineInfo()
 }
 
 defineExpose({
@@ -189,4 +301,10 @@ defineExpose({
   font-size: 24px; /* 设置加载图标大小 */
   color: #409eff; /* 设置加载图标颜色 */
 }
+.switch{
+    display: flex;
+    justify-content: start;
+    align-content: center;
+    margin-bottom: 2%;
+}
 </style>

+ 13 - 3
src/FccWeb/admin.ui.plus-master/src/views/admin/station/station.vue

@@ -29,11 +29,13 @@
                             class="right-operation" width="140">
                             <template #default="scope">
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
-                                    icon="ele-Plus" @click.stop="addDetails(scope.row.id)">设备</el-link>
+                                    icon="ele-Plus" @click.stop="addDetails(scope.row.id)">油罐</el-link>
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
-                                    icon="ele-Edit" @click.stop="uploadStation(scope.row)">编辑</el-link>
+                                    icon="ele-Plus" @click.stop="addMachine(scope.row.id)">油机</el-link>
                                 <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
-                                    icon="ele-Delete" @click.stop="deleteData(scope.row.id)">删除</el-link>
+                                    icon="ele-Edit" @click.stop="uploadStation(scope.row)">编辑</el-link>
+                                <!-- <el-link class="my-el-link mr12 ml12" type="primary" :underline="false" target="_blank"
+                                    icon="ele-Delete" @click.stop="deleteData(scope.row.id)">删除</el-link> -->
                             </template>
                         </el-table-column>
                     </el-table>
@@ -49,6 +51,7 @@
         </el-row>
         <EditDialog ref="editDialogRef" />
         <DeviceDialog ref="deviceDialogRef" />
+        <MachineDialog ref="machineDialogRef" />
         <oilcanDialog ref="oilcanDialogRef"></oilcanDialog>
     </div>
 
@@ -64,10 +67,12 @@ import eventBus from "/@/utils/mitt";
 /**引入组件*/
 const EditDialog = defineAsyncComponent(() => import('/@/views/admin/components/addStation.vue'))
 const DeviceDialog = defineAsyncComponent(() => import('/@/views/admin/components/addDevice.vue'))
+const MachineDialog = defineAsyncComponent(() => import('/@/views/admin/components/addMachine.vue'))
 const oilcanDialog = defineAsyncComponent(() => import('/@/views/admin/components/oilcanDetail.vue'))
 const oilcanDialogRef = ref()
 const editDialogRef = ref()
 const deviceDialogRef = ref()
+const machineDialogRef = ref()
 
 const data = reactive([
     { prop: 'name', label: '油站名称' },
@@ -145,6 +150,11 @@ const addDetails = (id: number) => {
     deviceDialogRef.value.openDialog(id)
 }
 
+//新增油机
+const addMachine = (id:number) => {
+    machineDialogRef.value.openDialog(id)
+}
+
 /**
  * 页条变化
  * @param val