字典
This commit is contained in:
@@ -40,7 +40,7 @@ import java.util.Map;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "系统:字典详情管理")
|
@Api(tags = "系统:字典详情管理")
|
||||||
@RequestMapping("/api/dictDetail")
|
@RequestMapping("/api/dictDetail2")
|
||||||
public class DictDetailController {
|
public class DictDetailController {
|
||||||
private final DictDetailService dictDetailService;
|
private final DictDetailService dictDetailService;
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package org.nl.system.controller.dict;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.common.TableDataInfo;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
import org.nl.system.service.dict.ISysDictService;
|
import org.nl.system.service.dict.ISysDictService;
|
||||||
@@ -29,18 +31,18 @@ import java.util.Set;
|
|||||||
* @since 2022-12-14
|
* @since 2022-12-14
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/api/dict")
|
@RequestMapping("/api/dict")
|
||||||
public class SysDictController {
|
public class SysDictController {
|
||||||
|
|
||||||
@Autowired
|
private final ISysDictService dictService;
|
||||||
private ISysDictService dictService;
|
|
||||||
|
|
||||||
@Log("查询字典")
|
@Log("查询字典")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询字典")
|
@ApiOperation("查询字典")
|
||||||
// @SaCheckPermission("dict:list")
|
// @SaCheckPermission("dict:list")
|
||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery pageable){
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery pageable){
|
||||||
return new ResponseEntity<>(dictService.queryAll(whereJson,pageable), HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(dictService.queryAll(whereJson,pageable)), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("新增字典")
|
@Log("新增字典")
|
||||||
@@ -65,16 +67,16 @@ public class SysDictController {
|
|||||||
@ApiOperation("删除字典")
|
@ApiOperation("删除字典")
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
// @SaCheckPermission("dict:del")
|
// @SaCheckPermission("dict:del")
|
||||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
public ResponseEntity<Object> delete(@RequestBody Set<String> ids){
|
||||||
dictService.deleteBatchByIds(ids);
|
dictService.deleteBatchByIds(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/dictDetail")
|
@GetMapping("/dictDetail")
|
||||||
@ApiOperation("查询字典详情")
|
@ApiOperation("查询字典详情")
|
||||||
public ResponseEntity<Object> queryDetails(Map criteria, PageQuery pageable){
|
public ResponseEntity<Object> queryDetails(@RequestParam Map criteria, PageQuery pageable){
|
||||||
DictQuery dictQuery = JSONObject.parseObject(JSONObject.toJSONString(criteria), DictQuery.class);
|
DictQuery dictQuery = JSONObject.parseObject(JSONObject.toJSONString(criteria), DictQuery.class);
|
||||||
return new ResponseEntity<>(dictService.queryAllDetail(dictQuery,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(dictService.queryAllDetail(dictQuery,pageable)),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询多个字典详情")
|
@ApiOperation("查询多个字典详情")
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public interface ISysDictService extends IService<Dict> {
|
|||||||
* 通过id批量删除字典
|
* 通过id批量删除字典
|
||||||
* @param ids
|
* @param ids
|
||||||
*/
|
*/
|
||||||
void deleteBatchByIds(Set<Long> ids);
|
void deleteBatchByIds(Set<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询获取字典明细
|
* 分页查询获取字典明细
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package org.nl.system.service.dict.dao;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -26,8 +27,8 @@ public class Dict implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 字典标识
|
* 字典标识
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId(value = "dict_id")
|
||||||
private Long dictId;
|
private String dictId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编码
|
* 编码
|
||||||
@@ -104,5 +105,4 @@ public class Dict implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String updateTime;
|
private String updateTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?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="org.nl.system.service.dict.dao.mapper.SysDictMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -11,5 +11,8 @@ import org.nl.system.service.dict.dao.Dict;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class DictQuery extends BaseQuery<Dict> {
|
public class DictQuery extends BaseQuery<Dict> {
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String dictName;
|
||||||
|
private String dictId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
@@ -23,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -33,21 +35,22 @@ import java.util.Set;
|
|||||||
* @since 2022-12-14
|
* @since 2022-12-14
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> implements ISysDictService {
|
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> implements ISysDictService {
|
||||||
|
|
||||||
@Autowired
|
private final SysDictMapper sysDictMapper;
|
||||||
private SysDictMapper sysDictMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<Dict> queryAll(Map whereJson, PageQuery page) {
|
public IPage<Dict> queryAll(Map whereJson, PageQuery page) {
|
||||||
String blurry = null;
|
String blurry = null;
|
||||||
if (ObjectUtil.isNotEmpty(whereJson.get("blurry"))) blurry = whereJson.get("blurry").toString();
|
if (ObjectUtil.isNotEmpty(whereJson.get("blurry"))) blurry = whereJson.get("blurry").toString();
|
||||||
LambdaQueryWrapper<Dict> lam = new LambdaQueryWrapper<>();
|
IPage<Dict> pages = this.page(new Page<>(page.getPage(), page.getSize()), new QueryWrapper<Dict>()
|
||||||
lam.like(ObjectUtil.isNotEmpty(blurry), Dict::getCode, blurry)
|
.select("MAX(dict_id) AS dictId, code, name")
|
||||||
|
.lambda()
|
||||||
|
.like(ObjectUtil.isNotEmpty(blurry), Dict::getCode, blurry)
|
||||||
.or(ObjectUtil.isNotEmpty(blurry))
|
.or(ObjectUtil.isNotEmpty(blurry))
|
||||||
.like(ObjectUtil.isNotEmpty(blurry), Dict::getName, blurry);
|
.like(ObjectUtil.isNotEmpty(blurry), Dict::getName, blurry)
|
||||||
IPage<Dict> pages = new Page<>(page.getPage(), page.getSize());
|
.groupBy(Dict::getCode, Dict::getName));
|
||||||
sysDictMapper.selectPage(pages, lam);
|
|
||||||
return pages;
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +60,10 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String nickName = SecurityUtils.getCurrentNickName();
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
String date = DateUtil.now();
|
String date = DateUtil.now();
|
||||||
Dict oldDict = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>()
|
List<Dict> oldDict = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>()
|
||||||
.eq(ObjectUtil.isNotEmpty(dict.getCode()), Dict::getCode, dict.getCode()));
|
.eq(ObjectUtil.isNotEmpty(dict.getCode()), Dict::getCode, dict.getCode()));
|
||||||
if (ObjectUtil.isNotEmpty(oldDict)) throw new BadRequestException("字典[" + dict.getCode() + "]已存在");
|
if (ObjectUtil.isNotEmpty(oldDict)) throw new BadRequestException("字典[" + dict.getCode() + "]已存在");
|
||||||
dict.setDictId(IdUtil.getSnowflake(1, 1).nextId());
|
dict.setDictId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||||
dict.setCreateId(currentUserId);
|
dict.setCreateId(currentUserId);
|
||||||
dict.setCreateName(nickName);
|
dict.setCreateName(nickName);
|
||||||
dict.setCreateTime(date);
|
dict.setCreateTime(date);
|
||||||
@@ -73,9 +76,10 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateDict(Dict dto) {
|
public void updateDict(Dict dto) {
|
||||||
Dict dict1 = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dto.getCode()));
|
|
||||||
if (ObjectUtil.isNotEmpty(dict1)) throw new BadRequestException("字典[" + dict1.getCode() + "]已存在");
|
|
||||||
Dict dict = sysDictMapper.selectById(dto.getDictId());
|
Dict dict = sysDictMapper.selectById(dto.getDictId());
|
||||||
|
List<Dict> dictList = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dto.getCode()));
|
||||||
|
if (ObjectUtil.isNotEmpty(dictList) && !dto.getCode().equals(dict.getCode()))
|
||||||
|
throw new BadRequestException("字典[" + dto.getCode() + "]已存在");
|
||||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||||
// 根据code获取所有字典
|
// 根据code获取所有字典
|
||||||
@@ -92,15 +96,21 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteBatchByIds(Set<Long> ids) {
|
public void deleteBatchByIds(Set<String> ids) {
|
||||||
sysDictMapper.deleteBatchIds(ids);
|
// 查找code删除
|
||||||
|
ids.forEach(id -> {
|
||||||
|
String code = sysDictMapper.selectById(id).getCode();
|
||||||
|
sysDictMapper.delete(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, code));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<Dict> queryAllDetail(DictQuery criteria, PageQuery pageable) {
|
public IPage<Dict> queryAllDetail(DictQuery criteria, PageQuery page) {
|
||||||
QueryWrapper<Dict> queryWrapper = criteria.build();
|
LambdaQueryWrapper<Dict> lam = new LambdaQueryWrapper<>();
|
||||||
Page<Dict> page = this.page(pageable.build(), queryWrapper);
|
lam.eq(Dict::getCode, criteria.getCode()).isNotNull(Dict::getLabel).ne(Dict::getLabel, "");
|
||||||
return page;
|
IPage<Dict> pages = new Page<>(page.getPage(), page.getSize());
|
||||||
|
sysDictMapper.selectPage(pages, lam);
|
||||||
|
return pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -122,6 +132,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
Dict selectOne = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
Dict selectOne = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
||||||
if (ObjectUtil.isEmpty(selectOne.getLabel())) {
|
if (ObjectUtil.isEmpty(selectOne.getLabel())) {
|
||||||
// 空就赋值
|
// 空就赋值
|
||||||
|
selectOne.setCode(dict.getCode());
|
||||||
selectOne.setLabel(dict.getLabel());
|
selectOne.setLabel(dict.getLabel());
|
||||||
selectOne.setValue(dict.getValue());
|
selectOne.setValue(dict.getValue());
|
||||||
selectOne.setDictSort(dict.getDictSort());
|
selectOne.setDictSort(dict.getDictSort());
|
||||||
@@ -133,7 +144,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 插入新的数据
|
// 插入新的数据
|
||||||
dict.setDictId(IdUtil.getSnowflake(1, 1).nextId());
|
dict.setDictId(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||||
dict.setCode(selectOne.getCode());
|
dict.setCode(selectOne.getCode());
|
||||||
dict.setName(selectOne.getName());
|
dict.setName(selectOne.getName());
|
||||||
dict.setCreateId(SecurityUtils.getCurrentUserId());
|
dict.setCreateId(SecurityUtils.getCurrentUserId());
|
||||||
@@ -151,9 +162,9 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
|||||||
Dict dict = sysDictMapper.selectById(resources.getDictId());
|
Dict dict = sysDictMapper.selectById(resources.getDictId());
|
||||||
if (ObjectUtil.isEmpty(dict)) throw new BadRequestException("被删除或无权限,操作失败!");
|
if (ObjectUtil.isEmpty(dict)) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||||
// 校验是否已经有标签
|
// 校验是否已经有标签
|
||||||
Dict one = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getLabel, dict.getLabel())
|
List<Dict> dictList = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getLabel, resources.getLabel())
|
||||||
.eq(Dict::getCode, dict.getCode()));
|
.eq(Dict::getCode, resources.getCode()));
|
||||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
if (ObjectUtil.isNotEmpty(dictList) && !resources.getLabel().equals(dict.getLabel())) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
||||||
resources.setUpdateId(SecurityUtils.getCurrentUserId());
|
resources.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||||
resources.setUpdateName(SecurityUtils.getCurrentNickName());
|
resources.setUpdateName(SecurityUtils.getCurrentNickName());
|
||||||
resources.setUpdateTime(DateUtil.now());
|
resources.setUpdateTime(DateUtil.now());
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export function get(dictName) {
|
|||||||
size: 9999
|
size: 9999
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail',
|
url: 'api/dict/dictDetail',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
@@ -20,7 +20,7 @@ export function getDictMap(dictName) {
|
|||||||
size: 9999
|
size: 9999
|
||||||
}
|
}
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail/map',
|
url: 'api/dict/dictDetail/map',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params
|
params
|
||||||
})
|
})
|
||||||
@@ -28,7 +28,7 @@ export function getDictMap(dictName) {
|
|||||||
|
|
||||||
export function add(data) {
|
export function add(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail',
|
url: 'api/dict/dictDetail',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
@@ -36,14 +36,14 @@ export function add(data) {
|
|||||||
|
|
||||||
export function del(id) {
|
export function del(id) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail/' + id,
|
url: 'api/dict/dictDetail/' + id,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function edit(data) {
|
export function edit(data) {
|
||||||
return request({
|
return request({
|
||||||
url: 'api/dictDetail',
|
url: 'api/dict/dictDetail',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="排序" prop="dict_sort">
|
<el-form-item label="排序" prop="dict_sort">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model.number="form.dict_sort"
|
v-model.number="form.dictSort"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="999"
|
:max="999"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="label" label="字典标签" align="center" width="120" show-overflow-tooltip />
|
<el-table-column prop="label" label="字典标签" align="center" width="120" show-overflow-tooltip />
|
||||||
<el-table-column prop="value" label="字典值" align="center" width="60" />
|
<el-table-column prop="value" label="字典值" align="center" width="60" />
|
||||||
<el-table-column prop="dict_sort" label="排序" align="center" width="65" />
|
<el-table-column prop="dictSort" label="排序" align="center" width="65" />
|
||||||
<el-table-column prop="para1" label="参数1" align="center" width="65" />
|
<el-table-column prop="para1" label="参数1" align="center" width="65" />
|
||||||
<el-table-column prop="para2" label="参数2" align="center" width="65" />
|
<el-table-column prop="para2" label="参数2" align="center" width="65" />
|
||||||
<el-table-column prop="para3" label="参数3" align="center" width="65" />
|
<el-table-column prop="para3" label="参数3" align="center" width="65" />
|
||||||
@@ -106,7 +106,7 @@ import pagination from '@crud/Pagination'
|
|||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
|
|
||||||
const defaultForm = { dict_id: null, code: null, name: null, label: null, value: null, dict_sort: null, dict_type: null, para1: null, para2: null, para3: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
|
const defaultForm = { dictId: null, name: null, label: null, value: null, dictSort: null, dictType: null, para1: null, para2: null, para3: null, createId: null, createName: null, createTime: null, updateId: null, updateName: null, updateTime: null }
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { pagination, rrOperation, udOperation },
|
components: { pagination, rrOperation, udOperation },
|
||||||
@@ -114,10 +114,10 @@ export default {
|
|||||||
return [
|
return [
|
||||||
CRUD({
|
CRUD({
|
||||||
title: '字典详情',
|
title: '字典详情',
|
||||||
url: 'api/dictDetail',
|
url: 'api/dict/dictDetail',
|
||||||
query: { code: '' },
|
query: { code: '' },
|
||||||
idField: 'dict_id',
|
idField: 'dictId',
|
||||||
sort: ['dict_sort,asc', 'dict_id,desc'],
|
sort: ['dictSort,asc', 'dictId,desc'],
|
||||||
crudMethod: { ...crudDictDetail },
|
crudMethod: { ...crudDictDetail },
|
||||||
optShow: {
|
optShow: {
|
||||||
add: true,
|
add: true,
|
||||||
@@ -133,11 +133,11 @@ export default {
|
|||||||
presenter(),
|
presenter(),
|
||||||
header(),
|
header(),
|
||||||
form(function() {
|
form(function() {
|
||||||
return Object.assign({ dict: { dict_id: this.dict_id }}, defaultForm)
|
return Object.assign({ dict: { dictId: this.dictId }}, defaultForm)
|
||||||
})],
|
})],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
dict_id: null,
|
dictId: null,
|
||||||
rules: {
|
rules: {
|
||||||
label: [
|
label: [
|
||||||
{ required: true, message: '请输入字典标签', trigger: 'blur' }
|
{ required: true, message: '请输入字典标签', trigger: 'blur' }
|
||||||
@@ -145,7 +145,7 @@ export default {
|
|||||||
value: [
|
value: [
|
||||||
{ required: true, message: '请输入字典值', trigger: 'blur' }
|
{ required: true, message: '请输入字典值', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
dict_sort: [
|
dictSort: [
|
||||||
{ required: true, message: '请输入序号', trigger: 'blur', type: 'number' }
|
{ required: true, message: '请输入序号', trigger: 'blur', type: 'number' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -86,14 +86,14 @@ import pagination from '@crud/Pagination'
|
|||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
|
|
||||||
const defaultForm = { dict_id: null, code: null, name: null, label: null, value: null, dict_sort: null, dict_type: null, para1: null, para2: null, para3: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null }
|
const defaultForm = { dictId: null, code: null, name: null, label: null, value: null, dictSort: null, dictType: null, para1: null, para2: null, para3: null, createId: null, createName: null, createTime: null, updateId: null, updateName: null, updateTime: null }
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Dict',
|
name: 'Dict',
|
||||||
components: { crudOperation, pagination, rrOperation, udOperation, dictDetail },
|
components: { crudOperation, pagination, rrOperation, udOperation, dictDetail },
|
||||||
cruds() {
|
cruds() {
|
||||||
return [
|
return [
|
||||||
CRUD({ title: '字典', url: 'api/dict', idField: 'dict_id', crudMethod: { ...crudDict }})
|
CRUD({ title: '字典', url: 'api/dict', idField: 'dictId', crudMethod: { ...crudDict }})
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
mixins: [presenter(), header(), form(defaultForm)],
|
mixins: [presenter(), header(), form(defaultForm)],
|
||||||
@@ -128,7 +128,7 @@ export default {
|
|||||||
handleCurrentChange(val) {
|
handleCurrentChange(val) {
|
||||||
if (val) {
|
if (val) {
|
||||||
this.$refs.dictDetail.query.code = val.code
|
this.$refs.dictDetail.query.code = val.code
|
||||||
this.$refs.dictDetail.form.dictCode = val.code
|
this.$refs.dictDetail.form.code = val.code
|
||||||
this.$refs.dictDetail.crud.toQuery()
|
this.$refs.dictDetail.crud.toQuery()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user