| | |
| | | return R.ok(basMapService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @GetMapping("/basMap/payload/{id}/auth") |
| | | @ManagerAuth |
| | | public R getPayload(@PathVariable("id") Integer id) { |
| | | BasMap basMap = basMapService.selectPayloadById(id); |
| | | if (basMap == null) { |
| | | return R.error("地图不存在"); |
| | | } |
| | | return R.ok(basMap); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basMap/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1")Integer curr, |
| | |
| | | allLike(BasMap.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));} |
| | | wrapper.orderBy(true, true, "lev"); |
| | | return R.ok(basMapService.page(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(basMapService.pageLight(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, QueryWrapper<T> wrapper){ |
| | |
| | | |
| | | boolean deleteByLev(Integer lev);//删除指定楼层地图 |
| | | |
| | | BasMap selectPayloadById(Integer id);//按id查询地图大字段 |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.entity.BasMap; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | int syncLocMastByMap(Integer lev);//按地图同步指定楼层locType |
| | | |
| | | IPage<BasMap> pageLight(Page<BasMap> page, QueryWrapper<BasMap> wrapper);//轻量分页查询 |
| | | |
| | | BasMap selectPayloadById(Integer id);//按id查询地图大字段 |
| | | |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<BasMap> pageLight(Page<BasMap> page, QueryWrapper<BasMap> wrapper) { |
| | | QueryWrapper<BasMap> queryWrapper = wrapper == null ? new QueryWrapper<>() : wrapper; |
| | | queryWrapper.select("id", "create_time", "update_time", "lev", "base_row", "base_row_code", "base_bay", "base_bay_code"); |
| | | return this.baseMapper.selectPage(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public BasMap selectPayloadById(Integer id) { |
| | | return this.baseMapper.selectPayloadById(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public int syncLocMastByMap(Integer lev) { |
| | | if (lev == null || lev <= 0) { |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <resultMap id="PayloadResultMap" type="com.zy.asrs.entity.BasMap"> |
| | | <id column="id" property="id" /> |
| | | <result column="lev" property="lev" /> |
| | | <result column="data" property="data" /> |
| | | <result column="last_data" property="lastData" /> |
| | | <result column="origin_data" property="originData" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectLatestMap" resultMap="BaseResultMap"> |
| | | select * |
| | | from asr_bas_map |
| | |
| | | limit 0,1 |
| | | </select> |
| | | |
| | | <select id="selectPayloadById" resultMap="PayloadResultMap"> |
| | | select id, lev, data, last_data, origin_data |
| | | from asr_bas_map |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | } |
| | | |
| | | function isSearchableField(field) { |
| | | return !!field && field.kind !== 'image' && !field.textarea; |
| | | return !!field && field.kind !== 'image' && !field.textarea && ['data', 'lastData', 'originData'].indexOf(field.field) === -1; |
| | | } |
| | | |
| | | function isSortableField(field) { |
| | |
| | | } |
| | | |
| | | function createDefaultVisibleColumnKeys() { |
| | | return fieldMeta.map(function (field) { |
| | | return fieldMeta.filter(function (field) { |
| | | return ['data', 'lastData', 'originData'].indexOf(field.field) === -1; |
| | | }).map(function (field) { |
| | | return field.field; |
| | | }); |
| | | } |
| | |
| | | mode: 'create', |
| | | submitting: false |
| | | }, |
| | | payloadDialog: { |
| | | visible: false, |
| | | loading: false, |
| | | row: null, |
| | | data: { |
| | | id: null, |
| | | lev: '', |
| | | data: '', |
| | | lastData: '', |
| | | originData: '' |
| | | } |
| | | }, |
| | | layoutTimer: null, |
| | | tableResizeHandler: null, |
| | | dialogForm: createFormDefaults(), |
| | |
| | | this.dialog.visible = true; |
| | | this.$nextTick(this.resetDialogState); |
| | | }, |
| | | createEmptyPayloadData: function () { |
| | | return { |
| | | id: null, |
| | | lev: '', |
| | | data: '', |
| | | lastData: '', |
| | | originData: '' |
| | | }; |
| | | }, |
| | | openPayloadDialog: function (row) { |
| | | var self = this; |
| | | if (!row || isEmptyValue(row[self.primaryKeyField])) { |
| | | self.$message.warning('当前记录不存在'); |
| | | return; |
| | | } |
| | | self.payloadDialog.visible = true; |
| | | self.payloadDialog.loading = true; |
| | | self.payloadDialog.row = row; |
| | | self.payloadDialog.data = self.createEmptyPayloadData(); |
| | | $.ajax({ |
| | | url: baseUrl + '/' + simpleEntityName + '/payload/' + encodeURIComponent(row[self.primaryKeyField]) + '/auth', |
| | | method: 'GET', |
| | | headers: self.authHeaders(), |
| | | success: function (res) { |
| | | self.payloadDialog.loading = false; |
| | | if (self.handleForbidden(res)) { |
| | | return; |
| | | } |
| | | if (!res || res.code !== 200) { |
| | | self.$message.error((res && res.msg) ? res.msg : '加载地图数据失败'); |
| | | return; |
| | | } |
| | | self.payloadDialog.data = $.extend({}, self.createEmptyPayloadData(), res.data || {}); |
| | | }, |
| | | error: function () { |
| | | self.payloadDialog.loading = false; |
| | | self.$message.error('加载地图数据失败'); |
| | | } |
| | | }); |
| | | }, |
| | | openEditDialog: function (row) { |
| | | var self = this; |
| | | if (!row || isEmptyValue(row[self.primaryKeyField])) { |
| | | self.$message.warning('当前记录不存在'); |
| | | return; |
| | | } |
| | | self.dialog.mode = 'edit'; |
| | | self.dialog.visible = true; |
| | | self.$nextTick(function () { |
| | | self.resetDialogState(); |
| | | fillFormFromRow(row, self.dialogForm, self.dialogDisplay); |
| | | self.dialog.submitting = true; |
| | | $.ajax({ |
| | | url: baseUrl + '/' + simpleEntityName + '/' + encodeURIComponent(row[self.primaryKeyField]) + '/auth', |
| | | method: 'GET', |
| | | headers: self.authHeaders(), |
| | | success: function (res) { |
| | | self.dialog.submitting = false; |
| | | if (self.handleForbidden(res)) { |
| | | return; |
| | | } |
| | | if (!res || res.code !== 200) { |
| | | self.$message.error((res && res.msg) ? res.msg : '加载详情失败'); |
| | | self.dialog.visible = false; |
| | | return; |
| | | } |
| | | fillFormFromRow(res.data || {}, self.dialogForm, self.dialogDisplay); |
| | | if (self.$refs.dialogForm) { |
| | | self.$refs.dialogForm.clearValidate(); |
| | | } |
| | | }, |
| | | error: function () { |
| | | self.dialog.submitting = false; |
| | | self.dialog.visible = false; |
| | | self.$message.error('加载详情失败'); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | buildDialogPayload: function () { |
| | |
| | | <span v-else>{{ valueOrDash(getTableValue(scope.row, field)) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="220" fixed="right" align="center"> |
| | | <el-table-column label="操作" width="300" fixed="right" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="openPayloadDialog(scope.row)">查看地图数据</el-button> |
| | | <el-button type="text" @click="openVisualEditor(scope.row)">可视化编辑</el-button> |
| | | <el-button type="text" @click="openEditDialog(scope.row)">修改</el-button> |
| | | <el-button type="text" style="color:#f56c6c;" @click="removeRows([scope.row[primaryKeyField]])">删除</el-button> |
| | |
| | | |
| | | <el-dialog |
| | | class="dialog-panel" |
| | | title="地图数据详情" |
| | | :visible.sync="payloadDialog.visible" |
| | | width="960px" |
| | | :close-on-click-modal="false"> |
| | | <div v-loading="payloadDialog.loading"> |
| | | <el-descriptions :column="2" border size="small" style="margin-bottom: 16px;"> |
| | | <el-descriptions-item label="ID">{{ valueOrDash(payloadDialog.data.id) }}</el-descriptions-item> |
| | | <el-descriptions-item label="层数">{{ valueOrDash(payloadDialog.data.lev) }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | <el-tabs> |
| | | <el-tab-pane label="实时数据"> |
| | | <el-input :value="stringValue(payloadDialog.data.data)" type="textarea" :rows="8" readonly></el-input> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="最近数据"> |
| | | <el-input :value="stringValue(payloadDialog.data.lastData)" type="textarea" :rows="8" readonly></el-input> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="原始地图"> |
| | | <el-input :value="stringValue(payloadDialog.data.originData)" type="textarea" :rows="8" readonly></el-input> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | </div> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="payloadDialog.visible = false">关闭</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog |
| | | class="dialog-panel" |
| | | :title="dialog.mode === 'create' ? '新增地图' : '修改地图'" |
| | | :visible.sync="dialog.visible" |
| | | width="760px" |