2023-05-12-02-bug

master
喻忠伟 2 years ago
parent a208888ffb
commit 72873b58b0
  1. 471
      ant-design-vue-jeecg/src/views/sensor/SensorList.vue
  2. 300
      ant-design-vue-jeecg/src/views/sensor/modules/SensorForm.vue
  3. 652
      ant-design-vue-jeecg/src/views/team/StationList.vue
  4. 347
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/sensor/controller/SensorController.java
  5. 431
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/team/controller/StationController.java

@ -1,229 +1,244 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="传感器编号"> <a-form-item label="传感器编号">
<a-input placeholder="请输入传感器编号" v-model="queryParam.sensorCode"></a-input> <a-input placeholder="请输入传感器编号" v-model="queryParam.sensorCode"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="车间"> <a-form-item label="车间">
<j-search-select-tag placeholder="请选择车间" v-model="queryParam.workshopId" dict="sys_depart,depart_name,id"/> <j-search-select-tag placeholder="请选择车间" v-model="queryParam.workshopId" dict="sys_depart,depart_name,id"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<template v-if="toggleSearchStatus"> <template v-if="toggleSearchStatus">
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="工位"> <a-form-item label="工位">
<a-input placeholder="请输入工位" v-model="queryParam.stationId"></a-input> <a-input placeholder="请输入工位" v-model="queryParam.stationId"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="进出标记"> <a-form-item label="进出标记">
<j-dict-select-tag placeholder="请选择进出标记" v-model="queryParam.iiOsign" dictCode="ioinset"/> <j-dict-select-tag placeholder="请选择进出标记" v-model="queryParam.iiOsign" dictCode="ioinset"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
</template> </template>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <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="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a @click="handleToggleSearch" style="margin-left: 8px"> <a @click="handleToggleSearch" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }} {{ toggleSearchStatus ? '收起' : '展开' }}
<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
</a> </a>
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<!-- 查询区域-END --> <!-- 查询区域-END -->
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator"> <div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('传感器表')">导出</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-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<!-- 高级查询区域 --> <!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu> </a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown> </a-dropdown>
</div> </div>
<!-- table区域-begin --> <!-- table区域-begin -->
<div> <div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> <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> <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> <a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div> </div>
<a-table <a-table
ref="table" ref="table"
size="middle" size="middle"
:scroll="{x:true}" :scroll="{x:true}"
bordered bordered
rowKey="id" rowKey="id"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading" :loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
class="j-table-force-nowrap" class="j-table-force-nowrap"
@change="handleTableChange"> @change="handleTableChange">
<template slot="htmlSlot" slot-scope="text"> <template slot="htmlSlot" slot-scope="text">
<div v-html="text"></div> <div v-html="text"></div>
</template> </template>
<template slot="imgSlot" slot-scope="text"> <template slot="imgSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> <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;"/> <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
</template> </template>
<template slot="fileSlot" slot-scope="text"> <template slot="fileSlot" slot-scope="text">
<span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
<a-button <a-button
v-else v-else
:ghost="true" :ghost="true"
type="primary" type="primary"
icon="download" icon="download"
size="small" size="small"
@click="downloadFile(text)"> @click="downloadFile(text)">
下载 下载
</a-button> </a-button>
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" /> <a-divider type="vertical" />
<a-dropdown> <a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down" /></a> <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item> <a-menu-item>
<a @click="handleDetail(record)">详情</a> <a @click="handleDetail(record)">详情</a>
</a-menu-item> </a-menu-item>
<a-menu-item> <a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
</span> </span>
</a-table> </a-table>
</div> </div>
<sensor-modal ref="modalForm" @ok="modalFormOk"></sensor-modal> <sensor-modal ref="modalForm" @ok="modalFormOk"></sensor-modal>
</a-card> </a-card>
</template> </template>
<script> <script>
import '@/assets/less/TableExpand.less' import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin' import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import SensorModal from './modules/SensorModal' import SensorModal from './modules/SensorModal'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import { filterObj } from '@/utils/util';
export default {
name: 'SensorList', export default {
mixins:[JeecgListMixin, mixinDevice], name: 'SensorList',
components: { mixins:[JeecgListMixin, mixinDevice],
SensorModal components: {
}, SensorModal
data () { },
return { data () {
description: '传感器表管理页面', return {
// description: '传感器表管理页面',
columns: [ //
{ columns: [
title: '#', {
dataIndex: '', title: '#',
key:'rowIndex', dataIndex: '',
width:60, key:'rowIndex',
align:"center", width:60,
customRender:function (t,r,index) { align:"center",
return parseInt(index)+1; customRender:function (t,r,index) {
} return parseInt(index)+1;
}, }
{ },
title:'传感器编号', {
align:"center", title:'传感器编号',
dataIndex: 'sensorCode' align:"center",
}, dataIndex: 'sensorCode'
{ },
title:'车间', {
align:"center", title:'车间',
dataIndex: 'workshopId_dictText' align:"center",
}, dataIndex: 'workshopId_dictText'
{ },
title:'网络地址', {
align:"center", title:'网络地址',
dataIndex: 'sensorIp' align:"center",
}, dataIndex: 'sensorIp'
{ },
title:'工位', {
align:"center", title:'工位',
dataIndex: 'stationId_dictText' align:"center",
}, dataIndex: 'stationId_dictText'
{ },
title:'进出标记', {
align:"center", title:'进出标记',
dataIndex: 'iiOsign_dictText' align:"center",
}, dataIndex: 'iiOsign_dictText'
{ },
title: '操作', {
dataIndex: 'action', title: '操作',
align:"center", dataIndex: 'action',
fixed:"right", align:"center",
width:147, fixed:"right",
scopedSlots: { customRender: 'action' } width:147,
} scopedSlots: { customRender: 'action' }
], }
url: { ],
list: "/sensor/sensor/list", url: {
delete: "/sensor/sensor/delete", list: "/sensor/sensor/list",
deleteBatch: "/sensor/sensor/deleteBatch", delete: "/sensor/sensor/delete",
exportXlsUrl: "/sensor/sensor/exportXls", deleteBatch: "/sensor/sensor/deleteBatch",
importExcelUrl: "sensor/sensor/importExcel", exportXlsUrl: "/sensor/sensor/exportXls",
importExcelUrl: "sensor/sensor/importExcel",
},
dictOptions:{}, },
superFieldList:[], dictOptions:{},
} superFieldList:[],
}, }
created() { },
this.getSuperFieldList(); created() {
}, this.getSuperFieldList();
computed: { },
importExcelUrl: function(){ computed: {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; importExcelUrl: function(){
}, return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}, },
methods: { },
initDictConfig(){ methods: {
}, initDictConfig(){
getSuperFieldList(){ },
let fieldList=[];
fieldList.push({type:'string',value:'sensorCode',text:'传感器编号',dictCode:''}) getQueryParams(arg) {
fieldList.push({type:'sel_search',value:'workshopId',text:'车间',dictTable:'sys_depart', dictText:'depart_name', dictCode:'id'}) //
fieldList.push({type:'string',value:'sensorIp',text:'网络地址',dictCode:''}) let sqp = {}
fieldList.push({type:'string',value:'stationId',text:'工位',dictCode:'station,station_name,id'}) if (this.superQueryParams) {
fieldList.push({type:'popup',value:'station',text:'工位', popup:{code:'findgw',field:'id',orgFields:'id',destFields:'station_id'}}) sqp['superQueryParams'] = encodeURI(this.superQueryParams)
fieldList.push({type:'string',value:'iiOsign',text:'进出标记',dictCode:'ioinset'}) sqp['superQueryMatchType'] = this.superQueryMatchType
this.superFieldList = fieldList }
} var param = Object.assign(sqp, this.queryParam, {}, this.filters)
} param.field = this.getQueryField()
} param.pageNo = this.ipagination.current
</script> param.pageSize = this.ipagination.pageSize
<style scoped> return filterObj(param)
@import '~@assets/less/common.less'; },
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'sensorCode',text:'传感器编号',dictCode:''})
fieldList.push({type:'sel_search',value:'workshopId',text:'车间',dictTable:'sys_depart', dictText:'depart_name', dictCode:'id'})
fieldList.push({type:'string',value:'sensorIp',text:'网络地址',dictCode:''})
fieldList.push({type:'string',value:'stationId',text:'工位',dictCode:'station,station_name,id'})
fieldList.push({type:'popup',value:'station',text:'工位', popup:{code:'findgw',field:'id',orgFields:'id',destFields:'station_id'}})
fieldList.push({type:'string',value:'iiOsign',text:'进出标记',dictCode:'ioinset'})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style> </style>

@ -1,147 +1,155 @@
<template> <template>
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled"> <j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="传感器编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sensorCode"> <a-form-model-item label="传感器编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sensorCode">
<a-input v-model="model.sensorCode" placeholder="请输入传感器编号" ></a-input> <a-input v-model="model.sensorCode" placeholder="请输入传感器编号" ></a-input>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="车间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workshopId"> <a-form-model-item label="车间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workshopId">
<j-search-select-tag v-model="model.workshopId" dict="sys_depart,depart_name,id" disabled/> <j-tree-select v-model="model.workshopId"
</a-form-model-item> dict="sys_depart,depart_name,id"
</a-col> pidField="parent_id"
<a-col :span="24"> placeholder="请选择车间"
<a-form-model-item label="网络地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sensorIp"> condition='{"org_category":"2"}'
<a-input v-model="model.sensorIp" placeholder="请输入网络地址" ></a-input> hasChildField="1"
</a-form-model-item> >
</a-col> </j-tree-select>
<a-col :span="24"> </a-form-model-item>
<a-form-model-item label="工位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="station"> </a-col>
<j-popup <a-col :span="24">
v-model="model.station" <a-form-model-item label="网络地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sensorIp">
field="station" <a-input v-model="model.sensorIp" placeholder="请输入网络地址" ></a-input>
org-fields="id,station_name,depart_id" </a-form-model-item>
dest-fields="stationId,station,workshopId" </a-col>
code="findgw" <a-col :span="24">
:multi="true" <a-form-model-item label="工位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="station">
@input="popupCallback" <!--<j-popup-->
/> <!--v-model="model.station"-->
</a-form-model-item> <!--field="station"-->
</a-col> <!--org-fields="id,station_name,depart_id"-->
<a-col :span="24"> <!--dest-fields="stationId,station,workshopId"-->
<a-form-model-item label="进出标记" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="iiOsign"> <!--code="findgw"-->
<j-dict-select-tag type="list" v-model="model.iiOsign" dictCode="ioinset" placeholder="请选择进出标记" /> <!--:multi="true"-->
</a-form-model-item> <!--@input="popupCallback"-->
</a-col> <!--/>-->
</a-row> <j-search-select-tag v-model="model.stationId" dict="station,station_name,id" />
</a-form-model> </a-form-model-item>
</j-form-container> </a-col>
</a-spin> <a-col :span="24">
</template> <a-form-model-item label="进出标记" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="iiOsign">
<j-dict-select-tag type="list" v-model="model.iiOsign" dictCode="ioinset" placeholder="请选择进出标记" />
<script> </a-form-model-item>
</a-col>
import { httpAction, getAction } from '@/api/manage' </a-row>
import { validateDuplicateValue } from '@/utils/util' </a-form-model>
</j-form-container>
export default { </a-spin>
name: 'SensorForm', </template>
components: {
}, <script>
props: {
// import { httpAction, getAction } from '@/api/manage'
disabled: { import { validateDuplicateValue } from '@/utils/util'
type: Boolean,
default: false, export default {
required: false name: 'SensorForm',
} components: {
}, },
data () { props: {
return { //
model:{ disabled: {
}, type: Boolean,
labelCol: { default: false,
xs: { span: 24 }, required: false
sm: { span: 5 }, }
}, },
wrapperCol: { data () {
xs: { span: 24 }, return {
sm: { span: 16 }, model:{
}, },
confirmLoading: false, labelCol: {
validatorRules: { xs: { span: 24 },
sensorCode: [ sm: { span: 5 },
{ required: true, message: '请输入传感器编号!'}, },
], wrapperCol: {
workshopId: [ xs: { span: 24 },
{ required: true, message: '请输入车间!'}, sm: { span: 16 },
], },
sensorIp: [ confirmLoading: false,
{ required: true, message: '请输入网络地址!'}, validatorRules: {
], sensorCode: [
iiOsign: [ { required: true, message: '请输入传感器编号!'},
{ required: true, message: '请输入进出标记!'}, ],
], workshopId: [
}, { required: true, message: '请输入车间!'},
url: { ],
add: "/sensor/sensor/add", sensorIp: [
edit: "/sensor/sensor/edit", { required: true, message: '请输入网络地址!'},
queryById: "/sensor/sensor/queryById" ],
} iiOsign: [
} { required: true, message: '请输入进出标记!'},
}, ],
computed: { },
formDisabled(){ url: {
return this.disabled add: "/sensor/sensor/add",
}, edit: "/sensor/sensor/edit",
}, queryById: "/sensor/sensor/queryById"
created () { }
//model }
this.modelDefault = JSON.parse(JSON.stringify(this.model)); },
}, computed: {
methods: { formDisabled(){
add () { return this.disabled
this.edit(this.modelDefault); },
}, },
edit (record) { created () {
this.model = Object.assign({}, record); //model
this.visible = true; this.modelDefault = JSON.parse(JSON.stringify(this.model));
}, },
submitForm () { methods: {
const that = this; add () {
// this.edit(this.modelDefault);
this.$refs.form.validate(valid => { },
if (valid) { edit (record) {
that.confirmLoading = true; this.model = Object.assign({}, record);
let httpurl = ''; this.visible = true;
let method = ''; },
if(!this.model.id){ submitForm () {
httpurl+=this.url.add; const that = this;
method = 'post'; //
}else{ this.$refs.form.validate(valid => {
httpurl+=this.url.edit; if (valid) {
method = 'put'; that.confirmLoading = true;
} let httpurl = '';
httpAction(httpurl,this.model,method).then((res)=>{ let method = '';
if(res.success){ if(!this.model.id){
that.$message.success(res.message); httpurl+=this.url.add;
that.$emit('ok'); method = 'post';
}else{ }else{
that.$message.warning(res.message); httpurl+=this.url.edit;
} method = 'put';
}).finally(() => { }
that.confirmLoading = false; httpAction(httpurl,this.model,method).then((res)=>{
}) if(res.success){
} that.$message.success(res.message);
that.$emit('ok');
}) }else{
}, that.$message.warning(res.message);
popupCallback(value,row){ }
this.model = Object.assign(this.model, row); }).finally(() => {
}, that.confirmLoading = false;
} })
} }
})
},
popupCallback(value,row){
this.model = Object.assign(this.model, row);
},
}
}
</script> </script>

@ -1,319 +1,335 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<!-- <a-form-item label="车间ID">--> <!-- <a-form-item label="车间ID">-->
<!-- <a-input placeholder="请输入车间ID" v-model="queryParam.departId"></a-input>--> <!-- <a-input placeholder="请输入车间ID" v-model="queryParam.departId"></a-input>-->
<!-- </a-form-item>--> <!-- </a-form-item>-->
<a-form-model-item label="车间名称"> <a-form-model-item label="车间名称">
<!-- <a-input placeholder="请输入部门编号" v-model="model.departId"/>--> <!-- <a-input placeholder="请输入部门编号" v-model="model.departId"/>-->
<j-select-depart placeholder="请选择车间" v-model="queryParam.departId"/> <j-select-depart placeholder="请选择车间" v-model="queryParam.departId"/>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="工位名称"> <a-form-item label="工位名称">
<a-input placeholder="请输入工位名称" v-model="queryParam.stationName"></a-input> <a-input placeholder="请输入工位名称" v-model="queryParam.stationName"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<template v-if="toggleSearchStatus"> <template v-if="toggleSearchStatus">
</template> </template>
<a-col :xl="6" :lg="7" :md="8" :sm="24"> <a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <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="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<!-- <a @click="handleToggleSearch" style="margin-left: 8px">--> <!-- <a @click="handleToggleSearch" style="margin-left: 8px">-->
<!-- {{ toggleSearchStatus ? '收起' : '展开' }}--> <!-- {{ toggleSearchStatus ? '收起' : '展开' }}-->
<!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>--> <!-- <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
<!-- </a>--> <!-- </a>-->
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator"> <div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('车间工位管理')">导出</a-button> <a-button type="primary" icon="download" @click="handleExportXls('车间工位管理')">导出</a-button>
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"--> <!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"-->
<!-- @change="handleImportExcel">--> <!-- @change="handleImportExcel">-->
<!-- <a-button type="primary" icon="import">导入</a-button>--> <!-- <a-button type="primary" icon="import">导入</a-button>-->
<!-- </a-upload>--> <!-- </a-upload>-->
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"> <a-menu-item key="1" @click="batchDel">
<a-icon type="delete"/> <a-icon type="delete"/>
删除 删除
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-button style="margin-left: 8px"> 批量操作
<a-icon type="down"/> <a-icon type="down"/>
</a-button> </a-button>
</a-dropdown> </a-dropdown>
</div> </div>
<!-- table区域-begin --> <!-- table区域-begin -->
<div> <div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
style="font-weight: 600">{{ selectedRowKeys.length }}</a> style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a> <a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div> </div>
<a-table <a-table
ref="table" ref="table"
size="middle" size="middle"
bordered bordered
rowKey="id" rowKey="id"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading" :loading="loading"
class="j-table-force-nowrap" class="j-table-force-nowrap"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange"> @change="handleTableChange">
<span slot="toolsIds_dictText" slot-scope="text, record"> <span slot="toolsIds_dictText" slot-scope="text, record">
<a-popover> <a-popover>
<template slot="content"> <template slot="content">
<p>{{ text }}</p> <p>{{ text }}</p>
</template> </template>
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{
text text
}}</a> }}</a>
</a-popover> </a-popover>
</span> </span>
<span slot="machineIds_dictText" slot-scope="text, record"> <span slot="machineIds_dictText" slot-scope="text, record">
<a-popover> <a-popover>
<template slot="content"> <template slot="content">
<p>{{ text }}</p> <p>{{ text }}</p>
</template> </template>
<a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{ <a style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display: inline-block;width: 100px">{{
text text
}}</a> }}</a>
</a-popover> </a-popover>
</span> </span>
<span slot="action1" slot-scope="text, record"> <span slot="action1" slot-scope="text, record">
<a @click="jumpPage1(record)">管理</a> <a @click="jumpPage1(record)">管理</a>
</span> </span>
<span slot="action2" slot-scope="text, record"> <span slot="action2" slot-scope="text, record">
<a @click="jumpPage2(record)">管理</a> <a @click="jumpPage2(record)">管理</a>
</span> </span>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
<!-- <a-divider type="vertical"/>--> <!-- <a-divider type="vertical"/>-->
<!-- <a @click="handleDetail(record)">详情</a>--> <!-- <a @click="handleDetail(record)">详情</a>-->
<a-divider type="vertical"/> <a-divider type="vertical"/>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete2(record.id)"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete2(record.id)">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
<a-divider type="vertical"/> <a-divider type="vertical"/>
<a @click="up(record.id)">前移</a> <a @click="up(record.id)">前移</a>
<a-divider type="vertical"/> <a-divider type="vertical"/>
<a @click="down(record.id)">后移</a> <a @click="down(record.id)">后移</a>
</span> </span>
</a-table> </a-table>
</div> </div>
<!-- table区域-end --> <!-- table区域-end -->
<!-- 表单区域 --> <!-- 表单区域 -->
<station-modal ref="modalForm" @ok="modalFormOk"></station-modal> <station-modal ref="modalForm" @ok="modalFormOk"></station-modal>
</a-card> </a-card>
</template> </template>
<script> <script>
import '@/assets/less/TableExpand.less' import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin' import {mixinDevice} from '@/utils/mixin'
import StationModal from './modules/StationModal' import StationModal from './modules/StationModal'
import {JeecgListMixin} from '@/mixins/JeecgListMixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {deleteAction, getAction} from "@api/manage"; import {deleteAction, getAction} from "@api/manage";
import { filterObj } from '@/utils/util';
export default {
name: "StationList", export default {
mixins: [JeecgListMixin, mixinDevice], name: "StationList",
components: { mixins: [JeecgListMixin, mixinDevice],
StationModal components: {
}, StationModal
data() { },
return { data() {
description: '车间工位管理管理页面', return {
// description: '车间工位管理管理页面',
columns: [ //
{ columns: [
title: '#', {
dataIndex: '', title: '#',
key: 'rowIndex', dataIndex: '',
width: 60, key: 'rowIndex',
align: "center", width: 60,
customRender: function (t, r, index) { align: "center",
return parseInt(index) + 1; customRender: function (t, r, index) {
} return parseInt(index) + 1;
}, }
/*{ },
title: '车间ID', /*{
align: "center", title: '车间ID',
dataIndex: 'departId' align: "center",
},*/ dataIndex: 'departId'
{ },*/
title: '车间名称', {
align: "center", title: '车间名称',
dataIndex: 'departName' align: "center",
}, dataIndex: 'departName'
{ },
title: '工位序号', {
align: "center", title: '工位序号',
dataIndex: 'stationNum' align: "center",
}, dataIndex: 'stationNum'
{ },
title: '工位名称', {
align: "center", title: '工位名称',
dataIndex: 'stationName' align: "center",
}, dataIndex: 'stationName'
{ },
title: '设备', {
align: "center", title: '设备',
dataIndex: 'machineIds_dictText', align: "center",
scopedSlots: {customRender: 'machineIds_dictText'} dataIndex: 'machineIds_dictText',
}, scopedSlots: {customRender: 'machineIds_dictText'}
{ },
title: '工具', {
align: "center", title: '工具',
dataIndex: 'toolsIds_dictText', align: "center",
scopedSlots: {customRender: 'toolsIds_dictText'} dataIndex: 'toolsIds_dictText',
}, scopedSlots: {customRender: 'toolsIds_dictText'}
{ },
title: '备注', {
align: "center", title: '备注',
dataIndex: 'description' align: "center",
}, dataIndex: 'description'
{ },
title: '工位设备模块', {
dataIndex: 'action1', title: '工位设备模块',
align: "center", dataIndex: 'action1',
// fixed: "right", align: "center",
width: 80, // fixed: "right",
scopedSlots: {customRender: 'action1'} width: 80,
}, scopedSlots: {customRender: 'action1'}
{ },
title: '工位工具模块', {
dataIndex: 'action2', title: '工位工具模块',
align: "center", dataIndex: 'action2',
// fixed: "right", align: "center",
width: 80, // fixed: "right",
scopedSlots: {customRender: 'action2'} width: 80,
}, scopedSlots: {customRender: 'action2'}
{ },
title: '操作', {
dataIndex: 'action', title: '操作',
align: "center", dataIndex: 'action',
width: 60, align: "center",
scopedSlots: {customRender: 'action'}, width: 60,
} scopedSlots: {customRender: 'action'},
], }
url: { ],
list: "/team/station/list", url: {
queryIsCanDelete: "/team/station/queryIsCanDelete", list: "/team/station/list",
up: "/team/station/up", queryIsCanDelete: "/team/station/queryIsCanDelete",
down: "/team/station/down", up: "/team/station/up",
delete: "/team/station/delete", down: "/team/station/down",
deleteBatch: "/team/station/deleteBatch", delete: "/team/station/delete",
exportXlsUrl: "/team/station/exportXls", deleteBatch: "/team/station/deleteBatch",
importExcelUrl: "/team/station/importExcel", exportXlsUrl: "/team/station/exportXls",
}, importExcelUrl: "/team/station/importExcel",
} },
}, }
computed: { },
importExcelUrl: function () { computed: {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; importExcelUrl: function () {
} return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}, }
methods: { },
// methods: {
jumpPage1(record) { //
this.$router.push({ getQueryParams(arg) {
path: '/team/StationMachineList',
query: { // //
'stationId': record.id, let sqp = {}
'stationName': record.stationName, if (this.superQueryParams) {
'stationNum': record.stationNum, sqp['superQueryParams'] = encodeURI(this.superQueryParams)
'departName': record.departName, sqp['superQueryMatchType'] = this.superQueryMatchType
}, }
}); var param = Object.assign(sqp, this.queryParam, {}, this.filters)
}, param.field = this.getQueryField()
jumpPage2(record) { param.pageNo = this.ipagination.current
this.$router.push({ param.pageSize = this.ipagination.pageSize
path: '/team/StationToolList', return filterObj(param)
query: { // },
'stationId': record.id, //
'stationName': record.stationName, jumpPage1(record) {
'stationNum': record.stationNum, this.$router.push({
'departName': record.departName, path: '/team/StationMachineList',
}, query: { //
}); 'stationId': record.id,
}, 'stationName': record.stationName,
handleDelete2: function (id) { 'stationNum': record.stationNum,
if (!this.url.queryIsCanDelete) { 'departName': record.departName,
this.$message.error("请设置url.delete属性!") },
return });
} },
// let dataTotal = 0; jumpPage2(record) {
let param = { this.$router.push({
id: id path: '/team/StationToolList',
} query: { //
getAction(this.url.queryIsCanDelete, param).then((res) => { 'stationId': record.id,
console.log("queryIsCanDelete res:" + JSON.stringify(res)); 'stationName': record.stationName,
if (res.success) { 'stationNum': record.stationNum,
if (res.result > 0) { 'departName': record.departName,
this.$message.warning("暂不可删除,子模块正在使用!"); },
return; });
} else { },
var that = this; handleDelete2: function (id) {
deleteAction(that.url.delete, param).then((res) => { if (!this.url.queryIsCanDelete) {
if (res.success) { this.$message.error("请设置url.delete属性!")
// return
that.reCalculatePage(1) }
that.$message.success(res.message); // let dataTotal = 0;
that.loadData(); let param = {
} else { id: id
that.$message.warning(res.message); }
} getAction(this.url.queryIsCanDelete, param).then((res) => {
}); console.log("queryIsCanDelete res:" + JSON.stringify(res));
} if (res.success) {
} if (res.result > 0) {
}) this.$message.warning("暂不可删除,子模块正在使用!");
}, return;
} else {
up(id) { var that = this;
getAction(this.url.up, {id: id}).then((res) => { deleteAction(that.url.delete, param).then((res) => {
if (res.success) { if (res.success) {
this.loadData(); //
this.$message.success(res.message); that.reCalculatePage(1)
} else { that.$message.success(res.message);
this.$message.warning(res.message); that.loadData();
} } else {
}) that.$message.warning(res.message);
}, }
down(id) { });
getAction(this.url.down, {id: id}).then((res) => { }
if (res.success) { }
this.loadData(); })
this.$message.success(res.message); },
} else {
this.$message.warning(res.message); up(id) {
} getAction(this.url.up, {id: id}).then((res) => {
}) if (res.success) {
}, this.loadData();
} this.$message.success(res.message);
} } else {
</script> this.$message.warning(res.message);
<!--<style scoped>--> }
<!--@import '~@assets/less/common.less';--> })
},
down(id) {
getAction(this.url.down, {id: id}).then((res) => {
if (res.success) {
this.loadData();
this.$message.success(res.message);
} else {
this.$message.warning(res.message);
}
})
},
}
}
</script>
<!--<style scoped>-->
<!--@import '~@assets/less/common.less';-->
<!--</style>--> <!--</style>-->

@ -1,173 +1,174 @@
package org.jeecg.modules.demo.sensor.controller; package org.jeecg.modules.demo.sensor.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.sensor.entity.Sensor; import org.jeecg.modules.demo.sensor.entity.Sensor;
import org.jeecg.modules.demo.sensor.service.ISensorService; import org.jeecg.modules.demo.sensor.service.ISensorService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
/** /**
* @Description: 传感器表 * @Description: 传感器表
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2023-02-10 * @Date: 2023-02-10
* @Version: V1.0 * @Version: V1.0
*/ */
@Api(tags="传感器表") @Api(tags="传感器表")
@RestController @RestController
@RequestMapping("/sensor/sensor") @RequestMapping("/sensor/sensor")
@Slf4j @Slf4j
public class SensorController extends JeecgController<Sensor, ISensorService> { public class SensorController extends JeecgController<Sensor, ISensorService> {
@Autowired @Autowired
private ISensorService sensorService; private ISensorService sensorService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param sensor * @param sensor
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @param req * @param req
* @return * @return
*/ */
@AutoLog(value = "传感器表-分页列表查询") @AutoLog(value = "传感器表-分页列表查询")
@ApiOperation(value="传感器表-分页列表查询", notes="传感器表-分页列表查询") @ApiOperation(value="传感器表-分页列表查询", notes="传感器表-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<?> queryPageList(Sensor sensor, public Result<?> queryPageList(Sensor sensor,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<Sensor> queryWrapper = QueryGenerator.initQueryWrapper(sensor, req.getParameterMap()); QueryWrapper<Sensor> queryWrapper = QueryGenerator.initQueryWrapper(sensor, req.getParameterMap());
Page<Sensor> page = new Page<Sensor>(pageNo, pageSize); Page<Sensor> page = new Page<Sensor>(pageNo, pageSize);
IPage<Sensor> pageList = sensorService.page(page, queryWrapper); queryWrapper.orderByAsc("create_time");
return Result.OK(pageList); IPage<Sensor> pageList = sensorService.page(page, queryWrapper);
} return Result.OK(pageList);
}
/**
* 添加 /**
* * 添加
* @param sensor *
* @return * @param sensor
*/ * @return
@AutoLog(value = "传感器表-添加") */
@ApiOperation(value="传感器表-添加", notes="传感器表-添加") @AutoLog(value = "传感器表-添加")
@PostMapping(value = "/add") @ApiOperation(value="传感器表-添加", notes="传感器表-添加")
public Result<?> add(@RequestBody Sensor sensor) { @PostMapping(value = "/add")
sensorService.save(sensor); public Result<?> add(@RequestBody Sensor sensor) {
return Result.OK("添加成功!"); sensorService.save(sensor);
} return Result.OK("添加成功!");
}
/**
* 编辑 /**
* * 编辑
* @param sensor *
* @return * @param sensor
*/ * @return
@AutoLog(value = "传感器表-编辑") */
@ApiOperation(value="传感器表-编辑", notes="传感器表-编辑") @AutoLog(value = "传感器表-编辑")
@PutMapping(value = "/edit") @ApiOperation(value="传感器表-编辑", notes="传感器表-编辑")
public Result<?> edit(@RequestBody Sensor sensor) { @PutMapping(value = "/edit")
sensorService.updateById(sensor); public Result<?> edit(@RequestBody Sensor sensor) {
return Result.OK("编辑成功!"); sensorService.updateById(sensor);
} return Result.OK("编辑成功!");
}
/**
* 通过id删除 /**
* * 通过id删除
* @param id *
* @return * @param id
*/ * @return
@AutoLog(value = "传感器表-通过id删除") */
@ApiOperation(value="传感器表-通过id删除", notes="传感器表-通过id删除") @AutoLog(value = "传感器表-通过id删除")
@DeleteMapping(value = "/delete") @ApiOperation(value="传感器表-通过id删除", notes="传感器表-通过id删除")
public Result<?> delete(@RequestParam(name="id",required=true) String id) { @DeleteMapping(value = "/delete")
sensorService.removeById(id); public Result<?> delete(@RequestParam(name="id",required=true) String id) {
return Result.OK("删除成功!"); sensorService.removeById(id);
} return Result.OK("删除成功!");
}
/**
* 批量删除 /**
* * 批量删除
* @param ids *
* @return * @param ids
*/ * @return
@AutoLog(value = "传感器表-批量删除") */
@ApiOperation(value="传感器表-批量删除", notes="传感器表-批量删除") @AutoLog(value = "传感器表-批量删除")
@DeleteMapping(value = "/deleteBatch") @ApiOperation(value="传感器表-批量删除", notes="传感器表-批量删除")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { @DeleteMapping(value = "/deleteBatch")
this.sensorService.removeByIds(Arrays.asList(ids.split(","))); public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
return Result.OK("批量删除成功!"); this.sensorService.removeByIds(Arrays.asList(ids.split(",")));
} return Result.OK("批量删除成功!");
}
/**
* 通过id查询 /**
* * 通过id查询
* @param id *
* @return * @param id
*/ * @return
@AutoLog(value = "传感器表-通过id查询") */
@ApiOperation(value="传感器表-通过id查询", notes="传感器表-通过id查询") @AutoLog(value = "传感器表-通过id查询")
@GetMapping(value = "/queryById") @ApiOperation(value="传感器表-通过id查询", notes="传感器表-通过id查询")
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { @GetMapping(value = "/queryById")
Sensor sensor = sensorService.getById(id); public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
if(sensor==null) { Sensor sensor = sensorService.getById(id);
return Result.error("未找到对应数据"); if(sensor==null) {
} return Result.error("未找到对应数据");
return Result.OK(sensor); }
} return Result.OK(sensor);
}
/**
* 导出excel /**
* * 导出excel
* @param request *
* @param sensor * @param request
*/ * @param sensor
@RequestMapping(value = "/exportXls") */
public ModelAndView exportXls(HttpServletRequest request, Sensor sensor) { @RequestMapping(value = "/exportXls")
return super.exportXls(request, sensor, Sensor.class, "传感器表"); public ModelAndView exportXls(HttpServletRequest request, Sensor sensor) {
} return super.exportXls(request, sensor, Sensor.class, "传感器表");
}
/**
* 通过excel导入数据 /**
* * 通过excel导入数据
* @param request *
* @param response * @param request
* @return * @param response
*/ * @return
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) */
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
return super.importExcel(request, response, Sensor.class); public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
} return super.importExcel(request, response, Sensor.class);
}
}
}

@ -1,215 +1,216 @@
package org.jeecg.modules.team.controller; package org.jeecg.modules.team.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.system.service.ISysDepartService; import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.team.entity.Station; import org.jeecg.modules.team.entity.Station;
import org.jeecg.modules.team.entity.StationMachine; import org.jeecg.modules.team.entity.StationMachine;
import org.jeecg.modules.team.entity.StationTool; import org.jeecg.modules.team.entity.StationTool;
import org.jeecg.modules.team.service.IStationMachineService; import org.jeecg.modules.team.service.IStationMachineService;
import org.jeecg.modules.team.service.IStationService; import org.jeecg.modules.team.service.IStationService;
import org.jeecg.modules.team.service.IStationToolService; import org.jeecg.modules.team.service.IStationToolService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @Description: 车间工位管理 * @Description: 车间工位管理
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2022-12-05 * @Date: 2022-12-05
* @Version: V1.0 * @Version: V1.0
*/ */
@Slf4j @Slf4j
@Api(tags = "车间工位管理") @Api(tags = "车间工位管理")
@RestController @RestController
@RequestMapping("/team/station") @RequestMapping("/team/station")
public class StationController extends JeecgController<Station, IStationService> { public class StationController extends JeecgController<Station, IStationService> {
@Autowired @Autowired
private IStationService stationService; private IStationService stationService;
@Autowired @Autowired
private ISysDepartService iSysDepartService; private ISysDepartService iSysDepartService;
@Autowired @Autowired
private IStationToolService iStationToolService; private IStationToolService iStationToolService;
@Autowired @Autowired
private IStationMachineService iStationMachineService; private IStationMachineService iStationMachineService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param station * @param station
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @param req * @param req
* @return * @return
*/ */
@AutoLog(value = "车间工位管理-分页列表查询") @AutoLog(value = "车间工位管理-分页列表查询")
@ApiOperation(value = "车间工位管理-分页列表查询", notes = "车间工位管理-分页列表查询") @ApiOperation(value = "车间工位管理-分页列表查询", notes = "车间工位管理-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<?> queryPageList(Station station, public Result<?> queryPageList(Station station,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<Station> queryWrapper = QueryGenerator.initQueryWrapper(station, req.getParameterMap()); QueryWrapper<Station> queryWrapper = QueryGenerator.initQueryWrapper(station, req.getParameterMap());
Page<Station> page = new Page<Station>(pageNo, pageSize); Page<Station> page = new Page<Station>(pageNo, pageSize);
IPage<Station> pageList = stationService.page(page, queryWrapper); queryWrapper.orderByAsc("station_num");
if (!ObjectUtils.isEmpty(pageList.getRecords())) { IPage<Station> pageList = stationService.page(page, queryWrapper);
List<Station> records = pageList.getRecords(); if (!ObjectUtils.isEmpty(pageList.getRecords())) {
//按工位序号顺序排序 List<Station> records = pageList.getRecords();
Collections.sort(records, Comparator.comparingInt(Station::getStationNum)); //按工位序号顺序排序
List<String> ids = records.stream().map(o -> o.getDepartId()).collect(Collectors.toList()); Collections.sort(records, Comparator.comparingInt(Station::getStationNum));
List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().in(SysDepart::getId, ids)); List<String> ids = records.stream().map(o -> o.getDepartId()).collect(Collectors.toList());
records.stream().forEach(e -> { List<SysDepart> departList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().in(SysDepart::getId, ids));
List<StationTool> stationTools = iStationToolService.list(new LambdaQueryWrapper<StationTool>().eq(StationTool::getStationId, e.getId())); records.stream().forEach(e -> {
e.setToolsIds(stationTools.stream().map(StationTool::getToolsId).collect(Collectors.joining(","))); List<StationTool> stationTools = iStationToolService.list(new LambdaQueryWrapper<StationTool>().eq(StationTool::getStationId, e.getId()));
List<StationMachine> machineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, e.getId())); e.setToolsIds(stationTools.stream().map(StationTool::getToolsId).collect(Collectors.joining(",")));
e.setMachineIds(machineList.stream().map(StationMachine::getMachineId).collect(Collectors.joining(","))); List<StationMachine> machineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, e.getId()));
departList.forEach(j -> { e.setMachineIds(machineList.stream().map(StationMachine::getMachineId).collect(Collectors.joining(",")));
if (e.getDepartId().equals(j.getId())) { departList.forEach(j -> {
e.setDepartName(j.getDepartName()); if (e.getDepartId().equals(j.getId())) {
return; e.setDepartName(j.getDepartName());
} return;
}); }
}); });
} });
return Result.OK(pageList); }
} return Result.OK(pageList);
}
@ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除")
@GetMapping(value = "/queryIsCanDelete") @ApiOperation(value = "车间工位管理-查询车间工位能否删除", notes = "车间工位管理-查询车间工位能否删除")
public Result<?> queryIsCanDelete(Station station, @GetMapping(value = "/queryIsCanDelete")
HttpServletRequest req) { public Result<?> queryIsCanDelete(Station station,
return Result.OK(stationService.queryIsCanDelete(station)); HttpServletRequest req) {
} return Result.OK(stationService.queryIsCanDelete(station));
}
/**
* 添加 /**
* * 添加
* @param station *
* @return * @param station
*/ * @return
@AutoLog(value = "车间工位管理-添加") */
@ApiOperation(value = "车间工位管理-添加", notes = "车间工位管理-添加") @AutoLog(value = "车间工位管理-添加")
@PostMapping(value = "/add") @ApiOperation(value = "车间工位管理-添加", notes = "车间工位管理-添加")
public Result<?> add(@RequestBody Station station) { @PostMapping(value = "/add")
stationService.save(station); public Result<?> add(@RequestBody Station station) {
return Result.OK("添加成功!"); stationService.save(station);
} return Result.OK("添加成功!");
}
/**
* 编辑 /**
* * 编辑
* @param station *
* @return * @param station
*/ * @return
@AutoLog(value = "车间工位管理-编辑") */
@ApiOperation(value = "车间工位管理-编辑", notes = "车间工位管理-编辑") @AutoLog(value = "车间工位管理-编辑")
@PutMapping(value = "/edit") @ApiOperation(value = "车间工位管理-编辑", notes = "车间工位管理-编辑")
public Result<?> edit(@RequestBody Station station) { @PutMapping(value = "/edit")
stationService.updateById(station); public Result<?> edit(@RequestBody Station station) {
return Result.OK("编辑成功!"); stationService.updateById(station);
} return Result.OK("编辑成功!");
}
/**
* 通过id删除 /**
* * 通过id删除
* @param id *
* @return * @param id
*/ * @return
@AutoLog(value = "车间工位管理-通过id删除") */
@ApiOperation(value = "车间工位管理-通过id删除", notes = "车间工位管理-通过id删除") @AutoLog(value = "车间工位管理-通过id删除")
@DeleteMapping(value = "/delete") @ApiOperation(value = "车间工位管理-通过id删除", notes = "车间工位管理-通过id删除")
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { @DeleteMapping(value = "/delete")
stationService.removeById(id); public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
return Result.OK("删除成功!"); stationService.removeById(id);
} return Result.OK("删除成功!");
}
/**
* 批量删除 /**
* * 批量删除
* @param ids *
* @return * @param ids
*/ * @return
@AutoLog(value = "车间工位管理-批量删除") */
@ApiOperation(value = "车间工位管理-批量删除", notes = "车间工位管理-批量删除") @AutoLog(value = "车间工位管理-批量删除")
@DeleteMapping(value = "/deleteBatch") @ApiOperation(value = "车间工位管理-批量删除", notes = "车间工位管理-批量删除")
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { @DeleteMapping(value = "/deleteBatch")
this.stationService.removeByIds(Arrays.asList(ids.split(","))); public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
return Result.OK("批量删除成功!"); this.stationService.removeByIds(Arrays.asList(ids.split(",")));
} return Result.OK("批量删除成功!");
}
/**
* 通过id查询 /**
* * 通过id查询
* @param id *
* @return * @param id
*/ * @return
@AutoLog(value = "车间工位管理-通过id查询") */
@ApiOperation(value = "车间工位管理-通过id查询", notes = "车间工位管理-通过id查询") @AutoLog(value = "车间工位管理-通过id查询")
@GetMapping(value = "/queryById") @ApiOperation(value = "车间工位管理-通过id查询", notes = "车间工位管理-通过id查询")
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { @GetMapping(value = "/queryById")
Station station = stationService.getById(id); public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
return Result.OK(station); Station station = stationService.getById(id);
} return Result.OK(station);
}
/**
* 导出excel /**
* * 导出excel
* @param request *
* @param station * @param request
*/ * @param station
@RequestMapping(value = "/exportXls") */
public ModelAndView exportXls(HttpServletRequest request, Station station) { @RequestMapping(value = "/exportXls")
return super.exportXls(request, station, Station.class, "车间工位管理"); public ModelAndView exportXls(HttpServletRequest request, Station station) {
} return super.exportXls(request, station, Station.class, "车间工位管理");
}
/**
* 通过excel导入数据 /**
* * 通过excel导入数据
* @param request *
* @param response * @param request
* @return * @param response
*/ * @return
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) */
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
return super.importExcel(request, response, Station.class); public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
} return super.importExcel(request, response, Station.class);
}
@ApiOperation(value = "排序", notes = "排序")
@GetMapping(value = "/up") @ApiOperation(value = "排序", notes = "排序")
public Result<?> up(@RequestParam(name = "id", required = true) String id) { @GetMapping(value = "/up")
stationService.up(id); public Result<?> up(@RequestParam(name = "id", required = true) String id) {
return Result.OK(); stationService.up(id);
} return Result.OK();
}
@AutoLog(value = "排序")
@ApiOperation(value = "排序", notes = "排序") @AutoLog(value = "排序")
@GetMapping(value = "/down") @ApiOperation(value = "排序", notes = "排序")
public Result<?> down(@RequestParam(name = "id", required = true) String id) { @GetMapping(value = "/down")
stationService.down(id); public Result<?> down(@RequestParam(name = "id", required = true) String id) {
return Result.OK(); stationService.down(id);
} return Result.OK();
}
}
}

Loading…
Cancel
Save