fix:修复模板保存

This commit is contained in:
fanxb 2023-04-13 19:18:54 +08:00
parent 85f614f414
commit ea0d68036b

View File

@ -11,21 +11,25 @@
<el-button type="primary" size="small" @click="editClick"> <el-button type="primary" size="small" @click="editClick">
<el-tooltip effect="dark" content="编辑规则" placement="top"> <el-tooltip effect="dark" content="编辑规则" placement="top">
<el-icon> <el-icon>
<edit /> <edit/>
</el-icon> </el-icon>
</el-tooltip> </el-tooltip>
</el-button> </el-button>
<el-button type="primary" size="small" @click="move('top')"> <el-button type="primary" size="small" @click="move('top')">
<el-tooltip effect="dark" content="上移规则" placement="top"> <el-tooltip effect="dark" content="上移规则" placement="top">
<el-icon> <el-icon>
<top /> <top/>
</el-icon> </el-icon>
</el-tooltip> </el-tooltip>
</el-button> </el-button>
<el-button type="primary" size="small" @click="move('bottom')"> <el-button type="primary" size="small" @click="move('bottom')">
<el-tooltip effect="dark" content="下移规则" placement="top" <el-tooltip effect="dark" content="下移规则" placement="top"
><el-icon> <bottom /> </el-icon >
></el-tooltip> <el-icon>
<bottom/>
</el-icon
>
</el-tooltip>
</el-button> </el-button>
</template> </template>
</div> </div>
@ -38,11 +42,12 @@
<el-button type="primary" size="small" text @click="addRuleDialogShow = true">+ 新增规则</el-button> <el-button type="primary" size="small" text @click="addRuleDialogShow = true">+ 新增规则</el-button>
</div> </div>
</div> </div>
<el-dialog :title="editRule ? '编辑规则' : '新增规则'" v-model="addRuleDialogShow" width="70%" @close="ruleDialogClose"> <el-dialog :title="editRule ? '编辑规则' : '新增规则'" v-model="addRuleDialogShow" width="70%"
<rule :editRule="editRule" @ruleAdd="ruleAdd" v-if="addRuleDialogShow" :isAutoPlan="rules != undefined" /> @close="ruleDialogClose">
<rule :editRule="editRule" @ruleAdd="ruleAdd" v-if="addRuleDialogShow" :isAutoPlan="rules != undefined"/>
</el-dialog> </el-dialog>
<el-dialog title="模板管理" v-model="ruleTemplateShow" width="70%"> <el-dialog title="模板管理" v-model="ruleTemplateShow" width="70%">
<application-rule-list v-if="ruleTemplateShow" :curId="chosedTemplate.id" @templateUpdate="templateUpdate" /> <application-rule-list v-if="ruleTemplateShow" :curId="chosedTemplate.id" @templateUpdate="templateUpdate"/>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -51,7 +56,8 @@
import Rule from "@/components/Rule"; import Rule from "@/components/Rule";
import ApplicationRuleList from "./ApplicationRuleList"; import ApplicationRuleList from "./ApplicationRuleList";
import HttpUtil from "@/utils/HttpUtil"; import HttpUtil from "@/utils/HttpUtil";
import { Top, Bottom, Edit } from "@element-plus/icons-vue"; import {Top, Bottom, Edit} from "@element-plus/icons-vue";
export default { export default {
name: "RuleBlock", name: "RuleBlock",
props: ["rules"], props: ["rules"],
@ -107,7 +113,9 @@ export default {
}, },
// //
async templateUpdate(newVal) { async templateUpdate(newVal) {
console.debug("新的模板:", newVal);
this.ruleList = JSON.parse(newVal.content); this.ruleList = JSON.parse(newVal.content);
this.chosedTemplate = newVal;
this.ruleUpdate(); this.ruleUpdate();
this.ruleTemplateShow = false; this.ruleTemplateShow = false;
}, },
@ -127,11 +135,11 @@ export default {
/// ///
async block() { async block() {
this.ruleList this.ruleList
.filter((item) => item.checked) .filter((item) => item.checked)
.forEach((item) => { .forEach((item) => {
item.blocked = !item.blocked; item.blocked = !item.blocked;
item.checked = false; item.checked = false;
}); });
await this.ruleUpdate(); await this.ruleUpdate();
}, },
// //