wxw
2024-08-21 8520e36378e8e88cbbc45586bb31d1fec3be87ac
Merge branch 'master' of http://47.95.120.53:8083/r/WCSNet6
20个文件已修改
1 文件已重命名
1个文件已添加
1418 ■■■■ 已修改文件
Admin.NET/WCS.Application/Entity/WcsDevice.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Entity/WcsPlc.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Entity/WcsStation.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Enum/PLCEnum.cs 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs 180 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Util/PLCUtil.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/WCS.Application.csproj 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsDevice/component/editDialog.vue 218 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsDevice/index.vue 297 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsPlc/component/editDialog.vue 173 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsPlc/index.vue 279 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsStation/component/editDialog.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Web/src/views/wcs/wcsStation/index.vue 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Admin.NET/WCS.Application/Entity/WcsDevice.cs
@@ -47,8 +47,8 @@
    /// <summary>
    /// 流程字类型
    /// </summary>
    [SugarColumn(ColumnName = "PosType", ColumnDescription = "流程字类型", Length = 10)]
    public string? PosType { get; set; }
    [SugarColumn(ColumnName = "PosType", ColumnDescription = "流程字类型")]
    public PLCDataTypeEnum? PosType { get; set; }
    
    /// <summary>
    /// 显示屏ip地址
Admin.NET/WCS.Application/Entity/WcsPlc.cs
@@ -15,6 +15,13 @@
    public string IP { get; set; }
    /// <summary>
    /// PLC类型
    /// </summary>
    [Required]
    [SugarColumn(ColumnName = "PLCType", ColumnDescription = "PLC类型")]
    public PLCEnum PLCType { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    [Required]
Admin.NET/WCS.Application/Entity/WcsStation.cs
File was renamed from Admin.NET/WCS.Application/Entity/WcsplcStation.cs
@@ -29,8 +29,8 @@
    /// <summary>
    /// 流程字类型
    /// </summary>
    [SugarColumn(ColumnName = "PosType", ColumnDescription = "流程字类型", Length = 10)]
    public string? PosType { get; set; }
    [SugarColumn(ColumnName = "PosType", ColumnDescription = "流程字类型")]
    public PLCDataTypeEnum? PosType { get; set; }
    
    /// <summary>
    /// 显示屏ip地址
Admin.NET/WCS.Application/Enum/PLCEnum.cs
@@ -44,4 +44,90 @@
    /// </summary>
    [Description("工位级别")]
    Station = 2,
}
/// <summary>
/// PLC枚举
/// </summary>
[Description("PLC枚举")]
public enum PLCEnum
{
    //未定义
    [Description("未定义")]
    None = 0,
    //西门子S7-200
    [Description("西门子S7-200")]
    S7_200 = 1,
    //西门子S7-200Smar
    [Description("西门子S7-200Smar")]
    S7_200Smart = 2,
    //西门子S7-300
    [Description("西门子S7-300")]
    S7_300 = 3,
    //西门子S7-400
    [Description("西门子S7-400")]
    S7_400 = 4,
    //西门子S7-1200
    [Description("西门子S7-1200")]
    S7_1200 = 5,
    //西门子S7-1500
    [Description("西门子S7-1500")]
    S7_1500 = 6,
    //ModBusTcp
    [Description("ModBusTcp")]
    ModBusTcp =7,
    //ModBusRtu
    [Description("ModBusRtu")]
    ModBusRtu = 8,
    //ModBusAscii
    [Description("ModBusAscii")]
    ModBusAscii = 9,
    //ModbusRtuOverTcp
    [Description("ModbusRtuOverTcp")]
    ModbusRtuOverTcp = 10,
    //三菱
    [Description("三菱")]
    Mitsubishi = 11,
    //欧姆龙
    [Description("欧姆龙")]
    OmronFins = 12,
    //罗克韦尔
    [Description("罗克韦尔")]
    AllenBradley = 13,
}
/// <summary>
/// PLC数据类型枚举
/// </summary>
[Description("PLC数据类型枚举")]
public enum PLCDataTypeEnum
{
    //Bit
    [Description("Bit")]
    Bit = 1,
    //Byte
    [Description("Byte")]
    Byte = 2,
    //Char
    [Description("Char")]
    Char = 3,
    //Word
    [Description("Word")]
    Word = 4,
    //DWord
    [Description("DWord")]
    DWord = 5,
    //Int
    [Description("Int")]
    Int = 6,
    //DInt
    [Description("DInt")]
    DInt = 7,
    //Real
    [Description("Real")]
    Real = 8,
    //LReal
    [Description("LReal")]
    LReal = 9,
    //String
    [Description("String")]
    String = 10,
}
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs
@@ -1,9 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!

namespace WCS.Application;
    /// <summary>
@@ -54,7 +49,7 @@
        /// <summary>
        /// 流程字类型
        /// </summary>
        public string? PosType { get; set; }
        public PLCDataTypeEnum? PosType { get; set; }
        
        /// <summary>
        /// 显示屏ip地址
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs
@@ -47,7 +47,7 @@
        /// <summary>
        /// 流程字类型
        /// </summary>
        public virtual string? PosType { get; set; }
        public virtual PLCDataTypeEnum? PosType { get; set; }
        
        /// <summary>
        /// 显示屏ip地址
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceOutput.cs
@@ -1,9 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!

namespace WCS.Application;
/// <summary>
@@ -54,7 +49,7 @@
    /// <summary>
    /// 流程字类型
    /// </summary>
    public string? PosType { get; set; }
    public PLCDataTypeEnum? PosType { get; set; }
    
    /// <summary>
    /// 显示屏ip地址
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs
@@ -6,34 +6,39 @@
namespace WCS.Application;
/// <summary>
/// PLC输出参数
/// </summary>
public class WcsPlcDto
{
    /// <summary>
    /// PLC输出参数
    /// 主键Id
    /// </summary>
    public class WcsPlcDto
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        public long Id { get; set; }
        /// <summary>
        /// PLCIP地址
        /// </summary>
        public string IP { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        public PLCTypeEnum Type { get; set; }
        /// <summary>
        /// 仓库号
        /// </summary>
        public string? WareHouseNo { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        public string? Text { get; set; }
    }
    public long Id { get; set; }
    /// <summary>
    /// PLCIP地址
    /// </summary>
    public string IP { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public PLCEnum PLCType { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public PLCTypeEnum Type { get; set; }
    /// <summary>
    /// 仓库号
    /// </summary>
    public string? WareHouseNo { get; set; }
    /// <summary>
    /// 描述
    /// </summary>
    public string? Text { get; set; }
}
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs
@@ -1,106 +1,114 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core;
using System.ComponentModel.DataAnnotations;

namespace WCS.Application;
/// <summary>
/// PLC基础输入参数
/// </summary>
public class WcsPlcBaseInput
{
    /// <summary>
    /// PLC基础输入参数
    /// PLCIP地址
    /// </summary>
    public class WcsPlcBaseInput
    {
        /// <summary>
        /// PLCIP地址
        /// </summary>
        public virtual string IP { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        public virtual PLCTypeEnum Type { get; set; }
        /// <summary>
        /// 仓库号
        /// </summary>
        public virtual string? WareHouseNo { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        public virtual string? Text { get; set; }
    }
    public virtual string IP { get; set; }
    /// <summary>
    /// PLC分页查询输入参数
    /// PLC类型
    /// </summary>
    public class PageWcsPlcInput : BasePageInput
    {
        /// <summary>
        /// 关键字查询
        /// </summary>
        public string? SearchKey { get; set; }
        /// <summary>
        /// PLCIP地址
        /// </summary>
        public string? IP { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        public PLCTypeEnum? Type { get; set; }
    }
    public virtual PLCEnum PLCType { get; set; }
    /// <summary>
    /// PLC增加输入参数
    /// 设备类型
    /// </summary>
    public class AddWcsPlcInput : WcsPlcBaseInput
    {
        /// <summary>
        /// PLCIP地址
        /// </summary>
        [Required(ErrorMessage = "PLCIP地址不能为空")]
        public override string IP { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        [Required(ErrorMessage = "设备类型不能为空")]
        public override PLCTypeEnum Type { get; set; }
    }
    public virtual PLCTypeEnum Type { get; set; }
    /// <summary>
    /// PLC删除输入参数
    /// 仓库号
    /// </summary>
    public class DeleteWcsPlcInput : BaseIdInput
    {
    }
    public virtual string? WareHouseNo { get; set; }
    /// <summary>
    /// PLC更新输入参数
    /// 描述
    /// </summary>
    public class UpdateWcsPlcInput : WcsPlcBaseInput
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        [Required(ErrorMessage = "主键Id不能为空")]
        public long Id { get; set; }
    }
    public virtual string? Text { get; set; }
}
/// <summary>
/// PLC分页查询输入参数
/// </summary>
public class PageWcsPlcInput : BasePageInput
{
    /// <summary>
    /// 关键字查询
    /// </summary>
    public string? SearchKey { get; set; }
    /// <summary>
    /// PLC主键查询输入参数
    /// PLCIP地址
    /// </summary>
    public class QueryByIdWcsPlcInput : DeleteWcsPlcInput
    {
    public string? IP { get; set; }
    }
    /// <summary>
    /// PLC类型
    /// </summary>
    public PLCEnum? PLCType { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public PLCTypeEnum? Type { get; set; }
}
/// <summary>
/// PLC增加输入参数
/// </summary>
public class AddWcsPlcInput : WcsPlcBaseInput
{
    /// <summary>
    /// PLCIP地址
    /// </summary>
    [Required(ErrorMessage = "PLCIP地址不能为空")]
    public override string IP { get; set; }
    /// <summary>
    /// PLC类型
    /// </summary>
    [Required(ErrorMessage = "PLC类型不能为空")]
    public override PLCEnum PLCType { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    [Required(ErrorMessage = "设备类型不能为空")]
    public override PLCTypeEnum Type { get; set; }
}
/// <summary>
/// PLC删除输入参数
/// </summary>
public class DeleteWcsPlcInput : BaseIdInput
{
}
/// <summary>
/// PLC更新输入参数
/// </summary>
public class UpdateWcsPlcInput : WcsPlcBaseInput
{
    /// <summary>
    /// 主键Id
    /// </summary>
    [Required(ErrorMessage = "主键Id不能为空")]
    public long Id { get; set; }
}
/// <summary>
/// PLC主键查询输入参数
/// </summary>
public class QueryByIdWcsPlcInput : DeleteWcsPlcInput
{
}
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs
@@ -1,9 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!

namespace WCS.Application;
/// <summary>
@@ -15,27 +10,32 @@
    /// 主键Id
    /// </summary>
    public long Id { get; set; }
    /// <summary>
    /// PLCIP地址
    /// </summary>
    public string IP { get; set; }
    /// <summary>
    /// PLC类型
    /// </summary>
    public PLCEnum PLCType { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public PLCTypeEnum Type { get; set; }
    /// <summary>
    /// 仓库号
    /// </summary>
    public string? WareHouseNo { get; set; }
    /// <summary>
    /// 描述
    /// </summary>
    public string? Text { get; set; }
    }
}
Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs
@@ -1,11 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
using Admin.NET.Core.Service;
using Microsoft.AspNetCore.Http;

namespace WCS.Application;
/// <summary>
@@ -30,15 +23,16 @@
    [DisplayName("分页查询PLC")]
    public async Task<SqlSugarPagedList<WcsPlcOutput>> Page(PageWcsPlcInput input)
    {
        input.SearchKey = input.SearchKey?.Trim();
        input.SearchKey = input.SearchKey?.Trim();
        var query = _wcsPlcRep.AsQueryable()
            .WhereIF(!string.IsNullOrEmpty(input.SearchKey), u =>
                u.IP.Contains(input.SearchKey)
            )
            .WhereIF(input.PLCType.HasValue, u => u.PLCType == input.PLCType)
            .WhereIF(!string.IsNullOrWhiteSpace(input.IP), u => u.IP.Contains(input.IP.Trim()))
            .WhereIF(input.Type.HasValue, u => u.Type == input.Type)
            .Select<WcsPlcOutput>();
        return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
        return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
    }
    /// <summary>
Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationDto.cs
@@ -34,7 +34,7 @@
        /// <summary>
        /// 流程字类型
        /// </summary>
        public string? PosType { get; set; }
        public PLCDataTypeEnum? PosType { get; set; }
        
        /// <summary>
        /// 显示屏ip地址
Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationInput.cs
@@ -32,7 +32,7 @@
        /// <summary>
        /// 流程字类型
        /// </summary>
        public virtual string? PosType { get; set; }
        public virtual PLCDataTypeEnum? PosType { get; set; }
        
        /// <summary>
        /// 显示屏ip地址
Admin.NET/WCS.Application/Service/WcsStation/Dto/WcsStationOutput.cs
@@ -1,9 +1,4 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!

namespace WCS.Application;
/// <summary>
@@ -39,7 +34,7 @@
    /// <summary>
    /// 流程字类型
    /// </summary>
    public string? PosType { get; set; }
    public PLCDataTypeEnum? PosType { get; set; }
    
    /// <summary>
    /// 显示屏ip地址
Admin.NET/WCS.Application/Util/PLCUtil.cs
New file
@@ -0,0 +1,12 @@
using IoTClient.Clients.PLC;
using IoTClient.Common.Enums;
namespace WCS.Application;
public class PLCUtil
{
    public PLCUtil()
    {
        SiemensClient client = new SiemensClient(SiemensVersion.S7_200Smart, "127.0.0.1", 102);
    }
}
Admin.NET/WCS.Application/WCS.Application.csproj
@@ -118,6 +118,10 @@
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="IoTClient" Version="1.0.40" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Admin.NET.Core\Admin.NET.Core.csproj" />
    <ProjectReference Include="..\Plugins\Admin.NET.Plugin.ApprovalFlow\Admin.NET.Plugin.ApprovalFlow.csproj" />
    <ProjectReference Include="..\Plugins\Admin.NET.Plugin.DingTalk\Admin.NET.Plugin.DingTalk.csproj" />
Web/src/views/wcs/wcsDevice/component/editDialog.vue
@@ -15,71 +15,85 @@
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="PlcId" prop="plcId">
                            <el-select clearable filterable v-model="ruleForm.plcId" placeholder="请选择PlcId">
                                <el-option v-for="(item,index) in wcsPlcPlcIdDropdownList" :key="index" :value="item.value" :label="item.label" />
                                <el-option v-for="(item, index) in wcsPlcPlcIdDropdownList" :key="index"
                                    :value="item.value" :label="item.label" />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="设备级别" prop="level">
                            <el-select clearable v-model="ruleForm.level" placeholder="请选择设备级别">
                                <el-option v-for="(item,index) in dl('DeviceLevelEnum')" :key="index" :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
                                <el-option v-for="(item, index) in dl('DeviceLevelEnum')" :key="index"
                                    :value="Number(item.value)"
                                    :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="DB区域" prop="dbNumber">
                            <el-input v-model="ruleForm.dbNumber" placeholder="请输入DB区域" maxlength="10" show-word-limit clearable />
                            <el-input v-model="ruleForm.dbNumber" placeholder="请输入DB区域" maxlength="10" show-word-limit
                                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="stationNum">
                            <el-input v-model="ruleForm.stationNum" placeholder="请输入工位号" maxlength="4" show-word-limit clearable />
                            <el-input v-model="ruleForm.stationNum" placeholder="请输入工位号" maxlength="4" show-word-limit
                                clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="PLC偏移量" prop="plcPos">
                            <el-input v-model="ruleForm.plcPos" placeholder="请输入PLC偏移量" maxlength="10" show-word-limit clearable />
                            <el-input v-model="ruleForm.plcPos" placeholder="请输入PLC偏移量" maxlength="10" show-word-limit
                                clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="WCS偏移量" prop="wcsPos">
                            <el-input v-model="ruleForm.wcsPos" placeholder="请输入WCS偏移量" maxlength="10" show-word-limit clearable />
                            <el-input v-model="ruleForm.wcsPos" placeholder="请输入WCS偏移量" maxlength="10" show-word-limit
                                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="posType">
                            <el-input v-model="ruleForm.posType" placeholder="请输入流程字类型" maxlength="10" show-word-limit clearable />
                            <el-select clearable v-model="ruleForm.posType" placeholder="请选择流程字类型">
                                <el-option v-for="(item, index) in dl('PLCDataTypeEnum')" :key="index"
                                    :value="Number(item.value)"
                                    :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="显示屏ip地址" prop="ledIP">
                            <el-input v-model="ruleForm.ledIP" placeholder="请输入显示屏ip地址" maxlength="50" show-word-limit clearable />
                            <el-input v-model="ruleForm.ledIP" placeholder="请输入显示屏ip地址" maxlength="50" show-word-limit
                                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="text">
                            <el-input v-model="ruleForm.text" placeholder="请输入描述" maxlength="20" show-word-limit clearable />
                            <el-input v-model="ruleForm.text" placeholder="请输入描述" maxlength="20" show-word-limit
                                clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
@@ -99,97 +113,93 @@
}
</style>
<script lang="ts" setup>
    import { ref,onMounted } from "vue";
    import { ElMessage } from "element-plus";
    import type { FormRules } from "element-plus";
    import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
    import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
      import { formatDate } from '/@/utils/formatTime';
    import { addWcsDevice, updateWcsDevice, detailWcsDevice } from "/@/api/wcs/wcsDevice";
    import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice';
    import { getAPI } from '/@/utils/axios-utils';
    import { SysEnumApi } from '/@/api-services/api';
import { ref, onMounted } from "vue";
import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus";
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
import { formatDate } from '/@/utils/formatTime';
import { addWcsDevice, updateWcsDevice, detailWcsDevice } from "/@/api/wcs/wcsDevice";
import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice';
import { getAPI } from '/@/utils/axios-utils';
import { SysEnumApi } from '/@/api-services/api';
    //父级传递来的参数
    var props = defineProps({
        title: {
//父级传递来的参数
var props = defineProps({
    title: {
        type: String,
        default: "",
    },
    });
    //父级传递来的函数,用于回调
    const emit = defineEmits(["reloadTable"]);
    const ruleFormRef = ref();
    const isShowDialog = ref(false);
    const ruleForm = ref<any>({});
    //自行添加其他规则
    const rules = ref<FormRules>({
    });
});
//父级传递来的函数,用于回调
const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref();
const isShowDialog = ref(false);
const ruleForm = ref<any>({});
//自行添加其他规则
const rules = ref<FormRules>({
});
    // 页面加载时
    onMounted(() => {
// 页面加载时
onMounted(() => {
    });
});
    // 打开弹窗
    const openDialog = async (row: any) => {
        // ruleForm.value = JSON.parse(JSON.stringify(row));
        // 改用detail获取最新数据来编辑
        let rowData = JSON.parse(JSON.stringify(row));
        if (rowData.id)
            ruleForm.value = (await detailWcsDevice(rowData.id)).data.result;
        else
            ruleForm.value = rowData;
        isShowDialog.value = true;
    };
// 打开弹窗
const openDialog = async (row: any) => {
    // ruleForm.value = JSON.parse(JSON.stringify(row));
    // 改用detail获取最新数据来编辑
    let rowData = JSON.parse(JSON.stringify(row));
    if (rowData.id)
        ruleForm.value = (await detailWcsDevice(rowData.id)).data.result;
    else
        ruleForm.value = rowData;
    isShowDialog.value = true;
};
    // 关闭弹窗
    const closeDialog = () => {
        emit("reloadTable");
        isShowDialog.value = false;
    };
// 关闭弹窗
const closeDialog = () => {
    emit("reloadTable");
    isShowDialog.value = false;
};
    // 取消
    const cancel = () => {
        isShowDialog.value = false;
    };
// 取消
const cancel = () => {
    isShowDialog.value = false;
};
    // 提交
    const submit = async () => {
        ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
            if (isValid) {
                let values = ruleForm.value;
                if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
                    await addWcsDevice(values);
                } else {
                    await updateWcsDevice(values);
                }
                closeDialog();
// 提交
const submit = async () => {
    ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
        if (isValid) {
            let values = ruleForm.value;
            if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
                await addWcsDevice(values);
            } else {
                ElMessage({
                    message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
                    type: "error",
                });
                await updateWcsDevice(values);
            }
        });
    };
            closeDialog();
        } else {
            ElMessage({
                message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
                type: "error",
            });
        }
    });
};
    const wcsPlcPlcIdDropdownList = ref<any>([]);
    const getWcsPlcPlcIdDropdownList = async () => {
        let list = await getWcsPlcPlcIdDropdown();
        wcsPlcPlcIdDropdownList.value = list.data.result ?? [];
    };
    getWcsPlcPlcIdDropdownList();
const wcsPlcPlcIdDropdownList = ref<any>([]);
const getWcsPlcPlcIdDropdownList = async () => {
    let list = await getWcsPlcPlcIdDropdown();
    wcsPlcPlcIdDropdownList.value = list.data.result ?? [];
};
getWcsPlcPlcIdDropdownList();
    //将属性或者函数暴露给父组件
    defineExpose({ openDialog });
//将属性或者函数暴露给父组件
defineExpose({ openDialog });
</script>
Web/src/views/wcs/wcsDevice/index.vue
@@ -1,220 +1,213 @@
<template>
  <div class="wcsDevice-container">
    <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
    <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
      <el-form :model="queryParams" ref="queryForm" labelWidth="90">
        <el-row>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
            <el-form-item label="关键字">
              <el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
              <el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字" />
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
            <el-form-item label="PlcId">
              <el-select clearable="" filterable="" v-model="queryParams.plcId" placeholder="请选择PlcId">
                <el-option v-for="(item,index) in wcsPlcPlcIdDropdownList" :key="index" :value="item.value" :label="item.label" />
                <el-option v-for="(item, index) in wcsPlcPlcIdDropdownList" :key="index" :value="item.value"
                  :label="item.label" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
            <el-form-item label="描述">
              <el-input v-model="queryParams.text" clearable="" placeholder="请输入描述"/>
              <el-input v-model="queryParams.text" clearable="" placeholder="请输入描述" />
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
            <el-form-item >
            <el-form-item>
              <el-button-group style="display: flex; align-items: center;">
                <el-button type="primary"  icon="ele-Search" @click="handleQuery" v-auth="'wcsDevice:page'"> 查询 </el-button>
                      <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
                        <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> 高级查询 </el-button>
                        <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsDevice" v-auth="'wcsDevice:add'"> 新增 </el-button>
                <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'wcsDevice:page'"> 查询
                </el-button>
                <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
                <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI"
                  style="margin-left:5px;"> 高级查询 </el-button>
                <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI"
                  style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsDevice"
                  v-auth="'wcsDevice:add'"> 新增 </el-button>
              </el-button-group>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-card class="full-table" shadow="hover" style="margin-top: 5px">
      <el-table
                :data="tableData"
                style="width: 100%"
                v-loading="loading"
                tooltip-effect="light"
                                row-key="id"
                @sort-change="sortChange"
                border="">
        <el-table-column type="index" label="序号" width="55" align="center"/>
        <el-table-column prop="plcId" label="PlcId"  show-overflow-tooltip="">
      <el-table :data="tableData" style="width: 100%" v-loading="loading" tooltip-effect="light" row-key="id"
        @sort-change="sortChange" border="">
        <el-table-column type="index" label="序号" width="55" align="center" />
        <el-table-column prop="plcId" label="PlcId" show-overflow-tooltip="">
          <template #default="scope">
            <span>{{scope.row.plcIdIP}}</span>
            <span>{{ scope.row.plcIdIP }}</span>
          </template>
        </el-table-column>
          <el-table-column prop="level" label="设备级别"  show-overflow-tooltip="" >
            <template #default="scope">
              <el-tag :type="dv('DeviceLevelEnum', scope.row.level)?.tagType"> {{dv('DeviceLevelEnum', scope.row.level)?.name}}</el-tag>
            </template>
          </el-table-column>
        <el-table-column prop="dbNumber" label="DB区域"  show-overflow-tooltip="" />
        <el-table-column prop="stationNum" label="工位号"  show-overflow-tooltip="" />
        <el-table-column prop="plcPos" label="PLC偏移量"  show-overflow-tooltip="" />
        <el-table-column prop="wcsPos" label="WCS偏移量"  show-overflow-tooltip="" />
        <el-table-column prop="posType" label="流程字类型"  show-overflow-tooltip="" />
        <el-table-column prop="ledIP" label="显示屏ip地址"  show-overflow-tooltip="" />
        <el-table-column prop="text" label="描述"  show-overflow-tooltip="" />
        <el-table-column prop="level" label="设备级别" show-overflow-tooltip="">
          <template #default="scope">
            <el-tag :type="dv('DeviceLevelEnum', scope.row.level)?.tagType"> {{ dv('DeviceLevelEnum',
              scope.row.level)?.name}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="dbNumber" label="DB区域" show-overflow-tooltip="" />
        <el-table-column prop="stationNum" label="工位号" show-overflow-tooltip="" />
        <el-table-column prop="plcPos" label="PLC偏移量" show-overflow-tooltip="" />
        <el-table-column prop="wcsPos" label="WCS偏移量" show-overflow-tooltip="" />
        <el-table-column prop="posType" label="流程字类型" show-overflow-tooltip="">
          <template #default="scope">
            <el-tag :type="dv('PLCDataTypeEnum', scope.row.posType)?.tagType"> {{ dv('PLCDataTypeEnum',
              scope.row.posType)?.name}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="ledIP" label="显示屏ip地址" show-overflow-tooltip="" />
        <el-table-column prop="text" label="描述" show-overflow-tooltip="" />
        <el-table-column label="修改记录" width="80" align="center" show-overflow-tooltip>
          <template #default="scope">
            <ModifyRecord :data="scope.row" />
          </template>
        </el-table-column>
        <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('wcsDevice:update') || auth('wcsDevice:delete')">
        <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip=""
          v-if="auth('wcsDevice:update') || auth('wcsDevice:delete')">
          <template #default="scope">
            <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsDevice(scope.row)" v-auth="'wcsDevice:update'"> 编辑 </el-button>
            <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsDevice(scope.row)" v-auth="'wcsDevice:delete'"> 删除 </el-button>
            <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsDevice(scope.row)"
              v-auth="'wcsDevice:update'"> 编辑 </el-button>
            <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsDevice(scope.row)"
              v-auth="'wcsDevice:delete'"> 删除 </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
                v-model:currentPage="tableParams.page"
                v-model:page-size="tableParams.pageSize"
                :total="tableParams.total"
                :page-sizes="[10, 20, 50, 100, 200, 500]"
                size="small"
                background=""
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                layout="total, sizes, prev, pager, next, jumper"
    />
      <printDialog
        ref="printDialogRef"
        :title="printWcsDeviceTitle"
        @reloadTable="handleQuery" />
      <editDialog
        ref="editDialogRef"
        :title="editWcsDeviceTitle"
        @reloadTable="handleQuery"
      />
      <el-pagination v-model:currentPage="tableParams.page" v-model:page-size="tableParams.pageSize"
        :total="tableParams.total" :page-sizes="[10, 20, 50, 100, 200, 500]" size="small" background=""
        @size-change="handleSizeChange" @current-change="handleCurrentChange"
        layout="total, sizes, prev, pager, next, jumper" />
      <printDialog ref="printDialogRef" :title="printWcsDeviceTitle" @reloadTable="handleQuery" />
      <editDialog ref="editDialogRef" :title="editWcsDeviceTitle" @reloadTable="handleQuery" />
    </el-card>
  </div>
</template>
<script lang="ts" setup="" name="wcsDevice">
  import { ref } from "vue";
  import { ElMessageBox, ElMessage } from "element-plus";
  import { auth } from '/@/utils/authFunction';
import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction';
  import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
  import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
  import { formatDate } from '/@/utils/formatTime';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
import { formatDate } from '/@/utils/formatTime';
  import ModifyRecord from '/@/components/table/modifyRecord.vue';
import ModifyRecord from '/@/components/table/modifyRecord.vue';
  import printDialog from '/@/views/system/print/component/hiprint/preview.vue'
  import editDialog from '/@/views/wcs/wcsDevice/component/editDialog.vue'
  import { pageWcsDevice, deleteWcsDevice } from '/@/api/wcs/wcsDevice';
  import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice';
import printDialog from '/@/views/system/print/component/hiprint/preview.vue'
import editDialog from '/@/views/wcs/wcsDevice/component/editDialog.vue'
import { pageWcsDevice, deleteWcsDevice } from '/@/api/wcs/wcsDevice';
import { getWcsPlcPlcIdDropdown } from '/@/api/wcs/wcsDevice';
  const showAdvanceQueryUI = ref(false);
  const printDialogRef = ref();
  const editDialogRef = ref();
  const loading = ref(false);
  const tableData = ref<any>([]);
  const queryParams = ref<any>({});
  const tableParams = ref({
    page: 1,
    pageSize: 10,
    total: 0,
  });
const showAdvanceQueryUI = ref(false);
const printDialogRef = ref();
const editDialogRef = ref();
const loading = ref(false);
const tableData = ref<any>([]);
const queryParams = ref<any>({});
const tableParams = ref({
  page: 1,
  pageSize: 10,
  total: 0,
});
  const printWcsDeviceTitle = ref("");
  const editWcsDeviceTitle = ref("");
const printWcsDeviceTitle = ref("");
const editWcsDeviceTitle = ref("");
  // 改变高级查询的控件显示状态
  const changeAdvanceQueryUI = () => {
    showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
  }
// 改变高级查询的控件显示状态
const changeAdvanceQueryUI = () => {
  showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
}
  // 查询操作
  const handleQuery = async () => {
    loading.value = true;
    var res = await pageWcsDevice(Object.assign(queryParams.value, tableParams.value));
    tableData.value = res.data.result?.items ?? [];
    tableParams.value.total = res.data.result?.total;
    loading.value = false;
  };
// 查询操作
const handleQuery = async () => {
  loading.value = true;
  var res = await pageWcsDevice(Object.assign(queryParams.value, tableParams.value));
  tableData.value = res.data.result?.items ?? [];
  tableParams.value.total = res.data.result?.total;
  loading.value = false;
};
  // 列排序
  const sortChange = async (column: any) => {
    queryParams.value.field = column.prop;
    queryParams.value.order = column.order;
    await handleQuery();
  };
// 列排序
const sortChange = async (column: any) => {
  queryParams.value.field = column.prop;
  queryParams.value.order = column.order;
  await handleQuery();
};
  // 打开新增页面
  const openAddWcsDevice = () => {
    editWcsDeviceTitle.value = '添加设备信息';
    editDialogRef.value.openDialog({});
  };
// 打开新增页面
const openAddWcsDevice = () => {
  editWcsDeviceTitle.value = '添加设备信息';
  editDialogRef.value.openDialog({});
};
  // 打开打印页面
  const openPrintWcsDevice = async (row: any) => {
    printWcsDeviceTitle.value = '打印设备信息';
  }
  // 打开编辑页面
  const openEditWcsDevice = (row: any) => {
    editWcsDeviceTitle.value = '编辑设备信息';
    editDialogRef.value.openDialog(row);
  };
// 打开打印页面
const openPrintWcsDevice = async (row: any) => {
  printWcsDeviceTitle.value = '打印设备信息';
}
  // 删除
  const delWcsDevice = (row: any) => {
    ElMessageBox.confirm(`确定要删除吗?`, "提示", {
// 打开编辑页面
const openEditWcsDevice = (row: any) => {
  editWcsDeviceTitle.value = '编辑设备信息';
  editDialogRef.value.openDialog(row);
};
// 删除
const delWcsDevice = (row: any) => {
  ElMessageBox.confirm(`确定要删除吗?`, "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
  .then(async () => {
    await deleteWcsDevice(row);
    handleQuery();
    ElMessage.success("删除成功");
  })
  .catch(() => {});
  };
    .then(async () => {
      await deleteWcsDevice(row);
      handleQuery();
      ElMessage.success("删除成功");
    })
    .catch(() => { });
};
  // 改变页面容量
  const handleSizeChange = (val: number) => {
    tableParams.value.pageSize = val;
    handleQuery();
  };
  // 改变页码序号
  const handleCurrentChange = (val: number) => {
    tableParams.value.page = val;
    handleQuery();
  };
  const wcsPlcPlcIdDropdownList = ref<any>([]);
  const getWcsPlcPlcIdDropdownList = async () => {
    let list = await getWcsPlcPlcIdDropdown();
    wcsPlcPlcIdDropdownList.value = list.data.result ?? [];
  };
  getWcsPlcPlcIdDropdownList();
// 改变页面容量
const handleSizeChange = (val: number) => {
  tableParams.value.pageSize = val;
  handleQuery();
};
// 改变页码序号
const handleCurrentChange = (val: number) => {
  tableParams.value.page = val;
  handleQuery();
};
const wcsPlcPlcIdDropdownList = ref<any>([]);
const getWcsPlcPlcIdDropdownList = async () => {
  let list = await getWcsPlcPlcIdDropdown();
  wcsPlcPlcIdDropdownList.value = list.data.result ?? [];
};
getWcsPlcPlcIdDropdownList();
handleQuery();
</script>
<style scoped>
:deep(.el-input),
:deep(.el-select),
:deep(.el-input-number) {
    width: 100%;
  width: 100%;
}
</style>
Web/src/views/wcs/wcsPlc/component/editDialog.vue
@@ -14,34 +14,51 @@
                    </el-form-item>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="PLCIP地址" prop="ip">
                            <el-input v-model="ruleForm.ip" placeholder="请输入PLCIP地址" maxlength="20" show-word-limit clearable />
                            <el-input v-model="ruleForm.ip" placeholder="请输入PLCIP地址" maxlength="20" show-word-limit
                                clearable />
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="PLC类型" prop="plcType">
                            <el-select clearable v-model="ruleForm.plcType" placeholder="请选择PLC类型">
                                <el-option v-for="(item, index) in dl('PLCEnum')" :key="index"
                                    :value="Number(item.value)"
                                    :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="设备类型" prop="type">
                            <el-select clearable v-model="ruleForm.type" placeholder="请选择设备类型">
                                <el-option v-for="(item,index) in dl('PLCTypeEnum')" :key="index" :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
                                <el-option v-for="(item, index) in dl('PLCTypeEnum')" :key="index"
                                    :value="Number(item.value)"
                                    :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="仓库号" prop="wareHouseNo">
                            <el-input v-model="ruleForm.wareHouseNo" placeholder="请输入仓库号" maxlength="20" show-word-limit clearable />
                            <el-input v-model="ruleForm.wareHouseNo" placeholder="请输入仓库号" maxlength="20" show-word-limit
                                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="text">
                            <el-input v-model="ruleForm.text" placeholder="请输入描述" maxlength="100" show-word-limit clearable />
                            <el-input v-model="ruleForm.text" placeholder="请输入描述" maxlength="100" show-word-limit
                                clearable />
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
@@ -61,89 +78,85 @@
}
</style>
<script lang="ts" setup>
    import { ref,onMounted } from "vue";
    import { ElMessage } from "element-plus";
    import type { FormRules } from "element-plus";
    import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
    import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
    import { addWcsPlc, updateWcsPlc, detailWcsPlc } from "/@/api/wcs/wcsPlc";
    import { getAPI } from '/@/utils/axios-utils';
    import { SysEnumApi } from '/@/api-services/api';
import { ref, onMounted } from "vue";
import { ElMessage } from "element-plus";
import type { FormRules } from "element-plus";
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
import { addWcsPlc, updateWcsPlc, detailWcsPlc } from "/@/api/wcs/wcsPlc";
import { getAPI } from '/@/utils/axios-utils';
import { SysEnumApi } from '/@/api-services/api';
    //父级传递来的参数
    var props = defineProps({
        title: {
//父级传递来的参数
var props = defineProps({
    title: {
        type: String,
        default: "",
    },
    });
    //父级传递来的函数,用于回调
    const emit = defineEmits(["reloadTable"]);
    const ruleFormRef = ref();
    const isShowDialog = ref(false);
    const ruleForm = ref<any>({});
    //自行添加其他规则
    const rules = ref<FormRules>({
        iP: [{required: true, message: '请输入PLCIP地址!', trigger: 'blur',},],
    });
});
//父级传递来的函数,用于回调
const emit = defineEmits(["reloadTable"]);
const ruleFormRef = ref();
const isShowDialog = ref(false);
const ruleForm = ref<any>({});
//自行添加其他规则
const rules = ref<FormRules>({
    iP: [{ required: true, message: '请输入PLCIP地址!', trigger: 'blur', },],
});
    // 页面加载时
    onMounted(() => {
// 页面加载时
onMounted(() => {
    });
});
    // 打开弹窗
    const openDialog = async (row: any) => {
        // ruleForm.value = JSON.parse(JSON.stringify(row));
        // 改用detail获取最新数据来编辑
        let rowData = JSON.parse(JSON.stringify(row));
        if (rowData.id)
            ruleForm.value = (await detailWcsPlc(rowData.id)).data.result;
        else
            ruleForm.value = rowData;
        isShowDialog.value = true;
    };
// 打开弹窗
const openDialog = async (row: any) => {
    // ruleForm.value = JSON.parse(JSON.stringify(row));
    // 改用detail获取最新数据来编辑
    let rowData = JSON.parse(JSON.stringify(row));
    if (rowData.id)
        ruleForm.value = (await detailWcsPlc(rowData.id)).data.result;
    else
        ruleForm.value = rowData;
    isShowDialog.value = true;
};
    // 关闭弹窗
    const closeDialog = () => {
        emit("reloadTable");
        isShowDialog.value = false;
    };
// 关闭弹窗
const closeDialog = () => {
    emit("reloadTable");
    isShowDialog.value = false;
};
    // 取消
    const cancel = () => {
        isShowDialog.value = false;
    };
// 取消
const cancel = () => {
    isShowDialog.value = false;
};
    // 提交
    const submit = async () => {
        ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
            if (isValid) {
                let values = ruleForm.value;
                if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
                    await addWcsPlc(values);
                } else {
                    await updateWcsPlc(values);
                }
                closeDialog();
// 提交
const submit = async () => {
    ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
        if (isValid) {
            let values = ruleForm.value;
            if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
                await addWcsPlc(values);
            } else {
                ElMessage({
                    message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
                    type: "error",
                });
                await updateWcsPlc(values);
            }
        });
    };
            closeDialog();
        } else {
            ElMessage({
                message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
                type: "error",
            });
        }
    });
};
    //将属性或者函数暴露给父组件
    defineExpose({ openDialog });
//将属性或者函数暴露给父组件
defineExpose({ openDialog });
</script>
Web/src/views/wcs/wcsPlc/index.vue
@@ -1,203 +1,206 @@
<template>
  <div class="wcsPlc-container">
    <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
    <el-card shadow="hover" :body-style="{ paddingBottom: '0' }">
      <el-form :model="queryParams" ref="queryForm" labelWidth="90">
        <el-row>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
            <el-form-item label="关键字">
              <el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字"/>
              <el-input v-model="queryParams.searchKey" clearable="" placeholder="请输入模糊查询关键字" />
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
            <el-form-item label="PLCIP地址">
              <el-input v-model="queryParams.ip" clearable="" placeholder="请输入PLCIP地址"/>
              <el-input v-model="queryParams.ip" clearable="" placeholder="请输入PLCIP地址" />
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
            <el-form-item label="PLC类型">
              <el-select clearable="" v-model="queryParams.plcType" placeholder="请选择PLC类型">
                <el-option v-for="(item, index) in dl('PLCEnum')" :key="index" :value="item.value"
                  :label="`${item.name} (${item.code}) [${item.value}] `" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10" v-if="showAdvanceQueryUI">
            <el-form-item label="设备类型">
              <el-select clearable="" v-model="queryParams.type" placeholder="请选择设备类型">
                <el-option v-for="(item,index) in dl('PLCTypeEnum')" :key="index" :value="item.value" :label="`${item.name} (${item.code}) [${item.value}] `" />
                <el-option v-for="(item, index) in dl('PLCTypeEnum')" :key="index" :value="item.value"
                  :label="`${item.name} (${item.code}) [${item.value}] `" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
            <el-form-item >
            <el-form-item>
              <el-button-group style="display: flex; align-items: center;">
                <el-button type="primary"  icon="ele-Search" @click="handleQuery" v-auth="'wcsPlc:page'"> 查询 </el-button>
                      <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
                        <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI" style="margin-left:5px;"> 高级查询 </el-button>
                        <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI" style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsPlc" v-auth="'wcsPlc:add'"> 新增 </el-button>
                <el-button type="primary" icon="ele-Search" @click="handleQuery" v-auth="'wcsPlc:page'"> 查询 </el-button>
                <el-button icon="ele-Refresh" @click="() => queryParams = {}"> 重置 </el-button>
                <el-button icon="ele-ZoomIn" @click="changeAdvanceQueryUI" v-if="!showAdvanceQueryUI"
                  style="margin-left:5px;"> 高级查询 </el-button>
                <el-button icon="ele-ZoomOut" @click="changeAdvanceQueryUI" v-if="showAdvanceQueryUI"
                  style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="openAddWcsPlc"
                  v-auth="'wcsPlc:add'"> 新增 </el-button>
              </el-button-group>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-card class="full-table" shadow="hover" style="margin-top: 5px">
      <el-table
                :data="tableData"
                style="width: 100%"
                v-loading="loading"
                tooltip-effect="light"
                                row-key="id"
                @sort-change="sortChange"
                border="">
        <el-table-column type="index" label="序号" width="55" align="center"/>
        <el-table-column prop="ip" label="PLCIP地址"  show-overflow-tooltip="" />
          <el-table-column prop="type" label="设备类型"  show-overflow-tooltip="" >
            <template #default="scope">
              <el-tag :type="dv('PLCTypeEnum', scope.row.type)?.tagType"> {{dv('PLCTypeEnum', scope.row.type)?.name}}</el-tag>
            </template>
          </el-table-column>
        <el-table-column prop="wareHouseNo" label="仓库号"  show-overflow-tooltip="" />
        <el-table-column prop="text" label="描述"  show-overflow-tooltip="" />
      <el-table :data="tableData" style="width: 100%" v-loading="loading" tooltip-effect="light" row-key="id"
        @sort-change="sortChange" border="">
        <el-table-column type="index" label="序号" width="55" align="center" />
        <el-table-column prop="ip" label="PLCIP地址" show-overflow-tooltip="" />
        <el-table-column prop="plcType" label="PLC类型" show-overflow-tooltip="">
          <template #default="scope">
            <el-tag :type="dv('PLCEnum', scope.row.plcType)?.tagType"> {{ dv('PLCEnum',
              scope.row.plcType)?.name}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="type" label="设备类型" show-overflow-tooltip="">
          <template #default="scope">
            <el-tag :type="dv('PLCTypeEnum', scope.row.type)?.tagType"> {{ dv('PLCTypeEnum',
              scope.row.type)?.name }}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="wareHouseNo" label="仓库号" show-overflow-tooltip="" />
        <el-table-column prop="text" label="描述" show-overflow-tooltip="" />
        <el-table-column label="修改记录" width="80" align="center" show-overflow-tooltip>
          <template #default="scope">
            <ModifyRecord :data="scope.row" />
          </template>
        </el-table-column>
        <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" v-if="auth('wcsPlc:update') || auth('wcsPlc:delete')">
        <el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip=""
          v-if="auth('wcsPlc:update') || auth('wcsPlc:delete')">
          <template #default="scope">
            <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsPlc(scope.row)" v-auth="'wcsPlc:update'"> 编辑 </el-button>
            <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsPlc(scope.row)" v-auth="'wcsPlc:delete'"> 删除 </el-button>
            <el-button icon="ele-Edit" size="small" text="" type="primary" @click="openEditWcsPlc(scope.row)"
              v-auth="'wcsPlc:update'"> 编辑 </el-button>
            <el-button icon="ele-Delete" size="small" text="" type="primary" @click="delWcsPlc(scope.row)"
              v-auth="'wcsPlc:delete'"> 删除 </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
                v-model:currentPage="tableParams.page"
                v-model:page-size="tableParams.pageSize"
                :total="tableParams.total"
                :page-sizes="[10, 20, 50, 100, 200, 500]"
                size="small"
                background=""
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                layout="total, sizes, prev, pager, next, jumper"
    />
      <printDialog
        ref="printDialogRef"
        :title="printWcsPlcTitle"
        @reloadTable="handleQuery" />
      <editDialog
        ref="editDialogRef"
        :title="editWcsPlcTitle"
        @reloadTable="handleQuery"
      />
      <el-pagination v-model:currentPage="tableParams.page" v-model:page-size="tableParams.pageSize"
        :total="tableParams.total" :page-sizes="[10, 20, 50, 100, 200, 500]" size="small" background=""
        @size-change="handleSizeChange" @current-change="handleCurrentChange"
        layout="total, sizes, prev, pager, next, jumper" />
      <printDialog ref="printDialogRef" :title="printWcsPlcTitle" @reloadTable="handleQuery" />
      <editDialog ref="editDialogRef" :title="editWcsPlcTitle" @reloadTable="handleQuery" />
    </el-card>
  </div>
</template>
<script lang="ts" setup="" name="wcsPlc">
  import { ref } from "vue";
  import { ElMessageBox, ElMessage } from "element-plus";
  import { auth } from '/@/utils/authFunction';
import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction';
  import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
  import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
  import ModifyRecord from '/@/components/table/modifyRecord.vue';
import ModifyRecord from '/@/components/table/modifyRecord.vue';
  import printDialog from '/@/views/system/print/component/hiprint/preview.vue'
  import editDialog from '/@/views/wcs/wcsPlc/component/editDialog.vue'
  import { pageWcsPlc, deleteWcsPlc } from '/@/api/wcs/wcsPlc';
    import { getAPI } from '/@/utils/axios-utils';
    import { SysEnumApi } from '/@/api-services/api';
  import commonFunction from '/@/utils/commonFunction';
import printDialog from '/@/views/system/print/component/hiprint/preview.vue'
import editDialog from '/@/views/wcs/wcsPlc/component/editDialog.vue'
import { pageWcsPlc, deleteWcsPlc } from '/@/api/wcs/wcsPlc';
import { getAPI } from '/@/utils/axios-utils';
import { SysEnumApi } from '/@/api-services/api';
import commonFunction from '/@/utils/commonFunction';
  const showAdvanceQueryUI = ref(false);
  const printDialogRef = ref();
  const editDialogRef = ref();
  const loading = ref(false);
  const tableData = ref<any>([]);
  const queryParams = ref<any>({});
  const tableParams = ref({
    page: 1,
    pageSize: 10,
    total: 0,
  });
const showAdvanceQueryUI = ref(false);
const printDialogRef = ref();
const editDialogRef = ref();
const loading = ref(false);
const tableData = ref<any>([]);
const queryParams = ref<any>({});
const tableParams = ref({
  page: 1,
  pageSize: 10,
  total: 0,
});
  const printWcsPlcTitle = ref("");
  const editWcsPlcTitle = ref("");
const printWcsPlcTitle = ref("");
const editWcsPlcTitle = ref("");
  // 改变高级查询的控件显示状态
  const changeAdvanceQueryUI = () => {
    showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
  }
// 改变高级查询的控件显示状态
const changeAdvanceQueryUI = () => {
  showAdvanceQueryUI.value = !showAdvanceQueryUI.value;
}
  // 查询操作
  const handleQuery = async () => {
    loading.value = true;
    var res = await pageWcsPlc(Object.assign(queryParams.value, tableParams.value));
    tableData.value = res.data.result?.items ?? [];
    tableParams.value.total = res.data.result?.total;
    loading.value = false;
  };
// 查询操作
const handleQuery = async () => {
  loading.value = true;
  var res = await pageWcsPlc(Object.assign(queryParams.value, tableParams.value));
  tableData.value = res.data.result?.items ?? [];
  tableParams.value.total = res.data.result?.total;
  loading.value = false;
};
  // 列排序
  const sortChange = async (column: any) => {
    queryParams.value.field = column.prop;
    queryParams.value.order = column.order;
    await handleQuery();
  };
// 列排序
const sortChange = async (column: any) => {
  queryParams.value.field = column.prop;
  queryParams.value.order = column.order;
  await handleQuery();
};
  // 打开新增页面
  const openAddWcsPlc = () => {
    editWcsPlcTitle.value = '添加PLC';
    editDialogRef.value.openDialog({});
  };
// 打开新增页面
const openAddWcsPlc = () => {
  editWcsPlcTitle.value = '添加PLC';
  editDialogRef.value.openDialog({});
};
  // 打开打印页面
  const openPrintWcsPlc = async (row: any) => {
    printWcsPlcTitle.value = '打印PLC';
  }
  // 打开编辑页面
  const openEditWcsPlc = (row: any) => {
    editWcsPlcTitle.value = '编辑PLC';
    editDialogRef.value.openDialog(row);
  };
// 打开打印页面
const openPrintWcsPlc = async (row: any) => {
  printWcsPlcTitle.value = '打印PLC';
}
  // 删除
  const delWcsPlc = (row: any) => {
    ElMessageBox.confirm(`确定要删除吗?`, "提示", {
// 打开编辑页面
const openEditWcsPlc = (row: any) => {
  editWcsPlcTitle.value = '编辑PLC';
  editDialogRef.value.openDialog(row);
};
// 删除
const delWcsPlc = (row: any) => {
  ElMessageBox.confirm(`确定要删除吗?`, "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
  .then(async () => {
    await deleteWcsPlc(row);
    handleQuery();
    ElMessage.success("删除成功");
  })
  .catch(() => {});
  };
    .then(async () => {
      await deleteWcsPlc(row);
      handleQuery();
      ElMessage.success("删除成功");
    })
    .catch(() => { });
};
  // 改变页面容量
  const handleSizeChange = (val: number) => {
    tableParams.value.pageSize = val;
    handleQuery();
  };
  // 改变页码序号
  const handleCurrentChange = (val: number) => {
    tableParams.value.page = val;
    handleQuery();
  };
// 改变页面容量
const handleSizeChange = (val: number) => {
  tableParams.value.pageSize = val;
  handleQuery();
};
// 改变页码序号
const handleCurrentChange = (val: number) => {
  tableParams.value.page = val;
  handleQuery();
};
handleQuery();
</script>
<style scoped>
:deep(.el-input),
:deep(.el-select),
:deep(.el-input-number) {
    width: 100%;
  width: 100%;
}
</style>
Web/src/views/wcs/wcsStation/component/editDialog.vue
@@ -38,7 +38,10 @@
                    </el-col>
                    <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
                        <el-form-item label="流程字类型" prop="posType">
                            <el-input v-model="ruleForm.posType" placeholder="请输入流程字类型" maxlength="10" show-word-limit clearable />
                            <el-select clearable v-model="ruleForm.posType" placeholder="请选择流程字类型">
                                <el-option v-for="(item,index) in dl('PLCDataTypeEnum')" :key="index" :value="Number(item.value)" :label="`${item.name} (${item.code}) [${item.value}]`"></el-option>
                            </el-select>
                            
                        </el-form-item>
                        
@@ -80,7 +83,7 @@
    import type { FormRules } from "element-plus";
    import { addWcsStation, updateWcsStation, detailWcsStation } from "/@/api/wcs/wcsStation";
    import { getWcsDeviceDeviceIdDropdown } from '/@/api/wcs/wcsStation';
    import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
    //父级传递来的参数
    var props = defineProps({
        title: {
Web/src/views/wcs/wcsStation/index.vue
@@ -57,8 +57,13 @@
        </el-table-column>
        <el-table-column prop="stationNum" label="工位号" show-overflow-tooltip="" />
        <el-table-column prop="plcPos" label="偏移量" show-overflow-tooltip="" />
        <el-table-column prop="posType" label="流程字类型" show-overflow-tooltip="" />
        <el-table-column prop="plcPos" label="偏移量" show-overflow-tooltip="" /> <el-table-column prop="posType"
          label="流程字类型" show-overflow-tooltip="">
          <template #default="scope">
            <el-tag :type="dv('PLCDataTypeEnum', scope.row.posType)?.tagType"> {{ dv('PLCDataTypeEnum',
              scope.row.posType)?.name}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="ledIP" label="显示屏ip地址" show-overflow-tooltip="" />
        <el-table-column prop="text" label="描述" show-overflow-tooltip="" />
        <el-table-column label="修改记录" width="80" align="center" show-overflow-tooltip>
@@ -90,7 +95,7 @@
import { ref } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import { auth } from '/@/utils/authFunction';
import { getDictLabelByVal as dv } from '/@/utils/dict-utils';
import ModifyRecord from '/@/components/table/modifyRecord.vue';
import printDialog from '/@/views/system/print/component/hiprint/preview.vue'