完善字典数据的页面和接口逻辑
This commit is contained in:
parent
c0ed0ac04b
commit
7f429ada76
|
|
@ -7,6 +7,7 @@ import com.jsh.erp.datasource.entities.SysDictData;
|
|||
import com.jsh.erp.service.SysDictDataService;
|
||||
import com.jsh.erp.service.SysDictTypeService;
|
||||
import com.jsh.erp.service.UserService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -14,7 +15,11 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
|
|
@ -36,8 +41,11 @@ public class SysDictDataController extends BaseController {
|
|||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value = "查询列表")
|
||||
public TableDataInfo list(SysDictData dictData) {
|
||||
startPage();
|
||||
public TableDataInfo list(@RequestParam(value = Constants.SEARCH, required = false) String search) {
|
||||
SysDictData dictData = new SysDictData();
|
||||
dictData.setDictType(StringUtil.getInfo(search, "dictType"));
|
||||
dictData.setDictLabel(StringUtil.getInfo(search, "dictLabel"));
|
||||
dictData.setStatus(StringUtil.getInfo(search, "status"));
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
@ -66,27 +74,29 @@ public class SysDictDataController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
* 新增字典数据
|
||||
*/
|
||||
@PostMapping
|
||||
@ApiOperation(value = "新增字典数据")
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict) throws Exception {
|
||||
@PostMapping(value = "/add")
|
||||
public String add(@Validated @RequestBody SysDictData dict) throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
dict.setCreateBy(userService.getCurrentUser().getLoginName());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
return returnStr(objectMap, dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
* 修改保存字典数据
|
||||
*/
|
||||
@PutMapping
|
||||
@ApiOperation(value = "修改保存字典数据")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict) throws Exception {
|
||||
@PutMapping(value = "/update")
|
||||
public String edit(@Validated @RequestBody SysDictData dict) throws Exception {
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
dict.setUpdateBy(userService.getCurrentUser().getLoginName());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
return returnStr(objectMap, dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
* 删除字典数据
|
||||
*/
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
@ApiOperation(value = "删除字典数据")
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import com.jsh.erp.base.TableDataInfo;
|
|||
import com.jsh.erp.datasource.entities.SysDictType;
|
||||
import com.jsh.erp.service.SysDictTypeService;
|
||||
import com.jsh.erp.service.UserService;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.ErpInfo;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -39,8 +41,15 @@ public class SysDictTypeController extends BaseController {
|
|||
|
||||
@ApiOperation("获取字典分页列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictType dictType) {
|
||||
startPage();
|
||||
public TableDataInfo list(@RequestParam(value = Constants.SEARCH, required = false) String search) {
|
||||
SysDictType dictType = new SysDictType();
|
||||
dictType.setDictName(StringUtil.getInfo(search, "dictName"));
|
||||
dictType.setDictType(StringUtil.getInfo(search, "dictType"));
|
||||
dictType.setStatus(StringUtil.getInfo(search, "status"));
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("beginTime", StringUtil.getInfo(search, "beginTime"));
|
||||
params.put("endTime", StringUtil.getInfo(search, "endTime"));
|
||||
dictType.setParams(params);
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.jsh.erp.service;
|
|||
import com.jsh.erp.datasource.entities.SysDictData;
|
||||
import com.jsh.erp.datasource.mappers.SysDictDataMapper;
|
||||
import com.jsh.erp.utils.DictUtils;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -27,6 +28,7 @@ public class SysDictDataService {
|
|||
*/
|
||||
public List<SysDictData> selectDictDataList(SysDictData dictData)
|
||||
{
|
||||
PageUtils.startPage();
|
||||
return dictDataMapper.selectDictDataList(dictData);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.jsh.erp.datasource.mappers.SysDictTypeMapper;
|
|||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.utils.DictUtils;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -65,6 +66,7 @@ public class SysDictTypeService {
|
|||
*/
|
||||
public List<SysDictType> selectDictTypeList(SysDictType dictType)
|
||||
{
|
||||
PageUtils.startPage();
|
||||
return dictTypeMapper.selectDictTypeList(dictType);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,9 @@ const fileSizeLimit = (params)=>getAction("/systemConfig/fileSizeLimit",params);
|
|||
//字典管理
|
||||
const addDictType = (params)=>postAction("/dict/type/add",params);
|
||||
const editDictType = (params)=>putAction("/dict/type/update",params);
|
||||
const addDictData = (params)=>postAction("/dict/data/add",params);
|
||||
const editDictData= (params)=>putAction("/dict/data/update",params);
|
||||
const getDictOptionselect = (params)=>getAction("/dict/type/optionselect",params);
|
||||
//平台参数
|
||||
const addPlatformConfig = (params)=>postAction("/platformConfig/add",params);
|
||||
const editPlatformConfig = (params)=>putAction("/platformConfig/update",params);
|
||||
|
|
@ -189,6 +192,9 @@ export {
|
|||
fileSizeLimit,
|
||||
addDictType,
|
||||
editDictType,
|
||||
addDictData,
|
||||
editDictData,
|
||||
getDictOptionselect,
|
||||
addPlatformConfig,
|
||||
editPlatformConfig,
|
||||
getPlatformConfigByKey,
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
<a-col :md="6" :sm="24">
|
||||
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-select v-model="queryParam.status" placeholder="请选择状态">
|
||||
<a-select-option value="1">正常</a-select-option>
|
||||
<a-select-option value="0">停用</a-select-option>
|
||||
<a-select-option value="0">正常</a-select-option>
|
||||
<a-select-option value="1">停用</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
|
@ -85,8 +85,8 @@
|
|||
dictNameCustomRender
|
||||
<!-- 状态渲染模板 -->
|
||||
<template slot="customRenderStatus" slot-scope="status">
|
||||
<a-tag v-if="status" color="green">启用</a-tag>
|
||||
<a-tag v-if="!status" color="orange">禁用</a-tag>
|
||||
<a-tag v-if="status==='0'" color="green">正常</a-tag>
|
||||
<a-tag v-if="status==='1'" color="orange">停用</a-tag>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
|
|
@ -103,6 +103,7 @@
|
|||
import DictDataListModal from './modules/DictDataListModal'
|
||||
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
|
||||
import { deleteAction } from '@/api/manage'
|
||||
import moment from 'moment/moment'
|
||||
export default {
|
||||
name: "DictList",
|
||||
mixins: [JeecgListMixin],
|
||||
|
|
@ -171,6 +172,16 @@
|
|||
},
|
||||
handleShowData(record) {
|
||||
this.$refs.modalDataList.show(record)
|
||||
},
|
||||
onCreateDateChange: function (value, dateString) {
|
||||
this.queryParam.beginTime=dateString[0]
|
||||
this.queryParam.endTime=dateString[1]
|
||||
if(dateString[0] && dateString[1]) {
|
||||
this.queryParam.createTimeRange = [moment(dateString[0]), moment(dateString[1])]
|
||||
}
|
||||
},
|
||||
onDateOk(value) {
|
||||
console.log(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,11 @@
|
|||
<a-row :gutter="24">
|
||||
<a-col :md="6" :sm="24">
|
||||
<a-form-item label="字典名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
||||
<a-input placeholder="请输入字典名称" v-model="queryParam.dictName"></a-input>
|
||||
<a-select placeholder="请选择字典名称" showSearch allow-clear optionFilterProp="children" v-model="queryParam.dictType">
|
||||
<a-select-option v-for="(item,index) in typeOptions" :key="index" :value="item.dictType">
|
||||
{{ item.dictName }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :md="6" :sm="24">
|
||||
|
|
@ -49,7 +53,7 @@
|
|||
</div>
|
||||
<!-- 操作按钮区域 -->
|
||||
<div class="table-operator" style="border-top: 5px">
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
|
||||
<a-button @click="handleAddWithData" type="primary" icon="plus">新增</a-button>
|
||||
<a-button @click="batchDel" icon="delete">删除</a-button>
|
||||
</div>
|
||||
<!-- table区域-begin -->
|
||||
|
|
@ -83,7 +87,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { addDictType, editDictType, findBillDetailByNumber, findBySelectCus, findBySelectSup } from '@/api/api'
|
||||
import { getDictOptionselect } from '@/api/api'
|
||||
import DictDataModal from './DictDataModal'
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
||||
|
|
@ -96,8 +100,10 @@
|
|||
title:"字典数据",
|
||||
visible: false,
|
||||
disableMixinCreated: true,
|
||||
// 类型数据字典
|
||||
typeOptions: [],
|
||||
queryParam: {
|
||||
dictType: "",
|
||||
dictType: undefined,
|
||||
dictLabel: "",
|
||||
status: undefined
|
||||
},
|
||||
|
|
@ -138,30 +144,20 @@
|
|||
show(record) {
|
||||
this.model = Object.assign({}, {})
|
||||
this.visible = true
|
||||
this.queryParam.dictType = record.dictType
|
||||
this.getTypeList()
|
||||
this.loadData(1)
|
||||
},
|
||||
handleSearchSupplier(value) {
|
||||
let that = this
|
||||
if(this.setTimeFlag != null){
|
||||
clearTimeout(this.setTimeFlag);
|
||||
}
|
||||
if(this.organLabel === '供应商') {
|
||||
this.setTimeFlag = setTimeout(() => {
|
||||
findBySelectSup({ key: value, limit:1 }).then((res) => {
|
||||
if (res) {
|
||||
that.supplierList = res;
|
||||
}
|
||||
})
|
||||
}, 500)
|
||||
} else if(this.organLabel === '客户') {
|
||||
this.setTimeFlag = setTimeout(() => {
|
||||
findBySelectCus({ key: value, limit:1 }).then((res) => {
|
||||
if (res) {
|
||||
that.supplierList = res;
|
||||
}
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
/** 查询字典类型列表 */
|
||||
getTypeList() {
|
||||
getDictOptionselect().then(res => {
|
||||
this.typeOptions = res.data;
|
||||
});
|
||||
},
|
||||
handleAddWithData() {
|
||||
this.$refs.modalForm.add(this.queryParam.dictType)
|
||||
this.$refs.modalForm.title = "新增";
|
||||
this.$refs.modalForm.disableSubmit = false;
|
||||
},
|
||||
close () {
|
||||
this.$emit('close');
|
||||
|
|
@ -184,17 +180,6 @@
|
|||
status: ""
|
||||
}
|
||||
this.loadData(1);
|
||||
},
|
||||
myHandleDetail(record) {
|
||||
let that = this
|
||||
findBillDetailByNumber({ number: record.number }).then((res) => {
|
||||
if (res && res.code === 200) {
|
||||
let type = res.data.depotHeadType
|
||||
type = type.replace('其它','')
|
||||
that.$refs.billDetail.show(res.data, type);
|
||||
that.$refs.billDetail.title="详情";
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,22 +18,22 @@
|
|||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="字典类型">
|
||||
<a-input placeholder="请输入字典类型" v-decorator.trim="[ 'dictName', validatorRules.dictName]" />
|
||||
<a-input placeholder="请输入字典类型" v-decorator.trim="[ 'dictType' ]" :readOnly="true" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="数据标签">
|
||||
<a-input placeholder="请输入数据标签" v-decorator.trim="[ 'dictType', validatorRules.dictType]" />
|
||||
<a-input placeholder="请输入数据标签" v-decorator.trim="[ 'dictLabel', validatorRules.dictLabel]" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="数据键值">
|
||||
<a-input placeholder="请输入数据键值" v-decorator.trim="[ 'dictType', validatorRules.dictType]" />
|
||||
<a-input placeholder="请输入数据键值" v-decorator.trim="[ 'dictValue', validatorRules.dictValue]" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="样式属性">
|
||||
<a-input placeholder="请输入样式属性" v-decorator.trim="[ 'dictType' ]" />
|
||||
<a-input placeholder="请输入样式属性" v-decorator.trim="[ 'cssClass' ]" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="显示排序">
|
||||
<a-input placeholder="请输入显示排序" v-decorator.trim="[ 'dictType' ]" />
|
||||
<a-input placeholder="请输入显示排序" v-decorator.trim="[ 'dictSort' ]" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="回显样式">
|
||||
<a-input placeholder="请输入回显样式" v-decorator.trim="[ 'dictType' ]" />
|
||||
<a-input placeholder="请输入回显样式" v-decorator.trim="[ 'listClass' ]" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="状态">
|
||||
<a-select style="width:100%" placeholder="请选择状态" v-decorator.trim="[ 'status' ]">
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import { addDictType, editDictType } from '@/api/api'
|
||||
import { addDictData, editDictData } from '@/api/api'
|
||||
import { mixinDevice } from '@/utils/mixin'
|
||||
export default {
|
||||
name: "DictDataModal",
|
||||
|
|
@ -88,15 +88,19 @@
|
|||
created () {
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
add (dictType) {
|
||||
this.edit({});
|
||||
this.model.dictType = dictType
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'dictType'))
|
||||
})
|
||||
},
|
||||
edit (record) {
|
||||
this.form.resetFields();
|
||||
this.model = Object.assign({}, record);
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model,'dictName', 'dictType', 'status', 'remark'))
|
||||
this.form.setFieldsValue(pick(this.model, 'dictType', 'dictLabel', 'dictValue', 'cssClass', 'dictSort', 'listClass', 'status', 'remark'))
|
||||
})
|
||||
},
|
||||
close () {
|
||||
|
|
@ -111,10 +115,10 @@
|
|||
that.confirmLoading = true;
|
||||
let formData = Object.assign(this.model, values);
|
||||
let obj;
|
||||
if(!this.model.dictId){
|
||||
obj=addDictType(formData)
|
||||
if(!this.model.dictCode){
|
||||
obj=addDictData(formData)
|
||||
}else{
|
||||
obj=editDictType(formData)
|
||||
obj=editDictData(formData)
|
||||
}
|
||||
obj.then((res)=>{
|
||||
if(res.code === 200){
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user