base1
This commit is contained in:
parent
3ef6000794
commit
f92b34bc35
20
ggpx/pom.xml
Normal file
20
ggpx/pom.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<version>3.8.8</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ggpx</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
104
ggpx/src/main/java/com/ruoyi/ggpx/controller/TaskController.java
Normal file
104
ggpx/src/main/java/com/ruoyi/ggpx/controller/TaskController.java
Normal file
@ -0,0 +1,104 @@
|
||||
package com.ruoyi.ggpx.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ggpx.domain.Task;
|
||||
import com.ruoyi.ggpx.service.ITaskService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 任务列表Controller
|
||||
*
|
||||
* @author Jian
|
||||
* @date 2024-08-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ggpx/task")
|
||||
public class TaskController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITaskService taskService;
|
||||
|
||||
/**
|
||||
* 查询任务列表列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ggpx:task:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Task task)
|
||||
{
|
||||
startPage();
|
||||
List<Task> list = taskService.selectTaskList(task);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出任务列表列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ggpx:task:export')")
|
||||
@Log(title = "任务列表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Task task)
|
||||
{
|
||||
List<Task> list = taskService.selectTaskList(task);
|
||||
ExcelUtil<Task> util = new ExcelUtil<Task>(Task.class);
|
||||
util.exportExcel(response, list, "任务列表数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务列表详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ggpx:task:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(taskService.selectTaskById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ggpx:task:add')")
|
||||
@Log(title = "任务列表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Task task)
|
||||
{
|
||||
return toAjax(taskService.insertTask(task));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ggpx:task:edit')")
|
||||
@Log(title = "任务列表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Task task)
|
||||
{
|
||||
return toAjax(taskService.updateTask(task));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ggpx:task:remove')")
|
||||
@Log(title = "任务列表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(taskService.deleteTaskByIds(ids));
|
||||
}
|
||||
}
|
97
ggpx/src/main/java/com/ruoyi/ggpx/domain/Task.java
Normal file
97
ggpx/src/main/java/com/ruoyi/ggpx/domain/Task.java
Normal file
@ -0,0 +1,97 @@
|
||||
package com.ruoyi.ggpx.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 任务列表对象 ggpx_task
|
||||
*
|
||||
* @author Jian
|
||||
* @date 2024-08-11
|
||||
*/
|
||||
public class Task extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** 任务名称 */
|
||||
@Excel(name = "任务名称")
|
||||
private String name;
|
||||
|
||||
/** 任务类型 */
|
||||
@Excel(name = "任务类型")
|
||||
private Integer type;
|
||||
|
||||
/** 填报标准 */
|
||||
@Excel(name = "填报标准")
|
||||
private String base;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
private Integer status;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setType(Integer type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Integer getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setBase(String base)
|
||||
{
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public String getBase()
|
||||
{
|
||||
return base;
|
||||
}
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("type", getType())
|
||||
.append("base", getBase())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
61
ggpx/src/main/java/com/ruoyi/ggpx/mapper/TaskMapper.java
Normal file
61
ggpx/src/main/java/com/ruoyi/ggpx/mapper/TaskMapper.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.ggpx.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ggpx.domain.Task;
|
||||
|
||||
/**
|
||||
* 任务列表Mapper接口
|
||||
*
|
||||
* @author Jian
|
||||
* @date 2024-08-11
|
||||
*/
|
||||
public interface TaskMapper
|
||||
{
|
||||
/**
|
||||
* 查询任务列表
|
||||
*
|
||||
* @param id 任务列表主键
|
||||
* @return 任务列表
|
||||
*/
|
||||
public Task selectTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询任务列表列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 任务列表集合
|
||||
*/
|
||||
public List<Task> selectTaskList(Task task);
|
||||
|
||||
/**
|
||||
* 新增任务列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTask(Task task);
|
||||
|
||||
/**
|
||||
* 修改任务列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTask(Task task);
|
||||
|
||||
/**
|
||||
* 删除任务列表
|
||||
*
|
||||
* @param id 任务列表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除任务列表
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTaskByIds(Long[] ids);
|
||||
}
|
61
ggpx/src/main/java/com/ruoyi/ggpx/service/ITaskService.java
Normal file
61
ggpx/src/main/java/com/ruoyi/ggpx/service/ITaskService.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.ggpx.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ggpx.domain.Task;
|
||||
|
||||
/**
|
||||
* 任务列表Service接口
|
||||
*
|
||||
* @author Jian
|
||||
* @date 2024-08-11
|
||||
*/
|
||||
public interface ITaskService
|
||||
{
|
||||
/**
|
||||
* 查询任务列表
|
||||
*
|
||||
* @param id 任务列表主键
|
||||
* @return 任务列表
|
||||
*/
|
||||
public Task selectTaskById(Long id);
|
||||
|
||||
/**
|
||||
* 查询任务列表列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 任务列表集合
|
||||
*/
|
||||
public List<Task> selectTaskList(Task task);
|
||||
|
||||
/**
|
||||
* 新增任务列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTask(Task task);
|
||||
|
||||
/**
|
||||
* 修改任务列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTask(Task task);
|
||||
|
||||
/**
|
||||
* 批量删除任务列表
|
||||
*
|
||||
* @param ids 需要删除的任务列表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTaskByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除任务列表信息
|
||||
*
|
||||
* @param id 任务列表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTaskById(Long id);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.ruoyi.ggpx.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.ggpx.mapper.TaskMapper;
|
||||
import com.ruoyi.ggpx.domain.Task;
|
||||
import com.ruoyi.ggpx.service.ITaskService;
|
||||
|
||||
/**
|
||||
* 任务列表Service业务层处理
|
||||
*
|
||||
* @author Jian
|
||||
* @date 2024-08-11
|
||||
*/
|
||||
@Service
|
||||
public class TaskServiceImpl implements ITaskService
|
||||
{
|
||||
@Autowired
|
||||
private TaskMapper taskMapper;
|
||||
|
||||
/**
|
||||
* 查询任务列表
|
||||
*
|
||||
* @param id 任务列表主键
|
||||
* @return 任务列表
|
||||
*/
|
||||
@Override
|
||||
public Task selectTaskById(Long id)
|
||||
{
|
||||
return taskMapper.selectTaskById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询任务列表列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 任务列表
|
||||
*/
|
||||
@Override
|
||||
public List<Task> selectTaskList(Task task)
|
||||
{
|
||||
return taskMapper.selectTaskList(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTask(Task task)
|
||||
{
|
||||
task.setCreateTime(DateUtils.getNowDate());
|
||||
return taskMapper.insertTask(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务列表
|
||||
*
|
||||
* @param task 任务列表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTask(Task task)
|
||||
{
|
||||
task.setUpdateTime(DateUtils.getNowDate());
|
||||
return taskMapper.updateTask(task);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除任务列表
|
||||
*
|
||||
* @param ids 需要删除的任务列表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTaskByIds(Long[] ids)
|
||||
{
|
||||
return taskMapper.deleteTaskByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务列表信息
|
||||
*
|
||||
* @param id 任务列表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTaskById(Long id)
|
||||
{
|
||||
return taskMapper.deleteTaskById(id);
|
||||
}
|
||||
}
|
87
ggpx/src/main/resources/mapper/ggpx/TaskMapper.xml
Normal file
87
ggpx/src/main/resources/mapper/ggpx/TaskMapper.xml
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ggpx.mapper.TaskMapper">
|
||||
|
||||
<resultMap type="Task" id="TaskResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="base" column="base" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTaskVo">
|
||||
select id, name, type, base, status, create_by, create_time, update_by, update_time from ggpx_task
|
||||
</sql>
|
||||
|
||||
<select id="selectTaskList" parameterType="Task" resultMap="TaskResult">
|
||||
<include refid="selectTaskVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="type != null "> and type = #{type}</if>
|
||||
<if test="base != null and base != ''"> and base = #{base}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTaskById" parameterType="Long" resultMap="TaskResult">
|
||||
<include refid="selectTaskVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTask" parameterType="Task" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ggpx_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="base != null">base,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="base != null">#{base},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTask" parameterType="Task">
|
||||
update ggpx_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="base != null">base = #{base},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTaskById" parameterType="Long">
|
||||
delete from ggpx_task where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTaskByIds" parameterType="String">
|
||||
delete from ggpx_task where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
44
ruoyi-ui/src/api/ggpx/submit.js
Normal file
44
ruoyi-ui/src/api/ggpx/submit.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询任务填报列表
|
||||
export function listSubmit(query) {
|
||||
return request({
|
||||
url: '/ggpx/submit/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询任务填报详细
|
||||
export function getSubmit(id) {
|
||||
return request({
|
||||
url: '/ggpx/submit/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增任务填报
|
||||
export function addSubmit(data) {
|
||||
return request({
|
||||
url: '/ggpx/submit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改任务填报
|
||||
export function updateSubmit(data) {
|
||||
return request({
|
||||
url: '/ggpx/submit',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除任务填报
|
||||
export function delSubmit(id) {
|
||||
return request({
|
||||
url: '/ggpx/submit/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
44
ruoyi-ui/src/api/ggpx/task.js
Normal file
44
ruoyi-ui/src/api/ggpx/task.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询任务列表列表
|
||||
export function listTask(query) {
|
||||
return request({
|
||||
url: '/ggpx/task/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询任务列表详细
|
||||
export function getTask(id) {
|
||||
return request({
|
||||
url: '/ggpx/task/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增任务列表
|
||||
export function addTask(data) {
|
||||
return request({
|
||||
url: '/ggpx/task',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改任务列表
|
||||
export function updateTask(data) {
|
||||
return request({
|
||||
url: '/ggpx/task',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除任务列表
|
||||
export function delTask(id) {
|
||||
return request({
|
||||
url: '/ggpx/task/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -8,6 +8,7 @@ export default class DictData {
|
||||
constructor(label, value, raw) {
|
||||
this.label = label
|
||||
this.value = value
|
||||
this.remark = raw.remark
|
||||
this.raw = raw
|
||||
}
|
||||
}
|
||||
|
112
ruoyi-ui/src/views/ggpx/submit/form.vue
Normal file
112
ruoyi-ui/src/views/ggpx/submit/form.vue
Normal file
@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="taskData.type === 1">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="样品名称">
|
||||
<el-input v-model="form.ypmc" placeholder="请输入样品名称"></el-input>
|
||||
</el-form-item>
|
||||
<div v-for="(item, index) in form.data" :key="index">
|
||||
<h3>{{ item.label }}</h3>
|
||||
<el-form-item v-for="(child, index) in item.children" :label="child.label" :key="index">
|
||||
<el-input-number v-model="child.value" :min="0" :max="child.maxScore" :step="0.5"
|
||||
:precision="1"></el-input-number>
|
||||
<span>满分{{ child.maxScore }}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="质量水平">
|
||||
<el-radio-group v-model="form.zlpx">
|
||||
<el-radio label="高端" value="高端"></el-radio>
|
||||
<el-radio label="1类" value="1类"></el-radio>
|
||||
<el-radio label="2类" value="2类"></el-radio>
|
||||
<el-radio label="其他" value="其他"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="品质描述">
|
||||
<el-input v-model="form.pzms" placeholder="请输入品质描述"></el-input>
|
||||
</el-form-item>
|
||||
<div style="display: flex; justify-content: center;margin: 20px">
|
||||
<el-button type="success" @click="submitForm">提交</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div v-if="taskData.type === 2">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item v-for="(item, index) in form.data" :label="item.name" :key="index">
|
||||
<el-input v-if="item.type === 'text'" v-model="item.value" :placeholder="item.name"></el-input>
|
||||
<el-radio-group v-if="item.type === 'radio'" v-model="item.value">
|
||||
<el-radio label="是" value="是"></el-radio>
|
||||
<el-radio label="否" value="否"></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div style="display: flex; justify-content: center;margin: 20px">
|
||||
<el-button type="success" @click="submitForm">提交</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "SubmitForm",
|
||||
props: {
|
||||
taskData: {
|
||||
type: Object, default: () => {
|
||||
},
|
||||
},
|
||||
reset: {
|
||||
type: Boolean, default: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
data: [],
|
||||
},
|
||||
rules: {},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
taskData: {
|
||||
handler(newValue) {
|
||||
let data = JSON.parse(newValue.base);
|
||||
console.log("watch", data)
|
||||
data.forEach(item => {
|
||||
if (item.type === 'radio') {
|
||||
item.value ? item.value : '是';
|
||||
} else {
|
||||
item.value ? item.value : null;
|
||||
}
|
||||
})
|
||||
this.$set(this.form, "data", data)
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
console.log("submitForm", this.form)
|
||||
|
||||
const formData = {
|
||||
taskId: this.$route.params.id,
|
||||
data: JSON.stringify(this.form.data)
|
||||
};
|
||||
if (this.taskData.type === 1) {
|
||||
formData.ypmc = this.form.ypmc ? this.form.ypmc : null;
|
||||
formData.zlpx = this.form.zlpx ? this.form.zlpx : null;
|
||||
formData.pzms = this.form.pzms ? this.form.pzms : null;
|
||||
}
|
||||
|
||||
this.$emit('submitForm', formData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
306
ruoyi-ui/src/views/ggpx/submit/index.vue
Normal file
306
ruoyi-ui/src/views/ggpx/submit/index.vue
Normal file
@ -0,0 +1,306 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<h2>{{ taskData ? taskData.name : '' }}</h2>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<!-- <el-form-item label="任务id" prop="taskId">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.taskId"-->
|
||||
<!-- placeholder="请输入任务id"-->
|
||||
<!-- clearable-->
|
||||
<!-- @keyup.enter.native="handleQuery"-->
|
||||
<!-- />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- <el-form-item label="填报人id" prop="userId">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="queryParams.userId"-->
|
||||
<!-- placeholder="请输入填报人id"-->
|
||||
<!-- 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-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-if="taskData.status===1"
|
||||
v-hasPermi="['ggpx:submit:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="success"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="single"-->
|
||||
<!-- @click="handleUpdate"-->
|
||||
<!-- v-hasPermi="['ggpx:submit:edit']"-->
|
||||
<!-- >修改-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="multiple"-->
|
||||
<!-- @click="handleDelete"-->
|
||||
<!-- v-hasPermi="['ggpx:submit:remove']"-->
|
||||
<!-- >删除-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['ggpx:submit:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-close"
|
||||
size="mini"
|
||||
@click="handleClose"
|
||||
>关闭
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="submitList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="id" align="center" prop="id"/>
|
||||
<!-- <el-table-column label="任务id" align="center" prop="taskId"/>-->
|
||||
<!-- <el-table-column label="填报数据" align="center" prop="data"/>-->
|
||||
<!-- <el-table-column label="状态" align="center" prop="status"/>-->
|
||||
<!-- <el-table-column label="填报人id" align="center" prop="userId"/>-->
|
||||
<el-table-column label="填报人" align="center" prop="createBy"/>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['ggpx:submit:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['ggpx:submit:remove']"
|
||||
>删除
|
||||
</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"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改任务填报对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" fullscreen append-to-body>
|
||||
<submit-form :task-data="taskData" @submitForm="submitForm"></submit-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listTask, getTask, delTask, addTask, updateTask} from "@/api/ggpx/task";
|
||||
import {listSubmit, getSubmit, delSubmit, addSubmit, updateSubmit} from "@/api/ggpx/submit";
|
||||
import SubmitForm from "./form.vue";
|
||||
|
||||
export default {
|
||||
name: "Submit",
|
||||
components: {SubmitForm},
|
||||
data() {
|
||||
return {
|
||||
taskData: null,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 任务填报表格数据
|
||||
submitList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
taskId: null,
|
||||
data: null,
|
||||
status: null,
|
||||
userId: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
taskId: [
|
||||
{required: true, message: "任务id不能为空", trigger: "blur"}
|
||||
],
|
||||
userId: [
|
||||
{required: true, message: "填报人id不能为空", trigger: "blur"}
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getTask();
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询任务填报列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.taskId = this.$route.params.id;
|
||||
listSubmit(this.queryParams).then(response => {
|
||||
this.submitList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
getTask() {
|
||||
const id = this.$route.params.id;
|
||||
getTask(id).then(response => {
|
||||
this.taskData = response.data;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
taskId: null,
|
||||
data: null,
|
||||
status: null,
|
||||
userId: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
this.getTask();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
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
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
console.log("add taskData....", this.taskData);
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "新增" + this.taskData.name + "填报信息";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
console.log("edit taskData....", this.taskData);
|
||||
const id = row.id || this.ids
|
||||
getSubmit(id).then(response => {
|
||||
this.form = response.data;
|
||||
console.log("getSubmit....", response.data.data);
|
||||
this.$set(this.taskData, "base", response.data.data)
|
||||
this.open = true;
|
||||
this.title = "修改" + this.taskData.name + "填报信息";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm(form) {
|
||||
console.log("form1111....", form);
|
||||
if (this.form.id != null) {
|
||||
form.id = this.form.id;
|
||||
updateSubmit(form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addSubmit(form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除任务填报编号为"' + ids + '"的数据项?').then(function () {
|
||||
return delSubmit(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
,
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('ggpx/submit/export', {
|
||||
...this.queryParams
|
||||
}, `submit_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
,
|
||||
/** 返回按钮操作 */
|
||||
handleClose() {
|
||||
const obj = {path: "/ggpx/task"};
|
||||
this.$tab.closeOpenPage(obj);
|
||||
}
|
||||
,
|
||||
}
|
||||
};
|
||||
</script>
|
332
ruoyi-ui/src/views/ggpx/task/index.vue
Normal file
332
ruoyi-ui/src/views/ggpx/task/index.vue
Normal file
@ -0,0 +1,332 @@
|
||||
<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="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
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-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5" style="margin-top: 10px">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['ggpx:task:add']"
|
||||
>添加
|
||||
</el-button>
|
||||
</el-col>
|
||||
<!-- <el-col :span="1.5">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="success"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-edit"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="single"-->
|
||||
<!-- @click="handleUpdate"-->
|
||||
<!-- v-hasPermi="['ggpx:task:edit']"-->
|
||||
<!-- >修改-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- <el-col :span="1.5" style="margin-top: 10px">-->
|
||||
<!-- <el-button-->
|
||||
<!-- type="danger"-->
|
||||
<!-- plain-->
|
||||
<!-- icon="el-icon-delete"-->
|
||||
<!-- size="mini"-->
|
||||
<!-- :disabled="multiple"-->
|
||||
<!-- @click="handleDelete"-->
|
||||
<!-- v-hasPermi="['ggpx:task:remove']"-->
|
||||
<!-- >删除-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="1.5" style="margin-top: 10px">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['ggpx:task:export']"
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" style="margin-top: 15px"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
|
||||
<!-- <el-table-column type="selection" width="55" align="center"/>-->
|
||||
<el-table-column label="id" align="center" prop="id"/>
|
||||
<el-table-column label="任务名称" align="center" prop="name">
|
||||
<template slot-scope="scope">
|
||||
<router-link :to="'/ggpx/submit/' + scope.row.id" class="link-type">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</router-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="填报标准" align="center" prop="base"/>-->
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" size="mini" v-if="scope.row.status === 1">启用</el-tag>
|
||||
<el-tag type="danger" size="mini" v-if="scope.row.status === 0">禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['ggpx:task:edit']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
v-if="scope.row.status === 0"
|
||||
@click="handleStart(scope.row)"
|
||||
v-hasPermi="['ggpx:task:edit']"
|
||||
>启用
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleEnd(scope.row)"
|
||||
v-if="scope.row.status === 1"
|
||||
v-hasPermi="['ggpx:task:edit']"
|
||||
>禁用
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['ggpx:task:remove']"
|
||||
>删除
|
||||
</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"
|
||||
/>
|
||||
|
||||
<!-- <!– 添加或修改任务列表对话框 –>-->
|
||||
<!-- <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="name">-->
|
||||
<!-- <el-input v-model="form.name" 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>-->
|
||||
|
||||
<el-dialog :title="title" :visible.sync="open" fullscreen append-to-body>
|
||||
<div style="display: flex; justify-content: center;margin: 20px">
|
||||
<el-radio-group v-model="taskType" size="mini" :disabled="title.includes('修改')">
|
||||
<el-radio-button :label="1">任务类型1</el-radio-button>
|
||||
<el-radio-button :label="2">任务类型2</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<Task1 @submit="submitForm" :task-data="form" :reset="title.includes('添加任务')" v-if="taskType === 1"></Task1>
|
||||
<Task2 @submit="submitForm" :task-data="form" :reset="title.includes('添加任务')" v-if="taskType === 2"></Task2>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listTask, getTask, delTask, addTask, updateTask} from "@/api/ggpx/task";
|
||||
import Task1 from "./task1.vue";
|
||||
import Task2 from "./task2.vue";
|
||||
|
||||
|
||||
export default {
|
||||
name: "Task",
|
||||
components: {Task1, Task2},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 任务列表表格数据
|
||||
taskList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
taskType: 1,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
base: null,
|
||||
status: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
// 计算树形taskType
|
||||
|
||||
methods: {
|
||||
/** 查询任务列表列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listTask(this.queryParams).then(response => {
|
||||
this.taskList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
type: this.taskType,
|
||||
fields: [],
|
||||
base: null,
|
||||
status: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
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
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加任务";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getTask(id).then(response => {
|
||||
console.log("response.data", response.data);
|
||||
this.form = response.data;
|
||||
this.taskType = response.data.type;
|
||||
this.open = true;
|
||||
this.title = "修改任务";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.getList();
|
||||
this.open = false;
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除任务列表编号为"' + ids + '"的数据项?').then(function () {
|
||||
return delTask(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('ggpx/task/export', {
|
||||
...this.queryParams
|
||||
}, `task_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleStart(row) {
|
||||
console.log("row.status", row.status);
|
||||
// 改成可以设置窗体大小的弹窗
|
||||
this.$confirm('确认要启用任务吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
customClass: 'my-modal',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
updateTask({id: row.id, status: 1}).then(response => {
|
||||
this.$modal.msgSuccess("启用成功");
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
},
|
||||
handleEnd(row) {
|
||||
console.log("row.status", row.status);
|
||||
// 改成可以设置窗体大小的弹窗
|
||||
this.$confirm('确认要禁用任务吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
customClass: 'my-modal',
|
||||
type: 'warning',
|
||||
}).then(() => {
|
||||
updateTask({id: row.id, status: 0}).then(response => {
|
||||
this.$modal.msgSuccess("禁用成功");
|
||||
this.getList();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.my-modal {
|
||||
width: 300px;
|
||||
}
|
||||
</style>
|
393
ruoyi-ui/src/views/ggpx/task/task1.vue
Normal file
393
ruoyi-ui/src/views/ggpx/task/task1.vue
Normal file
@ -0,0 +1,393 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-form form="taskForm" :model="treeTemplate" label-width="100px">
|
||||
<el-form-item label="任务名称">
|
||||
<el-input v-model="form.name" placeholder="请输入任务名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="指标模板">
|
||||
<el-select @change="templateChange" v-model="treeTemplate.remark" placeholder="请选择评价标准模板"
|
||||
style="width: 200px" clearable>
|
||||
<el-option
|
||||
v-for="item in dict.type.ggpx_tree_template"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.remark">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div class="block">
|
||||
<el-divider>指标体系</el-divider>
|
||||
<el-tree
|
||||
:data="tree"
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
:expand-on-click-node="false">
|
||||
<span class="custom-tree-node" slot-scope="{ node, data }">
|
||||
<span>{{ node.label }}</span>
|
||||
<span>
|
||||
<span style="margin-right: 10px" v-show="node.level>=2">
|
||||
{{ node.data.isTotal === 1 ? '+' : '' }}{{ node.data.maxScore }}
|
||||
</span>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="editTreeItem(node, data)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
:disabled="node.level>=2"
|
||||
@click="addTreeItem(node,data)">
|
||||
添加
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="remove(node, data)">
|
||||
删除
|
||||
</el-button>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
<div style="display: flex; justify-content: right;margin-top: 20px">
|
||||
<el-tag>其他: {{ totalOtherScore }}</el-tag>
|
||||
<el-tag>+总分: {{ totalMaxScore }}</el-tag>
|
||||
<el-tag>全部: {{ totalOtherScore + totalMaxScore }}</el-tag>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: center;margin-top: 20px">
|
||||
<el-button type="primary" @click="addLevel1">添加1级指标</el-button>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: center;margin-top: 20px">
|
||||
<el-button type="success" @click="createTask">保存任务</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-dialog
|
||||
append-to-body
|
||||
:title="dialogTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
width="350px"
|
||||
:before-close="handleClose">
|
||||
<el-divider>{{ this.isChild ? 2 : 1 }}级指标</el-divider>
|
||||
<el-form ref="dialogForm" :model="dialogForm" label-width="80px" :rules="dialogFormRule">
|
||||
<el-form-item label="指标名称" prop="label">
|
||||
<el-input v-model="dialogForm.label" placeholder="请输入指标名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="this.isChild" label="满分" prop="maxScore">
|
||||
<el-input-number :min="0" :max="100" v-model="dialogForm.maxScore"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="this.isChild" label="记入总分" prop="isTotal">
|
||||
<el-radio-group v-model="dialogForm.isTotal">
|
||||
<el-radio :label="1" checked>是</el-radio>
|
||||
<el-radio :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="this.isChild" label="备注" prop="remark">
|
||||
<el-input v-model="dialogForm.remark" placeholder="请输入备注"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleTreeItem(isChild)">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addTask, updateTask} from "@/api/ggpx/task";
|
||||
|
||||
export default {
|
||||
name: "Task1",
|
||||
dicts: ['ggpx_tree_template'],
|
||||
props: {
|
||||
treeProp: {type: Array, default: () => []},
|
||||
taskData: {type: Object, default: () => {}},
|
||||
reset: {type: Boolean, default: false},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
treeTemplate: {
|
||||
remark: null
|
||||
},
|
||||
|
||||
id: 100,
|
||||
totalMaxScore: 0,
|
||||
totalOtherScore: 0,
|
||||
// 对话框显示
|
||||
dialogVisible: false,
|
||||
dialogTitle: null,
|
||||
dialogNode: null,
|
||||
dialogData: null,
|
||||
dialogForm: {},
|
||||
isChild: false,
|
||||
dialogFormRule: {
|
||||
label: [
|
||||
{required: true, message: '请输入指标名称', trigger: 'blur'},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
let count = 0;
|
||||
const tree = this.tree;
|
||||
for (let level1 of tree) {
|
||||
if (level1.label === value) {
|
||||
count++;
|
||||
}
|
||||
if (level1.children && level1.children.length > 0) {
|
||||
for (let level2 of level1.children) {
|
||||
if (level2.label === value) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// this.dialogTitle === '添加指标' 时可以重复0次
|
||||
// this.dialogTitle === '修改指标' 时可以重复1次
|
||||
if (this.dialogTitle === '添加指标') {
|
||||
if (count > 0) {
|
||||
callback(new Error('指标名称重复'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
} else if (this.dialogTitle === '修改指标') {
|
||||
if (count > 1) {
|
||||
callback(new Error('指标名称重复'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}, trigger: 'blur'
|
||||
},
|
||||
],
|
||||
maxScore: [
|
||||
{required: true, message: '请输入指标满分', trigger: 'blur'},
|
||||
],
|
||||
isTotal: [
|
||||
{required: true, message: '请选择是否记入总分', trigger: 'blur'},
|
||||
],
|
||||
},
|
||||
tree: [],
|
||||
form: {
|
||||
name: null,
|
||||
base: null
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
treeProp: {
|
||||
handler(newValue) {
|
||||
this.tree = newValue;
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
},
|
||||
taskData: {
|
||||
handler(newValue) {
|
||||
if (newValue) {
|
||||
this.form = newValue;
|
||||
if (newValue.base) {
|
||||
this.tree = JSON.parse(newValue.base);
|
||||
}else{
|
||||
if(this.treeTemplate.remark){
|
||||
this.tree = JSON.parse(this.treeTemplate.remark);
|
||||
}else{
|
||||
this.tree = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
},
|
||||
reset: {
|
||||
handler(newValue) {
|
||||
if (newValue) {
|
||||
this.tree = [];
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
},
|
||||
// 计算tree累计maxScore
|
||||
tree: {
|
||||
handler(newValue) {
|
||||
let total = 0;
|
||||
let other = 0;
|
||||
if (newValue instanceof String) {
|
||||
return;
|
||||
}
|
||||
// 计算累计maxScore
|
||||
newValue.forEach(group => {
|
||||
if (group.children) {
|
||||
group.children.forEach(criterion => {
|
||||
if (criterion.isTotal === 0) {
|
||||
other += criterion.maxScore;
|
||||
} else {
|
||||
total += criterion.maxScore;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
this.totalMaxScore = total;
|
||||
this.totalOtherScore = other;
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
templateChange(value) {
|
||||
if (!value) {
|
||||
this.tree = [];
|
||||
}
|
||||
if (value) {
|
||||
let tree = JSON.parse(value);
|
||||
if (tree instanceof Array) {
|
||||
this.tree = tree;
|
||||
}
|
||||
}
|
||||
},
|
||||
appendChildren(node, data) {
|
||||
const formData = this.dialogForm;
|
||||
|
||||
if (this.tree.length === 0) {
|
||||
this.tree.push(formData);
|
||||
return
|
||||
}
|
||||
|
||||
const newChild = {
|
||||
id: this.id++,
|
||||
label: formData.label,
|
||||
maxScore: formData.maxScore,
|
||||
remark: formData.remark,
|
||||
isTotal: formData.isTotal,
|
||||
children: [],
|
||||
score: 0
|
||||
};
|
||||
if (!data.children) {
|
||||
this.$set(data, 'children', []);
|
||||
}
|
||||
data.children.push(newChild);
|
||||
},
|
||||
update(node, data) {
|
||||
const formData = this.dialogForm;
|
||||
data.label = formData.label;
|
||||
data.maxScore = formData.maxScore;
|
||||
data.remark = formData.remark;
|
||||
},
|
||||
remove(node, data) {
|
||||
const parent = node.parent;
|
||||
const children = parent.data.children || parent.data;
|
||||
const index = children.findIndex(d => d.id === data.id);
|
||||
children.splice(index, 1);
|
||||
},
|
||||
handleClose(done) {
|
||||
this.dialogVisible = false;
|
||||
},
|
||||
addTreeItem(node, data) {
|
||||
this.resetDialog();
|
||||
this.dialogNode = node;
|
||||
this.dialogData = data;
|
||||
this.isChild = true;
|
||||
this.dialogVisible = true;
|
||||
this.dialogTitle = '添加指标';
|
||||
},
|
||||
addLevel1() {
|
||||
this.resetDialog();
|
||||
this.isChild = false;
|
||||
this.dialogVisible = true;
|
||||
this.dialogTitle = '添加指标';
|
||||
},
|
||||
editTreeItem(node, data) {
|
||||
if (node.level > 1) {
|
||||
this.isChild = true;
|
||||
} else {
|
||||
this.isChild = false;
|
||||
}
|
||||
this.dialogForm = data;
|
||||
this.dialogNode = node;
|
||||
this.dialogData = data;
|
||||
this.dialogVisible = true;
|
||||
this.dialogTitle = '修改指标';
|
||||
},
|
||||
handleTreeItem(isChild) {
|
||||
// 校验数据
|
||||
let passRules = true;
|
||||
this.$refs.dialogForm.validate((valid) => {
|
||||
if (!valid) {
|
||||
passRules = false;
|
||||
}
|
||||
});
|
||||
if (!passRules) {
|
||||
return
|
||||
}
|
||||
|
||||
// 更新树节点
|
||||
if (this.dialogTitle === '添加指标') {
|
||||
if (isChild) {
|
||||
this.appendChildren(this.dialogNode, this.dialogData)
|
||||
} else {
|
||||
this.tree.push(this.dialogForm);
|
||||
}
|
||||
} else if (this.dialogTitle === '修改指标') {
|
||||
this.update(this.dialogNode, this.dialogData)
|
||||
}
|
||||
this.dialogVisible = false;
|
||||
|
||||
},
|
||||
// 表单重置
|
||||
resetDialog() {
|
||||
this.dialogForm = {
|
||||
id: this.id++,
|
||||
label: null,
|
||||
maxScore: 0,
|
||||
remark: null,
|
||||
isTotal: 1,
|
||||
}
|
||||
},
|
||||
createTask() {
|
||||
if (!this.form.name) {
|
||||
this.$message({message: '请输入任务名称', type: 'error'});
|
||||
return
|
||||
}
|
||||
if (this.tree.length === 0) {
|
||||
this.$message({message: '请添加指标体系', type: 'error'});
|
||||
return
|
||||
}
|
||||
this.form.base = JSON.stringify(this.tree);
|
||||
|
||||
this.submitForm();
|
||||
this.$emit('submit');
|
||||
},
|
||||
submitForm() {
|
||||
// 处理表单提交逻辑
|
||||
this.form.type = 1;
|
||||
console.log("task1 submitForm", this.form);
|
||||
if (this.form.id != null) {
|
||||
updateTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
});
|
||||
} else {
|
||||
addTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.custom-tree-node {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
210
ruoyi-ui/src/views/ggpx/task/task2.vue
Normal file
210
ruoyi-ui/src/views/ggpx/task/task2.vue
Normal file
@ -0,0 +1,210 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-form :model="fieldsTemplate" label-width="100px">
|
||||
<el-form-item label="任务名称">
|
||||
<el-input v-model="form.name" placeholder="请输入任务名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="字段模板">
|
||||
<el-select @change="templateChange" v-model="fieldsTemplate.remark" placeholder="请选择字段模板"
|
||||
style="width: 200px" clearable>
|
||||
<el-option
|
||||
v-for="item in dict.type.ggpx_fields_template"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.remark">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<div>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-divider>字段列表</el-divider>
|
||||
<div v-for="(field, index) in form.fields" :key="index">
|
||||
<el-form-item :label="`字段 ${index + 1}`" :prop="'fields.'+index+'.name'">
|
||||
<el-input v-model="field.name" placeholder="请输入字段名">
|
||||
<el-select slot="prepend" size="mini" v-model="field.type" placeholder="请选择字段类型"
|
||||
style="width: 90px">
|
||||
<el-option label="字符串" value="text"></el-option>
|
||||
<el-option label="选择" value="radio"></el-option>
|
||||
<!-- 可以继续添加其他字段类型 -->
|
||||
</el-select>
|
||||
<el-button style="color: red" slot="append" size="mini" icon="el-icon-delete"
|
||||
@click="deleteField(index)">
|
||||
</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div style="display: flex; justify-content: center;margin-top: 20px">
|
||||
<el-button type="primary" @click="addField">添加字段</el-button>
|
||||
</div>
|
||||
<!-- 如果需要提交表单,可以添加一个提交按钮 -->
|
||||
<div style="display: flex; justify-content: center;margin-top: 20px">
|
||||
<el-button type="success" @click="createTask">保存任务</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listTask, getTask, delTask, addTask, updateTask} from "@/api/ggpx/task";
|
||||
|
||||
export default {
|
||||
name: "Task2",
|
||||
dicts: ['ggpx_fields_template'],
|
||||
props: {
|
||||
fieldsProp: {type: Array, default: () => []},
|
||||
taskData: {
|
||||
type: Object, default: () => {
|
||||
}
|
||||
},
|
||||
reset: {type: Boolean, default: false},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fieldsTemplate: {
|
||||
remark: null
|
||||
},
|
||||
form: {
|
||||
fields: [],
|
||||
},
|
||||
rules: {},
|
||||
filedNameRules: [{required: true, message: '请输入字段名', trigger: 'blur'},
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
// 检查字段名是否重复
|
||||
let count = 0;
|
||||
this.form.fields.forEach((field) => {
|
||||
if (field.name && field.name === value) {
|
||||
count++;
|
||||
}
|
||||
});
|
||||
if (count > 1) {
|
||||
callback(new Error('字段名重复'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
fieldsProp: {
|
||||
handler(newValue) {
|
||||
this.form.fields = newValue;
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
},
|
||||
taskData: {
|
||||
handler(newValue) {
|
||||
if (newValue) {
|
||||
// 防止无限循环更新
|
||||
if (newValue !== this.form) {
|
||||
if (newValue.base) {
|
||||
newValue.fields = JSON.parse(newValue.base);
|
||||
} else {
|
||||
if (this.fieldsTemplate.remark) {
|
||||
newValue.fields = JSON.parse(this.fieldsTemplate.remark);
|
||||
} else {
|
||||
newValue.fields = [];
|
||||
}
|
||||
}
|
||||
this.form = newValue;
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
},
|
||||
|
||||
reset: {
|
||||
handler(newValue) {
|
||||
if (newValue) {
|
||||
this.form.fields = [];
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
},
|
||||
'form.fields': {
|
||||
handler(newValue) {
|
||||
//更新校验规则
|
||||
newValue.forEach((field, index) => {
|
||||
this.$set(this.rules, `fields.${index}.name`, this.filedNameRules)
|
||||
})
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
templateChange(value) {
|
||||
if (!value) {
|
||||
this.form.fields = [];
|
||||
}
|
||||
if (value) {
|
||||
let fields = JSON.parse(value);
|
||||
if (fields instanceof Array) {
|
||||
this.form.fields = fields;
|
||||
}
|
||||
}
|
||||
},
|
||||
addField() {
|
||||
const newItem = {name: null, type: 'text'};
|
||||
this.$set(this.form.fields, this.form.fields.length, newItem);
|
||||
// this.$set(this.rules, `fields.${this.form.fields.length - 1}.name`, this.filedNameRules)
|
||||
},
|
||||
|
||||
deleteField(index) {
|
||||
// 删除元素更新节点
|
||||
this.form.fields.splice(index, 1);
|
||||
},
|
||||
createTask() {
|
||||
if (!this.form.name) {
|
||||
this.$message({message: '请输入任务名称', type: 'error'});
|
||||
return
|
||||
}
|
||||
if (this.form.fields.length === 0) {
|
||||
this.$message({message: '请添加字段列表', type: 'error'});
|
||||
return
|
||||
}
|
||||
let passRules = true;
|
||||
// 手动校验表单
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) {
|
||||
passRules = false;
|
||||
}
|
||||
});
|
||||
if (!passRules) {
|
||||
return
|
||||
}
|
||||
this.form.base = JSON.stringify(this.form.fields);
|
||||
// 处理表单提交逻辑
|
||||
this.submitForm();
|
||||
this.$emit('submit');
|
||||
},
|
||||
submitForm() {
|
||||
this.form.type = 2;
|
||||
console.log("task2 submitForm", this.form);
|
||||
// 处理表单提交逻辑
|
||||
if (this.form.id != null) {
|
||||
updateTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
});
|
||||
} else {
|
||||
addTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* 你的样式 */
|
||||
</style>
|
@ -29,7 +29,8 @@
|
||||
</el-col>
|
||||
<!--用户数据-->
|
||||
<el-col :span="20" :xs="24">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-form-item label="用户名称" prop="userName">
|
||||
<el-input
|
||||
v-model="queryParams.userName"
|
||||
@ -89,7 +90,8 @@
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:user:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -100,7 +102,8 @@
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:user:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -111,7 +114,8 @@
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:user:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -121,7 +125,8 @@
|
||||
size="mini"
|
||||
@click="handleImport"
|
||||
v-hasPermi="['system:user:import']"
|
||||
>导入</el-button>
|
||||
>导入
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@ -131,7 +136,8 @@
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:user:export']"
|
||||
>导出</el-button>
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
@ -139,10 +145,14 @@
|
||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="50" align="center"/>
|
||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible"/>
|
||||
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
||||
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible"
|
||||
:show-overflow-tooltip="true"/>
|
||||
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible"
|
||||
:show-overflow-tooltip="true"/>
|
||||
<el-table-column label="部门" align="center" key="deptName" prop="dept.deptName" v-if="columns[3].visible"
|
||||
:show-overflow-tooltip="true"/>
|
||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber"
|
||||
v-if="columns[4].visible" width="120"/>
|
||||
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
@ -171,21 +181,26 @@
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:user:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:user:remove']"
|
||||
>删除</el-button>
|
||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
|
||||
>删除
|
||||
</el-button>
|
||||
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)"
|
||||
v-hasPermi="['system:user:resetPwd', 'system:user:edit']">
|
||||
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item command="handleResetPwd" icon="el-icon-key"
|
||||
v-hasPermi="['system:user:resetPwd']">重置密码</el-dropdown-item>
|
||||
v-hasPermi="['system:user:resetPwd']">重置密码
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item command="handleAuthRole" icon="el-icon-circle-check"
|
||||
v-hasPermi="['system:user:edit']">分配角色</el-dropdown-item>
|
||||
v-hasPermi="['system:user:edit']">分配角色
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
@ -237,7 +252,8 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
|
||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20"
|
||||
show-password/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -261,7 +277,8 @@
|
||||
v-for="dict in dict.type.sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -326,10 +343,13 @@
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||
<div class="el-upload__tip text-center" slot="tip">
|
||||
<div class="el-upload__tip" slot="tip">
|
||||
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
|
||||
<el-checkbox v-model="upload.updateSupport"/>
|
||||
是否更新已经存在的用户数据
|
||||
</div>
|
||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
||||
@click="importTemplate">下载模板
|
||||
</el-link>
|
||||
</div>
|
||||
</el-upload>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@ -341,7 +361,16 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus, deptTreeSelect } from "@/api/system/user";
|
||||
import {
|
||||
listUser,
|
||||
getUser,
|
||||
delUser,
|
||||
addUser,
|
||||
updateUser,
|
||||
resetUserPwd,
|
||||
changeUserStatus,
|
||||
deptTreeSelect
|
||||
} from "@/api/system/user";
|
||||
import {getToken} from "@/utils/auth";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
@ -495,13 +524,13 @@ export default {
|
||||
},
|
||||
// 用户状态修改
|
||||
handleStatusChange(row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
let text = row.status === 0 ? "启用" : "停用";
|
||||
this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
|
||||
return changeUserStatus(row.userId, row.status);
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess(text + "成功");
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
row.status = row.status === 0 ? 1 : 0;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
@ -602,7 +631,8 @@ export default {
|
||||
resetUserPwd(row.userId, value).then(response => {
|
||||
this.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||
});
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 分配角色操作 */
|
||||
handleAuthRole: function (row) {
|
||||
@ -637,7 +667,8 @@ export default {
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
@ -652,8 +683,7 @@ export default {
|
||||
},
|
||||
/** 下载模板操作 */
|
||||
importTemplate() {
|
||||
this.download('system/user/importTemplate', {
|
||||
}, `user_template_${new Date().getTime()}.xlsx`)
|
||||
this.download('system/user/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress(event, file, fileList) {
|
||||
|
0
sql/ggpx.sql
Normal file
0
sql/ggpx.sql
Normal file
Loading…
Reference in New Issue
Block a user