农场分区增加分区类型字段,将系统字典功能复制为业务字典功能,已通数据。字典标签未打通。
This commit is contained in:
parent
ebcb37c23a
commit
ca4d0db841
private-farm/src/main
java/com/jlt/csa
controller
domain
mapper
service
resources/mapper/csa
ruoyi-ui/src
api/csa
router
views
sql
@ -25,10 +25,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||||||
* 农场分区Controller
|
* 农场分区Controller
|
||||||
*
|
*
|
||||||
* @author 郏磊涛
|
* @author 郏磊涛
|
||||||
* @date 2022-03-24
|
* @date 2022-03-27
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/csa/zone")
|
@RequestMapping("/csa/farmzone")
|
||||||
public class ZoneController extends BaseController
|
public class ZoneController extends BaseController
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -37,7 +37,7 @@ public class ZoneController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 查询农场分区列表
|
* 查询农场分区列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('csa:zone:list')")
|
@PreAuthorize("@ss.hasPermi('csa:farmzone:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(Zone zone)
|
public TableDataInfo list(Zone zone)
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@ public class ZoneController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 导出农场分区列表
|
* 导出农场分区列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('csa:zone:export')")
|
@PreAuthorize("@ss.hasPermi('csa:farmzone:export')")
|
||||||
@Log(title = "农场分区", businessType = BusinessType.EXPORT)
|
@Log(title = "农场分区", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, Zone zone)
|
public void export(HttpServletResponse response, Zone zone)
|
||||||
@ -62,7 +62,7 @@ public class ZoneController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 获取农场分区详细信息
|
* 获取农场分区详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('csa:zone:query')")
|
@PreAuthorize("@ss.hasPermi('csa:farmzone:query')")
|
||||||
@GetMapping(value = "/{code}")
|
@GetMapping(value = "/{code}")
|
||||||
public AjaxResult getInfo(@PathVariable("code") String code)
|
public AjaxResult getInfo(@PathVariable("code") String code)
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@ public class ZoneController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 新增农场分区
|
* 新增农场分区
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('csa:zone:add')")
|
@PreAuthorize("@ss.hasPermi('csa:farmzone:add')")
|
||||||
@Log(title = "农场分区", businessType = BusinessType.INSERT)
|
@Log(title = "农场分区", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody Zone zone)
|
public AjaxResult add(@RequestBody Zone zone)
|
||||||
@ -83,7 +83,7 @@ public class ZoneController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 修改农场分区
|
* 修改农场分区
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('csa:zone:edit')")
|
@PreAuthorize("@ss.hasPermi('csa:farmzone:edit')")
|
||||||
@Log(title = "农场分区", businessType = BusinessType.UPDATE)
|
@Log(title = "农场分区", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody Zone zone)
|
public AjaxResult edit(@RequestBody Zone zone)
|
||||||
@ -94,7 +94,7 @@ public class ZoneController extends BaseController
|
|||||||
/**
|
/**
|
||||||
* 删除农场分区
|
* 删除农场分区
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('csa:zone:remove')")
|
@PreAuthorize("@ss.hasPermi('csa:farmzone:remove')")
|
||||||
@Log(title = "农场分区", businessType = BusinessType.DELETE)
|
@Log(title = "农场分区", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{codes}")
|
@DeleteMapping("/{codes}")
|
||||||
public AjaxResult remove(@PathVariable String[] codes)
|
public AjaxResult remove(@PathVariable String[] codes)
|
||||||
|
@ -0,0 +1,115 @@
|
|||||||
|
package com.jlt.csa.controller.base;
|
||||||
|
|
||||||
|
import com.jlt.csa.service.base.ICsaDictDataService;
|
||||||
|
import com.jlt.csa.service.base.ICsaDictTypeService;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/csa/base/dict/data")
|
||||||
|
public class CsaDictDataController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ICsaDictDataService dictDataService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICsaDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysDictData dictData)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysDictData dictData)
|
||||||
|
{
|
||||||
|
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||||
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||||
|
util.exportExcel(response, list, "字典数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典数据详细
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
|
@GetMapping(value = "/{dictCode}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据信息
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/type/{dictType}")
|
||||||
|
public AjaxResult dictType(@PathVariable String dictType)
|
||||||
|
{
|
||||||
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
|
if (StringUtils.isNull(data))
|
||||||
|
{
|
||||||
|
data = new ArrayList<SysDictData>();
|
||||||
|
}
|
||||||
|
return AjaxResult.success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setCreateBy(getUsername());
|
||||||
|
return toAjax(dictDataService.insertDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
|
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||||
|
{
|
||||||
|
dict.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dictDataService.updateDictData(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictCodes}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||||
|
{
|
||||||
|
dictDataService.deleteDictDataByIds(dictCodes);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
package com.jlt.csa.controller.base;
|
||||||
|
|
||||||
|
import com.jlt.csa.service.base.ICsaDictTypeService;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据字典信息
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/csa/base/dict/type")
|
||||||
|
public class CsaDictTypeController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ICsaDictTypeService dictTypeService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(SysDictType dictType)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, SysDictType dictType)
|
||||||
|
{
|
||||||
|
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||||
|
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||||
|
util.exportExcel(response, list, "字典类型");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典类型详细
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||||
|
@GetMapping(value = "/{dictId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||||
|
{
|
||||||
|
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setCreateBy(getUsername());
|
||||||
|
return toAjax(dictTypeService.insertDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||||
|
{
|
||||||
|
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||||
|
{
|
||||||
|
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
|
}
|
||||||
|
dict.setUpdateBy(getUsername());
|
||||||
|
return toAjax(dictTypeService.updateDictType(dict));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字典类型
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{dictIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||||
|
{
|
||||||
|
dictTypeService.deleteDictTypeByIds(dictIds);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新字典缓存
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||||
|
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/refreshCache")
|
||||||
|
public AjaxResult refreshCache()
|
||||||
|
{
|
||||||
|
dictTypeService.resetDictCache();
|
||||||
|
return AjaxResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取字典选择框列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/optionselect")
|
||||||
|
public AjaxResult optionselect()
|
||||||
|
{
|
||||||
|
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||||
|
return AjaxResult.success(dictTypes);
|
||||||
|
}
|
||||||
|
}
|
@ -9,25 +9,28 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||||||
* 农场分区对象 csa_zone
|
* 农场分区对象 csa_zone
|
||||||
*
|
*
|
||||||
* @author 郏磊涛
|
* @author 郏磊涛
|
||||||
* @date 2022-03-24
|
* @date 2022-03-27
|
||||||
*/
|
*/
|
||||||
public class Zone extends BaseEntity
|
public class Zone extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 分区代码 */
|
/** 分区代码 */
|
||||||
@Excel(name = "分区代码")
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
/** 分区类型 */
|
||||||
|
@Excel(name = "分区类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
/** 分区名称 */
|
/** 分区名称 */
|
||||||
@Excel(name = "分区名称")
|
@Excel(name = "分区名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 状态 */
|
/** 状态(0正常 1停用) */
|
||||||
@Excel(name = "状态")
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/** 删除标志 */
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
public void setCode(String code)
|
public void setCode(String code)
|
||||||
@ -39,6 +42,15 @@ public class Zone extends BaseEntity
|
|||||||
{
|
{
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
public void setType(String type)
|
||||||
|
{
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
public void setName(String name)
|
public void setName(String name)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -71,6 +83,7 @@ public class Zone extends BaseEntity
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("code", getCode())
|
.append("code", getCode())
|
||||||
|
.append("type", getType())
|
||||||
.append("name", getName())
|
.append("name", getName())
|
||||||
.append("status", getStatus())
|
.append("status", getStatus())
|
||||||
.append("delFlag", getDelFlag())
|
.append("delFlag", getDelFlag())
|
||||||
|
@ -7,7 +7,7 @@ import com.jlt.csa.domain.Zone;
|
|||||||
* 农场分区Mapper接口
|
* 农场分区Mapper接口
|
||||||
*
|
*
|
||||||
* @author 郏磊涛
|
* @author 郏磊涛
|
||||||
* @date 2022-03-24
|
* @date 2022-03-27
|
||||||
*/
|
*/
|
||||||
public interface ZoneMapper
|
public interface ZoneMapper
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
package com.jlt.csa.mapper.base;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典表 数据层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface CsaDictDataMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 根据条件分页查询字典数据
|
||||||
|
*
|
||||||
|
* @param dictData 字典数据信息
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictData> selectDictDataList(SysDictData dictData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictData> selectDictDataByType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典键值查询字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典键值
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典数据ID查询信息
|
||||||
|
*
|
||||||
|
* @param dictCode 字典数据ID
|
||||||
|
* @return 字典数据
|
||||||
|
*/
|
||||||
|
public SysDictData selectDictDataById(Long dictCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询字典数据
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典数据
|
||||||
|
*/
|
||||||
|
public int countDictDataByType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典ID删除字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictCode 字典数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDictDataById(Long dictCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictCodes 需要删除的字典数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDictDataByIds(Long[] dictCodes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictData 字典数据信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDictData(SysDictData dictData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictData 字典数据信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDictData(SysDictData dictData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步修改字典类型
|
||||||
|
*
|
||||||
|
* @param oldDictType 旧字典类型
|
||||||
|
* @param newDictType 新旧字典类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.jlt.csa.mapper.base;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典表 数据层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface CsaDictTypeMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 根据条件分页查询字典类型
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型信息
|
||||||
|
* @return 字典类型集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictType> selectDictTypeList(SysDictType dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据所有字典类型
|
||||||
|
*
|
||||||
|
* @return 字典类型集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictType> selectDictTypeAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型ID查询信息
|
||||||
|
*
|
||||||
|
* @param dictId 字典类型ID
|
||||||
|
* @return 字典类型
|
||||||
|
*/
|
||||||
|
public SysDictType selectDictTypeById(Long dictId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典类型
|
||||||
|
*/
|
||||||
|
public SysDictType selectDictTypeByType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典ID删除字典信息
|
||||||
|
*
|
||||||
|
* @param dictId 字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDictTypeById(Long dictId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典类型信息
|
||||||
|
*
|
||||||
|
* @param dictIds 需要删除的字典ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteDictTypeByIds(Long[] dictIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增字典类型信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDictType(SysDictType dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDictType(SysDictType dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典类型称是否唯一
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public SysDictType checkDictTypeUnique(String dictType);
|
||||||
|
}
|
@ -7,7 +7,7 @@ import com.jlt.csa.domain.Zone;
|
|||||||
* 农场分区Service接口
|
* 农场分区Service接口
|
||||||
*
|
*
|
||||||
* @author 郏磊涛
|
* @author 郏磊涛
|
||||||
* @date 2022-03-24
|
* @date 2022-03-27
|
||||||
*/
|
*/
|
||||||
public interface IZoneService
|
public interface IZoneService
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.jlt.csa.service.base;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典 业务层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface ICsaDictDataService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 根据条件分页查询字典数据
|
||||||
|
*
|
||||||
|
* @param dictData 字典数据信息
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictData> selectDictDataList(SysDictData dictData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典键值查询字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典键值
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
public String selectDictLabel(String dictType, String dictValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典数据ID查询信息
|
||||||
|
*
|
||||||
|
* @param dictCode 字典数据ID
|
||||||
|
* @return 字典数据
|
||||||
|
*/
|
||||||
|
public SysDictData selectDictDataById(Long dictCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictCodes 需要删除的字典数据ID
|
||||||
|
*/
|
||||||
|
public void deleteDictDataByIds(Long[] dictCodes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictData 字典数据信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDictData(SysDictData dictData);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictData 字典数据信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDictData(SysDictData dictData);
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.jlt.csa.service.base;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典 业务层
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
public interface ICsaDictTypeService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 根据条件分页查询字典类型
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型信息
|
||||||
|
* @return 字典类型集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictType> selectDictTypeList(SysDictType dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据所有字典类型
|
||||||
|
*
|
||||||
|
* @return 字典类型集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictType> selectDictTypeAll();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
public List<SysDictData> selectDictDataByType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型ID查询信息
|
||||||
|
*
|
||||||
|
* @param dictId 字典类型ID
|
||||||
|
* @return 字典类型
|
||||||
|
*/
|
||||||
|
public SysDictType selectDictTypeById(Long dictId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典类型
|
||||||
|
*/
|
||||||
|
public SysDictType selectDictTypeByType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典信息
|
||||||
|
*
|
||||||
|
* @param dictIds 需要删除的字典ID
|
||||||
|
*/
|
||||||
|
public void deleteDictTypeByIds(Long[] dictIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载字典缓存数据
|
||||||
|
*/
|
||||||
|
public void loadingDictCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空字典缓存数据
|
||||||
|
*/
|
||||||
|
public void clearDictCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置字典缓存数据
|
||||||
|
*/
|
||||||
|
public void resetDictCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典类型信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertDictType(SysDictType dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateDictType(SysDictType dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典类型称是否唯一
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public String checkDictTypeUnique(SysDictType dictType);
|
||||||
|
}
|
@ -12,7 +12,7 @@ import com.jlt.csa.service.IZoneService;
|
|||||||
* 农场分区Service业务层处理
|
* 农场分区Service业务层处理
|
||||||
*
|
*
|
||||||
* @author 郏磊涛
|
* @author 郏磊涛
|
||||||
* @date 2022-03-24
|
* @date 2022-03-27
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ZoneServiceImpl implements IZoneService
|
public class ZoneServiceImpl implements IZoneService
|
||||||
|
112
private-farm/src/main/java/com/jlt/csa/service/impl/base/CsaDictDataServiceImpl.java
Normal file
112
private-farm/src/main/java/com/jlt/csa/service/impl/base/CsaDictDataServiceImpl.java
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
package com.jlt.csa.service.impl.base;
|
||||||
|
|
||||||
|
import com.jlt.csa.mapper.base.CsaDictDataMapper;
|
||||||
|
import com.jlt.csa.service.base.ICsaDictDataService;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import com.ruoyi.common.utils.DictUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典 业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CsaDictDataServiceImpl implements ICsaDictDataService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private CsaDictDataMapper dictDataMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件分页查询字典数据
|
||||||
|
*
|
||||||
|
* @param dictData 字典数据信息
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDictData> selectDictDataList(SysDictData dictData)
|
||||||
|
{
|
||||||
|
return dictDataMapper.selectDictDataList(dictData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型和字典键值查询字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @param dictValue 字典键值
|
||||||
|
* @return 字典标签
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String selectDictLabel(String dictType, String dictValue)
|
||||||
|
{
|
||||||
|
return dictDataMapper.selectDictLabel(dictType, dictValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典数据ID查询信息
|
||||||
|
*
|
||||||
|
* @param dictCode 字典数据ID
|
||||||
|
* @return 字典数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysDictData selectDictDataById(Long dictCode)
|
||||||
|
{
|
||||||
|
return dictDataMapper.selectDictDataById(dictCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典数据信息
|
||||||
|
*
|
||||||
|
* @param dictCodes 需要删除的字典数据ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteDictDataByIds(Long[] dictCodes)
|
||||||
|
{
|
||||||
|
for (Long dictCode : dictCodes)
|
||||||
|
{
|
||||||
|
SysDictData data = selectDictDataById(dictCode);
|
||||||
|
dictDataMapper.deleteDictDataById(dictCode);
|
||||||
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典数据信息
|
||||||
|
*
|
||||||
|
* @param data 字典数据信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDictData(SysDictData data)
|
||||||
|
{
|
||||||
|
int row = dictDataMapper.insertDictData(data);
|
||||||
|
if (row > 0)
|
||||||
|
{
|
||||||
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典数据信息
|
||||||
|
*
|
||||||
|
* @param data 字典数据信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateDictData(SysDictData data)
|
||||||
|
{
|
||||||
|
int row = dictDataMapper.updateDictData(data);
|
||||||
|
if (row > 0)
|
||||||
|
{
|
||||||
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
}
|
224
private-farm/src/main/java/com/jlt/csa/service/impl/base/CsaDictTypeServiceImpl.java
Normal file
224
private-farm/src/main/java/com/jlt/csa/service/impl/base/CsaDictTypeServiceImpl.java
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
package com.jlt.csa.service.impl.base;
|
||||||
|
|
||||||
|
import com.jlt.csa.mapper.base.CsaDictDataMapper;
|
||||||
|
import com.jlt.csa.mapper.base.CsaDictTypeMapper;
|
||||||
|
import com.jlt.csa.service.base.ICsaDictTypeService;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.DictUtils;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典 业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class CsaDictTypeServiceImpl implements ICsaDictTypeService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private CsaDictTypeMapper dictTypeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CsaDictDataMapper dictDataMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目启动时,初始化字典到缓存
|
||||||
|
*/
|
||||||
|
@PostConstruct
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
loadingDictCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件分页查询字典类型
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型信息
|
||||||
|
* @return 字典类型集合信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDictType> selectDictTypeList(SysDictType dictType)
|
||||||
|
{
|
||||||
|
return dictTypeMapper.selectDictTypeList(dictType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据所有字典类型
|
||||||
|
*
|
||||||
|
* @return 字典类型集合信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDictType> selectDictTypeAll()
|
||||||
|
{
|
||||||
|
return dictTypeMapper.selectDictTypeAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDictData> selectDictDataByType(String dictType)
|
||||||
|
{
|
||||||
|
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||||
|
if (StringUtils.isNotEmpty(dictDatas))
|
||||||
|
{
|
||||||
|
return dictDatas;
|
||||||
|
}
|
||||||
|
dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||||
|
if (StringUtils.isNotEmpty(dictDatas))
|
||||||
|
{
|
||||||
|
DictUtils.setDictCache(dictType, dictDatas);
|
||||||
|
return dictDatas;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型ID查询信息
|
||||||
|
*
|
||||||
|
* @param dictId 字典类型ID
|
||||||
|
* @return 字典类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysDictType selectDictTypeById(Long dictId)
|
||||||
|
{
|
||||||
|
return dictTypeMapper.selectDictTypeById(dictId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询信息
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SysDictType selectDictTypeByType(String dictType)
|
||||||
|
{
|
||||||
|
return dictTypeMapper.selectDictTypeByType(dictType);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典类型信息
|
||||||
|
*
|
||||||
|
* @param dictIds 需要删除的字典ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void deleteDictTypeByIds(Long[] dictIds)
|
||||||
|
{
|
||||||
|
for (Long dictId : dictIds)
|
||||||
|
{
|
||||||
|
SysDictType dictType = selectDictTypeById(dictId);
|
||||||
|
if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0)
|
||||||
|
{
|
||||||
|
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
||||||
|
}
|
||||||
|
dictTypeMapper.deleteDictTypeById(dictId);
|
||||||
|
DictUtils.removeDictCache(dictType.getDictType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加载字典缓存数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void loadingDictCache()
|
||||||
|
{
|
||||||
|
SysDictData dictData = new SysDictData();
|
||||||
|
dictData.setStatus("0");
|
||||||
|
Map<String, List<SysDictData>> dictDataMap = dictDataMapper.selectDictDataList(dictData).stream().collect(Collectors.groupingBy(SysDictData::getDictType));
|
||||||
|
for (Map.Entry<String, List<SysDictData>> entry : dictDataMap.entrySet())
|
||||||
|
{
|
||||||
|
DictUtils.setDictCache(entry.getKey(), entry.getValue().stream().sorted(Comparator.comparing(SysDictData::getDictSort)).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清空字典缓存数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void clearDictCache()
|
||||||
|
{
|
||||||
|
DictUtils.clearDictCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置字典缓存数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void resetDictCache()
|
||||||
|
{
|
||||||
|
clearDictCache();
|
||||||
|
loadingDictCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存字典类型信息
|
||||||
|
*
|
||||||
|
* @param dict 字典类型信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertDictType(SysDictType dict)
|
||||||
|
{
|
||||||
|
int row = dictTypeMapper.insertDictType(dict);
|
||||||
|
if (row > 0)
|
||||||
|
{
|
||||||
|
DictUtils.setDictCache(dict.getDictType(), null);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存字典类型信息
|
||||||
|
*
|
||||||
|
* @param dict 字典类型信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public int updateDictType(SysDictType dict)
|
||||||
|
{
|
||||||
|
SysDictType oldDict = dictTypeMapper.selectDictTypeById(dict.getDictId());
|
||||||
|
dictDataMapper.updateDictDataType(oldDict.getDictType(), dict.getDictType());
|
||||||
|
int row = dictTypeMapper.updateDictType(dict);
|
||||||
|
if (row > 0)
|
||||||
|
{
|
||||||
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(dict.getDictType());
|
||||||
|
DictUtils.setDictCache(dict.getDictType(), dictDatas);
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验字典类型称是否唯一
|
||||||
|
*
|
||||||
|
* @param dict 字典类型
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String checkDictTypeUnique(SysDictType dict)
|
||||||
|
{
|
||||||
|
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
||||||
|
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
||||||
|
if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue())
|
||||||
|
{
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<resultMap type="Zone" id="ZoneResult">
|
<resultMap type="Zone" id="ZoneResult">
|
||||||
<result property="code" column="code" />
|
<result property="code" column="code" />
|
||||||
|
<result property="type" column="type" />
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
@ -17,14 +18,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectZoneVo">
|
<sql id="selectZoneVo">
|
||||||
select code, name, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_zone
|
select code, type, name, status, del_flag, create_by, create_time, update_by, update_time, remark from csa_zone
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectZoneList" parameterType="Zone" resultMap="ZoneResult">
|
<select id="selectZoneList" parameterType="Zone" resultMap="ZoneResult">
|
||||||
<include refid="selectZoneVo"/>
|
<include refid="selectZoneVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="code != null and code != ''"> and code = #{code}</if>
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
||||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||||
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -36,7 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<insert id="insertZone" parameterType="Zone">
|
<insert id="insertZone" parameterType="Zone">
|
||||||
insert into csa_zone
|
insert into csa_zone
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="code != null and code != ''">code,</if>
|
<if test="code != null">code,</if>
|
||||||
|
<if test="type != null and type != ''">type,</if>
|
||||||
<if test="name != null and name != ''">name,</if>
|
<if test="name != null and name != ''">name,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
@ -47,7 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="code != null and code != ''">#{code},</if>
|
<if test="code != null">#{code},</if>
|
||||||
|
<if test="type != null and type != ''">#{type},</if>
|
||||||
<if test="name != null and name != ''">#{name},</if>
|
<if test="name != null and name != ''">#{name},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
@ -62,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<update id="updateZone" parameterType="Zone">
|
<update id="updateZone" parameterType="Zone">
|
||||||
update csa_zone
|
update csa_zone
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="type != null and type != ''">type = #{type},</if>
|
||||||
<if test="name != null and name != ''">name = #{name},</if>
|
<if test="name != null and name != ''">name = #{name},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
@ -0,0 +1,124 @@
|
|||||||
|
<?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.jlt.csa.mapper.base.CsaDictDataMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysDictData" id="SysDictDataResult">
|
||||||
|
<id property="dictCode" column="dict_code" />
|
||||||
|
<result property="dictSort" column="dict_sort" />
|
||||||
|
<result property="dictLabel" column="dict_label" />
|
||||||
|
<result property="dictValue" column="dict_value" />
|
||||||
|
<result property="dictType" column="dict_type" />
|
||||||
|
<result property="cssClass" column="css_class" />
|
||||||
|
<result property="listClass" column="list_class" />
|
||||||
|
<result property="isDefault" column="is_default" />
|
||||||
|
<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="selectDictDataVo">
|
||||||
|
select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
|
||||||
|
from csa_dict_data
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDictDataList" parameterType="SysDictData" resultMap="SysDictDataResult">
|
||||||
|
<include refid="selectDictDataVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dictType != null and dictType != ''">
|
||||||
|
AND dict_type = #{dictType}
|
||||||
|
</if>
|
||||||
|
<if test="dictLabel != null and dictLabel != ''">
|
||||||
|
AND dict_label like concat('%', #{dictLabel}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND status = #{status}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by dict_sort asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictDataByType" parameterType="SysDictData" resultMap="SysDictDataResult">
|
||||||
|
<include refid="selectDictDataVo"/>
|
||||||
|
where status = '0' and dict_type = #{dictType} order by dict_sort asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictLabel" resultType="String">
|
||||||
|
select dict_label from csa_dict_data
|
||||||
|
where dict_type = #{dictType} and dict_value = #{dictValue}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
|
||||||
|
<include refid="selectDictDataVo"/>
|
||||||
|
where dict_code = #{dictCode}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="countDictDataByType" resultType="Integer">
|
||||||
|
select count(1) from csa_dict_data where dict_type=#{dictType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteDictDataById" parameterType="Long">
|
||||||
|
delete from csa_dict_data where dict_code = #{dictCode}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDictDataByIds" parameterType="Long">
|
||||||
|
delete from csa_dict_data where dict_code in
|
||||||
|
<foreach collection="array" item="dictCode" open="(" separator="," close=")">
|
||||||
|
#{dictCode}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<update id="updateDictData" parameterType="SysDictData">
|
||||||
|
update csa_dict_data
|
||||||
|
<set>
|
||||||
|
<if test="dictSort != null">dict_sort = #{dictSort},</if>
|
||||||
|
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
|
||||||
|
<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
|
||||||
|
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
|
||||||
|
<if test="cssClass != null">css_class = #{cssClass},</if>
|
||||||
|
<if test="listClass != null">list_class = #{listClass},</if>
|
||||||
|
<if test="isDefault != null and isDefault != ''">is_default = #{isDefault},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where dict_code = #{dictCode}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateDictDataType" parameterType="String">
|
||||||
|
update csa_dict_data set dict_type = #{newDictType} where dict_type = #{oldDictType}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertDictData" parameterType="SysDictData">
|
||||||
|
insert into csa_dict_data(
|
||||||
|
<if test="dictSort != null">dict_sort,</if>
|
||||||
|
<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
|
||||||
|
<if test="dictValue != null and dictValue != ''">dict_value,</if>
|
||||||
|
<if test="dictType != null and dictType != ''">dict_type,</if>
|
||||||
|
<if test="cssClass != null and cssClass != ''">css_class,</if>
|
||||||
|
<if test="listClass != null and listClass != ''">list_class,</if>
|
||||||
|
<if test="isDefault != null and isDefault != ''">is_default,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="dictSort != null">#{dictSort},</if>
|
||||||
|
<if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
|
||||||
|
<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
|
||||||
|
<if test="dictType != null and dictType != ''">#{dictType},</if>
|
||||||
|
<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
|
||||||
|
<if test="listClass != null and listClass != ''">#{listClass},</if>
|
||||||
|
<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,105 @@
|
|||||||
|
<?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.jlt.csa.mapper.base.CsaDictTypeMapper">
|
||||||
|
|
||||||
|
<resultMap type="SysDictType" id="SysDictTypeResult">
|
||||||
|
<id property="dictId" column="dict_id" />
|
||||||
|
<result property="dictName" column="dict_name" />
|
||||||
|
<result property="dictType" column="dict_type" />
|
||||||
|
<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="selectDictTypeVo">
|
||||||
|
select dict_id, dict_name, dict_type, status, create_by, create_time, remark
|
||||||
|
from csa_dict_type
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
|
||||||
|
<include refid="selectDictTypeVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="dictName != null and dictName != ''">
|
||||||
|
AND dict_name like concat('%', #{dictName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null and status != ''">
|
||||||
|
AND status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="dictType != null and dictType != ''">
|
||||||
|
AND dict_type like concat('%', #{dictType}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||||
|
and date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
|
and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictTypeAll" resultMap="SysDictTypeResult">
|
||||||
|
<include refid="selectDictTypeVo"/>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
|
||||||
|
<include refid="selectDictTypeVo"/>
|
||||||
|
where dict_id = #{dictId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
|
||||||
|
<include refid="selectDictTypeVo"/>
|
||||||
|
where dict_type = #{dictType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
|
||||||
|
<include refid="selectDictTypeVo"/>
|
||||||
|
where dict_type = #{dictType} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteDictTypeById" parameterType="Long">
|
||||||
|
delete from csa_dict_type where dict_id = #{dictId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteDictTypeByIds" parameterType="Long">
|
||||||
|
delete from csa_dict_type where dict_id in
|
||||||
|
<foreach collection="array" item="dictId" open="(" separator="," close=")">
|
||||||
|
#{dictId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<update id="updateDictType" parameterType="SysDictType">
|
||||||
|
update csa_dict_type
|
||||||
|
<set>
|
||||||
|
<if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
|
||||||
|
<if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
|
update_time = sysdate()
|
||||||
|
</set>
|
||||||
|
where dict_id = #{dictId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insertDictType" parameterType="SysDictType">
|
||||||
|
insert into csa_dict_type(
|
||||||
|
<if test="dictName != null and dictName != ''">dict_name,</if>
|
||||||
|
<if test="dictType != null and dictType != ''">dict_type,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="dictName != null and dictName != ''">#{dictName},</if>
|
||||||
|
<if test="dictType != null and dictType != ''">#{dictType},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
52
ruoyi-ui/src/api/csa/dict/data.js
Normal file
52
ruoyi-ui/src/api/csa/dict/data.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询字典数据列表
|
||||||
|
export function listData(query) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/data/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询字典数据详细
|
||||||
|
export function getData(dictCode) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/data/' + dictCode,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据字典类型查询字典数据信息
|
||||||
|
export function getDicts(dictType) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/data/type/' + dictType,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增字典数据
|
||||||
|
export function addData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/data',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改字典数据
|
||||||
|
export function updateData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/data',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除字典数据
|
||||||
|
export function delData(dictCode) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/data/' + dictCode,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
60
ruoyi-ui/src/api/csa/dict/type.js
Normal file
60
ruoyi-ui/src/api/csa/dict/type.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询字典类型列表
|
||||||
|
export function listType(query) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/type/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询字典类型详细
|
||||||
|
export function getType(dictId) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/type/' + dictId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增字典类型
|
||||||
|
export function addType(data) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/type',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改字典类型
|
||||||
|
export function updateType(data) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/type',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除字典类型
|
||||||
|
export function delType(dictId) {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/type/' + dictId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新字典缓存
|
||||||
|
export function refreshCache() {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/type/refreshCache',
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取字典选择框列表
|
||||||
|
export function optionselect() {
|
||||||
|
return request({
|
||||||
|
url: '/csa/base/dict/type/optionselect',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
@ -1,44 +1,44 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询农场分区列表
|
// 查询农场分区列表
|
||||||
export function listZone(query) {
|
export function listFarmzone(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/csa/zone/list',
|
url: '/csa/farmzone/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询农场分区详细
|
// 查询农场分区详细
|
||||||
export function getZone(code) {
|
export function getFarmzone(code) {
|
||||||
return request({
|
return request({
|
||||||
url: '/csa/zone/' + code,
|
url: '/csa/farmzone/' + code,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增农场分区
|
// 新增农场分区
|
||||||
export function addZone(data) {
|
export function addFarmzone(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/csa/zone',
|
url: '/csa/farmzone',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改农场分区
|
// 修改农场分区
|
||||||
export function updateZone(data) {
|
export function updateFarmzone(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/csa/zone',
|
url: '/csa/farmzone',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除农场分区
|
// 删除农场分区
|
||||||
export function delZone(code) {
|
export function delFarmzone(code) {
|
||||||
return request({
|
return request({
|
||||||
url: '/csa/zone/' + code,
|
url: '/csa/farmzone/' + code,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
@ -134,6 +134,20 @@ export const dynamicRoutes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/csa/dict-data',
|
||||||
|
component: Layout,
|
||||||
|
hidden: true,
|
||||||
|
permissions: ['system:dict:list'],
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'index/:dictId(\\d+)',
|
||||||
|
component: () => import('@/views/csa/dict/data'),
|
||||||
|
name: 'Data',
|
||||||
|
meta: { title: '字典数据', activeMenu: '/csa/dict' }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/monitor/job-log',
|
path: '/monitor/job-log',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
399
ruoyi-ui/src/views/csa/dict/data.vue
Normal file
399
ruoyi-ui/src/views/csa/dict/data.vue
Normal file
@ -0,0 +1,399 @@
|
|||||||
|
<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="dictType">
|
||||||
|
<el-select v-model="queryParams.dictType">
|
||||||
|
<el-option
|
||||||
|
v-for="item in typeOptions"
|
||||||
|
:key="item.dictId"
|
||||||
|
:label="item.dictName"
|
||||||
|
:value="item.dictType"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典标签" prop="dictLabel">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.dictLabel"
|
||||||
|
placeholder="请输入字典标签"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="数据状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="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-hasPermi="['system:dict: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="['system:dict: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="['system:dict: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="['system:dict: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="dataList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="字典编码" align="center" prop="dictCode" />
|
||||||
|
<el-table-column label="字典标签" align="center" prop="dictLabel">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span>
|
||||||
|
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="字典键值" align="center" prop="dictValue" />
|
||||||
|
<el-table-column label="字典排序" align="center" prop="dictSort" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" 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="['system:dict:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:dict: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="字典类型">
|
||||||
|
<el-input v-model="form.dictType" :disabled="true" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据标签" prop="dictLabel">
|
||||||
|
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="数据键值" prop="dictValue">
|
||||||
|
<el-input v-model="form.dictValue" placeholder="请输入数据键值" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="样式属性" prop="cssClass">
|
||||||
|
<el-input v-model="form.cssClass" placeholder="请输入样式属性" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="显示排序" prop="dictSort">
|
||||||
|
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="回显样式" prop="listClass">
|
||||||
|
<el-select v-model="form.listClass">
|
||||||
|
<el-option
|
||||||
|
v-for="item in listClassOptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listData, getData, delData, addData, updateData } from "@/api/csa/dict/data";
|
||||||
|
import { listType, getType } from "@/api/csa/dict/type";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Data",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 字典表格数据
|
||||||
|
dataList: [],
|
||||||
|
// 默认字典类型
|
||||||
|
defaultDictType: "",
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 数据标签回显样式
|
||||||
|
listClassOptions: [
|
||||||
|
{
|
||||||
|
value: "default",
|
||||||
|
label: "默认"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "primary",
|
||||||
|
label: "主要"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "success",
|
||||||
|
label: "成功"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "info",
|
||||||
|
label: "信息"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "warning",
|
||||||
|
label: "警告"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "danger",
|
||||||
|
label: "危险"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 类型数据字典
|
||||||
|
typeOptions: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
dictName: undefined,
|
||||||
|
dictType: undefined,
|
||||||
|
status: undefined
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
dictLabel: [
|
||||||
|
{ required: true, message: "数据标签不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dictValue: [
|
||||||
|
{ required: true, message: "数据键值不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dictSort: [
|
||||||
|
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
const dictId = this.$route.params && this.$route.params.dictId;
|
||||||
|
this.getType(dictId);
|
||||||
|
this.getTypeList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询字典类型详细 */
|
||||||
|
getType(dictId) {
|
||||||
|
getType(dictId).then(response => {
|
||||||
|
this.queryParams.dictType = response.data.dictType;
|
||||||
|
this.defaultDictType = response.data.dictType;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 查询字典类型列表 */
|
||||||
|
getTypeList() {
|
||||||
|
listType().then(response => {
|
||||||
|
this.typeOptions = response.rows;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 查询字典数据列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listData(this.queryParams).then(response => {
|
||||||
|
this.dataList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
dictCode: undefined,
|
||||||
|
dictLabel: undefined,
|
||||||
|
dictValue: undefined,
|
||||||
|
cssClass: undefined,
|
||||||
|
listClass: 'default',
|
||||||
|
dictSort: 0,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 返回按钮操作 */
|
||||||
|
handleClose() {
|
||||||
|
const obj = { path: "/system/dict" };
|
||||||
|
this.$tab.closeOpenPage(obj);
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.queryParams.dictType = this.defaultDictType;
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加字典数据";
|
||||||
|
this.form.dictType = this.queryParams.dictType;
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.dictCode)
|
||||||
|
this.single = selection.length!=1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const dictCode = row.dictCode || this.ids
|
||||||
|
getData(dictCode).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改字典数据";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm: function() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.dictCode != undefined) {
|
||||||
|
updateData(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addData(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const dictCodes = row.dictCode || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
|
||||||
|
return delData(dictCodes);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/dict/data/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `data_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
346
ruoyi-ui/src/views/csa/dict/index.vue
Normal file
346
ruoyi-ui/src/views/csa/dict/index.vue
Normal file
@ -0,0 +1,346 @@
|
|||||||
|
<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="dictName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.dictName"
|
||||||
|
placeholder="请输入字典名称"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典类型" prop="dictType">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.dictType"
|
||||||
|
placeholder="请输入字典类型"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select
|
||||||
|
v-model="queryParams.status"
|
||||||
|
placeholder="字典状态"
|
||||||
|
clearable
|
||||||
|
style="width: 240px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dateRange"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-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="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:dict: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="['system:dict: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="['system:dict: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="['system:dict:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
size="mini"
|
||||||
|
@click="handleRefreshCache"
|
||||||
|
v-hasPermi="['system:dict:remove']"
|
||||||
|
>刷新缓存</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="字典编号" align="center" prop="dictId" />
|
||||||
|
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<router-link :to="'/csa/dict-data/index/' + scope.row.dictId" class="link-type">
|
||||||
|
<span>{{ scope.row.dictType }}</span>
|
||||||
|
</router-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" 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="['system:dict:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:dict: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="dictName">
|
||||||
|
<el-input v-model="form.dictName" placeholder="请输入字典名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字典类型" prop="dictType">
|
||||||
|
<el-input v-model="form.dictType" placeholder="请输入字典类型" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/csa/dict/type";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Dict",
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 字典表格数据
|
||||||
|
typeList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 日期范围
|
||||||
|
dateRange: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
dictName: undefined,
|
||||||
|
dictType: undefined,
|
||||||
|
status: undefined
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
dictName: [
|
||||||
|
{ required: true, message: "字典名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
dictType: [
|
||||||
|
{ required: true, message: "字典类型不能为空", trigger: "blur" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询字典类型列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||||
|
this.typeList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
dictId: undefined,
|
||||||
|
dictName: undefined,
|
||||||
|
dictType: undefined,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRange = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加字典类型";
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.dictId)
|
||||||
|
this.single = selection.length!=1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const dictId = row.dictId || this.ids
|
||||||
|
getType(dictId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改字典类型";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm: function() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.dictId != undefined) {
|
||||||
|
updateType(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addType(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const dictIds = row.dictId || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() {
|
||||||
|
return delType(dictIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('csa/base/dict/type/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `type_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
/** 刷新缓存按钮操作 */
|
||||||
|
handleRefreshCache() {
|
||||||
|
refreshCache().then(() => {
|
||||||
|
this.$modal.msgSuccess("刷新成功");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -1,14 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<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="code">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.code"
|
|
||||||
placeholder="请输入分区代码"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分区名称" prop="name">
|
<el-form-item label="分区名称" prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.name"
|
v-model="queryParams.name"
|
||||||
@ -31,7 +23,7 @@
|
|||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['csa:zone:add']"
|
v-hasPermi="['csa:farmzone:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -42,7 +34,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['csa:zone:edit']"
|
v-hasPermi="['csa:farmzone:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -53,7 +45,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['csa:zone:remove']"
|
v-hasPermi="['csa:farmzone:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
@ -63,15 +55,16 @@
|
|||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['csa:zone:export']"
|
v-hasPermi="['csa:farmzone:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="zoneList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="farmzoneList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="分区代码" align="center" prop="code" />
|
<el-table-column label="分区代码" align="center" prop="code" />
|
||||||
|
<el-table-column label="分区类型" align="center" prop="type" />
|
||||||
<el-table-column label="分区名称" align="center" prop="name" />
|
<el-table-column label="分区名称" align="center" prop="name" />
|
||||||
<el-table-column label="状态" align="center" prop="status" />
|
<el-table-column label="状态" align="center" prop="status" />
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
@ -82,19 +75,19 @@
|
|||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['csa:zone:edit']"
|
v-hasPermi="['csa:farmzone:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['csa:zone:remove']"
|
v-hasPermi="['csa:farmzone:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
@ -104,16 +97,16 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改农场分区对话框 -->
|
<!-- 添加或修改农场分区对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="350px" append-to-body>
|
<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 ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="分区代码" prop="name">
|
|
||||||
<el-input v-model="form.code" placeholder="请输入分区代码" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分区名称" prop="name">
|
<el-form-item label="分区名称" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入分区名称" />
|
<el-input v-model="form.name" placeholder="请输入分区名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="删除标志" prop="delFlag">
|
||||||
|
<el-input v-model="form.delFlag" placeholder="请输入删除标志" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
@ -125,10 +118,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listZone, getZone, delZone, addZone, updateZone } from "@/api/csa/zone";
|
import { listFarmzone, getFarmzone, delFarmzone, addFarmzone, updateFarmzone } from "@/api/csa/farmzone";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Zone",
|
name: "Farmzone",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
@ -144,7 +137,7 @@ export default {
|
|||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
// 农场分区表格数据
|
// 农场分区表格数据
|
||||||
zoneList: [],
|
farmzoneList: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
@ -153,17 +146,16 @@ export default {
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
code: null,
|
type: null,
|
||||||
name: null,
|
name: null,
|
||||||
|
status: null,
|
||||||
},
|
},
|
||||||
// 是否新增
|
|
||||||
isAdd: false,
|
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
code: [
|
type: [
|
||||||
{ required: true, message: "分区代码不能为空", trigger: "blur" }
|
{ required: true, message: "分区类型不能为空", trigger: "change" }
|
||||||
],
|
],
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: "分区名称不能为空", trigger: "blur" }
|
{ required: true, message: "分区名称不能为空", trigger: "blur" }
|
||||||
@ -178,8 +170,8 @@ export default {
|
|||||||
/** 查询农场分区列表 */
|
/** 查询农场分区列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listZone(this.queryParams).then(response => {
|
listFarmzone(this.queryParams).then(response => {
|
||||||
this.zoneList = response.rows;
|
this.farmzoneList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
@ -193,10 +185,15 @@ export default {
|
|||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
code: null,
|
code: null,
|
||||||
|
type: null,
|
||||||
name: null,
|
name: null,
|
||||||
status: "0",
|
status: "0",
|
||||||
delFlag: "0",
|
delFlag: null,
|
||||||
remark: ""
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
remark: null
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
@ -219,16 +216,14 @@ export default {
|
|||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.isAdd = true;
|
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加农场分区";
|
this.title = "添加农场分区";
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.isAdd = false;
|
|
||||||
const code = row.code || this.ids
|
const code = row.code || this.ids
|
||||||
getZone(code).then(response => {
|
getFarmzone(code).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改农场分区";
|
this.title = "修改农场分区";
|
||||||
@ -238,14 +233,14 @@ export default {
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (!this.isAdd) {
|
if (this.form.code != null) {
|
||||||
updateZone(this.form).then(response => {
|
updateFarmzone(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addZone(this.form).then(response => {
|
addFarmzone(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
@ -258,7 +253,7 @@ export default {
|
|||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const codes = row.code || this.ids;
|
const codes = row.code || this.ids;
|
||||||
this.$modal.confirm('是否确认删除农场分区编号为"' + codes + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除农场分区编号为"' + codes + '"的数据项?').then(function() {
|
||||||
return delZone(codes);
|
return delFarmzone(codes);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
@ -266,9 +261,9 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('csa/zone/export', {
|
this.download('csa/farmzone/export', {
|
||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `zone_${new Date().getTime()}.xlsx`)
|
}, `farmzone_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,399 +1,399 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<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="dictType">
|
<el-form-item label="字典名称" prop="dictType">
|
||||||
<el-select v-model="queryParams.dictType">
|
<el-select v-model="queryParams.dictType">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in typeOptions"
|
v-for="item in typeOptions"
|
||||||
:key="item.dictId"
|
:key="item.dictId"
|
||||||
:label="item.dictName"
|
:label="item.dictName"
|
||||||
:value="item.dictType"
|
:value="item.dictType"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="字典标签" prop="dictLabel">
|
<el-form-item label="字典标签" prop="dictLabel">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.dictLabel"
|
v-model="queryParams.dictLabel"
|
||||||
placeholder="请输入字典标签"
|
placeholder="请输入字典标签"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select v-model="queryParams.status" placeholder="数据状态" clearable>
|
<el-select v-model="queryParams.status" placeholder="数据状态" clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in dict.type.sys_normal_disable"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.label"
|
:label="dict.label"
|
||||||
:value="dict.value"
|
:value="dict.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['system:dict:add']"
|
v-hasPermi="['system:dict:add']"
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['system:dict:edit']"
|
v-hasPermi="['system:dict:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['system:dict:remove']"
|
v-hasPermi="['system:dict:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-download"
|
icon="el-icon-download"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['system:dict:export']"
|
v-hasPermi="['system:dict:export']"
|
||||||
>导出</el-button>
|
>导出</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="warning"
|
type="warning"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-close"
|
icon="el-icon-close"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleClose"
|
@click="handleClose"
|
||||||
>关闭</el-button>
|
>关闭</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="字典编码" align="center" prop="dictCode" />
|
<el-table-column label="字典编码" align="center" prop="dictCode" />
|
||||||
<el-table-column label="字典标签" align="center" prop="dictLabel">
|
<el-table-column label="字典标签" align="center" prop="dictLabel">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span>
|
<span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span>
|
||||||
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag>
|
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="字典键值" align="center" prop="dictValue" />
|
<el-table-column label="字典键值" align="center" prop="dictValue" />
|
||||||
<el-table-column label="字典排序" align="center" prop="dictSort" />
|
<el-table-column label="字典排序" align="center" prop="dictSort" />
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['system:dict:edit']"
|
v-hasPermi="['system:dict:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['system:dict:remove']"
|
v-hasPermi="['system:dict:remove']"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改参数配置对话框 -->
|
<!-- 添加或修改参数配置对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<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 ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="字典类型">
|
<el-form-item label="字典类型">
|
||||||
<el-input v-model="form.dictType" :disabled="true" />
|
<el-input v-model="form.dictType" :disabled="true" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据标签" prop="dictLabel">
|
<el-form-item label="数据标签" prop="dictLabel">
|
||||||
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
|
<el-input v-model="form.dictLabel" placeholder="请输入数据标签" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="数据键值" prop="dictValue">
|
<el-form-item label="数据键值" prop="dictValue">
|
||||||
<el-input v-model="form.dictValue" placeholder="请输入数据键值" />
|
<el-input v-model="form.dictValue" placeholder="请输入数据键值" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="样式属性" prop="cssClass">
|
<el-form-item label="样式属性" prop="cssClass">
|
||||||
<el-input v-model="form.cssClass" placeholder="请输入样式属性" />
|
<el-input v-model="form.cssClass" placeholder="请输入样式属性" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="显示排序" prop="dictSort">
|
<el-form-item label="显示排序" prop="dictSort">
|
||||||
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
|
<el-input-number v-model="form.dictSort" controls-position="right" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="回显样式" prop="listClass">
|
<el-form-item label="回显样式" prop="listClass">
|
||||||
<el-select v-model="form.listClass">
|
<el-select v-model="form.listClass">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in listClassOptions"
|
v-for="item in listClassOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
></el-option>
|
></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in dict.type.sys_normal_disable"
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
>{{dict.label}}</el-radio>
|
>{{dict.label}}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
|
import { listData, getData, delData, addData, updateData } from "@/api/system/dict/data";
|
||||||
import { listType, getType } from "@/api/system/dict/type";
|
import { listType, getType } from "@/api/system/dict/type";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Data",
|
name: "Data",
|
||||||
dicts: ['sys_normal_disable'],
|
dicts: ['sys_normal_disable'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
// 非单个禁用
|
// 非单个禁用
|
||||||
single: true,
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
multiple: true,
|
multiple: true,
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
// 字典表格数据
|
// 字典表格数据
|
||||||
dataList: [],
|
dataList: [],
|
||||||
// 默认字典类型
|
// 默认字典类型
|
||||||
defaultDictType: "",
|
defaultDictType: "",
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 数据标签回显样式
|
// 数据标签回显样式
|
||||||
listClassOptions: [
|
listClassOptions: [
|
||||||
{
|
{
|
||||||
value: "default",
|
value: "default",
|
||||||
label: "默认"
|
label: "默认"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "primary",
|
value: "primary",
|
||||||
label: "主要"
|
label: "主要"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "success",
|
value: "success",
|
||||||
label: "成功"
|
label: "成功"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "info",
|
value: "info",
|
||||||
label: "信息"
|
label: "信息"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "warning",
|
value: "warning",
|
||||||
label: "警告"
|
label: "警告"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "danger",
|
value: "danger",
|
||||||
label: "危险"
|
label: "危险"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// 类型数据字典
|
// 类型数据字典
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
dictName: undefined,
|
dictName: undefined,
|
||||||
dictType: undefined,
|
dictType: undefined,
|
||||||
status: undefined
|
status: undefined
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
dictLabel: [
|
dictLabel: [
|
||||||
{ required: true, message: "数据标签不能为空", trigger: "blur" }
|
{ required: true, message: "数据标签不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
dictValue: [
|
dictValue: [
|
||||||
{ required: true, message: "数据键值不能为空", trigger: "blur" }
|
{ required: true, message: "数据键值不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
dictSort: [
|
dictSort: [
|
||||||
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const dictId = this.$route.params && this.$route.params.dictId;
|
const dictId = this.$route.params && this.$route.params.dictId;
|
||||||
this.getType(dictId);
|
this.getType(dictId);
|
||||||
this.getTypeList();
|
this.getTypeList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询字典类型详细 */
|
/** 查询字典类型详细 */
|
||||||
getType(dictId) {
|
getType(dictId) {
|
||||||
getType(dictId).then(response => {
|
getType(dictId).then(response => {
|
||||||
this.queryParams.dictType = response.data.dictType;
|
this.queryParams.dictType = response.data.dictType;
|
||||||
this.defaultDictType = response.data.dictType;
|
this.defaultDictType = response.data.dictType;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询字典类型列表 */
|
/** 查询字典类型列表 */
|
||||||
getTypeList() {
|
getTypeList() {
|
||||||
listType().then(response => {
|
listType().then(response => {
|
||||||
this.typeOptions = response.rows;
|
this.typeOptions = response.rows;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 查询字典数据列表 */
|
/** 查询字典数据列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listData(this.queryParams).then(response => {
|
listData(this.queryParams).then(response => {
|
||||||
this.dataList = response.rows;
|
this.dataList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {
|
||||||
dictCode: undefined,
|
dictCode: undefined,
|
||||||
dictLabel: undefined,
|
dictLabel: undefined,
|
||||||
dictValue: undefined,
|
dictValue: undefined,
|
||||||
cssClass: undefined,
|
cssClass: undefined,
|
||||||
listClass: 'default',
|
listClass: 'default',
|
||||||
dictSort: 0,
|
dictSort: 0,
|
||||||
status: "0",
|
status: "0",
|
||||||
remark: undefined
|
remark: undefined
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
/** 返回按钮操作 */
|
/** 返回按钮操作 */
|
||||||
handleClose() {
|
handleClose() {
|
||||||
const obj = { path: "/system/dict" };
|
const obj = { path: "/system/dict" };
|
||||||
this.$tab.closeOpenPage(obj);
|
this.$tab.closeOpenPage(obj);
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm("queryForm");
|
||||||
this.queryParams.dictType = this.defaultDictType;
|
this.queryParams.dictType = this.defaultDictType;
|
||||||
this.handleQuery();
|
this.handleQuery();
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "添加字典数据";
|
this.title = "添加字典数据";
|
||||||
this.form.dictType = this.queryParams.dictType;
|
this.form.dictType = this.queryParams.dictType;
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.dictCode)
|
this.ids = selection.map(item => item.dictCode)
|
||||||
this.single = selection.length!=1
|
this.single = selection.length!=1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const dictCode = row.dictCode || this.ids
|
const dictCode = row.dictCode || this.ids
|
||||||
getData(dictCode).then(response => {
|
getData(dictCode).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改字典数据";
|
this.title = "修改字典数据";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function() {
|
submitForm: function() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.dictCode != undefined) {
|
if (this.form.dictCode != undefined) {
|
||||||
updateData(this.form).then(response => {
|
updateData(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addData(this.form).then(response => {
|
addData(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const dictCodes = row.dictCode || this.ids;
|
const dictCodes = row.dictCode || this.ids;
|
||||||
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?').then(function() {
|
||||||
return delData(dictCodes);
|
return delData(dictCodes);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('system/dict/data/export', {
|
this.download('csa/base/dict/data/export', {
|
||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `data_${new Date().getTime()}.xlsx`)
|
}, `data_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
887
sql/csa.sql
887
sql/csa.sql
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user