增加plc页面
parent
048475c422
commit
480986236d
@ -0,0 +1,246 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="88px">
|
||||
|
||||
<el-form-item label="设备名称" prop="tenantName">
|
||||
<el-input
|
||||
v-model="queryParams.tenantName"
|
||||
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"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="ip" align="center" prop="value"/>
|
||||
<el-table-column label="port" align="center" prop="value"/>
|
||||
<el-table-column label="协议类型" align="center" prop="value"/>
|
||||
<el-table-column label="寄存器位置" align="center" prop="value"/>
|
||||
<el-table-column label="数据长度" align="center" prop="value"/>
|
||||
<el-table-column label="读取类型" align="center" prop="value"/>
|
||||
|
||||
<el-table-column label="操作" width="200px" 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)"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</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="30%" append-to-body>
|
||||
<el-form ref="form" :model="form" label-width="100px">
|
||||
<el-form-item label="ip">
|
||||
<el-input v-model="form.tenantName" placeholder="请输入ip"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标识符" prop="tenantName">
|
||||
<el-select v-model="form.tenantType" placeholder="请选择标识符" clearable>
|
||||
<el-option
|
||||
v-for="i in tenants"
|
||||
:key="i.value"
|
||||
:label="i.tenantName"
|
||||
:value="i.tenantId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据类型" prop="contactName">
|
||||
<el-select v-model="form.tenantIndustry" placeholder="请选择数据类型" clearable>
|
||||
<el-option
|
||||
v-for="i in sceneModes"
|
||||
:key="i.value"
|
||||
:label="i.sceneModeName"
|
||||
:value="i.sceneModeId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位">
|
||||
<el-input v-model="form.tenantName" placeholder="请输入单位"/>
|
||||
</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 {addScene, delScene, getSceneModes, getTenants, updateScene} from "@/api/business/scene";
|
||||
|
||||
export default {
|
||||
name: "PLCModel",
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
ids: [],
|
||||
single: true,
|
||||
multiple: true,
|
||||
queryParams: {},
|
||||
list: [
|
||||
{
|
||||
value: 1
|
||||
}
|
||||
],
|
||||
total: 10,
|
||||
sceneModes: [],
|
||||
tenants: [],
|
||||
form: {},
|
||||
title: "",
|
||||
open: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTenants();
|
||||
this.getSceneModes()
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
getTenants() {
|
||||
getTenants().then(response => {
|
||||
this.tenants = response.data;
|
||||
console.log(response.data)
|
||||
})
|
||||
},
|
||||
getSceneModes() {
|
||||
getSceneModes().then(response => {
|
||||
this.sceneModes = response.data;
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
getList() {
|
||||
this.loading = false
|
||||
},
|
||||
reset() {
|
||||
this.form = {};
|
||||
this.resetForm("form");
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加模型";
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const sceneId = row.sceneId || this.ids
|
||||
this.open = true;
|
||||
this.title = "修改场景信息";
|
||||
},
|
||||
handleDelete(row) {
|
||||
const sceneIds = row.sceneId || this.ids;
|
||||
this.$modal.confirm('是否确认删除模型ID为"' + sceneIds + '"的数据项?').then(function () {
|
||||
return delScene(sceneIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.sceneId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.sceneId != null) {
|
||||
updateScene(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
});
|
||||
} else {
|
||||
addScene(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
|
@ -0,0 +1,255 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="88px">
|
||||
|
||||
<el-form-item label="模型名称" prop="tenantName">
|
||||
<el-input
|
||||
v-model="queryParams.tenantName"
|
||||
placeholder="请输入模型名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性名称" prop="tenantType">
|
||||
<el-select v-model="queryParams.tenantType" placeholder="请选择所属租户" clearable>
|
||||
<el-option
|
||||
v-for="i in tenants"
|
||||
:key="i.value"
|
||||
:label="i.tenantName"
|
||||
:value="i.tenantId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</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"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="属性名称" align="center" prop="value"/>
|
||||
<el-table-column label="标识符" align="center" prop="value"/>
|
||||
<el-table-column label="数据类型" align="center" prop="value"/>
|
||||
<el-table-column label="单位" align="center" prop="value"/>
|
||||
|
||||
<el-table-column label="操作" width="200px" 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)"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</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="30%" append-to-body>
|
||||
<el-form ref="form" :model="form" label-width="100px">
|
||||
<el-form-item label="属性名称">
|
||||
<el-input v-model="form.tenantName" placeholder="请输入属性名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标识符" prop="tenantName">
|
||||
<el-select v-model="form.tenantType" placeholder="请选择标识符" clearable>
|
||||
<el-option
|
||||
v-for="i in tenants"
|
||||
:key="i.value"
|
||||
:label="i.tenantName"
|
||||
:value="i.tenantId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据类型" prop="contactName">
|
||||
<el-select v-model="form.tenantIndustry" placeholder="请选择数据类型" clearable>
|
||||
<el-option
|
||||
v-for="i in sceneModes"
|
||||
:key="i.value"
|
||||
:label="i.sceneModeName"
|
||||
:value="i.sceneModeId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位">
|
||||
<el-input v-model="form.tenantName" placeholder="请输入单位"/>
|
||||
</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 {addScene, delScene, getSceneModes, getTenants, updateScene} from "@/api/business/scene";
|
||||
|
||||
export default {
|
||||
name: "PLCModel",
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
ids: [],
|
||||
single: true,
|
||||
multiple: true,
|
||||
queryParams: {},
|
||||
list: [
|
||||
{
|
||||
value: 1
|
||||
}
|
||||
],
|
||||
total: 10,
|
||||
sceneModes: [],
|
||||
tenants: [],
|
||||
form: {},
|
||||
title: "",
|
||||
open: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTenants();
|
||||
this.getSceneModes()
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
getTenants() {
|
||||
getTenants().then(response => {
|
||||
this.tenants = response.data;
|
||||
console.log(response.data)
|
||||
})
|
||||
},
|
||||
getSceneModes() {
|
||||
getSceneModes().then(response => {
|
||||
this.sceneModes = response.data;
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
getList() {
|
||||
this.loading = false
|
||||
},
|
||||
reset() {
|
||||
this.form = {};
|
||||
this.resetForm("form");
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加模型";
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const sceneId = row.sceneId || this.ids
|
||||
this.open = true;
|
||||
this.title = "修改场景信息";
|
||||
},
|
||||
handleDelete(row) {
|
||||
const sceneIds = row.sceneId || this.ids;
|
||||
this.$modal.confirm('是否确认删除模型ID为"' + sceneIds + '"的数据项?').then(function () {
|
||||
return delScene(sceneIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.sceneId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.sceneId != null) {
|
||||
updateScene(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
});
|
||||
} else {
|
||||
addScene(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
|
@ -0,0 +1,273 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="88px">
|
||||
|
||||
<el-form-item label="模型名称" prop="tenantName">
|
||||
<el-input
|
||||
v-model="queryParams.tenantName"
|
||||
placeholder="请输入模型名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属租户" prop="tenantType">
|
||||
<el-select v-model="queryParams.tenantType" placeholder="请选择所属租户" clearable>
|
||||
<el-option
|
||||
v-for="i in tenants"
|
||||
:key="i.value"
|
||||
:label="i.tenantName"
|
||||
:value="i.tenantId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="所属场景" prop="tenantIndustry">
|
||||
<el-select v-model="queryParams.tenantIndustry" placeholder="请选择所属场景" clearable>
|
||||
<el-option
|
||||
v-for="i in sceneModes"
|
||||
:key="i.value"
|
||||
:label="i.sceneModeName"
|
||||
:value="i.sceneModeId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</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"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center"/>
|
||||
<el-table-column label="模型id" align="center" prop="value"/>
|
||||
<el-table-column label="模型名称" align="center" prop="value"/>
|
||||
<el-table-column label="所属租户" align="center" prop="value"/>
|
||||
<el-table-column label="所属场景" align="center" prop="value"/>
|
||||
|
||||
<el-table-column label="操作" width="200px" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="toBind(scope.row)"
|
||||
>绑定属性
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</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" fullscreen :visible.sync="open" width="30%" append-to-body>
|
||||
<el-form ref="form" :model="form" label-width="100px">
|
||||
<el-form-item label="模型名称">
|
||||
<el-input v-model="form.tenantName" placeholder="请输入模型名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属租户" prop="tenantName">
|
||||
<el-select v-model="form.tenantType" placeholder="请选择所属租户" clearable>
|
||||
<el-option
|
||||
v-for="i in tenants"
|
||||
:key="i.value"
|
||||
:label="i.tenantName"
|
||||
:value="i.tenantId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属场景" prop="contactName">
|
||||
<el-select v-model="form.tenantIndustry" placeholder="请选择所属场景" clearable>
|
||||
<el-option
|
||||
v-for="i in sceneModes"
|
||||
:key="i.value"
|
||||
:label="i.sceneModeName"
|
||||
:value="i.sceneModeId">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</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 {addScene, delScene, getSceneModes, getTenants, updateScene} from "@/api/business/scene";
|
||||
|
||||
export default {
|
||||
name: "PLCModel",
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
ids: [],
|
||||
single: true,
|
||||
multiple: true,
|
||||
queryParams: {},
|
||||
list: [
|
||||
{
|
||||
value: 1
|
||||
}
|
||||
],
|
||||
total: 10,
|
||||
sceneModes: [],
|
||||
tenants: [],
|
||||
form: {},
|
||||
title: "",
|
||||
open: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTenants();
|
||||
this.getSceneModes()
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
getTenants() {
|
||||
getTenants().then(response => {
|
||||
this.tenants = response.data;
|
||||
console.log(response.data)
|
||||
})
|
||||
},
|
||||
getSceneModes() {
|
||||
getSceneModes().then(response => {
|
||||
this.sceneModes = response.data;
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
getList() {
|
||||
this.loading = false
|
||||
},
|
||||
reset() {
|
||||
this.form = {};
|
||||
this.resetForm("form");
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加模型";
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const sceneId = row.sceneId || this.ids
|
||||
this.open = true;
|
||||
this.title = "修改场景信息";
|
||||
},
|
||||
handleDelete(row) {
|
||||
const sceneIds = row.sceneId || this.ids;
|
||||
this.$modal.confirm('是否确认删除模型ID为"' + sceneIds + '"的数据项?').then(function () {
|
||||
return delScene(sceneIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.sceneId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.sceneId != null) {
|
||||
updateScene(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
});
|
||||
} else {
|
||||
addScene(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
}
|
||||
});
|
||||
},
|
||||
toBind(){
|
||||
this.$router.push('bind')
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue