<template>
  <view class="operation">
    <view class="operation__header">{{ dourceData.name }}</view>
    <view class="operation__body">
      <view class="operation__body-content">
        <view class="operation__body-content--title">展开</view>
        <view class="operation__body-content--desc">
          <u-switch
            v-model="runStatus"
            active-color="#14A478"
            inactive-color="#C3CAD8"
            size="36"
          ></u-switch>
        </view>
      </view>
      <view class="operation__body-content">
        <view class="operation__body-content--title">收拢</view>
        <view class="operation__body-content--desc">
          <u-switch
            v-model="closeStatus"
            active-color="#14A478"
            inactive-color="#C3CAD8"
            size="36"
          ></u-switch>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
export default {
  name: 'OperationCard',
  props: {
    dourceData: {
      type: Object,
      default: () => {},
    },
  },
  computed: {
    runStatus: {
      get() {
        // 展开
        return this.dourceData.down_status == '1';
      },
      set(val) {
        this.$emit('run-status', this.dourceData);
      },
    },
    closeStatus: {
      get() {
        // 收拢
        return this.dourceData.up_status == '1';
      },
      set(val) {
        this.$emit('close-status', this.dourceData);
      },
    },
  },
  data() {
    return {
      checked: true,
      checked1: false,
    };
  },
  methods: {},
};
</script>
<style scoped lang="scss">
.operation {
  justify-content: center;
  border-radius: 4px;
  background: #eff2fa;
  margin-bottom: 32rpx;
  &__header {
    height: 64rpx;
    line-height: 64rpx;
    color: #333333;
    font-family: 'Source Han Sans CN VF';
    font-size: 28rpx;
    font-weight: 500;
    border-bottom: 2rpx solid #e4e7ed;
    padding: 0 32rpx;
  }
  &__body {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 24rpx;
    padding: 30rpx;
    &-content {
      height: 72rpx;
      background: #ffffff;
      border-radius: 16rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16rpx;
    }
  }
}
</style>
