parent
cd7a956a54
commit
7f0fda7dcf
64 changed files with 4302 additions and 604 deletions
@ -0,0 +1,225 @@ |
||||
<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="品牌名称"> |
||||
<a-input placeholder="请输入名称" v-model="queryParam.brand"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="联系人"> |
||||
<a-input placeholder="请输入联系人" v-model="queryParam.contact"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="产地"> |
||||
<a-input placeholder="请输入产地" v-model="queryParam.place"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-model-item label="生产厂商" > |
||||
<j-select-depart v-model="queryParam.manufacturer" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-model-item label="供应商" > |
||||
<j-select-depart v-model="queryParam.supplier" /> |
||||
</a-form-model-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> |
||||
</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}" |
||||
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 @click="handleDetail(record)">详情</a> |
||||
<a-divider type="vertical" /> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<zy-tool-brand-modal ref="modalForm" @ok="modalFormOk"></zy-tool-brand-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ZyToolBrandModal from './modules/ZyToolBrandModal' |
||||
|
||||
export default { |
||||
name: 'ZyToolBrandList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
ZyToolBrandModal |
||||
}, |
||||
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: 'img' |
||||
}, |
||||
{ |
||||
title:'类型品牌', |
||||
align:"center", |
||||
dataIndex: 'brand' |
||||
}, |
||||
{ |
||||
title:'生产厂商', |
||||
align:"center", |
||||
dataIndex: 'manufacturer_dictText' |
||||
}, |
||||
{ |
||||
title:'供应商', |
||||
align:"center", |
||||
dataIndex: 'supplier_dictText' |
||||
}, |
||||
{ |
||||
title:'联系人', |
||||
align:"center", |
||||
dataIndex: 'contact' |
||||
}, |
||||
{ |
||||
title:'产地', |
||||
align:"center", |
||||
dataIndex: 'place' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/toolbrand/zyToolBrand/list", |
||||
delete: "/toolbrand/zyToolBrand/delete", |
||||
deleteBatch: "/toolbrand/zyToolBrand/deleteBatch", |
||||
exportXlsUrl: "/toolbrand/zyToolBrand/exportXls", |
||||
importExcelUrl: "toolbrand/zyToolBrand/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'img',text:'类型图片',dictCode:''}) |
||||
fieldList.push({type:'string',value:'brand',text:'类型品牌',dictCode:''}) |
||||
fieldList.push({type:'string',value:'manufacturer',text:'生产厂商',dictCode:''}) |
||||
fieldList.push({type:'string',value:'supplier',text:'供应商',dictCode:''}) |
||||
fieldList.push({type:'string',value:'contact',text:'联系人',dictCode:''}) |
||||
fieldList.push({type:'string',value:'place',text:'产地',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,129 @@ |
||||
<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="img"> |
||||
<j-image-upload isMultiple v-model="model.img" ></j-image-upload> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="类型品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brand"> |
||||
<a-input v-model="model.brand" placeholder="请输入类型品牌" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="生产厂商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manufacturer"> |
||||
<j-select-depart v-model="model.manufacturer" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="供应商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="supplier"> |
||||
<j-select-depart v-model="model.supplier" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contact"> |
||||
<a-input v-model="model.contact" placeholder="请输入联系人" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="产地" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="place"> |
||||
<a-input v-model="model.place" 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: 'ZyToolBrandForm', |
||||
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: "/toolbrand/zyToolBrand/add", |
||||
edit: "/toolbrand/zyToolBrand/edit", |
||||
queryById: "/toolbrand/zyToolBrand/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="关闭"> |
||||
<zy-tool-brand-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></zy-tool-brand-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ZyToolBrandForm from './ZyToolBrandForm' |
||||
export default { |
||||
name: 'ZyToolBrandModal', |
||||
components: { |
||||
ZyToolBrandForm |
||||
}, |
||||
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"> |
||||
<zy-tool-brand-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></zy-tool-brand-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 ZyToolBrandForm from './ZyToolBrandForm' |
||||
|
||||
export default { |
||||
name: 'ZyToolBrandModal', |
||||
components: { |
||||
ZyToolBrandForm |
||||
}, |
||||
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-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="编号"> |
||||
<a-input placeholder="请输入编号" v-model="queryParam.tooltypeCode"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="型号"> |
||||
<a-input placeholder="请输入名称" v-model="queryParam.model"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-model-item label="型号描述" > |
||||
<a-input v-model="queryParam.description" placeholder="请输入型号描述" ></a-input> |
||||
</a-form-model-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> |
||||
</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}" |
||||
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="imgeSlot" slot-scope="text"> |
||||
<img :src="text" height="" 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 @click="handleDetail(record)">详情</a> |
||||
<a-divider type="vertical" /> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
|
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<zy-tool-model-modal ref="modalForm" @ok="modalFormOk"></zy-tool-model-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ZyToolModelModal from './modules/ZyToolModelModal' |
||||
|
||||
export default { |
||||
name: 'ZyToolModelList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
ZyToolModelModal |
||||
}, |
||||
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: 'brandId_dictText' |
||||
}, |
||||
{ |
||||
title:'类型编号', |
||||
align:"center", |
||||
dataIndex: 'tooltypeCode' |
||||
}, |
||||
{ |
||||
title:'型号图片', |
||||
align:"center", |
||||
dataIndex: 'img', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
}, |
||||
{ |
||||
title:'二维码', |
||||
align:"center", |
||||
dataIndex: 'qrcode', |
||||
scopedSlots: {customRender: 'imgeSlot'} |
||||
}, |
||||
{ |
||||
title:'型号', |
||||
align:"center", |
||||
dataIndex: 'model' |
||||
}, |
||||
{ |
||||
title:'型号参数', |
||||
align:"center", |
||||
dataIndex: 'parameters' |
||||
}, |
||||
{ |
||||
title:'型号描述', |
||||
align:"center", |
||||
dataIndex: 'description' |
||||
}, |
||||
{ |
||||
title:'联系人', |
||||
align:"center", |
||||
dataIndex: 'contact' |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/toolmodel/zyToolModel/list", |
||||
delete: "/toolmodel/zyToolModel/delete", |
||||
deleteBatch: "/toolmodel/zyToolModel/deleteBatch", |
||||
exportXlsUrl: "/toolmodel/zyToolModel/exportXls", |
||||
importExcelUrl: "toolmodel/zyToolModel/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'brandId',text:'品牌id(名称)',dictCode:''}) |
||||
fieldList.push({type:'string',value:'tooltypeCode',text:'类型编号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'img',text:'型号图片',dictCode:''}) |
||||
fieldList.push({type:'string',value:'qrcode',text:'二维码',dictCode:''}) |
||||
fieldList.push({type:'string',value:'model',text:'型号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'parameters',text:'型号参数',dictCode:''}) |
||||
fieldList.push({type:'string',value:'description',text:'型号描述',dictCode:''}) |
||||
fieldList.push({type:'string',value:'contact',text:'联系人',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,172 @@ |
||||
<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="brandId">--> |
||||
<!-- <a-input v-model="model.brandId" placeholder="请输入品牌名称" ></a-input>--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brandId "> |
||||
<j-popup |
||||
v-model="model.brand" |
||||
field="brand" |
||||
org-fields="brand,id" |
||||
dest-fields="brand,brandId" |
||||
code="zy_toolbrand" |
||||
:multi="false" |
||||
@input="popupCallback" |
||||
/> |
||||
</a-form-model-item> |
||||
<a-input v-model="model.brandId" hidden/> |
||||
</a-col> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tooltypeCode">--> |
||||
<!-- <a-input v-model="model.tooltypeCode" placeholder="请输入类型编号" ></a-input>--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tooltypeCode "> |
||||
<j-popup |
||||
v-model="model.code" |
||||
field="code" |
||||
org-fields="code,code" |
||||
dest-fields="code,tooltypeCode" |
||||
code="zy_tooltype" |
||||
:multi="false" |
||||
@input="popupCallback" |
||||
/> |
||||
</a-form-model-item> |
||||
<a-input v-model="model.tooltypeCode" hidden/> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="型号图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img"> |
||||
<j-image-upload v-model="model.img" ></j-image-upload> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="二维码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qrcode">--> |
||||
<!-- <j-image-upload isMultiple v-model="model.qrcode" ></j-image-upload>--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="model"> |
||||
<a-input v-model="model.model" placeholder="请输入型号" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="型号参数" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parameters"> |
||||
<a-input v-model="model.parameters" placeholder="请输入型号参数" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="型号描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="description"> |
||||
<a-input v-model="model.description" placeholder="请输入型号描述" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="联系人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="contact"> |
||||
<a-input v-model="model.contact" 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: 'ZyToolModelForm', |
||||
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: "/toolmodel/zyToolModel/add", |
||||
edit: "/toolmodel/zyToolModel/edit", |
||||
queryById: "/toolmodel/zyToolModel/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.model.brand=this.model.brandId_dictText |
||||
this.model.code=this.model.tooltypeCode |
||||
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; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
popupCallback(value,row){ |
||||
this.model = Object.assign(this.model, row); |
||||
}, |
||||
} |
||||
} |
||||
</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="关闭"> |
||||
<zy-tool-model-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></zy-tool-model-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ZyToolModelForm from './ZyToolModelForm' |
||||
export default { |
||||
name: 'ZyToolModelModal', |
||||
components: { |
||||
ZyToolModelForm |
||||
}, |
||||
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"> |
||||
<zy-tool-model-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></zy-tool-model-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 ZyToolModelForm from './ZyToolModelForm' |
||||
|
||||
export default { |
||||
name: 'ZyToolModelModal', |
||||
components: { |
||||
ZyToolModelForm |
||||
}, |
||||
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,281 @@ |
||||
<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-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="organizer"> |
||||
<a-input v-model="queryParam.name" placeholder="请输入名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="organizer"> |
||||
<a-input v-model="queryParam.code" placeholder="请输入编号" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-model-item label="工具状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> |
||||
<j-dict-select-tag v-model="queryParam.status" dictCode="devicestatus1" |
||||
placeholder="工具状态"></j-dict-select-tag> |
||||
</a-form-model-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> |
||||
</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}" |
||||
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="imgeSlot" slot-scope="text"> |
||||
<img :src="text" height="" 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 @click="handleDetail(record)">详情</a> |
||||
<a-divider type="vertical" /> |
||||
|
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
|
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<zy-tool-modal ref="modalForm" @ok="modalFormOk"></zy-tool-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ZyToolModal from './modules/ZyToolModal' |
||||
|
||||
export default { |
||||
name: 'ZyToolList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
ZyToolModal |
||||
}, |
||||
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: 'typeCode' |
||||
// }, |
||||
{ |
||||
title:'工具品牌', |
||||
align:"center", |
||||
dataIndex: 'brandId_dictText' |
||||
}, |
||||
{ |
||||
title:'工具型号', |
||||
align:"center", |
||||
dataIndex: 'modelId_dictText' |
||||
}, |
||||
{ |
||||
title:'工具编号', |
||||
align:"center", |
||||
dataIndex: 'code' |
||||
}, |
||||
{ |
||||
title:'工具名称', |
||||
align:"center", |
||||
dataIndex: 'name' |
||||
}, |
||||
{ |
||||
title:'购买时间', |
||||
align:"center", |
||||
dataIndex: 'buydate', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
}, |
||||
{ |
||||
title:'经办人', |
||||
align:"center", |
||||
dataIndex: 'agent_dictText' |
||||
}, |
||||
{ |
||||
title:'工具状态', |
||||
align:"center", |
||||
dataIndex: 'status_dictText' |
||||
}, |
||||
{ |
||||
title:'二维码', |
||||
align:"center", |
||||
dataIndex: 'qrcode', |
||||
scopedSlots: {customRender: 'imgeSlot'} |
||||
}, |
||||
{ |
||||
title:'维护周期', |
||||
align:"center", |
||||
dataIndex: 'maintenancecycle', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
}, |
||||
{ |
||||
title:'管理人', |
||||
align:"center", |
||||
dataIndex: 'administrator_dictText' |
||||
}, |
||||
{ |
||||
title:'上次维护时间', |
||||
align:"center", |
||||
dataIndex: 'maintenancedate', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
}, |
||||
{ |
||||
title:'工具图片', |
||||
align:"center", |
||||
dataIndex: 'img', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
}, |
||||
{ |
||||
title:'3d模型', |
||||
align:"center", |
||||
dataIndex: 'img3d', |
||||
scopedSlots: {customRender: 'fileSlot'} |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
|
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/zytool/zyTool/list", |
||||
delete: "/zytool/zyTool/delete", |
||||
deleteBatch: "/zytool/zyTool/deleteBatch", |
||||
exportXlsUrl: "/zytool/zyTool/exportXls", |
||||
importExcelUrl: "zytool/zyTool/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'typeCode',text:'类型编号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'brandId',text:'工具品牌',dictCode:''}) |
||||
fieldList.push({type:'string',value:'modelId',text:'工具型号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'code',text:'工具编号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'name',text:'工具名称',dictCode:''}) |
||||
fieldList.push({type:'date',value:'buydate',text:'购买时间'}) |
||||
fieldList.push({type:'sel_user',value:'agent',text:'经办人'}) |
||||
fieldList.push({type:'string',value:'status',text:'工具状态',dictCode:''}) |
||||
fieldList.push({type:'string',value:'qrcode',text:'二维码',dictCode:''}) |
||||
fieldList.push({type:'date',value:'maintenancecycle',text:'维护周期'}) |
||||
fieldList.push({type:'sel_user',value:'administrator',text:'管理人'}) |
||||
fieldList.push({type:'date',value:'maintenancedate',text:'上次维护时间'}) |
||||
fieldList.push({type:'string',value:'img',text:'工具图片',dictCode:''}) |
||||
fieldList.push({type:'string',value:'img3d',text:'3d模型',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,197 @@ |
||||
<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="manufacturer"> |
||||
<j-select-depart v-model="model.orgCode" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="typeCode">--> |
||||
<!-- <a-input v-model="model.typeCode" placeholder="请输入类型编号" ></a-input>--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="工具品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brandId">--> |
||||
<!-- <a-input v-model="model.brandId" placeholder="请输入工具品牌" ></a-input>--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="工具型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modelId">--> |
||||
<!-- <a-input v-model="model.modelId" placeholder="请输入工具型号" ></a-input>--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
|
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code"v-if="bianhao==1"> |
||||
<a-input v-model="model.code" placeholder="请输入工具编号" disabled></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> |
||||
<a-input v-model="model.name" placeholder="请输入工具名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="购买时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="buydate"> |
||||
<j-date placeholder="请选择购买时间" v-model="model.buydate" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="经办人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="agent"> |
||||
<j-select-user-by-dep v-model="model.agent" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> |
||||
<j-dict-select-tag v-model="model.status" dictCode="devicestatus1" |
||||
placeholder="工具状态"></j-dict-select-tag> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<!-- <a-col :span="24">--> |
||||
<!-- <a-form-model-item label="二维码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qrcode">--> |
||||
<!-- <j-image-upload isMultiple v-model="model.qrcode" ></j-image-upload>--> |
||||
<!-- </a-form-model-item>--> |
||||
<!-- </a-col>--> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="维护周期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancecycle"> |
||||
<a-input v-model="model.maintenancecycle" placeholder="请输入维护周期" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="管理人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="administrator"> |
||||
<j-select-user-by-dep v-model="model.administrator" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="上次维护时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancedate"> |
||||
<j-date placeholder="请选择上次维护时间" v-model="model.maintenancedate" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img"> |
||||
<j-image-upload isMultiple v-model="model.img" ></j-image-upload> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="3d模型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img3d"> |
||||
<!-- <j-upload v-model="model.img3d" ></j-upload>--> |
||||
<a-input v-model="model.img3d" placeholder="请输入模型地址" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tooltypeCode "> |
||||
<j-popup |
||||
v-model="model.code1" |
||||
field="code1" |
||||
org-fields="model,id" |
||||
dest-fields="code1,modelId" |
||||
code="zy_toolmodel" |
||||
:multi="false" |
||||
@input="popupCallback" |
||||
/> |
||||
</a-form-model-item> |
||||
<a-input v-model="model.modelId" hidden/> |
||||
</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: 'ZyToolForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用 |
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
bianhao:'', |
||||
model:{ |
||||
status:1, |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
}, |
||||
url: { |
||||
add: "/zytool/zyTool/add", |
||||
edit: "/zytool/zyTool/edit", |
||||
queryById: "/zytool/zyTool/queryById" |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
//备份model原始值 |
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.model = Object.assign({}, this.modelDefault); |
||||
}, |
||||
edit (record) { |
||||
this.model = Object.assign({}, record); |
||||
this.bianhao=1; |
||||
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; |
||||
}) |
||||
} |
||||
|
||||
}) |
||||
}, |
||||
popupCallback(value,row){ |
||||
this.model = Object.assign(this.model, row); |
||||
}, |
||||
} |
||||
} |
||||
</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="关闭"> |
||||
<zy-tool-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></zy-tool-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ZyToolForm from './ZyToolForm' |
||||
export default { |
||||
name: 'ZyToolModal', |
||||
components: { |
||||
ZyToolForm |
||||
}, |
||||
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"> |
||||
<zy-tool-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></zy-tool-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 ZyToolForm from './ZyToolForm' |
||||
|
||||
export default { |
||||
name: 'ZyToolModal', |
||||
components: { |
||||
ZyToolForm |
||||
}, |
||||
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,208 @@ |
||||
<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-tree-select v-model="queryParam.selfId" |
||||
dict="zy_tool_type,name,id" |
||||
pidField="self_id" |
||||
placeholder="请选择上级类型" > |
||||
</j-tree-select> |
||||
{{ selfId }} |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="名称"> |
||||
<a-input placeholder="请输入名称" v-model="queryParam.name"></a-input> |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :xl="6" :lg="7" :md="8" :sm="24"> |
||||
<a-form-item label="编号"> |
||||
<a-input placeholder="请输入编号" v-model="queryParam.code"></a-input> |
||||
</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> |
||||
</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}" |
||||
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 @click="handleDetail(record)">详情</a> |
||||
<a-divider type="vertical" /> |
||||
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> |
||||
<a>删除</a> |
||||
</a-popconfirm> |
||||
</span> |
||||
|
||||
</a-table> |
||||
</div> |
||||
|
||||
<zy-tool-type-modal ref="modalForm" @ok="modalFormOk"></zy-tool-type-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ZyToolTypeModal from './modules/ZyToolTypeModal' |
||||
|
||||
export default { |
||||
name: 'ZyToolTypeList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
ZyToolTypeModal |
||||
}, |
||||
data () { |
||||
return { |
||||
description: '工具类型管理页面', |
||||
selfId:'', |
||||
// 表头 |
||||
columns: [ |
||||
{ |
||||
title: '#', |
||||
dataIndex: '', |
||||
key:'rowIndex', |
||||
width:60, |
||||
align:"center", |
||||
customRender:function (t,r,index) { |
||||
return parseInt(index)+1; |
||||
} |
||||
}, |
||||
{ |
||||
title:'上级类型', |
||||
align:"center", |
||||
dataIndex: 'selfId_dictText' |
||||
}, |
||||
{ |
||||
title:'类型编号', |
||||
align:"center", |
||||
dataIndex: 'code' |
||||
}, |
||||
{ |
||||
title:'类型名称', |
||||
align:"center", |
||||
dataIndex: 'name' |
||||
}, |
||||
{ |
||||
title:'类型图片', |
||||
align:"center", |
||||
dataIndex: 'img', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/tooltype/zyToolType/list", |
||||
delete: "/tooltype/zyToolType/delete", |
||||
deleteBatch: "/tooltype/zyToolType/deleteBatch", |
||||
exportXlsUrl: "/tooltype/zyToolType/exportXls", |
||||
importExcelUrl: "tooltype/zyToolType/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'selfId',text:'关联自己id',dictCode:''}) |
||||
fieldList.push({type:'string',value:'code',text:'类型编号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'name',text:'类型名称',dictCode:''}) |
||||
fieldList.push({type:'string',value:'img',text:'类型图片',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,139 @@ |
||||
<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-item label="上级类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="selfId"> |
||||
<j-tree-select v-model="model.selfId" |
||||
dict="zy_tool_type,name,id" |
||||
pidField="self_id" |
||||
placeholder="请选择上级类型" > |
||||
</j-tree-select> |
||||
{{ selfId }} |
||||
</a-form-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="类型编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code"> |
||||
<a-input v-model="model.code" placeholder="请输入类型编号" disabled></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> |
||||
<a-input v-model="model.name" placeholder="请输入类型名称" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="类型图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img"> |
||||
<j-image-upload isMultiple v-model="model.img" ></j-image-upload> |
||||
</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: 'ZyToolTypeForm', |
||||
components: { |
||||
}, |
||||
props: { |
||||
//表单禁用 |
||||
disabled: { |
||||
type: Boolean, |
||||
default: false, |
||||
required: false |
||||
} |
||||
}, |
||||
data () { |
||||
return { |
||||
model:{ |
||||
code:'' |
||||
}, |
||||
labelCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 5 }, |
||||
}, |
||||
wrapperCol: { |
||||
xs: { span: 24 }, |
||||
sm: { span: 16 }, |
||||
}, |
||||
selfId:'', |
||||
confirmLoading: false, |
||||
validatorRules: { |
||||
}, |
||||
url: { |
||||
add: "/tooltype/zyToolType/add", |
||||
edit: "/tooltype/zyToolType/edit", |
||||
queryById: "/tooltype/zyToolType/queryById", |
||||
sort:"/tooltype/zyToolType/sort" |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
formDisabled(){ |
||||
return this.disabled |
||||
}, |
||||
}, |
||||
created () { |
||||
|
||||
//备份model原始值 |
||||
this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
||||
}, |
||||
methods: { |
||||
add () { |
||||
var n=5 |
||||
getAction(this.url.sort,null).then((res)=>{ |
||||
var num=parseInt(res.result,10)+1 |
||||
num=num.toString() |
||||
while(num.length<n){ |
||||
num="0"+num |
||||
} |
||||
this.model.code="D"+num; |
||||
console.log(num) |
||||
}) |
||||
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="关闭"> |
||||
<zy-tool-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></zy-tool-type-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ZyToolTypeForm from './ZyToolTypeForm' |
||||
export default { |
||||
name: 'ZyToolTypeModal', |
||||
components: { |
||||
ZyToolTypeForm |
||||
}, |
||||
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"> |
||||
<zy-tool-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></zy-tool-type-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 ZyToolTypeForm from './ZyToolTypeForm' |
||||
|
||||
export default { |
||||
name: 'ZyToolTypeModal', |
||||
components: { |
||||
ZyToolTypeForm |
||||
}, |
||||
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> |
@ -1,172 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.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.tool.entity.ZyTool; |
||||
import org.jeecg.modules.demo.tool.service.IZyToolService; |
||||
|
||||
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: zy_tool |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="zy_tool") |
||||
@RestController |
||||
@RequestMapping("/tool/zyTool") |
||||
@Slf4j |
||||
public class ZyToolController extends JeecgController<ZyTool, IZyToolService> { |
||||
@Autowired |
||||
private IZyToolService zyToolService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param zyTool |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool-分页列表查询") |
||||
@ApiOperation(value="zy_tool-分页列表查询", notes="zy_tool-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(ZyTool zyTool, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<ZyTool> queryWrapper = QueryGenerator.initQueryWrapper(zyTool, req.getParameterMap()); |
||||
// QueryWrapper queryWrapper = new QueryWrapper();
|
||||
Page<ZyTool> page = new Page<ZyTool>(pageNo, pageSize); |
||||
IPage<ZyTool> pageList = zyToolService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param zyTool |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool-添加") |
||||
@ApiOperation(value="zy_tool-添加", notes="zy_tool-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ZyTool zyTool) { |
||||
zyToolService.save(zyTool); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param zyTool |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool-编辑") |
||||
@ApiOperation(value="zy_tool-编辑", notes="zy_tool-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ZyTool zyTool) { |
||||
zyToolService.updateById(zyTool); |
||||
return Result.OK("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool-通过id删除") |
||||
@ApiOperation(value="zy_tool-通过id删除", notes="zy_tool-通过id删除") |
||||
@DeleteMapping(value = "/delete") |
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
||||
zyToolService.removeById(id); |
||||
return Result.OK("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool-批量删除") |
||||
@ApiOperation(value="zy_tool-批量删除", notes="zy_tool-批量删除") |
||||
@DeleteMapping(value = "/deleteBatch") |
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
||||
this.zyToolService.removeByIds(Arrays.asList(ids.split(","))); |
||||
return Result.OK("批量删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool-通过id查询") |
||||
@ApiOperation(value="zy_tool-通过id查询", notes="zy_tool-通过id查询") |
||||
@GetMapping(value = "/queryById") |
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
||||
ZyTool zyTool = zyToolService.getById(id); |
||||
if(zyTool==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(zyTool); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param zyTool |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ZyTool zyTool) { |
||||
return super.exportXls(request, zyTool, ZyTool.class, "zy_tool"); |
||||
} |
||||
|
||||
/** |
||||
* 通过excel导入数据 |
||||
* |
||||
* @param request |
||||
* @param response |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
||||
return super.importExcel(request, response, ZyTool.class); |
||||
} |
||||
|
||||
} |
@ -1,172 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.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.tool.entity.ZyToolStatic; |
||||
import org.jeecg.modules.demo.tool.service.IZyToolStaticService; |
||||
|
||||
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: zy_tool_static |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="zy_tool_static") |
||||
@RestController |
||||
@RequestMapping("/tool/zyToolStatic") |
||||
@Slf4j |
||||
public class ZyToolStaticController extends JeecgController<ZyToolStatic, IZyToolStaticService> { |
||||
@Autowired |
||||
private IZyToolStaticService zyToolStaticService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param zyToolStatic |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool_static-分页列表查询") |
||||
@ApiOperation(value="zy_tool_static-分页列表查询", notes="zy_tool_static-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(ZyToolStatic zyToolStatic, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
//QueryWrapper<ZyToolStatic> queryWrapper = QueryGenerator.initQueryWrapper(zyToolStatic, req.getParameterMap());
|
||||
QueryWrapper queryWrapper = new QueryWrapper(); |
||||
Page<ZyToolStatic> page = new Page<ZyToolStatic>(pageNo, pageSize); |
||||
IPage<ZyToolStatic> pageList = zyToolStaticService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param zyToolStatic |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool_static-添加") |
||||
@ApiOperation(value="zy_tool_static-添加", notes="zy_tool_static-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ZyToolStatic zyToolStatic) { |
||||
zyToolStaticService.save(zyToolStatic); |
||||
return Result.OK("添加成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param zyToolStatic |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool_static-编辑") |
||||
@ApiOperation(value="zy_tool_static-编辑", notes="zy_tool_static-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ZyToolStatic zyToolStatic) { |
||||
zyToolStaticService.updateById(zyToolStatic); |
||||
return Result.OK("编辑成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id删除 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool_static-通过id删除") |
||||
@ApiOperation(value="zy_tool_static-通过id删除", notes="zy_tool_static-通过id删除") |
||||
@DeleteMapping(value = "/delete") |
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
||||
zyToolStaticService.removeById(id); |
||||
return Result.OK("删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除 |
||||
* |
||||
* @param ids |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool_static-批量删除") |
||||
@ApiOperation(value="zy_tool_static-批量删除", notes="zy_tool_static-批量删除") |
||||
@DeleteMapping(value = "/deleteBatch") |
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
||||
this.zyToolStaticService.removeByIds(Arrays.asList(ids.split(","))); |
||||
return Result.OK("批量删除成功!"); |
||||
} |
||||
|
||||
/** |
||||
* 通过id查询 |
||||
* |
||||
* @param id |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "zy_tool_static-通过id查询") |
||||
@ApiOperation(value="zy_tool_static-通过id查询", notes="zy_tool_static-通过id查询") |
||||
@GetMapping(value = "/queryById") |
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
||||
ZyToolStatic zyToolStatic = zyToolStaticService.getById(id); |
||||
if(zyToolStatic==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(zyToolStatic); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param zyToolStatic |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ZyToolStatic zyToolStatic) { |
||||
return super.exportXls(request, zyToolStatic, ZyToolStatic.class, "zy_tool_static"); |
||||
} |
||||
|
||||
/** |
||||
* 通过excel导入数据 |
||||
* |
||||
* @param request |
||||
* @param response |
||||
* @return |
||||
*/ |
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
||||
return super.importExcel(request, response, ZyToolStatic.class); |
||||
} |
||||
|
||||
} |
@ -1,70 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.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: zy_tool |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("zy_tool") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="zy_tool对象", description="zy_tool") |
||||
public class ZyTool implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**工具表id*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "工具表id") |
||||
private java.lang.String id; |
||||
/**工具名称*/ |
||||
@Excel(name = "工具名称", width = 15) |
||||
@ApiModelProperty(value = "工具名称") |
||||
private java.lang.String name; |
||||
/**工具编号*/ |
||||
@Excel(name = "工具编号", width = 15) |
||||
@ApiModelProperty(value = "工具编号") |
||||
private java.lang.String nums; |
||||
/**功能*/ |
||||
@Excel(name = "功能", width = 15) |
||||
@ApiModelProperty(value = "功能") |
||||
private java.lang.String function; |
||||
/**规格*/ |
||||
@Excel(name = "规格", width = 15) |
||||
@ApiModelProperty(value = "规格") |
||||
private java.lang.String specs; |
||||
/**适用范围*/ |
||||
@Excel(name = "适用范围", width = 15) |
||||
@ApiModelProperty(value = "适用范围") |
||||
private java.lang.String scope; |
||||
/**责人工段*/ |
||||
@Excel(name = "责人工段", width = 15) |
||||
@ApiModelProperty(value = "责人工段") |
||||
private java.lang.String workshopSection; |
||||
/**状态 ( 0 在库、1 在用、2 遗失 、3 损坏、4 报废)*/ |
||||
@Excel(name = "状态 ( 0 在库、1 在用、2 遗失 、3 损坏、4 报废)", width = 15) |
||||
@ApiModelProperty(value = "状态 ( 0 在库、1 在用、2 遗失 、3 损坏、4 报废)") |
||||
private java.lang.String status; |
||||
/**二维码*/ |
||||
@Excel(name = "二维码", width = 15) |
||||
@ApiModelProperty(value = "二维码") |
||||
private java.lang.String qrode; |
||||
} |
@ -1,50 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.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: zy_tool_static |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("zy_tool_static") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="zy_tool_static对象", description="zy_tool_static") |
||||
public class ZyToolStatic implements Serializable { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/**工具统计表*/ |
||||
@TableId(type = IdType.ASSIGN_ID) |
||||
@ApiModelProperty(value = "工具统计表") |
||||
private java.lang.String id; |
||||
/**工具id*/ |
||||
@Excel(name = "工具id", width = 15) |
||||
@ApiModelProperty(value = "工具id") |
||||
private java.lang.String toolId; |
||||
/**使用时间*/ |
||||
@Excel(name = "使用时间", width = 15) |
||||
@ApiModelProperty(value = "使用时间") |
||||
private java.lang.String userTime; |
||||
/**使用人*/ |
||||
@Excel(name = "使用人", width = 15) |
||||
@ApiModelProperty(value = "使用人") |
||||
private java.lang.String userPerson; |
||||
} |
@ -1,17 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.demo.tool.entity.ZyTool; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: zy_tool |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ZyToolMapper extends BaseMapper<ZyTool> { |
||||
|
||||
} |
@ -1,17 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.jeecg.modules.demo.tool.entity.ZyToolStatic; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* @Description: zy_tool_static |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ZyToolStaticMapper extends BaseMapper<ZyToolStatic> { |
||||
|
||||
} |
@ -1,14 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.service; |
||||
|
||||
import org.jeecg.modules.demo.tool.entity.ZyTool; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: zy_tool |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IZyToolService extends IService<ZyTool> { |
||||
|
||||
} |
@ -1,14 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.service; |
||||
|
||||
import org.jeecg.modules.demo.tool.entity.ZyToolStatic; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* @Description: zy_tool_static |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IZyToolStaticService extends IService<ZyToolStatic> { |
||||
|
||||
} |
@ -1,19 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.service.impl; |
||||
|
||||
import org.jeecg.modules.demo.tool.entity.ZyTool; |
||||
import org.jeecg.modules.demo.tool.mapper.ZyToolMapper; |
||||
import org.jeecg.modules.demo.tool.service.IZyToolService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: zy_tool |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ZyToolServiceImpl extends ServiceImpl<ZyToolMapper, ZyTool> implements IZyToolService { |
||||
|
||||
} |
@ -1,19 +0,0 @@ |
||||
package org.jeecg.modules.demo.tool.service.impl; |
||||
|
||||
import org.jeecg.modules.demo.tool.entity.ZyToolStatic; |
||||
import org.jeecg.modules.demo.tool.mapper.ZyToolStaticMapper; |
||||
import org.jeecg.modules.demo.tool.service.IZyToolStaticService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: zy_tool_static |
||||
* @Author: jeecg-boot |
||||
* @Date: 2021-11-04 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ZyToolStaticServiceImpl extends ServiceImpl<ZyToolStaticMapper, ZyToolStatic> implements IZyToolStaticService { |
||||
|
||||
} |
@ -0,0 +1,187 @@ |
||||
package org.jeecg.modules.zytool.toolbrand.controller; |
||||
|
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.URLDecoder; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecg.modules.zytool.toolbrand.entity.ZyToolBrand; |
||||
import org.jeecg.modules.zytool.toolbrand.service.IZyToolBrandService; |
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 工具品牌表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="工具品牌表") |
||||
@RestController |
||||
@RequestMapping("/toolbrand/zyToolBrand") |
||||
@Slf4j |
||||
public class ZyToolBrandController extends JeecgController<ZyToolBrand, IZyToolBrandService> { |
||||
@Autowired |
||||
private IZyToolBrandService zyToolBrandService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param zyToolBrand |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具品牌表-分页列表查询") |
||||
@ApiOperation(value="工具品牌表-分页列表查询", notes="工具品牌表-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(ZyToolBrand zyToolBrand, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<ZyToolBrand> queryWrapper = QueryGenerator.initQueryWrapper(zyToolBrand, req.getParameterMap()); |
||||
Page<ZyToolBrand> page = new Page<ZyToolBrand>(pageNo, pageSize); |
||||
IPage<ZyToolBrand> pageList = zyToolBrandService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param zyToolBrand |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具品牌表-添加") |
||||
@ApiOperation(value="工具品牌表-添加", notes="工具品牌表-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ZyToolBrand zyToolBrand) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("brand",zyToolBrand.getBrand()); |
||||
int a= zyToolBrandService.count(queryWrapper); |
||||
if(a==0){ |
||||
zyToolBrandService.save(zyToolBrand); |
||||
return Result.OK("添加成功!");} |
||||
else { |
||||
return Result.error("添加失败,品牌已存在!!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param zyToolBrand |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具品牌表-编辑") |
||||
@ApiOperation(value="工具品牌表-编辑", notes="工具品牌表-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ZyToolBrand zyToolBrand) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("brand",zyToolBrand.getBrand()); |
||||
int a= zyToolBrandService.count(queryWrapper); |
||||
if(a<2){ |
||||
zyToolBrandService.updateById(zyToolBrand); |
||||
return Result.OK("编辑成功!");} |
||||
else { |
||||
return Result.error("编辑失败,品牌名称已存在!!!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通过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) { |
||||
zyToolBrandService.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.zyToolBrandService.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) { |
||||
ZyToolBrand zyToolBrand = zyToolBrandService.getById(id); |
||||
if(zyToolBrand==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(zyToolBrand); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param zyToolBrand |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ZyToolBrand zyToolBrand) { |
||||
return super.exportXls(request, zyToolBrand, ZyToolBrand.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, ZyToolBrand.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,82 @@ |
||||
package org.jeecg.modules.zytool.toolbrand.entity; |
||||
|
||||
|
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 工具品牌表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("zy_tool_brand") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="zy_tool_brand对象", description="工具品牌表") |
||||
public class ZyToolBrand 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; |
||||
/**类型图片*/ |
||||
@Excel(name = "类型图片", width = 15) |
||||
@ApiModelProperty(value = "类型图片") |
||||
private String img; |
||||
/**类型品牌*/ |
||||
@Excel(name = "类型品牌", width = 15) |
||||
@ApiModelProperty(value = "类型品牌") |
||||
private String brand; |
||||
/**生产厂商*/ |
||||
@Excel(name = "生产厂商", width = 15) |
||||
@ApiModelProperty(value = "生产厂商") |
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") |
||||
private String manufacturer; |
||||
/**供应商*/ |
||||
@Excel(name = "供应商", width = 15) |
||||
@ApiModelProperty(value = "供应商") |
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") |
||||
private String supplier; |
||||
/**联系人*/ |
||||
@Excel(name = "联系人", width = 15) |
||||
@ApiModelProperty(value = "联系人") |
||||
private String contact; |
||||
/**产地*/ |
||||
@Excel(name = "产地", width = 15) |
||||
@ApiModelProperty(value = "产地") |
||||
private String place; |
||||
} |
@ -0,0 +1,20 @@ |
||||
package org.jeecg.modules.zytool.toolbrand.mapper; |
||||
|
||||
|
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.jeecg.modules.zytool.toolbrand.entity.ZyToolBrand; |
||||
|
||||
/** |
||||
* @Description: 工具品牌表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ZyToolBrandMapper extends BaseMapper<ZyToolBrand> { |
||||
|
||||
} |
@ -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.zytool.toolbrand.mapper.ZyToolBrandMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,15 @@ |
||||
package org.jeecg.modules.zytool.toolbrand.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.jeecg.modules.zytool.toolbrand.entity.ZyToolBrand; |
||||
|
||||
/** |
||||
* @Description: 工具品牌表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IZyToolBrandService extends IService<ZyToolBrand> { |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package org.jeecg.modules.zytool.toolbrand.service.impl; |
||||
|
||||
|
||||
import org.jeecg.modules.zytool.toolbrand.entity.ZyToolBrand; |
||||
import org.jeecg.modules.zytool.toolbrand.mapper.ZyToolBrandMapper; |
||||
import org.jeecg.modules.zytool.toolbrand.service.IZyToolBrandService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 工具品牌表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ZyToolBrandServiceImpl extends ServiceImpl<ZyToolBrandMapper, ZyToolBrand> implements IZyToolBrandService { |
||||
|
||||
} |
@ -0,0 +1,223 @@ |
||||
package org.jeecg.modules.zytool.toolmodel.controller; |
||||
|
||||
|
||||
import java.io.ByteArrayOutputStream; |
||||
import java.util.*; |
||||
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 com.google.zxing.BarcodeFormat; |
||||
import com.google.zxing.EncodeHintType; |
||||
import com.google.zxing.MultiFormatWriter; |
||||
import com.google.zxing.WriterException; |
||||
import com.google.zxing.client.j2se.MatrixToImageWriter; |
||||
import com.google.zxing.common.BitMatrix; |
||||
import com.google.zxing.qrcode.QRCodeWriter; |
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
import org.jeecg.modules.zytool.toolmodel.service.IZyToolModelService; |
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 工具型号表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="工具型号表") |
||||
@RestController |
||||
@RequestMapping("/toolmodel/zyToolModel") |
||||
@Slf4j |
||||
public class ZyToolModelController extends JeecgController<ZyToolModel, IZyToolModelService> { |
||||
@Autowired |
||||
private IZyToolModelService zyToolModelService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param zyToolModel |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具型号表-分页列表查询") |
||||
@ApiOperation(value="工具型号表-分页列表查询", notes="工具型号表-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(ZyToolModel zyToolModel, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) throws WriterException, IOException { |
||||
QueryWrapper<ZyToolModel> queryWrapper = QueryGenerator.initQueryWrapper(zyToolModel, req.getParameterMap()); |
||||
Page<ZyToolModel> page = new Page<ZyToolModel>(pageNo, pageSize); |
||||
IPage<ZyToolModel> pageList = zyToolModelService.page(page, queryWrapper); |
||||
MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); |
||||
@SuppressWarnings("rawtypes") |
||||
Map hints = new HashMap(); |
||||
//设置UTF-8, 防止中文乱码
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
||||
//设置二维码四周白色区域的大小
|
||||
hints.put(EncodeHintType.MARGIN, 1); |
||||
//设置二维码的容错性
|
||||
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
||||
//width:图片完整的宽;height:图片完整的高
|
||||
//因为要在二维码下方附上文字,所以把图片设置为长方形(高大于宽)
|
||||
int width = 150; |
||||
int height = 150; |
||||
//画二维码,记得调用multiFormatWriter.encode()时最后要带上hints参数,不然上面设置无效
|
||||
QRCodeWriter qrCodeWriter = new QRCodeWriter(); |
||||
List<Object> img= new ArrayList<>(); |
||||
String content=""; |
||||
//批量生成二维码
|
||||
for (int i=0;i<pageList.getRecords().size();i++){ |
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
||||
content = pageList.getRecords().get(i).getTooltypeCode(); |
||||
BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints); |
||||
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", outputStream); |
||||
Base64.Encoder encoder = Base64.getEncoder(); |
||||
String text = encoder.encodeToString(outputStream.toByteArray()); |
||||
pageList.getRecords().get(i).setQrcode("data:image/png;base64,"+text); |
||||
} |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param zyToolModel |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具型号表-添加") |
||||
@ApiOperation(value="工具型号表-添加", notes="工具型号表-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ZyToolModel zyToolModel) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("model",zyToolModel.getModel()); |
||||
int a=zyToolModelService.count(queryWrapper); |
||||
if(a==0){ |
||||
zyToolModelService.save(zyToolModel); |
||||
return Result.OK("添加成功!"); |
||||
}else{ |
||||
return Result.error("添加失败,型号重复!!!"); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param zyToolModel |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具型号表-编辑") |
||||
@ApiOperation(value="工具型号表-编辑", notes="工具型号表-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ZyToolModel zyToolModel) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("model",zyToolModel.getModel()); |
||||
int a=zyToolModelService.count(queryWrapper); |
||||
if(a<2){ |
||||
zyToolModelService.updateById(zyToolModel); |
||||
return Result.OK("编辑成功!");} |
||||
else{ |
||||
return Result.error("编辑失败,型号重复!!!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通过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) { |
||||
zyToolModelService.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.zyToolModelService.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) { |
||||
ZyToolModel zyToolModel = zyToolModelService.getById(id); |
||||
if(zyToolModel==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(zyToolModel); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param zyToolModel |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ZyToolModel zyToolModel) { |
||||
return super.exportXls(request, zyToolModel, ZyToolModel.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, ZyToolModel.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,90 @@ |
||||
package org.jeecg.modules.zytool.toolmodel.entity; |
||||
|
||||
|
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 工具型号表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("zy_tool_model") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="zy_tool_model对象", description="工具型号表") |
||||
public class ZyToolModel 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; |
||||
/**品牌id(名称)*/ |
||||
@Excel(name = "品牌id(名称)", width = 15) |
||||
@ApiModelProperty(value = "品牌id(名称)") |
||||
@Dict(dictTable = "zy_tool_brand" ,dicCode = "id",dicText = "brand") |
||||
private String brandId; |
||||
/**类型编号*/ |
||||
@Excel(name = "类型编号", width = 15) |
||||
@ApiModelProperty(value = "类型编号") |
||||
// @Dict(dictTable = "zy_tool_type" ,dicCode = "id",dicText = "code")
|
||||
private String tooltypeCode; |
||||
/**型号图片*/ |
||||
@Excel(name = "型号图片", width = 15) |
||||
@ApiModelProperty(value = "型号图片") |
||||
private String img; |
||||
/**二维码*/ |
||||
@Excel(name = "二维码", width = 15) |
||||
@ApiModelProperty(value = "二维码") |
||||
private String qrcode; |
||||
/**型号*/ |
||||
@Excel(name = "型号", width = 15) |
||||
@ApiModelProperty(value = "型号") |
||||
private String model; |
||||
/**型号参数*/ |
||||
@Excel(name = "型号参数", width = 15) |
||||
@ApiModelProperty(value = "型号参数") |
||||
private String parameters; |
||||
/**型号描述*/ |
||||
@Excel(name = "型号描述", width = 15) |
||||
@ApiModelProperty(value = "型号描述") |
||||
private String description; |
||||
/**联系人*/ |
||||
@Excel(name = "联系人", width = 15) |
||||
@ApiModelProperty(value = "联系人") |
||||
private String contact; |
||||
} |
@ -0,0 +1,14 @@ |
||||
package org.jeecg.modules.zytool.toolmodel.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
|
||||
/** |
||||
* @Description: 工具型号表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ZyToolModelMapper extends BaseMapper<ZyToolModel> { |
||||
|
||||
} |
@ -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.zytool.toolmodel.mapper.ZyToolModelMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,15 @@ |
||||
package org.jeecg.modules.zytool.toolmodel.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
|
||||
/** |
||||
* @Description: 工具型号表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IZyToolModelService extends IService<ZyToolModel> { |
||||
|
||||
} |
@ -0,0 +1,20 @@ |
||||
package org.jeecg.modules.zytool.toolmodel.service.impl; |
||||
|
||||
|
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
import org.jeecg.modules.zytool.toolmodel.mapper.ZyToolModelMapper; |
||||
import org.jeecg.modules.zytool.toolmodel.service.IZyToolModelService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 工具型号表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ZyToolModelServiceImpl extends ServiceImpl<ZyToolModelMapper, ZyToolModel> implements IZyToolModelService { |
||||
|
||||
} |
@ -0,0 +1,200 @@ |
||||
package org.jeecg.modules.zytool.tooltype.controller; |
||||
|
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.stream.Collectors; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.net.URLDecoder; |
||||
import javax.servlet.http.HttpServletRequest; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecg.modules.zytool.tooltype.entity.ZyToolType; |
||||
import org.jeecg.modules.zytool.tooltype.service.IZyToolTypeService; |
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 工具类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="工具类型") |
||||
@RestController |
||||
@RequestMapping("/tooltype/zyToolType") |
||||
@Slf4j |
||||
public class ZyToolTypeController extends JeecgController<ZyToolType, IZyToolTypeService> { |
||||
@Autowired |
||||
private IZyToolTypeService zyToolTypeService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param zyToolType |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具类型-分页列表查询") |
||||
@ApiOperation(value="工具类型-分页列表查询", notes="工具类型-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(ZyToolType zyToolType, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) { |
||||
QueryWrapper<ZyToolType> queryWrapper = QueryGenerator.initQueryWrapper(zyToolType, req.getParameterMap()); |
||||
queryWrapper.orderByDesc("code"); |
||||
Page<ZyToolType> page = new Page<ZyToolType>(pageNo, pageSize); |
||||
IPage<ZyToolType> pageList = zyToolTypeService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param zyToolType |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具类型-添加") |
||||
@ApiOperation(value="工具类型-添加", notes="工具类型-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ZyToolType zyToolType) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("name",zyToolType.getName()); |
||||
int a= zyToolTypeService.count(queryWrapper); |
||||
if(a==0){ |
||||
zyToolTypeService.save(zyToolType); |
||||
return Result.OK("添加成功!"); |
||||
}else{ |
||||
return Result.error("添加失败,名称重复!!"); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param zyToolType |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具类型-编辑") |
||||
@ApiOperation(value="工具类型-编辑", notes="工具类型-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ZyToolType zyToolType) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("name",zyToolType.getName()); |
||||
int a= zyToolTypeService.count(queryWrapper); |
||||
if(a<2){ |
||||
zyToolTypeService.updateById(zyToolType); |
||||
return Result.OK("编辑成功!");} |
||||
else { |
||||
return Result.error("编辑失败,名称重复!!!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通过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) { |
||||
zyToolTypeService.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.zyToolTypeService.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) { |
||||
ZyToolType zyToolType = zyToolTypeService.getById(id); |
||||
if(zyToolType==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(zyToolType); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param zyToolType |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ZyToolType zyToolType) { |
||||
return super.exportXls(request, zyToolType, ZyToolType.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, ZyToolType.class); |
||||
} |
||||
@AutoLog(value = "排序") |
||||
@ApiOperation(value="工具类型-排序", notes="工具类型-排序") |
||||
@GetMapping(value = "/sort") |
||||
public Result<?> sort() { |
||||
String code=zyToolTypeService.findCode(); |
||||
if(code==null||code.equals("")){ |
||||
return Result.OK("0"); |
||||
}else{ |
||||
return Result.OK(code.substring(1)); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,73 @@ |
||||
package org.jeecg.modules.zytool.tooltype.entity; |
||||
|
||||
|
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 工具类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("zy_tool_type") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="zy_tool_type对象", description="工具类型") |
||||
public class ZyToolType 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; |
||||
/**关联自己id*/ |
||||
@Excel(name = "关联自己id", width = 15) |
||||
@ApiModelProperty(value = "关联自己id") |
||||
@Dict(dictTable = "zy_tool_type",dicCode = "id",dicText = "name") |
||||
private String selfId; |
||||
/**类型编号*/ |
||||
@Excel(name = "类型编号", width = 15) |
||||
@ApiModelProperty(value = "类型编号") |
||||
private String code; |
||||
/**类型名称*/ |
||||
@Excel(name = "类型名称", width = 15) |
||||
@ApiModelProperty(value = "类型名称") |
||||
private String name; |
||||
/**类型图片*/ |
||||
@Excel(name = "类型图片", width = 15) |
||||
@ApiModelProperty(value = "类型图片") |
||||
private String img; |
||||
} |
@ -0,0 +1,21 @@ |
||||
package org.jeecg.modules.zytool.tooltype.mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.jeecg.modules.zytool.tooltype.entity.ZyToolType; |
||||
|
||||
/** |
||||
* @Description: 工具类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ZyToolTypeMapper extends BaseMapper<ZyToolType> { |
||||
|
||||
@Select("select code from zy_tool_type order by code desc limit 0,1") |
||||
String findCode(); |
||||
} |
@ -1,5 +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.tool.mapper.ZyToolStaticMapper"> |
||||
<mapper namespace="org.jeecg.modules.zytool.tooltype.mapper.ZyToolTypeMapper"> |
||||
|
||||
</mapper> |
||||
</mapper> |
@ -0,0 +1,16 @@ |
||||
package org.jeecg.modules.zytool.tooltype.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.jeecg.modules.zytool.tooltype.entity.ZyToolType; |
||||
|
||||
/** |
||||
* @Description: 工具类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IZyToolTypeService extends IService<ZyToolType> { |
||||
|
||||
String findCode(); |
||||
} |
@ -0,0 +1,27 @@ |
||||
package org.jeecg.modules.zytool.tooltype.service.impl; |
||||
|
||||
|
||||
import org.jeecg.modules.zytool.tooltype.entity.ZyToolType; |
||||
import org.jeecg.modules.zytool.tooltype.mapper.ZyToolTypeMapper; |
||||
import org.jeecg.modules.zytool.tooltype.service.IZyToolTypeService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 工具类型 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ZyToolTypeServiceImpl extends ServiceImpl<ZyToolTypeMapper, ZyToolType> implements IZyToolTypeService { |
||||
|
||||
@Autowired |
||||
ZyToolTypeMapper zyToolTypeMapper; |
||||
@Override |
||||
public String findCode() { |
||||
return zyToolTypeMapper.findCode(); |
||||
} |
||||
} |
@ -0,0 +1,253 @@ |
||||
package org.jeecg.modules.zytool.zytool.controller; |
||||
|
||||
import java.io.ByteArrayOutputStream; |
||||
import java.util.*; |
||||
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 com.google.zxing.BarcodeFormat; |
||||
import com.google.zxing.EncodeHintType; |
||||
import com.google.zxing.MultiFormatWriter; |
||||
import com.google.zxing.WriterException; |
||||
import com.google.zxing.client.j2se.MatrixToImageWriter; |
||||
import com.google.zxing.common.BitMatrix; |
||||
import com.google.zxing.qrcode.QRCodeWriter; |
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; |
||||
import org.jeecg.common.api.vo.Result; |
||||
import org.jeecg.common.system.query.QueryGenerator; |
||||
import org.jeecg.common.util.oConvertUtils; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
|
||||
import org.jeecg.modules.device.entity.ZyDevice; |
||||
import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; |
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
|
||||
import org.jeecg.modules.zytool.zytool.entity.ZyTool; |
||||
import org.jeecg.modules.zytool.zytool.service.IZyToolService; |
||||
import org.jeecgframework.poi.excel.ExcelImportUtil; |
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
||||
import org.jeecgframework.poi.excel.entity.ExportParams; |
||||
import org.jeecgframework.poi.excel.entity.ImportParams; |
||||
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
||||
import org.jeecg.common.system.base.controller.JeecgController; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import org.springframework.web.multipart.MultipartHttpServletRequest; |
||||
import org.springframework.web.servlet.ModelAndView; |
||||
import com.alibaba.fastjson.JSON; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import org.jeecg.common.aspect.annotation.AutoLog; |
||||
|
||||
/** |
||||
* @Description: 工具表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Api(tags="工具表") |
||||
@RestController |
||||
@RequestMapping("/zytool/zyTool") |
||||
@Slf4j |
||||
public class ZyToolController extends JeecgController<ZyTool, IZyToolService> { |
||||
@Autowired |
||||
private IZyToolService zyToolService; |
||||
|
||||
/** |
||||
* 分页列表查询 |
||||
* |
||||
* @param zyTool |
||||
* @param pageNo |
||||
* @param pageSize |
||||
* @param req |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具表-分页列表查询") |
||||
@ApiOperation(value="工具表-分页列表查询", notes="工具表-分页列表查询") |
||||
@GetMapping(value = "/list") |
||||
public Result<?> queryPageList(ZyTool zyTool, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) throws WriterException, IOException { |
||||
QueryWrapper<ZyTool> queryWrapper = QueryGenerator.initQueryWrapper(zyTool, req.getParameterMap()); |
||||
Page<ZyTool> page = new Page<ZyTool>(pageNo, pageSize); |
||||
IPage<ZyTool> pageList = zyToolService.page(page, queryWrapper); |
||||
MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); |
||||
@SuppressWarnings("rawtypes") |
||||
Map hints = new HashMap(); |
||||
//设置UTF-8, 防止中文乱码
|
||||
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); |
||||
//设置二维码四周白色区域的大小
|
||||
hints.put(EncodeHintType.MARGIN, 1); |
||||
//设置二维码的容错性
|
||||
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); |
||||
//width:图片完整的宽;height:图片完整的高
|
||||
//因为要在二维码下方附上文字,所以把图片设置为长方形(高大于宽)
|
||||
int width = 150; |
||||
int height = 150; |
||||
//画二维码,记得调用multiFormatWriter.encode()时最后要带上hints参数,不然上面设置无效
|
||||
QRCodeWriter qrCodeWriter = new QRCodeWriter(); |
||||
List<Object> img= new ArrayList<>(); |
||||
String content=""; |
||||
//批量生成二维码
|
||||
for (int i=0;i<pageList.getRecords().size();i++){ |
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
||||
content = pageList.getRecords().get(i).getCode(); |
||||
BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints); |
||||
MatrixToImageWriter.writeToStream(bitMatrix, "PNG", outputStream); |
||||
Base64.Encoder encoder = Base64.getEncoder(); |
||||
String text = encoder.encodeToString(outputStream.toByteArray()); |
||||
pageList.getRecords().get(i).setQrcode("data:image/png;base64,"+text); |
||||
} |
||||
return Result.OK(pageList); |
||||
} |
||||
@AutoLog(value = "设备信息-分页列表查询") |
||||
@ApiOperation(value="设备信息-分页列表查询", notes="设备信息-分页列表查询") |
||||
@GetMapping(value = "/list1") |
||||
public Result<?> queryPageList1(ZyTool zyTool, |
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
||||
HttpServletRequest req) throws WriterException, IOException { |
||||
QueryWrapper<ZyTool> queryWrapper = QueryGenerator.initQueryWrapper(zyTool, req.getParameterMap()); |
||||
Page<ZyTool> page = new Page<ZyTool>(pageNo, pageSize); |
||||
IPage<ZyTool> pageList = zyToolService.page(page, queryWrapper); |
||||
return Result.OK(pageList); |
||||
} |
||||
|
||||
/** |
||||
* 添加 |
||||
* |
||||
* @param zyTool |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具表-添加") |
||||
@ApiOperation(value="工具表-添加", notes="工具表-添加") |
||||
@PostMapping(value = "/add") |
||||
public Result<?> add(@RequestBody ZyTool zyTool) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("name",zyTool.getName()); |
||||
int a=zyToolService.count(queryWrapper); |
||||
if(a==0){ |
||||
if(zyTool.getModelId()!=null&&!zyTool.getModelId().equals("")){ |
||||
ZyToolModel zytoolModel=zyToolService.findByModelId(zyTool.getModelId()); |
||||
if(zytoolModel.getBrandId()!=null){ |
||||
zyTool.setBrandId(zytoolModel.getBrandId()); |
||||
zyTool.setTypeCode(zytoolModel.getTooltypeCode()); |
||||
} |
||||
} |
||||
String code=zyToolService.getCode(); |
||||
if(code==null||code.equals("")){ |
||||
zyTool.setCode(zyTool.getTypeCode()+"001"); |
||||
}else{ |
||||
String sort=String.valueOf(Integer.parseInt(code.substring(6))+1); |
||||
while(sort.length()<3){ |
||||
sort="0"+sort; |
||||
} |
||||
zyTool.setCode(zyTool.getTypeCode()+sort); |
||||
} |
||||
zyToolService.save(zyTool); |
||||
return Result.OK("添加成功!"); |
||||
}else{ |
||||
return Result.error("添加失败,设备名称重复!!!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 编辑 |
||||
* |
||||
* @param zyTool |
||||
* @return |
||||
*/ |
||||
@AutoLog(value = "工具表-编辑") |
||||
@ApiOperation(value="工具表-编辑", notes="工具表-编辑") |
||||
@PutMapping(value = "/edit") |
||||
public Result<?> edit(@RequestBody ZyTool zyTool) { |
||||
QueryWrapper queryWrapper=new QueryWrapper(); |
||||
queryWrapper.eq("name",zyTool.getName()); |
||||
int a=zyToolService.count(queryWrapper); |
||||
if(a<2){ |
||||
zyToolService.updateById(zyTool); |
||||
return Result.OK("编辑成功!");} |
||||
else{ |
||||
return Result.error("编辑失败,设备名称重复!!!"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 通过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) { |
||||
zyToolService.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.zyToolService.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) { |
||||
ZyTool zyTool = zyToolService.getById(id); |
||||
if(zyTool==null) { |
||||
return Result.error("未找到对应数据"); |
||||
} |
||||
return Result.OK(zyTool); |
||||
} |
||||
|
||||
/** |
||||
* 导出excel |
||||
* |
||||
* @param request |
||||
* @param zyTool |
||||
*/ |
||||
@RequestMapping(value = "/exportXls") |
||||
public ModelAndView exportXls(HttpServletRequest request, ZyTool zyTool) { |
||||
return super.exportXls(request, zyTool, ZyTool.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, ZyTool.class); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,127 @@ |
||||
package org.jeecg.modules.zytool.zytool.entity; |
||||
|
||||
|
||||
|
||||
import java.io.Serializable; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.util.Date; |
||||
import java.math.BigDecimal; |
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import org.springframework.format.annotation.DateTimeFormat; |
||||
import org.jeecgframework.poi.excel.annotation.Excel; |
||||
import org.jeecg.common.aspect.annotation.Dict; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* @Description: 工具表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Data |
||||
@TableName("zy_tool") |
||||
@Accessors(chain = true) |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value="zy_tool对象", description="工具表") |
||||
public class ZyTool 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; |
||||
/**所属部门*/ |
||||
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") |
||||
@ApiModelProperty(value = "所属部门") |
||||
private String OrgCode; |
||||
/**类型编号*/ |
||||
@Excel(name = "类型编号", width = 15) |
||||
@ApiModelProperty(value = "类型编号") |
||||
private String typeCode; |
||||
/**工具品牌*/ |
||||
@Excel(name = "工具品牌", width = 15) |
||||
@ApiModelProperty(value = "工具品牌") |
||||
@Dict(dictTable = "zy_tool_brand", dicText = "brand", dicCode = "id") |
||||
private String brandId; |
||||
/**工具型号*/ |
||||
@Excel(name = "工具型号", width = 15) |
||||
@ApiModelProperty(value = "工具型号") |
||||
@Dict(dictTable = "zy_tool_model", dicText = "model", dicCode = "id") |
||||
private String modelId; |
||||
/**工具编号*/ |
||||
@Excel(name = "工具编号", width = 15) |
||||
@ApiModelProperty(value = "工具编号") |
||||
private String code; |
||||
/**工具名称*/ |
||||
@Excel(name = "工具名称", width = 15) |
||||
@ApiModelProperty(value = "工具名称") |
||||
private String name; |
||||
/**购买时间*/ |
||||
@Excel(name = "购买时间", width = 15, format = "yyyy-MM-dd") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd") |
||||
@ApiModelProperty(value = "购买时间") |
||||
private Date buydate; |
||||
/**经办人*/ |
||||
@Excel(name = "经办人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@ApiModelProperty(value = "经办人") |
||||
private String agent; |
||||
/**工具状态*/ |
||||
@Excel(name = "工具状态", width = 15) |
||||
@ApiModelProperty(value = "工具状态") |
||||
@Dict( dicCode = "devicestatus1") |
||||
private String status; |
||||
/**二维码*/ |
||||
@Excel(name = "二维码", width = 15) |
||||
@ApiModelProperty(value = "二维码") |
||||
private String qrcode; |
||||
/**维护周期*/ |
||||
@Excel(name = "维护周期", width = 15, format = "yyyy-MM-dd") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd") |
||||
@ApiModelProperty(value = "维护周期") |
||||
private Integer maintenancecycle; |
||||
/**管理人*/ |
||||
@Excel(name = "管理人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") |
||||
@ApiModelProperty(value = "管理人") |
||||
private String administrator; |
||||
/**上次维护时间*/ |
||||
@Excel(name = "上次维护时间", width = 15, format = "yyyy-MM-dd") |
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") |
||||
@DateTimeFormat(pattern="yyyy-MM-dd") |
||||
@ApiModelProperty(value = "上次维护时间") |
||||
private Date maintenancedate; |
||||
/**工具图片*/ |
||||
@Excel(name = "工具图片", width = 15) |
||||
@ApiModelProperty(value = "工具图片") |
||||
private String img; |
||||
/**3d模型*/ |
||||
@Excel(name = "3d模型", width = 15) |
||||
@ApiModelProperty(value = "3d模型") |
||||
private String img3d; |
||||
} |
@ -0,0 +1,28 @@ |
||||
package org.jeecg.modules.zytool.zytool.mapper; |
||||
|
||||
|
||||
|
||||
import java.util.List; |
||||
|
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; |
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
import org.jeecg.modules.zytool.zytool.entity.ZyTool; |
||||
|
||||
/** |
||||
* @Description: 工具表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface ZyToolMapper extends BaseMapper<ZyTool> { |
||||
|
||||
@Select("select * from zy_tool_model where id=#{modelId}") |
||||
ZyToolModel findByModelId(String modelId); |
||||
|
||||
@Select("select code from zy_tool order by code desc limit 0,1") |
||||
String getCode(); |
||||
} |
@ -1,5 +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.tool.mapper.ZyToolMapper"> |
||||
<mapper namespace="org.jeecg.modules.zytool.zytool.mapper.ZyToolMapper"> |
||||
|
||||
</mapper> |
||||
</mapper> |
@ -0,0 +1,20 @@ |
||||
package org.jeecg.modules.zytool.zytool.service; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; |
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
import org.jeecg.modules.zytool.zytool.entity.ZyTool; |
||||
|
||||
/** |
||||
* @Description: 工具表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
public interface IZyToolService extends IService<ZyTool> { |
||||
|
||||
ZyToolModel findByModelId(String modelId); |
||||
|
||||
String getCode(); |
||||
} |
@ -0,0 +1,33 @@ |
||||
package org.jeecg.modules.zytool.zytool.service.impl; |
||||
|
||||
import org.jeecg.modules.zydevice.devicemodel.entity.ZyDevicemodel; |
||||
import org.jeecg.modules.zytool.toolmodel.entity.ZyToolModel; |
||||
import org.jeecg.modules.zytool.zytool.entity.ZyTool; |
||||
import org.jeecg.modules.zytool.zytool.mapper.ZyToolMapper; |
||||
import org.jeecg.modules.zytool.zytool.service.IZyToolService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
||||
/** |
||||
* @Description: 工具表 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2023-01-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ZyToolServiceImpl extends ServiceImpl<ZyToolMapper, ZyTool> implements IZyToolService { |
||||
|
||||
@Autowired |
||||
ZyToolMapper zyToolMapper; |
||||
@Override |
||||
public ZyToolModel findByModelId(String modelId) { |
||||
return zyToolMapper.findByModelId(modelId); |
||||
} |
||||
|
||||
@Override |
||||
public String getCode() { |
||||
return zyToolMapper.getCode(); |
||||
} |
||||
} |
@ -0,0 +1,261 @@ |
||||
<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> |
||||
|
||||
<zy-tool-modal ref="modalForm" @ok="modalFormOk"></zy-tool-modal> |
||||
</a-card> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import '@/assets/less/TableExpand.less' |
||||
import { mixinDevice } from '@/utils/mixin' |
||||
import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
||||
import ZyToolModal from './modules/ZyToolModal' |
||||
|
||||
export default { |
||||
name: 'ZyToolList', |
||||
mixins:[JeecgListMixin, mixinDevice], |
||||
components: { |
||||
ZyToolModal |
||||
}, |
||||
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: 'typeCode' |
||||
}, |
||||
{ |
||||
title:'工具品牌', |
||||
align:"center", |
||||
dataIndex: 'brandId' |
||||
}, |
||||
{ |
||||
title:'工具型号', |
||||
align:"center", |
||||
dataIndex: 'modelId' |
||||
}, |
||||
{ |
||||
title:'工具编号', |
||||
align:"center", |
||||
dataIndex: 'code' |
||||
}, |
||||
{ |
||||
title:'工具名称', |
||||
align:"center", |
||||
dataIndex: 'name' |
||||
}, |
||||
{ |
||||
title:'购买时间', |
||||
align:"center", |
||||
dataIndex: 'buydate', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
}, |
||||
{ |
||||
title:'经办人', |
||||
align:"center", |
||||
dataIndex: 'agent_dictText' |
||||
}, |
||||
{ |
||||
title:'工具状态', |
||||
align:"center", |
||||
dataIndex: 'status_dictText' |
||||
}, |
||||
{ |
||||
title:'二维码', |
||||
align:"center", |
||||
dataIndex: 'qrcode', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
}, |
||||
{ |
||||
title:'维护周期', |
||||
align:"center", |
||||
dataIndex: 'maintenancecycle', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
}, |
||||
{ |
||||
title:'管理人', |
||||
align:"center", |
||||
dataIndex: 'administrator_dictText' |
||||
}, |
||||
{ |
||||
title:'上次维护时间', |
||||
align:"center", |
||||
dataIndex: 'maintenancedate', |
||||
customRender:function (text) { |
||||
return !text?"":(text.length>10?text.substr(0,10):text) |
||||
} |
||||
}, |
||||
{ |
||||
title:'工具图片', |
||||
align:"center", |
||||
dataIndex: 'img', |
||||
scopedSlots: {customRender: 'imgSlot'} |
||||
}, |
||||
{ |
||||
title:'3d模型', |
||||
align:"center", |
||||
dataIndex: 'img3d', |
||||
scopedSlots: {customRender: 'fileSlot'} |
||||
}, |
||||
{ |
||||
title: '操作', |
||||
dataIndex: 'action', |
||||
align:"center", |
||||
fixed:"right", |
||||
width:147, |
||||
scopedSlots: { customRender: 'action' } |
||||
} |
||||
], |
||||
url: { |
||||
list: "/zytool/zyTool/list", |
||||
delete: "/zytool/zyTool/delete", |
||||
deleteBatch: "/zytool/zyTool/deleteBatch", |
||||
exportXlsUrl: "/zytool/zyTool/exportXls", |
||||
importExcelUrl: "zytool/zyTool/importExcel", |
||||
|
||||
}, |
||||
dictOptions:{}, |
||||
superFieldList:[], |
||||
} |
||||
}, |
||||
created() { |
||||
this.getSuperFieldList(); |
||||
}, |
||||
computed: { |
||||
importExcelUrl: function(){ |
||||
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; |
||||
}, |
||||
}, |
||||
methods: { |
||||
initDictConfig(){ |
||||
}, |
||||
getSuperFieldList(){ |
||||
let fieldList=[]; |
||||
fieldList.push({type:'string',value:'typeCode',text:'类型编号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'brandId',text:'工具品牌',dictCode:''}) |
||||
fieldList.push({type:'string',value:'modelId',text:'工具型号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'code',text:'工具编号',dictCode:''}) |
||||
fieldList.push({type:'string',value:'name',text:'工具名称',dictCode:''}) |
||||
fieldList.push({type:'date',value:'buydate',text:'购买时间'}) |
||||
fieldList.push({type:'sel_user',value:'agent',text:'经办人'}) |
||||
fieldList.push({type:'string',value:'status',text:'工具状态',dictCode:''}) |
||||
fieldList.push({type:'string',value:'qrcode',text:'二维码',dictCode:''}) |
||||
fieldList.push({type:'date',value:'maintenancecycle',text:'维护周期'}) |
||||
fieldList.push({type:'sel_user',value:'administrator',text:'管理人'}) |
||||
fieldList.push({type:'date',value:'maintenancedate',text:'上次维护时间'}) |
||||
fieldList.push({type:'string',value:'img',text:'工具图片',dictCode:''}) |
||||
fieldList.push({type:'string',value:'img3d',text:'3d模型',dictCode:''}) |
||||
this.superFieldList = fieldList |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped> |
||||
@import '~@assets/less/common.less'; |
||||
</style> |
@ -0,0 +1,169 @@ |
||||
<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="typeCode"> |
||||
<a-input v-model="model.typeCode" placeholder="请输入类型编号" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brandId"> |
||||
<a-input v-model="model.brandId" placeholder="请输入工具品牌" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modelId"> |
||||
<a-input v-model="model.modelId" placeholder="请输入工具型号" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code"> |
||||
<a-input v-model="model.code" placeholder="请输入工具编号" ></a-input> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="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="buydate"> |
||||
<j-date placeholder="请选择购买时间" v-model="model.buydate" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="经办人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="agent"> |
||||
<j-select-user-by-dep v-model="model.agent" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status"> |
||||
<j-dict-select-tag type="list" v-model="model.status" dictCode="" placeholder="请选择工具状态" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="二维码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qrcode"> |
||||
<j-image-upload isMultiple v-model="model.qrcode" ></j-image-upload> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="维护周期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancecycle"> |
||||
<j-date placeholder="请选择维护周期" v-model="model.maintenancecycle" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="管理人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="administrator"> |
||||
<j-select-user-by-dep v-model="model.administrator" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="上次维护时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="maintenancedate"> |
||||
<j-date placeholder="请选择上次维护时间" v-model="model.maintenancedate" style="width: 100%" /> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="工具图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img"> |
||||
<j-image-upload isMultiple v-model="model.img" ></j-image-upload> |
||||
</a-form-model-item> |
||||
</a-col> |
||||
<a-col :span="24"> |
||||
<a-form-model-item label="3d模型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="img3d"> |
||||
<j-upload v-model="model.img3d" ></j-upload> |
||||
</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: 'ZyToolForm', |
||||
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: "/zytool/zyTool/add", |
||||
edit: "/zytool/zyTool/edit", |
||||
queryById: "/zytool/zyTool/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="关闭"> |
||||
<zy-tool-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></zy-tool-form> |
||||
</j-modal> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ZyToolForm from './ZyToolForm' |
||||
export default { |
||||
name: 'ZyToolModal', |
||||
components: { |
||||
ZyToolForm |
||||
}, |
||||
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"> |
||||
<zy-tool-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></zy-tool-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 ZyToolForm from './ZyToolForm' |
||||
|
||||
export default { |
||||
name: 'ZyToolModal', |
||||
components: { |
||||
ZyToolForm |
||||
}, |
||||
data () { |
||||
return { |
||||
title:"操作", |
||||
width:800, |
||||
visible: false, |
||||
disableSubmit: false |
||||
} |
||||
}, |
||||
methods: { |
||||
add () { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.add(); |
||||
}) |
||||
}, |
||||
edit (record) { |
||||
this.visible=true |
||||
this.$nextTick(()=>{ |
||||
this.$refs.realForm.edit(record); |
||||
}); |
||||
}, |
||||
close () { |
||||
this.$emit('close'); |
||||
this.visible = false; |
||||
}, |
||||
submitCallback(){ |
||||
this.$emit('ok'); |
||||
this.visible = false; |
||||
}, |
||||
handleOk () { |
||||
this.$refs.realForm.submitForm(); |
||||
}, |
||||
handleCancel () { |
||||
this.close() |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="less" scoped> |
||||
/** Button按钮间距 */ |
||||
.ant-btn { |
||||
margin-left: 30px; |
||||
margin-bottom: 30px; |
||||
float: right; |
||||
} |
||||
.drawer-footer{ |
||||
position: absolute; |
||||
bottom: -8px; |
||||
width: 100%; |
||||
border-top: 1px solid #e8e8e8; |
||||
padding: 10px 16px; |
||||
text-align: right; |
||||
left: 0; |
||||
background: #fff; |
||||
border-radius: 0 0 2px 2px; |
||||
} |
||||
</style> |
Loading…
Reference in new issue