字典列表新增

This commit is contained in:
caoyang
2022-03-01 15:47:04 +08:00
parent f3dd356fc9
commit ace2989e51
3 changed files with 123 additions and 59 deletions
@@ -57,7 +57,7 @@ public class SysCategoryController {
* @param req * @param req
* @return * @return
*/ */
@RequiresPermissions("sys:category:list") // @RequiresPermissions("sys:category:list")
@GetMapping(value = "/rootList") @GetMapping(value = "/rootList")
public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory, public Result<IPage<SysCategory>> queryPageList(SysCategory sysCategory,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@@ -4,7 +4,6 @@
class="doc-table-drawer" class="doc-table-drawer"
title="调取已入库文件" title="调取已入库文件"
placement="right" placement="right"
v-if="visible"
:visible="visible" :visible="visible"
:after-visible-change="afterVisibleChange" :after-visible-change="afterVisibleChange"
@close="onClose" @close="onClose"
@@ -12,46 +11,54 @@
> >
<div class="doc-table-content"> <div class="doc-table-content">
<div class="doc-header"> <div class="doc-header">
<a-form layout="inline" v-model="queryParams" @keyup.enter.native="searchQuery(queryParams)"> <search :url="url" :flag="'condition'"></search>
<a-row :gutter="24"> <!-- <a-form layout="inline" v-model="queryParams" @keyup.enter.native="searchQuery(queryParams)">-->
<a-col :md="6" :sm="12"> <!-- <a-row :gutter="24">-->
<a-form-item :label="'编号'"> <!-- <a-col :md="6" :sm="12">-->
<j-input :placeholder="'请输入编号'" v-model="queryParams.serialNumber"></j-input> <!-- <a-form-item :label="'编号'">-->
</a-form-item> <!-- <j-input :placeholder="'请输入编号'" v-model="queryParams.serialNumber"></j-input>-->
</a-col> <!-- </a-form-item>-->
<a-col :md="6" :sm="12"> <!-- </a-col>-->
<a-form-item :label="'标题'"> <!-- <a-col :md="6" :sm="12">-->
<j-input :placeholder="'请输入标题'" v-model="queryParams.title"></j-input> <!-- <a-form-item :label="'标题'">-->
</a-form-item> <!-- <j-input :placeholder="'请输入标题'" v-model="queryParams.title"></j-input>-->
</a-col> <!-- </a-form-item>-->
<a-col :md="6" :sm="8"> <!-- </a-col>-->
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <!-- <a-col :md="6" :sm="8">-->
<a-button type="primary" @click="searchQuery" icon="search">{{$t('query')}}</a-button> <!-- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
<a-button @click="searchReset" icon="reload" style="margin-left: 8px">清空</a-button> <!-- <a-button type="primary" @click="searchQuery" icon="search">{{$t('query')}}</a-button>-->
</span> <!-- <a-button @click="searchReset" icon="reload" style="margin-left: 8px">清空</a-button>-->
</a-col> <!-- </span>-->
</a-row> <!-- </a-col>-->
</a-form> <!-- </a-row>-->
<!-- </a-form>-->
</div> </div>
</div> </div>
<div class="doc-table-detail"> <div class="doc-table-detail">
<a-table bordered :data-source="tableSource" :columns="columns" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="tag-con-table" :pagination="false" > <tableData
<span slot="num" slot-scope="text,records,index"> :flag="'header'"
{{ (queryParams.pageNo-1)*queryParams.pageSize+Number(index)+1 }} :url="url"
</span> :showAction="false"
</a-table> @onSelectChange="onSelectChange"
<div class="page" v-if="tableSource.length > 0"> />
<a-pagination
:show-total="total => `共 ${total} 条`"
show-quick-jumper
show-size-changer
:page-size.sync="queryParams.pageSize"
:total="total"
@change="onChangePage"
@showSizeChange="SizeChange"
/>
</div>
</div> </div>
<!-- <a-table bordered :data-source="tableSource" :columns="columns" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" class="tag-con-table" :pagination="false" >-->
<!-- <span slot="num" slot-scope="text,records,index">-->
<!-- {{ (queryParams.pageNo-1)*queryParams.pageSize+Number(index)+1 }}-->
<!-- </span>-->
<!-- </a-table>-->
<!-- <div class="page" v-if="tableSource.length > 0">-->
<!-- <a-pagination-->
<!-- :show-total="total => `共 ${total} 条`"-->
<!-- show-quick-jumper-->
<!-- show-size-changer-->
<!-- :page-size.sync="queryParams.pageSize"-->
<!-- :total="total"-->
<!-- @change="onChangePage"-->
<!-- @showSizeChange="SizeChange"-->
<!-- />-->
<!-- </div>-->
<!-- </div>-->
<div class="doc-table-footer"> <div class="doc-table-footer">
<a-button type="primary" class="btn-export" @click="tableExport">导入</a-button> <a-button type="primary" class="btn-export" @click="tableExport">导入</a-button>
<a-button type="primary" @click="onClose">取消</a-button> <a-button type="primary" @click="onClose">取消</a-button>
@@ -62,8 +69,15 @@
<script> <script>
import { getAction, postAction, deleteAction } from '@/api/manage' import { getAction, postAction, deleteAction } from '@/api/manage'
import search from '@/components/search/index'
import tableData from '@/components/tableDate/index'
export default { export default {
name: 'docTable', name: 'docTable',
components:{
search,
tableData,
},
props:{ props:{
drawVisible:Boolean, drawVisible:Boolean,
drawTableSorce:Array, drawTableSorce:Array,
@@ -79,6 +93,7 @@
title:'' title:''
}, },
total:0, total:0,
OperationList:[],
ipagination: { ipagination: {
defaultPageSize: 10, defaultPageSize: 10,
defaultCurrent: 1, defaultCurrent: 1,
@@ -137,11 +152,18 @@
ellipsis: true, ellipsis: true,
}, },
], ],
url:{
tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForOcr', //表格头部字段
seachList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForOcr', //搜索字段
tableList: 'document/bussDocumentLibraryEO/ocrPageInfo', //表格数据
// getAddForm: 'ocr/ocrRecord/getForm', // 表单的字段
// addInfo: 'ocr/OcrRestful/addOcrRecord', //新增
}
} }
}, },
mounted() { mounted() {
this.visible=this.drawVisible this.visible=this.drawVisible
this.loadData() // this.loadData()
// this.tableSource= [...this.drawTableSorce] // this.tableSource= [...this.drawTableSorce]
}, },
methods: { methods: {
@@ -172,6 +194,7 @@
}, },
onSelectChange(rowKeys){ onSelectChange(rowKeys){
console.log('key',rowKeys) console.log('key',rowKeys)
}, },
//点击页数 //点击页数
@@ -212,4 +235,14 @@
margin-right: 20px; margin-right: 20px;
} }
} }
</style>
<style lang="less">
.doc-header{
.table-page-search-submitButtons{
float: none!important;
}
}
</style> </style>
@@ -30,11 +30,11 @@
:wrapper-col="wrapperCol" :wrapper-col="wrapperCol"
> >
<a-form-model-item label="名称" prop="dictName"> <a-form-model-item label="名称" prop="itemText">
<a-input v-model="form.dictName" placeholder="请输入名称" /> <a-input v-model="form.itemText" placeholder="请输入名称" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="英文名称" prop="dictEnName"> <a-form-model-item label="英文名称" prop="itemValue">
<a-input v-model="form.dictEnName" placeholder="请输入英文名称" /> <a-input v-model="form.itemValue" placeholder="请输入英文名称" />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="父级名称" prop="dictCode" v-if="parentVisible"> <a-form-model-item label="父级名称" prop="dictCode" v-if="parentVisible">
<a-tree-select <a-tree-select
@@ -87,14 +87,16 @@
form:{}, form:{},
newVisible:false, newVisible:false,
rules:{ rules:{
dictName:[ itemText:[
{ required: true, message: '请输入展示区域', trigger: 'blur' }, { required: true, message: '请输入名称', trigger: 'blur' },
{ min:1, max: 30, message: '长度在 1 - 30字符', trigger: 'blur' }, { min:1, max: 30, message: '长度在 1 - 30字符', trigger: 'blur' },
], ],
dictEnName:[ itemValue:[
{ required: true, message: '请输入英文名称', trigger: 'blur' },
{ min:1, max: 100, message: '长度在 1 - 100字符', trigger: 'blur' }, { min:1, max: 100, message: '长度在 1 - 100字符', trigger: 'blur' },
], ],
description:[ description:[
{ required: true, message: '请输入描述', trigger: 'blur' },
{ min:1, max: 300, message: '长度在 1 - 300字符', trigger: 'blur' }, { min:1, max: 300, message: '长度在 1 - 300字符', trigger: 'blur' },
] ]
}, },
@@ -154,24 +156,45 @@
}, },
mounted() { mounted() {
this.loadData() this.loadData()
this.getParents()
}, },
methods:{ methods:{
//获取父级列表
getParents(){
let params={
sysDictId:this.record.id
}
getAction(`sys/dict/loadDictItem`,params).then(res=>{
if(res.success){
}
})
},
//获取列表数据 //获取列表数据
loadData(){ loadData(){
this.dataFlag=false this.dataFlag=false
let params={ if(this.dictVal=='list'){
...this.queryParams, let params={
dictId:this.record.id ...this.queryParams,
} dictId:this.record.id
getAction(`sys/dictItem/page`,params).then(res=>{ }
if(res.success){
this.total=res.result.total getAction(`sys/dictItem/page`,params).then(res=>{
if(this.dictVal=='list'){ if(res.success){
this.total=res.result.total
this.tableData=[...res.result.records] this.tableData=[...res.result.records]
this.dataFlag=true this.dataFlag=true
} }
}
}) })
}else if(this.dictVal=='tree'){
getAction(`sys/category/rootList`,{
sysDictId:this.record.id
}).then(res=>{
})
}
}, },
//搜索 //搜索
search(){ search(){
@@ -200,19 +223,26 @@
hideModal(){ hideModal(){
let params={ let params={
...this.form, ...this.form,
dictId:this.record.id
} }
if(this.isEdit){ if(this.isEdit){
params.dictId=this.record.id putAction(`sys/dictItem/edit`,params).then(res=>{
putAction(``,params).then(res=>{
if(res.success){ if(res.success){
this.$message.success(res.message)
this.loadData() this.loadData()
this.newVisible=false
}else{
this.$message.warning(res.message)
} }
}) })
}else{ }else{
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.loadData() this.loadData()
this.newVisible=false
}else{
this.$message.warning(res.message)
} }
}) })
} }
@@ -223,6 +253,7 @@
}, },
//列表编辑 //列表编辑
editDict(rec,val){ editDict(rec,val){
this.isEdit=true
this.form={...rec} this.form={...rec}
this.newVisible=val this.newVisible=val
this.parentVisible=false this.parentVisible=false