From 497c5c82fbc5b259b93d1f175446f2944cf9733d Mon Sep 17 00:00:00 2001 From: youjie <272855983@qq.com> Date: Wed, 12 Oct 2022 17:32:16 +0800 Subject: [PATCH] 增加仓库界面 --- jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue | 285 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseForm.vue | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.Style#Drawer.vue | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.vue | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/controller/WarehouseController.java | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/entity/Warehouse.java | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/WarehouseMapper.java | 17 +++++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/xml/WarehouseMapper.xml | 5 +++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/IWarehouseService.java | 14 ++++++++++++++ jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/impl/WarehouseServiceImpl.java | 19 +++++++++++++++++++ 10 files changed, 971 insertions(+), 0 deletions(-) create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseForm.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.Style#Drawer.vue create mode 100644 jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.vue create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/controller/WarehouseController.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/entity/Warehouse.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/WarehouseMapper.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/xml/WarehouseMapper.xml create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/IWarehouseService.java create mode 100644 jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/impl/WarehouseServiceImpl.java diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue new file mode 100644 index 0000000..f76d0ca --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/WarehouseList.vue @@ -0,0 +1,285 @@ +<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> + + <warehouse-modal ref="modalForm" @ok="modalFormOk"></warehouse-modal> + </a-card> +</template> + +<script> + + import '@/assets/less/TableExpand.less' + import { mixinDevice } from '@/utils/mixin' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import WarehouseModal from './modules/WarehouseModal' + + export default { + name: 'WarehouseList', + mixins:[JeecgListMixin, mixinDevice], + components: { + WarehouseModal + }, + data () { + return { + description: '仓库管理页面', + // 表头 + columns: [ + { + title: '#', + dataIndex: '', + key:'rowIndex', + width:60, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + { + title:'创建人', + align:"center", + dataIndex: 'createBy' + }, + { + title:'创建日期', + align:"center", + dataIndex: 'createTime' + }, + { + title:'更新人', + align:"center", + dataIndex: 'updateBy' + }, + { + title:'更新日期', + align:"center", + dataIndex: 'updateTime' + }, + { + title:'仓库编码', + align:"center", + dataIndex: 'code' + }, + { + title:'地址', + align:"center", + dataIndex: 'address' + }, + { + title:'城市', + align:"center", + dataIndex: 'city' + }, + { + title:'省份', + align:"center", + dataIndex: 'state' + }, + { + title:'区/县', + align:"center", + dataIndex: 'district' + }, + { + title:'国家', + align:"center", + dataIndex: 'country' + }, + { + title:'邮编', + align:"center", + dataIndex: 'postalcode' + }, + { + title:'联系人', + align:"center", + dataIndex: 'attentionto' + }, + { + title:'联系电话', + align:"center", + dataIndex: 'phonenum' + }, + { + title:'传真号', + align:"center", + dataIndex: 'faxnum' + }, + { + title:'名称', + align:"center", + dataIndex: 'name' + }, + { + title:'可用状态', + align:"center", + dataIndex: 'enable' + }, + { + title:'删除标记', + align:"center", + dataIndex: 'deleted' + }, + { + title:'自定义字段1', + align:"center", + dataIndex: 'userdef1' + }, + { + title:'自定义字段2', + align:"center", + dataIndex: 'userdef2' + }, + { + title:'自定义字段3', + align:"center", + dataIndex: 'userdef3' + }, + { + title: '操作', + dataIndex: 'action', + align:"center", + fixed:"right", + width:147, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: "/config/warehouse/list", + delete: "/config/warehouse/delete", + deleteBatch: "/config/warehouse/deleteBatch", + exportXlsUrl: "/config/warehouse/exportXls", + importExcelUrl: "config/warehouse/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:'createBy',text:'创建人',dictCode:''}) + fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) + fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''}) + fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'}) + fieldList.push({type:'string',value:'code',text:'仓库编码',dictCode:''}) + fieldList.push({type:'string',value:'address',text:'地址',dictCode:''}) + fieldList.push({type:'string',value:'city',text:'城市',dictCode:''}) + fieldList.push({type:'string',value:'state',text:'省份',dictCode:''}) + fieldList.push({type:'string',value:'district',text:'区/县',dictCode:''}) + fieldList.push({type:'string',value:'country',text:'国家',dictCode:''}) + fieldList.push({type:'string',value:'postalcode',text:'邮编',dictCode:''}) + fieldList.push({type:'string',value:'attentionto',text:'联系人',dictCode:''}) + fieldList.push({type:'string',value:'phonenum',text:'联系电话',dictCode:''}) + fieldList.push({type:'string',value:'faxnum',text:'传真号',dictCode:''}) + fieldList.push({type:'string',value:'name',text:'名称',dictCode:''}) + fieldList.push({type:'int',value:'enable',text:'可用状态',dictCode:''}) + fieldList.push({type:'int',value:'deleted',text:'删除标记',dictCode:''}) + fieldList.push({type:'string',value:'userdef1',text:'自定义字段1',dictCode:''}) + fieldList.push({type:'string',value:'userdef2',text:'自定义字段2',dictCode:''}) + fieldList.push({type:'string',value:'userdef3',text:'自定义字段3',dictCode:''}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseForm.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseForm.vue new file mode 100644 index 0000000..643e7c4 --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseForm.vue @@ -0,0 +1,202 @@ +<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="创建人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createBy"> + <a-input v-model="model.createBy" placeholder="请输入创建人" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="创建日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="createTime"> + <j-date placeholder="请选择创建日期" v-model="model.createTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="更新人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="updateBy"> + <a-input v-model="model.updateBy" placeholder="请输入更新人" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="更新日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="updateTime"> + <j-date placeholder="请选择更新日期" v-model="model.updateTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="仓库编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code"> + <a-input v-model="model.code" placeholder="请输入仓库编码" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address"> + <a-input v-model="model.address" placeholder="请输入地址" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="城市" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="city"> + <a-input v-model="model.city" placeholder="请输入城市" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="省份" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="state"> + <a-input v-model="model.state" placeholder="请输入省份" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="区/县" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="district"> + <a-input v-model="model.district" placeholder="请输入区/县" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="国家" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="country"> + <a-input v-model="model.country" placeholder="请输入国家" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="邮编" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="postalcode"> + <a-input v-model="model.postalcode" placeholder="请输入邮编" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="attentionto"> + <a-input v-model="model.attentionto" placeholder="请输入联系人" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="联系电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="phonenum"> + <a-input v-model="model.phonenum" placeholder="请输入联系电话" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="传真号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="faxnum"> + <a-input v-model="model.faxnum" placeholder="请输入传真号" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> + <a-input v-model="model.name" placeholder="请输入名称" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="可用状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="enable"> + <a-input-number v-model="model.enable" placeholder="请输入可用状态" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="删除标记" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="deleted"> + <a-input-number v-model="model.deleted" placeholder="请输入删除标记" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="自定义字段1" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userdef1"> + <a-input v-model="model.userdef1" placeholder="请输入自定义字段1" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="自定义字段2" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userdef2"> + <a-input v-model="model.userdef2" placeholder="请输入自定义字段2" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="自定义字段3" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userdef3"> + <a-input v-model="model.userdef3" placeholder="请输入自定义字段3" ></a-input> + </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: 'WarehouseForm', + 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: { + code: [ + { required: true, message: '请输入仓库编码!'}, + ], + }, + url: { + add: "/config/warehouse/add", + edit: "/config/warehouse/edit", + queryById: "/config/warehouse/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> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.Style#Drawer.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.Style#Drawer.vue new file mode 100644 index 0000000..1ca163e --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.Style#Drawer.vue @@ -0,0 +1,84 @@ +<template> + <a-drawer + :title="title" + :width="width" + placement="right" + :closable="false" + @close="close" + destroyOnClose + :visible="visible"> + <warehouse-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></warehouse-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 WarehouseForm from './WarehouseForm' + + export default { + name: 'WarehouseModal', + components: { + WarehouseForm + }, + 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> \ No newline at end of file diff --git a/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.vue b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.vue new file mode 100644 index 0000000..2eb223a --- /dev/null +++ b/jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/WarehouseModal.vue @@ -0,0 +1,60 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel" + cancelText="关闭"> + <warehouse-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></warehouse-form> + </j-modal> +</template> + +<script> + + import WarehouseForm from './WarehouseForm' + export default { + name: 'WarehouseModal', + components: { + WarehouseForm + }, + 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> \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/controller/WarehouseController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/controller/WarehouseController.java new file mode 100644 index 0000000..0d68bbe --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/controller/WarehouseController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.system.config.warehouse.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 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.jeecg.modules.system.config.warehouse.entity.Warehouse; +import org.jeecg.modules.system.config.warehouse.service.IWarehouseService; +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: 2022-10-12 + * @Version: V1.0 + */ +@Api(tags="仓库") +@RestController +@RequestMapping("/config/warehouse") +@Slf4j +public class WarehouseController extends JeecgController<Warehouse, IWarehouseService> { + @Autowired + private IWarehouseService warehouseService; + + /** + * 分页列表查询 + * + * @param warehouse + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "仓库-分页列表查询") + @ApiOperation(value="仓库-分页列表查询", notes="仓库-分页列表查询") + @GetMapping(value = "/list") + public Result<IPage<Warehouse>> queryPageList(Warehouse warehouse, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<Warehouse> queryWrapper = QueryGenerator.initQueryWrapper(warehouse, req.getParameterMap()); + Page<Warehouse> page = new Page<Warehouse>(pageNo, pageSize); + IPage<Warehouse> pageList = warehouseService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param warehouse + * @return + */ + @AutoLog(value = "仓库-添加") + @ApiOperation(value="仓库-添加", notes="仓库-添加") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody Warehouse warehouse) { + warehouseService.save(warehouse); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param warehouse + * @return + */ + @AutoLog(value = "仓库-编辑") + @ApiOperation(value="仓库-编辑", notes="仓库-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody Warehouse warehouse) { + warehouseService.updateById(warehouse); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "仓库-通过id删除") + @ApiOperation(value="仓库-通过id删除", notes="仓库-通过id删除") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + warehouseService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "仓库-批量删除") + @ApiOperation(value="仓库-批量删除", notes="仓库-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.warehouseService.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<Warehouse> queryById(@RequestParam(name="id",required=true) String id) { + Warehouse warehouse = warehouseService.getById(id); + if(warehouse==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(warehouse); + } + + /** + * 导出excel + * + * @param request + * @param warehouse + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, Warehouse warehouse) { + return super.exportXls(request, warehouse, Warehouse.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, Warehouse.class); + } + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/entity/Warehouse.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/entity/Warehouse.java new file mode 100644 index 0000000..18423f2 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/entity/Warehouse.java @@ -0,0 +1,114 @@ +package org.jeecg.modules.system.config.warehouse.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: 2022-10-12 + * @Version: V1.0 + */ +@Data +@TableName("warehouse") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="warehouse对象", description="仓库") +public class Warehouse implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private Date updateTime; + /**仓库编码*/ + @Excel(name = "仓库编码", width = 15) + @ApiModelProperty(value = "仓库编码") + private String code; + /**地址*/ + @Excel(name = "地址", width = 15) + @ApiModelProperty(value = "地址") + private String address; + /**城市*/ + @Excel(name = "城市", width = 15) + @ApiModelProperty(value = "城市") + private String city; + /**省份*/ + @Excel(name = "省份", width = 15) + @ApiModelProperty(value = "省份") + private String state; + /**区/县*/ + @Excel(name = "区/县", width = 15) + @ApiModelProperty(value = "区/县") + private String district; + /**国家*/ + @Excel(name = "国家", width = 15) + @ApiModelProperty(value = "国家") + private String country; + /**邮编*/ + @Excel(name = "邮编", width = 15) + @ApiModelProperty(value = "邮编") + private String postalcode; + /**联系人*/ + @Excel(name = "联系人", width = 15) + @ApiModelProperty(value = "联系人") + private String attentionto; + /**联系电话*/ + @Excel(name = "联系电话", width = 15) + @ApiModelProperty(value = "联系电话") + private String phonenum; + /**传真号*/ + @Excel(name = "传真号", width = 15) + @ApiModelProperty(value = "传真号") + private String faxnum; + /**名称*/ + @Excel(name = "名称", width = 15) + @ApiModelProperty(value = "名称") + private String name; + /**可用状态*/ + @Excel(name = "可用状态", width = 15) + @ApiModelProperty(value = "可用状态") + private Integer enable; + /**删除标记*/ + @Excel(name = "删除标记", width = 15) + @ApiModelProperty(value = "删除标记") + private Integer deleted; + /**自定义字段1*/ + @Excel(name = "自定义字段1", width = 15) + @ApiModelProperty(value = "自定义字段1") + private String userdef1; + /**自定义字段2*/ + @Excel(name = "自定义字段2", width = 15) + @ApiModelProperty(value = "自定义字段2") + private String userdef2; + /**自定义字段3*/ + @Excel(name = "自定义字段3", width = 15) + @ApiModelProperty(value = "自定义字段3") + private String userdef3; +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/WarehouseMapper.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/WarehouseMapper.java new file mode 100644 index 0000000..3909608 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/WarehouseMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.system.config.warehouse.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.system.config.warehouse.entity.Warehouse; + +/** + * @Description: 仓库 + * @Author: jeecg-boot + * @Date: 2022-10-12 + * @Version: V1.0 + */ +public interface WarehouseMapper extends BaseMapper<Warehouse> { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/xml/WarehouseMapper.xml b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/xml/WarehouseMapper.xml new file mode 100644 index 0000000..7277a26 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/mapper/xml/WarehouseMapper.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.system.config.warehouse.mapper.WarehouseMapper"> + +</mapper> diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/IWarehouseService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/IWarehouseService.java new file mode 100644 index 0000000..8e4a1d2 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/IWarehouseService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.system.config.warehouse.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.system.config.warehouse.entity.Warehouse; + +/** + * @Description: 仓库 + * @Author: jeecg-boot + * @Date: 2022-10-12 + * @Version: V1.0 + */ +public interface IWarehouseService extends IService<Warehouse> { + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/impl/WarehouseServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/impl/WarehouseServiceImpl.java new file mode 100644 index 0000000..e42632c --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/config/warehouse/service/impl/WarehouseServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.system.config.warehouse.service.impl; + +import org.jeecg.modules.system.config.warehouse.entity.Warehouse; +import org.jeecg.modules.system.config.warehouse.mapper.WarehouseMapper; +import org.jeecg.modules.system.config.warehouse.service.IWarehouseService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 仓库 + * @Author: jeecg-boot + * @Date: 2022-10-12 + * @Version: V1.0 + */ +@Service +public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse> implements IWarehouseService { + +} -- libgit2 0.22.2