注:逻辑不可考究,主要实现各种基础功能,建议本地运行找对应功能,放到vue-element项目里可直接运行
<template>
<el-form :model="ruleForm" :rules="form_rules" ref="ruleForm" style="margin-left:50px;">
<el-row>
<el-tooltip class="item" effect="dark" content="合并选中项" placement="bottom">
<el-button type="primary" @click="addBrackets">合并</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="分解选中项" placement="bottom">
<el-button type="success" @click="removeBrackets">拆解</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="控制复选框的显示与否" placement="bottom">
<el-button type="info" @click="showCheckBox">{
{showCheck?'取消选择':'选择'}}</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="括号层的包含关系" placement="bottom">
<el-button type="warning" @click="changeOuterStatus(true)">包含</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="括号层的包含关系" placement="bottom">
<el-button type="danger" @click="changeOuterStatus(false)">不包含</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="状态重置" placement="bottom">
<el-button type="danger" @click="clearAll">重置</el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" content="清空当前选择项" placement="bottom">
<el-button type="danger" @click="clearChecked">清空选择</el-button>
</el-tooltip>
</el-row>
<el-form-item label=" " prop="">
<el-select v-model="ruleForm.incloud">
<el-option label="包含" :value="true"></el-option>
<el-option label="不包含" :value="false"></el-option>
</el-select>
<div type="flex" class="row-bg">
<div class="item-box" v-for="(item,index) in ruleForm.rule" :key="index">
<el-select v-if="item.wordnum" v-model="item