main
wangqiujuan0808 2023-12-26 11:48:03 +08:00
commit ae9fcf8996
9 changed files with 444 additions and 21 deletions

View File

@ -130,29 +130,13 @@ const infoApi = {
delSc(params) {
return deleteRequest("/sb", params);
},
//
//
getRules(params) {
return getRequest('/rule', params);
},
//
//
addRules(params) {
return postJsonRequest('/rule', params)
},
//
editRule(params) {
return putRequest('/rule', params)
},
//
delRules(params) {
return deleteRequest('/rule', params)
},
//
startStatus(params) {
return postJsonRequest('/enable', params);
},
//
stopStatus(params) {
return postJsonRequest('/disable', params);
},
};
export default infoApi;

30
src/proto/data.proto Normal file
View File

@ -0,0 +1,30 @@
syntax = "proto3";
option go_package = "data/";
message m_properties{
string name = 1;
string value = 2;
}
message m_point_list{
repeated m_point points = 1;
}
message m_point{
string name = 1;
string path = 2;
string value = 3;
repeated m_properties properties = 4;
}
message m_device_list{
repeated m_device devices = 1;
}
message m_device{
string name = 1;
string value = 2;
string path = 3;
repeated m_properties properties = 4;
repeated m_point points = 5;
}

View File

@ -4550,6 +4550,242 @@ export const dns_info = $root.dns_info = (() => {
return dns_info;
})();
export const post = $root.post = (() => {
/**
* Properties of a post.
* @exports Ipost
* @interface Ipost
* @property {number|null} [cmd] post cmd
* @property {Uint8Array|null} [data] post data
*/
/**
* Constructs a new post.
* @exports post
* @classdesc Represents a post.
* @implements Ipost
* @constructor
* @param {Ipost=} [properties] Properties to set
*/
function post(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* post cmd.
* @member {number} cmd
* @memberof post
* @instance
*/
post.prototype.cmd = 0;
/**
* post data.
* @member {Uint8Array} data
* @memberof post
* @instance
*/
post.prototype.data = $util.newBuffer([]);
/**
* Creates a new post instance using the specified properties.
* @function create
* @memberof post
* @static
* @param {Ipost=} [properties] Properties to set
* @returns {post} post instance
*/
post.create = function create(properties) {
return new post(properties);
};
/**
* Encodes the specified post message. Does not implicitly {@link post.verify|verify} messages.
* @function encode
* @memberof post
* @static
* @param {Ipost} message post message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
post.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.cmd != null && Object.hasOwnProperty.call(message, "cmd"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.cmd);
if (message.data != null && Object.hasOwnProperty.call(message, "data"))
writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.data);
return writer;
};
/**
* Encodes the specified post message, length delimited. Does not implicitly {@link post.verify|verify} messages.
* @function encodeDelimited
* @memberof post
* @static
* @param {Ipost} message post message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
post.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a post message from the specified reader or buffer.
* @function decode
* @memberof post
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {post} post
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
post.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.post();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.cmd = reader.int32();
break;
}
case 2: {
message.data = reader.bytes();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a post message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof post
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {post} post
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
post.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a post message.
* @function verify
* @memberof post
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
post.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.cmd != null && message.hasOwnProperty("cmd"))
if (!$util.isInteger(message.cmd))
return "cmd: integer expected";
if (message.data != null && message.hasOwnProperty("data"))
if (!(message.data && typeof message.data.length === "number" || $util.isString(message.data)))
return "data: buffer expected";
return null;
};
/**
* Creates a post message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof post
* @static
* @param {Object.<string,*>} object Plain object
* @returns {post} post
*/
post.fromObject = function fromObject(object) {
if (object instanceof $root.post)
return object;
let message = new $root.post();
if (object.cmd != null)
message.cmd = object.cmd | 0;
if (object.data != null)
if (typeof object.data === "string")
$util.base64.decode(object.data, message.data = $util.newBuffer($util.base64.length(object.data)), 0);
else if (object.data.length >= 0)
message.data = object.data;
return message;
};
/**
* Creates a plain object from a post message. Also converts values to other types if specified.
* @function toObject
* @memberof post
* @static
* @param {post} message post
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
post.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults) {
object.cmd = 0;
if (options.bytes === String)
object.data = "";
else {
object.data = [];
if (options.bytes !== Array)
object.data = $util.newBuffer(object.data);
}
}
if (message.cmd != null && message.hasOwnProperty("cmd"))
object.cmd = message.cmd;
if (message.data != null && message.hasOwnProperty("data"))
object.data = options.bytes === String ? $util.base64.encode(message.data, 0, message.data.length) : options.bytes === Array ? Array.prototype.slice.call(message.data) : message.data;
return object;
};
/**
* Converts this post to JSON.
* @function toJSON
* @memberof post
* @instance
* @returns {Object.<string,*>} JSON object
*/
post.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for post
* @function getTypeUrl
* @memberof post
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
post.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/post";
};
return post;
})();
export const response = $root.response = (() => {
/**
@ -5041,6 +5277,8 @@ export const rule_info = $root.rule_info = (() => {
* @interface Irule_info
* @property {string|null} [id] rule_info id
* @property {string|null} [label] rule_info label
* @property {string|null} [info] rule_info info
* @property {Uint8Array|null} [nodes] rule_info nodes
* @property {boolean|null} [disabled] rule_info disabled
*/
@ -5075,6 +5313,22 @@ export const rule_info = $root.rule_info = (() => {
*/
rule_info.prototype.label = "";
/**
* rule_info info.
* @member {string} info
* @memberof rule_info
* @instance
*/
rule_info.prototype.info = "";
/**
* rule_info nodes.
* @member {Uint8Array} nodes
* @memberof rule_info
* @instance
*/
rule_info.prototype.nodes = $util.newBuffer([]);
/**
* rule_info disabled.
* @member {boolean} disabled
@ -5111,8 +5365,12 @@ export const rule_info = $root.rule_info = (() => {
writer.uint32(/* id 1, wireType 2 =*/10).string(message.id);
if (message.label != null && Object.hasOwnProperty.call(message, "label"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.label);
if (message.info != null && Object.hasOwnProperty.call(message, "info"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.info);
if (message.nodes != null && Object.hasOwnProperty.call(message, "nodes"))
writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.nodes);
if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled"))
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.disabled);
writer.uint32(/* id 5, wireType 0 =*/40).bool(message.disabled);
return writer;
};
@ -5156,6 +5414,14 @@ export const rule_info = $root.rule_info = (() => {
break;
}
case 3: {
message.info = reader.string();
break;
}
case 4: {
message.nodes = reader.bytes();
break;
}
case 5: {
message.disabled = reader.bool();
break;
}
@ -5200,6 +5466,12 @@ export const rule_info = $root.rule_info = (() => {
if (message.label != null && message.hasOwnProperty("label"))
if (!$util.isString(message.label))
return "label: string expected";
if (message.info != null && message.hasOwnProperty("info"))
if (!$util.isString(message.info))
return "info: string expected";
if (message.nodes != null && message.hasOwnProperty("nodes"))
if (!(message.nodes && typeof message.nodes.length === "number" || $util.isString(message.nodes)))
return "nodes: buffer expected";
if (message.disabled != null && message.hasOwnProperty("disabled"))
if (typeof message.disabled !== "boolean")
return "disabled: boolean expected";
@ -5222,6 +5494,13 @@ export const rule_info = $root.rule_info = (() => {
message.id = String(object.id);
if (object.label != null)
message.label = String(object.label);
if (object.info != null)
message.info = String(object.info);
if (object.nodes != null)
if (typeof object.nodes === "string")
$util.base64.decode(object.nodes, message.nodes = $util.newBuffer($util.base64.length(object.nodes)), 0);
else if (object.nodes.length >= 0)
message.nodes = object.nodes;
if (object.disabled != null)
message.disabled = Boolean(object.disabled);
return message;
@ -5243,12 +5522,24 @@ export const rule_info = $root.rule_info = (() => {
if (options.defaults) {
object.id = "";
object.label = "";
object.info = "";
if (options.bytes === String)
object.nodes = "";
else {
object.nodes = [];
if (options.bytes !== Array)
object.nodes = $util.newBuffer(object.nodes);
}
object.disabled = false;
}
if (message.id != null && message.hasOwnProperty("id"))
object.id = message.id;
if (message.label != null && message.hasOwnProperty("label"))
object.label = message.label;
if (message.info != null && message.hasOwnProperty("info"))
object.info = message.info;
if (message.nodes != null && message.hasOwnProperty("nodes"))
object.nodes = options.bytes === String ? $util.base64.encode(message.nodes, 0, message.nodes.length) : options.bytes === Array ? Array.prototype.slice.call(message.nodes) : message.nodes;
if (message.disabled != null && message.hasOwnProperty("disabled"))
object.disabled = message.disabled;
return object;

7
src/proto/post.proto Normal file
View File

@ -0,0 +1,7 @@
syntax = "proto3";
option go_package = "data/";
message post{
int32 cmd = 1;
bytes data = 2;
}

View File

@ -8,5 +8,7 @@ message rule{
message rule_info{
string id = 1;
string label = 2;
bool disabled = 3;
string info = 3;
bytes nodes = 4;
bool disabled = 5;
}

41
src/proto/sb.proto Normal file
View File

@ -0,0 +1,41 @@
syntax = "proto3";
option go_package = "data/";
message sb_list{
repeated sb_info sb = 1;
}
message sb_host{
repeated string host = 1;
}
message sb_info{
string name = 1;
string drive = 2;
string host = 3;
uint32 status = 4;
string description = 5;
bool enable = 6;
repeated string device_name = 7;
}
message sb_add{
string name = 1;
string drive = 2;
string description = 3;
bytes config = 4;
}
message sb_drive_list{
repeated sb_drive_info sb_drive = 1;
}
message sb_drive_info{
string name = 1;
bytes config = 2;
}
// message tx_drive_config_modbusTCP{
// string host = 1;
// string port = 2;
// }

67
src/proto/tx.proto Normal file
View File

@ -0,0 +1,67 @@
syntax = "proto3";
option go_package = "data/";
import "data.proto";
message tx_list{
repeated tx_info tx = 1;
}
message tx_host{
repeated string host = 1;
}
message tx_info{
string name = 1;
string drive = 2;
bool serial = 3;
string host = 4;
uint32 status = 5;
string description = 6;
bool enable = 7;
repeated tx_device_info device = 8;
}
message tx_add{
string name = 1;
string drive = 2;
bool serial = 3;
string description = 4;
bytes config = 5;
}
message tx_add_device{
string name = 1;
repeated tx_device_info device = 2;
}
message tx_drive_list{
repeated tx_drive_info tx_drive = 1;
}
message tx_drive_info{
string name = 1;
bool serial = 2;
bytes config = 3;
}
message tx_drive_config_modbusTCP{
string host = 1;
string port = 2;
}
message tx_device_info{
string name = 1;
string template = 2;
repeated m_properties properties = 3;
}
message mb_list{
repeated mb_info mb = 1;
}
message mb_info{
string name = 1;
string type = 2;
string description = 3;
repeated m_point points = 4;
}

View File

@ -18,4 +18,5 @@ message passwd{
string name = 1;
string old_password = 2;
string new_password = 3;
string new_password2 = 4;
}

View File

@ -69,7 +69,7 @@
import { onMounted, reactive, ref, toRefs } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import infoApi from "@/api/infoApi.js";
import { response, rule_info } from '../proto/data/pd'
import { response, rule,rule_info,post } from '../proto/data/pd'
import AddRule from "@/components/AddRule.vue";
export default {
name: "rules",