<template>
  <div>
    <el-form :model="property" :label-position="labelPosition" label-width="72px">
      <el-form-item label="序号" class="serial-number">
        <el-input v-model="property.serial_number" />
        <SvgIcon icon-class="switch" size="14" @click="switchSerialNumber(property)" />
      </el-form-item>
      <el-form-item>
        <el-radio
          v-for="{ value, label } in snGenerationMethodList"
          :key="value"
          v-model="property.sn_generation_method"
          :label="value"
        >
          {{ label }}
        </el-radio>
      </el-form-item>
      <el-form-item label="序号位置">
        <SerialNumberPosition :position="property.sn_position" @changeNumberPosition="changeNumberPosition" />
      </el-form-item>
      <el-divider />
      <el-form-item label="查看方式">
        <el-radio v-for="{ value, label } in viewMethodList" :key="value" v-model="property.view_method" :label="value">
          {{ label }}
        </el-radio>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import SettingMixin from '@/views/book/courseware/create/components/common/SettingMixin';

import { viewMethodList, snGenerationMethodList, checkString } from '@/views/book/courseware/data/common';

export default {
  name: 'PictureSetting',
  mixins: [SettingMixin],
  data() {
    return {
      checkString,
      snGenerationMethodList,
      viewMethodList,
      labelPosition: 'left',
      property: {
        serial_number: 1, // 序号
        sn_type: 'number',
        sn_position: 'top-start', // 序号位置：top-start top top-end 等
        sn_generation_method: snGenerationMethodList[0].value, // 序号生成方式：recalculate 重新计算follow 跟随
        view_method: viewMethodList[0].value, // 查看方式：independent 独立 list 列表icon 图标
      },
    };
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.el-form {
  .serial-number {
    :deep .el-form-item__content {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }

  .el-input {
    margin-right: 16px;
  }

  .el-divider {
    margin: 16px 0;
  }
}
</style>
