Explorar el Código

添加MIS信息查询、工单编码修改

HD_wangm hace 5 meses
padre
commit
69f6f5ca52

+ 7 - 2
ygtx-common/src/main/java/com/ygtx/common/enums/DataSourceType.java

@@ -15,5 +15,10 @@ public enum DataSourceType
     /**
      * 从库
      */
-    SLAVE
-}
+    SLAVE,
+
+    /**
+     * 源数据库
+     */
+    SOURCE
+}

+ 6 - 2
ygtx-framework/src/main/java/com/ygtx/framework/config/DruidConfig.java

@@ -9,6 +9,8 @@ import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.sql.DataSource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.web.servlet.FilterRegistrationBean;
@@ -51,11 +53,13 @@ public class DruidConfig
 
     @Bean(name = "dynamicDataSource")
     @Primary
-    public DynamicDataSource dataSource(DataSource masterDataSource)
+    public DynamicDataSource dataSource(DataSource masterDataSource,
+                                       @Qualifier("sourceDataSource") DataSource sourceDataSource)
     {
         Map<Object, Object> targetDataSources = new HashMap<>();
         targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
         setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
+        targetDataSources.put(DataSourceType.SOURCE.name(), sourceDataSource);
         return new DynamicDataSource(masterDataSource, targetDataSources);
     }
     
@@ -123,4 +127,4 @@ public class DruidConfig
         registrationBean.addUrlPatterns(commonJsPattern);
         return registrationBean;
     }
-}
+}

+ 4 - 0
ygtx-framework/src/main/java/com/ygtx/framework/config/MyBatisConfig.java

@@ -9,10 +9,12 @@ import javax.sql.DataSource;
 import org.apache.ibatis.io.VFS;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.annotation.MapperScan;
 import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
 import org.springframework.core.env.Environment;
 import org.springframework.core.io.DefaultResourceLoader;
 import org.springframework.core.io.Resource;
@@ -30,6 +32,7 @@ import com.ygtx.common.utils.StringUtils;
  * @author ruoyi
  */
 @Configuration
+@MapperScan(basePackages = "com.ygtx.**.mapper", sqlSessionFactoryRef = "sqlSessionFactory")
 public class MyBatisConfig
 {
     @Autowired
@@ -114,6 +117,7 @@ public class MyBatisConfig
     }
 
     @Bean
+    @Primary
     public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception
     {
         String typeAliasesPackage = env.getProperty("mybatis.typeAliasesPackage");

+ 18 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/conf/SourceDataSourceConfig.java

@@ -1,9 +1,13 @@
 package com.ygtx.gxt.conf;
 
 import com.alibaba.druid.pool.DruidDataSource;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
 
 import javax.sql.DataSource;
 
@@ -12,6 +16,10 @@ import javax.sql.DataSource;
  * 用于设备同步任务从其他数据库获取数据
  */
 @Configuration
+@MapperScan(
+    basePackages = "com.ygtx.gxt.mapper.source",
+    sqlSessionFactoryRef = "sourceSqlSessionFactory"
+)
 public class SourceDataSourceConfig {
 
     /**
@@ -24,4 +32,14 @@ public class SourceDataSourceConfig {
     public DataSource sourceDataSource() {
         return new DruidDataSource();
     }
+
+    @Bean
+    public SqlSessionFactory sourceSqlSessionFactory() throws Exception {
+        SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
+        sessionFactory.setDataSource(sourceDataSource());
+        // 可以设置单独的mapper.xml路径
+        sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
+                .getResources("classpath:mapper/gxt/source/*.xml"));
+        return sessionFactory.getObject();
+    }
 }

+ 60 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtMisInfoController.java

@@ -0,0 +1,60 @@
+package com.ygtx.gxt.controller;
+
+import com.ygtx.common.annotation.Log;
+import com.ygtx.common.core.controller.BaseController;
+import com.ygtx.common.core.domain.AjaxResult;
+import com.ygtx.common.core.page.TableDataInfo;
+import com.ygtx.common.enums.BusinessType;
+import com.ygtx.common.utils.poi.ExcelUtil;
+import com.ygtx.gxt.domain.GxtWorkOrder;
+import com.ygtx.gxt.domain.GxtWorkOrderAttachment;
+import com.ygtx.gxt.domain.GxtWorkOrderFlow;
+import com.ygtx.gxt.domain.GxtMisInfo;
+import com.ygtx.gxt.service.IGxtMisInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 维保工单Controller
+ *
+ * @author ygtx
+ * @date 2025-10-25
+ */
+@RestController
+@RequestMapping("/gxt/misInfo")
+public class GxtMisInfoController extends BaseController
+{
+    @Autowired
+    private IGxtMisInfoService misInfoService;
+
+    /**
+     * 查询维保工单列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(GxtMisInfo misInfo)
+    {
+        startPage();
+        List<GxtMisInfo> list = misInfoService.selectGxtMisInfoList(misInfo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 测试数据源连接
+     */
+    @GetMapping("/testConnection")
+    public AjaxResult testConnection()
+    {
+        try {
+            List<GxtMisInfo> list = misInfoService.selectGxtMisInfoList(new GxtMisInfo());
+            return success("数据源连接正常,查询到 " + list.size() + " 条记录");
+        } catch (Exception e) {
+            return error("数据源连接异常: " + e.getMessage());
+        }
+    }
+
+}

+ 154 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtMisInfo.java

@@ -0,0 +1,154 @@
+package com.ygtx.gxt.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ygtx.common.core.domain.BaseEntity;
+
+import java.util.Date;
+
+public class GxtMisInfo extends BaseEntity {
+    private String misNo;
+
+    /** 风电场 */
+    private String pcsStationName;
+
+    /** 风机编号 */
+    private String pcsDeviceName;
+
+    /** 风机品牌 */
+    private String brand;
+
+    /** 风机型号 */
+    private String model;
+
+    /** 计划开始日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private Date planStartTime;
+
+    /** 计划结束日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private Date planEndTime;
+
+    /** 实际开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private Date realStartTime;
+
+    /** 实际结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    private Date realEndTime;
+
+    /** 维保内容 */
+    private String content;
+
+    /** 签发人 */
+    private String issuerName;
+
+    /** 许可人 */
+    private String permitterName;
+
+    /** 工单状态:draft-草稿,to_assign-待派单,assigned-已派单,accepted-已接单,processing-处理中,paused-暂停中,to_approve-待审批,suspended-已挂起,completed-已完成 */
+    private String workOrderStatus;
+
+    public String getMisNo() {
+        return misNo;
+    }
+
+    public void setMisNo(String misNo) {
+        this.misNo = misNo;
+    }
+
+    public String getPcsStationName() {
+        return pcsStationName;
+    }
+
+    public void setPcsStationName(String pcsStationName) {
+        this.pcsStationName = pcsStationName;
+    }
+
+    public String getBrand() {
+        return brand;
+    }
+
+    public void setBrand(String brand) {
+        this.brand = brand;
+    }
+
+    public String getModel() {
+        return model;
+    }
+
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    public Date getPlanStartTime() {
+        return planStartTime;
+    }
+
+    public void setPlanStartTime(Date planStartTime) {
+        this.planStartTime = planStartTime;
+    }
+
+    public Date getPlanEndTime() {
+        return planEndTime;
+    }
+
+    public void setPlanEndTime(Date planEndTime) {
+        this.planEndTime = planEndTime;
+    }
+
+    public Date getRealStartTime() {
+        return realStartTime;
+    }
+
+    public void setRealStartTime(Date realStartTime) {
+        this.realStartTime = realStartTime;
+    }
+
+    public Date getRealEndTime() {
+        return realEndTime;
+    }
+
+    public void setRealEndTime(Date realEndTime) {
+        this.realEndTime = realEndTime;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getIssuerName() {
+        return issuerName;
+    }
+
+    public void setIssuerName(String issuerName) {
+        this.issuerName = issuerName;
+    }
+
+    public String getPermitterName() {
+        return permitterName;
+    }
+
+    public void setPermitterName(String permitterName) {
+        this.permitterName = permitterName;
+    }
+
+    public String getWorkOrderStatus() {
+        return workOrderStatus;
+    }
+
+    public void setWorkOrderStatus(String workOrderStatus) {
+        this.workOrderStatus = workOrderStatus;
+    }
+
+    public String getPcsDeviceName() {
+        return pcsDeviceName;
+    }
+
+    public void setPcsDeviceName(String pcsDeviceName) {
+        this.pcsDeviceName = pcsDeviceName;
+    }
+}

+ 12 - 12
ygtx-gxt/src/main/java/com/ygtx/gxt/domain/GxtWorkOrder.java

@@ -72,12 +72,12 @@ public class GxtWorkOrder extends BaseEntity
     private String misNo;
 
     /** 计划开始日期 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
 //    @Excel(name = "计划开始日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date planStartTime;
 
     /** 计划结束日期 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
 //    @Excel(name = "计划结束日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date planEndTime;
 
@@ -86,7 +86,7 @@ public class GxtWorkOrder extends BaseEntity
     private String orderSource;
 
     /** 派单时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
 //    @Excel(name = "派单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date assignTime;
 
@@ -98,7 +98,7 @@ public class GxtWorkOrder extends BaseEntity
     private String assignUserName;
 
     /** 接单时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
 //    @Excel(name = "接单时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date acceptTime;
 
@@ -110,13 +110,13 @@ public class GxtWorkOrder extends BaseEntity
     private String acceptUserName;
 
     /** 实际开始时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
     private Date realStartTime;
 
     /** 实际结束时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
     private Date realEndTime;
 
     /** 班组组长ID */
@@ -137,7 +137,7 @@ public class GxtWorkOrder extends BaseEntity
     private String suspendReason;
 
     /** 挂起时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
     private Date suspendTime;
 
     /** 挂起前的状态 */
@@ -150,15 +150,15 @@ public class GxtWorkOrder extends BaseEntity
     private String pauseReason;
 
     /** 暂停时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
     private Date pauseTime;
 
     /** 重启时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
     private Date restartTime;
 
     /** 完成时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
 //    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date completeTime;
 

+ 19 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/mapper/source/GxtMisInfoMapper.java

@@ -0,0 +1,19 @@
+package com.ygtx.gxt.mapper.source;
+
+import com.ygtx.common.annotation.DataSource;
+import com.ygtx.common.enums.DataSourceType;
+import com.ygtx.gxt.domain.GxtMisInfo;
+
+import java.util.List;
+
+@DataSource(DataSourceType.SOURCE)
+public interface GxtMisInfoMapper {
+    /**
+     * 查询MIS信息列表
+     *
+     * @param misInfo MIS信息
+     * @return MIS信息集合
+     */
+    public List<GxtMisInfo> selectGxtMisInfoList(GxtMisInfo misInfo);
+
+}

+ 25 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/IGxtMisInfoService.java

@@ -0,0 +1,25 @@
+package com.ygtx.gxt.service;
+
+import com.ygtx.gxt.domain.GxtMisInfo;
+import com.ygtx.gxt.domain.GxtWorkOrder;
+import com.ygtx.gxt.domain.GxtWorkOrderAttachment;
+import com.ygtx.gxt.domain.GxtWorkOrderFlow;
+
+import java.util.List;
+
+/**
+ * 维保工单Service接口
+ *
+ * @author ygtx
+ * @date 2025-10-25
+ */
+public interface IGxtMisInfoService {
+    /**
+     * 查询维保工单列表
+     *
+     * @param misInfo 维保工单
+     * @return 维保工单集合
+     */
+    public List<GxtMisInfo> selectGxtMisInfoList(GxtMisInfo misInfo);
+
+}

+ 46 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtMisNoServiceImpl.java

@@ -0,0 +1,46 @@
+package com.ygtx.gxt.service.impl;
+
+import com.ygtx.gxt.domain.*;
+import com.ygtx.gxt.mapper.GxtWorkOrderAttachmentMapper;
+import com.ygtx.gxt.mapper.GxtWorkOrderFlowMapper;
+import com.ygtx.gxt.mapper.GxtWorkOrderMapper;
+import com.ygtx.gxt.mapper.GxtWorkOrderPersonMapper;
+import com.ygtx.gxt.mapper.source.GxtMisInfoMapper;
+import com.ygtx.gxt.service.IGxtMisInfoService;
+import com.ygtx.system.mapper.SysDeptMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ygtx.common.annotation.DataSource;
+import com.ygtx.common.enums.DataSourceType;
+
+import java.util.List;
+
+/**
+ * 维保工单Service业务层处理
+ *
+ * @author ygtx
+ * @date 2025-10-25
+ */
+@Service
+public class GxtMisNoServiceImpl implements IGxtMisInfoService
+{
+    private static final Logger logger = LoggerFactory.getLogger(GxtMisNoServiceImpl.class);
+    @Autowired
+    private GxtMisInfoMapper misInfoMapper;
+
+    /**
+     * 查询维保工单列表
+     *
+     * @param misInfo 维保工单
+     * @return 维保工单
+     */
+    @Override
+    public List<GxtMisInfo> selectGxtMisInfoList(GxtMisInfo misInfo)
+    {
+        return misInfoMapper.selectGxtMisInfoList(misInfo);
+    }
+
+
+}

+ 52 - 2
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtWorkOrderServiceImpl.java

@@ -113,15 +113,37 @@ public class GxtWorkOrderServiceImpl implements IGxtWorkOrderService
         {
             gxtWorkOrder.setWorkOrderStatus("draft");
         }
+        SysDept dept = deptMapper.selectDeptByDeptName(gxtWorkOrder.getPcsStationName());
+        if (dept != null) {
+            gxtWorkOrder.setPcsStationId(dept.getDeptId());
+            // 设备场站
+            if ("4".equals(dept.getLevel())) {
+                SysDept pDept = deptMapper.selectDeptById(dept.getParentId());
+                gxtWorkOrder.setGxtCenterId(pDept.getParentId());
+                gxtWorkOrder.setGxtCenter(pDept.getParentName());
+                gxtWorkOrder.setPcsStationPid(pDept.getDeptId());
+            } else if ("3".equals(dept.getLevel())) {
+//                        SysDept pDept = deptMapper.selectDeptById(dept.getDeptId());
+                gxtWorkOrder.setGxtCenterId(dept.getParentId());
+                gxtWorkOrder.setGxtCenter(dept.getParentName());
+                gxtWorkOrder.setPcsStationPid(dept.getDeptId());
+            }
+        }
 
         gxtWorkOrder.setCreateTime(DateUtils.getNowDate());
         int result = gxtWorkOrderMapper.insertGxtWorkOrder(gxtWorkOrder);
+        String actionType = null;
+        if ("draft".equals(gxtWorkOrder.getWorkOrderStatus())) {
+            actionType = "create";
+        } else {
+            actionType = "assign";
+        }
 
         // 记录创建流转
         if (result > 0)
         {
             recordWorkOrderFlow(gxtWorkOrder.getId(), gxtWorkOrder.getWorkOrderProjectNo(),
-                    "create", null, gxtWorkOrder.getWorkOrderStatus(), "创建工单");
+                    actionType, null, gxtWorkOrder.getWorkOrderStatus(), null);
         }
 
         return result;
@@ -142,9 +164,37 @@ public class GxtWorkOrderServiceImpl implements IGxtWorkOrderService
         {
             throw new ServiceException("工单编码已存在");
         }
+        SysDept dept = deptMapper.selectDeptByDeptName(gxtWorkOrder.getPcsStationName());
+        if (dept != null) {
+            gxtWorkOrder.setPcsStationId(dept.getDeptId());
+            // 设备场站
+            if ("4".equals(dept.getLevel())) {
+                SysDept pDept = deptMapper.selectDeptById(dept.getParentId());
+                gxtWorkOrder.setGxtCenterId(pDept.getParentId());
+                gxtWorkOrder.setGxtCenter(pDept.getParentName());
+                gxtWorkOrder.setPcsStationPid(pDept.getDeptId());
+            } else if ("3".equals(dept.getLevel())) {
+                gxtWorkOrder.setGxtCenterId(dept.getParentId());
+                gxtWorkOrder.setGxtCenter(dept.getParentName());
+                gxtWorkOrder.setPcsStationPid(dept.getDeptId());
+            }
+        }
 
         gxtWorkOrder.setUpdateTime(DateUtils.getNowDate());
-        return gxtWorkOrderMapper.updateGxtWorkOrder(gxtWorkOrder);
+        int result = gxtWorkOrderMapper.updateGxtWorkOrder(gxtWorkOrder);
+        String actionType = null;
+        if ("draft".equals(gxtWorkOrder.getWorkOrderStatus())) {
+            actionType = "create";
+        } else {
+            actionType = "assign";
+        }
+        // 记录创建流转
+        if (result > 0)
+        {
+            recordWorkOrderFlow(gxtWorkOrder.getId(), gxtWorkOrder.getWorkOrderProjectNo(),
+                    actionType, null, gxtWorkOrder.getWorkOrderStatus(), null);
+        }
+        return result;
     }
 
     /**

+ 1 - 1
ygtx-gxt/src/main/java/com/ygtx/gxt/task/GxtWorkOrderScheduledTask.java

@@ -33,7 +33,7 @@ public class GxtWorkOrderScheduledTask
      * 执行频率:每天凌晨2点执行一次
      */
 //    @Scheduled(cron = "0 0 2 * * *")
-    @Scheduled(cron = "*/30 * * * * *")
+//    @Scheduled(cron = "*/30 * * * * *")
     @Transactional
     public void archiveExpiredWorkOrders()
     {

+ 46 - 0
ygtx-gxt/src/main/resources/mapper/gxt/source/GxtMisInfoMapper.xml

@@ -0,0 +1,46 @@
+<?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.source.GxtMisInfoMapper">
+
+    <resultMap type="com.ygtx.gxt.domain.GxtMisInfo" id="GxtMisInfoResult">
+        <result property="misNo"    column="work_order_project_no"    />
+        <result property="workOrderStatus"    column="work_order_status"    />
+        <result property="pcsStationName"    column="pcs_station_name"    />
+        <result property="pcsDeviceName"    column="pcs_device_name"    />
+        <result property="planStartTime"    column="plan_start_time"    />
+        <result property="planEndTime"    column="plan_end_time"    />
+        <result property="realStartTime"    column="real_start_time"    />
+        <result property="realEndTime"    column="real_end_time"    />
+        <result property="content"    column="work_content"    />
+        <result property="issuerName"    column="issuer_name"    />
+        <result property="permitterName"    column="permitter_name"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectGxtMisInfoVo">
+        select work_order_project_no, work_order_status, pcs_station_name,
+               pcs_device_name, plan_start_time, plan_end_time, real_start_time, real_end_time,
+               work_content, issuer_name,permitter_name, create_time, update_time, remark
+        from fujian_wo_workorder_info t
+    </sql>
+
+    <select id="selectGxtMisInfoList" parameterType="com.ygtx.gxt.domain.GxtMisInfo" resultMap="GxtMisInfoResult">
+        <include refid="selectGxtMisInfoVo"/>
+        <where>
+            <if test="misNo != null  and misNo != ''"> and work_order_project_no like concat('%', #{misNo}, '%')</if>
+            <if test="pcsStationName != null  and pcsStationName != ''"> and pcs_station_name = #{pcsStationName}</if>
+            <if test="pcsDeviceName != null  and pcsDeviceName != ''"> and pcs_device_name = #{pcsDeviceName}</if>
+            <if test="workOrderStatus != null  and workOrderStatus != ''"> and work_order_status in
+                <foreach collection="workOrderStatus.split(',')" item="status" open="(" separator="," close=")">
+                    #{status}
+                </foreach>
+            </if>
+        </where>
+        order by create_time desc
+    </select>
+
+</mapper>

+ 93 - 0
ygtx-ui/src/api/gxt/misInfo.js

@@ -0,0 +1,93 @@
+import request from '@/utils/request'
+
+// 查询设备管理列表
+export function listMisInfo(query) {
+  return request({
+    url: '/gxt/misInfo/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询所有品牌列表(去重)
+export function listBrands() {
+  return request({
+    url: '/gxt/equipment/brands',
+    method: 'get'
+  })
+}
+
+// 根据品牌查询机型列表(去重)
+export function listModelsByBrand(brand) {
+  return request({
+    url: '/gxt/equipment/models/' + brand,
+    method: 'get'
+  })
+}
+
+// 查询设备管理详细
+export function getEquipment(equipmentId) {
+  return request({
+    url: '/gxt/equipment/' + equipmentId,
+    method: 'get'
+  })
+}
+
+// 新增设备管理
+export function addEquipment(data) {
+  return request({
+    url: '/gxt/equipment',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改设备管理
+export function updateEquipment(data) {
+  return request({
+    url: '/gxt/equipment',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除设备管理
+export function delEquipment(equipmentId) {
+  return request({
+    url: '/gxt/equipment/' + equipmentId,
+    method: 'delete'
+  })
+}
+
+// 查询所有维保中心列表(去重)
+export function listMaintenanceCenters() {
+  return request({
+    url: '/gxt/equipment/maintenanceCenters',
+    method: 'get'
+  })
+}
+
+// 根据维保中心查询场站列表(去重)
+export function listStationsByMaintenanceCenter(maintenanceCenter) {
+  return request({
+    url: '/gxt/equipment/stations/' + maintenanceCenter,
+    method: 'get'
+  })
+}
+
+// 查询所有机型列表(去重)
+export function listAllModels() {
+  return request({
+    url: '/gxt/equipment/models',
+    method: 'get'
+  })
+}
+
+// 导入设备管理数据
+export function importEquipment(data) {
+  return request({
+    url: '/gxt/equipment/importData',
+    method: 'post',
+    data: data
+  })
+}

+ 202 - 0
ygtx-ui/src/components/misInfoSelect/single.vue

@@ -0,0 +1,202 @@
+<template>
+  <el-dialog title="MIS系统编码选择"
+    v-model="showFlag"
+    :modal= false
+    width="80%"
+    center
+  >
+    <el-row :gutter="20">
+      <!--设备数据-->
+      <el-col :span="24" :xs="24">
+        <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
+          <el-form-item label="MIS系统编码" prop="misNo">
+            <el-input
+                v-model="queryParams.misNo"
+                placeholder="请输入MIS系统编码"
+                clearable
+                style="width: 240px"
+                @keyup.enter="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="风机编号" prop="pcsDeviceName">
+            <el-input
+              v-model="queryParams.pcsDeviceName"
+              placeholder="请输入风机编号"
+              clearable
+              style="width: 240px"
+              @keyup.enter="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item label="场站" prop="pcsStationName">
+            <el-input
+              v-model="queryParams.pcsStationName"
+              placeholder="请输入场站"
+              clearable
+              style="width: 240px"
+              @keyup.enter="handleQuery"
+            />
+          </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-table v-loading="loading" :data="misNoList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick" ref="tableRef">
+            <el-table-column  width="55" align="center" >
+                <template #default="scope">
+                    <el-radio v-model="selectedId" :label="scope.row.equipmentId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
+                </template>
+            </el-table-column>
+          <el-table-column label="MIS系统编码" align="center" key="misNo" prop="misNo" :show-overflow-tooltip="true" />
+          <el-table-column label="风机编号" align="center" key="pcsDeviceName" prop="pcsDeviceName" :show-overflow-tooltip="true" />
+          <el-table-column label="场站" align="center" key="pcsStationName" prop="pcsStationName" :show-overflow-tooltip="true" />
+          <el-table-column label="维修内容" align="center" key="content" prop="content" :show-overflow-tooltip="true" />
+          <el-table-column label="状态" align="center" key="workOrderStatus" prop="workOrderStatus" :show-overflow-tooltip="true" />
+        </el-table>
+
+        <pagination
+          v-show="total>0"
+          :total="total"
+          v-model:page="queryParams.pageNum"
+          v-model:limit="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </el-col>
+    </el-row>
+    <template #footer>
+        <div class="dialog-footer">
+            <el-button type="primary" @click="confirmSelect">确 定</el-button>
+            <el-button @click="handleCancel">取 消</el-button>
+        </div>
+    </template>
+  </el-dialog>
+</template>
+
+<script setup>
+import { ref, reactive, getCurrentInstance, watch, onMounted, nextTick } from 'vue'
+import { listMisInfo } from "@/api/gxt/misInfo.js";
+
+// 定义v-model
+const props = defineProps({
+  modelValue: {
+    type: Boolean,
+    default: false
+  }
+})
+
+const emit = defineEmits(['update:modelValue', 'onSelected'])
+
+// 获取组件实例
+const { proxy } = getCurrentInstance()
+
+// 定义变量
+const showFlag = ref(false)
+const loading = ref(true)
+const selectedId = ref(null)
+const selectedRow = ref(null)
+const single = ref(true)
+const multiple = ref(true)
+const showSearch = ref(true)
+const total = ref(0)
+const misNoList = ref([])
+const title = ref("")
+const queryRef = ref(null)
+const tableRef = ref(null)
+
+// 监听modelValue变化
+watch(() => props.modelValue, (newVal) => {
+  showFlag.value = newVal
+  // 无论对话框打开还是关闭,都重置选择
+  selectedId.value = null
+  selectedRow.value = null
+})
+
+// 监听showFlag变化
+watch(showFlag, (newVal) => {
+  emit('update:modelValue', newVal)
+  // 无论对话框打开还是关闭,都重置选择
+  selectedId.value = null
+  selectedRow.value = null
+})
+
+// 查询参数
+const queryParams = reactive({
+  pageNum: 1,
+  pageSize: 10,
+  misNo: undefined,
+  pcsDeviceName: undefined,
+  pcsStationName: undefined,
+  workOrderStatus: "编辑,作业中"
+})
+
+// 组件挂载时查询数据
+onMounted(() => {
+  getList();
+})
+
+/** 查询设备列表 */
+function getList() {
+  loading.value = true;
+  listMisInfo(queryParams).then(response => {
+      misNoList.value = response.rows;
+      total.value = response.total;
+      loading.value = false;
+    }
+  );
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+
+function handleCurrent(row){
+    if(row){
+        selectedRow.value = row;
+    }
+}
+
+//行双击选中
+function handleRowDbClick(row){
+  if(row){
+    selectedRow.value = row;
+    emit('onSelected', selectedRow.value);
+    showFlag.value = false;
+  }
+}
+
+// 单选选中数据
+function handleRowChange(row) {
+  if(row){
+    selectedRow.value = row;
+  }
+}
+
+//确定选中
+function confirmSelect(){
+    if(selectedId.value == null || selectedId.value == 0){
+        proxy.$notify({
+            title:'提示',
+            type:'warning',
+            message: '请至少选择一条数据!'
+        });
+        return;
+    }
+    emit('onSelected', selectedRow.value);
+    showFlag.value = false;
+}
+
+// 取消按钮
+function handleCancel() {
+  selectedId.value = null
+  selectedRow.value = null
+  showFlag.value = false
+}
+</script>

+ 187 - 106
ygtx-ui/src/views/gxt/gxtOrder/index.vue

@@ -103,28 +103,37 @@
       </el-col> -->
       <el-col :span="1.5">
         <el-button
-          type="info"
-          icon="Upload"
-          @click="handleImport('order')"
-          v-hasPermi="['gxt:maintenance:order:import']"
-        >工单导入</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-            type="info"
-            icon="Upload"
-            @click="handleImport('person')"
-            v-hasPermi="['gxt:maintenance:order:import']"
-        >工单人员导入</el-button>
+            type="primary"
+            plain
+            icon="Plus"
+            @click="handleAdd"
+            v-hasPermi="['gxt:maintenance:order:add']"
+        >新建工单</el-button>
       </el-col>
 <!--      <el-col :span="1.5">-->
 <!--        <el-button-->
-<!--          type="warning"-->
-<!--          icon="Download"-->
-<!--          @click="handleExport"-->
-<!--          v-hasPermi="['gxt:maintenance:order:export']"-->
-<!--        >导出</el-button>-->
+<!--          type="info"-->
+<!--          icon="Upload"-->
+<!--          @click="handleImport('order')"-->
+<!--          v-hasPermi="['gxt:maintenance:order:import']"-->
+<!--        >工单导入</el-button>-->
 <!--      </el-col>-->
+<!--      <el-col :span="1.5">-->
+<!--        <el-button-->
+<!--            type="info"-->
+<!--            icon="Upload"-->
+<!--            @click="handleImport('person')"-->
+<!--            v-hasPermi="['gxt:maintenance:order:import']"-->
+<!--        >工单人员导入</el-button>-->
+<!--      </el-col>-->
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="Download"
+          @click="handleExport"
+          v-hasPermi="['gxt:maintenance:order:export']"
+        >导出</el-button>
+      </el-col>
       <!-- <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> -->
     </el-row>
 
@@ -204,6 +213,13 @@
       </el-table-column>
       <el-table-column label="操作" align="center" min-width="200" class-name="small-padding fixed-width" fixed="right" >
         <template #default="scope">
+          <el-button
+              v-if="scope.row.workOrderStatus === 'draft'"
+              type="primary"
+              link
+              @click="handleUpdate(scope.row)"
+              v-hasPermi="['gxt:maintenance:order:edit']"
+          ><i class="fa fa-edit"></i>编辑</el-button>
           <!-- 已派单状态:只显示确认按钮 -->
           <el-button link type="success" @click="handleAccept(scope.row)" v-if="scope.row.workOrderStatus === 'assigned'" v-hasPermi="['gxt:maintenance:order:accept']">
             <i class="fa fa-check"></i>接单
@@ -225,7 +241,7 @@
 
           <!-- 待结单状态:显示结单按钮 -->
           <el-button link type="success" @click="handleFinish(scope.row)" v-if="scope.row.workOrderStatus === 'processing' || scope.row.workOrderStatus === 'to_finish'" v-hasPermi="['gxt:maintenance:order:complete']">
-            <i class="fa fa-check"></i>自评
+            <i class="fa fa-check"></i>结单
           </el-button>
 
           <!-- 已完成状态:显示评分按钮 -->
@@ -253,6 +269,93 @@
       v-model:limit="queryParams.pageSize"
       @pagination="getList"
     />
+
+    <!-- 新增对话框 -->
+    <el-dialog :title="title" v-model="open" width="800px" append-to-body>
+      <div style="max-height: 500px; overflow-y: auto; padding-right: 10px;">
+        <el-form ref="orderRef" :model="form" :rules="rules" label-width="120px" label-position="top">
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item label="工单编码" prop="workOrderProjectNo">
+                <el-input v-model="form.workOrderProjectNo" maxlength="50" show-word-limit v-chinese-limit/>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="MIS系统编码" prop="misNo">
+                <el-input v-model="form.misNo">
+                  <template #append>
+                    <el-button @click="handleSelectMisInfo" icon="Search"></el-button>
+                  </template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <!-- MIS选择组件 -->
+            <MisInfoSelectSingle v-model="misInfoSelectVisible" @onSelected="onMisInfoSelected"></MisInfoSelectSingle>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item label="风机编号" prop="pcsDeviceName">
+                <el-input v-model="form.pcsDeviceName" readonly />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="维保中心" prop="gxtCenter">
+                <el-input v-model="form.gxtCenter" readonly />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item label="场站" prop="pcsStationName">
+                <el-input v-model="form.pcsStationName" readonly />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="品牌" prop="brand">
+                <el-input v-model="form.brand" readonly />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :span="12">
+              <el-form-item label="机型" prop="model">
+                <el-input v-model="form.model" readonly />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row :gutter="20">
+            <el-col :span="24">
+              <el-form-item label="维保内容" prop="content">
+                <el-input v-model="form.content" type="textarea" placeholder="请输入维保内容" :rows="3" readonly />
+              </el-form-item>
+            </el-col>
+          </el-row>
+<!--          <el-row :gutter="20">-->
+<!--            <el-col :span="24">-->
+<!--              <el-form-item label="工作负责人" prop="teamLeaderId">-->
+<!--                <el-select v-model="acceptForm.teamLeaderId" placeholder="请选择工作负责人" style="width: 100%" @change="(userId) => acceptForm.teamLeaderName = userList.find(u => u.userId === userId)?.nickName">-->
+<!--                  <el-option-->
+<!--                      v-for="user in userList"-->
+<!--                      :key="user.userId"-->
+<!--                      :label="user.nickName"-->
+<!--                      :value="user.userId"-->
+<!--                  />-->
+<!--                </el-select>-->
+<!--              </el-form-item>-->
+<!--            </el-col>-->
+<!--          </el-row>-->
+        </el-form>
+      </div>
+      <template #footer>
+        <div class="dialog-footer">
+<!--          <el-button type="primary" @click="submitAccept">确 认</el-button>-->
+          <el-button @click="open  = false">取 消</el-button>
+          <el-button type="primary" @click="submitForm('draft')">保 存</el-button>
+          <el-button type="primary" @click="submitForm('assigned')">保存并下发</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
     <!-- 挂起对话框 -->
     <el-dialog title="申请挂起工单" v-model="suspendDialogVisible" width="800px" append-to-body>
       <el-form ref="suspendRef" :model="suspendForm" :rules="suspendRules" label-width="120px" label-position="top">
@@ -436,7 +539,7 @@
         </div>
         <h4 class="text-lg font-medium mb-2">确定要恢复工单吗?</h4>
         <p class="text-gray-500 mb-4">工单编号:{{ resumeForm.orderCode }}</p>
-        <p class="text-gray-500 text-sm">恢复后,工单状态将变为"待自评"</p>
+        <p class="text-gray-500 text-sm">恢复后,工单状态将变为"待结单"</p>
       </div>
       <template #footer>
         <div class="dialog-footer">
@@ -445,12 +548,12 @@
         </div>
       </template>
     </el-dialog>
-    <!-- 自评对话框 -->
-    <el-dialog title="自评" v-model="finishDialogVisible" width="800px" append-to-body>
+    <!-- 结单对话框 -->
+    <el-dialog title="结单" v-model="finishDialogVisible" width="800px" append-to-body>
       <div class="space-y-4">
         <el-alert type="info" :closable="false" style="border-color: #14b8a6; background-color: #f0fdfa; color: #0d9488; height: 35px;">
           <template #default>
-            <i class="fa fa-file-text-o mr-2" style="color: #0d9488;"> 请补充维保详情并上传相关附件完成自评。</i>
+            <i class="fa fa-file-text-o mr-2" style="color: #0d9488;"> 请补充维保详情并上传相关附件完成结单。</i>
           </template>
         </el-alert>
         <el-form ref="finishRef" :model="finishForm" :rules="finishRules" label-width="120px" label-position="top">
@@ -579,7 +682,7 @@
       <template #footer>
         <div class="dialog-footer">
           <el-button @click="finishDialogVisible = false">取 消</el-button>
-          <el-button type="primary" @click="submitFinish">确认自评</el-button>
+          <el-button type="primary" @click="submitFinish">确认结单</el-button>
         </div>
       </template>
     </el-dialog>
@@ -1153,7 +1256,7 @@
 
       <!-- 附件信息 -->
       <div class="info-section" v-if="detailData.attachmentUrls">
-        <h3 class="section-title">自评附件</h3>
+        <h3 class="section-title">结单附件</h3>
         <el-row>
           <el-col :span="24">
             <el-form-item label="附件">
@@ -1246,7 +1349,9 @@ import {
 import { listUser } from "@/api/system/user"
 import {getToken} from "@/utils/auth.js";
 import {getRepairOrder} from "@/api/gxt/repairOrder.js";
-import {listMaintenanceCenters, listStationsByMaintenanceCenter} from "@/api/gxt/equipment.js";
+import {listEquipment, listMaintenanceCenters, listStationsByMaintenanceCenter} from "@/api/gxt/equipment.js";
+import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
+import {genCode} from "@/api/system/autocode/rule.js";
 
 const { proxy } = getCurrentInstance()
 const {
@@ -1293,6 +1398,9 @@ const stationOptions = ref([])
 // 在 data 部分添加
 const fileUploadRef = ref(null)
 
+const tableHeight = ref(window.innerHeight - 300)
+const misInfoSelectVisible = ref(false)
+
 const upload = reactive({
   // 是否显示弹出层(设备导入)
   open: false,
@@ -1336,7 +1444,9 @@ const data = reactive({
   },
   rules: {
     workOrderProjectNo: [{ required: true, message: "工单编码不能为空", trigger: "blur" }],
-    workOrderStatus: [{ required: true, message: "工单状态不能为空", trigger: "change" }],
+    misNo: [{ required: true, message: "MIS编码不能为空", trigger: "blur" }],
+    pcsDeviceName: [{ required: true, message: "风机编号不能为空", trigger: "blur" }],
+    // workOrderStatus: [{ required: true, message: "工单状态不能为空", trigger: "change" }],
     gxtCenter: [{ required: true, message: "维保中心不能为空", trigger: "blur" }],
     pcsStationName: [{ required: true, message: "风电场不能为空", trigger: "blur" }]
   },
@@ -1603,6 +1713,10 @@ function handleSelectionChange(selection) {
 /** 新增按钮操作 */
 function handleAdd() {
   reset()
+  //生成工单编号
+  genCode('WORK_ORDER_CODE').then(response =>{
+    form.value.workOrderProjectNo = response;
+  });
   open.value = true
   title.value = "添加维保工单"
 }
@@ -1619,9 +1733,10 @@ function handleUpdate(row) {
 }
 
 /** 提交按钮 */
-function submitForm() {
+function submitForm(status) {
   proxy.$refs["orderRef"].validate(valid => {
     if (valid) {
+      form.value.workOrderStatus = status
       if (form.value.id != undefined) {
         updateGxtOrder(form.value).then(response => {
           proxy.$modal.msgSuccess("修改成功")
@@ -1701,50 +1816,6 @@ function submitFinish() {
   })
 }
 
-/** 上传附件 */
-function uploadAttachmentsFn(files, orderId) {
-  const formData = new FormData()
-  debugger
-  // 处理文件
-  let fileCount = 0
-  files.forEach((file) => {
-    // 需要处理两种情况:有file属性的新文件,或需要上传的文件
-    debugger
-    // if (file.file) {
-      // 新上传的文件
-    formData.append('files', file)
-    fileCount++
-    // } else if (file.rawFile) {
-    //   // 来自 FileUpload 组件的文件
-    //   formData.append('files', file.rawFile)
-    //   fileCount++
-    // }
-  })
-
-  if (fileCount === 0) {
-    // 如果没有需要上传的文件,直接保存工单
-    saveFinishWorkOrder()
-    return
-  }
-
-  // 显示加载提示
-  proxy.$modal.loading("上传中...")
-
-  // 调用上传接口,orderId 作为 URL 参数
-  uploadAttachments(orderId, formData).then(response => {
-    proxy.$modal.closeLoading()
-    if (response.code === 200 || response.code === 0) {
-      // 上传成功,保存工单
-      saveFinishWorkOrder()
-    } else {
-      proxy.$modal.msgError('附件上传失败' + (response.msg || '未知错误'))
-    }
-  }).catch(error => {
-    proxy.$modal.closeLoading()
-    proxy.$modal.msgError('附件上传失败:' + (error?.message || '未知错误'))
-  })
-}
-
 /** 保存结单工单 */
 function saveFinishWorkOrder() {
   finishForm.value.workOrderStatus = 'completed'
@@ -1753,10 +1824,10 @@ function saveFinishWorkOrder() {
     finishDialogVisible.value = false
     // 清空附件列表
     finishForm.value.attachmentUrls = undefined
-    proxy.$modal.msgSuccess("自评成功")
+    proxy.$modal.msgSuccess("结单成功")
     getList()
   }).catch(error => {
-    proxy.$modal.msgError("自评失败:" + (error?.response?.data?.msg || "未知错误"))
+    proxy.$modal.msgError("结单失败:" + (error?.response?.data?.msg || "未知错误"))
   })
 }
 
@@ -2078,33 +2149,6 @@ function isImageFile(fileName) {
   return imageExts.includes(ext)
 }
 
-/** 预览附件 */
-function previewAttachment(attachment) {
-  if (isImageFile(attachment.fileName)) {
-    // 创建预览窗口
-    const previewWindow = window.open()
-    previewWindow.document.write(`<img src="${attachment.filePath}" style="width: 100%; height: auto;"/>`)
-  }
-}
-
-/** 下载附件 */
-function downloadAttachment(attachment) {
-  // 创建临时链接下载
-  const link = document.createElement('a')
-  link.href = attachment.filePath
-  link.download = attachment.fileName
-  link.click()
-}
-
-/** 格式化文件大小 */
-function formatFileSize(bytes) {
-  if (bytes === 0) return '0 B'
-  const k = 1024
-  const sizes = ['B', 'KB', 'MB', 'GB']
-  const i = Math.floor(Math.log(bytes) / Math.log(k))
-  return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + ' ' + sizes[i]
-}
-
 /**文件上传中处理 */
 const handleFileUploadProgress = (event, file, fileList) => {
   upload.isUploading = true
@@ -2227,6 +2271,48 @@ function handleResize() {
   tableHeight.value = window.innerHeight - 300
 }
 
+/** 打开设备选择对话框 */
+function handleSelectMisInfo() {
+  misInfoSelectVisible.value = true
+}
+
+/** 设备选择回调 */
+function onMisInfoSelected(row) {
+  if (row) {
+    // 检查维保中心ID和场站ID是否存在
+    // if (!row.maintenanceCenterId) {
+    //   proxy.$modal.msgError("该设备的维保中心没有对应的部门,请完善部门信息后再更新设备数据!");
+    //   return;
+    // }
+    // if (!row.stationId) {
+    //   proxy.$modal.msgError("该设备的场站没有对应的部门,请完善部门信息后再更新设备数据!");
+    //   return;
+    // }
+    form.value.misNo = row.misNo
+    form.value.pcsDeviceName = row.pcsDeviceName
+    form.value.pcsStationName = row.pcsStationName
+    form.value.content = row.content
+    listEquipment({ station: row.pcsStationName, equipmentCode: row.pcsDeviceName }).then(response => {
+      const equipments = response.rows
+      debugger
+      if (equipments) {
+        form.value.pcsDeviceId = equipments[0].equipmentId
+        form.value.gxtCenter = equipments[0].maintenanceCenter
+        form.value.brand = equipments[0].brand
+        form.value.model = equipments[0].model
+      }
+    });
+  }
+  misInfoSelectVisible.value = false
+}
+
+//自动编码生成
+function handleAutoGenChange(){
+    genCode('WORK_ORDER_CODE').then(response =>{
+      this.form.workOrderProjectNo = response;
+    });
+}
+
 getList()
 </script>
 <style scoped>
@@ -2390,10 +2476,5 @@ getList()
   text-overflow: ellipsis;
 }
 
-.attachment-action {
-  flex-shrink: 0;
-  margin-left: 12px;
-  white-space: nowrap;
-}
 
 </style>

+ 15 - 20
ygtx-ui/src/views/gxt/repairOrder/index.vue

@@ -800,11 +800,11 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="MIS工单编码" prop="misOrderNo">
-              <el-input 
-                v-model="finalizeForm.misOrderNo" 
-                placeholder="请输入MIS工单编码" 
-                maxlength="50" 
-                show-word-limit 
+              <el-input
+                v-model="finalizeForm.misOrderNo"
+                placeholder="请输入MIS工单编码"
+                maxlength="50"
+                show-word-limit
                 v-chinese-limit
                 @blur="handleMisOrderNoBlur"
               />
@@ -1373,6 +1373,7 @@ import { listMaintenanceCenters, listStationsByMaintenanceCenter } from "@/api/g
 import ImageUpload from "@/components/ImageUpload/index.vue"
 import preview from '@/components/FileUpload/preview.vue'
 import { getConfigKey } from "@/api/system/config"
+import {genCode} from "@/api/system/autocode/rule.js";
 
 
 const { proxy } = getCurrentInstance()
@@ -1826,7 +1827,7 @@ function getDeptInfoAndParent(deptId) {
       // 如果部门level为3,直接返回
       if (dept.level === "3") {
         resolve(dept);
-      } 
+      }
       // 如果有祖先部门,则继续向上查找
       else if (dept.ancestors) {
         // 从ancestors中提取父部门ID
@@ -1841,7 +1842,7 @@ function getDeptInfoAndParent(deptId) {
             resolve(parentDept);
           });
         }
-      } 
+      }
       // 其他情况也直接返回
       else {
         resolve(dept);
@@ -1917,18 +1918,12 @@ function handleSelectionChange(selection) {
 /** 新增按钮操作 */
 function handleAdd() {
   reset()
+  //生成工单编号
+  genCode('REPAIR_ORDER_CODE').then(response =>{
+    form.value.workOrderProjectNo = response;
+  });
   openDialog.value = true
   dialogTitle.value = "新建维修工单"
-
-  // 生成工单编号
-  const now = new Date()
-  const year = now.getFullYear()
-  const month = String(now.getMonth() + 1).padStart(2, '0')
-  const day = String(now.getDate()).padStart(2, '0')
-  const dateStr = `${year}${month}${day}`
-  const randomNum = Math.floor(100 + Math.random() * 900)
-  form.value.workOrderProjectNo = `WX${dateStr}${randomNum}`
-
   // 设置默认发生时间
   form.value.occurTime = now
 }
@@ -2260,7 +2255,7 @@ function handleMisOrderNoBlur() {
       id: finalizeForm.value.id,
       misOrderNo: finalizeForm.value.misOrderNo
     };
-    
+
     getRepairOrderByMisOrderNo(requestData).then(response => {
       const data = response.data;
       if (data) {
@@ -2268,7 +2263,7 @@ function handleMisOrderNoBlur() {
         if (data.realStartTime) {
           finalizeForm.value.realStartTime = data.realStartTime;
         }
-        
+
         // 填充结束时间
         if (data.realEndTime) {
           finalizeForm.value.realEndTime = data.realEndTime;
@@ -2281,7 +2276,7 @@ function handleMisOrderNoBlur() {
 
         if (data.repairOrderPersonList && data.repairOrderPersonList.length > 0) {
           finalizeForm.value.repairOrderPersonList = data.repairOrderPersonList;
-        } 
+        }
       } else {
         finalizeForm.value.realStartTime = null;
         finalizeForm.value.realEndTime = null;