Compare commits
14 Commits
dev_2026-0
...
a3e5408488
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3e5408488 | ||
|
|
e156a8d34c | ||
|
|
998e9afd33 | ||
|
|
bbfd57e737 | ||
|
|
760eccdecc | ||
|
|
ff257d8e68 | ||
|
|
0d032f82f5 | ||
|
|
cc6c894dc6 | ||
|
|
6fd0abef89 | ||
|
|
a41891e528 | ||
|
|
ba4d30f048 | ||
|
|
4f468c4569 | ||
|
|
7a81a41c78 | ||
|
|
281c6d71b2 |
@@ -2,43 +2,70 @@ import request from '@/utils/request';
|
||||
|
||||
// 查询组态列表
|
||||
export function listCenter(query) {
|
||||
return request({
|
||||
url: '/scada/picture/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
return request({
|
||||
url: '/scada/picture/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询组态详情
|
||||
export function getCenter(id) {
|
||||
return request({
|
||||
url: '/scada/picture/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
return request({
|
||||
url: '/scada/picture/' + id,
|
||||
method: 'get',
|
||||
});
|
||||
}
|
||||
|
||||
// 新增组态
|
||||
export function addCenter(data) {
|
||||
return request({
|
||||
url: '/scada/picture',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: '/scada/picture',
|
||||
method: 'post',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 修改组态
|
||||
export function updateCenter(data) {
|
||||
return request({
|
||||
url: '/scada/picture',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
return request({
|
||||
url: '/scada/picture',
|
||||
method: 'put',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
// 删除组态
|
||||
export function delCenter(id) {
|
||||
return request({
|
||||
url: '/scada/picture/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
return request({
|
||||
url: '/scada/picture/' + id,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
// 查询维修完成情况数据
|
||||
export function getMaintenanceData(query) {
|
||||
return request({
|
||||
url: '/iot/configuration/repairList',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询保养统计数据
|
||||
export function getMaintenanceStats(query) {
|
||||
return request({
|
||||
url: '/iot/configuration/maintenanceList',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
// 查询设备列表
|
||||
export function getDeviceList(query) {
|
||||
return request({
|
||||
url: '/iot/configuration/deviceList',
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
}
|
||||
|
||||
BIN
src/assets/picture/dg2.png
Normal file
BIN
src/assets/picture/dg2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 641 KiB |
BIN
src/assets/picture/dg2slt.png
Normal file
BIN
src/assets/picture/dg2slt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 880 KiB |
@@ -628,6 +628,10 @@
|
||||
"iot.group.index.637432-25": "新增成功",
|
||||
"iot.group.index.637432-26": "是否确认删除设备分组编号为{0}的数据项?",
|
||||
"iot.group.index.637432-27": "删除成功",
|
||||
"iot.group.index.637432-28": "上级分类",
|
||||
"iot.group.index.637432-29": "请选择上级分类",
|
||||
"iot.group.index.637432-30": "类型编码",
|
||||
"iot.group.index.637432-31": "请选择设备类型编码",
|
||||
"iot.group.device-list.849593-0": "选择设备",
|
||||
"iot.group.device-list.849593-1": "设备名称",
|
||||
"iot.group.device-list.849593-2": "请输入设备名称",
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
"product.product-things-model.142341-1": "导入通用物模型",
|
||||
"product.product-things-model.142341-2": "刷新",
|
||||
"product.product-things-model.142341-3": "查看物模型",
|
||||
"product.product-things-model.142341-4": "注意:标识符不能重复",
|
||||
"product.product-things-model.142341-4": "注意:同设备类型下标识符不能重复",
|
||||
"product.product-things-model.142341-5": "请选择设备从机:",
|
||||
"product.product-things-model.142341-6": "请选择设备从机",
|
||||
"product.product-things-model.142341-7": "网关物模型",
|
||||
@@ -377,6 +377,10 @@
|
||||
"product.product-things-model.142341-133": "搜索",
|
||||
"product.product-things-model.142341-134": "重置",
|
||||
"product.product-things-model.142341-135": "分组",
|
||||
"product.product-things-model.142341-136": "设备类型",
|
||||
"product.product-things-model.142341-137": "请选择设备类型",
|
||||
"product.product-things-model.142341-138": "模型名称",
|
||||
"product.product-things-model.142341-139": "请选择模型名称",
|
||||
"product.product-modbus.562372-0": "网关子设备配置",
|
||||
"product.product-modbus.562372-1": "网关子设备配置默认的子设备地址,轮询方式",
|
||||
"product.product-modbus.562372-2": "编辑设备配置",
|
||||
@@ -449,15 +453,20 @@
|
||||
"product.thimgs-mopdel-list.738493-8": "关 闭",
|
||||
"product.components.batchImportModbus.745343-0": "IO寄存器模板",
|
||||
"product.components.batchImportModbus.745343-1": "数据寄存器模板",
|
||||
"product.category.142342-0": "产品分类名称",
|
||||
"product.category.142342-0": "设备分类名称",
|
||||
"product.category.142342-1": "显示顺序",
|
||||
"product.category.142342-2": "请输入显示顺序",
|
||||
"product.category.142342-3": "请输入内容",
|
||||
"product.category.142342-4": "产品分类名称不能为空",
|
||||
"product.category.142342-4": "设备分类名称不能为空",
|
||||
"product.category.142342-5": "是否系统通用不能为空",
|
||||
"product.category.142342-6": "添加产品分类",
|
||||
"product.category.142342-7": "修改产品分类",
|
||||
"product.category.142342-8": "是否确认删除产品分类编号为{0}的数据项?",
|
||||
"product.category.142342-6": "添加设备分类",
|
||||
"product.category.142342-7": "修改设备分类",
|
||||
"product.category.142342-8": "是否确认删除设备分类名称为:“{0}”的数据项?",
|
||||
"product.category.142342-9": "上级分类",
|
||||
"product.category.142342-10": "请选择上级分类",
|
||||
"product.category.142342-14": "类型编码不能为空",
|
||||
"product.category.142342-12": "类型编码",
|
||||
"product.category.142342-13": "请选择设备类型编码",
|
||||
"product.product-scada.034908-0": "创建组态",
|
||||
"product.product-sub.3843945-0": "添加子产品",
|
||||
"product.product-sub.3843945-1": "删除子产品",
|
||||
|
||||
@@ -139,6 +139,11 @@ export const constantRoutes = [
|
||||
component: () => import('@/views/scada/picture/screen'),
|
||||
hidden: true,
|
||||
},
|
||||
{
|
||||
path: '/scada/picture/screen2',
|
||||
component: () => import('@/views/scada/picture/screen2'),
|
||||
hidden: true,
|
||||
},
|
||||
];
|
||||
|
||||
// 动态路由,基于用户权限动态去加载
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
export function loadBMap() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (typeof BMap !== 'undefined') {
|
||||
resolve(BMap)
|
||||
return true
|
||||
}
|
||||
window.onBMapCallback = function() {
|
||||
resolve(BMap)
|
||||
resolve(BMap);
|
||||
return true;
|
||||
}
|
||||
window.onBMapCallback = function () {
|
||||
resolve(BMap);
|
||||
};
|
||||
// 使用https协议需要添加一下meta标签
|
||||
var protocolStr = document.location.protocol;
|
||||
if(protocolStr == "https:")
|
||||
{
|
||||
let meta = document.createElement('meta')
|
||||
meta.httpEquiv = 'Content-Security-Policy'
|
||||
meta.content ='upgrade-insecure-requests'
|
||||
meta.onerror = reject
|
||||
document.head.appendChild(meta)
|
||||
}
|
||||
var protocolStr = document.location.protocol;
|
||||
if (protocolStr == 'https:') {
|
||||
let meta = document.createElement('meta');
|
||||
meta.httpEquiv = 'Content-Security-Policy';
|
||||
meta.content = 'upgrade-insecure-requests';
|
||||
meta.onerror = reject;
|
||||
document.head.appendChild(meta);
|
||||
}
|
||||
// 引入百度地图
|
||||
let script = document.createElement('script')
|
||||
script.type = 'text/javascript'
|
||||
script.src =
|
||||
'http://api.map.baidu.com/api?v=2.0&ak='+ process.env.VUE_APP_BAI_DU_AK +'&s=1&__ec_v__=20190126&callback=onBMapCallback'
|
||||
script.onerror = reject
|
||||
document.head.appendChild(script)
|
||||
})
|
||||
}
|
||||
let script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = 'http://api.map.baidu.com1/api?v=2.0&ak=' + process.env.VUE_APP_BAI_DU_AK + '&s=1&__ec_v__=20190126&callback=onBMapCallback';
|
||||
script.onerror = reject;
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:category:add']">{{ $t('add') }}</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">{{ $t('role.index.094567-18') }}</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5" style="line-height: 28px">
|
||||
<el-checkbox v-model="queryParams.showSenior" style="margin: 0 10px" @change="handleQuery">{{ $t('product.index.091251-8') }}</el-checkbox>
|
||||
<el-tooltip :content="$t('product.index.091251-9')" placement="top"><i class="el-icon-question"></i></el-tooltip>
|
||||
@@ -24,8 +27,9 @@
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange" :border="false">
|
||||
<el-table-column :label="$t('product.category.142342-0')" align="center" prop="categoryName" />
|
||||
<el-table v-if="refreshTable" v-loading="loading" :data="categoryList" :border="false" row-key="categoryId" :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column :label="$t('product.category.142342-0')" align="left" prop="categoryName" min-width="250" />
|
||||
<el-table-column :label="$t('product.category.142342-12')" align="center" prop="industryCode" width="150" />
|
||||
<el-table-column :label="$t('template.index.891112-12')" align="center" prop="isSys" width="100">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.iot_yes_no" :value="scope.row.isSys" />
|
||||
@@ -57,9 +61,19 @@
|
||||
<!-- 添加或修改产品分类对话框 -->
|
||||
<el-dialog :title="$t('product.index.091251-2')" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label="$t('product.category.142342-9')" prop="parentId">
|
||||
<treeselect v-model="form.parentId" :options="categoryOptions" :normalizer="normalizer" :placeholder="$t('product.category.142342-10')" :max-height="300" :searchable="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item :label="$t('product.index.091251-2')" prop="categoryName">
|
||||
<el-input v-model="form.categoryName" :placeholder="$t('product.index.091251-3')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.category.142342-12')" prop="industryCode">
|
||||
<el-input v-model="form.industryCode" :placeholder="$t('product.category.142342-13')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.category.142342-1')" prop="orderNum">
|
||||
<el-input-number controls-position="right" v-model="form.orderNum" type="number" :placeholder="$t('product.category.142342-2')" style="width: 100%" />
|
||||
</el-form-item>
|
||||
@@ -78,32 +92,35 @@
|
||||
|
||||
<script>
|
||||
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from '@/api/iot/category';
|
||||
import Treeselect from '@riophae/vue-treeselect';
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
|
||||
|
||||
export default {
|
||||
name: 'Category',
|
||||
dicts: ['iot_yes_no'],
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
// 是否为租户
|
||||
isTenant: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 产品分类表格数据
|
||||
categoryList: [],
|
||||
// 分类树选项
|
||||
categoryOptions: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
showSenior: false,
|
||||
@@ -123,6 +140,13 @@ export default {
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
industryCode: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('product.category.142342-14'),
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
isSys: [
|
||||
{
|
||||
required: true,
|
||||
@@ -147,11 +171,53 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCategory(this.queryParams).then((response) => {
|
||||
this.categoryList = response.rows;
|
||||
this.categoryList = this.handleTree(response.rows, 'categoryId');
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 转换树形结构 */
|
||||
handleTree(data, id) {
|
||||
const tree = [];
|
||||
const map = {};
|
||||
|
||||
data.forEach(item => {
|
||||
map[item[id]] = item;
|
||||
});
|
||||
|
||||
data.forEach(item => {
|
||||
const parent = map[item.parentId];
|
||||
if (parent) {
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
parent.children.push(item);
|
||||
} else {
|
||||
tree.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return tree;
|
||||
},
|
||||
/** 展开/折叠操作 */
|
||||
toggleExpandAll() {
|
||||
this.refreshTable = false;
|
||||
this.isExpandAll = !this.isExpandAll;
|
||||
this.$nextTick(() => {
|
||||
this.refreshTable = true;
|
||||
});
|
||||
},
|
||||
/** 转换分类数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.categoryId,
|
||||
label: node.categoryName,
|
||||
children: node.children,
|
||||
};
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
@@ -166,6 +232,7 @@ export default {
|
||||
tenantName: null,
|
||||
isSys: null,
|
||||
parentId: null,
|
||||
industryCode: null,
|
||||
orderNum: null,
|
||||
delFlag: null,
|
||||
createBy: null,
|
||||
@@ -186,26 +253,37 @@ export default {
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.categoryId);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
handleAdd(row) {
|
||||
this.reset();
|
||||
if (row != undefined) {
|
||||
this.form.parentId = row.categoryId;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = this.$t('product.category.142342-6');
|
||||
const params = {
|
||||
pageSize: 9999 // 确保加载所有分类
|
||||
};
|
||||
listCategory(params).then((response) => {
|
||||
this.categoryOptions = this.handleTree(response.rows, 'categoryId');
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const categoryId = row.categoryId || this.ids;
|
||||
getCategory(categoryId).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = this.$t('product.category.142342-7');
|
||||
// 先加载分类树选项
|
||||
const params = {
|
||||
pageSize: 9999 // 确保加载所有分类
|
||||
};
|
||||
listCategory(params).then((categoryResponse) => {
|
||||
this.categoryOptions = this.handleTree(categoryResponse.rows, 'categoryId');
|
||||
// 再加载分类详情
|
||||
getCategory(row.categoryId).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = this.$t('product.category.142342-7');
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@@ -230,18 +308,14 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const categoryIds = row.categoryId || this.ids;
|
||||
let msg = '';
|
||||
this.$modal
|
||||
.confirm(this.$t('product.category.142342-8', [categoryIds]))
|
||||
.confirm(this.$t('product.category.142342-8', [row.categoryName]))
|
||||
.then(function () {
|
||||
return delCategory(categoryIds).then((response) => {
|
||||
msg = response.msg;
|
||||
});
|
||||
return delCategory(row.categoryId);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess(msg);
|
||||
this.$modal.msgSuccess(this.$t('delSuccess'));
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
|
||||
@@ -921,10 +921,11 @@ export default {
|
||||
return;
|
||||
}
|
||||
let reg = /^[0-9a-zA-Z]+$/;
|
||||
if (!reg.test(this.form.serialNumber)) {
|
||||
this.$modal.alertError(this.$t('device.device-edit.148398-66'));
|
||||
return;
|
||||
}
|
||||
//if (!reg.test(this.form.serialNumber)) {
|
||||
// this.$modal.alertError(this.$t('device.device-edit.148398-66'));
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (this.form.productId == null || this.form.productId == 0) {
|
||||
this.$modal.alertError(this.$t('device.device-edit.148398-67'));
|
||||
return;
|
||||
|
||||
@@ -18,11 +18,15 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['iot:group:add']">{{ $t('iot.group.index.637432-5') }}</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">{{ $t('role.index.094567-18') }}</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="groupList" :border="false" @selection-change="handleSelectionChange">
|
||||
<el-table-column :label="$t('iot.group.index.637432-0')" align="center" prop="groupName" min-width="200" />
|
||||
<el-table v-if="refreshTable" v-loading="loading" :data="groupList" :border="false" row-key="groupId" :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
||||
<el-table-column :label="$t('iot.group.index.637432-0')" align="left" prop="groupName" min-width="200" />
|
||||
<el-table-column :label="$t('product.category.142342-12')" align="center" prop="industryCode" width="150" />
|
||||
<el-table-column :label="$t('iot.group.index.637432-6')" align="center" prop="groupOrder" width="100" />
|
||||
<el-table-column :label="$t('iot.group.index.637432-7')" align="center" prop="createTime" width="160">
|
||||
<template slot-scope="scope">
|
||||
@@ -54,12 +58,23 @@
|
||||
<!-- 添加或修改设备分组对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item :label="$t('iot.group.index.637432-28')" prop="parentId">
|
||||
<treeselect v-model="form.parentId" :options="groupOptions" :normalizer="normalizer" :placeholder="$t('iot.group.index.637432-29')" :max-height="300" :searchable="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item :label="$t('iot.group.index.637432-0')" prop="groupName">
|
||||
<el-input v-model="form.groupName" :placeholder="$t('iot.group.index.637432-1')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.category.142342-12')" prop="industryCode">
|
||||
<el-input v-model="form.industryCode" :placeholder="$t('product.category.142342-13')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('iot.group.index.637432-6')" prop="groupOrder">
|
||||
<el-input v-model="form.groupOrder" type="number" :placeholder="$t('iot.group.index.637432-15')" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('iot.group.index.637432-9')" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :placeholder="$t('iot.group.index.637432-16')" />
|
||||
</el-form-item>
|
||||
@@ -77,11 +92,14 @@
|
||||
import deviceList from './device-list';
|
||||
import { listGroup, getGroup, delGroup, addGroup, updateGroup } from '@/api/iot/group';
|
||||
import { getUserId } from '@/utils/auth';
|
||||
import Treeselect from '@riophae/vue-treeselect';
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
|
||||
|
||||
export default {
|
||||
name: 'Group',
|
||||
components: {
|
||||
deviceList,
|
||||
Treeselect,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -103,14 +121,20 @@ export default {
|
||||
total: 0,
|
||||
// 设备分组表格数据
|
||||
groupList: [],
|
||||
// 分组树选项
|
||||
groupOptions: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
pageSize: 20,
|
||||
groupName: null,
|
||||
userId: null,
|
||||
},
|
||||
@@ -165,11 +189,53 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listGroup(this.queryParams).then((response) => {
|
||||
this.groupList = response.rows;
|
||||
this.groupList = this.handleTree(response.rows, 'groupId');
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 转换树形结构 */
|
||||
handleTree(data, id) {
|
||||
const tree = [];
|
||||
const map = {};
|
||||
|
||||
data.forEach(item => {
|
||||
map[item[id]] = item;
|
||||
});
|
||||
|
||||
data.forEach(item => {
|
||||
const parent = map[item.parentId];
|
||||
if (parent) {
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
parent.children.push(item);
|
||||
} else {
|
||||
tree.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return tree;
|
||||
},
|
||||
/** 展开/折叠操作 */
|
||||
toggleExpandAll() {
|
||||
this.refreshTable = false;
|
||||
this.isExpandAll = !this.isExpandAll;
|
||||
this.$nextTick(() => {
|
||||
this.refreshTable = true;
|
||||
});
|
||||
},
|
||||
/** 转换分组数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.groupId,
|
||||
label: node.groupName,
|
||||
children: node.children,
|
||||
};
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
@@ -183,6 +249,8 @@ export default {
|
||||
groupOrder: null,
|
||||
userId: null,
|
||||
userName: null,
|
||||
parentId: null,
|
||||
industryCode: null,
|
||||
delFlag: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
@@ -209,19 +277,35 @@ export default {
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
handleAdd(row) {
|
||||
this.reset();
|
||||
if (row != undefined) {
|
||||
this.form.parentId = row.groupId;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = this.$t('iot.group.index.637432-22');
|
||||
const params = {
|
||||
pageSize: 9999 // 确保加载所有分组
|
||||
};
|
||||
listGroup(params).then((response) => {
|
||||
this.groupOptions = this.handleTree(response.rows, 'groupId');
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const groupId = row.groupId || this.ids;
|
||||
getGroup(groupId).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = this.$t('iot.group.index.637432-23');
|
||||
// 先加载分组树选项
|
||||
const params = {
|
||||
pageSize: 9999 // 确保加载所有分组
|
||||
};
|
||||
listGroup(params).then((groupResponse) => {
|
||||
this.groupOptions = this.handleTree(groupResponse.rows, 'groupId');
|
||||
// 再加载分组详情
|
||||
getGroup(row.groupId).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = this.$t('iot.group.index.637432-23');
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 选择设备 */
|
||||
@@ -252,11 +336,10 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const groupIds = row.groupId || this.ids;
|
||||
this.$modal
|
||||
.confirm(this.$t('iot.group.index.637432-26', [groupIds]))
|
||||
.confirm(this.$t('iot.group.index.637432-26', [row.groupName]))
|
||||
.then(function () {
|
||||
return delGroup(groupIds);
|
||||
return delGroup(row.groupId);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
|
||||
@@ -14,16 +14,17 @@
|
||||
<el-input v-model="form.productName" :placeholder="$t('product.product-edit.473153-2')" :readonly="form.status == 2 || form.isOwner == 0" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.product-edit.473153-3')" prop="categoryId">
|
||||
<el-select
|
||||
<treeselect
|
||||
v-model="form.categoryId"
|
||||
:options="categoryOptions"
|
||||
:normalizer="normalizer"
|
||||
:placeholder="$t('product.product-edit.473153-4')"
|
||||
@change="selectCategory"
|
||||
style="width: 100%"
|
||||
:disabled="form.status == 2 || form.isOwner == 0"
|
||||
:filterable="true"
|
||||
>
|
||||
<el-option v-for="category in categoryShortList" :key="category.id" :label="category.name" :value="category.id"></el-option>
|
||||
</el-select>
|
||||
:max-height="300"
|
||||
:searchable="true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.product-edit.473153-78')" prop="deviceType">
|
||||
<el-select
|
||||
@@ -285,8 +286,10 @@ import productModbus from './product-modbus';
|
||||
import { listProtocol } from '@/api/iot/protocol';
|
||||
import productSub from './product-sub'; //子产品
|
||||
import productModbusTask from './product-modbus-task'; //轮询任务
|
||||
import { listShortCategory } from '@/api/iot/category';
|
||||
import { listShortCategory, listCategory } from '@/api/iot/category';
|
||||
import { getProduct, addProduct, updateProduct, changeProductStatus, deviceCount } from '@/api/iot/product';
|
||||
import Treeselect from '@riophae/vue-treeselect';
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
|
||||
import { getTempByPId, listTemp } from '@/api/iot/temp';
|
||||
import { getAllPoints } from '@/api/iot/template';
|
||||
import ProductModbus from '@/views/iot/product/product-modbus';
|
||||
@@ -297,6 +300,7 @@ export default {
|
||||
dicts: ['iot_device_type', 'iot_network_method', 'iot_vertificate_method', 'iot_transport_type', 'data_collect_type', 'iot_location_way', 'sub_gateway_type'],
|
||||
components: {
|
||||
ProductModbus,
|
||||
Treeselect,
|
||||
productThingsModel,
|
||||
productApp,
|
||||
productModbus,
|
||||
@@ -317,6 +321,8 @@ export default {
|
||||
activeName: 'basic',
|
||||
// 分类短列表
|
||||
categoryShortList: [],
|
||||
// 分类树选项
|
||||
categoryOptions: [],
|
||||
//协议列表
|
||||
protocolList: [],
|
||||
//组态相关按钮是否显示,true显示,false不显示
|
||||
@@ -451,15 +457,52 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 获取简短分类列表
|
||||
// 获取分类树
|
||||
getShortCategory() {
|
||||
const data = {
|
||||
pageSize: 999,
|
||||
const params = {
|
||||
pageSize: 9999 // 确保加载所有分类
|
||||
};
|
||||
listShortCategory(data).then((response) => {
|
||||
this.categoryShortList = response.data;
|
||||
listCategory(params).then((response) => {
|
||||
console.log('listCategory response:', response);
|
||||
this.categoryOptions = this.handleTree(response.rows, 'categoryId');
|
||||
console.log('categoryOptions after handleTree:', this.categoryOptions);
|
||||
console.log('Total categories loaded:', response.rows.length);
|
||||
});
|
||||
},
|
||||
/** 转换树形结构 */
|
||||
handleTree(data, id) {
|
||||
const tree = [];
|
||||
const map = {};
|
||||
|
||||
data.forEach(item => {
|
||||
map[item[id]] = item;
|
||||
});
|
||||
|
||||
data.forEach(item => {
|
||||
const parent = map[item.parentId];
|
||||
if (parent) {
|
||||
if (!parent.children) {
|
||||
parent.children = [];
|
||||
}
|
||||
parent.children.push(item);
|
||||
} else {
|
||||
tree.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
return tree;
|
||||
},
|
||||
/** 转换分类数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.categoryId,
|
||||
label: node.categoryName,
|
||||
children: node.children,
|
||||
};
|
||||
},
|
||||
//接收网关子设备配置的参数,为了轮询任务页签的显示
|
||||
sendPollType(value) {
|
||||
this.polltype = value;
|
||||
@@ -512,6 +555,28 @@ export default {
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
// 确保categoryName被正确赋值
|
||||
if (this.form.categoryId && !this.form.categoryName) {
|
||||
const findCategoryName = (options, id) => {
|
||||
for (const option of options) {
|
||||
if (option.categoryId == id) {
|
||||
return option.categoryName;
|
||||
}
|
||||
if (option.children && option.children.length > 0) {
|
||||
const name = findCategoryName(option.children, id);
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
const categoryName = findCategoryName(this.categoryOptions, this.form.categoryId);
|
||||
if (categoryName) {
|
||||
this.form.categoryName = categoryName;
|
||||
}
|
||||
}
|
||||
console.log('Form data before submit:', this.form);
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.productId != null && this.form.productId != 0) {
|
||||
@@ -582,11 +647,29 @@ export default {
|
||||
},
|
||||
/** 选择分类 */
|
||||
selectCategory(val) {
|
||||
for (var i = 0; i < this.categoryShortList.length; i++) {
|
||||
if (this.categoryShortList[i].id == val) {
|
||||
this.form.categoryName = this.categoryShortList[i].name;
|
||||
return;
|
||||
console.log('selectCategory called with val:', val);
|
||||
console.log('categoryOptions:', this.categoryOptions);
|
||||
// 在树形结构中查找分类名称
|
||||
const findCategoryName = (options, id) => {
|
||||
for (const option of options) {
|
||||
if (option.categoryId == id) {
|
||||
return option.categoryName;
|
||||
}
|
||||
if (option.children && option.children.length > 0) {
|
||||
const name = findCategoryName(option.children, id);
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const categoryName = findCategoryName(this.categoryOptions, val);
|
||||
console.log('Found categoryName:', categoryName);
|
||||
if (categoryName) {
|
||||
this.form.categoryName = categoryName;
|
||||
console.log('form.categoryName set to:', this.form.categoryName);
|
||||
}
|
||||
},
|
||||
/**获取上传图片的路径 */
|
||||
|
||||
@@ -1,28 +1,30 @@
|
||||
<template>
|
||||
<div style="padding-left: 20px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
|
||||
<!-- <el-form-item :label="$t('product.product-things-model.142341-127')" prop="isAPP">
|
||||
<el-select v-model="queryParams.isAPP" :placeholder="$t('product.product-things-model.142341-128')" clearable
|
||||
size="small">
|
||||
<el-option v-for="dict in dict.type.iot_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item :label="$t('product.product-things-model.142341-129')" prop="type">
|
||||
<el-select v-model="queryParams.type" :placeholder="$t('product.product-things-model.142341-130')" clearable size="small">
|
||||
<el-option v-for="dict in dict.type.iot_things_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.product-things-model.142341-131')" prop="isHistory">
|
||||
<el-select v-model="queryParams.isHistory" :placeholder="$t('product.product-things-model.142341-132')" clearable size="small">
|
||||
<el-option v-for="dict in dict.type.iot_yes_no" :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" size="mini" @click="handleQuery">{{ $t('product.product-things-model.142341-133') }}</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('product.product-things-model.142341-134') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="108px">
|
||||
<!-- <el-form-item :label="$t('product.product-things-model.142341-138')" prop="modelName">-->
|
||||
<!-- <el-input v-model="queryParams.modelName" :placeholder="$t('product.product-things-model.142341-139')" clearable size="small" @keyup.enter.native="handleQuery" />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item :label="$t('product.product-things-model.142341-129')" prop="type">
|
||||
<el-select v-model="queryParams.type" :placeholder="$t('product.product-things-model.142341-130')" clearable size="small" @change="handleQuery">
|
||||
<el-option v-for="dict in dict.type.iot_things_type" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.product-things-model.142341-136')" prop="devType">
|
||||
<el-select v-model="queryParams.devType" :placeholder="$t('product.product-things-model.142341-137')" clearable size="small" @change="handleQuery">
|
||||
<el-option v-for="dict in dict.type.model_dev_type" :key="dict.value" :label="dict.label" :value="Number(dict.value)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.product-things-model.142341-131')" prop="isHistory">
|
||||
<el-select v-model="queryParams.isHistory" :placeholder="$t('product.product-things-model.142341-132')" clearable size="small" @change="handleQuery">
|
||||
<el-option v-for="dict in dict.type.iot_yes_no" :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" size="mini" @click="handleQuery">{{ $t('product.product-things-model.142341-133') }}</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('product.product-things-model.142341-134') }}</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-if="productInfo.status == 1 && productInfo.isOwner != 0" v-hasPermi="['iot:model:add']">
|
||||
@@ -98,7 +100,12 @@
|
||||
<div v-html="formatSpecsDisplay(scope.row.specs)"></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('product.product-things-model.142341-19')" align="center" prop="formula" />
|
||||
<el-table-column :label="$t('product.product-things-model.142341-136')" align="center" prop="devType" width="80">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.model_dev_type" :value="scope.row.devType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column :label="$t('product.product-things-model.142341-19')" align="center" prop="formula" />-->
|
||||
<el-table-column :label="$t('product.product-things-model.142341-20')" align="center" prop="modelOrder" width="80" />
|
||||
<el-table-column :label="$t('product.product-things-model.142341-21')" align="center" class-name="small-padding fixed-width" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
@@ -133,6 +140,11 @@
|
||||
<el-radio-button label="3">{{ $t('product.product-things-model.142341-33') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.product-things-model.142341-136')" prop="devType">
|
||||
<el-select v-model="form.devType" :placeholder="$t('product.product-things-model.142341-137')" clearable style="width: 385px">
|
||||
<el-option v-for="dict in dict.type.model_dev_type" :key="dict.value" :label="dict.label" :value="String(dict.value)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('product.product-things-model.142341-34')" prop="property">
|
||||
<el-checkbox name="isChart" :label="$t('product.product-things-model.142341-12')" @change="isChartChange" v-show="form.type == 1" v-model="form.isChart" :true-label="1" :false-label="0"></el-checkbox>
|
||||
<el-checkbox
|
||||
@@ -391,7 +403,7 @@ import importBatch from './components/batchImportThingsModel';
|
||||
|
||||
export default {
|
||||
name: 'product-things-model',
|
||||
dicts: ['iot_things_type', 'iot_data_type', 'iot_yes_no'],
|
||||
dicts: ['iot_things_type', 'iot_data_type', 'iot_yes_no', 'model_dev_type'],
|
||||
components: {
|
||||
productSelectTemplate,
|
||||
thingsParameter,
|
||||
@@ -537,6 +549,7 @@ export default {
|
||||
modelOrder: 0,
|
||||
type: 1,
|
||||
datatype: 'integer',
|
||||
devType: null,
|
||||
isSys: null,
|
||||
isChart: 1,
|
||||
isHistory: 1,
|
||||
@@ -564,16 +577,19 @@ export default {
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm');
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm');
|
||||
// 重置后确保 devType 为 undefined 而不是空字符串
|
||||
this.queryParams.devType = undefined;
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
@@ -581,43 +597,55 @@ export default {
|
||||
this.title = this.$t('product.product-things-model.142341-99');
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const modelId = row.modelId;
|
||||
getModel(modelId).then((response) => {
|
||||
let tempForm = response.data;
|
||||
this.open = true;
|
||||
this.title = this.$t('product.product-things-model.142341-100');
|
||||
// Json转对象
|
||||
tempForm.specs = JSON.parse(tempForm.specs);
|
||||
if (!tempForm.specs.enumList) {
|
||||
tempForm.specs.showWay = 'select';
|
||||
tempForm.specs.enumList = [
|
||||
{
|
||||
value: '',
|
||||
text: '',
|
||||
},
|
||||
];
|
||||
}
|
||||
if (!tempForm.specs.arrayType) {
|
||||
tempForm.specs.arrayType = 'integer';
|
||||
}
|
||||
if (!tempForm.specs.arrayCount) {
|
||||
tempForm.specs.arrayCount = 5;
|
||||
}
|
||||
if (!tempForm.specs.params) {
|
||||
tempForm.specs.params = [];
|
||||
}
|
||||
// 对象和数组中参数删除前缀
|
||||
if ((tempForm.specs.type == 'array' && tempForm.specs.arrayType == 'object') || tempForm.specs.type == 'object') {
|
||||
for (let i = 0; i < tempForm.specs.params.length; i++) {
|
||||
tempForm.specs.params[i].id = String(tempForm.specs.params[i].id).substring(String(tempForm.identifier).length + 1);
|
||||
}
|
||||
}
|
||||
this.form = tempForm;
|
||||
});
|
||||
},
|
||||
/**查看物模型 */
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const modelId = row.modelId;
|
||||
getModel(modelId).then((response) => {
|
||||
let tempForm = response.data;
|
||||
this.open = true;
|
||||
this.title = this.$t('product.product-things-model.142341-100');
|
||||
// devType类型转换,确保与下拉选项类型一致(String类型)
|
||||
if (tempForm.devType != null && tempForm.devType !== '') {
|
||||
tempForm.devType = String(tempForm.devType);
|
||||
} else {
|
||||
tempForm.devType = undefined;
|
||||
}
|
||||
// Json转对象
|
||||
tempForm.specs = JSON.parse(tempForm.specs);
|
||||
if (!tempForm.specs.enumList) {
|
||||
tempForm.specs.showWay = 'select';
|
||||
tempForm.specs.enumList = [
|
||||
{
|
||||
value: '',
|
||||
text: '',
|
||||
},
|
||||
];
|
||||
}
|
||||
if (!tempForm.specs.arrayType) {
|
||||
tempForm.specs.arrayType = 'integer';
|
||||
}
|
||||
if (!tempForm.specs.arrayCount) {
|
||||
tempForm.specs.arrayCount = 5;
|
||||
}
|
||||
if (!tempForm.specs.params) {
|
||||
tempForm.specs.params = [];
|
||||
}
|
||||
// 对象和数组中参数删除前缀
|
||||
if ((tempForm.specs.type == 'array' && tempForm.specs.arrayType == 'object') || tempForm.specs.type == 'object') {
|
||||
for (let i = 0; i < tempForm.specs.params.length; i++) {
|
||||
tempForm.specs.params[i].id = String(tempForm.specs.params[i].id).substring(String(tempForm.identifier).length + 1);
|
||||
}
|
||||
}
|
||||
this.form = tempForm;
|
||||
// 强制更新视图
|
||||
this.$nextTick(() => {
|
||||
this.$set(this.form, 'devType', this.form.devType);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**查看物模型 */
|
||||
handleOpenThingsModel() {
|
||||
this.title = this.$t('product.product-things-model.142341-101');
|
||||
// 生成物模型
|
||||
@@ -702,74 +730,87 @@ export default {
|
||||
// 使用正则表达式检查值中是否包含下划线
|
||||
return /_/.test(value);
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 验证对象或对象数组中的参数不能为空
|
||||
if (this.form.datatype == 'object' || (this.form.datatype == 'array' && this.form.specs.arrayType == 'object')) {
|
||||
if (!this.form.specs.params || this.form.specs.params == 0) {
|
||||
this.$modal.msgError(this.$t('product.product-things-model.142341-102'));
|
||||
return;
|
||||
}
|
||||
if (this.containsUnderscore(this.form.identifier)) {
|
||||
this.$modal.msgError(this.$t('product.product-things-model.142341-103'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 验证对象参数标识符不能相同
|
||||
if (this.form.specs.params && this.form.specs.params.length > 0) {
|
||||
let arr = this.form.specs.params.map((item) => item.id).sort();
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (arr[i] == arr[i + 1]) {
|
||||
this.$modal.msgError('参数标识 ' + arr[i] + ' 重复');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
//验证模型特性为图表展示时,数据类型是否为整数或者小数
|
||||
if (this.form.isChart == 1 && this.form.datatype != 'integer' && this.form.isChart == 1 && this.form.datatype != 'decimal') {
|
||||
this.$modal.msgError(this.$t('product.product-things-model.142341-106'));
|
||||
} else if (this.form.modelId != null) {
|
||||
// 格式化specs
|
||||
let tempForm = JSON.parse(JSON.stringify(this.form));
|
||||
tempForm.specs = this.formatThingsSpecs();
|
||||
if (this.form.type == 2) {
|
||||
tempForm.isMonitor = 0;
|
||||
tempForm.isChart = 0;
|
||||
} else if (this.form.type == 3) {
|
||||
tempForm.isMonitor = 0;
|
||||
tempForm.isChart = 0;
|
||||
}
|
||||
updateModel(tempForm).then((response) => {
|
||||
this.$modal.msgSuccess(this.$t('product.product-things-model.142341-107'));
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$emit('updateModel');
|
||||
});
|
||||
} else {
|
||||
// 格式化specs
|
||||
let tempForm = JSON.parse(JSON.stringify(this.form));
|
||||
tempForm.specs = this.formatThingsSpecs();
|
||||
tempForm.productId = this.productInfo.productId;
|
||||
tempForm.productName = this.productInfo.productName;
|
||||
if (this.form.type == 2) {
|
||||
tempForm.isMonitor = 0;
|
||||
} else if (this.form.type == 3) {
|
||||
tempForm.isMonitor = 0;
|
||||
tempForm.isChart = 0;
|
||||
}
|
||||
addModel(tempForm).then((response) => {
|
||||
this.$modal.msgSuccess(this.$t('product.product-things-model.142341-108'));
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$emit('updateModel');
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 验证对象或对象数组中的参数不能为空
|
||||
if (this.form.datatype == 'object' || (this.form.datatype == 'array' && this.form.specs.arrayType == 'object')) {
|
||||
if (!this.form.specs.params || this.form.specs.params == 0) {
|
||||
this.$modal.msgError(this.$t('product.product-things-model.142341-102'));
|
||||
return;
|
||||
}
|
||||
if (this.containsUnderscore(this.form.identifier)) {
|
||||
this.$modal.msgError(this.$t('product.product-things-model.142341-103'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 验证对象参数标识符不能相同
|
||||
if (this.form.specs.params && this.form.specs.params.length > 0) {
|
||||
let arr = this.form.specs.params.map((item) => item.id).sort();
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (arr[i] == arr[i + 1]) {
|
||||
this.$modal.msgError('参数标识 ' + arr[i] + ' 重复');
|
||||
return;
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
}
|
||||
}
|
||||
//验证模型特性为图表展示时,数据类型是否为整数或者小数
|
||||
if (this.form.isChart == 1 && this.form.datatype != 'integer' && this.form.isChart == 1 && this.form.datatype != 'decimal') {
|
||||
this.$modal.msgError(this.$t('product.product-things-model.142341-106'));
|
||||
} else if (this.form.modelId != null) {
|
||||
// 格式化specs
|
||||
let tempForm = JSON.parse(JSON.stringify(this.form));
|
||||
tempForm.specs = this.formatThingsSpecs();
|
||||
// devType类型转换:String转Number(如果devType有值)
|
||||
if (tempForm.devType != null && tempForm.devType !== '' && tempForm.devType !== undefined) {
|
||||
tempForm.devType = Number(tempForm.devType);
|
||||
} else {
|
||||
tempForm.devType = null;
|
||||
}
|
||||
if (this.form.type == 2) {
|
||||
tempForm.isMonitor = 0;
|
||||
tempForm.isChart = 0;
|
||||
} else if (this.form.type == 3) {
|
||||
tempForm.isMonitor = 0;
|
||||
tempForm.isChart = 0;
|
||||
}
|
||||
updateModel(tempForm).then((response) => {
|
||||
this.$modal.msgSuccess(this.$t('product.product-things-model.142341-107'));
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$emit('updateModel');
|
||||
});
|
||||
} else {
|
||||
// 格式化specs
|
||||
let tempForm = JSON.parse(JSON.stringify(this.form));
|
||||
tempForm.specs = this.formatThingsSpecs();
|
||||
// devType类型转换:String转Number(如果devType有值)
|
||||
if (tempForm.devType != null && tempForm.devType !== '' && tempForm.devType !== undefined) {
|
||||
tempForm.devType = Number(tempForm.devType);
|
||||
} else {
|
||||
tempForm.devType = null;
|
||||
}
|
||||
tempForm.productId = this.productInfo.productId;
|
||||
tempForm.productName = this.productInfo.productName;
|
||||
if (this.form.type == 2) {
|
||||
tempForm.isMonitor = 0;
|
||||
} else if (this.form.type == 3) {
|
||||
tempForm.isMonitor = 0;
|
||||
tempForm.isChart = 0;
|
||||
}
|
||||
addModel(tempForm).then((response) => {
|
||||
this.$modal.msgSuccess(this.$t('product.product-things-model.142341-108'));
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.$emit('updateModel');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const modelIds = row.modelId;
|
||||
this.$modal
|
||||
|
||||
2430
src/views/login.vue
2430
src/views/login.vue
File diff suppressed because it is too large
Load Diff
@@ -2,12 +2,10 @@
|
||||
<div class="center-wrap">
|
||||
<div v-if="showType == 'card'">
|
||||
<el-row :gutter="15">
|
||||
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" style="margin-top: 7.5px; margin-bottom: 7.5px"
|
||||
v-for="item in centerList" :key="item.id">
|
||||
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" style="margin-top: 7.5px; margin-bottom: 7.5px" v-for="item in centerList" :key="item.id">
|
||||
<el-card class="card-wrap" :body-style="{ padding: '10px' }">
|
||||
<div class="img-wrap" @click="goToDetail(item)">
|
||||
<el-image style="width: 100%; height: 100%; border-radius: 5px" lazy
|
||||
:src="item.pageImage" fit="cover"></el-image>
|
||||
<el-image style="width: 100%; height: 100%; border-radius: 5px" lazy :src="item.pageImage" fit="cover"></el-image>
|
||||
</div>
|
||||
<div class="tag-wrap">
|
||||
<span>{{ item.pageResolution ? item.pageResolution : '未知' }}</span>
|
||||
@@ -33,31 +31,59 @@ export default {
|
||||
// 固定数据
|
||||
centerList: [
|
||||
{
|
||||
"createBy": "1",
|
||||
"createTime": "2026-03-23 17:31:51",
|
||||
"updateBy": null,
|
||||
"updateTime": "2026-03-23 17:31:51",
|
||||
"remark": null,
|
||||
"pageNum": null,
|
||||
"pageSize": null,
|
||||
"id": 5,
|
||||
"guid": "2b5759ba-8ee7-43e8-bb72-234986e52715",
|
||||
"scadaData": null,
|
||||
"serialNumbers": null,
|
||||
"deviceName": null,
|
||||
"isMainPage": null,
|
||||
"pageName": "国瑞药业冻干三物联组态",
|
||||
"pageResolution": null,
|
||||
"isShare": null,
|
||||
"shareUrl": null,
|
||||
"sharePass": null,
|
||||
"pageImage": require("../../../assets/picture/fengmian.png"),
|
||||
"tenantId": null,
|
||||
"tenantName": null,
|
||||
"delFlag": 0,
|
||||
"base64": null,
|
||||
"bindDeviceList": null
|
||||
}
|
||||
createBy: '1',
|
||||
createTime: '2026-05-07 10:00:00',
|
||||
updateBy: null,
|
||||
updateTime: '2026-05-07 10:00:00',
|
||||
remark: null,
|
||||
pageNum: null,
|
||||
pageSize: null,
|
||||
id: 6,
|
||||
guid: '3c5859cb-9ff8-54f9-cc33-455077f66c26',
|
||||
scadaData: null,
|
||||
serialNumbers: null,
|
||||
deviceName: null,
|
||||
isMainPage: null,
|
||||
pageName: '国瑞药业冻干二物联组态',
|
||||
pageResolution: null,
|
||||
isShare: null,
|
||||
shareUrl: null,
|
||||
sharePass: null,
|
||||
pageImage: require('../../../assets/picture/dg2slt.png'),
|
||||
tenantId: null,
|
||||
tenantName: null,
|
||||
delFlag: 0,
|
||||
base64: null,
|
||||
bindDeviceList: null,
|
||||
pagePath: 'screen2',
|
||||
},
|
||||
{
|
||||
createBy: '1',
|
||||
createTime: '2026-03-23 17:31:51',
|
||||
updateBy: null,
|
||||
updateTime: '2026-03-23 17:31:51',
|
||||
remark: null,
|
||||
pageNum: null,
|
||||
pageSize: null,
|
||||
id: 5,
|
||||
guid: '2b5759ba-8ee7-43e8-bb72-234986e52715',
|
||||
scadaData: null,
|
||||
serialNumbers: null,
|
||||
deviceName: null,
|
||||
isMainPage: null,
|
||||
pageName: '国瑞药业冻干三物联组态',
|
||||
pageResolution: null,
|
||||
isShare: null,
|
||||
shareUrl: null,
|
||||
sharePass: null,
|
||||
pageImage: require('../../../assets/picture/fengmian.png'),
|
||||
tenantId: null,
|
||||
tenantName: null,
|
||||
delFlag: 0,
|
||||
base64: null,
|
||||
bindDeviceList: null,
|
||||
pagePath: 'screen',
|
||||
},
|
||||
],
|
||||
total: 1, // 总条数
|
||||
showType: 'card', // 展示方式
|
||||
@@ -77,10 +103,11 @@ export default {
|
||||
// guid: row.guid,
|
||||
// },
|
||||
// });
|
||||
|
||||
|
||||
// 方法2: 在新标签页打开
|
||||
const pagePath = row.pagePath || 'screen';
|
||||
const routeData = this.$router.resolve({
|
||||
path: '/scada/picture/screen',
|
||||
path: `/scada/picture/${pagePath}`,
|
||||
query: {
|
||||
id: row.id,
|
||||
guid: row.guid,
|
||||
@@ -155,4 +182,4 @@ export default {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1400
src/views/scada/picture/screen2.vue
Normal file
1400
src/views/scada/picture/screen2.vue
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user