Bläddra i källkod

Merge remote-tracking branch 'origin/master'

wuhb 6 månader sedan
förälder
incheckning
6c7de849a2

+ 110 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtFaultCodesController.java

@@ -0,0 +1,110 @@
+package com.ygtx.gxt.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ygtx.common.annotation.Log;
+import com.ygtx.common.core.controller.BaseController;
+import com.ygtx.common.core.domain.AjaxResult;
+import com.ygtx.common.enums.BusinessType;
+import com.ygtx.gxt.domain.GxtFaultCodes;
+import com.ygtx.gxt.service.IGxtFaultCodesService;
+import com.ygtx.common.utils.poi.ExcelUtil;
+import com.ygtx.common.core.page.TableDataInfo;
+
+/**
+ * 故障代码管理Controller
+ * 
+ * @author ouyj
+ * @date 2025-10-29
+ */
+@RestController
+@RequestMapping("/gxt/faultCodes")
+public class GxtFaultCodesController extends BaseController
+{
+    @Autowired
+    private IGxtFaultCodesService gxtFaultCodesService;
+
+    /**
+     * 查询故障代码管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('gxt:faultCodes:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(GxtFaultCodes gxtFaultCodes)
+    {
+        startPage();
+        List<GxtFaultCodes> list = gxtFaultCodesService.selectGxtFaultCodesList(gxtFaultCodes);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出故障代码管理列表
+     */
+    @PreAuthorize("@ss.hasPermi('gxt:faultCodes:export')")
+    @Log(title = "故障代码管理", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, GxtFaultCodes gxtFaultCodes)
+    {
+        List<GxtFaultCodes> list = gxtFaultCodesService.selectGxtFaultCodesList(gxtFaultCodes);
+        ExcelUtil<GxtFaultCodes> util = new ExcelUtil<GxtFaultCodes>(GxtFaultCodes.class);
+        util.exportExcel(response, list, "故障代码管理数据");
+    }
+
+    /**
+     * 获取故障代码管理详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('gxt:faultCodes:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(gxtFaultCodesService.selectGxtFaultCodesById(id));
+    }
+
+    /**
+     * 新增故障代码管理
+     */
+    @PreAuthorize("@ss.hasPermi('gxt:faultCodes:add')")
+    @Log(title = "故障代码管理", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody GxtFaultCodes gxtFaultCodes)
+    {
+        if (!gxtFaultCodesService.checkFaultCodeUnique(gxtFaultCodes)) {
+            return error("新增故障代码'" + gxtFaultCodes.getFaultCode() + "'失败,故障代码已存在");
+        }
+        return toAjax(gxtFaultCodesService.insertGxtFaultCodes(gxtFaultCodes));
+    }
+
+    /**
+     * 修改故障代码管理
+     */
+    @PreAuthorize("@ss.hasPermi('gxt:faultCodes:edit')")
+    @Log(title = "故障代码管理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody GxtFaultCodes gxtFaultCodes)
+    {
+        if (!gxtFaultCodesService.checkFaultCodeUnique(gxtFaultCodes)) {
+            return error("修改故障代码'" + gxtFaultCodes.getFaultCode() + "'失败,故障代码已存在");
+        }
+        return toAjax(gxtFaultCodesService.updateGxtFaultCodes(gxtFaultCodes));
+    }
+
+    /**
+     * 删除故障代码管理
+     */
+    @PreAuthorize("@ss.hasPermi('gxt:faultCodes:remove')")
+    @Log(title = "故障代码管理", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(gxtFaultCodesService.deleteGxtFaultCodesByIds(ids));
+    }
+}

+ 86 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtFaultCodes.java

@@ -0,0 +1,86 @@
+package com.ygtx.gxt.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ygtx.common.annotation.Excel;
+import com.ygtx.common.core.domain.BaseEntity;
+
+/**
+ * 故障代码管理对象 gxt_fault_codes
+ * 
+ * @author ouyj
+ * @date 2025-10-29
+ */
+public class GxtFaultCodes extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键ID */
+    private Long id;
+
+    /** 故障代码 */
+    @Excel(name = "故障代码")
+    private String faultCode;
+
+    /** 故障描述 */
+    @Excel(name = "故障描述")
+    private String faultDescription;
+
+    /** 是否启用(0:启用,1:停用) */
+    private Integer isActive;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+
+    public void setFaultCode(String faultCode) 
+    {
+        this.faultCode = faultCode;
+    }
+
+    public String getFaultCode() 
+    {
+        return faultCode;
+    }
+
+    public void setFaultDescription(String faultDescription) 
+    {
+        this.faultDescription = faultDescription;
+    }
+
+    public String getFaultDescription() 
+    {
+        return faultDescription;
+    }
+
+    public void setIsActive(Integer isActive) 
+    {
+        this.isActive = isActive;
+    }
+
+    public Integer getIsActive() 
+    {
+        return isActive;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("faultCode", getFaultCode())
+            .append("faultDescription", getFaultDescription())
+            .append("isActive", getIsActive())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .toString();
+    }
+}

+ 69 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/mapper/GxtFaultCodesMapper.java

@@ -0,0 +1,69 @@
+package com.ygtx.gxt.mapper;
+
+import java.util.List;
+import com.ygtx.gxt.domain.GxtFaultCodes;
+
+/**
+ * 故障代码管理Mapper接口
+ * 
+ * @author ouyj
+ * @date 2025-10-29
+ */
+public interface GxtFaultCodesMapper 
+{
+    /**
+     * 查询故障代码管理
+     * 
+     * @param id 故障代码管理主键
+     * @return 故障代码管理
+     */
+    public GxtFaultCodes selectGxtFaultCodesById(Long id);
+
+    /**
+     * 查询故障代码管理列表
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 故障代码管理集合
+     */
+    public List<GxtFaultCodes> selectGxtFaultCodesList(GxtFaultCodes gxtFaultCodes);
+
+    /**
+     * 根据故障代码查询故障代码管理
+     * 
+     * @param faultCode 故障代码
+     * @return 故障代码管理
+     */
+    public GxtFaultCodes selectGxtFaultCodesByFaultCode(String faultCode);
+
+    /**
+     * 新增故障代码管理
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 结果
+     */
+    public int insertGxtFaultCodes(GxtFaultCodes gxtFaultCodes);
+
+    /**
+     * 修改故障代码管理
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 结果
+     */
+    public int updateGxtFaultCodes(GxtFaultCodes gxtFaultCodes);
+
+    /**
+     * 删除故障代码管理
+     * 
+     * @param id 故障代码管理主键
+     * @return 结果
+     */
+    public int deleteGxtFaultCodesById(Long id);
+
+    /**
+     * 批量删除故障代码管理
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteGxtFaultCodesByIds(Long[] ids);
+}

+ 69 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/IGxtFaultCodesService.java

@@ -0,0 +1,69 @@
+package com.ygtx.gxt.service;
+
+import java.util.List;
+import com.ygtx.gxt.domain.GxtFaultCodes;
+
+/**
+ * 故障代码管理Service接口
+ * 
+ * @author ouyj
+ * @date 2025-10-29
+ */
+public interface IGxtFaultCodesService 
+{
+    /**
+     * 查询故障代码管理
+     * 
+     * @param id 故障代码管理主键
+     * @return 故障代码管理
+     */
+    public GxtFaultCodes selectGxtFaultCodesById(Long id);
+
+    /**
+     * 查询故障代码管理列表
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 故障代码管理集合
+     */
+    public List<GxtFaultCodes> selectGxtFaultCodesList(GxtFaultCodes gxtFaultCodes);
+
+    /**
+     * 验证故障代码是否唯一
+     * 
+     * @param gxtFaultCodes 故障代码信息
+     * @return 结果
+     */
+    public boolean checkFaultCodeUnique(GxtFaultCodes gxtFaultCodes);
+
+    /**
+     * 新增故障代码管理
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 结果
+     */
+    public int insertGxtFaultCodes(GxtFaultCodes gxtFaultCodes);
+
+    /**
+     * 修改故障代码管理
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 结果
+     */
+    public int updateGxtFaultCodes(GxtFaultCodes gxtFaultCodes);
+
+    /**
+     * 批量删除故障代码管理
+     * 
+     * @param ids 需要删除的故障代码管理主键集合
+     * @return 结果
+     */
+    public int deleteGxtFaultCodesByIds(Long[] ids);
+
+    /**
+     * 删除故障代码管理信息
+     * 
+     * @param id 故障代码管理主键
+     * @return 结果
+     */
+    public int deleteGxtFaultCodesById(Long id);
+}

+ 112 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtFaultCodesServiceImpl.java

@@ -0,0 +1,112 @@
+package com.ygtx.gxt.service.impl;
+
+import java.util.List;
+import com.ygtx.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ygtx.gxt.mapper.GxtFaultCodesMapper;
+import com.ygtx.gxt.domain.GxtFaultCodes;
+import com.ygtx.gxt.service.IGxtFaultCodesService;
+
+/**
+ * 故障代码管理Service业务层处理
+ * 
+ * @author ouyj
+ * @date 2025-10-29
+ */
+@Service
+public class GxtFaultCodesServiceImpl implements IGxtFaultCodesService 
+{
+    @Autowired
+    private GxtFaultCodesMapper gxtFaultCodesMapper;
+
+    /**
+     * 查询故障代码管理
+     * 
+     * @param id 故障代码管理主键
+     * @return 故障代码管理
+     */
+    @Override
+    public GxtFaultCodes selectGxtFaultCodesById(Long id)
+    {
+        return gxtFaultCodesMapper.selectGxtFaultCodesById(id);
+    }
+
+    /**
+     * 查询故障代码管理列表
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 故障代码管理
+     */
+    @Override
+    public List<GxtFaultCodes> selectGxtFaultCodesList(GxtFaultCodes gxtFaultCodes)
+    {
+        return gxtFaultCodesMapper.selectGxtFaultCodesList(gxtFaultCodes);
+    }
+
+    /**
+     * 验证故障代码是否唯一
+     * 
+     * @param gxtFaultCodes 故障代码信息
+     * @return 结果
+     */
+    @Override
+    public boolean checkFaultCodeUnique(GxtFaultCodes gxtFaultCodes) {
+        Long id = gxtFaultCodes.getId() == null ? -1L : gxtFaultCodes.getId();
+        GxtFaultCodes info = gxtFaultCodesMapper.selectGxtFaultCodesByFaultCode(gxtFaultCodes.getFaultCode());
+        if (info != null && info.getId().longValue() != id.longValue()) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 新增故障代码管理
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 结果
+     */
+    @Override
+    public int insertGxtFaultCodes(GxtFaultCodes gxtFaultCodes)
+    {
+        gxtFaultCodes.setCreateTime(DateUtils.getNowDate());
+        return gxtFaultCodesMapper.insertGxtFaultCodes(gxtFaultCodes);
+    }
+
+    /**
+     * 修改故障代码管理
+     * 
+     * @param gxtFaultCodes 故障代码管理
+     * @return 结果
+     */
+    @Override
+    public int updateGxtFaultCodes(GxtFaultCodes gxtFaultCodes)
+    {
+        gxtFaultCodes.setUpdateTime(DateUtils.getNowDate());
+        return gxtFaultCodesMapper.updateGxtFaultCodes(gxtFaultCodes);
+    }
+
+    /**
+     * 批量删除故障代码管理
+     * 
+     * @param ids 需要删除的故障代码管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteGxtFaultCodesByIds(Long[] ids)
+    {
+        return gxtFaultCodesMapper.deleteGxtFaultCodesByIds(ids);
+    }
+
+    /**
+     * 删除故障代码管理信息
+     * 
+     * @param id 故障代码管理主键
+     * @return 结果
+     */
+    @Override
+    public int deleteGxtFaultCodesById(Long id)
+    {
+        return gxtFaultCodesMapper.deleteGxtFaultCodesById(id);
+    }
+}

+ 91 - 0
ygtx-gxt/src/main/resources/mapper/gxt/GxtFaultCodesMapper.xml

@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ygtx.gxt.mapper.GxtFaultCodesMapper">
+    
+    <resultMap type="GxtFaultCodes" id="GxtFaultCodesResult">
+        <result property="id"    column="id"    />
+        <result property="faultCode"    column="fault_code"    />
+        <result property="faultDescription"    column="fault_description"    />
+        <result property="isActive"    column="is_active"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectGxtFaultCodesVo">
+        select id, fault_code, fault_description, is_active, create_by, create_time, update_by, update_time, remark from gxt_fault_codes
+    </sql>
+
+    <select id="selectGxtFaultCodesList" parameterType="GxtFaultCodes" resultMap="GxtFaultCodesResult">
+        <include refid="selectGxtFaultCodesVo"/>
+        <where>  
+            <if test="faultCode != null  and faultCode != ''"> and fault_code = #{faultCode}</if>
+            <if test="faultDescription != null  and faultDescription != ''"> and fault_description = #{faultDescription}</if>
+            <if test="isActive != null "> and is_active = #{isActive}</if>
+        </where>
+    </select>
+    
+    <select id="selectGxtFaultCodesById" parameterType="Long" resultMap="GxtFaultCodesResult">
+        <include refid="selectGxtFaultCodesVo"/>
+        where id = #{id}
+    </select>
+    
+    <select id="selectGxtFaultCodesByFaultCode" parameterType="String" resultMap="GxtFaultCodesResult">
+        <include refid="selectGxtFaultCodesVo"/>
+        where fault_code = #{faultCode}
+    </select>
+
+    <insert id="insertGxtFaultCodes" parameterType="GxtFaultCodes" useGeneratedKeys="true" keyProperty="id">
+        insert into gxt_fault_codes
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="faultCode != null and faultCode != ''">fault_code,</if>
+            <if test="faultDescription != null and faultDescription != ''">fault_description,</if>
+            <if test="isActive != null">is_active,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="faultCode != null and faultCode != ''">#{faultCode},</if>
+            <if test="faultDescription != null and faultDescription != ''">#{faultDescription},</if>
+            <if test="isActive != null">#{isActive},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateGxtFaultCodes" parameterType="GxtFaultCodes">
+        update gxt_fault_codes
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="faultCode != null and faultCode != ''">fault_code = #{faultCode},</if>
+            <if test="faultDescription != null and faultDescription != ''">fault_description = #{faultDescription},</if>
+            <if test="isActive != null">is_active = #{isActive},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteGxtFaultCodesById" parameterType="Long">
+        delete from gxt_fault_codes where id = #{id}
+    </delete>
+
+    <delete id="deleteGxtFaultCodesByIds" parameterType="String">
+        delete from gxt_fault_codes where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 44 - 0
ygtx-ui/src/api/gxt/faultCodes.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询故障代码管理列表
+export function listFaultCodes(query) {
+  return request({
+    url: '/gxt/faultCodes/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询故障代码管理详细
+export function getFaultCodes(id) {
+  return request({
+    url: '/gxt/faultCodes/' + id,
+    method: 'get'
+  })
+}
+
+// 新增故障代码管理
+export function addFaultCodes(data) {
+  return request({
+    url: '/gxt/faultCodes',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改故障代码管理
+export function updateFaultCodes(data) {
+  return request({
+    url: '/gxt/faultCodes',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除故障代码管理
+export function delFaultCodes(id) {
+  return request({
+    url: '/gxt/faultCodes/' + id,
+    method: 'delete'
+  })
+}

+ 5 - 0
ygtx-ui/src/main.js

@@ -30,6 +30,8 @@ import { useDict } from '@/utils/dict'
 import { getConfigKey } from "@/api/system/config"
 import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
 
+import { installChineseInputDirective } from '@/utils/inputLimit'
+
 // 分页组件
 import Pagination from '@/components/Pagination'
 // 自定义表格工具组件
@@ -75,6 +77,9 @@ app.component('svg-icon', SvgIcon)
 
 directive(app)
 
+// 注册全局指令
+installChineseInputDirective(app)
+
 // 使用element-plus 并且设置全局的大小
 app.use(ElementPlus, {
   locale: locale,

+ 92 - 0
ygtx-ui/src/utils/inputLimit.js

@@ -0,0 +1,92 @@
+ /**
+ * 过滤中文字符
+ * @param {string} value - 输入的值
+ * @returns {string} 过滤后的值(不含中文)
+ */
+export function filterChineseInput(value) {
+  if (value == null) return '';
+  // 使用正则表达式过滤中文字符
+  return value.replace(/[\u4e00-\u9fa5]/g, '');
+}
+
+/**
+ * 阻止中文输入法输入
+ * @param {Event} e - 键盘事件
+ */
+export function preventChineseInput(e) {
+  // 检测是否在输入中文(composition事件)
+  if (e.isComposing || e.keyCode === 229) {
+    e.preventDefault();
+  }
+}
+
+/**
+ * 中文输入限制的自定义指令
+ */
+export const ChineseInputDirective = {
+  mounted(el, binding, vnode) {
+    const input = el.tagName === 'INPUT' ? el : el.querySelector('input');
+
+    if (!input) return;
+
+    // 保存原始值,用于比较
+    let lastValue = input.value;
+
+    const handleInput = (e) => {
+      const value = e.target.value;
+      const filteredValue = filterChineseInput(value);
+
+      // 如果过滤后的值与原值不同,则更新输入框的值
+      if (value !== filteredValue) {
+        e.target.value = filteredValue;
+        // 触发input事件,以便v-model更新
+        e.target.dispatchEvent(new Event('input'));
+      }
+    };
+
+    const handleKeydown = (e) => {
+      preventChineseInput(e);
+    };
+
+    // 添加事件监听
+    input.addEventListener('input', handleInput);
+    input.addEventListener('keydown', handleKeydown);
+
+    // 将事件处理函数存储在元素上,以便在unmounted时移除
+    el._chineseInputHandlers = {
+      input: handleInput,
+      keydown: handleKeydown
+    };
+  },
+
+  unmounted(el) {
+    const input = el.tagName === 'INPUT' ? el : el.querySelector('input');
+    if (!input || !el._chineseInputHandlers) return;
+
+    // 移除事件监听
+    input.removeEventListener('input', el._chineseInputHandlers.input);
+    input.removeEventListener('keydown', el._chineseInputHandlers.keydown);
+    // 删除存储的处理函数
+    delete el._chineseInputHandlers;
+  }
+};
+
+/**
+ * 注册全局指令
+ * @param {Vue} Vue - Vue实例
+ */
+export function installChineseInputDirective(Vue) {
+  Vue.directive('chinese-limit', ChineseInputDirective);
+}
+
+/**
+ * 创建中文输入限制的验证规则
+ * @returns {Object} 验证规则对象
+ */
+export function createChineseValidateRule() {
+  return {
+    pattern: /^[^\u4e00-\u9fa5]*$/,
+    message: "该字段不能包含中文",
+    trigger: "change"
+  };
+}

+ 298 - 0
ygtx-ui/src/views/gxt/faultCodes/index.vue

@@ -0,0 +1,298 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="故障代码" prop="faultCode">
+        <el-input
+          v-model="queryParams.faultCode"
+          placeholder="请输入故障代码"
+          clearable
+          @keyup.enter="handleQuery"
+          style="width: 200px"
+        />
+      </el-form-item>
+      <el-form-item label="启用状态" prop="isActive">
+        <el-select
+            v-model="queryParams.isActive"
+            placeholder="启用状态"
+            clearable
+            style="width: 200px"
+        >
+          <el-option
+              v-for="dict in sys_normal_disable"
+              :key="dict.value"
+              :label="dict.label"
+              :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="Plus"
+          @click="handleAdd"
+          v-hasPermi="['gxt:faultCodes:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="Edit"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['gxt:faultCodes:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="Delete"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['gxt:faultCodes:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="Download"
+          @click="handleExport"
+          v-hasPermi="['gxt:faultCodes:export']"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="faultCodesList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="故障代码" align="center" prop="faultCode" />
+      <el-table-column label="故障描述" align="center" prop="faultDescription" />
+      <el-table-column label="启用状态" align="center" prop="isActive">
+        <template #default="scope">
+          <dict-tag :options="sys_normal_disable" :value="scope.row.isActive"/>
+        </template>
+      </el-table-column>
+<!--      <el-table-column label="备注" align="center" prop="remark" />-->
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template #default="scope">
+          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['gxt:faultCodes:edit']">修改</el-button>
+          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['gxt:faultCodes:remove']">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改故障代码管理对话框 -->
+    <el-dialog :title="title" v-model="open" width="700px" append-to-body>
+      <el-form ref="faultCodesRef" :model="form" :rules="rules" label-width="120px">
+        <el-row :gutter="20">
+          <el-col :span="12">
+            <el-form-item label="故障代码" prop="faultCode">
+              <el-input v-model="form.faultCode" placeholder="请输入故障代码" maxlength="50" show-word-limit v-chinese-limit/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="启用状态" prop="isActive">
+              <el-radio-group v-model="form.isActive">
+                <el-radio
+                  v-for="dict in sys_normal_disable"
+                  :key="dict.value"
+                  :value="parseInt(dict.value)"
+                >
+                  {{ dict.label }}
+                </el-radio>
+              </el-radio-group>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="24">
+            <el-form-item label="故障描述" prop="faultDescription">
+              <el-input v-model="form.faultDescription" type="textarea" placeholder="请输入内容" :rows="4" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="20">
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remark">
+              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" :rows="4" maxlength="500" show-word-limit/>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </div>
+</template>
+
+<script setup name="FaultCodes">
+import { listFaultCodes, getFaultCodes, delFaultCodes, addFaultCodes, updateFaultCodes } from "@/api/gxt/faultCodes"
+
+const { proxy } = getCurrentInstance()
+
+// 定义字典
+const { sys_normal_disable } = proxy.useDict("sys_normal_disable" )
+
+const faultCodesList = ref([])
+const open = ref(false)
+const loading = ref(true)
+const showSearch = ref(true)
+const ids = ref([])
+const single = ref(true)
+const multiple = ref(true)
+const total = ref(0)
+const title = ref("")
+
+const data = reactive({
+  form: {},
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    faultCode: null,
+    faultDescription: null,
+    isActive: null,
+  },
+  rules: {
+    faultCode: [
+      { required: true, message: "故障代码不能为空", trigger: "blur" }
+    ],
+    faultDescription: [
+      { required: true, message: "故障描述不能为空", trigger: "blur" }
+    ],
+  }
+})
+
+const { queryParams, form, rules } = toRefs(data)
+
+/** 查询故障代码管理列表 */
+function getList() {
+  loading.value = true
+  listFaultCodes(queryParams.value).then(response => {
+    faultCodesList.value = response.rows
+    total.value = response.total
+    loading.value = false
+  })
+}
+
+// 取消按钮
+function cancel() {
+  open.value = false
+  reset()
+}
+
+// 表单重置
+function reset() {
+  form.value = {
+    id: null,
+    faultCode: null,
+    faultDescription: null,
+    isActive: 0,
+    createBy: null,
+    createTime: null,
+    updateBy: null,
+    updateTime: null,
+    remark: null
+  }
+  proxy.resetForm("faultCodesRef")
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.pageNum = 1
+  getList()
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+  proxy.resetForm("queryRef")
+  handleQuery()
+}
+
+// 多选框选中数据
+function handleSelectionChange(selection) {
+  ids.value = selection.map(item => item.id)
+  single.value = selection.length != 1
+  multiple.value = !selection.length
+}
+
+/** 新增按钮操作 */
+function handleAdd() {
+  reset()
+  open.value = true
+  title.value = "添加故障代码"
+}
+
+/** 修改按钮操作 */
+function handleUpdate(row) {
+  reset()
+  const _id = row.id || ids.value
+  getFaultCodes(_id).then(response => {
+    form.value = response.data
+    open.value = true
+    title.value = "修改故障代码"
+  })
+}
+
+/** 提交按钮 */
+function submitForm() {
+  proxy.$refs["faultCodesRef"].validate(valid => {
+    if (valid) {
+      if (form.value.id != null) {
+        updateFaultCodes(form.value).then(response => {
+          proxy.$modal.msgSuccess("修改成功")
+          open.value = false
+          getList()
+        })
+      } else {
+        addFaultCodes(form.value).then(response => {
+          proxy.$modal.msgSuccess("新增成功")
+          open.value = false
+          getList()
+        })
+      }
+    }
+  })
+}
+
+/** 删除按钮操作 */
+function handleDelete(row) {
+  const _ids = row.id || ids.value
+  proxy.$modal.confirm('是否确认删除故障代码编号为"' + _ids + '"的数据项?').then(function() {
+    return delFaultCodes(_ids)
+  }).then(() => {
+    getList()
+    proxy.$modal.msgSuccess("删除成功")
+  }).catch(() => {})
+}
+
+/** 导出按钮操作 */
+function handleExport() {
+  proxy.download('gxt/faultCodes/export', {
+    ...queryParams.value
+  }, `faultCodes_${new Date().getTime()}.xlsx`)
+}
+
+getList()
+</script>

+ 2 - 2
ygtx-ui/src/views/system/message/index.vue

@@ -22,7 +22,7 @@
         </el-select>
       </el-form-item>
 
-      <el-form-item label="接收人" prop="recipientNick">
+<!--      <el-form-item label="接收人" prop="recipientNick">
         <el-input
             v-model="queryParams.recipientNick"
             placeholder="请输入接收人"
@@ -30,7 +30,7 @@
             style="width: 200px"
             @keyup.enter="handleQuery"
         />
-      </el-form-item>
+      </el-form-item>-->
 
       <el-form-item label="状态" prop="status">
         <el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 200px">