diff --git a/src/components/AddRule.vue b/src/components/AddRule.vue index 6e8c8a6..c477c72 100644 --- a/src/components/AddRule.vue +++ b/src/components/AddRule.vue @@ -81,11 +81,31 @@ export default { const saveFormData = () => { ruleFormRef.value.validate(async (valid) => { if (valid) { - const req_databuf = rule_info.encode(state.addForm).finish(); + const req_databuf = rule_info.encode({ + label:state.addForm.title, + info:state.addForm.description + }).finish(); // 截取有效长度 const req_data = req_databuf.slice(0, req_databuf.length); - const res = await infoApi.postRules(req_data); - + const req_databuf1 = post.encode({ + cmd: 1, + data: req_data, + }).finish(); + // 截取有效长度 + const req_data1 = req_databuf1.slice(0, req_databuf1.length); + + const req_databuf2 = post.encode({ + cmd: 5, + data: req_data, + }).finish(); + // 截取有效长度 + const req_data2 = req_databuf2.slice(0, req_databuf2.length); + + + + + const res = props.type === 'I' ? await infoApi.postJsonRequest(req_data1) : await infoApi.postJsonRequest(req_data2); + console.log(555, res) const ret = response.decode(new Uint8Array(res)); console.log(555, ret) if (ret.code == 0) {