commit
8c6135a3f3
48 changed files with 4165 additions and 175 deletions
@ -0,0 +1,347 @@ |
||||
<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" |
||||
rowKey="id" |
||||
class="j-table-force-nowrap" |
||||
:scroll="{x:true}" |
||||
:columns="columns" |
||||
:dataSource="dataSource" |
||||
:pagination="ipagination" |
||||
:loading="loading" |
||||
:expandedRowKeys="expandedRowKeys" |
||||
@change="handleTableChange" |
||||
@expand="handleExpand" |
||||
v-bind="tableProps"> |
||||
|
||||
<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="handleAddChild(record)">添加下级</a> |
||||
</a-menu-item> |
||||
<a-menu-item> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteNode(record.id)" placement="topLeft"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</a-menu-item> |
||||
</a-menu> |
||||
</a-dropdown> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<collectType-modal ref="modalForm" @ok="modalFormOk"></collectType-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { getAction, deleteAction } from '@/api/manage' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import CollectTypeModal from './modules/CollectTypeModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
import { filterObj } from '@/utils/util'; |
||||
|
||||
export default { |
||||
name: "CollectTypeList", |
||||
mixins:[JeecgListMixin], |
||||
components: { |
||||
CollectTypeModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '收藏分类管理管理页面', |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title:'收藏分类名', |
||||
align:"left", |
||||
dataIndex: 'collectTypeName' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' }, |
||||
} |
||||
], |
||||
url: { |
||||
list: "/collecttype/collectType/rootList", |
||||
childList: "/collecttype/collectType/childList", |
||||
getChildListBatch: "/collecttype/collectType/getChildListBatch", |
||||
delete: "/collecttype/collectType/delete", |
||||
deleteBatch: "/collecttype/collectType/deleteBatch", |
||||
exportXlsUrl: "/collecttype/collectType/exportXls", |
||||
importExcelUrl: "collecttype/collectType/importExcel", |
||||
}, |
||||
expandedRowKeys:[], |
||||
hasChildrenField:"hasChild", |
||||
pidField:"pid", |
||||
dictOptions: {}, |
||||
loadParent: false, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
tableProps() { |
||||
let _this = this |
||||
return { |
||||
// 列表项是否可选择 |
||||
rowSelection: { |
||||
selectedRowKeys: _this.selectedRowKeys, |
||||
onChange: (selectedRowKeys) => _this.selectedRowKeys = selectedRowKeys |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
loadData(arg){ |
||||
if(arg==1){ |
||||
this.ipagination.current=1 |
||||
} |
||||
this.loading = true |
||||
let params = this.getQueryParams() |
||||
params.hasQuery = 'true' |
||||
getAction(this.url.list,params).then(res=>{ |
||||
if(res.success){ |
||||
let result = res.result |
||||
if(Number(result.total)>0){ |
||||
this.ipagination.total = Number(result.total) |
||||
this.dataSource = this.getDataByResult(res.result.records) |
||||
return this.loadDataByExpandedRows(this.dataSource) |
||||
}else{ |
||||
this.ipagination.total=0 |
||||
this.dataSource=[] |
||||
} |
||||
}else{ |
||||
this.$message.warning(res.message) |
||||
} |
||||
}).finally(()=>{ |
||||
this.loading = false |
||||
}) |
||||
}, |
||||
// 根据已展开的行查询数据(用于保存后刷新时异步加载子级的数据) |
||||
loadDataByExpandedRows(dataList) { |
||||
if (this.expandedRowKeys.length > 0) { |
||||
return getAction(this.url.getChildListBatch,{ parentIds: this.expandedRowKeys.join(',') }).then(res=>{ |
||||
if (res.success && res.result.records.length>0) { |
||||
//已展开的数据批量子节点 |
||||
let records = res.result.records |
||||
const listMap = new Map(); |
||||
for (let item of records) { |
||||
let pid = item[this.pidField]; |
||||
if (this.expandedRowKeys.join(',').includes(pid)) { |
||||
let mapList = listMap.get(pid); |
||||
if (mapList == null) { |
||||
mapList = []; |
||||
} |
||||
mapList.push(item); |
||||
listMap.set(pid, mapList); |
||||
} |
||||
} |
||||
let childrenMap = listMap; |
||||
let fn = (list) => { |
||||
if(list) { |
||||
list.forEach(data => { |
||||
if (this.expandedRowKeys.includes(data.id)) { |
||||
data.children = this.getDataByResult(childrenMap.get(data.id)) |
||||
fn(data.children) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
fn(dataList) |
||||
} |
||||
}) |
||||
} else { |
||||
return Promise.resolve() |
||||
} |
||||
}, |
||||
getQueryParams(arg) { |
||||
//获取查询条件 |
||||
let sqp = {} |
||||
let param = {} |
||||
if(this.superQueryParams){ |
||||
sqp['superQueryParams']=encodeURI(this.superQueryParams) |
||||
sqp['superQueryMatchType'] = this.superQueryMatchType |
||||
} |
||||
if(arg){ |
||||
param = Object.assign(sqp, this.isorter ,this.filters); |
||||
}else{ |
||||
param = Object.assign(sqp, this.queryParam, this.isorter ,this.filters); |
||||
} |
||||
if(JSON.stringify(this.queryParam) === "{}" || arg){ |
||||
param.hasQuery = 'false' |
||||
}else{ |
||||
param.hasQuery = 'true' |
||||
} |
||||
param.field = this.getQueryField(); |
||||
param.pageNo = this.ipagination.current; |
||||
param.pageSize = this.ipagination.pageSize; |
||||
return filterObj(param); |
||||
}, |
||||
searchReset() { |
||||
//重置 |
||||
this.expandedRowKeys = [] |
||||
this.queryParam = {} |
||||
this.loadData(1); |
||||
}, |
||||
getDataByResult(result){ |
||||
if(result){ |
||||
return result.map(item=>{ |
||||
//判断是否标记了带有子节点 |
||||
if(item[this.hasChildrenField]=='1'){ |
||||
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true } |
||||
item.children = [loadChild] |
||||
} |
||||
return item |
||||
}) |
||||
} |
||||
}, |
||||
handleExpand(expanded, record){ |
||||
// 判断是否是展开状态 |
||||
if (expanded) { |
||||
this.expandedRowKeys.push(record.id) |
||||
if (record.children.length>0 && record.children[0].isLoading === true) { |
||||
let params = this.getQueryParams(1);//查询条件 |
||||
params[this.pidField] = record.id |
||||
params.hasQuery = 'false' |
||||
params.superQueryParams="" |
||||
getAction(this.url.childList,params).then((res)=>{ |
||||
if(res.success){ |
||||
if(res.result.records){ |
||||
record.children = this.getDataByResult(res.result.records) |
||||
this.dataSource = [...this.dataSource] |
||||
}else{ |
||||
record.children='' |
||||
record.hasChildrenField='0' |
||||
} |
||||
}else{ |
||||
this.$message.warning(res.message) |
||||
} |
||||
}) |
||||
} |
||||
}else{ |
||||
let keyIndex = this.expandedRowKeys.indexOf(record.id) |
||||
if(keyIndex>=0){ |
||||
this.expandedRowKeys.splice(keyIndex, 1); |
||||
} |
||||
} |
||||
}, |
||||
handleAddChild(record){ |
||||
this.loadParent = true |
||||
let obj = {} |
||||
obj[this.pidField] = record['id'] |
||||
this.$refs.modalForm.add(obj); |
||||
}, |
||||
handleDeleteNode(id) { |
||||
if(!this.url.delete){ |
||||
this.$message.error("请设置url.delete属性!") |
||||
return |
||||
} |
||||
var that = this; |
||||
deleteAction(that.url.delete, {id: id}).then((res) => { |
||||
if (res.success) { |
||||
that.loadData(1) |
||||
} else { |
||||
that.$message.warning(res.message); |
||||
} |
||||
}); |
||||
}, |
||||
batchDel(){ |
||||
if(this.selectedRowKeys.length<=0){ |
||||
this.$message.warning('请选择一条记录!'); |
||||
return false; |
||||
}else{ |
||||
let ids = ""; |
||||
let that = this; |
||||
that.selectedRowKeys.forEach(function(val) { |
||||
ids+=val+","; |
||||
}); |
||||
that.$confirm({ |
||||
title:"确认删除", |
||||
content:"是否删除选中数据?", |
||||
onOk: function(){ |
||||
that.handleDeleteNode(ids) |
||||
that.onClearSelected(); |
||||
} |
||||
}); |
||||
} |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'collectTypeName',text:'收藏分类名',dictCode:''}) |
||||
fieldList.push({type:'string',value:'pid',text:'父级节点',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,153 @@ |
||||
<template> |
||||
<j-modal |
||||
:title="title" |
||||
:width="width" |
||||
:visible="visible" |
||||
:confirmLoading="confirmLoading" |
||||
switchFullscreen |
||||
@ok="handleOk" |
||||
@cancel="handleCancel" |
||||
cancelText="关闭"> |
||||
<a-spin :spinning="confirmLoading"> |
||||
<a-form-model ref="form" :model="model" :rules="validatorRules"> |
||||
<a-form-model-item label="收藏分类名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="collectTypeName"> |
||||
<a-input v-model="model.collectTypeName" placeholder="请输入收藏分类名" ></a-input> |
||||
</a-form-model-item> |
||||
<a-form-model-item label="父级节点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pid"> |
||||
<j-tree-select |
||||
ref="treeSelect" |
||||
placeholder="请选择父级节点" |
||||
v-model="model.pid" |
||||
dict="collect_type,collect_type_name,id" |
||||
pidField="pid" |
||||
pidValue="0" |
||||
hasChildField="has_child" |
||||
> |
||||
</j-tree-select> |
||||
</a-form-model-item> |
||||
|
||||
</a-form-model> |
||||
</a-spin> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import { httpAction } from '@/api/manage' |
||||
import { validateDuplicateValue } from '@/utils/util' |
||||
export default { |
||||
name: "CollectTypeModal", |
||||
components: { |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
model:{ |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
|
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
}, |
||||
url: { |
||||
add: "/collecttype/collectType/add", |
||||
edit: "/collecttype/collectType/edit", |
||||
}, |
||||
expandedRowKeys:[], |
||||
pidField:"pid" |
||||
|
||||
} |
||||
}, |
||||
created () { |
||||
//备份model原始值 |
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add (obj) { |
||||
this.modelDefault.pid='' |
||||
this.edit(Object.assign(this.modelDefault , obj)); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.visible = true; |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
this.$refs.form.clearValidate() |
||||
}, |
||||
handleOk () { |
||||
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'; |
||||
} |
||||
if(this.model.id && this.model.id === this.model[this.pidField]){ |
||||
that.$message.warning("父级节点不能选择自己"); |
||||
that.confirmLoading = false; |
||||
return; |
||||
} |
||||
httpAction(httpurl,this.model,method).then((res)=>{ |
||||
if(res.success){ |
||||
that.$message.success(res.message); |
||||
this.$emit('ok'); |
||||
}else{ |
||||
that.$message.warning(res.message); |
||||
} |
||||
}).finally(() => { |
||||
that.confirmLoading = false; |
||||
that.close(); |
||||
}) |
||||
}else{ |
||||
return false |
||||
} |
||||
}) |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
}, |
||||
submitSuccess(formData,flag){ |
||||
if(!formData.id){ |
||||
let treeData = this.$refs.treeSelect.getCurrTreeData() |
||||
this.expandedRowKeys=[] |
||||
this.getExpandKeysByPid(formData[this.pidField],treeData,treeData) |
||||
this.$emit('ok',formData,this.expandedRowKeys.reverse()); |
||||
}else{ |
||||
this.$emit('ok',formData,flag); |
||||
} |
||||
}, |
||||
getExpandKeysByPid(pid,arr,all){ |
||||
if(pid && arr && arr.length>0){ |
||||
for(let i=0;i<arr.length;i++){ |
||||
if(arr[i].key==pid){ |
||||
this.expandedRowKeys.push(arr[i].key) |
||||
this.getExpandKeysByPid(arr[i]['parentId'],all,all) |
||||
}else{ |
||||
this.getExpandKeysByPid(pid,arr[i].children,all) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,196 @@ |
||||
<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> |
||||
|
||||
<customercollectgoods-modal ref="modalForm" @ok="modalFormOk"></customercollectgoods-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import CustomercollectgoodsModal from './modules/CustomercollectgoodsModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
|
||||
export default { |
||||
name: 'CustomercollectgoodsList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
CustomercollectgoodsModal |
||||
}, |
||||
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: 'userId_dictText' |
||||
}, |
||||
{ |
||||
title:'商品', |
||||
align:"center", |
||||
dataIndex: 'goodsId_dictText' |
||||
}, |
||||
{ |
||||
title:'当前单价', |
||||
align:"center", |
||||
dataIndex: 'price' |
||||
}, |
||||
{ |
||||
title:'数量', |
||||
align:"center", |
||||
dataIndex: 'number' |
||||
}, |
||||
{ |
||||
title:'收藏夹', |
||||
align:"center", |
||||
dataIndex: 'collectTypeId_dictText' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/customercollectgoods/customercollectgoods/list", |
||||
delete: "/customercollectgoods/customercollectgoods/delete", |
||||
deleteBatch: "/customercollectgoods/customercollectgoods/deleteBatch", |
||||
exportXlsUrl: "/customercollectgoods/customercollectgoods/exportXls", |
||||
importExcelUrl: "customercollectgoods/customercollectgoods/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_user',value:'userId',text:'用户'}) |
||||
fieldList.push({type:'sel_search',value:'goodsId',text:'商品',dictTable:'', dictText:'', dictCode:''}) |
||||
fieldList.push({type:'string',value:'price',text:'当前单价',dictCode:''}) |
||||
fieldList.push({type:'string',value:'number',text:'数量',dictCode:''}) |
||||
fieldList.push({type:'sel_search',value:'collectTypeId',text:'收藏夹',dictTable:'collect_type', dictText:'collect_type_name', dictCode:'id'}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,124 @@ |
||||
<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="userId"> |
||||
<j-select-user-by-dep v-model="model.userId" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="商品" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="goodsId"> |
||||
<j-search-select-tag v-model="model.goodsId" dict="" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="当前单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price"> |
||||
<a-input v-model="model.price" placeholder="请输入当前单价" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="number"> |
||||
<a-input v-model="model.number" placeholder="请输入数量" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="收藏夹" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="collectTypeId"> |
||||
<j-search-select-tag v-model="model.collectTypeId" dict="collect_type,collect_type_name,id" /> |
||||
</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: 'CustomercollectgoodsForm', |
||||
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: { |
||||
}, |
||||
url: { |
||||
add: "/customercollectgoods/customercollectgoods/add", |
||||
edit: "/customercollectgoods/customercollectgoods/edit", |
||||
queryById: "/customercollectgoods/customercollectgoods/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="关闭"> |
||||
<customercollectgoods-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></customercollectgoods-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import CustomercollectgoodsForm from './CustomercollectgoodsForm' |
||||
export default { |
||||
name: 'CustomercollectgoodsModal', |
||||
components: { |
||||
CustomercollectgoodsForm |
||||
}, |
||||
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"> |
||||
<customercollectgoods-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></customercollectgoods-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 CustomercollectgoodsForm from './CustomercollectgoodsForm' |
||||
|
||||
export default { |
||||
name: 'CustomercollectgoodsModal', |
||||
components: { |
||||
CustomercollectgoodsForm |
||||
}, |
||||
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,233 @@ |
||||
<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> |
||||
|
||||
<customer-invoice-modal ref="modalForm" @ok="modalFormOk"></customer-invoice-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import CustomerInvoiceModal from './modules/CustomerInvoiceModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
|
||||
export default { |
||||
name: 'CustomerInvoiceList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
CustomerInvoiceModal |
||||
}, |
||||
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: 'createTime' |
||||
}, |
||||
{ |
||||
title:'用户', |
||||
align:"center", |
||||
dataIndex: 'userId_dictText' |
||||
}, |
||||
{ |
||||
title:'客户类型', |
||||
align:"center", |
||||
dataIndex: 'customerType_dictText' |
||||
}, |
||||
{ |
||||
title:'发票类型', |
||||
align:"center", |
||||
dataIndex: 'invoiceType_dictText' |
||||
}, |
||||
{ |
||||
title:'名称', |
||||
align:"center", |
||||
dataIndex: 'name' |
||||
}, |
||||
{ |
||||
title:'纳税人识别号', |
||||
align:"center", |
||||
dataIndex: 'taxIdentificationNumber' |
||||
}, |
||||
{ |
||||
title:'地址', |
||||
align:"center", |
||||
dataIndex: 'address' |
||||
}, |
||||
{ |
||||
title:'电话', |
||||
align:"center", |
||||
dataIndex: 'telephone' |
||||
}, |
||||
{ |
||||
title:'开户行', |
||||
align:"center", |
||||
dataIndex: 'bankDeposit' |
||||
}, |
||||
{ |
||||
title:'账号', |
||||
align:"center", |
||||
dataIndex: 'accountNumber' |
||||
}, |
||||
{ |
||||
title:'排序', |
||||
align:"center", |
||||
sorter: true, |
||||
dataIndex: 'sort' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/customerinvoice/customerInvoice/list", |
||||
delete: "/customerinvoice/customerInvoice/delete", |
||||
deleteBatch: "/customerinvoice/customerInvoice/deleteBatch", |
||||
exportXlsUrl: "/customerinvoice/customerInvoice/exportXls", |
||||
importExcelUrl: "customerinvoice/customerInvoice/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) |
||||
fieldList.push({type:'sel_user',value:'userId',text:'用户'}) |
||||
fieldList.push({type:'string',value:'customerType',text:'客户类型',dictCode:'khlx'}) |
||||
fieldList.push({type:'string',value:'invoiceType',text:'发票类型',dictCode:'fplx'}) |
||||
fieldList.push({type:'string',value:'name',text:'名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'taxIdentificationNumber',text:'纳税人识别号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'address',text:'地址',dictCode:''}) |
||||
fieldList.push({type:'string',value:'telephone',text:'电话',dictCode:''}) |
||||
fieldList.push({type:'string',value:'bankDeposit',text:'开户行',dictCode:''}) |
||||
fieldList.push({type:'string',value:'accountNumber',text:'账号',dictCode:''}) |
||||
fieldList.push({type:'int',value:'sort',text:'排序',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,158 @@ |
||||
<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="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="userId"> |
||||
<j-select-user-by-dep v-model="model.userId" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="客户类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="customerType"> |
||||
<j-dict-select-tag type="list" v-model="model.customerType" dictCode="khlx" placeholder="请选择客户类型" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="发票类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="invoiceType"> |
||||
<j-dict-select-tag type="list" v-model="model.invoiceType" dictCode="fplx" placeholder="请选择发票类型" /> |
||||
</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="taxIdentificationNumber"> |
||||
<a-input v-model="model.taxIdentificationNumber" 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="telephone"> |
||||
<a-input v-model="model.telephone" placeholder="请输入电话" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="开户行" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="bankDeposit"> |
||||
<a-input v-model="model.bankDeposit" placeholder="请输入开户行" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="账号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="accountNumber"> |
||||
<a-input v-model="model.accountNumber" placeholder="请输入账号" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sort"> |
||||
<a-input-number v-model="model.sort" 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: 'CustomerInvoiceForm', |
||||
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: { |
||||
telephone: [ |
||||
{ required: false}, |
||||
{ pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码!'}, |
||||
], |
||||
}, |
||||
url: { |
||||
add: "/customerinvoice/customerInvoice/add", |
||||
edit: "/customerinvoice/customerInvoice/edit", |
||||
queryById: "/customerinvoice/customerInvoice/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="关闭"> |
||||
<customer-invoice-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></customer-invoice-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import CustomerInvoiceForm from './CustomerInvoiceForm' |
||||
export default { |
||||
name: 'CustomerInvoiceModal', |
||||
components: { |
||||
CustomerInvoiceForm |
||||
}, |
||||
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"> |
||||
<customer-invoice-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></customer-invoice-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 CustomerInvoiceForm from './CustomerInvoiceForm' |
||||
|
||||
export default { |
||||
name: 'CustomerInvoiceModal', |
||||
components: { |
||||
CustomerInvoiceForm |
||||
}, |
||||
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,259 @@ |
||||
<template> |
||||
<a-card :bordered="false"> |
||||
<!-- 查询区域 --> |
||||
<div class="table-page-search-wrapper"> |
||||
<a-form layout="inline" @keyup.enter.native="searchQuery"> |
||||
<a-row :gutter="24"> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="用户"> |
||||
<j-select-user-by-dep placeholder="请选择用户" v-model="queryParam.userId"/> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="商品"> |
||||
<j-search-select-tag placeholder="请选择商品" v-model="queryParam.goodsId" dict="zy_goods,goods_name,id"/> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> |
||||
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> |
||||
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> |
||||
<a @click="handleToggleSearch" style="margin-left: 8px"> |
||||
{{ toggleSearchStatus ? '收起' : '展开' }} |
||||
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> |
||||
</a> |
||||
</span> |
||||
</a-col> |
||||
</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,onSelect: onSelect}" |
||||
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 class="card-end"> |
||||
总计:<span style="color: red;font-size: 20px">{{ totalPrice }}</span |
||||
>元 |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
|
||||
<customer-shopping-cart-modal ref="modalForm" @ok="modalFormOk"></customer-shopping-cart-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import CustomerShoppingCartModal from './modules/CustomerShoppingCartModal' |
||||
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' |
||||
|
||||
export default { |
||||
|
||||
name: 'CustomerShoppingCartList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
CustomerShoppingCartModal |
||||
}, |
||||
data () { |
||||
return { |
||||
selectedRows: [], |
||||
totalPrice: 0, |
||||
ssrjian: 0, |
||||
description: '购物车管理页面', |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
/*{ |
||||
title:'图片', |
||||
align:"center", |
||||
dataIndex: 'temiimg', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
},*/ |
||||
{ |
||||
title:'创建日期', |
||||
align:"center", |
||||
dataIndex: 'createTime' |
||||
}, |
||||
{ |
||||
title:'用户', |
||||
align:"center", |
||||
dataIndex: 'userId_dictText' |
||||
}, |
||||
{ |
||||
title:'商品', |
||||
align:"center", |
||||
dataIndex: 'goodsId_dictText' |
||||
}, |
||||
{ |
||||
title:'当前单价', |
||||
align:"center", |
||||
dataIndex: 'price' |
||||
}, |
||||
{ |
||||
title:'数量', |
||||
align:"center", |
||||
dataIndex: 'number' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/customershoppingcart/customerShoppingCart/list", |
||||
delete: "/customershoppingcart/customerShoppingCart/delete", |
||||
deleteBatch: "/customershoppingcart/customerShoppingCart/deleteBatch", |
||||
exportXlsUrl: "/customershoppingcart/customerShoppingCart/exportXls", |
||||
importExcelUrl: "customershoppingcart/customerShoppingCart/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
onSelectChange(selectedRowKeys) { |
||||
this.selectedRowKeys = selectedRowKeys |
||||
}, |
||||
onSelect(record, selected) { |
||||
var ssr |
||||
// 若选中,直接push |
||||
if (selected) { |
||||
this.selectedRows.push(record) |
||||
this.totalPrice=this.totalPrice+(record.number*record.price) |
||||
} else { |
||||
// 若取消选中,则查找到这条数据删除 |
||||
let index = this.selectedRows.findIndex((item) => item.id == record.id) |
||||
if (index >= 0) { |
||||
this.selectedRows.splice(index, 1) |
||||
this.ssrjian = record.number*record.price |
||||
this.totalPrice=this.totalPrice- this.ssrjian |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
}, |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'datetime',value:'createTime',text:'创建日期'}) |
||||
fieldList.push({type:'sel_user',value:'userId',text:'用户'}) |
||||
fieldList.push({type:'sel_search',value:'goodsId',text:'商品',dictTable:'zy_goods', dictText:'goods_name', dictCode:'id'}) |
||||
fieldList.push({type:'double',value:'price',text:'当前单价',dictCode:''}) |
||||
fieldList.push({type:'int',value:'number',text:'数量',dictCode:''}) |
||||
fieldList.push({type:'string',value:'temp1',text:'中间字段临时存储',dictCode:''}) |
||||
fieldList.push({type:'string',value:'temp2',text:'中间字段临时存储',dictCode:''}) |
||||
fieldList.push({type:'string',value:'temp3',text:'中间字段临时存储',dictCode:''}) |
||||
fieldList.push({type:'string',value:'temp4',text:'中间字段临时存储',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,152 @@ |
||||
<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="temiimg"> |
||||
<j-image-upload isMultiple v-model="model.temiimg" ></j-image-upload> |
||||
</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%" disabled/> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> |
||||
<j-select-user-by-dep v-model="model.userId" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="商品" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="goodsId"> |
||||
<j-search-select-tag v-model="model.goodsId" dict="zy_goods,goods_name,id" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="当前单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price"> |
||||
<a-input-number v-model="model.price" placeholder="请输入当前单价" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="number"> |
||||
<a-input-number v-model="model.number" placeholder="请输入数量" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="面料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp1"> |
||||
<a-input v-model="model.temp1" placeholder="请输入面料" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="发货地" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp2"> |
||||
<a-input v-model="model.temp2" placeholder="请输入中间字段临时存储" disabled></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="中间字段临时存储" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp3"> |
||||
<a-input v-model="model.temp3" placeholder="发货地" disabled ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<!-- <a-col :span="24"> |
||||
<a-form-model-item label="中间字段临时存储" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="temp4"> |
||||
<a-input v-model="model.temp4" placeholder="请输入中间字段临时存储" ></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: 'CustomerShoppingCartForm', |
||||
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: { |
||||
}, |
||||
url: { |
||||
add: "/customershoppingcart/customerShoppingCart/add", |
||||
edit: "/customershoppingcart/customerShoppingCart/edit", |
||||
queryById: "/customershoppingcart/customerShoppingCart/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="关闭"> |
||||
<customer-shopping-cart-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></customer-shopping-cart-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import CustomerShoppingCartForm from './CustomerShoppingCartForm' |
||||
export default { |
||||
name: 'CustomerShoppingCartModal', |
||||
components: { |
||||
CustomerShoppingCartForm |
||||
}, |
||||
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"> |
||||
<customer-shopping-cart-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></customer-shopping-cart-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 CustomerShoppingCartForm from './CustomerShoppingCartForm' |
||||
|
||||
export default { |
||||
name: 'CustomerShoppingCartModal', |
||||
components: { |
||||
CustomerShoppingCartForm |
||||
}, |
||||
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,118 @@ |
||||
<template> |
||||
<div> |
||||
<a-modal |
||||
title="制衣部件详情" |
||||
:visible="visible" |
||||
:confirm-loading="confirmLoading" |
||||
:width='1000' |
||||
@ok="handleOk" |
||||
@cancel="handleCancel"> |
||||
<p class="title">制衣部件详情</p> |
||||
<a-descriptions title="" bordered> |
||||
<a-descriptions-item label="企业">{{model.enterpriseId_dictText}}</a-descriptions-item> |
||||
<a-descriptions-item label="服装类型">{{model.clothsTypeId_dictText}}</a-descriptions-item> |
||||
<a-descriptions-item label="部件名称">{{model.partsName}}</a-descriptions-item> |
||||
<a-descriptions-item label="模块">{{model.modularId_dictText}}</a-descriptions-item> |
||||
<a-descriptions-item label="描述" :span="2">{{model.description}}</a-descriptions-item> |
||||
<a-descriptions-item label="图片" :span="3"> |
||||
<img v-if="model.pictureUrl" :src="model.pictureUrl" alt="无法显示"></img> |
||||
<span v-else>暂无图片</span> |
||||
</a-descriptions-item> |
||||
</a-descriptions> |
||||
<p class="title">部件工序详情</p> |
||||
<a-table :columns="columns1" :data-source="data1" bordered :pagination="false"> |
||||
</a-table> |
||||
</a-modal> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
// 部件 |
||||
// 工序 |
||||
// 是否瓶颈工序 |
||||
// 创建时间 |
||||
const columns1 = [ |
||||
{ |
||||
title:'索引', |
||||
customRender:(text, record, index)=>index+1, |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '部件', |
||||
dataIndex: 'nums', |
||||
key: 'nums', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '工序', |
||||
dataIndex: 'modularId_dictText', |
||||
key: 'modularId_dictText', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '是否瓶颈工序', |
||||
dataIndex: 'partsName', |
||||
key: 'partsName', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
key: 'createTime', |
||||
dataIndex: 'createTime', |
||||
align:'center' |
||||
}, |
||||
]; |
||||
const data1 = [ |
||||
{ |
||||
key: '1', |
||||
nums:'gfhjf', |
||||
modularId_dictText:'1-3合后育克', |
||||
partsName:'是', |
||||
createTime:'2022-12-06 19:00:07' |
||||
}, |
||||
// { |
||||
// key: '2', |
||||
// nums:'aaff', |
||||
// modularId_dictText:'1-3合后育克', |
||||
// partsName:'否', |
||||
// createTime:'2022-12-06 18:30:49' |
||||
// } |
||||
] |
||||
export default { |
||||
name: 'ZyClothsComponentListDetail',//此处填组件名称 |
||||
data () { |
||||
return { |
||||
visible: false, |
||||
confirmLoading: false, |
||||
model:{ |
||||
}, |
||||
data1, |
||||
columns1, |
||||
} |
||||
}, |
||||
methods: { |
||||
showModal(record) { |
||||
this.visible = true; |
||||
this.model = record |
||||
console.log('record') |
||||
console.log(record) |
||||
}, |
||||
handleOk(e) { |
||||
this.confirmLoading = true; |
||||
setTimeout(() => { |
||||
this.visible = false; |
||||
this.confirmLoading = false; |
||||
}, 1); |
||||
}, |
||||
handleCancel(e) { |
||||
this.visible = false; |
||||
}, |
||||
}, |
||||
} |
||||
</script > |
||||
<style scoped> |
||||
.title{ |
||||
font-size: 18px; |
||||
margin: 1em 0; |
||||
font-weight: bold; |
||||
} |
||||
</style> |
@ -0,0 +1,171 @@ |
||||
<template> |
||||
<div> |
||||
<a-modal |
||||
title="制衣模块详情" |
||||
:visible="visible" |
||||
:confirm-loading="confirmLoading" |
||||
:width='1000' |
||||
@ok="handleOk" |
||||
@cancel="handleCancel"> |
||||
<p class="title">制衣模块详情</p> |
||||
<a-descriptions title="" bordered> |
||||
<a-descriptions-item label="企业">{{model.enterpriseId_dictText}}</a-descriptions-item> |
||||
<a-descriptions-item label="编号">{{model.nums}}</a-descriptions-item> |
||||
<a-descriptions-item label="模块名称">{{model.modularName}}</a-descriptions-item> |
||||
<a-descriptions-item label="服装类型">{{model.clothsTypeId_dictText}}</a-descriptions-item> |
||||
<a-descriptions-item label="描述" :span="2">{{model.description}}</a-descriptions-item> |
||||
<a-descriptions-item label="图片" :span="3"> |
||||
<img v-if="model.pictureUrl" :src="model.pictureUrl" alt="无法显示"></img> |
||||
<span v-else>暂无图片</span> |
||||
</a-descriptions-item> |
||||
</a-descriptions> |
||||
<p class="title">模块部件详情</p> |
||||
<a-table :columns="columns1" :data-source="data1" bordered :pagination="false"> |
||||
</a-table> |
||||
<p class="title">模块工序详情</p> |
||||
<a-table :columns="columns2" :data-source="data2" bordered :pagination="false"> |
||||
</a-table> |
||||
</a-modal> |
||||
</div> |
||||
</template> |
||||
<script> |
||||
const columns1 = [ |
||||
{ |
||||
title:'索引', |
||||
customRender:(text, record, index)=>index+1, |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '编码', |
||||
dataIndex: 'nums', |
||||
key: 'nums', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '模块名称', |
||||
dataIndex: 'modularId_dictText', |
||||
key: 'modularId_dictText', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '部件名称', |
||||
dataIndex: 'partsName', |
||||
key: 'partsName', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
key: 'createTime', |
||||
dataIndex: 'createTime', |
||||
align:'center' |
||||
}, |
||||
]; |
||||
const data1 = [ |
||||
{ |
||||
key: '1', |
||||
nums:'tttt', |
||||
modularId_dictText:'tttt', |
||||
partsName:'大袖衩', |
||||
createTime:'2022-12-06 19:00:07' |
||||
}, |
||||
{ |
||||
key: '2', |
||||
nums:'aaff', |
||||
modularId_dictText:'tttt', |
||||
partsName:'外片', |
||||
createTime:'2022-12-06 18:30:49' |
||||
}, |
||||
{ |
||||
key: '3', |
||||
nums:'test01', |
||||
modularId_dictText:'tttt', |
||||
partsName:'大片', |
||||
createTime:'2022-12-06 09:07:05' |
||||
} |
||||
] |
||||
const columns2 = [ |
||||
{ |
||||
title:'索引', |
||||
customRender:(text, record, index)=>index+1, |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '模块名称', |
||||
dataIndex: 'modularId_dictText', |
||||
key: 'modularId_dictText', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '工序名称', |
||||
dataIndex: 'processId_dictText', |
||||
key: 'processId_dictText', |
||||
align:'center' |
||||
}, |
||||
{ |
||||
title: '创建时间', |
||||
key: 'createTime', |
||||
dataIndex: 'createTime', |
||||
align:'center' |
||||
}, |
||||
]; |
||||
const data2 = [ |
||||
{ |
||||
key: '1', |
||||
modularId_dictText:'tttt', |
||||
processId_dictText:'1-3合后育克', |
||||
createTime:'2022-12-06 19:00:07' |
||||
}, |
||||
{ |
||||
key: '2', |
||||
modularId_dictText:'tttt', |
||||
processId_dictText:'模板运袋盖', |
||||
createTime:'2022-12-06 18:30:49' |
||||
}, |
||||
{ |
||||
key: '3', |
||||
modularId_dictText:'tttt', |
||||
processId_dictText:'1-4辑后育克0.1cm明线', |
||||
createTime:'2022-12-06 09:07:05' |
||||
} |
||||
] |
||||
export default { |
||||
name: 'ZyClothsModularListDetail',//此处填组件名称 |
||||
data () { |
||||
return { |
||||
visible: false, |
||||
confirmLoading: false, |
||||
model:{ |
||||
}, |
||||
data1, |
||||
columns1, |
||||
data2, |
||||
columns2, |
||||
} |
||||
}, |
||||
methods: { |
||||
showModal(record) { |
||||
this.visible = true; |
||||
this.model = record |
||||
console.log('record') |
||||
console.log(record) |
||||
}, |
||||
handleOk(e) { |
||||
this.confirmLoading = true; |
||||
setTimeout(() => { |
||||
this.visible = false; |
||||
this.confirmLoading = false; |
||||
}, 1); |
||||
}, |
||||
handleCancel(e) { |
||||
this.visible = false; |
||||
}, |
||||
}, |
||||
} |
||||
</script > |
||||
<style scoped> |
||||
.title{ |
||||
font-size: 18px; |
||||
margin: 1em 0; |
||||
font-weight: bold; |
||||
} |
||||
</style> |
@ -0,0 +1,250 @@ |
||||
package org.jeecg.modules.demo.collecttype.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.apache.shiro.SecurityUtils; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.system.vo.LoginUser; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
import org.jeecg.modules.demo.collecttype.entity.CollectType; |
||||
import org.jeecg.modules.demo.collecttype.mapper.CollectTypeMapper; |
||||
import org.jeecg.modules.demo.collecttype.service.ICollectTypeService; |
||||
|
||||
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: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="收藏分类管理") |
||||
@RestController |
||||
@RequestMapping("/collecttype/collectType") |
||||
@Slf4j |
||||
public class CollectTypeController extends JeecgController<CollectType, ICollectTypeService>{ |
||||
@Autowired |
||||
private ICollectTypeService collectTypeService; |
||||
|
||||
|
||||
@Autowired |
||||
CollectTypeMapper collectTypeMapper; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param collectType |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏分类管理-分页列表查询") |
||||
@ApiOperation(value="收藏分类管理-分页列表查询", notes="收藏分类管理-分页列表查询") |
||||
@GetMapping(value = "/rootList") |
||||
public Result<?> queryPageList(CollectType collectType, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
||||
String hasQuery = req.getParameter("hasQuery"); |
||||
if(hasQuery != null && "true".equals(hasQuery)){ |
||||
QueryWrapper<CollectType> queryWrapper = QueryGenerator.initQueryWrapper(collectType, req.getParameterMap()); |
||||
//根据用户id得到角色id
|
||||
String userole = collectTypeMapper.getuserole(sysUser.getId()); |
||||
if (userole.equals("f6817f48af4fb3af11b9e8bf182f618b")){ |
||||
|
||||
}else{ |
||||
queryWrapper.eq("createBy",sysUser.getUsername()); |
||||
} |
||||
/*queryWrapper.eq("createBy",sysUser.getUsername());*/ |
||||
List<CollectType> list = collectTypeService.queryTreeListNoPage(queryWrapper); |
||||
IPage<CollectType> pageList = new Page<>(1, 10, list.size()); |
||||
pageList.setRecords(list); |
||||
return Result.OK(pageList); |
||||
}else{ |
||||
String parentId = collectType.getPid(); |
||||
if (oConvertUtils.isEmpty(parentId)) { |
||||
parentId = "0"; |
||||
} |
||||
collectType.setPid(null); |
||||
QueryWrapper<CollectType> queryWrapper = QueryGenerator.initQueryWrapper(collectType, req.getParameterMap()); |
||||
// 使用 eq 防止模糊查询
|
||||
queryWrapper.eq("pid", parentId); |
||||
Page<CollectType> page = new Page<CollectType>(pageNo, pageSize); |
||||
IPage<CollectType> pageList = collectTypeService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取子数据 |
||||
* @param collectType |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏分类管理-获取子数据") |
||||
@ApiOperation(value="收藏分类管理-获取子数据", notes="收藏分类管理-获取子数据") |
||||
@GetMapping(value = "/childList") |
||||
public Result<?> queryPageList(CollectType collectType,HttpServletRequest req) { |
||||
QueryWrapper<CollectType> queryWrapper = QueryGenerator.initQueryWrapper(collectType, req.getParameterMap()); |
||||
List<CollectType> list = collectTypeService.list(queryWrapper); |
||||
IPage<CollectType> pageList = new Page<>(1, 10, list.size()); |
||||
pageList.setRecords(list); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 批量查询子节点 |
||||
* @param parentIds 父ID(多个采用半角逗号分割) |
||||
* @return 返回 IPage |
||||
* @param parentIds |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏分类管理-批量获取子数据") |
||||
@ApiOperation(value="收藏分类管理-批量获取子数据", notes="收藏分类管理-批量获取子数据") |
||||
@GetMapping("/getChildListBatch") |
||||
public Result getChildListBatch(@RequestParam("parentIds") String parentIds) { |
||||
try { |
||||
QueryWrapper<CollectType> queryWrapper = new QueryWrapper<>(); |
||||
List<String> parentIdList = Arrays.asList(parentIds.split(",")); |
||||
queryWrapper.in("pid", parentIdList); |
||||
List<CollectType> list = collectTypeService.list(queryWrapper); |
||||
IPage<CollectType> pageList = new Page<>(1, 10, list.size()); |
||||
pageList.setRecords(list); |
||||
return Result.OK(pageList); |
||||
} catch (Exception e) { |
||||
log.error(e.getMessage(), e); |
||||
return Result.error("批量查询子节点失败:" + e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param collectType |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏分类管理-添加") |
||||
@ApiOperation(value="收藏分类管理-添加", notes="收藏分类管理-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody CollectType collectType) { |
||||
collectTypeService.addCollectType(collectType); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param collectType |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏分类管理-编辑") |
||||
@ApiOperation(value="收藏分类管理-编辑", notes="收藏分类管理-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody CollectType collectType) { |
||||
collectTypeService.updateCollectType(collectType); |
||||
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) { |
||||
collectTypeService.deleteCollectType(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.collectTypeService.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) { |
||||
CollectType collectType = collectTypeService.getById(id); |
||||
if(collectType==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(collectType); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param collectType |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, CollectType collectType) { |
||||
return super.exportXls(request, collectType, CollectType.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, CollectType.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,70 @@ |
||||
package org.jeecg.modules.demo.collecttype.entity; |
||||
|
||||
import java.io.Serializable; |
||||
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 java.io.UnsupportedEncodingException; |
||||
|
||||
/** |
||||
* @Description: 收藏分类管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("collect_type") |
||||
@ApiModel(value="collect_type对象", description="收藏分类管理") |
||||
public class CollectType implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private java.lang.String id; |
||||
/**创建人*/ |
||||
@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; |
||||
/**所属部门*/ |
||||
@ApiModelProperty(value = "所属部门") |
||||
private java.lang.String sysOrgCode; |
||||
/**用户*/ |
||||
@Excel(name = "用户", width = 15) |
||||
@ApiModelProperty(value = "用户") |
||||
private java.lang.String userId; |
||||
/**收藏分类名*/ |
||||
@Excel(name = "收藏分类名", width = 15) |
||||
@ApiModelProperty(value = "收藏分类名") |
||||
private java.lang.String collectTypeName; |
||||
/**父级节点*/ |
||||
@Excel(name = "父级节点", width = 15) |
||||
@ApiModelProperty(value = "父级节点") |
||||
private java.lang.String pid; |
||||
/**是否有子节点*/ |
||||
@Excel(name = "是否有子节点", width = 15, dicCode = "yn") |
||||
@Dict(dicCode = "yn") |
||||
@ApiModelProperty(value = "是否有子节点") |
||||
private java.lang.String hasChild; |
||||
} |
@ -0,0 +1,25 @@ |
||||
package org.jeecg.modules.demo.collecttype.mapper; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.jeecg.modules.demo.collecttype.entity.CollectType; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 收藏分类管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface CollectTypeMapper extends BaseMapper<CollectType> { |
||||
|
||||
/** |
||||
* 编辑节点状态 |
||||
* @param id |
||||
* @param status |
||||
*/ |
||||
void updateTreeNodeStatus(@Param("id") String id,@Param("status") String status); |
||||
|
||||
@Select("select role_id from sys_user_role where user_id =#{id}") |
||||
String getuserole(String id); |
||||
} |
@ -0,0 +1,9 @@ |
||||
<?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.demo.collecttype.mapper.CollectTypeMapper"> |
||||
|
||||
<update id="updateTreeNodeStatus" parameterType="java.lang.String"> |
||||
update collect_type set has_child = #{status} where id = #{id} |
||||
</update> |
||||
|
||||
</mapper> |
@ -0,0 +1,44 @@ |
||||
package org.jeecg.modules.demo.collecttype.service; |
||||
|
||||
import org.jeecg.modules.demo.collecttype.entity.CollectType; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.jeecg.common.exception.JeecgBootException; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @Description: 收藏分类管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ICollectTypeService extends IService<CollectType> { |
||||
|
||||
@Autowired |
||||
|
||||
|
||||
/**根节点父ID的值*/ |
||||
public static final String ROOT_PID_VALUE = "0"; |
||||
|
||||
/**树节点有子节点状态值*/ |
||||
public static final String HASCHILD = "1"; |
||||
|
||||
/**树节点无子节点状态值*/ |
||||
public static final String NOCHILD = "0"; |
||||
|
||||
/**新增节点*/ |
||||
void addCollectType(CollectType collectType); |
||||
|
||||
/**修改节点*/ |
||||
void updateCollectType(CollectType collectType) throws JeecgBootException; |
||||
|
||||
/**删除节点*/ |
||||
void deleteCollectType(String id) throws JeecgBootException; |
||||
|
||||
/**查询所有数据,无分页*/ |
||||
List<CollectType> queryTreeListNoPage(QueryWrapper<CollectType> queryWrapper); |
||||
|
||||
|
||||
} |
@ -0,0 +1,193 @@ |
||||
package org.jeecg.modules.demo.collecttype.service.impl; |
||||
|
||||
import org.jeecg.common.exception.JeecgBootException; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
import org.jeecg.modules.demo.collecttype.entity.CollectType; |
||||
import org.jeecg.modules.demo.collecttype.mapper.CollectTypeMapper; |
||||
import org.jeecg.modules.demo.collecttype.service.ICollectTypeService; |
||||
import org.springframework.stereotype.Service; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 收藏分类管理 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class CollectTypeServiceImpl extends ServiceImpl<CollectTypeMapper, CollectType> implements ICollectTypeService { |
||||
|
||||
@Override |
||||
public void addCollectType(CollectType collectType) { |
||||
//新增时设置hasChild为0
|
||||
collectType.setHasChild(ICollectTypeService.NOCHILD); |
||||
if(oConvertUtils.isEmpty(collectType.getPid())){ |
||||
collectType.setPid(ICollectTypeService.ROOT_PID_VALUE); |
||||
}else{ |
||||
//如果当前节点父ID不为空 则设置父节点的hasChildren 为1
|
||||
CollectType parent = baseMapper.selectById(collectType.getPid()); |
||||
if(parent!=null && !"1".equals(parent.getHasChild())){ |
||||
parent.setHasChild("1"); |
||||
baseMapper.updateById(parent); |
||||
} |
||||
} |
||||
baseMapper.insert(collectType); |
||||
} |
||||
|
||||
@Override |
||||
public void updateCollectType(CollectType collectType) { |
||||
CollectType entity = this.getById(collectType.getId()); |
||||
if(entity==null) { |
||||
throw new JeecgBootException("未找到对应实体"); |
||||
} |
||||
String old_pid = entity.getPid(); |
||||
String new_pid = collectType.getPid(); |
||||
if(!old_pid.equals(new_pid)) { |
||||
updateOldParentNode(old_pid); |
||||
if(oConvertUtils.isEmpty(new_pid)){ |
||||
collectType.setPid(ICollectTypeService.ROOT_PID_VALUE); |
||||
} |
||||
if(!ICollectTypeService.ROOT_PID_VALUE.equals(collectType.getPid())) { |
||||
baseMapper.updateTreeNodeStatus(collectType.getPid(), ICollectTypeService.HASCHILD); |
||||
} |
||||
} |
||||
baseMapper.updateById(collectType); |
||||
} |
||||
|
||||
@Override |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public void deleteCollectType(String id) throws JeecgBootException { |
||||
//查询选中节点下所有子节点一并删除
|
||||
id = this.queryTreeChildIds(id); |
||||
if(id.indexOf(",")>0) { |
||||
StringBuffer sb = new StringBuffer(); |
||||
String[] idArr = id.split(","); |
||||
for (String idVal : idArr) { |
||||
if(idVal != null){ |
||||
CollectType collectType = this.getById(idVal); |
||||
String pidVal = collectType.getPid(); |
||||
//查询此节点上一级是否还有其他子节点
|
||||
List<CollectType> dataList = baseMapper.selectList(new QueryWrapper<CollectType>().eq("pid", pidVal).notIn("id",Arrays.asList(idArr))); |
||||
if((dataList == null || dataList.size()==0) && !Arrays.asList(idArr).contains(pidVal) |
||||
&& !sb.toString().contains(pidVal)){ |
||||
//如果当前节点原本有子节点 现在木有了,更新状态
|
||||
sb.append(pidVal).append(","); |
||||
} |
||||
} |
||||
} |
||||
//批量删除节点
|
||||
baseMapper.deleteBatchIds(Arrays.asList(idArr)); |
||||
//修改已无子节点的标识
|
||||
String[] pidArr = sb.toString().split(","); |
||||
for(String pid : pidArr){ |
||||
this.updateOldParentNode(pid); |
||||
} |
||||
}else{ |
||||
CollectType collectType = this.getById(id); |
||||
if(collectType==null) { |
||||
throw new JeecgBootException("未找到对应实体"); |
||||
} |
||||
updateOldParentNode(collectType.getPid()); |
||||
baseMapper.deleteById(id); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public List<CollectType> queryTreeListNoPage(QueryWrapper<CollectType> queryWrapper) { |
||||
List<CollectType> dataList = baseMapper.selectList(queryWrapper); |
||||
List<CollectType> mapList = new ArrayList<>(); |
||||
for(CollectType data : dataList){ |
||||
String pidVal = data.getPid(); |
||||
//递归查询子节点的根节点
|
||||
if(pidVal != null && !"0".equals(pidVal)){ |
||||
CollectType rootVal = this.getTreeRoot(pidVal); |
||||
if(rootVal != null && !mapList.contains(rootVal)){ |
||||
mapList.add(rootVal); |
||||
} |
||||
}else{ |
||||
if(!mapList.contains(data)){ |
||||
mapList.add(data); |
||||
} |
||||
} |
||||
} |
||||
return mapList; |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 根据所传pid查询旧的父级节点的子节点并修改相应状态值 |
||||
* @param pid |
||||
*/ |
||||
private void updateOldParentNode(String pid) { |
||||
if(!ICollectTypeService.ROOT_PID_VALUE.equals(pid)) { |
||||
Integer count = baseMapper.selectCount(new QueryWrapper<CollectType>().eq("pid", pid)); |
||||
if(count==null || count<=1) { |
||||
baseMapper.updateTreeNodeStatus(pid, ICollectTypeService.NOCHILD); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 递归查询节点的根节点 |
||||
* @param pidVal |
||||
* @return |
||||
*/ |
||||
private CollectType getTreeRoot(String pidVal){ |
||||
CollectType data = baseMapper.selectById(pidVal); |
||||
if(data != null && !"0".equals(data.getPid())){ |
||||
return this.getTreeRoot(data.getPid()); |
||||
}else{ |
||||
return data; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询所有子节点id |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
private String queryTreeChildIds(String ids) { |
||||
//获取id数组
|
||||
String[] idArr = ids.split(","); |
||||
StringBuffer sb = new StringBuffer(); |
||||
for (String pidVal : idArr) { |
||||
if(pidVal != null){ |
||||
if(!sb.toString().contains(pidVal)){ |
||||
if(sb.toString().length() > 0){ |
||||
sb.append(","); |
||||
} |
||||
sb.append(pidVal); |
||||
this.getTreeChildIds(pidVal,sb); |
||||
} |
||||
} |
||||
} |
||||
return sb.toString(); |
||||
} |
||||
|
||||
/** |
||||
* 递归查询所有子节点 |
||||
* @param pidVal |
||||
* @param sb |
||||
* @return |
||||
*/ |
||||
private StringBuffer getTreeChildIds(String pidVal,StringBuffer sb){ |
||||
List<CollectType> dataList = baseMapper.selectList(new QueryWrapper<CollectType>().eq("pid", pidVal)); |
||||
if(dataList != null && dataList.size()>0){ |
||||
for(CollectType tree : dataList) { |
||||
if(!sb.toString().contains(tree.getId())){ |
||||
sb.append(",").append(tree.getId()); |
||||
} |
||||
this.getTreeChildIds(tree.getId(),sb); |
||||
} |
||||
} |
||||
return sb; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,171 @@ |
||||
package org.jeecg.modules.demo.customercollectgoods.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.demo.customercollectgoods.entity.Customercollectgoods; |
||||
import org.jeecg.modules.demo.customercollectgoods.service.ICustomercollectgoodsService; |
||||
|
||||
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: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="收藏商品(衣橱)") |
||||
@RestController |
||||
@RequestMapping("/customercollectgoods/customercollectgoods") |
||||
@Slf4j |
||||
public class CustomercollectgoodsController extends JeecgController<Customercollectgoods, ICustomercollectgoodsService> { |
||||
@Autowired |
||||
private ICustomercollectgoodsService customercollectgoodsService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param customercollectgoods |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏商品(衣橱)-分页列表查询") |
||||
@ApiOperation(value="收藏商品(衣橱)-分页列表查询", notes="收藏商品(衣橱)-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(Customercollectgoods customercollectgoods, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<Customercollectgoods> queryWrapper = QueryGenerator.initQueryWrapper(customercollectgoods, req.getParameterMap()); |
||||
Page<Customercollectgoods> page = new Page<Customercollectgoods>(pageNo, pageSize); |
||||
IPage<Customercollectgoods> pageList = customercollectgoodsService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param customercollectgoods |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏商品(衣橱)-添加") |
||||
@ApiOperation(value="收藏商品(衣橱)-添加", notes="收藏商品(衣橱)-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody Customercollectgoods customercollectgoods) { |
||||
customercollectgoodsService.save(customercollectgoods); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param customercollectgoods |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "收藏商品(衣橱)-编辑") |
||||
@ApiOperation(value="收藏商品(衣橱)-编辑", notes="收藏商品(衣橱)-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody Customercollectgoods customercollectgoods) { |
||||
customercollectgoodsService.updateById(customercollectgoods); |
||||
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) { |
||||
customercollectgoodsService.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.customercollectgoodsService.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) { |
||||
Customercollectgoods customercollectgoods = customercollectgoodsService.getById(id); |
||||
if(customercollectgoods==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(customercollectgoods); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param customercollectgoods |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, Customercollectgoods customercollectgoods) { |
||||
return super.exportXls(request, customercollectgoods, Customercollectgoods.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, Customercollectgoods.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,79 @@ |
||||
package org.jeecg.modules.demo.customercollectgoods.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-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("customercollectgoods") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="customercollectgoods对象", description="收藏商品(衣橱)") |
||||
public class Customercollectgoods implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private java.lang.String id; |
||||
/**创建人*/ |
||||
@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; |
||||
/**所属部门*/ |
||||
@ApiModelProperty(value = "所属部门") |
||||
private java.lang.String sysOrgCode; |
||||
/**用户*/ |
||||
@Excel(name = "用户", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@ApiModelProperty(value = "用户") |
||||
private java.lang.String userId; |
||||
/**商品*/ |
||||
@Excel(name = "商品", width = 15) |
||||
@ApiModelProperty(value = "商品") |
||||
private java.lang.String goodsId; |
||||
/**当前单价*/ |
||||
@Excel(name = "当前单价", width = 15) |
||||
@ApiModelProperty(value = "当前单价") |
||||
private java.lang.String price; |
||||
/**数量*/ |
||||
@Excel(name = "数量", width = 15) |
||||
@ApiModelProperty(value = "数量") |
||||
private java.lang.String number; |
||||
/**收藏夹*/ |
||||
@Excel(name = "收藏夹", width = 15, dictTable = "collect_type", dicText = "collect_type_name", dicCode = "id") |
||||
@Dict(dictTable = "collect_type", dicText = "collect_type_name", dicCode = "id") |
||||
@ApiModelProperty(value = "收藏夹") |
||||
private java.lang.String collectTypeId; |
||||
} |
@ -0,0 +1,17 @@ |
||||
package org.jeecg.modules.demo.customercollectgoods.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 收藏商品(衣橱) |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface CustomercollectgoodsMapper extends BaseMapper<Customercollectgoods> { |
||||
|
||||
} |
@ -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.demo.customercollectgoods.mapper.CustomercollectgoodsMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
package org.jeecg.modules.demo.customercollectgoods.service; |
||||
|
||||
import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: 收藏商品(衣橱) |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ICustomercollectgoodsService extends IService<Customercollectgoods> { |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package org.jeecg.modules.demo.customercollectgoods.service.impl; |
||||
|
||||
import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; |
||||
import org.jeecg.modules.demo.customercollectgoods.mapper.CustomercollectgoodsMapper; |
||||
import org.jeecg.modules.demo.customercollectgoods.service.ICustomercollectgoodsService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 收藏商品(衣橱) |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class CustomercollectgoodsServiceImpl extends ServiceImpl<CustomercollectgoodsMapper, Customercollectgoods> implements ICustomercollectgoodsService { |
||||
|
||||
} |
@ -0,0 +1,171 @@ |
||||
package org.jeecg.modules.demo.customerinvoice.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.demo.customerinvoice.entity.CustomerInvoice; |
||||
import org.jeecg.modules.demo.customerinvoice.service.ICustomerInvoiceService; |
||||
|
||||
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: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="客户发票信息") |
||||
@RestController |
||||
@RequestMapping("/customerinvoice/customerInvoice") |
||||
@Slf4j |
||||
public class CustomerInvoiceController extends JeecgController<CustomerInvoice, ICustomerInvoiceService> { |
||||
@Autowired |
||||
private ICustomerInvoiceService customerInvoiceService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param customerInvoice |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "客户发票信息-分页列表查询") |
||||
@ApiOperation(value="客户发票信息-分页列表查询", notes="客户发票信息-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(CustomerInvoice customerInvoice, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<CustomerInvoice> queryWrapper = QueryGenerator.initQueryWrapper(customerInvoice, req.getParameterMap()); |
||||
Page<CustomerInvoice> page = new Page<CustomerInvoice>(pageNo, pageSize); |
||||
IPage<CustomerInvoice> pageList = customerInvoiceService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param customerInvoice |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "客户发票信息-添加") |
||||
@ApiOperation(value="客户发票信息-添加", notes="客户发票信息-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody CustomerInvoice customerInvoice) { |
||||
customerInvoiceService.save(customerInvoice); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param customerInvoice |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "客户发票信息-编辑") |
||||
@ApiOperation(value="客户发票信息-编辑", notes="客户发票信息-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody CustomerInvoice customerInvoice) { |
||||
customerInvoiceService.updateById(customerInvoice); |
||||
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) { |
||||
customerInvoiceService.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.customerInvoiceService.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) { |
||||
CustomerInvoice customerInvoice = customerInvoiceService.getById(id); |
||||
if(customerInvoice==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(customerInvoice); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param customerInvoice |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, CustomerInvoice customerInvoice) { |
||||
return super.exportXls(request, customerInvoice, CustomerInvoice.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, CustomerInvoice.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,100 @@ |
||||
package org.jeecg.modules.demo.customerinvoice.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-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("customer_invoice") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="customer_invoice对象", description="客户发票信息") |
||||
public class CustomerInvoice implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private java.lang.String id; |
||||
/**创建人*/ |
||||
@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; |
||||
/**所属部门*/ |
||||
@ApiModelProperty(value = "所属部门") |
||||
private java.lang.String sysOrgCode; |
||||
/**用户*/ |
||||
@Excel(name = "用户", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@ApiModelProperty(value = "用户") |
||||
private java.lang.String userId; |
||||
/**客户类型*/ |
||||
@Excel(name = "客户类型", width = 15, dicCode = "khlx") |
||||
@Dict(dicCode = "khlx") |
||||
@ApiModelProperty(value = "客户类型") |
||||
private java.lang.String customerType; |
||||
/**发票类型*/ |
||||
@Excel(name = "发票类型", width = 15, dicCode = "fplx") |
||||
@Dict(dicCode = "fplx") |
||||
@ApiModelProperty(value = "发票类型") |
||||
private java.lang.String invoiceType; |
||||
/**名称*/ |
||||
@Excel(name = "名称", width = 15) |
||||
@ApiModelProperty(value = "名称") |
||||
private java.lang.String name; |
||||
/**纳税人识别号*/ |
||||
@Excel(name = "纳税人识别号", width = 15) |
||||
@ApiModelProperty(value = "纳税人识别号") |
||||
private java.lang.String taxIdentificationNumber; |
||||
/**地址*/ |
||||
@Excel(name = "地址", width = 15) |
||||
@ApiModelProperty(value = "地址") |
||||
private java.lang.String address; |
||||
/**电话*/ |
||||
@Excel(name = "电话", width = 15) |
||||
@ApiModelProperty(value = "电话") |
||||
private java.lang.String telephone; |
||||
/**开户行*/ |
||||
@Excel(name = "开户行", width = 15) |
||||
@ApiModelProperty(value = "开户行") |
||||
private java.lang.String bankDeposit; |
||||
/**账号*/ |
||||
@Excel(name = "账号", width = 15) |
||||
@ApiModelProperty(value = "账号") |
||||
private java.lang.String accountNumber; |
||||
/**排序*/ |
||||
@Excel(name = "排序", width = 15) |
||||
@ApiModelProperty(value = "排序") |
||||
private java.lang.Integer sort; |
||||
} |
@ -0,0 +1,17 @@ |
||||
package org.jeecg.modules.demo.customerinvoice.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.demo.customerinvoice.entity.CustomerInvoice; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 客户发票信息 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface CustomerInvoiceMapper extends BaseMapper<CustomerInvoice> { |
||||
|
||||
} |
@ -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.demo.customerinvoice.mapper.CustomerInvoiceMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
package org.jeecg.modules.demo.customerinvoice.service; |
||||
|
||||
import org.jeecg.modules.demo.customerinvoice.entity.CustomerInvoice; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: 客户发票信息 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ICustomerInvoiceService extends IService<CustomerInvoice> { |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package org.jeecg.modules.demo.customerinvoice.service.impl; |
||||
|
||||
import org.jeecg.modules.demo.customerinvoice.entity.CustomerInvoice; |
||||
import org.jeecg.modules.demo.customerinvoice.mapper.CustomerInvoiceMapper; |
||||
import org.jeecg.modules.demo.customerinvoice.service.ICustomerInvoiceService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 客户发票信息 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class CustomerInvoiceServiceImpl extends ServiceImpl<CustomerInvoiceMapper, CustomerInvoice> implements ICustomerInvoiceService { |
||||
|
||||
} |
@ -0,0 +1,180 @@ |
||||
package org.jeecg.modules.demo.customershoppingcart.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.demo.customershoppingcart.entity.CustomerShoppingCart; |
||||
import org.jeecg.modules.demo.customershoppingcart.service.ICustomerShoppingCartService; |
||||
|
||||
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.demo.zygoods.entity.ZyGoods; |
||||
import org.jeecg.modules.demo.zygoods.service.IZyGoodsService; |
||||
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-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="购物车") |
||||
@RestController |
||||
@RequestMapping("/customershoppingcart/customerShoppingCart") |
||||
@Slf4j |
||||
public class CustomerShoppingCartController extends JeecgController<CustomerShoppingCart, ICustomerShoppingCartService> { |
||||
@Autowired |
||||
private ICustomerShoppingCartService customerShoppingCartService; |
||||
|
||||
@Autowired |
||||
private IZyGoodsService zyGoodsService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param customerShoppingCart |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "购物车-分页列表查询") |
||||
@ApiOperation(value="购物车-分页列表查询", notes="购物车-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(CustomerShoppingCart customerShoppingCart, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<CustomerShoppingCart> queryWrapper = QueryGenerator.initQueryWrapper(customerShoppingCart, req.getParameterMap()); |
||||
Page<CustomerShoppingCart> page = new Page<CustomerShoppingCart>(pageNo, pageSize); |
||||
IPage<CustomerShoppingCart> pageList = customerShoppingCartService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param customerShoppingCart |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "购物车-添加") |
||||
@ApiOperation(value="购物车-添加", notes="购物车-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody CustomerShoppingCart customerShoppingCart) { |
||||
customerShoppingCartService.save(customerShoppingCart); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param customerShoppingCart |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "购物车-编辑") |
||||
@ApiOperation(value="购物车-编辑", notes="购物车-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody CustomerShoppingCart customerShoppingCart) { |
||||
customerShoppingCartService.updateById(customerShoppingCart); |
||||
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) { |
||||
customerShoppingCartService.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.customerShoppingCartService.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) { |
||||
CustomerShoppingCart customerShoppingCart = customerShoppingCartService.getById(id); |
||||
if(customerShoppingCart==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
/* String goodsid = customerShoppingCart.getGoodsId(); |
||||
ZyGoods zygoods= zyGoodsService.getById(goodsid);*/ |
||||
|
||||
|
||||
return Result.OK(customerShoppingCart); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param customerShoppingCart |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, CustomerShoppingCart customerShoppingCart) { |
||||
return super.exportXls(request, customerShoppingCart, CustomerShoppingCart.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, CustomerShoppingCart.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,97 @@ |
||||
package org.jeecg.modules.demo.customershoppingcart.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-12-10 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("customer_shopping_cart") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="customer_shopping_cart对象", description="购物车") |
||||
public class CustomerShoppingCart implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**主键*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "主键") |
||||
private String id; |
||||
/**创建人*/ |
||||
@ApiModelProperty(value = "创建人") |
||||
private String createBy; |
||||
/**创建日期*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "创建日期") |
||||
private Date createTime; |
||||
/**更新人*/ |
||||
@ApiModelProperty(value = "更新人") |
||||
private String updateBy; |
||||
/**更新日期*/ |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
||||
@ApiModelProperty(value = "更新日期") |
||||
private Date updateTime; |
||||
/**所属部门*/ |
||||
@ApiModelProperty(value = "所属部门") |
||||
private String sysOrgCode; |
||||
/**用户*/ |
||||
@Excel(name = "用户", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@ApiModelProperty(value = "用户") |
||||
private String userId; |
||||
/**商品*/ |
||||
@Excel(name = "商品", width = 15, dictTable = "zy_goods", dicText = "goods_name", dicCode = "id") |
||||
@Dict(dictTable = "zy_goods", dicText = "goods_name", dicCode = "id") |
||||
@ApiModelProperty(value = "商品") |
||||
private String goodsId; |
||||
/**当前单价*/ |
||||
@Excel(name = "当前单价", width = 15) |
||||
@ApiModelProperty(value = "当前单价") |
||||
private Double price; |
||||
/**数量*/ |
||||
@Excel(name = "数量", width = 15) |
||||
@ApiModelProperty(value = "数量") |
||||
private Integer number; |
||||
/**中间字段临时存储*/ |
||||
@Excel(name = "中间字段临时存储", width = 15) |
||||
@ApiModelProperty(value = "中间字段临时存储") |
||||
private String temp1; |
||||
/**中间字段临时存储*/ |
||||
@Excel(name = "中间字段临时存储", width = 15) |
||||
@ApiModelProperty(value = "中间字段临时存储") |
||||
private String temp2; |
||||
/**中间字段临时存储*/ |
||||
@Excel(name = "中间字段临时存储", width = 15) |
||||
@ApiModelProperty(value = "中间字段临时存储") |
||||
private String temp3; |
||||
/**中间字段临时存储*/ |
||||
@Excel(name = "中间字段临时存储", width = 15) |
||||
@ApiModelProperty(value = "中间字段临时存储") |
||||
private String temp4; |
||||
/**图片字段*/ |
||||
@Excel(name = "图片字段", width = 15) |
||||
@ApiModelProperty(value = "图片字段") |
||||
private String temiimg; |
||||
} |
@ -0,0 +1,17 @@ |
||||
package org.jeecg.modules.demo.customershoppingcart.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: 购物车 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface CustomerShoppingCartMapper extends BaseMapper<CustomerShoppingCart> { |
||||
|
||||
} |
@ -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.demo.customershoppingcart.mapper.CustomerShoppingCartMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,14 @@ |
||||
package org.jeecg.modules.demo.customershoppingcart.service; |
||||
|
||||
import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: 购物车 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ICustomerShoppingCartService extends IService<CustomerShoppingCart> { |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
package org.jeecg.modules.demo.customershoppingcart.service.impl; |
||||
|
||||
import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; |
||||
import org.jeecg.modules.demo.customershoppingcart.mapper.CustomerShoppingCartMapper; |
||||
import org.jeecg.modules.demo.customershoppingcart.service.ICustomerShoppingCartService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 购物车 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-08 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class CustomerShoppingCartServiceImpl extends ServiceImpl<CustomerShoppingCartMapper, CustomerShoppingCart> implements ICustomerShoppingCartService { |
||||
|
||||
} |
Loading…
Reference in new issue