diff --git a/src/components/AddRule.vue b/src/components/AddRule.vue index 6b96312..8b4a969 100644 --- a/src/components/AddRule.vue +++ b/src/components/AddRule.vue @@ -81,10 +81,30 @@ 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 = props.type === 'I' ? await infoApi.addRules(req_data) : await infoApi.editRule(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)); if (ret.code == 0) {