<template>
  <div>
    <div class="detail-panel">
      <div class="panel-header">
        <div class="title">
          图文消息
        </div>
      </div>
      <el-row>
        <el-col :span="10" :offset="1">
          <el-form-item prop="imgText.titleMaxLength" label="标题长度" :verify="['Number']">
            <el-input v-model="tmpCondition.imgText.titleMaxLength"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.summaryMaxLength" label="摘要长度" :verify="['Number']">
            <el-input v-model="tmpCondition.imgText.summaryMaxLength"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.imgMaxCount" label="图片数量" :verify="['Number']">
            <el-input v-model="tmpCondition.imgText.imgMaxCount"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.imgMaxSize" label="图片大小" :verify="['Regex=^[1-9]([0-9]{0,8})[kmgtpezybndKMGTPEZYBND]?[bB]?(?<!\d)$|必须以数字开头，单位为B,KB,M,MB,G,GB...']">
            <el-input v-model="tmpCondition.imgText.imgMaxSize"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.imgFormat" label="图片格式">
            <el-checkbox-group v-model="tmpCondition.imgText.imgFormat">
              <el-checkbox v-for="item in imgFormatOptions" :key="item.ID" :label="item.ID">{{item.name}}</el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item prop="imgText.titleMaxLengthMsg" label="提示信息">
            <el-input v-model="tmpCondition.imgText.titleMaxLengthMsg"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.summaryMaxLengthMsg" label="提示信息">
            <el-input v-model="tmpCondition.imgText.summaryMaxLengthMsg"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.imgMaxCountMsg" label="提示信息">
            <el-input v-model="tmpCondition.imgText.imgMaxCountMsg"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.imgMaxSizeMsg" label="提示信息">
            <el-input v-model="tmpCondition.imgText.imgMaxSizeMsg"></el-input>
          </el-form-item>
          <el-form-item prop="imgText.imgFormatMsg" label="提示信息">
            <el-input v-model="tmpCondition.imgText.imgFormatMsg"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    conditionForm: Object
  },
  computed: {
    tmpCondition: {
      get() {
        return this.conditionForm
      },
      set(val) {
        this.$emit('update:conditionForm', val)
      }
    }
  },
  data() {
    return {
      imgFormatOptions: []
    }
  },
  async created() {
    let res = await Promise.all([
      axios.get('/ui/resourceformt/qqweiboimg')
    ])
    this.imgFormatOptions = res[0].data.data
  }
}
</script>
