Compare commits

...

10 Commits

21 changed files with 913 additions and 97 deletions

View File

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.board;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.board.domain.BoardInfo;
import com.ruoyi.board.domain.dto.BoardInfoAndRoadDTO;
import com.ruoyi.board.service.IBoardInfoService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@ -35,7 +36,7 @@ public class BoardInfoController extends BaseController {
@GetMapping("/list")
public TableDataInfo list(BoardInfo boardInfo) {
startPage();
List<BoardInfo> list = boardInfoService.listPage(boardInfo);
List<BoardInfoAndRoadDTO> list = boardInfoService.listBoardInfoDTO(boardInfo);
return getDataTable(list);
}

View File

@ -0,0 +1,91 @@
package com.ruoyi.web.controller.board;
import com.ruoyi.board.domain.BoardType;
import com.ruoyi.board.service.IBoardTypeService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 情报板类型Controller
*
* @author fuhao
* @date 2024-09-03
*/
@RestController
@RequestMapping("/board/boardType")
public class BoardTypeController extends BaseController {
@Autowired
private IBoardTypeService boardTypeService;
/**
* 查询情报板类型列表
*/
@PreAuthorize("@ss.hasPermi('board:boardType:list')")
@GetMapping("/list")
public TableDataInfo list(BoardType boardType) {
startPage();
List<BoardType> list = boardTypeService.list();
return getDataTable(list);
}
/**
* 导出情报板类型列表
*/
@PreAuthorize("@ss.hasPermi('board:boardType:export')")
@Log(title = "情报板类型", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BoardType boardType) {
List<BoardType> list = boardTypeService.list();
ExcelUtil<BoardType> util = new ExcelUtil<BoardType>(BoardType.class);
util.exportExcel(response, list, "情报板类型数据");
}
/**
* 获取情报板类型详细信息
*/
@PreAuthorize("@ss.hasPermi('board:boardType:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(boardTypeService.getById(id));
}
/**
* 新增情报板类型
*/
@PreAuthorize("@ss.hasPermi('board:boardType:add')")
@Log(title = "情报板类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BoardType boardType) {
return toAjax(boardTypeService.save(boardType));
}
/**
* 修改情报板类型
*/
@PreAuthorize("@ss.hasPermi('board:boardType:edit')")
@Log(title = "情报板类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BoardType boardType) {
return toAjax(boardTypeService.saveOrUpdate(boardType));
}
/**
* 删除情报板类型
*/
@PreAuthorize("@ss.hasPermi('board:boardType:remove')")
@Log(title = "情报板类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(boardTypeService.removeByIds(ids));
}
}

View File

@ -0,0 +1,98 @@
package com.ruoyi.web.controller.board;
import com.ruoyi.board.domain.RoadGroup;
import com.ruoyi.board.service.IRoadGroupService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 路段分组Controller
*
* @author fuhao
* @date 2024-09-03
*/
@RestController
@RequestMapping("/road/group")
public class RoadGroupController extends BaseController {
@Autowired
private IRoadGroupService roadGroupService;
/**
* 查询路段分组列表
*/
@PreAuthorize("@ss.hasPermi('road:group:list')")
@GetMapping("/list")
public AjaxResult list(RoadGroup roadGroup) {
List<RoadGroup> list = roadGroupService.list();
return success(list);
}
/**
* 导出路段分组列表
*/
@PreAuthorize("@ss.hasPermi('road:group:export')")
@Log(title = "路段分组", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RoadGroup roadGroup) {
List<RoadGroup> list = roadGroupService.list();
ExcelUtil<RoadGroup> util = new ExcelUtil<RoadGroup>(RoadGroup.class);
util.exportExcel(response, list, "路段分组数据");
}
/**
* 获取路段分组详细信息
*/
@PreAuthorize("@ss.hasPermi('road:group:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(roadGroupService.getById(id));
}
/**
* 新增路段分组
*/
@PreAuthorize("@ss.hasPermi('road:group:add')")
@Log(title = "路段分组", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RoadGroup roadGroup) {
return toAjax(roadGroupService.save(roadGroup));
}
/**
* 修改路段分组
*/
@PreAuthorize("@ss.hasPermi('road:group:edit')")
@Log(title = "路段分组", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RoadGroup roadGroup) {
return toAjax(roadGroupService.saveOrUpdate(roadGroup));
}
/**
* 删除路段分组
*/
@PreAuthorize("@ss.hasPermi('road:group:remove')")
@Log(title = "路段分组", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids) {
return toAjax(roadGroupService.removeByIds(ids));
}
/**
* 获取路段分组树列表
*/
@PreAuthorize("@ss.hasPermi('road:group:list')")
@GetMapping("/roadTree")
public AjaxResult deptTree(RoadGroup roadGroup) {
return success(roadGroupService.listRoadTree(roadGroup));
}
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.board.domain;
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 lombok.Data;
/**
* 情报板类型
*/
@Data
@TableName(value = "pub_board_type")
public class BoardType {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 名称
*/
@TableField(value = "`name`")
private String name;
/**
* 类型
*/
@TableField(value = "`type`")
private String type;
/**
* 尺寸
*/
@TableField(value = "`size`")
private String size;
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.board.domain;
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 lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 路段分组
*/
@Data
@TableName(value = "pub_road_group")
public class RoadGroup {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 路段名称
*/
@TableField(value = "road_name")
private String roadName;
/**
* 路段父id
*/
@TableField(value = "parent_id")
private Long parentId;
@TableField(select = false)
private List<RoadGroup> children = new ArrayList<>();
}

View File

@ -0,0 +1,58 @@
package com.ruoyi.board.domain.dto;
import lombok.Data;
@Data
public class BoardInfoAndRoadDTO {
/**
* 唯一标识
*/
private Integer id;
/**
* 情报板名称
*/
private String boardName;
/**
* 情报板路段
*/
private String boardRoadSection;
/**
* 情报板方向
*/
private String boardDirection;
/**
* 情报板工桩号
*/
private String boardMileage;
/**
* 情报板尺寸
*/
private String boardSize;
/**
* 情报板品牌
*/
private String boardBrand;
/**
* 情报板通讯协议
*/
private String boardCommunicationProtocol;
/**
* 情报板IP
*/
private String boardIp;
/**
* 路段名称
*/
private String roadName;
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.board.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.ruoyi.board.domain.BoardType;
public interface BoardTypeMapper extends MPJBaseMapper<BoardType> {
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.board.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.ruoyi.board.domain.RoadGroup;
public interface RoadGroupMapper extends MPJBaseMapper<RoadGroup> {
}

View File

@ -2,6 +2,7 @@ package com.ruoyi.board.service;
import com.github.yulichang.base.MPJBaseService;
import com.ruoyi.board.domain.BoardInfo;
import com.ruoyi.board.domain.dto.BoardInfoAndRoadDTO;
import java.util.List;
@ -10,4 +11,6 @@ public interface IBoardInfoService extends MPJBaseService<BoardInfo> {
BoardInfo getOneByIP(String ip);
List<BoardInfo> listPage(BoardInfo boardInfo);
List<BoardInfoAndRoadDTO> listBoardInfoDTO(BoardInfo boardInfo);
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.board.service;
import com.github.yulichang.base.MPJBaseService;
import com.ruoyi.board.domain.BoardType;
public interface IBoardTypeService extends MPJBaseService<BoardType> {
}

View File

@ -7,6 +7,5 @@ import com.ruoyi.common.core.domain.TreeSelect;
import java.util.List;
public interface IPlanTypeService extends MPJBaseService<PlanType>{
List<TreeSelect> listPlanTree(PlanType planType);
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.board.service;
import com.github.yulichang.base.MPJBaseService;
import com.ruoyi.board.domain.RoadGroup;
import com.ruoyi.common.core.domain.TreeSelect;
import java.util.List;
public interface IRoadGroupService extends MPJBaseService<RoadGroup> {
List<TreeSelect> listRoadTree(RoadGroup roadGroup);
}

View File

@ -2,11 +2,14 @@ package com.ruoyi.board.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.ruoyi.board.domain.BoardInfo;
import com.ruoyi.board.domain.RoadGroup;
import com.ruoyi.board.domain.dto.BoardInfoAndRoadDTO;
import com.ruoyi.board.mapper.BoardInfoMapper;
import com.ruoyi.board.service.IBoardInfoService;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import com.ruoyi.board.mapper.BoardInfoMapper;
import com.ruoyi.board.domain.BoardInfo;
import com.ruoyi.board.service.IBoardInfoService;
import java.util.List;
@ -31,4 +34,16 @@ public class BoardInfoServiceImpl extends MPJBaseServiceImpl<BoardInfoMapper, Bo
wrapper.eq(StringUtils.isNotEmpty(boardInfo.getBoardRoadSection()), BoardInfo::getBoardRoadSection, boardInfo.getBoardRoadSection());
return list(wrapper);
}
@Override
public List<BoardInfoAndRoadDTO> listBoardInfoDTO(BoardInfo boardInfo) {
MPJLambdaWrapper<BoardInfo> eq = new MPJLambdaWrapper<BoardInfo>()
.selectAll(BoardInfo.class)
.select(RoadGroup::getRoadName)
.leftJoin(RoadGroup.class, RoadGroup::getId, BoardInfo::getBoardRoadSection)
.likeRight(StringUtils.isNotEmpty(boardInfo.getBoardName()), BoardInfo::getBoardName, boardInfo.getBoardName())
.likeRight(StringUtils.isNotEmpty(boardInfo.getBoardMileage()), BoardInfo::getBoardMileage, boardInfo.getBoardMileage())
.eq(StringUtils.isNotEmpty(boardInfo.getBoardRoadSection()), BoardInfo::getBoardRoadSection, boardInfo.getBoardRoadSection());
return selectJoinList(BoardInfoAndRoadDTO.class, eq);
}
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.board.service.impl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.ruoyi.board.domain.BoardType;
import com.ruoyi.board.mapper.BoardTypeMapper;
import com.ruoyi.board.service.IBoardTypeService;
import org.springframework.stereotype.Service;
@Service
public class BoardTypeServiceImpl extends MPJBaseServiceImpl<BoardTypeMapper, BoardType> implements IBoardTypeService {
}

View File

@ -0,0 +1,85 @@
package com.ruoyi.board.service.impl;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.ruoyi.board.domain.RoadGroup;
import com.ruoyi.board.mapper.RoadGroupMapper;
import com.ruoyi.board.service.IRoadGroupService;
import com.ruoyi.common.core.domain.TreeSelect;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class RoadGroupServiceImpl extends MPJBaseServiceImpl<RoadGroupMapper, RoadGroup> implements IRoadGroupService {
@Override
public List<TreeSelect> listRoadTree(RoadGroup roadGroup) {
List<RoadGroup> list = list();
List<RoadGroup> roadGroups = buildRoadTree(list);
return roadGroups.stream().map(this::buildTreeSelect).collect(Collectors.toList());
}
private TreeSelect buildTreeSelect(RoadGroup roadGroup) {
List<TreeSelect> childTreeSelectList = roadGroup.getChildren().stream().map(this::buildTreeSelect).collect(Collectors.toList());
TreeSelect treeSelect = new TreeSelect();
treeSelect.setId(roadGroup.getId());
treeSelect.setLabel(roadGroup.getRoadName());
treeSelect.setChildren(childTreeSelectList);
return treeSelect;
}
private List<RoadGroup> buildRoadTree(List<RoadGroup> list) {
List<RoadGroup> returnList = new ArrayList<>();
List<Long> tempList = list.stream().map(RoadGroup::getId).collect(Collectors.toList());
for (RoadGroup roadGroup : list) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(roadGroup.getParentId())) {
recursionFn(list, roadGroup);
returnList.add(roadGroup);
}
}
if (returnList.isEmpty()) {
returnList = list;
}
return returnList;
}
/**
* 递归列表
*/
private void recursionFn(List<RoadGroup> list, RoadGroup t) {
// 得到子节点列表
List<RoadGroup> childList = getChildList(list, t);
t.setChildren(childList);
for (RoadGroup tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<RoadGroup> getChildList(List<RoadGroup> list, RoadGroup t) {
List<RoadGroup> tlist = new ArrayList<>();
for (RoadGroup n : list) {
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) {
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<RoadGroup> list, RoadGroup t) {
return !getChildList(list, t).isEmpty();
}
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.board.mapper.BoardTypeMapper">
</mapper>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.board.mapper.RoadGroupMapper">
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询情报板类型列表
export function listBoardType(query) {
return request({
url: '/board/boardType/list',
method: 'get',
params: query
})
}
// 查询情报板类型详细
export function getBoardType(id) {
return request({
url: '/board/boardType/' + id,
method: 'get'
})
}
// 新增情报板类型
export function addBoardType(data) {
return request({
url: '/board/boardType',
method: 'post',
data: data
})
}
// 修改情报板类型
export function updateBoardType(data) {
return request({
url: '/board/boardType',
method: 'put',
data: data
})
}
// 删除情报板类型
export function delBoardType(id) {
return request({
url: '/board/boardType/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询路段分组列表
export function listGroup(query) {
return request({
url: '/road/group/list',
method: 'get',
params: query
})
}
// 查询路段分组详细
export function getGroup(id) {
return request({
url: '/road/group/' + id,
method: 'get'
})
}
// 新增路段分组
export function addGroup(data) {
return request({
url: '/road/group',
method: 'post',
data: data
})
}
// 修改路段分组
export function updateGroup(data) {
return request({
url: '/road/group',
method: 'put',
data: data
})
}
// 删除路段分组
export function delGroup(id) {
return request({
url: '/road/group/' + id,
method: 'delete'
})
}
// 查询路段分组下拉树结构
export function roadGroupTreeSelect() {
return request({
url: '/road/group/roadTree',
method: 'get'
})
}

View File

@ -0,0 +1,286 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['board:boardType:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['board:boardType:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['board:boardType:remove']"
>删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="boardTypeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="唯一编号" align="center" prop="id"/>
<el-table-column label="名称" align="center" prop="name"/>
<el-table-column label="类型" align="center" prop="type"/>
<el-table-column label="尺寸" align="center" prop="size"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['board:boardType:edit']"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['board:boardType:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改情报板类型对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="auto">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称"/>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-input v-model="form.type" placeholder="请输入类型"/>
</el-form-item>
<el-form-item label="尺寸(高*长)" prop="size">
<el-row align="middle">
<el-col :span="8">
<el-input-number :controls="false" v-model="form.height" placeholder="请输入尺寸" size="small"/>
</el-col>
<el-col :span="4" align="middle">
<div>*</div>
</el-col>
<el-col :span="8">
<el-input-number :controls="false" v-model="form.width" placeholder="请输入尺寸" size="small"/>
</el-col>
</el-row>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listBoardType, getBoardType, delBoardType, addBoardType, updateBoardType} from "@/api/board/boardtype";
export default {
name: "BoardType",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
boardTypeList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
type: null,
size: null
},
//
form: {},
//
rules: {
name: [
{required: true, message: "名称不能为空", trigger: "change"}
],
type: [
{required: true, message: "类型不能为空", trigger: "change"}
],
size: [
{
validator: (rule, value, callback) => {
if (!this.form.height || !this.form.width) {
callback(new Error('尺寸(高和长)不能为空'));
} else {
callback();
}
},
required: true,
trigger: 'change'
}
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询情报板类型列表 */
getList() {
this.loading = true;
listBoardType(this.queryParams).then(response => {
this.boardTypeList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
type: null,
height: null,
width: null,
size: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加情报板类型";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getBoardType(id).then(response => {
this.form = response.data;
[this.form.height, this.form.width] = response.data.size.split("*").map(Number);
this.open = true;
this.title = "修改情报板类型";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.size = this.form.height + '*' + this.form.width;
if (this.form.id != null) {
updateBoardType(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addBoardType(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除情报板类型编号为"' + ids + '"的数据项?').then(function () {
return delBoardType(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('board/boardType/export', {
...this.queryParams
}, `boardType_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@ -1,65 +1,35 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="auto">
<el-form-item label="情报板名称" prop="boardName">
<el-input
v-model="queryParams.boardName"
placeholder="请输入情报板名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="情报板工桩号" prop="boardMileage">
<el-input
v-model="queryParams.boardMileage"
placeholder="请输入情报板工桩号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="情报板尺寸" prop="boardSize">
<el-select
v-model="queryParams.boardSize"
clearable
placeholder="全部">
<el-option
v-for="dict in dict.type.board_size"
:key="dict.value"
:label="dict.label + ' ' + dict.value"
:value="dict.value"
<el-row :gutter="20">
<el-form-item label="情报板路段" prop="boardRoadSection">
<el-col :span="4">
<treeselect v-model="queryParams.boardRoadSection" :options="roadGroupOptions"
placeholder="请选择归属路段" style="width: 200px" />
</el-col>
</el-form-item>
<el-form-item label="情报板名称" prop="boardName">
<el-input
v-model="queryParams.boardName"
placeholder="请输入情报板名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-select>
</el-form-item>
<el-form-item label="情报板品牌" prop="boardBrand">
<el-input
v-model="queryParams.boardBrand"
placeholder="请输入情报板品牌"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="情报板通讯协议" prop="boardCommunicationProtocol">
<el-select
v-model="queryParams.boardCommunicationProtocol"
clearable
placeholder="全部"
>
<el-option
v-for="dict in dict.type.board_protocol"
:key="dict.value"
:label="dict.label"
:value="dict.value"
</el-form-item>
<el-form-item label="情报板工桩号" prop="boardMileage">
<el-input
v-model="queryParams.boardMileage"
placeholder="请输入情报板工桩号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-select>
</el-form-item>
<el-form-item label="情报板路段" prop="boardRoadSection">
<treeselect v-model="queryParams.boardRoadSection" :options="deptOptions" placeholder="请选择归属路段"
style="width: 300px"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-row>
</el-form>
<el-row :gutter="10" class="mb8">
@ -98,17 +68,17 @@
>删除
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['board:info:export']"-->
<!-- >导出-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- plain-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['board:info:export']"-->
<!-- >导出-->
<!-- </el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -116,7 +86,7 @@
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="唯一编号" align="center" prop="id"/>
<el-table-column label="情报板名称" align="center" prop="boardName"/>
<el-table-column label="情报板路段" align="center" prop="boardRoadSection"/>
<el-table-column label="情报板路段" align="center" prop="roadName"/>
<el-table-column label="情报板方向" align="center" prop="boardDirection"/>
<el-table-column label="情报板工桩号" align="center" prop="boardMileage"/>
<el-table-column label="情报板尺寸" align="center" prop="boardSize">
@ -165,20 +135,20 @@
<!-- 添加或修改情报板信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="auto">
<el-form-item label="所属路段" prop="boardRoadSection">
<treeselect v-model="form.boardRoadSection" :options="roadGroupOptions" placeholder="请选择归属路段"
style="width: 200px"/>
</el-form-item>
<el-form-item label="情报板名称" prop="boardName">
<el-input v-model="form.boardName" placeholder="请输入情报板名称"/>
</el-form-item>
<el-form-item label="情报板路段" prop="boardRoadSection">
<treeselect v-model="form.boardRoadSection" :options="deptOptions" placeholder="请选择归属路段"
style="width: 300px"/>
</el-form-item>
<el-form-item label="情报板方向" prop="boardDirection">
<el-form-item label="方向" prop="boardDirection">
<el-input v-model="form.boardDirection" placeholder="请输入情报板方向"/>
</el-form-item>
<el-form-item label="情报板工桩号" prop="boardMileage">
<el-form-item label="工桩号" prop="boardMileage">
<el-input v-model="form.boardMileage" placeholder="请输入情报板工桩号"/>
</el-form-item>
<el-form-item label="情报板尺寸" prop="boardSize">
<el-form-item label="情报板类型" prop="boardSize">
<el-select
v-model="form.boardSize"
placeholder="请选择"
@ -191,10 +161,10 @@
/>
</el-select>
</el-form-item>
<el-form-item label="情报板品牌" prop="boardBrand">
<el-form-item label="品牌" prop="boardBrand">
<el-input v-model="form.boardBrand" placeholder="请输入情报板品牌"/>
</el-form-item>
<el-form-item label="情报板通讯协议" prop="boardCommunicationProtocol">
<el-form-item label="通讯协议" prop="boardCommunicationProtocol">
<el-select
v-model="form.boardCommunicationProtocol"
placeholder="全部"
@ -210,10 +180,6 @@
<el-form-item label="情报板IP" prop="boardIp">
<el-input v-model="form.boardIp" placeholder="请输入情报板IP"/>
</el-form-item>
<el-form-item label="情报板端口号" prop="boardPort">
<el-input-number :min="0" :max="65535" v-model="form.boardPort"
placeholder="填0为默认端口"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -225,10 +191,10 @@
<script>
import {listInfo, getInfo, delInfo, addInfo, updateInfo} from "@/api/board/info";
import {deptTreeSelect} from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import TextPreview from "@/views/board/component/TextPreview.vue";
import {roadGroupTreeSelect} from "@/api/board/roadgroup";
export default {
name: "Info",
@ -245,7 +211,7 @@ export default {
//
multiple: true,
//
deptOptions: [],
roadGroupOptions: [],
//
showSearch: true,
//
@ -303,15 +269,12 @@ export default {
trigger: "blur"
}
],
boardPort: [
{required: true, message: "情报板端口号不能为空", trigger: "blur"}
]
}
};
},
created() {
this.getList();
this.getDeptTree();
this.getRoadTree();
},
methods: {
/** 查询情报板信息列表 */
@ -347,7 +310,6 @@ export default {
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
console.log(this.queryParams)
this.getList();
},
/** 重置按钮操作 */
@ -415,9 +377,9 @@ export default {
}, `info_${new Date().getTime()}.xlsx`)
},
/** 查询部门下拉树结构 */
getDeptTree() {
deptTreeSelect().then(response => {
this.deptOptions = response.data;
getRoadTree() {
roadGroupTreeSelect().then(response => {
this.roadGroupOptions = response.data;
});
},
}