<template>
  <div class="flow-form" v-loading="loading">
    <el-form size="small" label-width="100px" :rules="dataRule" ref="dataForm" :model="dataForm" :disabled="setting.readonly">
      <el-col :span="24" v-if="JudgeShow('groupType')">
        <el-form-item label="人群类型">
          <el-radio-group v-model="dataForm.groupType" :disabled="JudgeWrite('groupType')">
            <el-radio :label="item" v-for="item in groupTypeOptions" :key="item">{{ item }} </el-radio>
          </el-radio-group>
        </el-form-item>
      </el-col>
      <el-col :span="12" v-if="JudgeShow('groupId')">
        <el-form-item label="选择人群" prop="groupId">
          <el-select v-model="dataForm.groupId" filterable :disabled="JudgeWrite('groupId')">
            <el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in groupsOptions" />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="12" v-if="JudgeShow('channelId')">
        <el-form-item label="完整渠道编码" prop="channelId">
          <el-input v-model="dataForm.channelId" placeholder="完整渠道编码" :disabled="JudgeWrite('channelId')"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="12" v-if="JudgeShow('tplInfoId')">
        <el-form-item label="选择模板" prop="tplInfoId">
          <el-select v-model="dataForm.tplInfoId" filterable :disabled="JudgeWrite('tplInfoId')">
            <el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in tplInfoOptions" />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="12" v-if="JudgeShow('messageInfo')">
        <el-form-item label="内容预览" prop="messageInfo">
          <el-input type="textarea" v-model="dataForm.messageInfo" :disabled="JudgeWrite('messageInfo')" :rows="4"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="24" v-if="JudgeShow('pushPattern')">
        <el-form-item label="推送方式">
          <el-radio-group v-model="dataForm.pushPattern" :disabled="JudgeWrite('pushPattern')">
            <el-radio :label="item" v-for="item in patternTypeOptions" :key="item">{{ item }} </el-radio>
          </el-radio-group>
        </el-form-item>
      </el-col>
    </el-form>
  </div>
</template>

<script>
import comMixin from '../mixin'
export default {
  mixins: [comMixin],
  name: 'adsMarketTaskInfo',
  data() {
    return {
      billEnCode: 'WF_adsMarketTaskInfoNo',
      dataForm: {
        groupType: '',
        groupId: '',
        channelId: '',
        tplInfoId: '',
        messageInfo: '',
        pushPattern: ''
      },
      groupTypeOptions: ['标签人群', '导入人群'],
      groupsOptions: [
        { label: '北京', value: 1 },
        { label: '上海', value: 2 },
        { label: '广州', value: 3 },
        { label: '郑州', value: 5 },
        { label: '河南', value: 6 }
      ],
      tplInfoOptions: [
        { label: '模板1', value: 1 },
        { label: '模板2', value: 2 },
        { label: '模板3', value: 3 },
        { label: '模板4', value: 5 },
        { label: '模板5', value: 6 }
      ],
      patternTypeOptions: ['审核后推送', '定时推送'],
      dataRule: {
        groupId: [{ required: true, message: '人群不能为空', trigger: 'change' }],
        channelId: [{ required: true, message: '完整渠道编码不能为空', trigger: 'blur' }],
        tplInfoId: [{ required: true, message: '模板不能为空', trigger: 'change' }],
        messageInfo: [{ required: true, message: '内容不能为空', trigger: 'blur' }]
      }
    }
  }
}
</script>

<style scoped></style>
