数据接口与网关管理功能
This commit is contained in:
parent
f31fac25e3
commit
bc2bbcdac0
53
imt-ui/src/api/system/gatewayinfo/gatewayinfo.js
Normal file
53
imt-ui/src/api/system/gatewayinfo/gatewayinfo.js
Normal file
@ -0,0 +1,53 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 创建机床网关信息
|
||||
export function createGatewayInfo(data) {
|
||||
return request({
|
||||
url: "/imt/gateway-info/create",
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 更新机床网关信息
|
||||
export function updateGatewayInfo(data) {
|
||||
return request({
|
||||
url: "/imt/gateway-info/update",
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除机床网关信息
|
||||
export function deleteGatewayInfo(id) {
|
||||
return request({
|
||||
url: "/imt/gateway-info/delete?id=" + id,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
// 获得机床网关信息
|
||||
export function getGatewayInfo(id) {
|
||||
return request({
|
||||
url: "/imt/gateway-info/get?id=" + id,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
// 获得机床网关信息分页
|
||||
export function getGatewayInfoPage(params) {
|
||||
return request({
|
||||
url: "/imt/gateway-info/page",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
// 导出机床网关信息 Excel
|
||||
export function exportGatewayInfoExcel(params) {
|
||||
return request({
|
||||
url: "/imt/gateway-info/export-excel",
|
||||
method: "get",
|
||||
params,
|
||||
responseType: "blob",
|
||||
});
|
||||
}
|
253
imt-ui/src/views/system/gatewayinfo/GatewayInfoForm.vue
Normal file
253
imt-ui/src/views/system/gatewayinfo/GatewayInfoForm.vue
Normal file
@ -0,0 +1,253 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<el-dialog
|
||||
:title="dialogTitle"
|
||||
:visible.sync="dialogVisible"
|
||||
width="45%"
|
||||
v-dialogDrag
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
v-loading="formLoading"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="网关名称"
|
||||
prop="gatewayName"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.gatewayName"
|
||||
placeholder="请输入网关名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="网关型号"
|
||||
prop="gatewayModel"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.gatewayModel"
|
||||
placeholder="请输入网关型号"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="网关生产厂商"
|
||||
prop="gatewayMfg"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.gatewayMfg"
|
||||
placeholder="请输入网关生产厂商"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="网关位置"
|
||||
prop="gatewayLocation"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.gatewayLocation"
|
||||
placeholder="请输入网关位置"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="固件版本"
|
||||
prop="firmwareVersion"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.firmwareVersion"
|
||||
placeholder="请输入固件版本"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="ip地址"
|
||||
prop="ipAddress"
|
||||
>
|
||||
<el-input
|
||||
v-model="formData.ipAddress"
|
||||
placeholder="请输入ip地址"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
label="规格参数"
|
||||
prop="gatewaySpn"
|
||||
>
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
v-model="formData.gatewaySpn"
|
||||
placeholder="请输入规格参数"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item
|
||||
label="备注"
|
||||
prop="remark"
|
||||
>
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
v-model="formData.remark"
|
||||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-form-item
|
||||
label="网关状态"
|
||||
prop="status"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.status"
|
||||
placeholder="请选择状态"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in this.getDictDatas(DICT_TYPE.GATEWAY_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-col :span="24">
|
||||
<el-form-item label="网关图片">
|
||||
<ImageUpload
|
||||
v-model="formData.gatewayPicPath"
|
||||
:limit="1"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
<div
|
||||
slot="footer"
|
||||
class="dialog-footer"
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="submitForm"
|
||||
:disabled="formLoading"
|
||||
>确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as GatewayInfoApi from "@/api/system/gatewayinfo/gatewayinfo";
|
||||
import ImageUpload from "@/components/ImageUpload";
|
||||
export default {
|
||||
name: "GatewayInfoForm",
|
||||
components: {
|
||||
ImageUpload,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
dialogTitle: "",
|
||||
// 是否显示弹出层
|
||||
dialogVisible: false,
|
||||
// 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
formLoading: false,
|
||||
// 表单参数
|
||||
formData: {
|
||||
gatewayId: undefined,
|
||||
gatewayName: undefined,
|
||||
gatewayModel: undefined,
|
||||
gatewayMfg: undefined,
|
||||
gatewayLocation: undefined,
|
||||
firmwareVersion: undefined,
|
||||
ipAddress: undefined,
|
||||
gatewaySpn: undefined,
|
||||
status: undefined,
|
||||
remark: undefined,
|
||||
gatewayPicPath: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
formRules: {
|
||||
gatewayName: [
|
||||
{ required: true, message: "机床网关名称不能为空", trigger: "blur" },
|
||||
],
|
||||
gatewayModel: [
|
||||
{ required: true, message: "机床网关名称不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id) {
|
||||
this.dialogVisible = true;
|
||||
this.reset();
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const res = await GatewayInfoApi.getGatewayInfo(id);
|
||||
this.formData = res.data;
|
||||
this.title = "修改机床网关信息";
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
}
|
||||
this.title = "新增机床网关信息";
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
// 校验主表
|
||||
await this.$refs["formRef"].validate();
|
||||
this.formLoading = true;
|
||||
try {
|
||||
const data = this.formData;
|
||||
// 修改的提交
|
||||
if (data.gatewayId) {
|
||||
await GatewayInfoApi.updateGatewayInfo(data);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit("success");
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
await GatewayInfoApi.createGatewayInfo(data);
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.$emit("success");
|
||||
} finally {
|
||||
this.formLoading = false;
|
||||
}
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
this.formData = {
|
||||
gatewayId: undefined,
|
||||
gatewayName: undefined,
|
||||
gatewayModel: undefined,
|
||||
gatewayMfg: undefined,
|
||||
gatewayLocation: undefined,
|
||||
firmwareVersion: undefined,
|
||||
ipAddress: undefined,
|
||||
gatewaySpn: undefined,
|
||||
status: undefined,
|
||||
remark: undefined,
|
||||
gatewayPicPath: undefined,
|
||||
};
|
||||
this.resetForm("formRef");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
302
imt-ui/src/views/system/gatewayinfo/index.vue
Normal file
302
imt-ui/src/views/system/gatewayinfo/index.vue
Normal file
@ -0,0 +1,302 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
style="text-align:right"
|
||||
>
|
||||
<el-form-item
|
||||
label="机床网关名称"
|
||||
label-width="100px"
|
||||
prop="gatewayName"
|
||||
>
|
||||
<el-input
|
||||
v-model="queryParams.gatewayName"
|
||||
placeholder="请输入机床网关名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="机床网关型号"
|
||||
label-width="100px"
|
||||
prop="gatewayModel"
|
||||
>
|
||||
<el-input
|
||||
v-model="queryParams.gatewayModel"
|
||||
placeholder="请输入机床网关型号"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="状态"
|
||||
prop="status"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in this.getDictDatas(DICT_TYPE.GATEWAY_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button>
|
||||
<el-button
|
||||
icon="el-icon-refresh"
|
||||
@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="openForm(undefined)"
|
||||
v-hasPermi="['imt:gateway-info:create']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['imt:gateway-info:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<el-table-column
|
||||
label="机床网关名称"
|
||||
align="center"
|
||||
prop="gatewayName"
|
||||
/>
|
||||
<el-table-column
|
||||
label="机床网关型号"
|
||||
align="center"
|
||||
prop="gatewayModel"
|
||||
/>
|
||||
<el-table-column
|
||||
label="机床网关生产厂商"
|
||||
align="center"
|
||||
prop="gatewayMfg"
|
||||
/>
|
||||
<el-table-column
|
||||
label="机床网关位置"
|
||||
align="center"
|
||||
prop="gatewayLocation"
|
||||
/>
|
||||
<el-table-column
|
||||
label="固件版本"
|
||||
align="center"
|
||||
prop="firmwareVersion"
|
||||
/>
|
||||
<el-table-column
|
||||
label="ip地址"
|
||||
align="center"
|
||||
prop="ipAddress"
|
||||
/>
|
||||
<el-table-column
|
||||
label="规格参数"
|
||||
align="center"
|
||||
prop="gatewaySpn"
|
||||
/>
|
||||
<el-table-column
|
||||
label="状态"
|
||||
align="center"
|
||||
prop="status"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<dict-tag
|
||||
:type="DICT_TYPE.GATEWAY_STATUS"
|
||||
:value="scope.row.status"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="备注"
|
||||
align="center"
|
||||
prop="remark"
|
||||
/>
|
||||
<el-table-column
|
||||
label="网关图片路径"
|
||||
align="center"
|
||||
prop="gatewayPicPath"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<img
|
||||
:src="scope.row.gatewayPicPath"
|
||||
style="display: block; width: 100px; height: 100px; margin: 0 auto"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="openForm(scope.row.gatewayId)"
|
||||
v-hasPermi="['imt:gateway-info:update']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['imt:gateway-info:delete']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<GatewayInfoForm
|
||||
ref="formRef"
|
||||
@success="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as GatewayInfoApi from "@/api/system/gatewayinfo/gatewayinfo";
|
||||
import GatewayInfoForm from "./GatewayInfoForm.vue";
|
||||
export default {
|
||||
name: "GatewayInfo",
|
||||
components: {
|
||||
GatewayInfoForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 机床网关信息列表
|
||||
list: [],
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 选中行
|
||||
currentRow: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
gatewayName: null,
|
||||
gatewayModel: null,
|
||||
status: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true;
|
||||
const res = await GatewayInfoApi.getGatewayInfoPage(this.queryParams);
|
||||
this.list = res.data.list;
|
||||
this.total = res.data.total;
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs["formRef"].open(id);
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const gatewayId = row.gatewayId;
|
||||
await this.$modal.confirm(
|
||||
'是否确认删除机床网关信息编号为"' + gatewayId + '"的数据项?'
|
||||
);
|
||||
try {
|
||||
await GatewayInfoApi.deleteGatewayInfo(gatewayId);
|
||||
await this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
} catch {}
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
async handleExport() {
|
||||
await this.$modal.confirm("是否确认导出所有机床网关信息数据项?");
|
||||
try {
|
||||
this.exportLoading = true;
|
||||
const data = await GatewayInfoApi.exportGatewayInfoExcel(
|
||||
this.queryParams
|
||||
);
|
||||
this.$download.excel(data, "机床网关信息.xls");
|
||||
} catch {
|
||||
} finally {
|
||||
this.exportLoading = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user