parent
d8aa09c0ee
commit
783cbda7f1
28 changed files with 2948 additions and 0 deletions
@ -0,0 +1,269 @@ |
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!-- 查询区域-END --> |
||||
|
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-button type="primary" icon="download" @click="handleExportXls('字段管理')">导出</a-button> |
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
||||
<a-button type="primary" icon="import">导入</a-button> |
||||
</a-upload> |
||||
<!-- 高级查询区域 --> |
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> |
||||
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> |
||||
</a-menu> |
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> |
||||
</a-dropdown> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
:scroll="{x:true}" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
||||
class="j-table-force-nowrap" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="downloadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
<a-dropdown> |
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item> |
||||
<a @click="handleDetail(record)">详情</a> |
||||
</a-menu-item> |
||||
<a-menu-item> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</a-menu-item> |
||||
</a-menu> |
||||
</a-dropdown> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<fieldx-modal ref="modalForm" @ok="modalFormOk"></fieldx-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import FieldxModal from './modules/FieldxModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
|
||||
export default { |
||||
name: 'FieldxList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
FieldxModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '字段管理管理页面', |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
{ |
||||
title:'对应实体id', |
||||
align:"center", |
||||
dataIndex: 'tableId' |
||||
}, |
||||
{ |
||||
title:'中文名称', |
||||
align:"center", |
||||
dataIndex: 'fieldName' |
||||
}, |
||||
{ |
||||
title:'英文名称', |
||||
align:"center", |
||||
dataIndex: 'fieldEnName' |
||||
}, |
||||
{ |
||||
title:'数据类型', |
||||
align:"center", |
||||
dataIndex: 'type_dictText' |
||||
}, |
||||
{ |
||||
title:'数据长度', |
||||
align:"center", |
||||
dataIndex: 'length' |
||||
}, |
||||
{ |
||||
title:'浮点精度', |
||||
align:"center", |
||||
dataIndex: 'accuracy' |
||||
}, |
||||
{ |
||||
title:'显示形式', |
||||
align:"center", |
||||
dataIndex: 'format' |
||||
}, |
||||
{ |
||||
title:'是否主键', |
||||
align:"center", |
||||
dataIndex: 'isPk_dictText' |
||||
}, |
||||
{ |
||||
title:'是否外键', |
||||
align:"center", |
||||
dataIndex: 'isFk_dictText' |
||||
}, |
||||
{ |
||||
title:'关联实体', |
||||
align:"center", |
||||
dataIndex: 'associateTable' |
||||
}, |
||||
{ |
||||
title:'关联字段', |
||||
align:"center", |
||||
dataIndex: 'associateField' |
||||
}, |
||||
{ |
||||
title:'是否为空', |
||||
align:"center", |
||||
dataIndex: 'isNull_dictText' |
||||
}, |
||||
{ |
||||
title:'是否重复', |
||||
align:"center", |
||||
dataIndex: 'isUniqueness_dictText' |
||||
}, |
||||
{ |
||||
title:'字段规则', |
||||
align:"center", |
||||
dataIndex: 'rule', |
||||
scopedSlots: {customRender: 'htmlSlot'} |
||||
}, |
||||
{ |
||||
title:'字段状态', |
||||
align:"center", |
||||
dataIndex: 'status_dictText' |
||||
}, |
||||
{ |
||||
title:'版本状态', |
||||
align:"center", |
||||
dataIndex: 'verisonStatus_dictText' |
||||
}, |
||||
{ |
||||
title:'版本号', |
||||
align:"center", |
||||
dataIndex: 'verison' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/fieldx/fieldx/list", |
||||
delete: "/fieldx/fieldx/delete", |
||||
deleteBatch: "/fieldx/fieldx/deleteBatch", |
||||
exportXlsUrl: "/fieldx/fieldx/exportXls", |
||||
importExcelUrl: "fieldx/fieldx/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'tableId',text:'对应实体id',dictCode:'tablex,table_name,id'}) |
||||
fieldList.push({type:'string',value:'fieldName',text:'中文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'fieldEnName',text:'英文名称',dictCode:''}) |
||||
fieldList.push({type:'sel_search',value:'type',text:'数据类型',dictTable:'', dictText:'', dictCode:'date_type'}) |
||||
fieldList.push({type:'int',value:'length',text:'数据长度',dictCode:''}) |
||||
fieldList.push({type:'int',value:'accuracy',text:'浮点精度',dictCode:''}) |
||||
fieldList.push({type:'string',value:'format',text:'显示形式',dictCode:''}) |
||||
fieldList.push({type:'int',value:'isPk',text:'是否主键',dictCode:''}) |
||||
fieldList.push({type:'int',value:'isFk',text:'是否外键',dictCode:''}) |
||||
fieldList.push({type:'string',value:'associateTable',text:'关联实体',dictCode:'tablex,table_name,id'}) |
||||
fieldList.push({type:'string',value:'associateField',text:'关联字段',dictCode:'fieldx,field_name,id'}) |
||||
fieldList.push({type:'int',value:'isNull',text:'是否为空',dictCode:''}) |
||||
fieldList.push({type:'int',value:'isUniqueness',text:'是否重复',dictCode:''}) |
||||
fieldList.push({type:'string',value:'rule',text:'字段规则',dictCode:''}) |
||||
fieldList.push({type:'int',value:'status',text:'字段状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verison',text:'版本号',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,211 @@ |
||||
<template> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<j-form-container :disabled="formDisabled"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
||||
<a-row> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="对应实体id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableId"> |
||||
<a-input v-model="model.tableId" placeholder="请输入对应实体id" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="中文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldName"> |
||||
<a-input v-model="model.fieldName" placeholder="请输入中文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="英文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldEnName"> |
||||
<a-input v-model="model.fieldEnName" placeholder="请输入英文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="数据类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> |
||||
<j-search-select-tag v-model="model.type" dict="date_type" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="数据长度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="length"> |
||||
<a-input-number v-model="model.length" placeholder="请输入数据长度" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="浮点精度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accuracy"> |
||||
<a-input-number v-model="model.accuracy" placeholder="请输入浮点精度" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="显示形式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="format"> |
||||
<a-input v-model="model.format" placeholder="请输入显示形式" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否主键" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isPk"> |
||||
<a-input-number v-model="model.isPk" placeholder="请输入是否主键" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否外键" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isFk"> |
||||
<a-input-number v-model="model.isFk" placeholder="请输入是否外键" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="关联实体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateTable"> |
||||
<a-input v-model="model.associateTable" placeholder="请输入关联实体" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="关联字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateField"> |
||||
<a-input v-model="model.associateField" placeholder="请输入关联字段" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否为空" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isNull"> |
||||
<a-input-number v-model="model.isNull" placeholder="请输入是否为空" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否重复" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isUniqueness"> |
||||
<a-input-number v-model="model.isUniqueness" placeholder="请输入是否重复" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="字段规则" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rule"> |
||||
<j-editor v-model="model.rule" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="字段状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> |
||||
<a-input-number v-model="model.status" placeholder="请输入字段状态" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="版本状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verisonStatus"> |
||||
<a-input-number v-model="model.verisonStatus" placeholder="请输入版本状态" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="版本号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verison"> |
||||
<a-input-number v-model="model.verison" placeholder="请输入版本号" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
</a-row> |
||||
</a-form-model> |
||||
</j-form-container> |
||||
</a-spin> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction, getAction } from '@/api/manage' |
||||
import { validateDuplicateValue } from '@/utils/util' |
||||
|
||||
export default { |
||||
name: 'FieldxForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用 |
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
model:{ |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
tableId: [ |
||||
{ required: true, message: '请输入对应实体id!'}, |
||||
], |
||||
fieldName: [ |
||||
{ required: true, message: '请输入中文名称!'}, |
||||
], |
||||
fieldEnName: [ |
||||
{ required: true, message: '请输入英文名称!'}, |
||||
], |
||||
type: [ |
||||
{ required: true, message: '请输入数据类型!'}, |
||||
], |
||||
isNull: [ |
||||
{ required: true, message: '请输入是否为空!'}, |
||||
], |
||||
isUniqueness: [ |
||||
{ required: true, message: '请输入是否重复!'}, |
||||
], |
||||
status: [ |
||||
{ required: true, message: '请输入字段状态!'}, |
||||
], |
||||
verisonStatus: [ |
||||
{ required: true, message: '请输入版本状态!'}, |
||||
], |
||||
verison: [ |
||||
{ required: true, message: '请输入版本号!'}, |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/fieldx/fieldx/add", |
||||
edit: "/fieldx/fieldx/edit", |
||||
queryById: "/fieldx/fieldx/queryById" |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
//备份model原始值 |
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.edit(this.modelDefault); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
submitForm () { |
||||
const that = this; |
||||
// 触发表单验证 |
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
httpAction(httpurl,this.model,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,60 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
switchFullscreen |
||||
@ok="handleOk" |
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<fieldx-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></fieldx-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import FieldxForm from './FieldxForm' |
||||
export default { |
||||
name: 'FieldxModal', |
||||
components: { |
||||
FieldxForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:'', |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,84 @@ |
||||
<template> |
||||
<a-drawer |
||||
:title="title" |
||||
:width="width" |
||||
placement="right" |
||||
:closable="false" |
||||
@close="close" |
||||
destroyOnClose |
||||
:visible="visible"> |
||||
<fieldx-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></fieldx-form> |
||||
<div class="drawer-footer"> |
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> |
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> |
||||
</div> |
||||
</a-drawer> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import FieldxForm from './FieldxForm' |
||||
|
||||
export default { |
||||
name: 'FieldxModal', |
||||
components: { |
||||
FieldxForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}); |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
/** Button按钮间距 */ |
||||
.ant-btn { |
||||
margin-left: 30px; |
||||
margin-bottom: 30px; |
||||
float: right; |
||||
} |
||||
.drawer-footer{ |
||||
position: absolute; |
||||
bottom: -8px; |
||||
width: 100%; |
||||
border-top: 1px solid #e8e8e8; |
||||
padding: 10px 16px; |
||||
text-align: right; |
||||
left: 0; |
||||
background: #fff; |
||||
border-radius: 0 0 2px 2px; |
||||
} |
||||
</style> |
@ -0,0 +1,214 @@ |
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!-- 查询区域-END --> |
||||
|
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-button type="primary" icon="download" @click="handleExportXls('实体表')">导出</a-button> |
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
||||
<a-button type="primary" icon="import">导入</a-button> |
||||
</a-upload> |
||||
<!-- 高级查询区域 --> |
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> |
||||
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> |
||||
</a-menu> |
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> |
||||
</a-dropdown> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
:scroll="{x:true}" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
||||
class="j-table-force-nowrap" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="downloadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
<a-dropdown> |
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item> |
||||
<a @click="handleDetail(record)">详情</a> |
||||
</a-menu-item> |
||||
<a-menu-item> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</a-menu-item> |
||||
</a-menu> |
||||
</a-dropdown> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<tablex-modal ref="modalForm" @ok="modalFormOk"></tablex-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import TablexModal from './modules/TablexModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
|
||||
export default { |
||||
name: 'TablexList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
TablexModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '实体表管理页面', |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
{ |
||||
title:'对应模块id', |
||||
align:"center", |
||||
dataIndex: 'moduleId_dictText' |
||||
}, |
||||
{ |
||||
title:'中文名称', |
||||
align:"center", |
||||
dataIndex: 'tableName' |
||||
}, |
||||
{ |
||||
title:'英文名称', |
||||
align:"center", |
||||
dataIndex: 'tableEnName' |
||||
}, |
||||
{ |
||||
title:'表结构SQL', |
||||
align:"center", |
||||
dataIndex: 'tableStructure' |
||||
}, |
||||
{ |
||||
title:'结构图', |
||||
align:"center", |
||||
dataIndex: 'structuralDiagram' |
||||
}, |
||||
{ |
||||
title:'实体状态', |
||||
align:"center", |
||||
dataIndex: 'status_dictText' |
||||
}, |
||||
{ |
||||
title:'版本状态', |
||||
align:"center", |
||||
dataIndex: 'verisonStatus_dictText' |
||||
}, |
||||
{ |
||||
title:'版本号', |
||||
align:"center", |
||||
dataIndex: 'verison' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/tablex/tablex/list", |
||||
delete: "/tablex/tablex/delete", |
||||
deleteBatch: "/tablex/tablex/deleteBatch", |
||||
exportXlsUrl: "/tablex/tablex/exportXls", |
||||
importExcelUrl: "tablex/tablex/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'sel_search',value:'moduleId',text:'对应模块id',dictTable:'modulex', dictText:'module_name', dictCode:'id'}) |
||||
fieldList.push({type:'string',value:'tableName',text:'中文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'tableEnName',text:'英文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'tableStructure',text:'表结构SQL',dictCode:''}) |
||||
fieldList.push({type:'string',value:'structuralDiagram',text:'结构图',dictCode:''}) |
||||
fieldList.push({type:'int',value:'status',text:'实体状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verison',text:'版本号',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,157 @@ |
||||
<template> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<j-form-container :disabled="formDisabled"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
||||
<a-row> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="对应模块id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleId"> |
||||
<j-search-select-tag v-model="model.moduleId" dict="modulex,module_name,id" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="中文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableName"> |
||||
<a-input v-model="model.tableName" placeholder="请输入中文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="英文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableEnName"> |
||||
<a-input v-model="model.tableEnName" placeholder="请输入英文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="表结构SQL" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableStructure"> |
||||
<a-input v-model="model.tableStructure" placeholder="请输入表结构SQL" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="结构图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="structuralDiagram"> |
||||
<j-image-upload v-model="model.structuralDiagram" placeholder="请输入结构图" ></j-image-upload> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="实体状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> |
||||
<a-input-number v-model="model.status" placeholder="请输入实体状态" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="版本状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verisonStatus"> |
||||
<a-input-number v-model="model.verisonStatus" placeholder="请输入版本状态" dict="yn" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="版本号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verison">--> |
||||
<!-- <a-input-number v-model="model.verison" placeholder="请输入版本号" style="width: 100%" />--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
</a-row> |
||||
</a-form-model> |
||||
</j-form-container> |
||||
</a-spin> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction, getAction } from '@/api/manage' |
||||
import { validateDuplicateValue } from '@/utils/util' |
||||
|
||||
export default { |
||||
name: 'TablexForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用 |
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
model:{ |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
moduleId: [ |
||||
{ required: true, message: '请输入对应模块id!'}, |
||||
], |
||||
tableName: [ |
||||
{ required: true, message: '请输入中文名称!'}, |
||||
], |
||||
tableEnName: [ |
||||
{ required: true, message: '请输入英文名称!'}, |
||||
], |
||||
status: [ |
||||
{ required: true, message: '请输入实体状态!'}, |
||||
], |
||||
verisonStatus: [ |
||||
{ required: true, message: '请输入版本状态!'}, |
||||
], |
||||
verison: [ |
||||
{ required: true, message: '请输入版本号!'}, |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/tablex/tablex/add", |
||||
edit: "/tablex/tablex/edit", |
||||
queryById: "/tablex/tablex/queryById" |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
//备份model原始值 |
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.edit(this.modelDefault); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
submitForm () { |
||||
const that = this; |
||||
// 触发表单验证 |
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
httpAction(httpurl,this.model,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,60 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
switchFullscreen |
||||
@ok="handleOk" |
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<tablex-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></tablex-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import TablexForm from './TablexForm' |
||||
export default { |
||||
name: 'TablexModal', |
||||
components: { |
||||
TablexForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:'', |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,84 @@ |
||||
<template> |
||||
<a-drawer |
||||
:title="title" |
||||
:width="width" |
||||
placement="right" |
||||
:closable="false" |
||||
@close="close" |
||||
destroyOnClose |
||||
:visible="visible"> |
||||
<tablex-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></tablex-form> |
||||
<div class="drawer-footer"> |
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> |
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> |
||||
</div> |
||||
</a-drawer> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import TablexForm from './TablexForm' |
||||
|
||||
export default { |
||||
name: 'TablexModal', |
||||
components: { |
||||
TablexForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}); |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
/** Button按钮间距 */ |
||||
.ant-btn { |
||||
margin-left: 30px; |
||||
margin-bottom: 30px; |
||||
float: right; |
||||
} |
||||
.drawer-footer{ |
||||
position: absolute; |
||||
bottom: -8px; |
||||
width: 100%; |
||||
border-top: 1px solid #e8e8e8; |
||||
padding: 10px 16px; |
||||
text-align: right; |
||||
left: 0; |
||||
background: #fff; |
||||
border-radius: 0 0 2px 2px; |
||||
} |
||||
</style> |
@ -0,0 +1,171 @@ |
||||
package org.jeecg.modules.fieldx.controller; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.URLDecoder; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
import org.jeecg.modules.fieldx.entity.Fieldx; |
||||
import org.jeecg.modules.fieldx.service.IFieldxService; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 字段管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="字段管理") |
||||
@RestController |
||||
@RequestMapping("/fieldx/fieldx") |
||||
@Slf4j |
||||
public class FieldxController extends JeecgController<Fieldx, IFieldxService> { |
||||
@Autowired |
||||
private IFieldxService fieldxService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param fieldx |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "字段管理-分页列表查询") |
||||
@ApiOperation(value="字段管理-分页列表查询", notes="字段管理-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(Fieldx fieldx, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<Fieldx> queryWrapper = QueryGenerator.initQueryWrapper(fieldx, req.getParameterMap()); |
||||
Page<Fieldx> page = new Page<Fieldx>(pageNo, pageSize); |
||||
IPage<Fieldx> pageList = fieldxService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param fieldx |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "字段管理-添加") |
||||
@ApiOperation(value="字段管理-添加", notes="字段管理-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody Fieldx fieldx) { |
||||
fieldxService.save(fieldx); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param fieldx |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "字段管理-编辑") |
||||
@ApiOperation(value="字段管理-编辑", notes="字段管理-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody Fieldx fieldx) { |
||||
fieldxService.updateById(fieldx); |
||||
return Result.OK("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "字段管理-通过id删除") |
||||
@ApiOperation(value="字段管理-通过id删除", notes="字段管理-通过id删除") |
||||
@DeleteMapping(value = "/delete") |
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
||||
fieldxService.removeById(id); |
||||
return Result.OK("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "字段管理-批量删除") |
||||
@ApiOperation(value="字段管理-批量删除", notes="字段管理-批量删除") |
||||
@DeleteMapping(value = "/deleteBatch") |
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
||||
this.fieldxService.removeByIds(Arrays.asList(ids.split(","))); |
||||
return Result.OK("批量删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "字段管理-通过id查询") |
||||
@ApiOperation(value="字段管理-通过id查询", notes="字段管理-通过id查询") |
||||
@GetMapping(value = "/queryById") |
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
||||
Fieldx fieldx = fieldxService.getById(id); |
||||
if(fieldx==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(fieldx); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param fieldx |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, Fieldx fieldx) { |
||||
return super.exportXls(request, fieldx, Fieldx.class, "字段管理"); |
||||
} |
||||
|
||||
/** |
||||
* 通过excel导入数据 |
||||
* |
||||
* @param request |
||||
* @param response |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
||||
return super.importExcel(request, response, Fieldx.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,129 @@ |
||||
package org.jeecg.modules.fieldx.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 字段管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("fieldx") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="fieldx对象", description="字段管理") |
||||
public class Fieldx implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private java.lang.String id; |
||||
/**对应实体id*/ |
||||
@Excel(name = "对应实体id", width = 15) |
||||
@ApiModelProperty(value = "对应实体id") |
||||
private java.lang.String tableId; |
||||
/**中文名称*/ |
||||
@Excel(name = "中文名称", width = 15) |
||||
@ApiModelProperty(value = "中文名称") |
||||
private java.lang.String fieldName; |
||||
/**英文名称*/ |
||||
@Excel(name = "英文名称", width = 15) |
||||
@ApiModelProperty(value = "英文名称") |
||||
private java.lang.String fieldEnName; |
||||
/**数据类型*/ |
||||
@Excel(name = "数据类型", width = 15, dicCode = "date_type") |
||||
@Dict(dicCode = "date_type") |
||||
@ApiModelProperty(value = "数据类型") |
||||
private java.lang.Integer type; |
||||
/**数据长度*/ |
||||
@Excel(name = "数据长度", width = 15) |
||||
@ApiModelProperty(value = "数据长度") |
||||
private java.lang.Integer length; |
||||
/**浮点精度*/ |
||||
@Excel(name = "浮点精度", width = 15) |
||||
@ApiModelProperty(value = "浮点精度") |
||||
private java.lang.Integer accuracy; |
||||
/**显示形式*/ |
||||
@Excel(name = "显示形式", width = 15) |
||||
@ApiModelProperty(value = "显示形式") |
||||
private java.lang.String format; |
||||
/**是否主键*/ |
||||
@Excel(name = "是否主键", width = 15,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "是否主键") |
||||
private java.lang.Integer isPk; |
||||
/**是否外键*/ |
||||
@Excel(name = "是否外键", width = 15,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "是否外键") |
||||
private java.lang.Integer isFk; |
||||
/**关联实体*/ |
||||
@Excel(name = "关联实体", width = 15) |
||||
@ApiModelProperty(value = "关联实体") |
||||
private java.lang.String associateTable; |
||||
/**关联字段*/ |
||||
@Excel(name = "关联字段", width = 15) |
||||
@ApiModelProperty(value = "关联字段") |
||||
private java.lang.String associateField; |
||||
/**是否为空*/ |
||||
@Excel(name = "是否为空", width = 15,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "是否为空") |
||||
private java.lang.Integer isNull; |
||||
/**是否重复*/ |
||||
@Excel(name = "是否重复", width = 15,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "是否重复") |
||||
private java.lang.Integer isUniqueness; |
||||
/**字段规则*/ |
||||
@Excel(name = "字段规则", width = 15) |
||||
@ApiModelProperty(value = "字段规则") |
||||
private java.lang.String rule; |
||||
/**创建人*/ |
||||
@ApiModelProperty(value = "创建人") |
||||
private java.lang.String createBy; |
||||
/**创建时间*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "创建时间") |
||||
private java.util.Date createTime; |
||||
/**修改人*/ |
||||
@ApiModelProperty(value = "修改人") |
||||
private java.lang.String updateBy; |
||||
/**修改时间*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "修改时间") |
||||
private java.util.Date updateTime; |
||||
/**字段状态*/ |
||||
@Excel(name = "字段状态", width = 15,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "字段状态") |
||||
private java.lang.Integer status; |
||||
/**版本状态*/ |
||||
@Excel(name = "版本状态", width = 15 ,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "版本状态") |
||||
private java.lang.Integer verisonStatus; |
||||
/**版本号*/ |
||||
@Excel(name = "版本号", width = 15) |
||||
@ApiModelProperty(value = "版本号") |
||||
private java.lang.Integer verison; |
||||
} |
@ -0,0 +1,17 @@ |
||||
package org.jeecg.modules.fieldx.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.fieldx.entity.Fieldx; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 字段管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface FieldxMapper extends BaseMapper<Fieldx> { |
||||
|
||||
} |
@ -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=".fieldx.mapper.FieldxMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
package org.jeecg.modules.fieldx.service; |
||||
|
||||
import org.jeecg.modules.fieldx.entity.Fieldx; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: 字段管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IFieldxService extends IService<Fieldx> { |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package org.jeecg.modules.fieldx.service.impl; |
||||
|
||||
import org.jeecg.modules.fieldx.entity.Fieldx; |
||||
import org.jeecg.modules.fieldx.mapper.FieldxMapper; |
||||
import org.jeecg.modules.fieldx.service.IFieldxService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 字段管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class FieldxServiceImpl extends ServiceImpl<FieldxMapper, Fieldx> implements IFieldxService { |
||||
|
||||
} |
@ -0,0 +1,269 @@ |
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!-- 查询区域-END --> |
||||
|
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-button type="primary" icon="download" @click="handleExportXls('字段管理')">导出</a-button> |
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
||||
<a-button type="primary" icon="import">导入</a-button> |
||||
</a-upload> |
||||
<!-- 高级查询区域 --> |
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> |
||||
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> |
||||
</a-menu> |
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> |
||||
</a-dropdown> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
:scroll="{x:true}" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
||||
class="j-table-force-nowrap" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="downloadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
<a-dropdown> |
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item> |
||||
<a @click="handleDetail(record)">详情</a> |
||||
</a-menu-item> |
||||
<a-menu-item> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</a-menu-item> |
||||
</a-menu> |
||||
</a-dropdown> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<fieldx-modal ref="modalForm" @ok="modalFormOk"></fieldx-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import FieldxModal from './modules/FieldxModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
|
||||
export default { |
||||
name: 'FieldxList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
FieldxModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '字段管理管理页面', |
||||
// 表头
|
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
{ |
||||
title:'对应实体id', |
||||
align:"center", |
||||
dataIndex: 'tableId' |
||||
}, |
||||
{ |
||||
title:'中文名称', |
||||
align:"center", |
||||
dataIndex: 'fieldName' |
||||
}, |
||||
{ |
||||
title:'英文名称', |
||||
align:"center", |
||||
dataIndex: 'fieldEnName' |
||||
}, |
||||
{ |
||||
title:'数据类型', |
||||
align:"center", |
||||
dataIndex: 'type_dictText' |
||||
}, |
||||
{ |
||||
title:'数据长度', |
||||
align:"center", |
||||
dataIndex: 'length' |
||||
}, |
||||
{ |
||||
title:'浮点精度', |
||||
align:"center", |
||||
dataIndex: 'accuracy' |
||||
}, |
||||
{ |
||||
title:'显示形式', |
||||
align:"center", |
||||
dataIndex: 'format' |
||||
}, |
||||
{ |
||||
title:'是否主键', |
||||
align:"center", |
||||
dataIndex: 'isPk' |
||||
}, |
||||
{ |
||||
title:'是否外键', |
||||
align:"center", |
||||
dataIndex: 'isFk' |
||||
}, |
||||
{ |
||||
title:'关联实体', |
||||
align:"center", |
||||
dataIndex: 'associateTable' |
||||
}, |
||||
{ |
||||
title:'关联字段', |
||||
align:"center", |
||||
dataIndex: 'associateField' |
||||
}, |
||||
{ |
||||
title:'是否为空', |
||||
align:"center", |
||||
dataIndex: 'isNull' |
||||
}, |
||||
{ |
||||
title:'是否重复', |
||||
align:"center", |
||||
dataIndex: 'isUniqueness' |
||||
}, |
||||
{ |
||||
title:'字段规则', |
||||
align:"center", |
||||
dataIndex: 'rule', |
||||
scopedSlots: {customRender: 'htmlSlot'} |
||||
}, |
||||
{ |
||||
title:'字段状态', |
||||
align:"center", |
||||
dataIndex: 'status' |
||||
}, |
||||
{ |
||||
title:'版本状态', |
||||
align:"center", |
||||
dataIndex: 'verisonStatus' |
||||
}, |
||||
{ |
||||
title:'版本号', |
||||
align:"center", |
||||
dataIndex: 'verison' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/fieldx/fieldx/list", |
||||
delete: "/fieldx/fieldx/delete", |
||||
deleteBatch: "/fieldx/fieldx/deleteBatch", |
||||
exportXlsUrl: "/fieldx/fieldx/exportXls", |
||||
importExcelUrl: "fieldx/fieldx/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'tableId',text:'对应实体id',dictCode:'tablex,table_name,id'}) |
||||
fieldList.push({type:'string',value:'fieldName',text:'中文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'fieldEnName',text:'英文名称',dictCode:''}) |
||||
fieldList.push({type:'sel_search',value:'type',text:'数据类型',dictTable:'', dictText:'', dictCode:'date_type'}) |
||||
fieldList.push({type:'int',value:'length',text:'数据长度',dictCode:''}) |
||||
fieldList.push({type:'int',value:'accuracy',text:'浮点精度',dictCode:''}) |
||||
fieldList.push({type:'string',value:'format',text:'显示形式',dictCode:''}) |
||||
fieldList.push({type:'int',value:'isPk',text:'是否主键',dictCode:''}) |
||||
fieldList.push({type:'int',value:'isFk',text:'是否外键',dictCode:''}) |
||||
fieldList.push({type:'string',value:'associateTable',text:'关联实体',dictCode:'tablex,table_name,id'}) |
||||
fieldList.push({type:'string',value:'associateField',text:'关联字段',dictCode:'fieldx,field_name,id'}) |
||||
fieldList.push({type:'int',value:'isNull',text:'是否为空',dictCode:''}) |
||||
fieldList.push({type:'int',value:'isUniqueness',text:'是否重复',dictCode:''}) |
||||
fieldList.push({type:'string',value:'rule',text:'字段规则',dictCode:''}) |
||||
fieldList.push({type:'int',value:'status',text:'字段状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verison',text:'版本号',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,211 @@ |
||||
<template> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<j-form-container :disabled="formDisabled"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
||||
<a-row> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="对应实体id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableId"> |
||||
<a-input v-model="model.tableId" placeholder="请输入对应实体id" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="中文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldName"> |
||||
<a-input v-model="model.fieldName" placeholder="请输入中文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="英文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fieldEnName"> |
||||
<a-input v-model="model.fieldEnName" placeholder="请输入英文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="数据类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> |
||||
<j-search-select-tag v-model="model.type" dict="date_type" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="数据长度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="length"> |
||||
<a-input-number v-model="model.length" placeholder="请输入数据长度" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="浮点精度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accuracy"> |
||||
<a-input-number v-model="model.accuracy" placeholder="请输入浮点精度" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="显示形式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="format"> |
||||
<a-input v-model="model.format" placeholder="请输入显示形式" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否主键" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isPk"> |
||||
<a-input-number v-model="model.isPk" placeholder="请输入是否主键" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否外键" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isFk"> |
||||
<a-input-number v-model="model.isFk" placeholder="请输入是否外键" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="关联实体" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateTable"> |
||||
<a-input v-model="model.associateTable" placeholder="请输入关联实体" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="关联字段" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="associateField"> |
||||
<a-input v-model="model.associateField" placeholder="请输入关联字段" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否为空" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isNull"> |
||||
<a-input-number v-model="model.isNull" placeholder="请输入是否为空" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="是否重复" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="isUniqueness"> |
||||
<a-input-number v-model="model.isUniqueness" placeholder="请输入是否重复" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="字段规则" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rule"> |
||||
<j-editor v-model="model.rule" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="字段状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> |
||||
<a-input-number v-model="model.status" placeholder="请输入字段状态" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="版本状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verisonStatus"> |
||||
<a-input-number v-model="model.verisonStatus" placeholder="请输入版本状态" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="版本号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verison"> |
||||
<a-input-number v-model="model.verison" placeholder="请输入版本号" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
</a-row> |
||||
</a-form-model> |
||||
</j-form-container> |
||||
</a-spin> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction, getAction } from '@/api/manage' |
||||
import { validateDuplicateValue } from '@/utils/util' |
||||
|
||||
export default { |
||||
name: 'FieldxForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用
|
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
model:{ |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
tableId: [ |
||||
{ required: true, message: '请输入对应实体id!'}, |
||||
], |
||||
fieldName: [ |
||||
{ required: true, message: '请输入中文名称!'}, |
||||
], |
||||
fieldEnName: [ |
||||
{ required: true, message: '请输入英文名称!'}, |
||||
], |
||||
type: [ |
||||
{ required: true, message: '请输入数据类型!'}, |
||||
], |
||||
isNull: [ |
||||
{ required: true, message: '请输入是否为空!'}, |
||||
], |
||||
isUniqueness: [ |
||||
{ required: true, message: '请输入是否重复!'}, |
||||
], |
||||
status: [ |
||||
{ required: true, message: '请输入字段状态!'}, |
||||
], |
||||
verisonStatus: [ |
||||
{ required: true, message: '请输入版本状态!'}, |
||||
], |
||||
verison: [ |
||||
{ required: true, message: '请输入版本号!'}, |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/fieldx/fieldx/add", |
||||
edit: "/fieldx/fieldx/edit", |
||||
queryById: "/fieldx/fieldx/queryById" |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.edit(this.modelDefault); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
submitForm () { |
||||
const that = this; |
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
httpAction(httpurl,this.model,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,60 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
switchFullscreen |
||||
@ok="handleOk" |
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<fieldx-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></fieldx-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import FieldxForm from './FieldxForm' |
||||
export default { |
||||
name: 'FieldxModal', |
||||
components: { |
||||
FieldxForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:'', |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,84 @@ |
||||
<template> |
||||
<a-drawer |
||||
:title="title" |
||||
:width="width" |
||||
placement="right" |
||||
:closable="false" |
||||
@close="close" |
||||
destroyOnClose |
||||
:visible="visible"> |
||||
<fieldx-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></fieldx-form> |
||||
<div class="drawer-footer"> |
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> |
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> |
||||
</div> |
||||
</a-drawer> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import FieldxForm from './FieldxForm' |
||||
|
||||
export default { |
||||
name: 'FieldxModal', |
||||
components: { |
||||
FieldxForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}); |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
/** Button按钮间距 */ |
||||
.ant-btn { |
||||
margin-left: 30px; |
||||
margin-bottom: 30px; |
||||
float: right; |
||||
} |
||||
.drawer-footer{ |
||||
position: absolute; |
||||
bottom: -8px; |
||||
width: 100%; |
||||
border-top: 1px solid #e8e8e8; |
||||
padding: 10px 16px; |
||||
text-align: right; |
||||
left: 0; |
||||
background: #fff; |
||||
border-radius: 0 0 2px 2px; |
||||
} |
||||
</style> |
@ -0,0 +1,171 @@ |
||||
package org.jeecg.modules.tablex.controller; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.URLDecoder; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
import org.jeecg.modules.tablex.entity.Tablex; |
||||
import org.jeecg.modules.tablex.service.ITablexService; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 实体表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="实体表") |
||||
@RestController |
||||
@RequestMapping("/tablex/tablex") |
||||
@Slf4j |
||||
public class TablexController extends JeecgController<Tablex, ITablexService> { |
||||
@Autowired |
||||
private ITablexService tablexService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param tablex |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "实体表-分页列表查询") |
||||
@ApiOperation(value="实体表-分页列表查询", notes="实体表-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(Tablex tablex, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<Tablex> queryWrapper = QueryGenerator.initQueryWrapper(tablex, req.getParameterMap()); |
||||
Page<Tablex> page = new Page<Tablex>(pageNo, pageSize); |
||||
IPage<Tablex> pageList = tablexService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param tablex |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "实体表-添加") |
||||
@ApiOperation(value="实体表-添加", notes="实体表-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody Tablex tablex) { |
||||
tablexService.save(tablex); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param tablex |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "实体表-编辑") |
||||
@ApiOperation(value="实体表-编辑", notes="实体表-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody Tablex tablex) { |
||||
tablexService.updateById(tablex); |
||||
return Result.OK("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "实体表-通过id删除") |
||||
@ApiOperation(value="实体表-通过id删除", notes="实体表-通过id删除") |
||||
@DeleteMapping(value = "/delete") |
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
||||
tablexService.removeById(id); |
||||
return Result.OK("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "实体表-批量删除") |
||||
@ApiOperation(value="实体表-批量删除", notes="实体表-批量删除") |
||||
@DeleteMapping(value = "/deleteBatch") |
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
||||
this.tablexService.removeByIds(Arrays.asList(ids.split(","))); |
||||
return Result.OK("批量删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "实体表-通过id查询") |
||||
@ApiOperation(value="实体表-通过id查询", notes="实体表-通过id查询") |
||||
@GetMapping(value = "/queryById") |
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
||||
Tablex tablex = tablexService.getById(id); |
||||
if(tablex==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(tablex); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param tablex |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, Tablex tablex) { |
||||
return super.exportXls(request, tablex, Tablex.class, "实体表"); |
||||
} |
||||
|
||||
/** |
||||
* 通过excel导入数据 |
||||
* |
||||
* @param request |
||||
* @param response |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
||||
return super.importExcel(request, response, Tablex.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,89 @@ |
||||
package org.jeecg.modules.tablex.entity; |
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 实体表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("tablex") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="tablex对象", description="实体表") |
||||
public class Tablex implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private java.lang.String id; |
||||
/**对应模块id*/ |
||||
@Excel(name = "对应模块id", width = 15, dictTable = "modulex", dicText = "module_name", dicCode = "id") |
||||
@Dict(dictTable = "modulex", dicText = "module_name", dicCode = "id") |
||||
@ApiModelProperty(value = "对应模块id") |
||||
private java.lang.String moduleId; |
||||
/**中文名称*/ |
||||
@Excel(name = "中文名称", width = 15) |
||||
@ApiModelProperty(value = "中文名称") |
||||
private java.lang.String tableName; |
||||
/**英文名称*/ |
||||
@Excel(name = "英文名称", width = 15) |
||||
@ApiModelProperty(value = "英文名称") |
||||
private java.lang.String tableEnName; |
||||
/**表结构SQL*/ |
||||
@Excel(name = "表结构SQL", width = 15) |
||||
@ApiModelProperty(value = "表结构SQL") |
||||
private java.lang.String tableStructure; |
||||
/**结构图*/ |
||||
@Excel(name = "结构图", width = 15) |
||||
@ApiModelProperty(value = "结构图") |
||||
private java.lang.String structuralDiagram; |
||||
/**创建人*/ |
||||
@ApiModelProperty(value = "创建人") |
||||
private java.lang.String createBy; |
||||
/**创建时间*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "创建时间") |
||||
private java.util.Date createTime; |
||||
/**修改人*/ |
||||
@ApiModelProperty(value = "修改人") |
||||
private java.lang.String updateBy; |
||||
/**修改时间*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "修改时间") |
||||
private java.util.Date updateTime; |
||||
/**实体状态*/ |
||||
@Excel(name = "实体状态", width = 15,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "实体状态") |
||||
private java.lang.Integer status; |
||||
/**版本状态*/ |
||||
@Excel(name = "版本状态", width = 15,dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "版本状态") |
||||
private java.lang.Integer verisonStatus; |
||||
/**版本号*/ |
||||
@Excel(name = "版本号", width = 15) |
||||
@ApiModelProperty(value = "版本号") |
||||
private java.lang.Integer verison; |
||||
} |
@ -0,0 +1,17 @@ |
||||
package org.jeecg.modules.tablex.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.tablex.entity.Tablex; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 实体表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface TablexMapper extends BaseMapper<Tablex> { |
||||
|
||||
} |
@ -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=".tablex.mapper.TablexMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
package org.jeecg.modules.tablex.service; |
||||
|
||||
import org.jeecg.modules.tablex.entity.Tablex; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: 实体表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ITablexService extends IService<Tablex> { |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package org.jeecg.modules.tablex.service.impl; |
||||
|
||||
import org.jeecg.modules.tablex.entity.Tablex; |
||||
import org.jeecg.modules.tablex.mapper.TablexMapper; |
||||
import org.jeecg.modules.tablex.service.ITablexService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 实体表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-04-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class TablexServiceImpl extends ServiceImpl<TablexMapper, Tablex> implements ITablexService { |
||||
|
||||
} |
@ -0,0 +1,214 @@ |
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
</a-row> |
||||
</a-form> |
||||
</div> |
||||
<!-- 查询区域-END --> |
||||
|
||||
<!-- 操作按钮区域 --> |
||||
<div class="table-operator"> |
||||
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> |
||||
<a-button type="primary" icon="download" @click="handleExportXls('实体表')">导出</a-button> |
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
||||
<a-button type="primary" icon="import">导入</a-button> |
||||
</a-upload> |
||||
<!-- 高级查询区域 --> |
||||
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> |
||||
<a-dropdown v-if="selectedRowKeys.length > 0"> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> |
||||
</a-menu> |
||||
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> |
||||
</a-dropdown> |
||||
</div> |
||||
|
||||
<!-- table区域-begin --> |
||||
<div> |
||||
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> |
||||
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 |
||||
<a style="margin-left: 24px" @click="onClearSelected">清空</a> |
||||
</div> |
||||
|
||||
<a-table |
||||
ref="table" |
||||
size="middle" |
||||
:scroll="{x:true}" |
||||
bordered |
||||
rowKey="id" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
||||
class="j-table-force-nowrap" |
||||
@change="handleTableChange"> |
||||
|
||||
<template slot="htmlSlot" slot-scope="text"> |
||||
<div v-html="text"></div> |
||||
</template> |
||||
<template slot="imgSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> |
||||
<img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> |
||||
</template> |
||||
<template slot="fileSlot" slot-scope="text"> |
||||
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> |
||||
<a-button |
||||
v-else |
||||
:ghost="true" |
||||
type="primary" |
||||
icon="download" |
||||
size="small" |
||||
@click="downloadFile(text)"> |
||||
下载 |
||||
</a-button> |
||||
</template> |
||||
|
||||
<span slot="action" slot-scope="text, record"> |
||||
<a @click="handleEdit(record)">编辑</a> |
||||
|
||||
<a-divider type="vertical" /> |
||||
<a-dropdown> |
||||
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> |
||||
<a-menu slot="overlay"> |
||||
<a-menu-item> |
||||
<a @click="handleDetail(record)">详情</a> |
||||
</a-menu-item> |
||||
<a-menu-item> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</a-menu-item> |
||||
</a-menu> |
||||
</a-dropdown> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<tablex-modal ref="modalForm" @ok="modalFormOk"></tablex-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import TablexModal from './modules/TablexModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
|
||||
export default { |
||||
name: 'TablexList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
TablexModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '实体表管理页面', |
||||
// 表头
|
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
{ |
||||
title:'对应模块id', |
||||
align:"center", |
||||
dataIndex: 'moduleId_dictText' |
||||
}, |
||||
{ |
||||
title:'中文名称', |
||||
align:"center", |
||||
dataIndex: 'tableName' |
||||
}, |
||||
{ |
||||
title:'英文名称', |
||||
align:"center", |
||||
dataIndex: 'tableEnName' |
||||
}, |
||||
{ |
||||
title:'表结构SQL', |
||||
align:"center", |
||||
dataIndex: 'tableStructure' |
||||
}, |
||||
{ |
||||
title:'结构图', |
||||
align:"center", |
||||
dataIndex: 'structuralDiagram' |
||||
}, |
||||
{ |
||||
title:'实体状态', |
||||
align:"center", |
||||
dataIndex: 'status' |
||||
}, |
||||
{ |
||||
title:'版本状态', |
||||
align:"center", |
||||
dataIndex: 'verisonStatus' |
||||
}, |
||||
{ |
||||
title:'版本号', |
||||
align:"center", |
||||
dataIndex: 'verison' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/tablex/tablex/list", |
||||
delete: "/tablex/tablex/delete", |
||||
deleteBatch: "/tablex/tablex/deleteBatch", |
||||
exportXlsUrl: "/tablex/tablex/exportXls", |
||||
importExcelUrl: "tablex/tablex/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'sel_search',value:'moduleId',text:'对应模块id',dictTable:'modulex', dictText:'module_name', dictCode:'id'}) |
||||
fieldList.push({type:'string',value:'tableName',text:'中文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'tableEnName',text:'英文名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'tableStructure',text:'表结构SQL',dictCode:''}) |
||||
fieldList.push({type:'string',value:'structuralDiagram',text:'结构图',dictCode:''}) |
||||
fieldList.push({type:'int',value:'status',text:'实体状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verisonStatus',text:'版本状态',dictCode:''}) |
||||
fieldList.push({type:'int',value:'verison',text:'版本号',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,157 @@ |
||||
<template> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<j-form-container :disabled="formDisabled"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> |
||||
<a-row> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="对应模块id" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moduleId"> |
||||
<j-search-select-tag v-model="model.moduleId" dict="modulex,module_name,id" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="中文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableName"> |
||||
<a-input v-model="model.tableName" placeholder="请输入中文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="英文名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableEnName"> |
||||
<a-input v-model="model.tableEnName" placeholder="请输入英文名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="表结构SQL" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tableStructure"> |
||||
<a-input v-model="model.tableStructure" placeholder="请输入表结构SQL" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="结构图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="structuralDiagram"> |
||||
<a-input v-model="model.structuralDiagram" placeholder="请输入结构图" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="实体状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> |
||||
<a-input-number v-model="model.status" placeholder="请输入实体状态" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="版本状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verisonStatus"> |
||||
<a-input-number v-model="model.verisonStatus" placeholder="请输入版本状态" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="版本号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="verison"> |
||||
<a-input-number v-model="model.verison" placeholder="请输入版本号" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
</a-row> |
||||
</a-form-model> |
||||
</j-form-container> |
||||
</a-spin> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction, getAction } from '@/api/manage' |
||||
import { validateDuplicateValue } from '@/utils/util' |
||||
|
||||
export default { |
||||
name: 'TablexForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用
|
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
model:{ |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
moduleId: [ |
||||
{ required: true, message: '请输入对应模块id!'}, |
||||
], |
||||
tableName: [ |
||||
{ required: true, message: '请输入中文名称!'}, |
||||
], |
||||
tableEnName: [ |
||||
{ required: true, message: '请输入英文名称!'}, |
||||
], |
||||
status: [ |
||||
{ required: true, message: '请输入实体状态!'}, |
||||
], |
||||
verisonStatus: [ |
||||
{ required: true, message: '请输入版本状态!'}, |
||||
], |
||||
verison: [ |
||||
{ required: true, message: '请输入版本号!'}, |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/tablex/tablex/add", |
||||
edit: "/tablex/tablex/edit", |
||||
queryById: "/tablex/tablex/queryById" |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
//备份model原始值
|
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.edit(this.modelDefault); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
submitForm () { |
||||
const that = this; |
||||
// 触发表单验证
|
||||
this.$refs.form.validate(valid => { |
||||
if (valid) { |
||||
that.confirmLoading = true; |
||||
let httpurl = ''; |
||||
let method = ''; |
||||
if(!this.model.id){ |
||||
httpurl+=this.url.add; |
||||
method = 'post'; |
||||
}else{ |
||||
httpurl+=this.url.edit; |
||||
method = 'put'; |
||||
} |
||||
httpAction(httpurl,this.model,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
that.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,60 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
switchFullscreen |
||||
@ok="handleOk" |
||||
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<tablex-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></tablex-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import TablexForm from './TablexForm' |
||||
export default { |
||||
name: 'TablexModal', |
||||
components: { |
||||
TablexForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:'', |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}) |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,84 @@ |
||||
<template> |
||||
<a-drawer |
||||
:title="title" |
||||
:width="width" |
||||
placement="right" |
||||
:closable="false" |
||||
@close="close" |
||||
destroyOnClose |
||||
:visible="visible"> |
||||
<tablex-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></tablex-form> |
||||
<div class="drawer-footer"> |
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> |
||||
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> |
||||
</div> |
||||
</a-drawer> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import TablexForm from './TablexForm' |
||||
|
||||
export default { |
||||
name: 'TablexModal', |
||||
components: { |
||||
TablexForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}); |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
/** Button按钮间距 */ |
||||
.ant-btn { |
||||
margin-left: 30px; |
||||
margin-bottom: 30px; |
||||
float: right; |
||||
} |
||||
.drawer-footer{ |
||||
position: absolute; |
||||
bottom: -8px; |
||||
width: 100%; |
||||
border-top: 1px solid #e8e8e8; |
||||
padding: 10px 16px; |
||||
text-align: right; |
||||
left: 0; |
||||
background: #fff; |
||||
border-radius: 0 0 2px 2px; |
||||
} |
||||
</style> |
Loading…
Reference in new issue