代码暂存
parent
69e6073dc1
commit
78bb06db81
|
@ -111,7 +111,7 @@ const infoApi = {
|
|||
},
|
||||
// 获取通讯状态
|
||||
getTxStatus(params) {
|
||||
return postPBRequest(`/driver`, params, 54002);
|
||||
return postPBRequest(`/driver`, params, 54003);
|
||||
},
|
||||
|
||||
// 获取支持的通讯驱动
|
||||
|
@ -120,7 +120,7 @@ const infoApi = {
|
|||
},
|
||||
// 查询查询驱动下设备的可用模板列表
|
||||
getTxTemplate(params) {
|
||||
return postPBRequest("/driver", params, 54011, params.driver_name);
|
||||
return postPBRequest("/driver", params, 54002, params.driver_name);
|
||||
},
|
||||
// 新增设备
|
||||
addSet(params) {
|
||||
|
@ -137,7 +137,7 @@ const infoApi = {
|
|||
},
|
||||
// 获取详情
|
||||
getD(params) {
|
||||
return postPBRequest('/driver', params, 54003, params.driver_name)
|
||||
return postPBRequest('/driver', params, 54005, params.driver_name)
|
||||
},
|
||||
// 重置
|
||||
resetCount(params) {
|
||||
|
@ -150,11 +150,11 @@ const infoApi = {
|
|||
|
||||
// 通讯服务启用,停用
|
||||
startStatus(params) {
|
||||
return postPBRequest("/driver", params, 54400,params.name);
|
||||
return postPBRequest("/driver", params, 56201,params.driver_name);
|
||||
},
|
||||
// 通讯服务停止
|
||||
stopStatus(params) {
|
||||
return postPBRequest("/driver", params, 54500,params.name);
|
||||
return postPBRequest("/driver", params, 56202,params.driver_name);
|
||||
},
|
||||
//保存配置
|
||||
addPz(params, header) {
|
||||
|
|
|
@ -13,141 +13,46 @@
|
|||
:rules="rules"
|
||||
ref="ruleFormRef"
|
||||
>
|
||||
<el-form-item label="通讯名称:" prop="name">
|
||||
<el-form-item label="驱动名称:" prop="driver_name">
|
||||
<el-input
|
||||
v-model="addForm.name"
|
||||
placeholder="请输入(不超过10)"
|
||||
v-model="addForm.driver_name"
|
||||
placeholder="请输入驱动名称(不超过20个字符)"
|
||||
clearable
|
||||
maxlength="10"
|
||||
maxlength="20"
|
||||
:disabled="type == '1'"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="通讯驱动:" prop="type" >
|
||||
<el-form-item label="驱动类型:" prop="driver_type" >
|
||||
<el-select
|
||||
v-model="addForm.type"
|
||||
v-model="addForm.driver_type"
|
||||
value-key="name"
|
||||
clearable
|
||||
placeholder="请选择通讯驱动"
|
||||
placeholder="请选择驱动类型"
|
||||
@change="driveChange"
|
||||
:disabled="type == '1'"
|
||||
>
|
||||
<el-option v-for="(item, index) of typeOptions" :key="index" :label="item.name" :value="item.key" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="驱动描述:" prop="description">
|
||||
<el-form-item label="通讯模板:" prop="template_name" >
|
||||
<el-select
|
||||
v-model="addForm.template_name"
|
||||
value-key="name"
|
||||
clearable
|
||||
placeholder="请选择通讯模板"
|
||||
:disabled="type == '1'"
|
||||
>
|
||||
<el-option v-for="(item, index) of templateOptions" :key="index" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="驱动描述:" prop="driver_description">
|
||||
<el-input
|
||||
v-model="addForm.description"
|
||||
placeholder="请输入描述(不超过50)"
|
||||
v-model="addForm.driver_description"
|
||||
placeholder="请输入模板描述(不超过50个字符)"
|
||||
clearable
|
||||
maxlength="50"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<!-- 驱动1 -->
|
||||
<!-- <div v-if="serialConfig">
|
||||
<el-form-item label="COM口:">
|
||||
<el-select
|
||||
v-model="configData.name"
|
||||
placeholder="请选择COM口"
|
||||
clearable
|
||||
@change="selsectCom"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of com_select"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
:disabled="item.used"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="波特率:">
|
||||
<el-select
|
||||
v-model="configData.baudRate"
|
||||
placeholder="请选择波频率"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of baud_rate_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="校验位:">
|
||||
<el-select
|
||||
v-model="configData.parity"
|
||||
placeholder="请选择校验位"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of parity_select"
|
||||
:key="index"
|
||||
:label="item.text"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数据位:">
|
||||
<el-select
|
||||
v-model="configData.dataBits"
|
||||
placeholder="请选择波频率"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of data_bits_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="停止位:">
|
||||
<el-select
|
||||
v-model="configData.stopBits"
|
||||
placeholder="请选择波频率"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of stop_bits_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="超时时间:" >
|
||||
<el-select
|
||||
v-model="configData.timeout"
|
||||
placeholder="请选择超时时间"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) of timeout_select"
|
||||
:key="index"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div> -->
|
||||
<!-- 驱动2 -->
|
||||
<!-- <div v-if="modbusTCPConfig">
|
||||
<el-form-item label="主机地址:">
|
||||
<el-input
|
||||
v-model="configData1.port"
|
||||
placeholder="请输入模板描述"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="主机端口:">
|
||||
<el-input
|
||||
v-model="configData1.host"
|
||||
placeholder="请输入模板描述"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
</div> -->
|
||||
</el-form>
|
||||
|
||||
|
||||
|
@ -163,55 +68,33 @@
|
|||
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
|
||||
import infoApi from "@/api/infoApi.js";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
// import { response, tx_list, com_info, com_list, tx_drive_list, tx_add, tx_info, tx_drive_config_modbusTCP } from '../proto/data/pd'
|
||||
export default {
|
||||
props: ["formData", "dialogVisible", "type", "qudongOptions"],
|
||||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const ruleFormRef = ref(null);
|
||||
const validName = (rule, value, callback) => {
|
||||
var name = /^[a-zA-Z]([_\w]*)$/;
|
||||
var name = /^[a-zA-Z][a-zA-Z0-9_]{2,19}$/;
|
||||
if (name.test(value) || !value) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("通讯名称格式不正确,支持英文数字和下划线"));
|
||||
callback(new Error("名称只能以字母开头,仅支持字母,数字和下划线,最短3个字符起,且长度不能超过20个字符"));
|
||||
}
|
||||
};
|
||||
const state = reactive({
|
||||
addForm: {},
|
||||
typeOptions: [],
|
||||
serialConfig: false,
|
||||
modbusTCPConfig: false,
|
||||
com_select: [],
|
||||
comArr: [],
|
||||
configData: {
|
||||
name: '',
|
||||
baudRate: '',
|
||||
parity: '',
|
||||
dataBits: '',
|
||||
stopBits:'',
|
||||
timeout:'',
|
||||
},
|
||||
configData1: {
|
||||
port: '',
|
||||
host: ''
|
||||
},
|
||||
baud_rate_select: [9600, 115200],
|
||||
parity_select:[
|
||||
{ text: "无校验", value: "N" },
|
||||
{ text: "偶校验", value: "E" },
|
||||
{ text: "奇校验", value: "O" }
|
||||
],
|
||||
data_bits_select: [5, 6, 7, 8],
|
||||
stop_bits_select: [1, 2],
|
||||
timeout_select: [0, 100, 200, 500, 1000, 2000],
|
||||
templateOptions: [],
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "请输入通讯名称", trigger: "blur" },
|
||||
// { required: true, validator: validName, trigger: "blur" },
|
||||
driver_name: [
|
||||
{ required: true, message: "请输入驱动名称", trigger: "blur" },
|
||||
{ required: true, validator: validName, trigger: "blur" },
|
||||
],
|
||||
description: [{ required: true, message: "请输入驱动描述", trigger: "blur" }],
|
||||
type: [{ required: true, message: "请选择通讯驱动", trigger: "blur" }]
|
||||
template_name: [
|
||||
{ required: true, message: "请选择通讯模板", trigger: "blur" },
|
||||
],
|
||||
driver_description: [{ required: true, message: "请输入驱动描述", trigger: "blur" }],
|
||||
driver_type: [{ required: true, message: "请选择通讯驱动", trigger: "change" }]
|
||||
},
|
||||
});
|
||||
const visible = computed(() => {
|
||||
|
@ -219,27 +102,9 @@ export default {
|
|||
});
|
||||
|
||||
onMounted(async () => {
|
||||
// if (props.type === '1') {
|
||||
// if (props.formData.serial) {
|
||||
// state.serialConfig = true;
|
||||
// state.modbusTCPConfig = false;
|
||||
// // 获取com,比对赋值
|
||||
// getCom();
|
||||
// } else {
|
||||
// state.serialConfig = false;
|
||||
// if (props.formData.drive == "modbusTCP") {
|
||||
// state.modbusTCPConfig = true;
|
||||
// // 直接赋值
|
||||
// state.configData1 = {
|
||||
// port: props.formData.host.split(":")[0],
|
||||
// host: props.formData.host.split(":")[1]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
state.addForm = props.formData;
|
||||
getTypeOptions();
|
||||
|
||||
driveChange();
|
||||
});
|
||||
|
||||
const getTypeOptions = () => {
|
||||
|
@ -270,58 +135,19 @@ export default {
|
|||
});
|
||||
};
|
||||
const driveChange = () => {
|
||||
// 如果是串口协议
|
||||
// if (props.formData.drive.serial) {
|
||||
// state.serialConfig = true;
|
||||
// state.modbusTCPConfig = false;
|
||||
// // 获取com
|
||||
// getCom();
|
||||
console.log(1);
|
||||
state.addForm.template_name = '';
|
||||
getTxTemplate();
|
||||
}
|
||||
|
||||
// } else {
|
||||
// state.serialConfig = false;
|
||||
// if (props.formData.drive.name == "modbusTCP") {
|
||||
// state.modbusTCPConfig = true;
|
||||
// }
|
||||
// }
|
||||
const getTxTemplate = async () => {
|
||||
const param = {
|
||||
driver_type: state.addForm.driver_type
|
||||
}
|
||||
// 获取com
|
||||
const getCom = async () => {
|
||||
const res = await infoApi.getCom();
|
||||
const res = await infoApi.getTxTemplate(param);
|
||||
if (res.code == 0) {
|
||||
state.comArr = res.data.com;
|
||||
state.com_select = [];
|
||||
infodata.com.forEach(e => {
|
||||
if (!e.used) {
|
||||
state.com_select.push(e);
|
||||
}
|
||||
});
|
||||
// 编辑赋值
|
||||
if (props.type === '1') {
|
||||
const config = infodata.com.filter(item => item.name === props.formData.host)[0];
|
||||
state.configData = {
|
||||
name: config.name,
|
||||
baudRate: config.baudRate,
|
||||
parity: config.parity,
|
||||
dataBits: config.dataBits,
|
||||
stopBits: config.stopBits,
|
||||
timeout: config.timeout,
|
||||
}
|
||||
}
|
||||
if (state.com_select.length == 0) {
|
||||
ElMessage.info("没有可用串口,请选择其他驱动");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 选择 com 回填数据
|
||||
const selsectCom = () => {
|
||||
const c = state.comArr.filter(item => item.name === state.configData.name)[0];
|
||||
state.configData = {
|
||||
name: c.name,
|
||||
baudRate: c.baudRate,
|
||||
parity: c.parity,
|
||||
dataBits: c.dataBits,
|
||||
stopBits: c.stopBits,
|
||||
timeout: c.timeout,
|
||||
state.templateOptions = res.data;
|
||||
state.addForm.template_name = state.templateOptions[0].name;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,9 +157,7 @@ export default {
|
|||
visible,
|
||||
saveData,
|
||||
closeDialog,
|
||||
driveChange,
|
||||
getCom,
|
||||
selsectCom
|
||||
driveChange
|
||||
};
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" :title="type === 'I' ? '新增模板' : '编辑模板'" width="30%" :before-close="closeDialog">
|
||||
<el-dialog v-model="visible" :title="type === 'I' ? '新增模板' : '编辑模板'" width="45%" :before-close="closeDialog">
|
||||
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large">
|
||||
<el-form-item label="模板名称:" prop="name">
|
||||
<el-input v-model="addForm.name" placeholder="请输入模板名称" clearable :disabled="type !== 'I'" />
|
||||
<el-form-item label="模板名称:" prop="template_name">
|
||||
<el-input v-model="addForm.template_name" placeholder="请输入模板名称(不超过20个字符)" maxlength="20" clearable
|
||||
:disabled="type !== 'I'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板描述:" prop="description">
|
||||
<el-input v-model="addForm.description" placeholder="请输入模板描述" clearable />
|
||||
<el-form-item label="模板描述:" prop="template_description">
|
||||
<el-input v-model="addForm.template_description" placeholder="请输入模板描述(不超过50个字符)" maxlength="50" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板类型:" prop="type">
|
||||
<el-form-item label="模板类型:" prop="template_type">
|
||||
|
||||
<el-select v-model="addForm.type" placeholder="请选择模板类型" @change="driveChange" :disabled="type !== 'I'">
|
||||
<el-select v-model="addForm.template_type" placeholder="请选择模板类型" @change="driveChange" :disabled="type !== 'I'">
|
||||
<el-option v-for="(item, index) of typeOptions" :key="index" :label="item.name" :value="item.key" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
@ -32,16 +33,26 @@ export default {
|
|||
emits: ["dialogClose", "dialogSuccess"],
|
||||
setup(props, ctx) {
|
||||
const ruleFormRef = ref(null);
|
||||
const validName = (rule, value, callback) => {
|
||||
var name = /^[a-zA-Z][a-zA-Z0-9_]{2,19}$/;
|
||||
if (name.test(value) || !value) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("名称只能以字母开头,仅支持字母,数字和下划线,最短3个字符起,且长度不能超过20个字符"));
|
||||
}
|
||||
};
|
||||
const state = reactive({
|
||||
addForm: {},
|
||||
rules: {
|
||||
name: [
|
||||
template_name: [
|
||||
{ required: true, message: "请输入模板名称", trigger: "blur" },
|
||||
{ min: 3, max: 20, message: "长度在3到20个字符", trigger: "blur" },
|
||||
{ required: true, validator: validName, trigger: "blur" },
|
||||
],
|
||||
description: [
|
||||
template_description: [
|
||||
{ required: true, message: "请输入模板描述", trigger: "blur" }
|
||||
],
|
||||
type: [
|
||||
template_type: [
|
||||
{ required: true, message: "请选择类型", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
|
@ -89,7 +100,7 @@ export default {
|
|||
// 关闭弹框
|
||||
ctx.emit("dialogSuccess");
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
ElMessage.error(res.data);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" title="点位管理" width="40%" :before-close="closeDialog">
|
||||
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large">
|
||||
<el-form-item label="点位名称:" prop="name">
|
||||
<el-input v-model="addForm.name" placeholder="请输入点位名称" clearable :disabled="type !== 'I'" />
|
||||
<el-form-item label="点位名称:" prop="point_name">
|
||||
<el-input v-model="addForm.point_name" placeholder="请输入点位名称" clearable :disabled="type !== 'I'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位地址:" prop="address">
|
||||
<el-input v-model="addForm.address" placeholder="请输入点位地址:0-19999或30000-49999" clearable type="number" />
|
||||
<el-input v-model="addForm.address" placeholder="请输入点位地址:0-65535" clearable type="number" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位类型:" prop="type">
|
||||
<el-select v-model="addForm.type" size="mini" placeholder="请选择点位类型">
|
||||
<el-form-item label="点位类型:" prop="point_type">
|
||||
<el-select v-model="addForm.point_type" size="mini" placeholder="请选择点位类型">
|
||||
<el-option v-for="item in datatypeArr" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="字节顺序:" prop="byte_order">
|
||||
<el-select v-model="addForm.byte_order" size="mini" placeholder="请选择字节顺序">
|
||||
<el-option v-for="item in byte_orderArr" :key="item.value" :label="item.label" :value="item.value" />
|
||||
<el-form-item label="寄存器:" prop="register">
|
||||
<el-select v-model="addForm.register" size="mini" placeholder="请选择寄存器">
|
||||
<el-option v-for="item in registerArr" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="点位描述:" prop="description">
|
||||
<el-input v-model="addForm.description" placeholder="请输入点位描述" clearable />
|
||||
<el-form-item label="点位描述:" prop="point_description">
|
||||
<el-input v-model="addForm.point_description" placeholder="请输入点位描述(不超过50个字符)" clearable maxlength="50"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="读写权限:" prop="permissions">
|
||||
<el-select v-model="addForm.permissions" size="mini" placeholder="请选择读写权限">
|
||||
<el-form-item label="读写权限:" prop="point_permissions">
|
||||
<el-select v-model="addForm.point_permissions" size="mini" placeholder="请选择读写权限">
|
||||
<el-option v-for="item in perOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="缩放系数:" prop="multiplier">
|
||||
<el-input v-model="addForm.multiplier" placeholder="请输入缩放系数" type="number" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位单位:" prop="unit">
|
||||
<el-input v-model="addForm.unit" placeholder="请输入点位单位" clearable />
|
||||
<el-form-item label="点位单位:" prop="point_unit">
|
||||
<el-input v-model="addForm.point_unit" placeholder="请输入点位单位" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -50,10 +50,18 @@ export default {
|
|||
setup(props, ctx) {
|
||||
const checkAddress = (rule, value, callback) => {
|
||||
let num = Number(value);
|
||||
if (value && (num >= 0 && num <= 19999) || (num >= 30000 && num <= 49999)) {
|
||||
if (value && (num >= 0 && num <= 65535)) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("点位地址:0-19999,30000-49999"));
|
||||
callback(new Error("点位地址:0-65535"));
|
||||
}
|
||||
};
|
||||
const validName = (rule, value, callback) => {
|
||||
var name = /^[a-zA-Z][a-zA-Z0-9_]{2,19}$/;
|
||||
if (name.test(value) || !value) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("名称只能以字母开头,仅支持字母,数字和下划线,最短3个字符起,且长度不能超过20个字符"));
|
||||
}
|
||||
};
|
||||
const ruleFormRef = ref(null);
|
||||
|
@ -90,6 +98,24 @@ export default {
|
|||
label: 'float64',
|
||||
value: 9
|
||||
}],
|
||||
registerArr: [
|
||||
{
|
||||
label: 'coil_status',
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: 'input_status',
|
||||
value: 2
|
||||
},
|
||||
{
|
||||
label: 'input_register',
|
||||
value: 3
|
||||
},
|
||||
{
|
||||
label: 'holding_register',
|
||||
value: 4
|
||||
}],
|
||||
|
||||
byte_orderArr: [{
|
||||
label: 'null',
|
||||
value: 1
|
||||
|
@ -148,16 +174,21 @@ export default {
|
|||
}
|
||||
],
|
||||
rules: {
|
||||
name: [{ required: true, message: "请输入点位名称", trigger: "blur" }],
|
||||
point_name: [{ required: true, message: "请输入点位名称", trigger: "blur" },
|
||||
{ min: 3, max: 20, message: "长度在3到20个字符", trigger: "blur" },
|
||||
{ required: true, validator: validName, trigger: "blur" },],
|
||||
address: [
|
||||
{ required: true, message: "请输入点位地址", trigger: "blur" },
|
||||
{ required: true, validator: checkAddress, trigger: "blur" }
|
||||
],
|
||||
type: [{ required: true, message: "请选择点位类型", trigger: "blur" }],
|
||||
byte_order: [{ required: true, message: "请选择字节顺序", trigger: "blur" }],
|
||||
point_type: [{ required: true, message: "请选择点位类型", trigger: "blur" }],
|
||||
register: [{ required: true, message: "请输入寄存器", trigger: "blur" }],
|
||||
multiplier: [{ required: true, message: "请输入缩放系数", trigger: "blur" }],
|
||||
unit: [{ required: true, message: "请输入点位单位", trigger: "blur" }],
|
||||
permissions: [{ required: true, message: "请输入读写权限", trigger: "blur" }],
|
||||
point_unit: [{ required: true, message: "请输入点位单位", trigger: "blur" }],
|
||||
point_permissions: [{ required: true, message: "请输入读写权限", trigger: "blur" }],
|
||||
point_description: [
|
||||
{ required: true, message: "请输入点位描述", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
});
|
||||
const visible = computed(() => {
|
||||
|
@ -175,10 +206,11 @@ export default {
|
|||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const param = {
|
||||
template_name: props.formData.name,
|
||||
template_name: props.formData.template_name,
|
||||
...state.addForm,
|
||||
address: Number(state.addForm.address),
|
||||
multiplier: Number(state.addForm.multiplier)
|
||||
multiplier: Number(state.addForm.multiplier),
|
||||
register: Number(state.addForm.register)
|
||||
}
|
||||
const res = props.type === 'I' ? await infoApi.addP(param) : await infoApi.editP(param);
|
||||
if (res.code == 0) {
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" title="设备管理" width="40%" :before-close="closeDialog">
|
||||
<el-form :model="addForm" label-width="100px" :rules="rules" ref="ruleFormRef" size="large">
|
||||
<el-form-item label="设备名称:" prop="name">
|
||||
<el-input v-model="addForm.name" placeholder="请输入设备名称(不超过10)" maxlength="10" clearable :disabled="type !== 'I'" />
|
||||
<el-form-item label="设备名称:" prop="device_name">
|
||||
<el-input v-model="addForm.device_name" placeholder="请输入设备名称(不超过20个字符)" maxlength="10" clearable
|
||||
:disabled="type !== 'I'" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备id:" prop="id">
|
||||
<el-input v-model="addForm.id" placeholder="请输入设备id:1-255" clearable type="number" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板名称:" prop="template_name">
|
||||
<el-select v-model="addForm.template_name" size="mini" placeholder="请选择模板名称">
|
||||
<el-option v-for="item in modelArr" :key="item.name" :label="item.name" :value="item.name" />
|
||||
</el-select>
|
||||
<el-form-item label="设备id:" prop="slave_id">
|
||||
<el-input v-model="addForm.slave_id" placeholder="请输入设备id:1-255" clearable type="number" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="设备描述:" prop="description">
|
||||
<el-input v-model="addForm.description" placeholder="请输入点位描述(不超过50)" maxlength="50" clearable />
|
||||
<el-form-item label="设备描述:" prop="device_description">
|
||||
<el-input v-model="addForm.device_description" placeholder="请输入点位描述(不超过50)" maxlength="50" clearable />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -41,15 +37,27 @@ export default {
|
|||
callback(new Error("设备ID:1-255"));
|
||||
}
|
||||
};
|
||||
const validName = (rule, value, callback) => {
|
||||
var name = /^[a-zA-Z][a-zA-Z0-9_]{2,19}$/;
|
||||
if (name.test(value) || !value) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("名称只能以字母开头,仅支持字母,数字和下划线,最短3个字符起,且长度不能超过20个字符"));
|
||||
}
|
||||
};
|
||||
const ruleFormRef = ref(null);
|
||||
const state = reactive({
|
||||
addForm: {
|
||||
},
|
||||
modelArr: [],
|
||||
rules: {
|
||||
name: [{ required: true, message: "请输入设备名称", trigger: "blur" }],
|
||||
template_name: [{ required: true, message: "请选择模板名称", trigger: "blur" }],
|
||||
id: [
|
||||
device_name: [{ required: true, message: "请输入设备名称", trigger: "blur" },
|
||||
{ min: 3, max: 20, message: "长度在3到20个字符", trigger: "blur" },
|
||||
{ required: true, validator: validName, trigger: "blur" },],
|
||||
device_description: [
|
||||
{ required: true, message: "请输入设备描述", trigger: "blur" }
|
||||
],
|
||||
slave_id: [
|
||||
{ required: true, message: "请输入设备ID", trigger: "blur" },
|
||||
{ required: true, validator: checkSetId, trigger: "blur" }
|
||||
],
|
||||
|
@ -61,30 +69,7 @@ export default {
|
|||
|
||||
onMounted(() => {
|
||||
state.addForm = props.setData;
|
||||
// 获取模板数据
|
||||
getTxTemplate();
|
||||
});
|
||||
const getTxTemplate = async () => {
|
||||
const param = {
|
||||
driver_name: props.formData.name
|
||||
}
|
||||
const res = await infoApi.getTxTemplate(param);
|
||||
if (res.code == 0) {
|
||||
// 获取数据
|
||||
state.modelArr = [];
|
||||
const data = res.data;
|
||||
for (let i in data) {
|
||||
let obj = {
|
||||
key: Number(i),
|
||||
name: data[i]
|
||||
}
|
||||
state.modelArr.push(obj);
|
||||
}
|
||||
state.addForm.template_name = state.modelArr[0].name;
|
||||
} else {
|
||||
ElMessage.error(res.data || res.message);
|
||||
}
|
||||
};
|
||||
const closeDialog = () => {
|
||||
ctx.emit("dialogClose");
|
||||
};
|
||||
|
@ -95,9 +80,9 @@ export default {
|
|||
await ruleFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const param = {
|
||||
driver_name: props.formData.name,
|
||||
driver_name: props.formData.driver_name,
|
||||
...state.addForm,
|
||||
id: Number(state.addForm.id)
|
||||
slave_id: Number(state.addForm.slave_id)
|
||||
}
|
||||
const res = props.type === 'I' ? await infoApi.addSet(param) : await infoApi.editSet(param);
|
||||
if (res.code == 0) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-drawer v-model="visible" title= "驱动详情" direction="rtl" :before-close="closeDialog">
|
||||
<el-drawer v-model="visible" direction="rtl" :before-close="closeDialog">
|
||||
|
||||
<fieldset class="box2">
|
||||
<legend class="box-ht">驱动名称</legend>
|
||||
|
@ -76,7 +76,7 @@ export default {
|
|||
});
|
||||
const getD = async () => {
|
||||
const parm = {
|
||||
name: props.formData.name
|
||||
name: props.formData.driver_name
|
||||
}
|
||||
const res = await infoApi.getD(parm);
|
||||
if (res.code == 0) {
|
||||
|
|
|
@ -39,7 +39,7 @@ export default {
|
|||
};
|
||||
|
||||
const saveP = async () => {
|
||||
const res = await infoApi.importP(state.importData, props.formData.name);
|
||||
const res = await infoApi.importP(state.importData, props.formData.template_name);
|
||||
if (res.code == 0) {
|
||||
ElMessage.success(res.message);
|
||||
ctx.emit("dialogSuccess");
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
||||
v-model="visible" title="点位管理">
|
||||
v-model="visible">
|
||||
<el-card class="top-title">
|
||||
<span>模板名称:{{ formData.name }}</span>
|
||||
<span>模板描述:{{ formData.description }}</span>
|
||||
<span>模板类型:{{ templateData[formData.type] }}</span>
|
||||
<span>模板名称:{{ formData.template_name }}</span>
|
||||
<!-- <span>模板描述:{{ formData.template_description }}</span>
|
||||
<span>模板类型:{{ templateData[formData.template_type] }}</span> -->
|
||||
<span>点位数量:{{ propertiesData.length }}</span>
|
||||
</el-card>
|
||||
<div class="top-btn">
|
||||
|
@ -19,30 +19,30 @@
|
|||
<el-table :data="propertiesData" height="640" style="width: 100%" border stripe
|
||||
:header-cell-style="{ background: '#F6F7FC' }" size="large">
|
||||
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||
<el-table-column prop="name" label="点位名称" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="point_name" label="点位名称" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" label="点位地址" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="点位类型" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="point_type" label="点位类型" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ typeData[scope.row.type] }}</span>
|
||||
<span>{{ typeData[scope.row.point_type] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="byte_order" label="字节顺序" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="register" label="寄存器" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ byteData[scope.row.byte_order] }}</span>
|
||||
<span>{{ registerData[scope.row.register] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="description" label="点位描述" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="point_description" label="点位描述" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="multiplier" label="缩放系数" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unit" label="点位单位" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="point_unit" label="点位单位" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="permissions" label="读写权限" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="point_permissions" label="读写权限" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.permissions == 1 ? '只读' : '可写' }}</span>
|
||||
<span>{{ scope.row.point_permissions == 1 ? '只读' : '可写' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200" show-overflow-tooltip>
|
||||
|
@ -111,6 +111,12 @@ export default {
|
|||
12: 'BIG',
|
||||
13: 'LIT'
|
||||
},
|
||||
registerData: {
|
||||
1: 'coil_status',
|
||||
2: 'input_status',
|
||||
3: 'input_register',
|
||||
4: 'holding_register'
|
||||
},
|
||||
type: 'I'
|
||||
});
|
||||
const visible = computed(() => {
|
||||
|
@ -123,15 +129,18 @@ export default {
|
|||
|
||||
const getPointList = async () => {
|
||||
const parm = {
|
||||
template_name: props.formData.name
|
||||
template_name: props.formData.template_name
|
||||
}
|
||||
const res = await infoApi.getP(parm);
|
||||
if (res.code == 0) {
|
||||
state.propertiesData = [];
|
||||
const pointData = res.data;
|
||||
const pointData = res.data.points;
|
||||
for (let i in pointData) {
|
||||
state.propertiesData.push(pointData[i]);
|
||||
}
|
||||
state.propertiesData = state.propertiesData.sort((a, b) => {
|
||||
return (a.point_name > b.point_name ? 1 : -1)
|
||||
});
|
||||
} else {
|
||||
ElMessage.error(res.data || res.message);
|
||||
}
|
||||
|
@ -148,8 +157,8 @@ export default {
|
|||
})
|
||||
.then(async () => {
|
||||
let param = {
|
||||
template_name: props.formData.name,
|
||||
name: item.name
|
||||
template_name: props.formData.template_name,
|
||||
point_name: item.point_name
|
||||
}
|
||||
const res = await infoApi.detP(param);
|
||||
if (res.code == 0) {
|
||||
|
@ -169,13 +178,13 @@ export default {
|
|||
state.formData1 = props.formData;
|
||||
state.type = 'I';
|
||||
state.pointData = {
|
||||
name: '',
|
||||
point_name: '',
|
||||
address: 36,
|
||||
type: 1,
|
||||
byte_order: 1,
|
||||
permissions: 1,
|
||||
point_type: 1,
|
||||
point_permissions: 1,
|
||||
multiplier: 1,
|
||||
unit: 'ppm'
|
||||
point_unit: 'on',
|
||||
register: 1
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,7 +217,7 @@ export default {
|
|||
url: '/template',
|
||||
headers: {
|
||||
"action": 53211,
|
||||
'template_name': Base64.encode(props.formData.name)
|
||||
'template_name': props.formData.template_name
|
||||
},
|
||||
responseType: 'blob',
|
||||
}).then((response) => {
|
||||
|
|
|
@ -1,31 +1,27 @@
|
|||
<template>
|
||||
<el-drawer size="65%" :modal-append-to-body="false" :destroy-on-close="true" :before-close="closeDialog"
|
||||
v-model="visible" title="设备管理">
|
||||
v-model="visible">
|
||||
<el-card class="top-title">
|
||||
<span>通讯名称:{{ formData.name }}</span>
|
||||
<span>通讯描述:{{ formData.description }}</span>
|
||||
<span>通信驱动:{{ qudongOptions[formData.type] }}</span>
|
||||
<span>设备数量:{{ driverInfo.device_count }}</span>
|
||||
<span>通讯名称:{{ formData.driver_name }}</span>
|
||||
<span>设备数量:{{ propertiesData.length }}</span>
|
||||
</el-card>
|
||||
<div class="top-btn">
|
||||
<el-button type="primary" size="large" @click="manageData">
|
||||
新增设备
|
||||
</el-button>
|
||||
<!-- <div>
|
||||
<div>
|
||||
<el-button type="primary" @click="importData"> 导入 </el-button>
|
||||
<el-button type="primary" @click="exportData"> 导出 </el-button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="propertiesData" height="640" style="width: 100%" border stripe
|
||||
:header-cell-style="{ background: '#F6F7FC' }">
|
||||
<el-table-column prop="name" label="设备名称" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="device_name" label="设备名称" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="id" label="设备ID" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column prop="template_name" label="设备的可用模板名称" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="slave_id" label="设备ID" align="center" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="description" label="设备描述" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="device_description" label="设备描述" align="center" show-overflow-tooltip>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="180" show-overflow-tooltip>
|
||||
|
@ -75,7 +71,7 @@ export default {
|
|||
const getSet = async () => {
|
||||
state.propertiesData = [];
|
||||
const parm = {
|
||||
driver_name: props.formData.name
|
||||
driver_name: props.formData.driver_name
|
||||
}
|
||||
const res = await infoApi.getSet(parm);
|
||||
if (res.code == 0) {
|
||||
|
@ -88,7 +84,7 @@ export default {
|
|||
}
|
||||
}
|
||||
state.propertiesData = state.propertiesData.sort((a, b) => {
|
||||
return (a.name > b.name ? 1 : -1)
|
||||
return (a.device_name > b.device_name ? 1 : -1)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -107,8 +103,8 @@ export default {
|
|||
})
|
||||
.then(async () => {
|
||||
let param = {
|
||||
driver_name: props.formData.name,
|
||||
name: item.name
|
||||
driver_name: props.formData.driver_name,
|
||||
device_name: item.device_name
|
||||
}
|
||||
const res = await infoApi.delSet(param);
|
||||
if (res.code == 0) {
|
||||
|
@ -128,9 +124,9 @@ export default {
|
|||
state.formData1 = props.formData;
|
||||
state.type = 'I';
|
||||
state.setData = {
|
||||
name: '',
|
||||
id: 1,
|
||||
description: ''
|
||||
device_name: '',
|
||||
slave_id: 1,
|
||||
device_description: ''
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ axios.interceptors.response.use(
|
|||
);
|
||||
// post请求
|
||||
export function postPBRequest(url, params, actionNum, name) {
|
||||
const title = url === '/driver' ? {'driver_name': Base64.encode(name) }: {'template_name': Base64.encode(name)}
|
||||
const title = url === '/driver' ? {'driver_name': name }: {'template_name': name}
|
||||
return axios({
|
||||
method: "post",
|
||||
url: url,
|
||||
|
|
|
@ -32,7 +32,7 @@ export const pathMap = {
|
|||
home: '设备信息',
|
||||
level: '网络配置',
|
||||
model: '模块管理',
|
||||
page: '通讯管理',
|
||||
page: '驱动管理',
|
||||
data: '实时数据',
|
||||
report: '上报管理',
|
||||
transparent: '透传管理',
|
||||
|
|
|
@ -79,18 +79,22 @@ export default {
|
|||
username: state.ruleForm.username,
|
||||
password: md5(state.ruleForm.password).toUpperCase(),
|
||||
}
|
||||
|
||||
myApi.login(userInfo).then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
let userInfo = {
|
||||
nickName: state.ruleForm.username,
|
||||
};
|
||||
// 模拟登录
|
||||
localSet("token", '99999999999999999');
|
||||
store.commit("setUserInfo", userInfo);
|
||||
getLoginStatus();
|
||||
} else {
|
||||
ElMessage.error(res.message);
|
||||
}
|
||||
})
|
||||
window.location.href = '/';
|
||||
|
||||
// myApi.login(userInfo).then(async (res) => {
|
||||
// if (res.code == 0) {
|
||||
// let userInfo = {
|
||||
// nickName: state.ruleForm.username,
|
||||
// };
|
||||
// store.commit("setUserInfo", userInfo);
|
||||
// getLoginStatus();
|
||||
// } else {
|
||||
// ElMessage.error(res.message);
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -7,14 +7,13 @@
|
|||
<el-table :data="tableData" style="width: 100%" border stripe
|
||||
:header-cell-style="{ background: '#F6F7FC' }" size="large">
|
||||
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||
<el-table-column prop="name" label="模板名称" width="240" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="type" label="模板类型" width="240" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="template_name" label="模板名称" width="240" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="template_type" label="模板类型" width="240" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ templateData[scope.row.type] }}</span>
|
||||
<span>{{ templateData[scope.row.template_type] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="point_count" label="点位数量" width="240" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="description" label="模板描述" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="template_description" label="模板描述" align="center" show-overflow-tooltip />
|
||||
<el-table-column label="模板管理" align="center" show-overflow-tooltip width="300">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" size="large" @click="viewData(scope.row)">
|
||||
|
@ -58,9 +57,9 @@ export default {
|
|||
dialogVisible2: false,
|
||||
tableData: [],
|
||||
formData: {
|
||||
name: '',
|
||||
description: '',
|
||||
type: '1'
|
||||
template_name: '',
|
||||
template_description: '',
|
||||
template_type: '1'
|
||||
},
|
||||
formData1: {},
|
||||
type: 'I',
|
||||
|
@ -85,7 +84,7 @@ export default {
|
|||
const res = await infoApi.getMb();
|
||||
if (res.code == 0) {
|
||||
// 获取数据
|
||||
state.tableData = res.data.sort((a,b) => {
|
||||
state.tableData = res.data && res.data.length > 0 && res.data.sort((a,b) => {
|
||||
return (a.name > b.name ? 1 : -1)
|
||||
});
|
||||
} else {
|
||||
|
@ -121,9 +120,9 @@ export default {
|
|||
state.dialogVisible = true;
|
||||
//清空数据
|
||||
state.formData = {
|
||||
name: '',
|
||||
description: '',
|
||||
type: 1
|
||||
template_name: '',
|
||||
template_description: '',
|
||||
template_type: 1
|
||||
}
|
||||
state.type = 'I';
|
||||
};
|
||||
|
|
|
@ -7,36 +7,34 @@
|
|||
<el-table :data="tableData" border :row-class-name="tableRowClassName"
|
||||
:header-cell-style="{ background: '#F6F7FC' }" size="large">
|
||||
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||
<el-table-column prop="name" label="通讯名称" width="200" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="description" label="通讯描述" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="drive" label="驱动类型" width="200" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="driver_name" label="驱动名称" width="200" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="driver_description" label="驱动描述" align="center" show-overflow-tooltip />
|
||||
<el-table-column prop="driver_type" label="驱动类型" width="200" align="center" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<span>{{ qudongOptions[scope.row.type] }}</span>
|
||||
<span>{{ qudongOptions[scope.row.driver_type] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="status" label="驱动状态" width="200" align="center">
|
||||
<el-table-column prop="template_name" label="通讯模板" width="200" align="center">
|
||||
</el-table-column>
|
||||
<el-table-column prop="driver_status" label="驱动状态" width="200" align="center">
|
||||
<template #default="scope">
|
||||
<!-- <span :style="{'color': getTextColor(scope.row.status)}"> {{ txStatus[scope.row.status] }} </span> -->
|
||||
<span> {{ txStatus[scope.row.status] }} </span>
|
||||
<span> {{ txStatus[scope.row.driver_status] }} </span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="enable" label="启停控制" width="200" align="center">
|
||||
<el-table-column prop="driver_enable" label="启停控制" width="200" align="center">
|
||||
<template #default="scope">
|
||||
<!-- 现在是 <el-tag :class="!scope.row.enable? 'stop':'start'">{{!scope.row.enable? '停用状态' : '启用状态'}} </el-tag> 您可以点击 -->
|
||||
<el-button type="primary" size="large" @click="changeStatus(scope.row)" v-if="!scope.row.enable">
|
||||
<el-button type="primary" size="large" @click="changeStatus(scope.row)" v-if="!scope.row.driver_enable">
|
||||
启用
|
||||
</el-button>
|
||||
<el-button size="large" @click="changeStatus(scope.row)" v-else>
|
||||
停用
|
||||
</el-button>
|
||||
<!-- <el-switch v-model="scope.row.enable" inline-prompt active-text="启用" inactive-text="停用" :active-value="true"
|
||||
:inactive-value="false" active-color="#13ce66" inactive-color="#ddd" @change="changeStatus(scope.row)" /> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" show-overflow-tooltip width="450">
|
||||
<template #default="scope">
|
||||
<el-button type="success" size="large" @click="openDetails(scope.row)">
|
||||
详情
|
||||
<el-button type="primary" size="large" @click="viewData(scope.row)">
|
||||
设备
|
||||
</el-button>
|
||||
<el-button type="warning" size="large" @click="openPz(scope.row)">
|
||||
配置
|
||||
|
@ -47,9 +45,6 @@
|
|||
<el-button type="danger" size="large" @click="delData(scope.row)">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button type="primary" size="large" @click="viewData(scope.row)">
|
||||
设备
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -148,13 +143,10 @@ export default {
|
|||
|
||||
};
|
||||
const getTableData = async () => {
|
||||
const param = {
|
||||
type: 0
|
||||
}
|
||||
const res = await infoApi.getTx(param);
|
||||
const res = await infoApi.getTx();
|
||||
if (res.code == 0) {
|
||||
state.tableData = res.data.sort((a,b) => {
|
||||
return (a.name > b.name ? 1 : -1)
|
||||
state.tableData = res.data && res.data.length > 0 && res.data.sort((a,b) => {
|
||||
return (a.driver_name > b.driver_name ? 1 : -1)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -196,9 +188,9 @@ export default {
|
|||
|
||||
const addData = () => {
|
||||
state.formData = {
|
||||
name: '',
|
||||
type: 1,
|
||||
description: '',
|
||||
driver_name: '',
|
||||
driver_type: 2,
|
||||
driver_description: '',
|
||||
};
|
||||
state.dialogVisible = true;
|
||||
state.type = '0';
|
||||
|
@ -250,9 +242,9 @@ export default {
|
|||
|
||||
const changeStatus = async (item) => {
|
||||
const param = {
|
||||
name: item.name,
|
||||
driver_name: item.driver_name,
|
||||
}
|
||||
const res = !item.enable ? await infoApi.startStatus(param) : await infoApi.stopStatus(param);
|
||||
const res = !item.driver_enable ? await infoApi.startStatus(param) : await infoApi.stopStatus(param);
|
||||
if (res.code == 0) {
|
||||
ElMessage.success(res.message || "请求成功");
|
||||
getTableData();
|
||||
|
|
Loading…
Reference in New Issue