Browse Source

-修改检测、维修任务分配、录入台账

jiangbiao 2 years ago
parent
commit
68711bc3b8

+ 5 - 1
master/src/main/java/com/ruoyi/project/task/controller/TTaskInspectionController.java

@@ -49,9 +49,13 @@ public class TTaskInspectionController extends BaseController {
         list.forEach(item -> {
             if (StringUtils.isNotEmpty(item.getTaskDoneNum()) && StringUtils.isNotEmpty(item.getTaskNum())) {
                 item.setPercentage(new BigDecimal(item.getTaskDoneNum()).divide(new BigDecimal(item.getTaskNum()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).doubleValue());
+            } else {
+                item.setPercentage(0.0);
             }
             if (item.getEndTime() != null) {
-                if (item.getEndTime().before(new Date())) {
+                if (item.getEndTime().before(new Date()) && StringUtils.isNotEmpty(item.getTaskNum()) && !item.getTaskNum().equals(item.getTaskDoneNum())) {
+                    item.setTimeOut("是");
+                }else if (item.getEndTime().before(new Date())) {
                     item.setTimeOut("是");
                 } else {
                     item.setTimeOut("否");

+ 12 - 1
master/src/main/java/com/ruoyi/project/task/controller/TTaskRepairController.java

@@ -51,9 +51,13 @@ public class TTaskRepairController extends BaseController
         list.forEach(item -> {
             if (StringUtils.isNotEmpty(item.getTaskDoneNum()) && StringUtils.isNotEmpty(item.getTaskNum())) {
                 item.setPercentage(new BigDecimal(item.getTaskDoneNum()).divide(new BigDecimal(item.getTaskNum()), 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).doubleValue());
+            } else {
+                item.setPercentage(0.0);
             }
             if (item.getEndTime() != null) {
-                if (item.getEndTime().before(new Date())) {
+                if (item.getEndTime().before(new Date()) && StringUtils.isNotEmpty(item.getTaskNum()) && !item.getTaskNum().equals(item.getTaskDoneNum())) {
+                    item.setTimeOut("是");
+                }else if (item.getEndTime().before(new Date())) {
                     item.setTimeOut("是");
                 } else {
                     item.setTimeOut("否");
@@ -120,4 +124,11 @@ public class TTaskRepairController extends BaseController
     {
         return toAjax(tTaskRepairService.deleteTTaskRepairByIds(ids));
     }
+
+    @PreAuthorize("@ss.hasPermi('task:repair:edit')")
+    @Log(title = "维修任务分配", businessType = BusinessType.UPDATE)
+    @PutMapping("/{ids}")
+    public AjaxResult divide(@PathVariable Long[] ids) {
+        return toAjax(tTaskRepairService.updateTTaskRepairByIds(ids));
+    }
 }

+ 9 - 0
master/src/main/java/com/ruoyi/project/task/domain/TTaskRepair.java

@@ -25,6 +25,7 @@ public class TTaskRepair extends BaseEntity
     /** 装置id */
     @Excel(name = "装置id")
     private Long plantId;
+    private String plantName;
 
     /** 任务名称 */
     @Excel(name = "任务名称")
@@ -112,6 +113,14 @@ public class TTaskRepair extends BaseEntity
         this.timeOut = timeOut;
     }
 
+    public String getPlantName() {
+        return plantName;
+    }
+
+    public void setPlantName(String plantName) {
+        this.plantName = plantName;
+    }
+
     public Double getPercentage() {
         return percentage;
     }

+ 10 - 8
master/src/main/java/com/ruoyi/project/task/mapper/TTaskRepairMapper.java

@@ -5,15 +5,15 @@ import com.ruoyi.project.task.domain.TTaskRepair;
 
 /**
  * 维修任务Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2022-11-30
  */
-public interface TTaskRepairMapper 
+public interface TTaskRepairMapper
 {
     /**
      * 查询维修任务
-     * 
+     *
      * @param id 维修任务主键
      * @return 维修任务
      */
@@ -21,7 +21,7 @@ public interface TTaskRepairMapper
 
     /**
      * 查询维修任务列表
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 维修任务集合
      */
@@ -29,7 +29,7 @@ public interface TTaskRepairMapper
 
     /**
      * 新增维修任务
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 结果
      */
@@ -37,15 +37,17 @@ public interface TTaskRepairMapper
 
     /**
      * 修改维修任务
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 结果
      */
     public int updateTTaskRepair(TTaskRepair tTaskRepair);
 
+    public int updateTTaskRepairByIds(Long[] id);
+
     /**
      * 删除维修任务
-     * 
+     *
      * @param id 维修任务主键
      * @return 结果
      */
@@ -53,7 +55,7 @@ public interface TTaskRepairMapper
 
     /**
      * 批量删除维修任务
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */

+ 10 - 8
master/src/main/java/com/ruoyi/project/task/service/ITTaskRepairService.java

@@ -5,15 +5,15 @@ import com.ruoyi.project.task.domain.TTaskRepair;
 
 /**
  * 维修任务Service接口
- * 
+ *
  * @author ruoyi
  * @date 2022-11-30
  */
-public interface ITTaskRepairService 
+public interface ITTaskRepairService
 {
     /**
      * 查询维修任务
-     * 
+     *
      * @param id 维修任务主键
      * @return 维修任务
      */
@@ -21,7 +21,7 @@ public interface ITTaskRepairService
 
     /**
      * 查询维修任务列表
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 维修任务集合
      */
@@ -29,7 +29,7 @@ public interface ITTaskRepairService
 
     /**
      * 新增维修任务
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 结果
      */
@@ -37,15 +37,17 @@ public interface ITTaskRepairService
 
     /**
      * 修改维修任务
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 结果
      */
     public int updateTTaskRepair(TTaskRepair tTaskRepair);
 
+    public int updateTTaskRepairByIds(Long[] ids);
+
     /**
      * 批量删除维修任务
-     * 
+     *
      * @param ids 需要删除的维修任务主键集合
      * @return 结果
      */
@@ -53,7 +55,7 @@ public interface ITTaskRepairService
 
     /**
      * 删除维修任务信息
-     * 
+     *
      * @param id 维修任务主键
      * @return 结果
      */

+ 14 - 8
master/src/main/java/com/ruoyi/project/task/service/impl/TTaskRepairServiceImpl.java

@@ -9,19 +9,19 @@ import com.ruoyi.project.task.service.ITTaskRepairService;
 
 /**
  * 维修任务Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2022-11-30
  */
 @Service
-public class TTaskRepairServiceImpl implements ITTaskRepairService 
+public class TTaskRepairServiceImpl implements ITTaskRepairService
 {
     @Autowired
     private TTaskRepairMapper tTaskRepairMapper;
 
     /**
      * 查询维修任务
-     * 
+     *
      * @param id 维修任务主键
      * @return 维修任务
      */
@@ -33,7 +33,7 @@ public class TTaskRepairServiceImpl implements ITTaskRepairService
 
     /**
      * 查询维修任务列表
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 维修任务
      */
@@ -45,7 +45,7 @@ public class TTaskRepairServiceImpl implements ITTaskRepairService
 
     /**
      * 新增维修任务
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 结果
      */
@@ -57,7 +57,7 @@ public class TTaskRepairServiceImpl implements ITTaskRepairService
 
     /**
      * 修改维修任务
-     * 
+     *
      * @param tTaskRepair 维修任务
      * @return 结果
      */
@@ -67,9 +67,15 @@ public class TTaskRepairServiceImpl implements ITTaskRepairService
         return tTaskRepairMapper.updateTTaskRepair(tTaskRepair);
     }
 
+    @Override
+    public int updateTTaskRepairByIds(Long[] ids)
+    {
+        return tTaskRepairMapper.updateTTaskRepairByIds(ids);
+    }
+
     /**
      * 批量删除维修任务
-     * 
+     *
      * @param ids 需要删除的维修任务主键
      * @return 结果
      */
@@ -81,7 +87,7 @@ public class TTaskRepairServiceImpl implements ITTaskRepairService
 
     /**
      * 删除维修任务信息
-     * 
+     *
      * @param id 维修任务主键
      * @return 结果
      */

+ 28 - 19
master/src/main/resources/mybatis/task/TTaskRepairMapper.xml

@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="TTaskRepair" id="TTaskRepairResult">
         <result property="id"    column="id"    />
         <result property="plantId"    column="plant_id"    />
+        <result property="plantName"    column="plant_name"    />
         <result property="taskName"    column="task_name"    />
         <result property="taskCode"    column="task_code"    />
         <result property="taskType"    column="task_type"    />
@@ -31,26 +32,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
 
     <select id="selectTTaskRepairList" parameterType="TTaskRepair" resultMap="TTaskRepairResult">
-        <include refid="selectTTaskRepairVo"/>
+        select d.*,bp.plant_name from t_task_repair d
+        left join t_base_plant bp on d.plant_id=bp.plant_id
         <where>
-            <if test="plantId != null "> and plant_id = #{plantId}</if>
-            <if test="taskName != null  and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
-            <if test="taskCode != null  and taskCode != ''"> and task_code = #{taskCode}</if>
-            <if test="taskType != null  and taskType != ''"> and task_type = #{taskType}</if>
-            <if test="startTime != null "> and start_time = #{startTime}</if>
-            <if test="endTime != null "> and end_time = #{endTime}</if>
-            <if test="recipient != null "> and recipient = #{recipient}</if>
-            <if test="taskNum != null  and taskNum != ''"> and task_num = #{taskNum}</if>
-            <if test="taskDoneNum != null  and taskDoneNum != ''"> and task_done_num = #{taskDoneNum}</if>
-            <if test="taskUndoneNum != null  and taskUndoneNum != ''"> and task_undone_num = #{taskUndoneNum}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
-            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
-            <if test="deptId != null "> and dept_id = #{deptId}</if>
-            <if test="createrCode != null "> and creater_code = #{createrCode}</if>
-            <if test="createdate != null "> and createdate = #{createdate}</if>
-            <if test="updaterCode != null "> and updater_code = #{updaterCode}</if>
-            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
-        and del_flag = 0
+            <if test="plantId != null "> and d.plant_id = #{plantId}</if>
+            <if test="taskName != null  and taskName != ''"> and d.task_name like concat('%', #{taskName}, '%')</if>
+            <if test="taskCode != null  and taskCode != ''"> and d.task_code = #{taskCode}</if>
+            <if test="taskType != null  and taskType != ''"> and d.task_type = #{taskType}</if>
+            <if test="startTime != null "> and d.start_time = #{startTime}</if>
+            <if test="endTime != null "> and d.end_time = #{endTime}</if>
+            <if test="recipient != null "> and d.recipient = #{recipient}</if>
+            <if test="taskNum != null  and taskNum != ''"> and d.task_num = #{taskNum}</if>
+            <if test="taskDoneNum != null  and taskDoneNum != ''"> and d.task_done_num = #{taskDoneNum}</if>
+            <if test="taskUndoneNum != null  and taskUndoneNum != ''"> and d.task_undone_num = #{taskUndoneNum}</if>
+            <if test="status != null  and status != ''"> and d.status = #{status}</if>
+            <if test="remarks != null  and remarks != ''"> and d.remarks = #{remarks}</if>
+            <if test="deptId != null "> and d.dept_id = #{deptId}</if>
+            <if test="createrCode != null "> and d.creater_code = #{createrCode}</if>
+            <if test="createdate != null "> and d.createdate = #{createdate}</if>
+            <if test="updaterCode != null "> and d.updater_code = #{updaterCode}</if>
+            <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
+        and d.del_flag = 0
         </where>
     </select>
 
@@ -128,6 +130,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
+    <update id="updateTTaskRepairByIds" parameterType="String">
+        update t_task_repair set status=1 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
     <delete id="deleteTTaskRepairById" parameterType="Long">
         update t_task_repair set del_flag=1 where id = #{id}
     </delete>

+ 7 - 0
ui/src/api/task/repair.js

@@ -42,3 +42,10 @@ export function delRepair(id) {
     method: 'delete'
   })
 }
+
+export function divideRepair(id) {
+  return request({
+    url: '/task/repair/' + id,
+    method: 'put'
+  })
+}

+ 17 - 164
ui/src/views/check/inspectionCheck/index.vue

@@ -9,16 +9,26 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="任务起始时间" prop="startTime">
-        <el-date-picker clearable
+      <el-form-item label="任务类型" prop="planId">
+        <el-select v-model="form.taskType" placeholder="请选择任务类型" @change="handleQuery" clearable size="small" style="width: 100%">
+          <el-option
+            v-for="dict in taskTypeOperation"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="任务起始时间" prop="startTime" label-width="100px">
+        <el-date-picker clearable  @change="handleQuery"
                         v-model="queryParams.startTime"
                         type="date"
                         value-format="yyyy-MM-dd"
                         placeholder="请选择任务起始时间">
         </el-date-picker>
       </el-form-item>
-      <el-form-item label="任务截止时间" prop="endTime">
-        <el-date-picker clearable
+      <el-form-item label="任务截止时间" prop="endTime" label-width="100px">
+        <el-date-picker clearable @change="handleQuery"
                         v-model="queryParams.endTime"
                         type="date"
                         value-format="yyyy-MM-dd"
@@ -34,11 +44,12 @@
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
-          type="warning"
+          type="info"
           plain
           icon="el-icon-download"
           size="mini"
           @click=""
+          :disabled="single"
           v-hasPermi="['check:inspection:export']"
         >导出任务清单
         </el-button>
@@ -98,64 +109,6 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
-
-    <!-- 添加或修改检测任务对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
-        <el-form-item label="检测计划" prop="planId">
-          <el-select v-model="form.planId" placeholder="请选择计划" clearable size="small" style="width: 100%">
-            <el-option
-              v-for="dict in planOperation"
-              :key="dict.id"
-              :label="dict.inspectionPlanName"
-              :value="dict.id"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="任务名称" prop="taskName">
-          <el-input v-model="form.taskName" placeholder="请输入任务名称"/>
-        </el-form-item>
-        <el-form-item label="任务编号" prop="taskCode">
-          <el-input v-model="form.taskCode" placeholder="请输入任务编号"/>
-        </el-form-item>
-        <el-form-item label="任务类型" prop="planId">
-          <el-select v-model="form.taskType" placeholder="请选择任务类型" clearable size="small" style="width: 100%">
-            <el-option
-              v-for="dict in taskTypeOperation"
-              :key="dict.dictValue"
-              :label="dict.dictLabel"
-              :value="dict.dictValue"
-            />
-          </el-select>
-        </el-form-item>
-        <el-form-item label="任务起始时间" prop="startTime">
-          <el-date-picker clearable style="width: 100%"
-                          v-model="form.startTime"
-                          type="date"
-                          value-format="yyyy-MM-dd"
-                          placeholder="请选择任务起始时间">
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="任务截止时间" prop="endTime">
-          <el-date-picker clearable style="width: 100%"
-                          v-model="form.endTime"
-                          type="date"
-                          value-format="yyyy-MM-dd"
-                          placeholder="请选择任务截止时间">
-          </el-date-picker>
-        </el-form-item>
-        <el-form-item label="接收人" prop="recipient">
-          <el-input v-model="form.recipient" placeholder="请输入接收人"/>
-        </el-form-item>
-        <el-form-item label="备注" prop="remarks">
-          <el-input v-model="form.remarks" placeholder="请输入备注"/>
-        </el-form-item>
-      </el-form>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitForm">确 定</el-button>
-        <el-button @click="cancel">取 消</el-button>
-      </div>
-    </el-dialog>
   </div>
 </template>
 
@@ -177,6 +130,7 @@ export default {
       taskTypeOperation: [],
       planOperation: [],
       divideOperation: [],
+      timeRange:[],
       // 页面高度
       clientHeight: 300,
       // 遮罩层
@@ -273,38 +227,6 @@ export default {
         this.loading = false;
       });
     },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        plantId: null,
-        planId: null,
-        taskName: null,
-        taskCode: null,
-        taskType: null,
-        startTime: null,
-        endTime: null,
-        recipient: null,
-        taskNum: null,
-        taskDoneNum: null,
-        taskUndoneNum: null,
-        status: "0",
-        percentage: 0,
-        remarks: null,
-        deptId: null,
-        delFlag: null,
-        createrCode: null,
-        createdate: null,
-        updaterCode: null,
-        updatedate: null
-      };
-      this.resetForm("form");
-    },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
@@ -318,78 +240,9 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.status = selection.map(item => item.status)
       this.single = selection.length !== 1
       this.multiple = !selection.length
     },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加检测任务";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getInspection(id).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改检测任务";
-      });
-    },
-    handleDivide() {
-      console.log(this.status)
-      for (const statusKey in this.status) {
-        if (statusKey === "1") {
-          this.$alert('已分配的任务不可再次分配!', '注意!', {
-            confirmButtonText: '确定',
-          });
-          return
-        }
-      }
-      this.reset();
-      const ids =  this.ids
-      this.$modal.confirm('是否确认分配?').then(function () {
-        return divideInspection(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("分配成功");
-      }).catch(() => {
-        this.$modal.msg("取消分配");
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.id != null) {
-            updateInspection(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addInspection(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除数据项?').then(function () {
-        return delInspection(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {
-      });
-    },
     /** 导出按钮操作 */
     handleExport() {
       this.download('task/inspection/export', {

+ 240 - 0
ui/src/views/check/repairCheck/index.vue

@@ -0,0 +1,240 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="任务名称" prop="taskName">
+        <el-input
+          v-model="queryParams.taskName"
+          placeholder="请输入任务名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="任务类型" prop="planId">
+        <el-select v-model="queryParams.taskType" @change="handleQuery" placeholder="请选择任务类型" clearable size="small" style="width: 100%">
+          <el-option
+            v-for="dict in taskTypeOperation"
+            :key="dict.dictValue"
+            :label="dict.dictLabel"
+            :value="dict.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="任务起始时间" prop="startTime" label-width="100px">
+        <el-date-picker clearable @change="handleQuery"
+                        v-model="queryParams.startTime"
+                        type="date"
+                        value-format="yyyy-MM-dd"
+                        placeholder="请选择任务起始时间">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="任务截止时间" prop="endTime" label-width="100px">
+        <el-date-picker clearable @change="handleQuery"
+                        v-model="queryParams.endTime"
+                        type="date"
+                        value-format="yyyy-MM-dd"
+                        placeholder="请选择任务截止时间">
+        </el-date-picker>
+      </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">
+      <el-col :span="1.5">
+        <el-button
+          type="info"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :disabled="single"
+          @click=""
+          v-hasPermi="['task:repair:export']"
+        >导出任务清单
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="repairList" @selection-change="handleSelectionChange" :height="clientHeight"
+              :cell-style="tableCellStyle" border>
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="是否超时" align="center" prop="timeOut" fixed="left" width="85"/>
+      <el-table-column label="装置名称" align="center" prop="plantName" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="任务名称" align="center" prop="taskName" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="任务编号" align="center" prop="taskCode" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="任务类型" align="center" prop="taskType" :show-overflow-tooltip="true" width="130" :formatter="taskTypeFormat"/>
+      <el-table-column label="任务起始时间" align="center" prop="startTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="任务截止时间" align="center" prop="endTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="接收人" align="center" prop="recipient" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="维修点数" align="center" prop="taskNum" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="已维修点数" align="center" prop="taskDoneNum" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="未维修点数" align="center" prop="taskUndoneNum" :show-overflow-tooltip="true"
+                       width="130"/>
+      <el-table-column label="完成率" align="center" width="250" prop="percentage">
+        <template slot-scope="scope">
+          <el-progress :text-inside="true" :stroke-width="14" :percentage="scope.row.percentage"
+                       status="success"></el-progress>
+        </template>
+      </el-table-column>
+      <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="130">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-s-order"
+            @click=""
+          >维修点清单
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import {listRepair, getRepair, delRepair, addRepair, updateRepair} from "@/api/task/repair";
+import {divideInspection} from "@/api/task/inspection";
+import {getAllPlantName} from "@/api/base/plant";
+
+export default {
+  name: "Repair",
+  data() {
+    return {
+      divideOperation: [],
+      taskTypeOperation:[],
+      plantOperation:[],
+      // 页面高度
+      clientHeight: 300,
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: false,
+      // 总条数
+      total: 0,
+      // 维修任务表格数据
+      repairList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        plantId: null,
+        taskName: null,
+        taskCode: null,
+        taskType: null,
+        startTime: null,
+        endTime: null,
+        recipient: null,
+        taskNum: null,
+        taskDoneNum: null,
+        taskUndoneNum: null,
+        status: 1,
+        remarks: null,
+        deptId: null,
+        createrCode: null,
+        createdate: null,
+        updaterCode: null,
+        updatedate: null
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {}
+    };
+  },
+  created() {
+    this.getList();
+    //设置表格高度对应屏幕高度
+    this.$nextTick(() => {
+      this.clientHeight = (document.body.clientHeight - 80) * 0.8
+    });
+    this.getDicts("divide_status").then(response => {
+      this.divideOperation = response.data;
+    });
+    this.getDicts("repair_type").then(response => {
+      this.taskTypeOperation = response.data;
+    });
+    getAllPlantName().then(response => {
+      this.plantOperation = response.data;
+    });
+  },
+  methods: {
+    taskTypeFormat(row, column) {
+      return this.selectDictLabel(this.taskTypeOperation, row.taskType);
+    },
+    tableCellStyle({row, column, rowIndex, columnIndex}) {
+      if (columnIndex === 1 && row.timeOut === '是') {
+        return "color:#ff0000;";
+      }
+      if (columnIndex === 1 && row.timeOut === '否') {
+        return "color:#00cc00;";
+      }
+      if (columnIndex === 5) {
+        return "color:#00f;";
+      }
+    },
+    divideFormat(row, column) {
+      return this.selectDictLabel(this.divideOperation, row.status);
+    },
+    /** 查询维修任务列表 */
+    getList() {
+      this.loading = true;
+      listRepair(this.queryParams).then(response => {
+        this.repairList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('task/repair/export', {
+        ...this.queryParams
+      }, `repair_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>

+ 14 - 8
ui/src/views/task/inspection/index.vue

@@ -10,7 +10,7 @@
         />
       </el-form-item>
       <el-form-item label="任务类型" prop="planId">
-        <el-select v-model="form.taskType" placeholder="请选择任务类型" clearable size="small" style="width: 100%">
+        <el-select v-model="queryParams.taskType" @change="handleQuery" placeholder="请选择任务类型" clearable size="small" style="width: 100%">
           <el-option
             v-for="dict in taskTypeOperation"
             :key="dict.dictValue"
@@ -19,16 +19,16 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="任务起始时间" prop="startTime">
-        <el-date-picker clearable
+      <el-form-item label="任务起始时间" prop="startTime" label-width="100px">
+        <el-date-picker clearable @change="handleQuery"
                         v-model="queryParams.startTime"
                         type="date"
                         value-format="yyyy-MM-dd"
                         placeholder="请选择任务起始时间">
         </el-date-picker>
       </el-form-item>
-      <el-form-item label="任务截止时间" prop="endTime">
-        <el-date-picker clearable
+      <el-form-item label="任务截止时间" prop="endTime" label-width="100px">
+        <el-date-picker clearable @change="handleQuery"
                         v-model="queryParams.endTime"
                         type="date"
                         value-format="yyyy-MM-dd"
@@ -91,11 +91,12 @@
       </el-col>
       <el-col :span="1.5">
         <el-button
-          type="warning"
+          type="info"
           plain
           icon="el-icon-download"
           size="mini"
           @click=""
+          :disabled="single"
           v-hasPermi="['task:inspection:export']"
         >导出任务清单
         </el-button>
@@ -410,6 +411,12 @@ export default {
     },
     /** 修改按钮操作 */
     handleUpdate(row) {
+      for (let statusKey of this.status) {
+        if (statusKey === "1") {
+          this.$modal.alert('已分配的任务不可修改!');
+          return
+        }
+      }
       this.reset();
       const id = row.id || this.ids
       getInspection(id).then(response => {
@@ -419,8 +426,7 @@ export default {
       });
     },
     handleDivide() {
-      console.log(this.status)
-      for (const statusKey in this.status) {
+      for (let statusKey of this.status) {
         if (statusKey === "1") {
           this.$alert('已分配的任务不可再次分配!', '注意!', {
             confirmButtonText: '确定',

+ 1 - 1
ui/src/views/task/plan/index.vue

@@ -125,7 +125,7 @@
     <!-- 添加或修改检测计划对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="100px">
-        <el-form-item label="装置id" prop="plantId">
+        <el-form-item label="装置" prop="plantId">
           <el-select v-model="form.plantId" placeholder="请选择装置" clearable size="small" style="width: 100%">
             <el-option
               v-for="dict in plantOperation"

+ 57 - 16
ui/src/views/task/repair/index.vue

@@ -10,7 +10,7 @@
         />
       </el-form-item>
       <el-form-item label="任务类型" prop="planId">
-        <el-select v-model="form.taskType" placeholder="请选择任务类型" clearable size="small" style="width: 100%">
+        <el-select v-model="queryParams.taskType" @change="handleQuery" placeholder="请选择任务类型" clearable size="small" style="width: 100%">
           <el-option
             v-for="dict in taskTypeOperation"
             :key="dict.dictValue"
@@ -19,16 +19,16 @@
           />
         </el-select>
       </el-form-item>
-      <el-form-item label="任务起始时间" prop="startTime">
-        <el-date-picker clearable
+      <el-form-item label="任务起始时间" prop="startTime" label-width="100px">
+        <el-date-picker clearable @change="handleQuery"
                         v-model="queryParams.startTime"
                         type="date"
                         value-format="yyyy-MM-dd"
                         placeholder="请选择任务起始时间">
         </el-date-picker>
       </el-form-item>
-      <el-form-item label="任务截止时间" prop="endTime">
-        <el-date-picker clearable
+      <el-form-item label="任务截止时间" prop="endTime" label-width="100px">
+        <el-date-picker clearable @change="handleQuery"
                         v-model="queryParams.endTime"
                         type="date"
                         value-format="yyyy-MM-dd"
@@ -85,17 +85,18 @@
           size="mini"
           :disabled="multiple"
           @click="handleDivide"
-          v-hasPermi="['task:inspection:edit']"
+          v-hasPermi="['task:repairs:edit']"
         >确认分配
         </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
-          type="warning"
+          type="info"
           plain
           icon="el-icon-download"
           size="mini"
           @click=""
+          :disabled="single"
           v-hasPermi="['task:repair:export']"
         >导出任务清单
         </el-button>
@@ -104,15 +105,14 @@
     </el-row>
 
     <el-table v-loading="loading" :data="repairList" @selection-change="handleSelectionChange" :height="clientHeight"
-              border>
+              :cell-style="tableCellStyle" border>
       <el-table-column type="selection" width="55" align="center"/>
-      <el-table-column label="状态" align="center" prop="status" width="85" :formatter="divideFormat"/>
+      <el-table-column label="状态" align="center" prop="status" fixed="left" width="85" :formatter="divideFormat"/>
       <el-table-column label="是否超时" align="center" prop="timeOut" fixed="left" width="85"/>
       <el-table-column label="装置名称" align="center" prop="plantName" :show-overflow-tooltip="true" width="130"/>
-      <el-table-column label="装置id" align="center" prop="plantId" :show-overflow-tooltip="true" width="130"/>
       <el-table-column label="任务名称" align="center" prop="taskName" :show-overflow-tooltip="true" width="130"/>
       <el-table-column label="任务编号" align="center" prop="taskCode" :show-overflow-tooltip="true" width="130"/>
-      <el-table-column label="任务类型" align="center" prop="taskType" :show-overflow-tooltip="true" width="130"/>
+      <el-table-column label="任务类型" align="center" prop="taskType" :show-overflow-tooltip="true" width="130" :formatter="taskTypeFormat"/>
       <el-table-column label="任务起始时间" align="center" prop="startTime" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
@@ -181,6 +181,16 @@
         <el-form-item label="任务编号" prop="taskCode">
           <el-input v-model="form.taskCode" placeholder="请输入任务编号"/>
         </el-form-item>
+        <el-form-item label="装置" prop="plantId">
+          <el-select v-model="form.plantId" placeholder="请选择装置" clearable size="small" style="width: 100%">
+            <el-option
+              v-for="dict in plantOperation"
+              :key="dict.plantId"
+              :label="dict.plantName"
+              :value="dict.plantId"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item label="任务类型" prop="planId">
           <el-select v-model="form.taskType" placeholder="请选择任务类型" clearable size="small" style="width: 100%">
             <el-option
@@ -223,20 +233,24 @@
 </template>
 
 <script>
-import {listRepair, getRepair, delRepair, addRepair, updateRepair} from "@/api/task/repair";
+import {listRepair, getRepair, delRepair, addRepair, updateRepair, divideRepair} from "@/api/task/repair";
 import {divideInspection} from "@/api/task/inspection";
+import {getAllPlantName} from "@/api/base/plant";
 
 export default {
   name: "Repair",
   data() {
     return {
       divideOperation: [],
+      taskTypeOperation:[],
+      plantOperation:[],
       // 页面高度
       clientHeight: 300,
       // 遮罩层
       loading: true,
       // 选中数组
       ids: [],
+      divideStatus: [],
       // 非单个禁用
       single: true,
       // 非多个禁用
@@ -288,11 +302,37 @@ export default {
     this.getDicts("divide_status").then(response => {
       this.divideOperation = response.data;
     });
+    this.getDicts("repair_type").then(response => {
+      this.taskTypeOperation = response.data;
+    });
+    getAllPlantName().then(response => {
+      this.plantOperation = response.data;
+    });
   },
   methods: {
+    taskTypeFormat(row, column) {
+      return this.selectDictLabel(this.taskTypeOperation, row.taskType);
+    },
+    tableCellStyle({row, column, rowIndex, columnIndex}) {
+      if (columnIndex === 1 && row.status == 0) {
+        return "color:#ff0000;";
+      }
+      if (columnIndex === 1 && row.status == 1) {
+        return "color:#00cc00;";
+      }
+      if (columnIndex === 2 && row.timeOut === '是') {
+        return "color:#ff0000;";
+      }
+      if (columnIndex === 2 && row.timeOut === '否') {
+        return "color:#00cc00;";
+      }
+      if (columnIndex === 6) {
+        return "color:#00d;";
+      }
+    },
     handleDivide() {
-      console.log(this.status)
-      for (const statusKey in this.status) {
+      console.log(this.divideStatus)
+      for (let statusKey of this.divideStatus) {
         if (statusKey === "1") {
           this.$alert('已分配的任务不可再次分配!', '注意!', {
             confirmButtonText: '确定',
@@ -303,7 +343,7 @@ export default {
       this.reset();
       const ids =  this.ids
       this.$modal.confirm('是否确认分配?').then(function () {
-        //return divideRepair(ids);
+        return divideRepair(ids);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("分配成功");
@@ -335,7 +375,7 @@ export default {
         plantId: null,
         taskName: null,
         taskCode: null,
-        taskType: null,
+        taskType: '1',
         startTime: null,
         endTime: null,
         recipient: null,
@@ -366,6 +406,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
+      this.divideStatus = selection.map(item => item.status)
       this.single = selection.length !== 1
       this.multiple = !selection.length
     },