字典列表

This commit is contained in:
caoyang
2022-03-03 16:08:22 +08:00
parent d88cf8722e
commit ced662f2e5
10 changed files with 89 additions and 72 deletions
@@ -81,7 +81,7 @@ public class SysCategoryController {
return result; return result;
} }
@RequiresPermissions("sys:category:list") // @RequiresPermissions("sys:category:list")
@GetMapping(value = "/childList") @GetMapping(value = "/childList")
public Result<List<SysCategory>> queryPageList(SysCategory sysCategory,HttpServletRequest req) { public Result<List<SysCategory>> queryPageList(SysCategory sysCategory,HttpServletRequest req) {
Result<List<SysCategory>> result = new Result<List<SysCategory>>(); Result<List<SysCategory>> result = new Result<List<SysCategory>>();
@@ -113,7 +113,7 @@ public class SysCategoryController {
* @param sysCategory * @param sysCategory
* @return * @return
*/ */
@RequiresPermissions("sys:category:add") // @RequiresPermissions("sys:category:add")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<SysCategory> add(@RequestBody SysCategory sysCategory) { public Result<SysCategory> add(@RequestBody SysCategory sysCategory) {
Result<SysCategory> result = new Result<SysCategory>(); Result<SysCategory> result = new Result<SysCategory>();
@@ -132,7 +132,7 @@ public class SysCategoryController {
* @param sysCategory * @param sysCategory
* @return * @return
*/ */
@RequiresPermissions("sys:category:edit") // @RequiresPermissions("sys:category:edit")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<SysCategory> edit(@RequestBody SysCategory sysCategory) { public Result<SysCategory> edit(@RequestBody SysCategory sysCategory) {
Result<SysCategory> result = new Result<SysCategory>(); Result<SysCategory> result = new Result<SysCategory>();
@@ -151,7 +151,7 @@ public class SysCategoryController {
* @param id * @param id
* @return * @return
*/ */
@RequiresPermissions("sys:category:list") // @RequiresPermissions("sys:category:list")
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
public Result<SysCategory> delete(@RequestParam(name="id",required=true) String id) { public Result<SysCategory> delete(@RequestParam(name="id",required=true) String id) {
Result<SysCategory> result = new Result<SysCategory>(); Result<SysCategory> result = new Result<SysCategory>();
@@ -171,7 +171,7 @@ public class SysCategoryController {
* @param ids * @param ids
* @return * @return
*/ */
@RequiresPermissions("sys:category:del") // @RequiresPermissions("sys:category:del")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<SysCategory> deleteBatch(@RequestParam(name="ids",required=true) String ids) { public Result<SysCategory> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<SysCategory> result = new Result<SysCategory>(); Result<SysCategory> result = new Result<SysCategory>();
@@ -189,7 +189,7 @@ public class SysCategoryController {
* @param id * @param id
* @return * @return
*/ */
@RequiresPermissions("sys:category:list") // @RequiresPermissions("sys:category:list")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<SysCategory> queryById(@RequestParam(name="id",required=true) String id) { public Result<SysCategory> queryById(@RequestParam(name="id",required=true) String id) {
Result<SysCategory> result = new Result<SysCategory>(); Result<SysCategory> result = new Result<SysCategory>();
+1 -1
View File
@@ -13,7 +13,7 @@
<a-form-model-item class="itemModel" :prop="item.db_field_name"> <a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-input class="box-input" v-model="formInline[item.db_field_name]" <a-input class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled" :disabled="disabled"
:placeholder="item.placeholder"/> :placeholder="$t('PleaseEnter')+item.db_field_txt"/>
</a-form-model-item> </a-form-model-item>
</div> </div>
</a-col> </a-col>
@@ -228,9 +228,9 @@
}, },
//下载 //下载
actionDown(val){ actionDown(val){
// console.log() // downloadFile('/sys/common/download', val.docRealName, { id: val.attId })
// downloadFile('/sys/common/download', val.fileName, { id: val.id }) // downloadFile(val.docRealFile)
downloadFile(val.docRealFile) window.open(val.docRealFile)
}, },
//删除 //删除
actionDelete(record){ actionDelete(record){
@@ -46,40 +46,7 @@
selectedKeys: [], selectedKeys: [],
expandedKeys: [], expandedKeys: [],
autoExpandParent: true, autoExpandParent: true,
treeData: [ treeData: [],
{
title: '车身结构',
key: '0-0',
children: [
{
title: '车身',
key: '0-0-0',
children: [
{ title: '前窗', key: '0-0-0-0' },
{ title: '挡风', key: '0-0-0-1' },
{ title: '车门', key: '0-0-0-2' },
],
},
{
title: '底盘',
key: '0-0-1',
},
{
title: '车机系统',
key: '0-0-2',
},
],
},
{
title: '软件中心',
key: '0-1',
children: [
{ title: '软件一', key: '0-1-0-0' },
{ title: '软件二', key: '0-1-0-1' },
{ title: '软件三', key: '0-1-0-2' },
],
},
],
dataList:[], dataList:[],
searchValue:'' searchValue:''
} }
@@ -106,7 +73,7 @@
if(res.success){ if(res.success){
let data=res.result let data=res.result
this.treeData=this.addAttr(data) this.treeData=this.addAttr(data)
console.log('treeData',this.treeData) // console.log('treeData',this.treeData)
} }
}) })
}, },
@@ -7,7 +7,7 @@
</div> </div>
</div> </div>
<!-- <a-button type="primary" @click="showModal">新增</a-button>--> <!-- <a-button type="primary" @click="showModal">新增</a-button>-->
<a-modal class="area-module" v-model="newVisible" :title="$t('add')" :ok-text="$t('preservation')" :cancel-text="$t('cancel')" @ok="hideModal" @cancel="cancelModel" v-if="newVisible"> <a-modal class="area-module" v-model="newVisible" :title="title" :ok-text="$t('preservation')" :cancel-text="$t('cancel')" @ok="hideModal" @cancel="cancelModel" v-if="newVisible">
<a-form-model <a-form-model
class="tag-module" class="tag-module"
ref="ruleForm" ref="ruleForm"
@@ -99,6 +99,7 @@
}, },
data(){ data(){
return{ return{
title:this.$t('add'),
queryParams:{ queryParams:{
pageNo:1, pageNo:1,
pageSize:10 pageSize:10
@@ -197,6 +198,7 @@
}, },
showModal() { showModal() {
this.title=this.$t('add')
this.newVisible = true; this.newVisible = true;
}, },
//新增 //新增
@@ -265,6 +267,7 @@
}, },
//编辑按钮 //编辑按钮
editArea(val){ editArea(val){
this.title=this.$t('edit')
this.newVisible = true; this.newVisible = true;
let params={ let params={
id:val id:val
@@ -17,16 +17,16 @@
<a-icon type="plus" /> <a-icon type="plus" />
{{$t('add')}} {{$t('add')}}
</div> </div>
<div class="operator-text" @click="batDelete"> <div class="operator-text" v-if="dictVal=='tree'" @click="batDelete">
<a-icon type="delete" /> <a-icon type="delete" />
{{$t('BatchDelete')}} {{$t('BatchDelete')}}
</div> </div>
</div> </div>
<div class="dic-list-table"> <div class="dic-list-table">
<list-table v-if="dictVal=='list'&&dataFlag" :tableData="tableData" @editDict="editDict" @deleteDict="deleteDict" :total="total"></list-table> <list-table v-if="dictVal=='list'&&dataFlag" :tableData="tableData" @editDict="editDict" @deleteDict="deleteDict" :total="total"></list-table>
<tree-table v-if="dictVal=='tree'&&dataFlag" :tabletreeData="tabletreeData" :record="record" @editDict="editTreeDict" @ok="ok" :total="total"></tree-table> <tree-table v-if="dictVal=='tree'&&dataFlag" :tabletreeData="tabletreeData" :record="record" @editDict="editTreeDict" @selectedKeys="selectedKeys" @ok="ok" :total="total"></tree-table>
</div> </div>
<a-modal class="dict-module" v-model="newVisible" :title="titleDict" ok-text="保存" cancel-text="取消" @ok="hideModal" @cancel="cancelModel" v-if="newVisible"> <a-modal class="dict-module" v-model="newVisible" :title="title" ok-text="保存" cancel-text="取消" @ok="hideModal" @cancel="cancelModel" v-if="newVisible">
<a-form-model <a-form-model
v-if="newVisible" v-if="newVisible"
class="dic-form-module" class="dic-form-module"
@@ -89,7 +89,7 @@
}, },
data(){ data(){
return{ return{
titleDict:'新增', title:this.$t('add'),
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 18 }, wrapperCol: { span: 18 },
queryParams:{ queryParams:{
@@ -158,7 +158,8 @@
parentVisible:false, parentVisible:false,
dataFlag:false, dataFlag:false,
total:0, total:0,
isEdit:false isEdit:false,
selectedIds:[], //树形选中的id
} }
}, },
watch: { watch: {
@@ -194,6 +195,7 @@
}) })
}else if(this.dictVal=='tree'){ }else if(this.dictVal=='tree'){
getAction(`sys/category/queryBySysDictId`,{ getAction(`sys/category/queryBySysDictId`,{
...this.queryParams,
id:this.record.id, id:this.record.id,
isTagDict:1 isTagDict:1
}).then(res=>{ }).then(res=>{
@@ -249,8 +251,10 @@
}, },
//新增 //新增
dicAdd(){ dicAdd(){
this.title=this.$t('add')
this.isEdit=false this.isEdit=false
this.newVisible=true; this.newVisible=true;
this.form={}
if(this.dictVal=='list'){ if(this.dictVal=='list'){
this.parentVisible=false this.parentVisible=false
@@ -280,6 +284,7 @@
postAction(`sys/dictItem/add`, params).then(res => { postAction(`sys/dictItem/add`, params).then(res => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(res.message)
this.form={}
this.loadData() this.loadData()
this.newVisible = false this.newVisible = false
} else { } else {
@@ -308,6 +313,7 @@
postAction(`sys/category/add`, params).then(res => { postAction(`sys/category/add`, params).then(res => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(res.message)
this.form={}
this.loadData() this.loadData()
this.newVisible = false this.newVisible = false
} else { } else {
@@ -323,6 +329,7 @@
}, },
//列表编辑 //列表编辑
editDict(rec,val){ editDict(rec,val){
this.title=this.$t('edit')
this.isEdit=true this.isEdit=true
this.form={...rec} this.form={...rec}
this.newVisible=val this.newVisible=val
@@ -330,6 +337,7 @@
}, },
//树状编辑 //树状编辑
editTreeDict(val,form){ editTreeDict(val,form){
this.title=this.$t('edit')
this.isEdit=true this.isEdit=true
this.form={...form} this.form={...form}
this.newVisible=val this.newVisible=val
@@ -356,14 +364,37 @@
} }
}) })
}, },
handleChange(){
},
//树形选中行
selectedKeys(val){
this.selectedIds=val
},
//批量删除 //批量删除
batDelete(){ batDelete(){
let params={ let params={
ids:this.selectedIds.join(',')
}
if(this.selectedIds && this.selectedIds.length>0){
this.$confirm({
title: this.$t('ConfirmDelete'),
content: '',
onOk:
async () => {
deleteAction(`sys/category/deleteBatch`, params).then(res => {
if(res.success){
this.loadData()
this.$message.success(res.message)
}else{
this.$message.warning((res.message))
}
})
}
})
}else{
this.$message.warning(this.$t('selectLeastOne'))
} }
deleteAction(`sys/category/deleteBatch`,params).then(res=>{
})
}, },
ok(){ ok(){
this.loadData() this.loadData()
@@ -1,6 +1,6 @@
<template> <template>
<div class="new-tag-drawer"> <div class="new-tag-drawer">
<onl-cgform-tag-form ref="realForm" @ok="submitCallback" :isTagContent="isTagContent" :editData="editData" :editId=editId :submitEdit="submitEdit" :disabled="disableSubmit" normal> </onl-cgform-tag-form> <onl-cgform-tag-form ref="realForm" @ok="submitCallback" :isTagContent="isTagContent" :editData="editData" :editId=editId :submitEdit="submitEdit" :disabled="disableSubmit" normal v-if="drawerVisible"> </onl-cgform-tag-form>
<div class="drawer-footer"> <div class="drawer-footer">
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">{{$t('preservation')}}</a-button> <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">{{$t('preservation')}}</a-button>
@@ -7,7 +7,8 @@
:data-source="tabData" :data-source="tabData"
:pagination="false" :pagination="false"
:loading="loading" :loading="loading"
:row-selection="{selectedRowKeys: selectedRowKeys, onSelectAll: onSelectAll, onSelect: onSelect}" :rowClassName='setRowClassName'
:row-selection="{selectedRowKeys: selectedRowKeys,onChange: onSelectChange, onSelectAll: onSelectAll, onSelect: onSelect, }"
> >
<template slot="action" slot-scope="text, record"> <template slot="action" slot-scope="text, record">
<a class="action-edit" href="javascript:;" @click="actionEdit(record)">编辑</a> <a class="action-edit" href="javascript:;" @click="actionEdit(record)">编辑</a>
@@ -34,27 +35,21 @@
title: '名称', title: '名称',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
align: "center",
}, },
{ {
title: '英文名称', title: '英文名称',
dataIndex: 'enName', dataIndex: 'enName',
key: 'enName', key: 'enName',
width: '12%',
align: "center",
}, },
{ {
title: '描述', title: '描述',
dataIndex: 'description', dataIndex: 'description',
width: '30%',
key: 'description', key: 'description',
align: "center",
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
dataIndex: 'action', dataIndex: 'action',
scopedSlots: {customRender: 'action'}, scopedSlots: {customRender: 'action'},
align: "center",
width: 170 width: 170
} }
], ],
@@ -78,7 +73,7 @@
let data = this.toTree(treeData) let data = this.toTree(treeData)
this.tabData=data this.tabData=data
this.loading=false this.loading=false
console.log('treedata',data) // console.log('treedata',data)
// this.dataFlag=true // this.dataFlag=true
}) })
}, },
@@ -91,7 +86,6 @@
// 将数据存储为 以 id 为 KEY 的 map 索引数据列 // 将数据存储为 以 id 为 KEY 的 map 索引数据列
let map = {}; let map = {};
config.forEach((item) => { config.forEach((item) => {
// 树 的label
item.label = item.name; item.label = item.name;
item.key=item.id; item.key=item.id;
map[item.id] = item; map[item.id] = item;
@@ -132,6 +126,15 @@
actionEdit(val){ actionEdit(val){
this.$emit('editDict',true,val) this.$emit('editDict',true,val)
}, },
//设置行属性
setRowClassName(record){
if(record.pid != 0){
return 'rowStyle'
}
},
onSelectChange(keys){
// console.log('keys',keys,this.selectedRowKeys)
},
onSelectAll(selected) { onSelectAll(selected) {
if (selected) { if (selected) {
const tabData = this.tabData; const tabData = this.tabData;
@@ -164,6 +167,8 @@
setParentUncheck(key); setParentUncheck(key);
} }
this.selectedRowKeys = Array.from(set); this.selectedRowKeys = Array.from(set);
// console.log('keyssssss',this.selectedRowKeys)
this.$emit('selectedKeys',this.selectedRowKeys)
// 设置父级选择 // 设置父级选择
function setParentCheck(key) { function setParentCheck(key) {
let parent = getParent(key); let parent = getParent(key);
@@ -219,6 +224,7 @@
set.add(v.key); set.add(v.key);
v.children && setChildCheck(v.children); v.children && setChildCheck(v.children);
}); });
} }
// 设置child取消 // 设置child取消
function setChildUncheck(list) { function setChildUncheck(list) {
@@ -245,4 +251,11 @@
} }
} }
} }
</style>
<style lang="less">
.rowStyle{
background-color:#fafafa;
}
</style> </style>
@@ -23,7 +23,7 @@
{{$t('add')}} {{$t('add')}}
</div> </div>
</div> </div>
<a-modal class="show-content" v-model="contentVisible" :visible="contentVisible" :title="$t('add')" :ok-text="$t('preservation')" :cancel-text="$t('cancel')" @ok="hideModal" @cancel="cancelModel" v-if="contentVisible"> <a-modal class="show-content" v-model="contentVisible" :visible="contentVisible" :title="title" :ok-text="$t('preservation')" :cancel-text="$t('cancel')" @ok="hideModal" @cancel="cancelModel" v-if="contentVisible">
<a-form-model <a-form-model
class="tag-content" class="tag-content"
ref="ruleForm" ref="ruleForm"
@@ -99,6 +99,7 @@
}, },
data(){ data(){
return{ return{
title: this.$t('add'),
total:0, total:0,
queryParams:{ queryParams:{
pageNo:1, pageNo:1,
@@ -199,12 +200,12 @@
this.loadData() this.loadData()
}, },
handleAdd(){ handleAdd(){
this.title=this.$t('add')
this.isEdit=1 this.isEdit=1
this.contentVisible=true this.contentVisible=true
this.form={} this.form={}
}, },
hideModal(){ hideModal(){
let params={ let params={
...this.form, ...this.form,
} }
@@ -272,11 +273,12 @@
}) })
}, },
onSelectChange(selectedRowKeys) { onSelectChange(selectedRowKeys) {
console.log('selectedRowKeys changed: ', selectedRowKeys); // console.log('selectedRowKeys changed: ', selectedRowKeys);
this.selectedRowKeys = selectedRowKeys; this.selectedRowKeys = selectedRowKeys;
}, },
//编辑 //编辑
actionEdit(val){ actionEdit(val){
this.title=this.$t('edit')
this.isEdit=0 this.isEdit=0
this.form={...val} this.form={...val}
this.contentVisible=true this.contentVisible=true
@@ -285,7 +287,7 @@
handleDicPop(record){ handleDicPop(record){
this.record=record this.record=record
if(record.attributeType=='1'){ if(record.attributeType=='1'){
console.log('attribu',record.attributeType,record.attributeType=='1') // console.log('attribu',record.attributeType,record.attributeType=='1')
// this.typeVisible[record.id]=false // this.typeVisible[record.id]=false
this.dictVal='list' this.dictVal='list'
this.dicVisible=true this.dicVisible=true
@@ -297,8 +299,8 @@
} }
}, },
afterDicVisibleChange(val) { afterDicVisibleChange(val) {
console.log('dicVisible',this.dicVisible) // console.log('dicVisible',this.dicVisible)
console.log('visible', val); // console.log('visible', val);
}, },
//字典列表关闭 //字典列表关闭
onDicClose() { onDicClose() {
@@ -1,6 +1,5 @@
<template> <template>
<div class="tag-item"> <div class="tag-item">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
@@ -253,6 +252,7 @@
...this.queryParam, ...this.queryParam,
isModel:1 isModel:1
} }
console.log('params',params)
if(val==1){ if(val==1){
params.isModel=1 params.isModel=1
}else if(val==0){ }else if(val==0){
@@ -355,6 +355,7 @@
// console.log('val',val) // console.log('val',val)
}, },
handleAddPop(val){ handleAddPop(val){
this.editData={}
this.drawerVisible=true this.drawerVisible=true
this.titleTag=this.$t('NewLabelItem') this.titleTag=this.$t('NewLabelItem')
this.submitEdit='add' this.submitEdit='add'