Compare commits

...

2 Commits

3 changed files with 27 additions and 23 deletions

View File

@ -135,7 +135,7 @@ const infoApi = {
return getRequest('/rule', params); return getRequest('/rule', params);
}, },
// //
addRules(params) { postRules(params) {
return postJsonRequest('/rule', params) return postJsonRequest('/rule', params)
}, },
}; };

View File

@ -11,17 +11,17 @@
:rules="rules" :rules="rules"
ref="ruleFormRef" ref="ruleFormRef"
> >
<el-form-item label="规则标题:" prop="title"> <el-form-item label="规则标题:" prop="lable">
<el-input <el-input
v-model="addForm.title" v-model="addForm.lable"
placeholder="请输入规则标题" placeholder="请输入规则标题"
clearable clearable
:disabled="type === 'I' ? false: true" :disabled="type === 'I' ? false: true"
/> />
</el-form-item> </el-form-item>
<el-form-item label="规则描述:" prop="description"> <el-form-item label="规则描述:" prop="info">
<el-input <el-input
v-model="addForm.description" v-model="addForm.info"
placeholder="请输入规则描述" placeholder="请输入规则描述"
clearable clearable
/> />
@ -47,14 +47,14 @@ export default {
const ruleFormRef = ref(null); const ruleFormRef = ref(null);
const state = reactive({ const state = reactive({
addForm: { addForm: {
title: '', lable: '',
description: '' info: ''
}, },
rules: { rules: {
title: [ lable: [
{ required: true, message: "请输入规则标题", trigger: "blur" } { required: true, message: "请输入规则标题", trigger: "blur" }
], ],
description: [ info: [
{ required: true, message: "请输入规则描述", trigger: "blur" } { required: true, message: "请输入规则描述", trigger: "blur" }
] ]
}, },
@ -107,6 +107,7 @@ export default {
const res = props.type === 'I' ? await infoApi.postJsonRequest(req_data1) : await infoApi.postJsonRequest(req_data2); const res = props.type === 'I' ? await infoApi.postJsonRequest(req_data1) : await infoApi.postJsonRequest(req_data2);
console.log(555, res) console.log(555, res)
const ret = response.decode(new Uint8Array(res)); const ret = response.decode(new Uint8Array(res));
console.log(555, ret)
if (ret.code == 0) { if (ret.code == 0) {
// //
console.log(new TextDecoder().decode(ret.data)); console.log(new TextDecoder().decode(ret.data));

View File

@ -12,18 +12,18 @@
stripe stripe
:header-cell-style="{ background: '#F6F7FC' }" :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 <el-table-column
prop="title" prop="lable"
label="标题" label="标题"
width="200" width="300"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column <el-table-column
prop="description" prop="info"
label="描述" label="描述"
width="200" width="500"
align="center" align="center"
show-overflow-tooltip show-overflow-tooltip
/> />
@ -37,6 +37,7 @@
</el-button> </el-button>
<el-switch <el-switch
v-model="scope.row.enable" v-model="scope.row.enable"
class="l10-r10"
inline-prompt inline-prompt
active-text="启用" active-text="启用"
inactive-text="停用" inactive-text="停用"
@ -80,8 +81,8 @@ export default {
const state = reactive({ const state = reactive({
tableData: [], tableData: [],
formData: { formData: {
title: '', lable: '',
description: '' info: ''
}, },
dialogVisible: false, dialogVisible: false,
type: 'I' type: 'I'
@ -97,7 +98,7 @@ export default {
if (ret.code == 0) { if (ret.code == 0) {
// //
// state.tableData = rule.decode(ret.data); state.tableData = rule.decode(ret.data).rule;
console.log(rule.decode(ret.data)); console.log(rule.decode(ret.data));
/** /**
* 组长看这里 * 组长看这里
@ -135,7 +136,7 @@ export default {
// //
const req_data1 = req_databuf1.slice(0, req_databuf1.length); 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)); const ret = response.decode(new Uint8Array(res));
if (ret.code == 0) { if (ret.code == 0) {
ElMessage.success(res.msg || "请求成功"); ElMessage.success(res.msg || "请求成功");
@ -152,8 +153,8 @@ export default {
const addData = () => { const addData = () => {
// //
state.formData = { state.formData = {
title: '', lable: '',
description: '' info: ''
} }
state.type = 'I'; state.type = 'I';
state.dialogVisible = true; state.dialogVisible = true;
@ -179,9 +180,7 @@ export default {
}).finish(); }).finish();
// //
const req_data2 = req_databuf2.slice(0, req_databuf2.length); const req_data2 = req_databuf2.slice(0, req_databuf2.length);
const res = item.enable==='启动' ? await infoApi.postRules(req_data2) : await infoApi.postRules(req_data1);
const res = item.enable==='启动' ? await infoApi.postJsonRequest(req_data2) : await infoApi.postJsonRequest(req_data1);
const ret = response.decode(new Uint8Array(res)); const ret = response.decode(new Uint8Array(res));
if (ret.code == 0) { if (ret.code == 0) {
ElMessage.success(res.msg || "更新成功"); ElMessage.success(res.msg || "更新成功");
@ -204,6 +203,7 @@ export default {
delData, delData,
getTableData, getTableData,
addData, addData,
changeStatus,
dialogSuccess, dialogSuccess,
dialogClose dialogClose
}; };
@ -219,4 +219,7 @@ export default {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.l10-r10 {
margin: 0 10px;
}
</style> </style>