main
parent
e1f9f38b4d
commit
b84d9abd0c
@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/../NMGJTManager/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/../NMGJTManager/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/../NMGJTManager/src/main/resources/static/View/assets" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/../NMGJTManager/src/main/resources/static/View/assets" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/../NMGJTManager/src/main/resources/static/View/index.html" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/../NMGJTManager/src/main/resources/static/View/resource" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/../NMGJTManager/src/main/resources/static/View/tinymce" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/../../TRKFTrafficSpace-WorkSpace/WS_SystemShow/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/../../TRKFTrafficSpace-WorkSpace/WS_SystemShow/src/main/resources" charset="UTF-8" />
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,90 @@
|
||||
package com.nmgs.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nmgs.entity.IpPortText;
|
||||
import com.nmgs.mapper.IpPortTextMapper;
|
||||
import com.nmgs.util.PropertiesUtil;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/IpPortText")
|
||||
@CrossOrigin(origins = "*")
|
||||
public class IpPortTextController {
|
||||
@Resource
|
||||
IpPortTextMapper ipPortTextMapper;
|
||||
|
||||
@PostMapping("/getPage")
|
||||
@ResponseBody
|
||||
public Object getPage(@RequestBody Map<String, Object> params, HttpServletRequest request) {
|
||||
int pageNum = (int) params.get("pageNum");
|
||||
int pageSize = (int) params.get("pageSize");
|
||||
Page<IpPortText> page = new Page<>(pageNum, pageSize);
|
||||
QueryWrapper<IpPortText> wrapper = new QueryWrapper<>();
|
||||
if(params.containsKey("staNo")&¶ms.get("staNo")!=null&&!params.get("staNo").toString().trim().equals("")){
|
||||
wrapper.eq("STANO",params.get("staNo"));
|
||||
}
|
||||
page = ipPortTextMapper.selectPage(page, wrapper);
|
||||
return page;
|
||||
}
|
||||
|
||||
@PostMapping("/selectInfo")
|
||||
@ResponseBody
|
||||
public Object selectInfo() {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("staNoList", ipPortTextMapper.getStaNoList(PropertiesUtil.getValue("UserStaNO")));
|
||||
return params;
|
||||
}
|
||||
|
||||
@PostMapping("/checkStaNo")
|
||||
@ResponseBody
|
||||
public Object checkStaNo(@RequestBody Map<String, Object> params) {
|
||||
IpPortText staNo = ipPortTextMapper.selectById((int) params.get("staNo"));
|
||||
return staNo == null;
|
||||
}
|
||||
|
||||
@PostMapping("/saveData")
|
||||
@ResponseBody
|
||||
public Object saveData(@RequestBody IpPortText ipPortText) {
|
||||
int a = 0;
|
||||
if (ipPortText.getIsAdd()) {
|
||||
a = ipPortTextMapper.insert(ipPortText);
|
||||
} else {
|
||||
a = ipPortTextMapper.updateById(ipPortText);
|
||||
}
|
||||
if (a > 0) {
|
||||
try {
|
||||
new PropertiesUtil().set("isReloadPortTask", "1");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
@PostMapping("/deleteByIds")
|
||||
@ResponseBody
|
||||
public Object deleteByIds(@RequestBody List<Integer> ids) {
|
||||
int a = 0;
|
||||
a = ipPortTextMapper.deleteBatchIds(ids);
|
||||
if (a > 0) {
|
||||
try {
|
||||
new PropertiesUtil().set("isReloadPortTask", "1");
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.nmgs.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@TableName("IP_PORT_TYPE_TEXT")
|
||||
public class IpPortText {
|
||||
@TableId(value = "STANO")
|
||||
private Long staNo;
|
||||
@TableField(value = "IP")
|
||||
private String ip;
|
||||
@TableField("PORT")
|
||||
private Long port;
|
||||
@TableField("TEXT")
|
||||
private String text;
|
||||
@TableField("ISRUN")
|
||||
private Long isRun;
|
||||
@TableField(exist = false)
|
||||
private Boolean isAdd;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.nmgs.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nmgs.entity.IpPortText;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mapper
|
||||
public interface IpPortTextMapper extends BaseMapper<IpPortText> {
|
||||
List<Map<String,Object>> getStaNoList(@Param("STANO") String staNo);
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<?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.nmgs.mapper.IpPortTextMapper">
|
||||
<select id="getStaNoList" resultType="java.util.Map">
|
||||
SELECT *
|
||||
FROM NAME_TABLE_DCOM
|
||||
WHERE SUBCOMNO = #{STANO}
|
||||
AND USERTYPE = 1
|
||||
</select>
|
||||
</mapper>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,348 @@
|
||||
<template>
|
||||
<div class="intemShow">
|
||||
<el-row style="width: 100%;height: 100%">
|
||||
<el-col :span="24">
|
||||
<div style="padding: 10px 0">
|
||||
<el-select v-model="selectFrom.staNo" placeholder="请选择收费站"
|
||||
style="width: 150px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in staNoList"
|
||||
:label="item.STANAME"
|
||||
:value="item.STANO+''"
|
||||
/>
|
||||
</el-select>
|
||||
<el-input style="width: 150px;margin-left: 0.5%" placeholder="请输入站点编号" v-model="selectFrom.staNo"
|
||||
clearable></el-input>
|
||||
|
||||
<el-button type="primary" style="margin-left: 0.5%;margin-top: 0px" @click="network">
|
||||
<el-icon style="vertical-align: middle;">
|
||||
<search/>
|
||||
</el-icon>
|
||||
<span style="vertical-align: middle;"> 搜索 </span>
|
||||
</el-button>
|
||||
<el-button type="primary" style="margin-left: 0.5%;margin-top: 0px" @click="reNetwork">
|
||||
<el-icon>
|
||||
<Refresh/>
|
||||
</el-icon>
|
||||
<span style="vertical-align: middle;"> 重置 </span>
|
||||
</el-button>
|
||||
<el-button type="primary" style="margin-left: 0.5%;margin-top: 0px" @click="addItem"><span style="vertical-align: middle;"> 新增 </span>
|
||||
<el-icon style="margin-left: 3px">
|
||||
<plus/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<el-button type="danger" style="margin-left: 0.5%;margin-top: 0px" @click="deleteSelect(null)"><span style="vertical-align: middle;"> 删除 </span>
|
||||
<el-icon style="margin-left: 3px">
|
||||
<delete/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData"
|
||||
border
|
||||
highlight-current-row="true"
|
||||
style="width: 100%;"
|
||||
:height=myHeight
|
||||
v-loading="tableLoading"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
|
||||
<el-table-column resizable="false" fixed type="selection" width="50" align="center"></el-table-column>
|
||||
|
||||
<el-table-column fixed prop="staNo" label="站点编号" width="100"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column prop="staName" label="站点名称" align="center"
|
||||
:formatter="getName"></el-table-column>
|
||||
<el-table-column prop="ip" label="IP"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column prop="port" label="端口"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column prop="text" label="备注"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column prop="isRun" label="是否运行"
|
||||
align="center" :formatter="getRun"></el-table-column>
|
||||
<el-table-column :resizable="false" prop="right" label="操作" width="130" align="center">
|
||||
<template v-slot="scope">
|
||||
<el-button style="width: 45%;margin-left: 2%" @click="editThis(scope.row)" type="warning" size="default"
|
||||
:icon="Edit">
|
||||
</el-button>
|
||||
<el-button style="width: 45%;margin-left: 2%" @click="deleteSelect(scope.row.staNo)" type="danger"
|
||||
size="default" :icon="Delete">
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-config-provider :locale="locale">
|
||||
<el-pagination
|
||||
background
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="selectFrom.pageNum"
|
||||
:page-sizes="[ 10,15,30, 50, 100]"
|
||||
:page-size="selectFrom.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="selectFrom.total">
|
||||
</el-pagination>
|
||||
</el-config-provider>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
<el-dialog title="操作" v-model="dialogFormVisible" width="50%" top="0.5%" :close-on-click-modal=false
|
||||
destroy-on-close
|
||||
>
|
||||
<el-form :model="inputForm" size="medium" :rules="rules" ref="form">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="收费站" :label-width="formLabelWidth" prop="staNo">
|
||||
<el-select v-model="inputForm.staNo" placeholder="请选择收费站"
|
||||
style="width:100%"
|
||||
:disabled="!inputForm.isAdd"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in staNoList"
|
||||
:label="item.STANAME"
|
||||
:value="item.STANO"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="IP" :label-width="formLabelWidth" prop="ip">
|
||||
<el-input v-model="inputForm.ip" autocomplete="off" :disabled="keyInput"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="端口" :label-width="formLabelWidth" prop="port">
|
||||
<el-input v-model="inputForm.port" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" :label-width="formLabelWidth" prop="text">
|
||||
<el-input v-model="inputForm.text" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否运行" :label-width="formLabelWidth" prop="isRun">
|
||||
<el-select v-model="inputForm.isRun" placeholder="请选择是否运行" style="width:100%">
|
||||
<el-option
|
||||
label="是"
|
||||
:value="1"
|
||||
/>
|
||||
<el-option
|
||||
label="否"
|
||||
:value="0"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible=false"> 取消</el-button>
|
||||
<el-button type="primary" @click="saveData('form')"> 确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||||
import {ElMessage, ElMessageBox} from "element-plus";
|
||||
import {
|
||||
getPage,
|
||||
selectInfo,
|
||||
saveData,
|
||||
deleteByIds,
|
||||
checkStaNo
|
||||
} from "../../util/api/api.js";
|
||||
import moment from "moment";
|
||||
import {Delete, Edit, Search, Share, Upload, Plus} from '@element-plus/icons-vue'
|
||||
|
||||
export default {
|
||||
name: "index",
|
||||
components: {
|
||||
Search,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
Search,
|
||||
Edit,
|
||||
Delete,
|
||||
selectFrom: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
staNo: '',
|
||||
},
|
||||
inputForm: {},
|
||||
nowTime: '',
|
||||
locale: zhCn,
|
||||
tableData: [],
|
||||
multipleSelection: [],
|
||||
staNoList: [],
|
||||
staNoMap: {},
|
||||
myHeight: 500,
|
||||
dialogFormVisible: false,
|
||||
tableLoading: true,
|
||||
formLabelWidth: '100px',
|
||||
rules: {
|
||||
ip: [{required: true, message: '请输入路段编码', trigger: 'blur'}],
|
||||
port: [{required: true, message: '请输入路段名称', trigger: 'blur'}],
|
||||
text: [{required: true, message: '请输入路段名称', trigger: 'blur'}],
|
||||
isRun: [{required: true, message: '请输入路段名称', trigger: 'blur'}],
|
||||
staNo: [{required: true, validator: this.toCheckStaNo, trigger: 'blur'}],
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toCheckStaNo(rule: any, value: any, callback: any) {
|
||||
if (this.inputForm.isAdd) {
|
||||
if (value == '' || value == null) {
|
||||
callback(new Error('请选择收费站!'))
|
||||
} else {
|
||||
checkStaNo({staNo: value}).then(res => {
|
||||
console.log(res)
|
||||
if (res) {
|
||||
callback()
|
||||
} else {
|
||||
callback(new Error('该配置已存在!'))
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
},
|
||||
handleSelectionChange(row) { //批量删除选择的数据
|
||||
this.multipleSelection = row
|
||||
},
|
||||
handleSizeChange(val) { //页大小改变
|
||||
this.selectFrom.pageSize = val
|
||||
this.network()
|
||||
},
|
||||
handleCurrentChange(val) { //当前页改变
|
||||
this.selectFrom.pageNum = val
|
||||
this.network()
|
||||
},
|
||||
network() { //分页查询
|
||||
this.tableLoading = true
|
||||
selectInfo().then((res) => {
|
||||
this.staNoList = res.staNoList
|
||||
for (let i = 0; i < this.staNoList.length; i++) {
|
||||
this.staNoMap[this.staNoList[i].STANO] = this.staNoList[i].STANAME;
|
||||
}
|
||||
})
|
||||
getPage(this.selectFrom).then((res) => {
|
||||
this.selectFrom.total = res.total
|
||||
this.tableData = res.records
|
||||
this.tableLoading = false
|
||||
})
|
||||
},
|
||||
reNetwork() { //重置
|
||||
this.tableLoading = true
|
||||
this.selectFrom.staNo = '';
|
||||
this.network();
|
||||
},
|
||||
getName(row, column) {
|
||||
return this.staNoMap[row.staNo];
|
||||
},
|
||||
getRun(row, column) {
|
||||
if (row[column.property] == 1) {
|
||||
return '是';
|
||||
} else {
|
||||
return '否';
|
||||
}
|
||||
},
|
||||
deleteSelect(id) { //删除
|
||||
let ids = [];
|
||||
if (id == null || id == '') {
|
||||
ids = this.multipleSelection.map(v => v.staNo)
|
||||
} else {
|
||||
ids[0] = id
|
||||
}
|
||||
if (ids.length == 0) {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: '请选择要删除的数据!',
|
||||
type: 'warning',
|
||||
})
|
||||
return;
|
||||
}
|
||||
ElMessageBox.confirm(
|
||||
'是否批量删除' + ids.length + '条数据?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
).then(() => {
|
||||
deleteByIds(ids).then((res) => {
|
||||
if (res) {
|
||||
ElMessage({
|
||||
message: ids.length + '条删除成功!',
|
||||
type: 'success',
|
||||
})
|
||||
this.network()
|
||||
} else {
|
||||
ElMessage.error('删除失败!')
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
ElMessage({
|
||||
type: 'info',
|
||||
message: '已取消!',
|
||||
})
|
||||
})
|
||||
},
|
||||
editThis(row) { //编辑
|
||||
this.inputForm = row
|
||||
this.inputForm.isAdd = false;
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
addItem() { //添加物品
|
||||
this.inputForm = {}
|
||||
this.inputForm.isAdd = true;
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
saveData(resetForm) { //用于数据的添加和更新
|
||||
this.$refs[resetForm].validate((valid) => {
|
||||
if (valid) {
|
||||
saveData(this.inputForm).then((res) => {
|
||||
if (res) {
|
||||
ElMessage({
|
||||
message: '操作成功!',
|
||||
type: 'success',
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.network()
|
||||
this.inputForm = {}
|
||||
} else {
|
||||
ElMessage.error('操作失败!请重新操作!')
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.myHeight = (document.documentElement.clientHeight) * 0.85;
|
||||
this.network()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.intemShow {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
@media print {
|
||||
.no-print {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue