move.vue 2.96 KB
Newer Older
xd's avatar
xd committed
1
<template>
xd's avatar
xd committed
2 3 4 5 6 7 8 9
  <div class="ct">
    <el-dialog
      :visible.sync="moveDialog"
      width="55%"
      :show-close="false"
      :close-on-click-modal="false"
    >
      <div class="choose">
xd's avatar
xd committed
10
        <div class="title">
xd's avatar
xd committed
11 12 13 14 15
          <div class="cg">选择分组</div>
          <div class="circle" @click="handleClose">
            <d2-icon-svg name="close" class="icon" />
          </div>
        </div>
xd's avatar
xd committed
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
        <div class="br">
          <div style="text-align: center">
            <el-transfer
              style="text-align: left; display: inline-block"
              v-model="value4"
              :left-default-checked="[]"
              :right-default-checked="[]"
              :titles="['选择', '已选']"
              :button-texts="['删除', '添加']"
              @change="handleChange"
              :data="data"
            >
              <span slot-scope="{ option }"
                >{{ option.key }} - {{ option.label }}</span
              >
            </el-transfer>
          </div>
        </div>
xd's avatar
xd committed
34
      </div>
xd's avatar
xd committed
35
      <span slot="footer" class="dialog-footer">
xd's avatar
xd committed
36 37 38 39
        <el-button @click="handleCancel" size="small">取 消</el-button>
        <el-button type="primary" @click="handleFinish" size="small"
          >确 定</el-button
        >
xd's avatar
xd committed
40 41 42 43 44 45 46 47 48 49 50 51 52
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {
    moveDialog: {
      type: Boolean,
      default: false
    }
  },
xd's avatar
xd committed
53 54 55 56 57 58 59 60 61 62 63
  data() {
    const generateData = _ => {
      const data = [];
      for (let i = 1; i <= 15; i++) {
        data.push({
          key: i,
          label: `备选项 ${i}`
        });
      }
      return data;
    };
xd's avatar
xd committed
64
    return {
xd's avatar
xd committed
65 66 67 68 69 70 71 72 73 74 75
      data: generateData(),
      value: [1],
      value4: [1],
      renderFunc(h, option) {
        return (
          <span>
            {option.key} - {option.label}
          </span>
        );
      }
    };
xd's avatar
xd committed
76 77
  },
  methods: {
xd's avatar
xd committed
78 79
    handleCancel() {
      this.$emit("handleCancel");
xd's avatar
xd committed
80
    },
xd's avatar
xd committed
81 82 83 84 85
    handleFinish() {
      this.$emit("handleFinish", false);
    },
    handleChange() {},
    handleClose() {
xd's avatar
xd committed
86
      this.$emit("handleCancel");
xd's avatar
xd committed
87 88 89 90 91
    }
  }
};
</script>

xd's avatar
xd committed
92 93 94 95 96 97 98 99
<style scoped>
.choose {
  padding: 16px;
  font-size: 16px;
  font-weight: bold;
  color: rgba(56, 56, 56, 1);
  box-sizing: border-box;
}
xd's avatar
xd committed
100
.title {
xd's avatar
xd committed
101 102 103
  display: flex;
  align-items: center;
  justify-content: space-between;
xd's avatar
xd committed
104 105
  /* border-bottom: 1px solid #f8f8f8; */
  padding-bottom: 10px;
xd's avatar
xd committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
}
.transfer-footer {
  margin-left: 20px;
  padding: 6px 5px;
}
.ct >>> .el-dialog__header {
  padding: 0 !important;
}
.ct >>> .el-dialog__body {
  padding: 0;
}
.ct >>> .el-transfer-panel {
  width: 250px;
}
.circle {
  width: 30px;
  height: 30px;
  line-height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(208, 2, 27, 1);
  position: relative;
}
.circle >>> .icon {
  width: 28px;
  height: 28px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
xd's avatar
xd committed
136 137 138 139 140
.br {
    border-top: 1px solid #f8f8f8;
    border-bottom: 1px solid #f8f8f8;
    padding: 24px 0;
}
xd's avatar
xd committed
141
</style>