diff --git a/src/api/infoApi.js b/src/api/infoApi.js index 265dc7b..1929513 100644 --- a/src/api/infoApi.js +++ b/src/api/infoApi.js @@ -135,7 +135,7 @@ const infoApi = { return getRequest('/rule', params); }, // 规则操作 - addRules(params) { + postRules(params) { return postJsonRequest('/rule', params) }, }; diff --git a/src/components/AddRule.vue b/src/components/AddRule.vue index 6b96312..6e8c8a6 100644 --- a/src/components/AddRule.vue +++ b/src/components/AddRule.vue @@ -11,17 +11,17 @@ :rules="rules" ref="ruleFormRef" > - + - + @@ -47,14 +47,14 @@ export default { const ruleFormRef = ref(null); const state = reactive({ addForm: { - title: '', - description: '' + lable: '', + info: '' }, rules: { - title: [ + lable: [ { required: true, message: "请输入规则标题", trigger: "blur" } ], - description: [ + info: [ { required: true, message: "请输入规则描述", trigger: "blur" } ] }, @@ -84,9 +84,10 @@ export default { const req_databuf = rule_info.encode(state.addForm).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); - console.log(555, res) + const res = await infoApi.postRules(req_data); + const ret = response.decode(new Uint8Array(res)); + console.log(555, ret) if (ret.code == 0) { // 获取数据 console.log(new TextDecoder().decode(ret.data)); diff --git a/src/views/Rules.vue b/src/views/Rules.vue index 24f0788..c90488d 100644 --- a/src/views/Rules.vue +++ b/src/views/Rules.vue @@ -12,18 +12,18 @@ stripe :header-cell-style="{ background: '#F6F7FC' }" > - + @@ -37,6 +37,7 @@ { //清空数据 state.formData = { - title: '', - description: '' + lable: '', + info: '' } state.type = 'I'; state.dialogVisible = true; @@ -179,9 +180,7 @@ export default { }).finish(); // 截取有效长度 const req_data2 = req_databuf2.slice(0, req_databuf2.length); - - - const res = item.enable==='启动' ? await infoApi.postJsonRequest(req_data2) : await infoApi.postJsonRequest(req_data1); + const res = item.enable==='启动' ? await infoApi.postRules(req_data2) : await infoApi.postRules(req_data1); const ret = response.decode(new Uint8Array(res)); if (ret.code == 0) { ElMessage.success(res.msg || "更新成功"); @@ -204,6 +203,7 @@ export default { delData, getTableData, addData, + changeStatus, dialogSuccess, dialogClose }; @@ -219,4 +219,7 @@ export default { display: flex; justify-content: flex-end; } +.l10-r10 { + margin: 0 10px; +}