main
parent
16fd1f9fab
commit
46e5142da0
|
@ -135,7 +135,7 @@ const infoApi = {
|
|||
return getRequest('/rule', params);
|
||||
},
|
||||
// 规则操作
|
||||
addRules(params) {
|
||||
postRules(params) {
|
||||
return postJsonRequest('/rule', params)
|
||||
},
|
||||
};
|
||||
|
|
|
@ -11,17 +11,17 @@
|
|||
:rules="rules"
|
||||
ref="ruleFormRef"
|
||||
>
|
||||
<el-form-item label="规则标题:" prop="title">
|
||||
<el-form-item label="规则标题:" prop="lable">
|
||||
<el-input
|
||||
v-model="addForm.title"
|
||||
v-model="addForm.lable"
|
||||
placeholder="请输入规则标题"
|
||||
clearable
|
||||
:disabled="type === 'I' ? false: true"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规则描述:" prop="description">
|
||||
<el-form-item label="规则描述:" prop="info">
|
||||
<el-input
|
||||
v-model="addForm.description"
|
||||
v-model="addForm.info"
|
||||
placeholder="请输入规则描述"
|
||||
clearable
|
||||
/>
|
||||
|
@ -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));
|
||||
|
|
|
@ -12,18 +12,18 @@
|
|||
stripe
|
||||
:header-cell-style="{ background: '#F6F7FC' }"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="80" align="center" />
|
||||
<el-table-column type="index" label="序号" width="100" align="center" />
|
||||
<el-table-column
|
||||
prop="title"
|
||||
prop="lable"
|
||||
label="标题"
|
||||
width="200"
|
||||
width="300"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="description"
|
||||
prop="info"
|
||||
label="描述"
|
||||
width="200"
|
||||
width="500"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
|
@ -37,6 +37,7 @@
|
|||
</el-button>
|
||||
<el-switch
|
||||
v-model="scope.row.enable"
|
||||
class="l10-r10"
|
||||
inline-prompt
|
||||
active-text="启用"
|
||||
inactive-text="停用"
|
||||
|
@ -80,8 +81,8 @@ export default {
|
|||
const state = reactive({
|
||||
tableData: [],
|
||||
formData: {
|
||||
title: '',
|
||||
description: ''
|
||||
lable: '',
|
||||
info: ''
|
||||
},
|
||||
dialogVisible: false,
|
||||
type: 'I'
|
||||
|
@ -97,7 +98,7 @@ export default {
|
|||
|
||||
if (ret.code == 0) {
|
||||
// 获取数据
|
||||
// state.tableData = rule.decode(ret.data);
|
||||
state.tableData = rule.decode(ret.data).rule;
|
||||
console.log(rule.decode(ret.data));
|
||||
/**
|
||||
* 组长看这里
|
||||
|
@ -135,7 +136,7 @@ export default {
|
|||
// 截取有效长度
|
||||
const req_data1 = req_databuf1.slice(0, req_databuf1.length);
|
||||
|
||||
const res = await infoApi.postJsonRequest(req_data1);
|
||||
const res = await infoApi.postRules(req_data1);
|
||||
const ret = response.decode(new Uint8Array(res));
|
||||
if (ret.code == 0) {
|
||||
ElMessage.success(res.msg || "请求成功");
|
||||
|
@ -152,8 +153,8 @@ export default {
|
|||
const addData = () => {
|
||||
//清空数据
|
||||
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;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue