Commit 7185f1e3 by chenjunxiong

build(server): 门禁设备配置功能开发

parent 04092c3e
......@@ -4,34 +4,86 @@
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="4" :lg="4" :md="5" :sm="24">
<a-form-item label="选择楼栋">
<a-select placeholder="选择楼栋" v-model="queryParam.buildingName" @change="buildingChange">
<a-select-option v-for="buildingInfo in buildingInfos" :key="buildingInfo.name">
{{ buildingInfo.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="4" :md="5" :sm="24">
<a-form-item label="选择楼层">
<a-select placeholder="选择楼层" v-model="queryParam.floor">
<a-select-option v-for="floor in targetFloorList" :key="floor">
{{ floor }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="4" :md="5" :sm="24">
<a-form-item label="设备类型">
<a-select placeholder="设备类型" v-model="queryParam.type">
<a-select-option v-for="type in types" :key="type">
{{ type }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="4" :md="5" :sm="24">
<a-form-item label="设备名称">
<j-input placeholder="请输入设备名称" v-model="queryParam.buildingName"></j-input>
</a-form-item>
</a-col>
<a-col :xl="4" :lg="4" :md="5" :sm="24">
<a-space style="float: left">
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button type="default" @click="searchReset">重置</a-button>
</a-space>
</a-col>
<a-col :xl="4" :lg="4" :md="5" :sm="24">
<a-space style="float: right">
<a-button @click="handleAdd" type="primary">新增</a-button>
<a-button @click="handleExportXls('pm_access_control_device')" type="primary">导出</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<!--<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('pm_access_control_device')">导出</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-upload>
<!-- 高级查询区域 -->
<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
&lt;!&ndash; 高级查询区域 &ndash;&gt;
<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-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-button style="margin-left: 8px"> 批量操作
<a-icon type="down"/>
</a-button>
</a-dropdown>
</div>
</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>
<!--<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>
</div>-->
<a-table
ref="table"
......@@ -52,7 +104,8 @@
</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;"/>
<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>
......@@ -70,9 +123,9 @@
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-divider type="vertical"/>
<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-item>
<a @click="handleDetail(record)">详情</a>
......@@ -95,182 +148,167 @@
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import PmAccessControlDeviceModal from './modules/PmAccessControlDeviceModal'
import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import PmAccessControlDeviceModal from './modules/PmAccessControlDeviceModal'
import {getAction} from '@/api/manage'
export default {
name: 'PmAccessControlDeviceList',
mixins:[JeecgListMixin, mixinDevice],
components: {
PmAccessControlDeviceModal
},
data () {
return {
description: 'pm_access_control_device管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title:'设备编码',
align:"center",
dataIndex: 'code'
},
{
title:'设备名称',
align:"center",
dataIndex: 'name'
},
{
title:'设备ip',
align:"center",
dataIndex: 'ip'
},
{
title:'楼栋',
align:"center",
dataIndex: 'buildingName'
},
{
title:'楼层',
align:"center",
dataIndex: 'floor'
},
{
title:'设备位置',
align:"center",
dataIndex: 'place'
},
{
title:'xy值',
align:"center",
dataIndex: 'coordinate'
},
{
title:'开门时间',
align:"center",
dataIndex: 'doorOpenTime'
},
{
title:'生产日期',
align:"center",
dataIndex: 'dateOfProduction',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title:'安装日期',
align:"center",
dataIndex: 'installationDate',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title:'保修截止日期',
align:"center",
dataIndex: 'warrantyPeriod',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title:'生产厂商',
align:"center",
dataIndex: 'manufacturer',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
export default {
name: 'PmAccessControlDeviceList',
mixins: [JeecgListMixin, mixinDevice],
components: {
PmAccessControlDeviceModal
},
data() {
return {
description: 'pm_access_control_device管理页面',
// 表头
columns: [
{
title: '序号',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: "center",
customRender: function (t, r, index) {
return parseInt(index) + 1;
}
},
{
title: '设备编码',
align: "center",
dataIndex: 'code'
},
{
title: '设备类型',
align: "center",
dataIndex: 'type'
},
{
title: '设备名称',
align: "center",
dataIndex: 'name'
},
{
title: '设备ip',
align: "center",
dataIndex: 'ip'
},
{
title: '楼栋',
align: "center",
dataIndex: 'buildingName'
},
{
title: '楼层',
align: "center",
dataIndex: 'floor'
},
{
title: '设备位置',
align: "center",
dataIndex: 'place'
},
{
title: 'xy值',
align: "center",
dataIndex: 'coordinate',
customRender(t, r, index) {
if (t) {
return t.x + ',' + t.y;
}
},
{
title:'状态',
align:"center",
dataIndex: 'status'
},
{
title:'创建人Id(sys_user)',
align:"center",
dataIndex: 'createUserId'
},
{
title:'修改人Id(sys_user)',
align:"center",
dataIndex: 'modifyUserId'
},
{
title:'修改时间',
align:"center",
dataIndex: 'modifyTime',
customRender:function (text) {
return !text?"":(text.length>10?text.substr(0,10):text)
}
},
{
title: '开门时间',
align: "center",
dataIndex: 'doorOpenTime',
customRender(t, r, index) {
return t + 's';
},
{
title: '操作',
dataIndex: 'action',
align:"center",
fixed:"right",
width:147,
scopedSlots: { customRender: 'action' }
}
],
url: {
list: "/pm/pmAccessControlDevice/list",
delete: "/pm/pmAccessControlDevice/delete",
deleteBatch: "/pm/pmAccessControlDevice/deleteBatch",
exportXlsUrl: "/pm/pmAccessControlDevice/exportXls",
importExcelUrl: "pm/pmAccessControlDevice/importExcel",
},
dictOptions:{},
superFieldList:[],
}
},
created() {
{
title: '创建人',
align: "center",
dataIndex: 'createUserId_dictText'
},
{
title: '创建时间',
align: "center",
dataIndex: 'createTime'
},
{
title: '操作',
dataIndex: 'action',
align: "center",
fixed: "right",
width: 147,
scopedSlots: {customRender: 'action'}
}
],
url: {
list: "/pm/pmAccessControlDevice/list",
delete: "/pm/pmAccessControlDevice/delete",
deleteBatch: "/pm/pmAccessControlDevice/deleteBatch",
exportXlsUrl: "/pm/pmAccessControlDevice/exportXls",
importExcelUrl: "pm/pmAccessControlDevice/importExcel",
},
dictOptions: {},
superFieldList: [],
buildingInfos: [],
targetFloorList: [],
types: [],
}
},
created() {
this.getSuperFieldList();
getAction('/pm/pmBuildingInfo/list')
.then(value => this.buildingInfos = value.result);
getAction('/pm/pmAccessControlDevice/types')
.then(value => this.types = value.result);
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
initDictConfig() {
},
methods: {
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'code',text:'设备编码'})
fieldList.push({type:'string',value:'name',text:'设备名称'})
fieldList.push({type:'string',value:'ip',text:'设备ip'})
fieldList.push({type:'string',value:'buildingName',text:'楼栋'})
fieldList.push({type:'int',value:'floor',text:'楼层'})
fieldList.push({type:'string',value:'place',text:'设备位置'})
fieldList.push({type:'string',value:'coordinate',text:'xy值'})
fieldList.push({type:'int',value:'doorOpenTime',text:'开门时间'})
fieldList.push({type:'date',value:'dateOfProduction',text:'生产日期'})
fieldList.push({type:'date',value:'installationDate',text:'安装日期'})
fieldList.push({type:'date',value:'warrantyPeriod',text:'保修截止日期'})
fieldList.push({type:'date',value:'manufacturer',text:'生产厂商'})
fieldList.push({type:'string',value:'status',text:'状态'})
fieldList.push({type:'string',value:'createUserId',text:'创建人Id(sys_user)'})
fieldList.push({type:'string',value:'modifyUserId',text:'修改人Id(sys_user)'})
fieldList.push({type:'date',value:'modifyTime',text:'修改时间'})
this.superFieldList = fieldList
getSuperFieldList() {
let fieldList = [];
fieldList.push({type: 'string', value: 'code', text: '设备编码'})
fieldList.push({type: 'string', value: 'name', text: '设备名称'})
fieldList.push({type: 'string', value: 'ip', text: '设备ip'})
fieldList.push({type: 'string', value: 'buildingName', text: '楼栋'})
fieldList.push({type: 'int', value: 'floor', text: '楼层'})
fieldList.push({type: 'string', value: 'place', text: '设备位置'})
fieldList.push({type: 'string', value: 'coordinate', text: 'xy值'})
fieldList.push({type: 'int', value: 'doorOpenTime', text: '开门时间'})
fieldList.push({type: 'date', value: 'dateOfProduction', text: '生产日期'})
fieldList.push({type: 'date', value: 'installationDate', text: '安装日期'})
fieldList.push({type: 'date', value: 'warrantyPeriod', text: '保修截止日期'})
fieldList.push({type: 'date', value: 'manufacturer', text: '生产厂商'})
fieldList.push({type: 'string', value: 'status', text: '状态'})
fieldList.push({type: 'string', value: 'createUserId', text: '创建人Id(sys_user)'})
fieldList.push({type: 'string', value: 'modifyUserId', text: '修改人Id(sys_user)'})
fieldList.push({type: 'date', value: 'modifyTime', text: '修改时间'})
this.superFieldList = fieldList
},
buildingChange(value) {
let targetList = this.buildingInfos.filter(buildingInfo => buildingInfo.name === value);
if (targetList != null && targetList.length > 0) {
this.targetFloorList = targetList[0].floorList;
} else {
this.targetFloorList = [];
}
}
},
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>
\ No newline at end of file
......@@ -3,87 +3,102 @@
<j-form-container :disabled="formDisabled">
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
<a-row>
<a-col :span="24">
<a-col :span="12">
<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-col :span="12">
<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-col :span="12">
<a-form-model-item label="设备ip" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ip">
<a-input v-model="model.ip" placeholder="请输入设备ip"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="楼栋" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="buildingName">
<a-input v-model="model.buildingName" placeholder="请输入楼栋"></a-input>
<a-col :span="12">
<a-form-model-item label="设备类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ip">
<a-select placeholder="选择设备类型" v-model="model.type">
<a-select-option v-for="type in types" :key="type">
{{ type }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="楼层" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="floor">
<a-input-number v-model="model.floor" placeholder="请输入楼层" style="width: 100%"/>
<a-col :span="12">
<a-form-model-item label="楼栋" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="buildingName">
<a-select placeholder="选择楼栋" v-model="model.buildingName" @change="buildingChange">
<a-select-option v-for="buildingInfo in buildingInfos" :key="buildingInfo.name">
{{ buildingInfo.name }}
</a-select-option>
</a-select>
</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-col :span="12">
<a-form-model-item label="楼层" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="floor">
<a-select placeholder="选择楼层" v-model="model.floor">
<a-select-option v-for="floor in targetFloorList" :key="floor">
{{ floor }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="xy值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="coordinate">
<a-input v-model="model.coordinate" placeholder="请输入xy值"></a-input>
<a-col :span="12">
<a-form-model-item label="开门时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="doorOpenTime">
<a-input-number :min="0" :formatter="value => `${value}s`"
:parser="value => value.replace('s', '')" v-model="model.doorOpenTime"
placeholder="请输入开门时间" style="width: 100%" suffix="RMB"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="开门时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="doorOpenTime">
<a-input-number v-model="model.doorOpenTime" placeholder="请输入开门时间" style="width: 100%"/>
<a-col :span="12">
<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-col :span="24">
<a-form-model-item label="产日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dateOfProduction">
<a-col :span="12">
<a-form-model-item label="产日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dateOfProduction">
<j-date placeholder="请选择生产日期" v-model="model.dateOfProduction" style="width: 100%"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-col :span="12">
<a-form-model-item label="安装日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="installationDate">
<j-date placeholder="请选择安装日期" v-model="model.installationDate" style="width: 100%"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="保修截止日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warrantyPeriod">
<j-date placeholder="请选择保修截止日期" v-model="model.warrantyPeriod" style="width: 100%"/>
<a-col :span="12">
<a-form-model-item label="生产厂商" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manufacturer">
<a-input v-model="model.manufacturer" 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-date placeholder="请选择生产厂商" v-model="model.manufacturer" style="width: 100%"/>
<a-col :span="12">
<a-form-model-item label="保修截止日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warrantyPeriod">
<j-date placeholder="请选择保修截止日期" v-model="model.warrantyPeriod" style="width: 100%"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-col :span="12">
<a-form-model-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="status">
<a-input v-model="model.status" placeholder="请输入状态"></a-input>
<a-select placeholder="选择状态" v-model="model.status" @change="statusChange">
<a-select-option v-for="status in statusList" :key="status.value">
{{ status.name }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="创建人Id(sys_user)" :labelCol="labelCol" :wrapperCol="wrapperCol"
prop="createUserId">
<a-input v-model="model.createUserId" placeholder="请输入创建人Id(sys_user)"></a-input>
<a-col :span="12">
<a-form-model-item label="xy值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="coordinateTmp">
<a-input v-model="model.coordinateTmp" disabled></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="修改人Id(sys_user)" :labelCol="labelCol" :wrapperCol="wrapperCol"
prop="modifyUserId">
<a-input v-model="model.modifyUserId" placeholder="请输入修改人Id(sys_user)"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="修改时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modifyTime">
<j-date placeholder="请选择修改时间" v-model="model.modifyTime" style="width: 100%"/>
</a-form-model-item>
<div style="position: relative">
<img src="@/assets/floor.png" alt="floor" width="100%" height="100%"
@click="imgClick($event)" @load="floorImgLoadComplete($event)"/>
<img :src="doorIconPath" alt="door"
:style="doorIconStyle"
v-show="doorIconPath"/>
</div>
</a-col>
</a-row>
</a-form-model>
......@@ -109,7 +124,10 @@ export default {
},
data() {
return {
model: {},
model: {
doorOpenTime: 0,
coordinateTmp: null,
},
labelCol: {
xs: {span: 24},
sm: {span: 5},
......@@ -119,12 +137,125 @@ export default {
sm: {span: 16},
},
confirmLoading: false,
validatorRules: {},
validatorRules: {
code: [
{
required: true,
message: '请输入设备编码',
trigger: 'blur'
}
],
name: [
{
required: true,
message: '请输入设备名称',
trigger: 'blur'
}
],
ip: [
{
required: true,
message: '请输入设备ip',
trigger: 'blur'
}
],
type: [
{
required: true,
message: '选择设备类型',
trigger: 'change'
}
],
buildingName: [
{
required: true,
message: '选择楼栋',
trigger: 'change'
}
],
floor: [
{
required: true,
message: '选择楼层',
trigger: 'change'
}
],
doorOpenTime: [
{
required: true,
message: '请输入开门时间',
trigger: 'blur'
}
],
place: [
{
required: true,
message: '请输入设备位置',
trigger: 'blur'
}
],
dateOfProduction: [
{
required: true,
message: '请选择生产日期',
trigger: 'change'
}
],
installationDate: [
{
required: true,
message: '请选择安装日期',
trigger: 'change'
}
],
manufacturer: [
{
required: true,
message: '请输入生产厂商',
trigger: 'blur'
}
],
warrantyPeriod: [
{
required: true,
message: '请选择保修截止日期',
trigger: 'change'
}
],
status: [
{
required: true,
message: '选择状态',
trigger: 'change'
}
],
coordinateTmp: [
{
required: true,
message: '请点击平面图设置设备坐标',
trigger: ['change', 'blur']
}
],
},
url: {
add: "/pm/pmAccessControlDevice/add",
edit: "/pm/pmAccessControlDevice/edit",
queryById: "/pm/pmAccessControlDevice/queryById"
}
},
statusList: [
{name: '正常', value: 'NORMAL', imgPath: require('@/assets/door-close.png')},
{name: '离线', value: 'OFFLINE', imgPath: require('@/assets/door-offline.png')},
{name: '损坏', value: 'BREAKDOWN', imgPath: require('@/assets/door-breakdown.png')}],
doorIconStyle: {
position: 'absolute',
top: '0px',
left: '0px',
width: '40px'
},
doorIconPath: null,
buildingInfos: [],
targetFloorList: [],
types: [],
}
},
computed: {
......@@ -135,6 +266,10 @@ export default {
created() {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
getAction('/pm/pmBuildingInfo/list')
.then(value => this.buildingInfos = value.result);
getAction('/pm/pmAccessControlDevice/types')
.then(value => this.types = value.result);
},
methods: {
add() {
......@@ -153,12 +288,24 @@ export default {
let httpurl = '';
let method = '';
if (!this.model.id) {
// 设置创建用户Id
this.model.createUserId = this.$store.getters.userInfo.id;
httpurl += this.url.add;
method = 'post';
} else {
httpurl += this.url.edit;
method = 'put';
}
// 初始化坐标对象并赋值
let coordinate = this.model.coordinateTmp.split(',');
this.model.coordinate = {
x: coordinate[0],
y: coordinate[1]
}
// 设置修改用户Id
this.model.modifyUserId = this.$store.getters.userInfo.id;
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message);
......@@ -170,9 +317,51 @@ export default {
that.confirmLoading = false;
})
}
})
},
imgClick(e) {
// 获取点击目标的x,y坐标
let target = e.target;
let fixX = target.x;
let fixY = target.y;
console.log(fixX, fixY);
console.log(e.x, e.y);
let offsetWidth = target.offsetWidth;
let offsetHeight = target.offsetHeight;
let offsetX = (e.x - fixX);
let offsetY = (e.y - fixY);
this.doorIconStyle.top = offsetY - 20 + 'px';
this.doorIconStyle.left = offsetX - 20 + 'px';
let x = ((e.x - fixX) / offsetWidth).toFixed(4);
let y = ((e.y - fixY) / offsetHeight).toFixed(4);
this.model.coordinateTmp = x + "," + y;
this.$refs.form.validateField('coordinateTmp');
},
statusChange(value) {
let targetList = this.statusList.filter(status => status.value === value);
this.doorIconPath = targetList.length > 0 ? targetList[0].imgPath : null;
},
buildingChange(value) {
let targetList = this.buildingInfos.filter(buildingInfo => buildingInfo.name === value);
if (targetList != null && targetList.length > 0) {
this.targetFloorList = targetList[0].floorList;
} else {
this.targetFloorList = [];
}
},
floorImgLoadComplete(e) {
if (this.model.coordinate) {
this.model.coordinateTmp = this.model.coordinate.x + ',' + this.model.coordinate.y;
this.statusChange(this.model.status);
let target = e.target;
let fixX = 20;
let fixY = 20;
let offsetWidth = target.offsetWidth;
let offsetHeight = target.offsetHeight;
this.doorIconStyle.top = this.model.coordinate.y * offsetHeight - fixY + 'px'
this.doorIconStyle.left = this.model.coordinate.x * offsetWidth - fixX + 'px';
}
},
}
}
</script>
\ No newline at end of file
......@@ -23,7 +23,7 @@
data () {
return {
title:'',
width:800,
width:1400,
visible: false,
disableSubmit: false
}
......
......@@ -19,6 +19,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
/**
* @Description: pm_access_control_device
......@@ -31,6 +32,9 @@ import java.util.Arrays;
@RequestMapping("/pm/pmAccessControlDevice")
@Slf4j
public class PmAccessControlDeviceController extends JeecgController<PmAccessControlDevice, IPmAccessControlDeviceService> {
private static final List<String> TYPES = Arrays.asList("type-1", "type-2", "type-3");
@Autowired
private IPmAccessControlDeviceService pmAccessControlDeviceService;
......@@ -51,7 +55,7 @@ public class PmAccessControlDeviceController extends JeecgController<PmAccessCon
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<PmAccessControlDevice> queryWrapper = QueryGenerator.initQueryWrapper(pmAccessControlDevice, req.getParameterMap());
Page<PmAccessControlDevice> page = new Page<PmAccessControlDevice>(pageNo, pageSize);
Page<PmAccessControlDevice> page = new Page<>(pageNo, pageSize);
IPage<PmAccessControlDevice> pageList = pmAccessControlDeviceService.page(page, queryWrapper);
return Result.OK(pageList);
}
......@@ -152,4 +156,8 @@ public class PmAccessControlDeviceController extends JeecgController<PmAccessCon
return super.importExcel(request, response, PmAccessControlDevice.class);
}
@GetMapping("/types")
public Result<List<String>> getTypes() {
return Result.OK(TYPES);
}
}
package org.jeecg.modules.demo.pm.controller;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.pm.entity.PmBuildingInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author 陈俊雄
* @since 2022/3/17
*/
@Api(tags = "pm_access_control_device")
@RestController
@RequestMapping("/pm/pmBuildingInfo")
@Slf4j
public class PmBuildingInfoController {
private static final List<PmBuildingInfo> BUILDING_INFOS = Arrays.asList(
new PmBuildingInfo()
.setName("望海路1号楼")
.setFloorList(Arrays.asList("-2F", "-1F", "1F", "2F", "3F")),
new PmBuildingInfo()
.setName("望海路2号楼")
.setFloorList(Arrays.asList("-3F", "-2F", "-1F", "1F", "2F", "3F", "4F"))
);
@GetMapping("/list")
public Result<List<PmBuildingInfo>> list() {
return Result.OK(BUILDING_INFOS);
}
}
package org.jeecg.modules.demo.pm.entity;
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import com.chanjx.utils.JsonUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author 陈俊雄
* @since 2022/3/17
*/
@Slf4j
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Coordinate implements Serializable {
private Float x;
private Float y;
@Slf4j
public static class TypeHandler extends AbstractJsonTypeHandler<Coordinate> {
@Override
protected Coordinate parse(String json) {
try {
return JsonUtils.json2Obj(json, Coordinate.class);
} catch (JsonProcessingException e) {
log.error("Json反序列化失败!", e);
}
return null;
}
@Override
protected String toJson(Coordinate obj) {
try {
return JsonUtils.obj2Json(obj);
} catch (JsonProcessingException e) {
log.error("Json序列化失败!", e);
}
return null;
}
}
}
package org.jeecg.modules.demo.pm.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -9,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
......@@ -22,7 +24,7 @@ import java.util.Date;
* @Version: V1.0
*/
@Data
@TableName("pm_access_control_device")
@TableName(value = "pm_access_control_device", autoResultMap = true)
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "pm_access_control_device对象", description = "pm_access_control_device")
......@@ -42,6 +44,12 @@ public class PmAccessControlDevice implements Serializable {
@ApiModelProperty(value = "设备编码")
private String code;
/**
* 设备类型
*/
@Excel(name = "设备类型", width = 15)
@ApiModelProperty(value = "设备类型")
private String type;
/**
* 设备名称
*/
@Excel(name = "设备名称", width = 15)
......@@ -64,7 +72,7 @@ public class PmAccessControlDevice implements Serializable {
*/
@Excel(name = "楼层", width = 15)
@ApiModelProperty(value = "楼层")
private Integer floor;
private String floor;
/**
* 设备位置
*/
......@@ -76,7 +84,8 @@ public class PmAccessControlDevice implements Serializable {
*/
@Excel(name = "xy值", width = 15)
@ApiModelProperty(value = "xy值")
private String coordinate;
@TableField(typeHandler = Coordinate.TypeHandler.class)
private Coordinate coordinate;
/**
* 开门时间
*/
......@@ -110,11 +119,9 @@ public class PmAccessControlDevice implements Serializable {
/**
* 生产厂商
*/
@Excel(name = "生产厂商", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产厂商", width = 15)
@ApiModelProperty(value = "生产厂商")
private Date manufacturer;
private String manufacturer;
/**
* 状态
*/
......@@ -126,17 +133,19 @@ public class PmAccessControlDevice implements Serializable {
*/
@Excel(name = "创建人Id(sys_user)", width = 15)
@ApiModelProperty(value = "创建人Id(sys_user)")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id")
private String createUserId;
/**
* 修改人Id(sys_user)
*/
@Excel(name = "修改人Id(sys_user)", width = 15)
@ApiModelProperty(value = "修改人Id(sys_user)")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id")
private String modifyUserId;
/**
* 创建时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd hh:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "创建时间")
private Date createTime;
......
package org.jeecg.modules.demo.pm.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author 陈俊雄
* @since 2022/3/17
*/
@Slf4j
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class PmBuildingInfo implements Serializable {
private String name;
private List<String> floorList;
}
package org.jeecg.modules.demo.pm.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -9,6 +10,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
......@@ -22,7 +24,7 @@ import java.util.Date;
* @Version: V1.0
*/
@Data
@TableName("pm_monitoring_device")
@TableName(value = "pm_monitoring_device", autoResultMap = true)
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "pm_monitoring_device对象", description = "pm_monitoring_device")
......@@ -42,6 +44,12 @@ public class PmMonitoringDevice implements Serializable {
@ApiModelProperty(value = "设备编码")
private String code;
/**
* 设备类型
*/
@Excel(name = "设备类型", width = 15)
@ApiModelProperty(value = "设备类型")
private String type;
/**
* 设备名称
*/
@Excel(name = "设备名称", width = 15)
......@@ -64,7 +72,7 @@ public class PmMonitoringDevice implements Serializable {
*/
@Excel(name = "楼层", width = 15)
@ApiModelProperty(value = "楼层")
private Integer floor;
private String floor;
/**
* 设备位置
*/
......@@ -76,7 +84,8 @@ public class PmMonitoringDevice implements Serializable {
*/
@Excel(name = "xy值", width = 15)
@ApiModelProperty(value = "xy值")
private String coordinate;
@TableField(typeHandler = Coordinate.TypeHandler.class)
private Coordinate coordinate;
/**
* 生产日期
*/
......@@ -104,11 +113,9 @@ public class PmMonitoringDevice implements Serializable {
/**
* 生产厂商
*/
@Excel(name = "生产厂商", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产厂商", width = 15)
@ApiModelProperty(value = "生产厂商")
private Date manufacturer;
private String manufacturer;
/**
* 状态
*/
......@@ -120,12 +127,14 @@ public class PmMonitoringDevice implements Serializable {
*/
@Excel(name = "创建人Id(sys_user)", width = 15)
@ApiModelProperty(value = "创建人Id(sys_user)")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id")
private String createUserId;
/**
* 修改人Id(sys_user)
*/
@Excel(name = "修改人Id(sys_user)", width = 15)
@ApiModelProperty(value = "修改人Id(sys_user)")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id")
private String modifyUserId;
/**
* 创建时间
......
package org.jeecg.modules.demo.pm.service.impl;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.jeecg.modules.demo.pm.entity.PmAccessControlDevice;
import org.jeecg.modules.demo.pm.mapper.PmAccessControlDeviceMapper;
import org.jeecg.modules.demo.pm.service.IPmAccessControlDeviceService;
......@@ -7,6 +8,8 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Date;
/**
* @Description: pm_access_control_device
* @Author: jeecg-boot
......@@ -15,5 +18,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
*/
@Service
public class PmAccessControlDeviceServiceImpl extends ServiceImpl<PmAccessControlDeviceMapper, PmAccessControlDevice> implements IPmAccessControlDeviceService {
@Override
public boolean save(PmAccessControlDevice entity) {
entity.setId(IdWorker.getId())
.setCreateTime(new Date())
.setModifyTime(new Date());
return super.save(entity);
}
@Override
public boolean updateById(PmAccessControlDevice entity) {
entity.setModifyTime(new Date());
return super.updateById(entity);
}
}
package org.jeecg.modules.system.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment