编辑卡片:半成品

113 阅读1分钟

a5d0d344f53b4da9470821633fa9d1d.png

<template>
  <div class="hello">
    <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">
      <el-form-item label="活动区域" prop="value">
        <div class="params-select" @click="showSelect = !showSelect">
          <div class="params-select-name-left">
            <div class="params-name">
              <div class="params-title">参数值</div>
              <div class="el-icon-close"></div>
            </div>
            <div class="params-number">+2</div>
          </div>
          <div class="params-icon">
            <div :class="showSelect ?' el-icon-arrow-down':'el-icon-arrow-up'"></div>
          </div>
        </div>
      </el-form-item>

      <!-- 下拉框 -->
      <el-form-item>
        <div class="selects">
          <!--左边 -->
          <div class="selects-left">
            <div class="selects-header-left">
              <div class="selects-header-left-title">所有参数值</div>
              <div class="selects-header-left-addbtn">新增</div>
            </div>
            <!-- 下拉框主体部分 -->
            <div class="selects-main-left">
              <el-input placeholder="关键字搜索" v-model="input4">
                <i slot="prefix" class="el-input__icon el-icon-search"></i>
              </el-input>
              <div class="select-main-left-list">
                <el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
                  <el-checkbox v-for="city in cities" :label="city" :key="city">{{city}}</el-checkbox>
                </el-checkbox-group>
              </div>
            </div>
          </div>

          <!-- 右边 -->
          <div class="selects-right">
            <div class="selects-header-right">
              <div class="selects-header-left-title">
                <span>已选</span>
                <span>4</span>
              </div>
              <div class="selects-header-left-addbtn">清空</div>
            </div>
            <!-- 下拉框主体部分 -->
            <div class="selects-main-right">11</div>
          </div>
        </div>
      </el-form-item>
      <!-- <div class="subitem">
        <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
        <el-button @click="resetForm('ruleForm')">重置</el-button>
      </div>-->
    </el-form>
  </div>
</template>

<script>
export default {
  name: "HelloWorld",
  props: {
    msg: String
  },
  data() {
    return {
      input: "",
      input4: "",
      showSelect: false,
      checked: true,
      ruleForm: {
        name: "",
        region: "",
        value: "",
        date1: "",
        date2: "",
        delivery: false,
        type: [],
        resource: "",
        desc: ""
      },
      checkAll: false,
      checkedCities: ["上海", "北京"],
      cities: ["上海", "北京", "广州", "深圳",]
    };
  },
  methods: {
    handleCheckedCitiesChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.cities.length;
      this.isIndeterminate =
        checkedCount > 0 && checkedCount < this.cities.length;
    }
  }
};
</script>

<style scoped lang="less">
.params-select {
  width: 500px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .params-select-name-left {
    display: flex;
    align-items: center;
  }
  .params-name {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 24px;
    line-height: 24px;
    margin: 4px;
    border-radius: 4px;
    padding: 0 6px;
    background-color: rgb(160, 161, 163);
    .params-title {
      margin-right: 6px;
    }
  }
  .params-number {
    height: 24px;
    line-height: 24px;
    font-size: 12px;
    padding: 0 6px;
    border-radius: 4px;
    background-color: rgb(160, 161, 163);
  }
  .params-icon {
    // display: flex;
    // align-items: flex-end;
    .el-icon-arrow-down {
    }
  }
}
.el-form-item {
  margin-bottom: 0px;
  height: 34px;
}
.selects {
  width: 500px;
  display: flex;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-top: 0px;
  .selects-left {
    border-right: 1px solid red;
  }
  .selects-left,
  .selects-right {
    .selects-header-left,
    .selects-header-right {
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 4px 10px;
      width: 249px;
      height: 30px;
      background-color: #ccc;
    }
  }
}

// 主体部分左侧
.selects-main-left,
.selects-main-right {
  margin: 0 10px;
}
/deep/ .el-input__inner {
  width: 230px;
  height: 28px !important;
  border-radius: 24px;
}
/deep/ .el-checkbox {
  height: 30px;
  width: 100%;
  line-height: 30px;
}

// 上面部分有用

.hello {
  width: 800px;
  height: 50px;
}
</style>