Browse Source

dev and fixed bugs

allen 1 year ago
parent
commit
18c610dc32
23 changed files with 876 additions and 518 deletions
  1. 8 0
      tfis-admin/src/main/java/com/tfis/system/controller/AircraftSubsystemController.java
  2. 11 1
      tfis-admin/src/main/java/com/tfis/system/controller/AircraftSystemController.java
  3. 9 0
      tfis-admin/src/main/java/com/tfis/system/controller/AircraftTypeController.java
  4. 1 1
      tfis-admin/src/main/java/com/tfis/system/controller/FaultCaseController.java
  5. 49 0
      tfis-admin/src/main/java/com/tfis/system/domain/AircraftType.java
  6. 12 0
      tfis-admin/src/main/java/com/tfis/system/domain/FaultCase.java
  7. 2 0
      tfis-admin/src/main/java/com/tfis/system/mapper/AircraftTypeMapper.java
  8. 2 0
      tfis-admin/src/main/java/com/tfis/system/service/IAircraftTypeService.java
  9. 6 0
      tfis-admin/src/main/java/com/tfis/system/service/impl/AircraftTypeServiceImpl.java
  10. 2 2
      tfis-admin/src/main/resources/application-druid.yml
  11. 7 2
      tfis-admin/src/main/resources/mapper/system/AircraftSystemMapper.xml
  12. 33 1
      tfis-admin/src/main/resources/mapper/system/AircraftTypeMapper.xml
  13. 6 0
      tfis-admin/src/main/resources/mapper/system/FaultCaseMapper.xml
  14. 28 0
      tfis-framework/src/main/java/com/tfis/framework/web/service/SysRegisterService.java
  15. 9 0
      tfis-ui/src/api/system/subsystem.js
  16. 7 0
      tfis-ui/src/api/system/system.js
  17. 9 0
      tfis-ui/src/api/system/type.js
  18. BIN
      tfis-ui/src/assets/images/j20_new.jpg
  19. 280 177
      tfis-ui/src/views/index.vue
  20. 55 19
      tfis-ui/src/views/system/case/index.vue
  21. 123 127
      tfis-ui/src/views/system/subsystem/index.vue
  22. 123 109
      tfis-ui/src/views/system/system/index.vue
  23. 94 79
      tfis-ui/src/views/system/type/index.vue

+ 8 - 0
tfis-admin/src/main/java/com/tfis/system/controller/AircraftSubsystemController.java

@@ -114,6 +114,14 @@ public class AircraftSubsystemController extends BaseController
     }
 
 
+    @GetMapping(value = "/airtts/{aircraftSystemId}")
+    public boolean checktsExistence(@PathVariable("aircraftSystemId") Long aircraftSystemId)
+    {
+        logger.info(String.valueOf(aircraftSystemId));
+        int count = aircraftSubsystemService.getSubSystemOption(aircraftSystemId).size();
+        return count>0;
+    }
+
     @GetMapping("/getSubOption")
     public AjaxResult getOption()
     {

+ 11 - 1
tfis-admin/src/main/java/com/tfis/system/controller/AircraftSystemController.java

@@ -101,11 +101,18 @@ public class AircraftSystemController extends BaseController
     @GetMapping(value = "/airsystem/{aircraftTypeId}")
     public AjaxResult getSystemOption(@PathVariable("aircraftTypeId") Long aircraftTypeId)
     {
-        System.out.println(aircraftTypeId);
         logger.info(String.valueOf(aircraftTypeId));
         return success(aircraftSystemService.getSystemOption(aircraftTypeId));
     }
 
+    @GetMapping(value = "/airts/{aircraftTypeId}")
+    public boolean checktsExistence(@PathVariable("aircraftTypeId") Long aircraftTypeId)
+    {
+        logger.info(String.valueOf(aircraftTypeId));
+        int count = aircraftSystemService.getSystemOption(aircraftTypeId).size();
+        return count>0;
+    }
+
 
 
     @GetMapping("/getSysOption")
@@ -113,5 +120,8 @@ public class AircraftSystemController extends BaseController
     {
         return success(aircraftSystemService.getSysOption());
     }
+
+
+
 }
 

+ 9 - 0
tfis-admin/src/main/java/com/tfis/system/controller/AircraftTypeController.java

@@ -109,4 +109,13 @@ public class AircraftTypeController extends BaseController
     {
         return success(aircraftTypeService.getOption());
     }
+
+    @PreAuthorize("@ss.hasPermi('system:type:getTSSOption')")
+    @GetMapping(value = "/getTSSOption/{aircraftTypeId}")
+    public AjaxResult getTSSOption(@PathVariable("aircraftTypeId") Long aircraftTypeId)
+    {
+        return success(aircraftTypeService.getTSSOption(aircraftTypeId));
+    }
+
+
 }

+ 1 - 1
tfis-admin/src/main/java/com/tfis/system/controller/FaultCaseController.java

@@ -37,7 +37,7 @@ public class FaultCaseController extends BaseController
     /**
      * 查询故障案例管理列表
      */
-    @PreAuthorize("@ss.hasPermi('system:case:list')")
+//    @PreAuthorize("@ss.hasPermi('system:case:list')")
     @GetMapping("/list")
     public TableDataInfo list(FaultCase faultCase)
     {

+ 49 - 0
tfis-admin/src/main/java/com/tfis/system/domain/AircraftType.java

@@ -22,6 +22,55 @@ public class AircraftType extends BaseEntity
     @Excel(name = "机型名称")
     private String aircraftTypeName;
 
+    /** 系统 */
+    private Long aircraftSystemId;
+
+    public Long getAircraftSystemId() {
+        return aircraftSystemId;
+    }
+
+    public void setAircraftSystemId(Long aircraftSystemId) {
+        this.aircraftSystemId = aircraftSystemId;
+    }
+
+    public String getAircraftSystemName() {
+        return aircraftSystemName;
+    }
+
+    public void setAircraftSystemName(String aircraftSystemName) {
+        this.aircraftSystemName = aircraftSystemName;
+    }
+
+    public Long getAircraftSubsystemId() {
+        return aircraftSubsystemId;
+    }
+
+    public void setAircraftSubsystemId(Long aircraftSubsystemId) {
+        this.aircraftSubsystemId = aircraftSubsystemId;
+    }
+
+    public String getAircraftSubsystemName() {
+        return aircraftSubsystemName;
+    }
+
+    public void setAircraftSubsystemName(String aircraftSubsystemName) {
+        this.aircraftSubsystemName = aircraftSubsystemName;
+    }
+
+    @Excel(name = "系统")
+    private String aircraftSystemName;
+
+    /** 分系统 */
+    private Long aircraftSubsystemId;
+
+    @Excel(name = "分系统")
+    private String aircraftSubsystemName;
+
+
+
+
+
+
     public void setId(Long id) 
     {
         this.id = id;

+ 12 - 0
tfis-admin/src/main/java/com/tfis/system/domain/FaultCase.java

@@ -37,6 +37,9 @@ public class FaultCase extends BaseEntity
     @Excel(name = "分系统")
     private String aircraftSubsystemName;
 
+    @Excel(name = "作者")
+    private String author;
+
     /** 故障现象 */
     @Excel(name = "故障现象")
     private String faultPhenomenon;
@@ -175,6 +178,14 @@ public class FaultCase extends BaseEntity
         this.orderBy = orderBy;
     }
 
+    public String getAuthor() {
+        return author;
+    }
+
+    public void setAuthor(String author) {
+        this.author = author;
+    }
+
     @Override
     public String toString() {
         return "FaultCase{" +
@@ -185,6 +196,7 @@ public class FaultCase extends BaseEntity
                 ", aircraftSystemName='" + aircraftSystemName + '\'' +
                 ", aircraftSubsystemId=" + aircraftSubsystemId +
                 ", aircraftSubsystemName='" + aircraftSubsystemName + '\'' +
+                ", author='" + author + '\'' +
                 ", faultPhenomenon='" + faultPhenomenon + '\'' +
                 ", faultCause='" + faultCause + '\'' +
                 ", faultTreePath='" + faultTreePath + '\'' +

+ 2 - 0
tfis-admin/src/main/java/com/tfis/system/mapper/AircraftTypeMapper.java

@@ -60,4 +60,6 @@ public interface AircraftTypeMapper
     public int deleteAircraftTypeByIds(Long[] ids);
 
     List getOption();
+
+    List getTSSOption(Long aircraftTypeId);
 }

+ 2 - 0
tfis-admin/src/main/java/com/tfis/system/service/IAircraftTypeService.java

@@ -62,4 +62,6 @@ public interface IAircraftTypeService
     public int deleteAircraftTypeById(Long id);
 
     List getOption();
+
+    List getTSSOption(Long aircraftTypeId);
 }

+ 6 - 0
tfis-admin/src/main/java/com/tfis/system/service/impl/AircraftTypeServiceImpl.java

@@ -100,4 +100,10 @@ public class AircraftTypeServiceImpl implements IAircraftTypeService
     public List getOption() {
         return aircraftTypeMapper.getOption();
     }
+
+    @Override
+    public List getTSSOption(Long aircraftTypeId) {
+        return aircraftTypeMapper.getTSSOption(aircraftTypeId);
+    }
+
 }

+ 2 - 2
tfis-admin/src/main/resources/application-druid.yml

@@ -6,9 +6,9 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://localhost:3306/tfis?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                url: jdbc:mysql://47.108.150.237:3306/tfis?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
                 username: root
-                password: 123456
+                password: w.cf123321
             # 从库数据源
             slave:
                 # 从数据源开关/默认关闭

+ 7 - 2
tfis-admin/src/main/resources/mapper/system/AircraftSystemMapper.xml

@@ -90,14 +90,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <delete id="deleteAircraftSystemById" parameterType="Long">
-        delete from biz_aircraft_system where id = #{id}
+        delete from biz_aircraft_system where id = #{id};
     </delete>
 
     <delete id="deleteAircraftSystemByIds" parameterType="String">
-        delete from biz_aircraft_system where id in 
+
+        delete abs, asys
+        from biz_aircraft_system as asys
+        left join biz_aircraft_subsystem as abs on asys.id = abs.aircraft_system_id
+        where asys.id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
+
     </delete>
 
 

+ 33 - 1
tfis-admin/src/main/resources/mapper/system/AircraftTypeMapper.xml

@@ -7,6 +7,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="AircraftType" id="AircraftTypeResult">
         <result property="id"    column="id"    />
         <result property="aircraftTypeName"    column="aircraft_type_name"    />
+        <result property="aircraftSystemId"    column="aircraft_system_id"    />
+        <result property="aircraftSubsystemId"    column="aircraft_subsystem_id"    />
+        <result property="aircraftSystemName"    column="aircraft_system_name"    />
+        <result property="aircraftSubsystemName"    column="aircraft_subsystem_name"    />
         <result property="remark"    column="remark"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
@@ -18,6 +22,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select id, aircraft_type_name, remark, create_by, create_time, update_by, update_time from biz_aircraft_type
     </sql>
 
+    <sql id="selectTSSVo">
+        SELECT
+            bat.id,
+            bat.aircraft_type_name,
+            bas.id aircraft_system_id,
+            bas.aircraft_type_name aircraft_system_name,
+            bass.id aircraft_subsystem_id,
+            bass.aircraft_type_name aircraft_subsystem_name
+        FROM
+            biz_aircraft_type bat
+                LEFT JOIN biz_aircraft_system bas ON bat.id = bas.aircraft_type_id
+                LEFT JOIN biz_aircraft_subsystem bass ON bas.id = bass.aircraft_system_id
+    </sql>
+
     <select id="selectAircraftTypeList" parameterType="AircraftType" resultMap="AircraftTypeResult">
         <include refid="selectAircraftTypeVo"/>
         <where>  
@@ -68,12 +86,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteAircraftTypeByIds" parameterType="String">
-        delete from biz_aircraft_type where id in 
+
+        delete abs, asys, atype
+        from biz_aircraft_subsystem as abs
+        right join biz_aircraft_system as asys on abs.aircraft_system_id = asys.id
+        right join biz_aircraft_type as atype on asys.aircraft_type_id = atype.id
+        where atype.id in
+        (
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
+        )
     </delete>
+
+
     <select id="getOption" resultType="Map">
         select id, aircraft_type_name as name from biz_aircraft_type order by id
     </select>
+
+    <select id="getTSSOption" resultType="Map">
+        <include refid="selectTSSVo"/>
+        where bat.id = #{aircraftTypeId}
+    </select>
 </mapper>

+ 6 - 0
tfis-admin/src/main/resources/mapper/system/FaultCaseMapper.xml

@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="aircraftSystemName"    column="aircraft_system_name"    />
         <result property="aircraftSubsystemId"    column="aircraft_subsystem_id"    />
         <result property="aircraftSubsystemName"    column="aircraft_subsystem_name"    />
+        <result property="author"    column="author"    />
         <result property="faultPhenomenon"    column="fault_phenomenon"    />
         <result property="faultCause"    column="fault_cause"    />
         <result property="faultTreePath"    column="fault_tree_path"    />
@@ -33,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             bas.aircraft_type_name aircraft_system_name,
             bfc.aircraft_subsystem_id,
             bass.aircraft_type_name aircraft_subsystem_name,
+            bfc.author,
             bfc.fault_phenomenon,
             bfc.fault_cause,
             bfc.fault_tree_path,
@@ -56,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aircraftTypeId != null "> and bfc.aircraft_type_id = #{aircraftTypeId}</if>
             <if test="aircraftSystemId != null "> and bfc.aircraft_system_id = #{aircraftSystemId}</if>
             <if test="aircraftSubsystemId != null "> and bfc.aircraft_subsystem_id = #{aircraftSubsystemId}</if>
+            <if test="author != null "> and bfc.author = #{author}</if>
             <if test="faultPhenomenon != null  and faultPhenomenon != ''"> and bfc.fault_phenomenon like concat('%', #{faultPhenomenon}, '%')</if>
             <if test="faultCause != null  and faultCause != ''"> and bfc.fault_cause like concat('%', #{faultCause}, '%')</if>
             <if test="faultTreePath != null  and faultTreePath != ''"> and bfc.fault_tree_path = #{faultTreePath}</if>
@@ -81,6 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aircraftTypeId != null">aircraft_type_id,</if>
             <if test="aircraftSystemId != null">aircraft_system_id,</if>
             <if test="aircraftSubsystemId != null">aircraft_subsystem_id,</if>
+            <if test="author != null">author,</if>
             <if test="faultPhenomenon != null">fault_phenomenon,</if>
             <if test="faultCause != null">fault_cause,</if>
             <if test="faultTreePath != null">fault_tree_path,</if>
@@ -96,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aircraftTypeId != null">#{aircraftTypeId},</if>
             <if test="aircraftSystemId != null">#{aircraftSystemId},</if>
             <if test="aircraftSubsystemId != null">#{aircraftSubsystemId},</if>
+            <if test="author != null">#{author},</if>
             <if test="faultPhenomenon != null">#{faultPhenomenon},</if>
             <if test="faultCause != null">#{faultCause},</if>
             <if test="faultTreePath != null">#{faultTreePath},</if>
@@ -115,6 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="aircraftTypeId != null">aircraft_type_id = #{aircraftTypeId},</if>
             <if test="aircraftSystemId != null">aircraft_system_id = #{aircraftSystemId},</if>
             <if test="aircraftSubsystemId != null">aircraft_subsystem_id = #{aircraftSubsystemId},</if>
+            <if test="author != null">author = #{author},</if>
             <if test="faultPhenomenon != null">fault_phenomenon = #{faultPhenomenon},</if>
             <if test="faultCause != null">fault_cause = #{faultCause},</if>
             <if test="faultTreePath != null">fault_tree_path = #{faultTreePath},</if>

+ 28 - 0
tfis-framework/src/main/java/com/tfis/framework/web/service/SysRegisterService.java

@@ -1,5 +1,10 @@
 package com.tfis.framework.web.service;
 
+import com.tfis.system.domain.SysUserRole;
+import com.tfis.system.mapper.SysRoleMapper;
+import com.tfis.system.mapper.SysUserRoleMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import com.tfis.common.constant.CacheConstants;
@@ -18,6 +23,9 @@ import com.tfis.framework.manager.factory.AsyncFactory;
 import com.tfis.system.service.ISysConfigService;
 import com.tfis.system.service.ISysUserService;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 注册校验方法
  * 
@@ -26,6 +34,8 @@ import com.tfis.system.service.ISysUserService;
 @Component
 public class SysRegisterService
 {
+
+    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
     @Autowired
     private ISysUserService userService;
 
@@ -35,6 +45,9 @@ public class SysRegisterService
     @Autowired
     private RedisCache redisCache;
 
+    @Autowired
+    private SysUserRoleMapper userRoleMapper;
+
     /**
      * 注册
      */
@@ -78,6 +91,7 @@ public class SysRegisterService
             sysUser.setNickName(username);
             sysUser.setPassword(SecurityUtils.encryptPassword(password));
             boolean regFlag = userService.registerUser(sysUser);
+            setDefaultRole(sysUser);
             if (!regFlag)
             {
                 msg = "注册失败,请联系系统管理人员";
@@ -90,6 +104,20 @@ public class SysRegisterService
         return msg;
     }
 
+    private void setDefaultRole(SysUser sysUser) {
+        if (sysUser.getUserId() != null) {
+            List<SysUserRole> userRoleList = new ArrayList<>(1);
+            SysUserRole sysUserRole = new SysUserRole();
+            // 普通角色(系统默认角色)
+            sysUserRole.setRoleId(2L);
+            sysUserRole.setUserId(sysUser.getUserId());
+            userRoleList.add(sysUserRole);
+            userRoleMapper.batchUserRole(userRoleList);
+        } else {
+            logger.warn("创建用户未获取到用户id,无法给用户创建默认角色");
+        }
+    }
+
     /**
      * 校验验证码
      * 

+ 9 - 0
tfis-ui/src/api/system/subsystem.js

@@ -50,3 +50,12 @@ export function getSubSystemOption(aircraftSystemId) {
     method: 'get'
   })
 }
+
+
+// getSystemOption
+export function checkttsExistence(aircraftSystemId) {
+  return request({
+    url: '/system/subsystem/airtts/' +aircraftSystemId,
+    method: 'get'
+  })
+}

+ 7 - 0
tfis-ui/src/api/system/system.js

@@ -61,4 +61,11 @@ export function getSysOption() {
 }
 
 
+// getSysoptionOption
+export function checktsExistence(aircraftTypeId) {
+  return request({
+    url: '/system/system/airts/' + aircraftTypeId,
+    method: 'get'
+  })
+}
 

+ 9 - 0
tfis-ui/src/api/system/type.js

@@ -51,3 +51,12 @@ export function getTypeOption() {
   })
 }
 
+
+// getTypeOption
+export function getTSSOption(aircrafttypeid) {
+  return request({
+    url: '/system/type/getTSSOption/'+aircrafttypeid,
+    method: 'get'
+  })
+}
+

BIN
tfis-ui/src/assets/images/j20_new.jpg


+ 280 - 177
tfis-ui/src/views/index.vue

@@ -1,217 +1,282 @@
 <template>
   <div class="app-container">
-    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
-      <el-form-item label="机型" prop="aircraftTypeId">
-        <el-select v-model="queryParams.aircraftTypeId" placeholder="请选择" @change="handleaircraftChange">
-          <el-option
-            v-for="item in typeOption"
-            :key="item.id"
-            :label="item.name"
-            :value="item.id"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="系统" prop="aircraftSystemId">
-        <el-select v-model="queryParams.aircraftSystemId" placeholder="请选择" @change="handlesystemChange">
-          <el-option
-            v-for="item in systemOption"
-            :key="item.id"
-            :label="item.aircraftSystemName"
-            :value="item.id"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="分系统" prop="aircraftSubsystemId">
-        <el-select v-model="queryParams.aircraftSubsystemId" placeholder="请选择">
-          <el-option
-            v-for="item in subSystemOption"
-            :key="item.id"
-            :label="item.aircraftSubsystemName"
-            :value="item.id"
-          />
-        </el-select>
-      </el-form-item>
-      <el-form-item label="故障现象" prop="faultPhenomenon">
-        <el-input
-          v-model="queryParams.faultPhenomenon"
-          placeholder="请输入故障现象"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="排序" prop="orderBy">
-        <el-select v-model="queryParams.orderBy" placeholder="请选择">
-          <el-option
-            v-for="item in orderByOption"
-            :key="item.id"
-            :label="item.name"
-            :value="item.id"
-          />
-        </el-select>
-      </el-form-item>
-
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
-
-    <el-row :gutter="10" class="mb8">
-      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
-    </el-row>
-    <el-row>
-      <el-col v-for="varCase in caseList" :key="varCase.id" :span="8">
-        <el-card class="box-card" style="margin:10px">
-          <div class="rounded-corners">
-            <el-row style="background: #d3dce6;">
-              <el-col :span="6"><div class="grid-content bg-purple" style="background-color: dodgerblue;text-align: center"><img :src="require('@/assets/icons/aircraft.png')" style="width: 1rem"><br>机型</div></el-col>
-              <el-col :span="18"><div class="grid-content bg-purple-light flex-center">{{ varCase.aircraftTypeName }}</div></el-col>
-            </el-row>
-            <el-row style="background: #e5e9f2;">
-              <el-col :span="6"><div class="grid-content bg-purple" style="background-color: dodgerblue;text-align: center"><img :src="require('@/assets/icons/system.png')" style="width: 1rem"><br>系统</div></el-col>
-              <el-col :span="18"><div class="grid-content bg-purple-light flex-center">{{ varCase.aircraftSystemName }}</div></el-col>
-            </el-row>
-            <el-row style="background: #d3dce6;">
-              <el-col :span="6"><div class="grid-content bg-purple" style="background-color: dodgerblue;text-align: center"><img :src="require('@/assets/icons/subsystem.png')" style="width: 1rem"><br>分系统</div></el-col>
-              <el-col :span="18"><div class="grid-content bg-purple-light flex-center"> {{ varCase.aircraftSubsystemName }}</div></el-col>
-            </el-row>
-            <el-row style="background: #e5e9f2;">
-              <el-col :span="6"><div class="grid-content bg-purple" style="background-color: dodgerblue;text-align: center"><img :src="require('@/assets/icons/fault.png')" style="width: 1rem"><br>故障现象</div></el-col>
-              <el-col :span="18"><div class="grid-content bg-purple-light flex-center"> {{ truncatedText(varCase.faultPhenomenon) }}</div></el-col>
-            </el-row>
-          </div>
-          <el-divider style="margin: 12px 0;" />
-          <div class="container">
-            <div class="left"><el-button type="text" class="button" @click="handleUpdate(varCase.id)">查看详情</el-button></div>
-            <div class="right"><time class="time">{{ varCase.createTime }}</time> <img :src="require('@/assets/icons/hot.png')" style="width: 1rem"> {{ varCase.viewCount }}</div>
-          </div>
-        </el-card>
-      </el-col>
-    </el-row>
-
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      :page-sizes="[12,24,36,48]"
-      @pagination="getList"
-    />
-
-    <!-- 添加或修改故障案例管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-row>
-          <el-col :span="6"><div class="grid-content bg-purple">
-            <el-form-item label="机型" prop="faultPhenomenon">
-              <el-select v-model="form.aircraftTypeId" placeholder="请选择" @change="handleaircraftChange1" readonly>
+    <div v-show="isfirstView" class="centerClass">
+      <div class="centered-content">
+        <img :src="require('@/assets/images/j20_new.jpg')">
+        <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
+          <el-row>
+            <el-form-item label="机型" prop="aircraftTypeId">
+              <el-select v-model="queryParams.aircraftTypeId" placeholder="请选择" @change="handleaircraftChange">
                 <el-option
-                  v-for="item in typeOption1"
+                  v-for="item in typeOption"
                   :key="item.id"
                   :label="item.name"
                   :value="item.id"
                 />
               </el-select>
             </el-form-item>
-          </div></el-col>
-          <el-col :span="6"><div class="grid-content bg-purple">
             <el-form-item label="系统" prop="aircraftSystemId">
-              <el-select v-model="form.aircraftSystemId" placeholder="请选择" @change="handlesystemChange1" readonly>
+              <el-select v-model="queryParams.aircraftSystemId" placeholder="请选择" @change="handlesystemChange">
                 <el-option
-                  v-for="item in systemOption1"
+                  v-for="item in systemOption"
                   :key="item.id"
                   :label="item.aircraftSystemName"
                   :value="item.id"
                 />
               </el-select>
             </el-form-item>
-          </div></el-col>
-          <el-col :span="6"><div class="grid-content bg-purple">
             <el-form-item label="分系统" prop="aircraftSubsystemId">
-              <el-select v-model="form.aircraftSubsystemId" placeholder="请选择" readonly>
+              <el-select v-model="queryParams.aircraftSubsystemId" placeholder="请选择">
                 <el-option
-                  v-for="item in subSystemOption1"
+                  v-for="item in subSystemOption"
                   :key="item.id"
                   :label="item.aircraftSubsystemName"
                   :value="item.id"
                 />
               </el-select>
             </el-form-item>
-          </div>
-          </el-col>
-          <el-col :span="6"><div class="grid-content bg-purple" /></el-col>
+            <el-form-item label="故障现象" prop="faultPhenomenon">
+              <el-input
+                v-model="queryParams.faultPhenomenon"
+                placeholder="请输入故障现象"
+                clearable
+                @keyup.enter.native="handleQuery"
+              />
+            </el-form-item>
+            <el-form-item>
+              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+            </el-form-item>
+          </el-row>
+        </el-form>
+      </div>
+    </div>
+    <div v-show="!isfirstView">
+      <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
+        <el-row>
+          <el-form-item label="机型" prop="aircraftTypeId">
+            <el-select v-model="queryParams.aircraftTypeId" placeholder="请选择" @change="handleaircraftChange">
+              <el-option
+                v-for="item in typeOption"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="系统" prop="aircraftSystemId">
+            <el-select v-model="queryParams.aircraftSystemId" placeholder="请选择" @change="handlesystemChange">
+              <el-option
+                v-for="item in systemOption"
+                :key="item.id"
+                :label="item.aircraftSystemName"
+                :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="分系统" prop="aircraftSubsystemId">
+            <el-select v-model="queryParams.aircraftSubsystemId" placeholder="请选择">
+              <el-option
+                v-for="item in subSystemOption"
+                :key="item.id"
+                :label="item.aircraftSubsystemName"
+                :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
+          <el-form-item label="故障现象" prop="faultPhenomenon">
+            <el-input
+              v-model="queryParams.faultPhenomenon"
+              placeholder="请输入故障现象"
+              clearable
+              @keyup.enter.native="handleQuery"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+          </el-form-item>
         </el-row>
         <el-row>
-          <el-col :span="12">
+          <el-form-item label="排序" prop="orderBy">
+            <el-select v-model="queryParams.orderBy" placeholder="请选择" @change="changeOrderBy">
+              <el-option
+                v-for="item in orderByOption"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              />
+            </el-select>
+          </el-form-item>
+        </el-row>
+      </el-form>
+
+      <el-row :gutter="10" class="mb8">
+        <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
+      </el-row>
+      <el-row>
+        <el-col v-for="varCase in caseList" :key="varCase.id" :span="8">
+          <el-card class="box-card" style="margin:10px">
+            <div class="rounded-corners">
+              <el-row style="background: #d3dce6;">
+                <el-col :span="6"><div class="grid-content bg-purple" style="background-color: dodgerblue;text-align: center"><img :src="require('@/assets/icons/aircraft.png')" style="width: 1rem"><br>机型</div></el-col>
+                <el-col :span="18"><div class="grid-content bg-purple-light flex-center">{{ varCase.aircraftTypeName }}</div></el-col>
+              </el-row>
+              <el-row style="background: #e5e9f2;">
+                <el-col :span="6"><div class="grid-content bg-purple" style="background-color: rgb(56, 154, 251);text-align: center"><img :src="require('@/assets/icons/system.png')" style="width: 1rem"><br>系统</div></el-col>
+                <el-col :span="18"><div class="grid-content bg-purple-light flex-center">{{ varCase.aircraftSystemName }}</div></el-col>
+              </el-row>
+              <el-row style="background: #d3dce6;">
+                <el-col :span="6"><div class="grid-content bg-purple" style="background-color: dodgerblue;text-align: center"><img :src="require('@/assets/icons/subsystem.png')" style="width: 1rem"><br>分系统</div></el-col>
+                <el-col :span="18"><div class="grid-content bg-purple-light flex-center"> {{ varCase.aircraftSubsystemName }}</div></el-col>
+              </el-row>
+              <el-row style="background: #e5e9f2;">
+                <el-col :span="6"><div class="grid-content bg-purple" style="background-color: rgb(56, 154, 251);text-align: center"><img :src="require('@/assets/icons/fault.png')" style="width: 1rem"><br>故障现象</div></el-col>
+                <el-col :span="18"><div class="grid-content bg-purple-light flex-center"> {{ truncatedText(varCase.faultPhenomenon) }}</div></el-col>
+              </el-row>
+            </div>
+            <el-divider style="margin: 12px 0;" />
+            <div class="container">
+              <div class="left"><el-button type="text" class="button" @click="handleUpdate(varCase.id)">查看详情</el-button></div>
+              <div class="right"><time class="time">{{ varCase.createTime }}</time> <img :src="require('@/assets/icons/hot.png')" style="width: 1rem"> {{ varCase.viewCount }}</div>
+            </div>
+          </el-card>
+        </el-col>
+      </el-row>
+
+      <pagination
+        v-show="total>0"
+        :total="total"
+        :page.sync="queryParams.pageNum"
+        :limit.sync="queryParams.pageSize"
+        :page-sizes="[12,24,36,48]"
+        @pagination="getList"
+      />
+
+      <!-- 添加或修改故障案例管理对话框 -->
+      <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" :close-on-press-escape="false">
+        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+          <el-row>
+            <el-col :span="6"><div class="grid-content bg-purple">
+              <el-form-item label="机型" prop="faultPhenomenon">
+                <el-select v-model="form.aircraftTypeId" readonly @change="handleaircraftChange1">
+                  <el-option
+                    v-for="item in typeOption1"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id"
+                  />
+                </el-select>
+              </el-form-item>
+            </div></el-col>
+            <el-col :span="6"><div class="grid-content bg-purple">
+              <el-form-item label="系统" prop="aircraftSystemId">
+                <el-select v-model="form.aircraftSystemId" readonly @change="handlesystemChange1">
+                  <el-option
+                    v-for="item in systemOption1"
+                    :key="item.id"
+                    :label="item.aircraftSystemName"
+                    :value="item.id"
+                  />
+                </el-select>
+              </el-form-item>
+            </div></el-col>
+            <el-col :span="6"><div class="grid-content bg-purple">
+              <el-form-item label="分系统" prop="aircraftSubsystemId">
+                <el-select v-model="form.aircraftSubsystemId" readonly>
+                  <el-option
+                    v-for="item in subSystemOption1"
+                    :key="item.id"
+                    :label="item.aircraftSubsystemName"
+                    :value="item.id"
+                  />
+                </el-select>
+              </el-form-item>
+            </div>
+            </el-col>
+            <el-col :span="6">
+              <div class="grid-content bg-purple">
+                <el-form-item label="作者" prop="author">
+                  <el-input v-model="form.author" readonly />
+                </el-form-item>
+              </div></el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="12">
+              <el-card class="box-card" style="margin:5px">
+                <div slot="header" class="clearfix">
+                  <span>故障现象</span>
+                </div>
+                <div>
+                  <el-input v-model="form.faultPhenomenon" type="textarea" :rows="5" placeholder="请输入内容" readonly />
+                </div>
+              </el-card>
+            </el-col>
+            <el-col :span="12">
+              <el-card class="box-card" style="margin:5px">
+                <div slot="header" class="clearfix">
+                  <span>故障原因</span>
+                </div>
+                <div>
+                  <el-input v-model="form.faultCause" type="textarea" :rows="5" placeholder="请输入内容" readonly />
+                </div>
+              </el-card>
+            </el-col>
+          </el-row>
+          <el-row>
             <el-card class="box-card" style="margin:5px">
               <div slot="header" class="clearfix">
-                <span>故障现象</span>
+                <span>故障</span>
               </div>
               <div>
-                <el-input v-model="form.faultPhenomenon" type="textarea" :rows="5" placeholder="请输入内容" readonly/>
+                <div v-if="form.faultTreePath">
+                  <!-- <img :src="baseUrl+form.faultTreePath" style="max-width: 100%;" @load="showResetBtn = true;"> -->
+                  <img :src="baseUrl+form.faultTreePath" style="max-width: 100px;" @load="showResetBtn = true" @click="showModal = true;imageSrc=form.faultTreePath">
+                  <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
+                </div>
               </div>
             </el-card>
-          </el-col>
-          <el-col :span="12">
+          </el-row>
+          <el-row>
             <el-card class="box-card" style="margin:5px">
               <div slot="header" class="clearfix">
-                <span>故障原因</span>
-              </div>
-              <div>
-                <el-input v-model="form.faultCause" type="textarea" :rows="5" placeholder="请输入内容" readonly/>
-              </div>
-            </el-card>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-card class="box-card" style="margin:5px">
-            <div slot="header" class="clearfix">
-              <span>故障树</span>
-            </div>
-            <div>
-              <div v-if="form.faultTreePath">
-                <img :src="baseUrl+form.faultTreePath" style="max-width: 100%;" @load="showResetBtn = true;">
-                <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
+                <span>排故方法</span>
               </div>
-            </div>
-          </el-card>
-        </el-row>
-        <el-row>
-          <el-card class="box-card" style="margin:5px">
-            <div slot="header" class="clearfix">
-              <span>排故方法</span>
-            </div>
-            <el-row>
-              <el-col :span="4">
-                <span>故障图</span>
-                <div>
-                  <div v-if="form.faultPicturePath">
-                    <img :src="baseUrl+form.faultPicturePath" style="max-width: 100px;" @load="showResetBtnpic = true" @click="showModal = true;imageSrc=form.faultPicturePath">
-                    <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
+              <el-row>
+                <el-col :span="4">
+                  <span>故障图</span>
+                  <div>
+                    <div v-if="form.faultPicturePath">
+                      <img :src="baseUrl+form.faultPicturePath" style="max-width: 100px;" @load="showResetBtnpic = true" @click="showModal = true;imageSrc=form.faultPicturePath">
+                      <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
+                    </div>
                   </div>
-                </div>
-              </el-col>
-              <el-col :span="20">
-                <span>文档</span>
-                <div>
-                  <div v-if="form.troubleshootingMethodPath">
-                    <div ref="troubleshootingMethodFile" />
-                    <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
+                </el-col>
+                <el-col :span="20">
+                  <span>文档</span>
+                  <div>
+                    <div v-if="form.troubleshootingMethodPath">
+                      <span style="margin: 10px">{{ getFileNameByPath(form.troubleshootingMethodPath) }}</span>
+                      <el-button v-show="!viewWordFlag" type="primary" @click="viewWordFlag=true">预览</el-button>
+                      <el-button v-show="viewWordFlag" type="primary" @click="viewWordFlag=false">取消预览</el-button>
+                      <el-button type="primary" @click="download(form.troubleshootingMethodPath)">下载</el-button>
+                      <div v-show="viewWordFlag" ref="troubleshootingMethodFile" />
+                    </div>
                   </div>
-                </div>
-              </el-col>
-            </el-row>
-          </el-card>
-        </el-row>
-        <div v-if="showModal" class="modal" @click="showModal = false">
-          <img :src="baseUrl+imageSrc" class="full-image">
-        </div>
-      </el-form>
+                </el-col>
+              </el-row>
+            </el-card>
+          </el-row>
+          <div v-if="showModal" class="modal" @click="showModal = false">
+            <img :src="baseUrl+imageSrc" class="full-image">
+          </div>
+        </el-form>
 
-      <div slot="footer" class="dialog-footer">
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="cancel">返回</el-button>
+        </div>
+      </el-dialog>
+    </div>
 
   </div>
 </template>
@@ -324,7 +389,9 @@ export default {
           'id': 'countDesc',
           'name': '按点击量降序'
         }
-      ]
+      ],
+      viewWordFlag: false,
+      isfirstView: true
     }
   },
   created() {
@@ -332,6 +399,10 @@ export default {
     this.getOption()
     this.getOption1()
   },
+  activated() {
+    this.getOption()
+    this.getOption1()
+  },
   methods: {
     getOption() {
       getTypeOption().then(resp => {
@@ -498,6 +569,7 @@ export default {
         this.caseList = response.rows
         this.total = response.total
         this.loading = false
+        this.isfirstView = false
       })
     },
     // 取消按钮
@@ -565,7 +637,7 @@ export default {
         this.handleaircraftChange1(false)
         this.handlesystemChange1(false)
       })
-      countPlus(id).then(response =>{
+      countPlus(id).then(response => {
       })
     },
     /** 提交按钮 */
@@ -616,6 +688,29 @@ export default {
         return text.substring(0, maxLength) + '...'
       }
       return text
+    },
+    download(path) {
+      this.$download.resource(path)
+    },
+    getFileNameByPath(path) {
+      if (!path) {
+        return ''
+      } else if (path.lastIndexOf('/') > -1) {
+        const newName = path.slice(path.lastIndexOf('/') + 1)
+        const names = newName.split('.')
+        if ((names.size = 2) && (names[0].length > 19)) {
+          return newName.substring(0, names[0].length - 19) + '.' + names[1]
+        } else {
+          return newName
+        }
+      } else {
+        return ''
+      }
+    },
+    changeOrderBy() {
+      if (this.caseList.length > 0) {
+        this.getList()
+      }
     }
   }
 }
@@ -698,5 +793,13 @@ export default {
     display: table;
     clear: both;
   }
+  .centerClass {
+  }
+
+  .centered-content {
+    /* margin-top: 20%; */
+    text-align: center;
+    /* font-family: Arial, sans-serif; */
+  }
 
 </style>

+ 55 - 19
tfis-ui/src/views/system/case/index.vue

@@ -144,18 +144,18 @@
       <el-table-column label="故障图" align="center" prop="faultPicturePath" />
       <el-table-column label="排故方法" align="center" prop="troubleshootingMethodPath" /> -->
       <el-table-column label="浏览次数" align="center" prop="viewCount" />
-      <el-table-column label="创建人" align="center" prop="createBy" />
+      <el-table-column label="作者" align="center" prop="author" />
       <el-table-column label="创建时间" align="center" prop="createTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createTime) }}</span>
         </template>
       </el-table-column>
-      <el-table-column label="最后修改人" align="center" prop="updateBy" />
+      <!-- <el-table-column label="最后修改人" align="center" prop="updateBy" />
       <el-table-column label="最后修改时间" align="center" prop="updateTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.updateTime) }}</span>
         </template>
-      </el-table-column>
+      </el-table-column> -->
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -225,7 +225,13 @@
             </el-form-item>
           </div>
           </el-col>
-          <el-col :span="6"><div class="grid-content bg-purple" /></el-col>
+          <el-col :span="6">
+            <div class="grid-content bg-purple">
+              <el-form-item label="作者" prop="author">
+                <el-input v-model="form.author" placeholder="请输入作者" />
+              </el-form-item>
+            </div>
+          </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
@@ -234,7 +240,7 @@
                 <span>故障现象</span>
               </div>
               <div>
-                <el-input v-model="form.faultPhenomenon" type="textarea" :rows="5" placeholder="请输入内容" maxlength="500"/>
+                <el-input v-model="form.faultPhenomenon" type="textarea" :rows="5" placeholder="请输入内容" maxlength="500" />
               </div>
             </el-card>
           </el-col>
@@ -244,7 +250,7 @@
                 <span>故障原因</span>
               </div>
               <div>
-                <el-input v-model="form.faultCause" type="textarea" :rows="5" placeholder="请输入内容" maxlength="500"/>
+                <el-input v-model="form.faultCause" type="textarea" :rows="5" placeholder="请输入内容" maxlength="500" />
               </div>
             </el-card>
           </el-col>
@@ -270,9 +276,10 @@
                 <i class="el-icon-plus" />
               </el-upload>
               <div v-if="form.faultTreePath">
-                <img :src="baseUrl+form.faultTreePath" style="max-width: 100%;" @load="showResetBtn = true;">
+                <!-- <img :src="baseUrl+form.faultTreePath" style="max-width: 100%;" @load="showResetBtn = true;"> -->
+                <img :src="baseUrl+form.faultTreePath" style="max-width: 100px;" @load="showResetBtn = true" @click="showModal = true;imageSrc=form.faultTreePath">
                 <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
-                <el-button v-if="showResetBtn" type="danger" @click="reuploadTree">重置</el-button>
+                <el-button v-if="showResetBtn" type="danger" @click="reuploadTree">删除</el-button>
               </div>
             </div>
           </el-card>
@@ -302,7 +309,7 @@
                   <div v-if="form.faultPicturePath">
                     <img :src="baseUrl+form.faultPicturePath" style="max-width: 100px;" @load="showResetBtnpic = true" @click="showModal = true;imageSrc=form.faultPicturePath">
                     <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
-                    <el-button v-if="showResetBtnpic" type="danger" @click="reuploadPic">重置</el-button>
+                    <el-button v-if="showResetBtnpic" type="danger" @click="reuploadPic">删除</el-button>
                   </div>
                 </div>
               </el-col>
@@ -323,9 +330,12 @@
                     <i class="el-icon-plus" />
                   </el-upload>
                   <div v-if="form.troubleshootingMethodPath">
-                    <div ref="troubleshootingMethodFile" />
-                    <div style="flex: 1;" /> <!-- 占位符,用于将重置按钮推到最右侧 -->
-                    <el-button type="danger" @click="reuploadMethod">重置</el-button>
+                    <span style="margin: 10px">{{ getFileNameByPath(form.troubleshootingMethodPath) }}</span>
+                    <el-button v-show="!viewWordFlag" type="primary" @click="viewWordFlag=true">预览</el-button>
+                    <el-button v-show="viewWordFlag" type="primary" @click="viewWordFlag=false">取消预览</el-button>
+                    <el-button type="primary" @click="download(form.troubleshootingMethodPath)">下载</el-button>
+                    <el-button type="danger" @click="reuploadMethod">删除</el-button>
+                    <div v-show="viewWordFlag" ref="troubleshootingMethodFile" />
                   </div>
                 </div>
               </el-col>
@@ -435,7 +445,8 @@ export default {
       uploadFileUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传文件服务器地址
       headers: {
         Authorization: 'Bearer ' + getToken()
-      }
+      },
+      viewWordFlag: false
     }
   },
   created() {
@@ -443,6 +454,10 @@ export default {
     this.getOption()
     this.getOption1()
   },
+  activated() {
+    this.getOption()
+    this.getOption1()
+  },
   methods: {
     getOption() {
       getTypeOption().then(resp => {
@@ -470,9 +485,9 @@ export default {
         this.$message.error('图片格式只能为jpeg/png/jpg/bmp/gif')
       }
 
-      const isLt2M = file.size / 1024 / 1024 < 2
+      const isLt2M = file.size / 1024 / 1024 < 20
       if (!isLt2M) {
-        this.$message.error('图片大小不能超过 2MB!')
+        this.$message.error('图片大小不能超过 20MB!')
       }
       return isLt2M && isOKType
     },
@@ -502,9 +517,9 @@ export default {
         this.$message.error('图片格式只能为jpeg/png/jpg/bmp/gif')
       }
 
-      const isLt2M = file.size / 1024 / 1024 < 2
+      const isLt2M = file.size / 1024 / 1024 < 20
       if (!isLt2M) {
-        this.$message.error('图片大小不能超过 2MB!')
+        this.$message.error('图片大小不能超过 20MB!')
       }
       return isLt2M && isOKType
     },
@@ -533,9 +548,9 @@ export default {
         this.$message.error('文件格式只能为doc/docx')
       }
 
-      const isLt2M = file.size / 1024 / 1024 < 5
+      const isLt2M = file.size / 1024 / 1024 < 20
       if (!isLt2M) {
-        this.$message.error('图片大小不能超过 5MB!')
+        this.$message.error('图片大小不能超过 20MB!')
       }
       return isLt2M && isOKType
     },
@@ -743,6 +758,27 @@ export default {
       this.download('system/case/export', {
         ...this.queryParams
       }, `case_${new Date().getTime()}.xlsx`)
+    },
+    download(path) {
+      this.$download.resource(path)
+    },
+    getFileNameByPath(path) {
+      if (!path) {
+        return ''
+      } else if (path.lastIndexOf('/') > -1) {
+        const newName = path.slice(path.lastIndexOf('/') + 1)
+        const names = newName.split('.')
+        if ((names.size = 2) && (names[0].length > 19)) {
+          return newName.substring(0, names[0].length - 19) + '.' + names[1]
+        } else {
+          return newName
+        }
+      } else {
+        return ''
+      }
+    },
+    viewWord() {
+
     }
   }
 }

+ 123 - 127
tfis-ui/src/views/system/subsystem/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
       <el-form-item label="机型" prop="aircraftTypeId">
         <el-select v-model="queryParams.aircraftTypeId" placeholder="请选择" @change="handleaircraftChange">
           <el-option
@@ -14,25 +14,24 @@
       <el-form-item label="系统" prop="aircraftSystemId">
         <el-select v-model="queryParams.aircraftSystemId" placeholder="请选择" @change="handlesystemChange">
           <!--  -->
-            <el-option
-              v-for="item in systemOption"
-              :key="item.id"
-              :label="item.aircraftSystemName"
-              :value="item.id">
-            </el-option>
-          </el-select>
+          <el-option
+            v-for="item in systemOption"
+            :key="item.id"
+            :label="item.aircraftSystemName"
+            :value="item.id"
+          />
+        </el-select>
       </el-form-item>
 
-
       <el-form-item label="分系统" prop="aircraftTypeName">
         <el-select v-model="queryParams.aircraftTypeName" placeholder="请选择">
-            <el-option
-              v-for="item in subSystemOption"
-              :key="item.aircraftSubsystemName"
-              :label="item.aircraftSubsystemName"
-              :value="item.aircraftSubsystemName">
-            </el-option>
-          </el-select>
+          <el-option
+            v-for="item in subSystemOption"
+            :key="item.aircraftSubsystemName"
+            :label="item.aircraftSubsystemName"
+            :value="item.aircraftSubsystemName"
+          />
+        </el-select>
       </el-form-item>
 
       <el-form-item>
@@ -44,47 +43,47 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:subsystem:add']"
           type="primary"
           plain
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['system:subsystem:add']"
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:subsystem:edit']"
           type="success"
           plain
           icon="el-icon-edit"
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          v-hasPermi="['system:subsystem:edit']"
         >修改</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:subsystem:remove']"
           type="danger"
           plain
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['system:subsystem:remove']"
         >删除</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:subsystem:export']"
           type="warning"
           plain
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['system:subsystem:export']"
         >导出</el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
     </el-row>
 
     <el-table v-loading="loading" :data="subsystemList" @selection-change="handleSelectionChange">
@@ -97,23 +96,23 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-hasPermi="['system:subsystem:edit']"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:subsystem:edit']"
           >修改</el-button>
           <el-button
+            v-hasPermi="['system:subsystem:remove']"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['system:subsystem:remove']"
           >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -126,25 +125,25 @@
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
         <el-form-item label="机型" prop="aircraftTypeId">
-              <el-select v-model="form.airname" placeholder="请选择" @change="handleaircraftChange1">
-                <el-option
-                  v-for="item in typeOption1"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.id"
-                />
-              </el-select>
-            </el-form-item>
-            <el-form-item label="系统" prop="aircraftSystemId">
-              <el-select v-model="form.aircraftSystemId" placeholder="请选择">
-                <el-option
-                  v-for="item in systemOption1"
-                  :key="item.id"
-                  :label="item.aircraftSystemName"
-                  :value="item.id"
-                />
-              </el-select>
-            </el-form-item>
+          <el-select v-model="form.airname" placeholder="请选择" @change="handleaircraftChange1">
+            <el-option
+              v-for="item in typeOption1"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="系统" prop="aircraftSystemId">
+          <el-select v-model="form.aircraftSystemId" placeholder="请选择">
+            <el-option
+              v-for="item in systemOption1"
+              :key="item.id"
+              :label="item.aircraftSystemName"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
 
         <el-form-item label="分系统名称" prop="aircraftSubsystemName">
           <el-input v-model="form.aircraftSubsystemName" placeholder="请输入分系统名称" />
@@ -162,16 +161,15 @@
 </template>
 
 <script>
-import { getSystem} from "@/api/system/system";
-import { listSubsystem, getSubsystem, delSubsystem, addSubsystem, updateSubsystem } from "@/api/system/subsystem";
+import { getSystem } from '@/api/system/system'
+import { listSubsystem, getSubsystem, delSubsystem, addSubsystem, updateSubsystem } from '@/api/system/subsystem'
 import { getTypeOption } from '@/api/system/type'
 import { getSystemOption } from '@/api/system/system'
 import { getSubSystemOption } from '@/api/system/subsystem'
-import { getSysOption } from "@/api/system/system";
-
+import { getSysOption } from '@/api/system/system'
 
 export default {
-  name: "Subsystem",
+  name: 'Subsystem',
   data() {
     return {
       // 遮罩层
@@ -189,7 +187,7 @@ export default {
       // 分系统信息管理表格数据
       subsystemList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 查询参数
@@ -198,39 +196,41 @@ export default {
         pageSize: 10,
         aircraftSystemId: null,
         aircraftTypeName: null,
-        aircraftSubsystemId:null,
-        aircraftSubsystemName:null,
+        aircraftSubsystemId: null,
+        aircraftSubsystemName: null
       },
       // 表单参数
       form: {
-        aircraftSystemName:null,
-        aircraftTypeId:null,
+        aircraftSystemName: null,
+        aircraftTypeId: null,
         aircraftSystemId: null,
         aircraftTypeName: null,
-        aircraftSubsystemName:null,
-        aircraftSubsystemId:null,
-        remark:null,
-        airname:null,
-        
+        aircraftSubsystemName: null,
+        aircraftSubsystemId: null,
+        remark: null,
+        airname: null
+
       },
       // 表单校验
       rules: {
       },
-      typeOption:[],
-      systemOption:[],
+      typeOption: [],
+      systemOption: [],
       typeOption1: [],
-      subSystemOption:[],
-      systemOption1:[],
-      subSystemOption1: [],
-      
-    };
+      subSystemOption: [],
+      systemOption1: [],
+      subSystemOption1: []
+
+    }
   },
   created() {
-    this.getList();
+    this.getList()
     this.getOption()
     this.getOption1()
+    this.resetQuery()
   },
   activated() {
+    this.getList()
     this.getOption()
     this.getOption1()
   },
@@ -257,29 +257,27 @@ export default {
     //     this.allsystemOption1 = resp.data
     //   })
     // },
-        // 机型变化后更新系统下拉框
-      handleaircraftChange() {
+    // 机型变化后更新系统下拉框
+    handleaircraftChange() {
       this.queryParams.aircraftSystemId = ''
       this.queryParams.aircraftSubsystemId = ''
       this.queryParams.aircraftTypeName = ''
-      // alert(this.queryParams.aircraftTypeId)
       getSystemOption(this.queryParams.aircraftTypeId).then(resp => {
         this.systemOption = resp.data
       })
     },
-     //系统变化后更新分系统
-     handlesystemChange(){
+    // 系统变化后更新分系统
+    handlesystemChange() {
       this.queryParams.aircraftTypeName = ''
-      getSubSystemOption(this.queryParams.aircraftSystemId).then(resp =>{
-        this.subSystemOption = resp.data;
+      getSubSystemOption(this.queryParams.aircraftSystemId).then(resp => {
+        this.subSystemOption = resp.data
       })
     },
 
     // 添加或修改对话框中机型变化后,修改系统
     handleaircraftChange1() {
       this.form.aircraftSystemName = ''
-      // alert(this.queryParams.aircraftTypeId)
-      this.form.aircraftTypeId = this.form.airname; 
+      this.form.aircraftTypeId = this.form.airname
       getSystemOption(this.form.aircraftTypeId).then(resp => {
         this.systemOption1 = resp.data
       })
@@ -287,27 +285,26 @@ export default {
 
     // 添加或修改对话框中系统变化后,修改分系统
     handlesystemChange1() {
-      //this.form.aircraftSystemId = this.form.aircraftSystemName
+      // this.form.aircraftSystemId = this.form.aircraftSystemName
       // getSubSystemOption(this.form.aircraftSystemId).then(resp => {
       //   this.subSystemOption1 = resp.data
       // })
-      
-    },
 
+    },
 
     /** 查询分系统信息管理列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listSubsystem(this.queryParams).then(response => {
-        this.subsystemList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+        this.subsystemList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -320,83 +317,82 @@ export default {
         createTime: null,
         updateBy: null,
         updateTime: null
-      };
-      this.resetForm("form");
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.queryParams.pageNum = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
+      this.resetForm('queryForm')
       this.systemOption = []
       this.subSystemOption = []
-      this.handleQuery();
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加分系统信息管理";
+      this.reset()
+      this.open = true
+      this.title = '添加分系统信息管理'
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       const id = row.id || this.ids
       getSubsystem(id).then(response => {
-        this.form = response.data;
-        this.form.airname = this.form.aircraftTypeName;
-        console.log(this.form)
-        this.open = true;
-        this.title = "修改分系统信息管理";
-      });
+        this.form = response.data
+        this.form.airname = this.form.aircraftTypeName
+        this.open = true
+        this.title = '修改分系统信息管理'
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
-          this.form.aircraftTypeName = this.form.aircraftSubsystemName;
+          this.form.aircraftTypeName = this.form.aircraftSubsystemName
           if (this.form.id != null) {
-            this.form.aircraftTypeName = this.form.aircraftSubsystemName;
+            this.form.aircraftTypeName = this.form.aircraftSubsystemName
             updateSubsystem(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.getList()
+            })
           } else {
             addSubsystem(this.form).then(response => {
-              console.log(this.form.aircraftSubsystemName)
-              //this.form.aircraftTypeName = this.form.aircraftSubsystemName;
-              this.$modal.msgSuccess("新增成功");
+              // this.form.aircraftTypeName = this.form.aircraftSubsystemName;
+              this.$modal.msgSuccess('新增成功')
+
+              this.open = false
 
-              this.open = false;
-              
-              this.queryParams.aircraftSystemId= null;
-              this.queryParams.aircraftTypeName= null;
-              this.queryParams.aircraftSubsystemId=null;
-              this.getList();
-            });
+              this.queryParams.aircraftSystemId = null
+              this.queryParams.aircraftTypeName = null
+              this.queryParams.aircraftSubsystemId = null
+              this.systemOption1 = []
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除分系统信息管理编号为"' + ids + '"的数据项?').then(function() {
-        return delSubsystem(ids);
+      const ids = row.id || this.ids
+      this.$modal.confirm('是否确认删除分系统编号为"' + ids + '"的数据项?').then(function() {
+        return delSubsystem(ids)
       }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+        this.getList()
+        this.$modal.msgSuccess('删除成功')
+      }).catch(() => {})
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -405,5 +401,5 @@ export default {
       }, `subsystem_${new Date().getTime()}.xlsx`)
     }
   }
-};
+}
 </script>

+ 123 - 109
tfis-ui/src/views/system/system/index.vue

@@ -1,25 +1,25 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
       <el-form-item label="机型" prop="aircraftTypeId">
         <el-select v-model="queryParams.aircraftTypeId" placeholder="请选择" @change="handleaircraftChange">
-            <el-option
-              v-for="item in typeOption"
-              :key="item.id"
-              :label="item.name"
-              :value="item.id">
-            </el-option>
-          </el-select>
+          <el-option
+            v-for="item in typeOption"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
+          />
+        </el-select>
       </el-form-item>
       <el-form-item label="系统" prop="aircraftTypeName">
         <el-select v-model="queryParams.aircraftTypeName" placeholder="请选择">
-            <el-option
-              v-for="item in systemOption"
-              :key="item.aircraftSystemName"
-              :label="item.aircraftSystemName"
-              :value="item.aircraftSystemName">
-            </el-option>
-          </el-select>
+          <el-option
+            v-for="item in systemOption"
+            :key="item.aircraftSystemName"
+            :label="item.aircraftSystemName"
+            :value="item.aircraftSystemName"
+          />
+        </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -30,47 +30,47 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:system:add']"
           type="primary"
           plain
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['system:system:add']"
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:system:edit']"
           type="success"
           plain
           icon="el-icon-edit"
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          v-hasPermi="['system:system:edit']"
         >修改</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:system:remove']"
           type="danger"
           plain
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['system:system:remove']"
         >删除</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:system:export']"
           type="warning"
           plain
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['system:system:export']"
         >导出</el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
     </el-row>
 
     <el-table v-loading="loading" :data="systemList" @selection-change="handleSelectionChange">
@@ -82,23 +82,23 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-hasPermi="['system:system:edit']"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:system:edit']"
           >修改</el-button>
           <el-button
+            v-hasPermi="['system:system:remove']"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['system:system:remove']"
           >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -116,8 +116,8 @@
               v-for="item in typeOption1"
               :key="item.id"
               :label="item.name"
-              :value="item.id">
-            </el-option>
+              :value="item.id"
+            />
           </el-select>
         </el-form-item>
 
@@ -138,13 +138,14 @@
 </template>
 
 <script>
-import { listSystem, getSystem, delSystem, addSystem, updateSystem } from "@/api/system/system";
-import { getTypeOption } from "@/api/system/type";
-import { getSystemOption,getSysOption } from "@/api/system/system";
-
+import { listSystem, getSystem, delSystem, addSystem, updateSystem } from '@/api/system/system'
+import { getTypeOption } from '@/api/system/type'
+import { getSystemOption, getSysOption, checktsExistence } from '@/api/system/system'
+import { checkttsExistence } from '@/api/system/subsystem'
+import { getSubSystemOption } from '@/api/system/subsystem'
 
 export default {
-  name: "System",
+  name: 'System',
   data() {
     return {
       // 遮罩层
@@ -162,7 +163,7 @@ export default {
       // 系统信息管理表格数据
       systemList: [],
       // 弹出层标题
-      title: "",
+      title: '',
       // 是否显示弹出层
       open: false,
       // 查询参数
@@ -170,78 +171,77 @@ export default {
         pageNum: 1,
         pageSize: 10,
         aircraftTypeId: null,
-        aircraftTypeName: null,
-//       aircraftSystemId:null,
+        aircraftTypeName: null
+        //       aircraftSystemId:null,
 
       },
       // 表单参数
       form: {
         aircraftTypeId: null,
         aircraftTypeName: null,
-//        aircraftSystemId:null,
-        remark:null
+        //        aircraftSystemId:null,
+        remark: null
       },
       // 表单校验
       rules: {
       },
       typeOption: [],
       typeOption1: [],
-      systemOption:[],
-      subSystemOption:[],
-      systemOption1:[]
-    };
+      systemOption: [],
+      subSystemOption: [],
+      systemOption1: [],
+      tsExistence: ''
+    }
   },
   created() {
-    this.getList();
-    this.getOption();
-    this.getOption1();
+    this.getList()
+    this.getOption()
+    this.getOption1()
     // this.getSysOption();
   },
   activated() {
-    this.getOption();
-    this.getOption1();
+    this.getList()
+    this.getOption()
+    this.getOption1()
   },
   methods: {
-      getOption() {
-        getTypeOption().then(resp => {
-          this.typeOption = resp.data
-        })
-      },
-       //用于获取飞机机型(放到添加功能中)
+    getOption() {
+      getTypeOption().then(resp => {
+        this.typeOption = resp.data
+      })
+    },
+    // 用于获取飞机机型(放到添加功能中)
     getOption1() {
       getTypeOption().then(resp => {
         this.typeOption1 = resp.data
       })
     },
-        //机型变化后更新系统下拉框
+    // 机型变化后更新系统下拉框
     handleaircraftChange() {
-      this.queryParams.aircraftTypeName = '';
-      //alert(this.queryParams.aircraftTypeId)
       getSystemOption(this.queryParams.aircraftTypeId).then(resp => {
-        this.systemOption = resp.data;
-      });
+        this.systemOption = resp.data
+      })
     },
-     //添加或修改对话框中机型变化后,修改系统
+    // 添加或修改对话框中机型变化后,修改系统
     handleaircraftChange1() {
-      this.form.aircraftSystemId = '';
-      //alert(this.queryParams.aircraftTypeId)
+      this.form.aircraftSystemId = ''
       getSystemOption(this.form.aircraftTypeId).then(resp => {
-        this.systemOption1 = resp.data;
-      });
+        this.systemOption1 = resp.data
+      })
     },
     /** 查询系统信息管理列表 */
     getList() {
-      this.loading = true;
+      this.loading = true
       listSystem(this.queryParams).then(response => {
-        this.systemList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+        this.systemList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -249,85 +249,99 @@ export default {
         id: null,
         aircraftTypeId: null,
         aircraftTypeName: null,
-        aircraftSystemName:null,
+        aircraftSystemName: null,
         remark: null,
         createBy: null,
         createTime: null,
         updateBy: null,
         updateTime: null
-      };
-      this.resetForm("form");
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.queryParams.pageNum = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
+      this.resetForm('queryForm')
       this.systemOption = []
-      this.handleQuery();
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加系统信息管理";
+      this.reset()
+      this.open = true
+      this.title = '添加系统信息管理'
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       const id = row.id || this.ids
       getSystem(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改系统信息管理";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '修改系统信息管理'
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
-            this.form.aircraftTypeName = this.form.aircraftSystemName;
+            this.form.aircraftTypeName = this.form.aircraftSystemName
             updateSystem(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.queryParams.aircraftTypeId = null;
-              this.queryParams.aircraftTypeName= null;
-              this.queryParams.aircraftSystemId=null;
-              this.getList();
-            });
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.queryParams.aircraftTypeId = null
+              this.queryParams.aircraftTypeName = null
+              this.queryParams.aircraftSystemId = null
+              this.getList()
+            })
           } else {
-            this.form.aircraftTypeName = this.form.aircraftSystemName;
+            this.form.aircraftTypeName = this.form.aircraftSystemName
             addSystem(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.queryParams.aircraftTypeId = null;
-              this.queryParams.aircraftTypeName= null;
-              this.queryParams.aircraftSystemId=null;
-              this.getList();
-            });
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.queryParams.aircraftTypeId = null
+              this.queryParams.aircraftTypeName = null
+              this.queryParams.aircraftSystemId = null
+              this.getList()
+            })
           }
         }
-      });
+      })
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除系统信息管理编号为"' + ids + '"的数据项?').then(function() {
-        return delSystem(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+      const ids = row.id || this.ids
+      this.$modal.confirm('是否确认删除系统编号为"' + ids + '"的数据项?').then(function() {
+        return checkttsExistence(ids)
+      }).then((resp) => {
+        if (resp) {
+          this.$modal.confirm('编号为"' + ids + '"的系统关联了子系统,确定是否删除并删除其关联的子系统?').then(function() {
+            return delSystem(ids)
+          }).then(() => {
+            this.getList()
+            this.$modal.msgSuccess('删除成功')
+          }).catch(() => {})
+        } else {
+          delSystem(ids).then(response => {
+            this.$modal.msgSuccess('删除成功')
+            this.getList()
+          }).catch(error => {
+            console.error('删除系统出错:', error)
+            // 进行相应的错误处理
+          })
+        }
+      }).catch(() => {})
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -336,5 +350,5 @@ export default {
       }, `system_${new Date().getTime()}.xlsx`)
     }
   }
-};
+}
 </script>

+ 94 - 79
tfis-ui/src/views/system/type/index.vue

@@ -1,15 +1,15 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" size="small" :inline="true" label-width="68px">
       <el-form-item label="机型名称" prop="aircraftTypeName" @change="handleaircraftChange">
         <el-select v-model="queryParams.aircraftTypeName" placeholder="请选择">
-            <el-option
-              v-for="item in typeOption"
-              :key="item.name"
-              :label="item.name"
-              :value="item.name">
-            </el-option>
-          </el-select>
+          <el-option
+            v-for="item in typeOption"
+            :key="item.name"
+            :label="item.name"
+            :value="item.name"
+          />
+        </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -20,47 +20,47 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:type:add']"
           type="primary"
           plain
           icon="el-icon-plus"
           size="mini"
           @click="handleAdd"
-          v-hasPermi="['system:type:add']"
         >新增</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:type:edit']"
           type="success"
           plain
           icon="el-icon-edit"
           size="mini"
           :disabled="single"
           @click="handleUpdate"
-          v-hasPermi="['system:type:edit']"
         >修改</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:type:remove']"
           type="danger"
           plain
           icon="el-icon-delete"
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['system:type:remove']"
         >删除</el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
+          v-hasPermi="['system:type:export']"
           type="warning"
           plain
           icon="el-icon-download"
           size="mini"
           @click="handleExport"
-          v-hasPermi="['system:type:export']"
         >导出</el-button>
       </el-col>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
     </el-row>
 
     <el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
@@ -71,23 +71,23 @@
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
+            v-hasPermi="['system:type:edit']"
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:type:edit']"
           >修改</el-button>
           <el-button
+            v-hasPermi="['system:type:remove']"
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['system:type:remove']"
           >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -115,12 +115,14 @@
 </template>
 
 <script>
-import { listType, getType, delType, addType, updateType } from "@/api/system/type";
-import { getTypeOption } from "@/api/system/type";
-import { getSystemOption } from "@/api/system/system";
+import { listType, getType, delType, addType, updateType } from '@/api/system/type'
+import { getTypeOption } from '@/api/system/type'
+import { getSystemOption, checktsExistence } from '@/api/system/system'
+import { delSubsystem } from '@/api/system/subsystem'
+import { delSystem } from '@/api/system/system'
 
 export default {
-  name: "Type",
+  name: 'Type',
   data() {
     return {
       // 遮罩层
@@ -138,7 +140,9 @@ export default {
       // 机型信息管理表格数据
       typeList: [],
       // 弹出层标题
-      title: "",
+      title: '',
+      systemOption: [],
+      subSystemOption: [],
       // 是否显示弹出层
       open: false,
       // 查询参数
@@ -146,21 +150,23 @@ export default {
         pageNum: 1,
         pageSize: 10,
         aircraftTypeName: null,
-        aircraftTypeId:null
+        aircraftTypeId: null
       },
       // 表单参数
       form: {
-        aircraftTypeName:null
+        aircraftTypeName: null
       },
       // 表单校验
       rules: {
       },
       typeOption: [],
-    };
+      typeOptiontest: [],
+      tsExistence: ''
+    }
   },
   created() {
-    this.getOption();
-    this.getList();
+    this.getOption()
+    this.getList()
   },
   methods: {
     /** 查询机型信息管理列表 */
@@ -170,25 +176,24 @@ export default {
       })
     },
     getList() {
-      this.loading = true;
+      this.loading = true
       listType(this.queryParams).then(response => {
-        this.typeList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
+        this.typeList = response.rows
+        this.total = response.total
+        this.loading = false
+      })
     },
-     //机型变化后更新系统下拉框
-     handleaircraftChange() {
-      this.queryParams.aircraftSystemId = '';
-      //alert(this.queryParams.aircraftTypeId)
+    // 机型变化后更新系统下拉框
+    handleaircraftChange() {
+      this.queryParams.aircraftSystemId = ''
       getSystemOption(this.queryParams.aircraftTypeId).then(resp => {
-        this.systemOption = resp.data;
-      });
+        this.systemOption = resp.data
+      })
     },
     // 取消按钮
     cancel() {
-      this.open = false;
-      this.reset();
+      this.open = false
+      this.reset()
     },
     // 表单重置
     reset() {
@@ -200,76 +205,86 @@ export default {
         createTime: null,
         updateBy: null,
         updateTime: null
-      };
-      this.resetForm("form");
+      }
+      this.resetForm('form')
     },
     /** 搜索按钮操作 */
     handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
+      this.queryParams.pageNum = 1
+      this.getList()
     },
     /** 重置按钮操作 */
     resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
+      this.resetForm('queryForm')
+      this.handleQuery()
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
     handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加机型信息管理";
+      this.reset()
+      this.open = true
+      this.title = '添加机型信息管理'
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
-      this.reset();
+      this.reset()
       const id = row.id || this.ids
       getType(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改机型信息管理";
-      });
+        this.form = response.data
+        this.open = true
+        this.title = '修改机型信息管理'
+      })
     },
     /** 提交按钮 */
     submitForm() {
-      this.$refs["form"].validate(valid => {
+      this.$refs['form'].validate(valid => {
         if (valid) {
           if (this.form.id != null) {
             updateType(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.queryParams.aircraftTypeName = null;
-              this.queryParams.aircraftTypeId=null;
-              this.getList();
-              this.getOption();
-            });
+              this.$modal.msgSuccess('修改成功')
+              this.open = false
+              this.queryParams.aircraftTypeName = null
+              this.queryParams.aircraftTypeId = null
+              this.getList()
+              this.getOption()
+            })
           } else {
             addType(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.queryParams.aircraftTypeName = null;
-              this.queryParams.aircraftTypeId=null;
-              this.getList();
-              this.getOption();
-            });
+              this.$modal.msgSuccess('新增成功')
+              this.open = false
+              this.queryParams.aircraftTypeName = null
+              this.queryParams.aircraftTypeId = null
+              this.getList()
+              this.getOption()
+            })
           }
         }
-      });
+      })
     },
-    /** 删除按钮操作 */
     handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除机型信息管理编号为"' + ids + '"的数据项?').then(function() {
-        return delType(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+      const ids = row.id || this.ids
+      this.$modal.confirm('是否确认删除机型编号为"' + ids + '"的数据项?').then(function() {
+        return checktsExistence(ids)
+      }).then((resp) => {
+        if (resp) {
+          this.$modal.confirm('编号为"' + ids + '"的机型关联了系统,确定是否删除并删除其关联的系统和子系统?').then(function() {
+            return delType(ids)
+          }).then(() => {
+            this.getList()
+            this.$modal.msgSuccess('删除成功')
+          }).catch(() => {})
+        } else {
+          delType(ids).then(response => {
+            this.$modal.msgSuccess('删除成功')
+            this.getList()
+          })
+        }
+      }).catch(() => {})
     },
     /** 导出按钮操作 */
     handleExport() {
@@ -278,5 +293,5 @@ export default {
       }, `type_${new Date().getTime()}.xlsx`)
     }
   }
-};
+}
 </script>