2023-1-12工具

zhc4dev
lenovo 2 years ago
parent 5d4ec8555d
commit 438584b771
  1. 261
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/vue/ZyToolList.vue
  2. 169
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/vue/modules/ZyToolForm.vue
  3. 60
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/vue/modules/ZyToolModal.vue
  4. 84
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zytool/zytool/vue/modules/ZyToolModal__Style#Drawer.vue

@ -1,261 +0,0 @@
<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>

@ -1,169 +0,0 @@
<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>

@ -1,60 +0,0 @@
<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>

@ -1,84 +0,0 @@
<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…
Cancel
Save