<template>
  <div class='app-container'>
    <el-form class="form" label-width="100px" ref="form" :model="data.form" :rules="data.rules">
      <el-form-item class="audioList" label="选择音频：">
        <el-tag v-for="item in data.form.audioList" :key="item.audioId" size="large" closable>
          {{ item.audioName }}
        </el-tag>
        <div class="audio">
          <img src="@/assets/icons/svg/file.svg" width="70" height="70" />
          <span>双十一活动</span>
          <span>3小时21分</span>
        </div>
        <el-button icon="Plus" @click="getDialog" style="width: 100%">新增</el-button>
      </el-form-item>
      <el-form-item label="内容名称：">
        <el-input v-model="data.form.name" placeholder="请输入内容名称" />
      </el-form-item>
      <el-form-item label="播放时间：">
        <el-date-picker type="datetimerange" start-placeholder="开始时间" end-placeholder="结束时间"
          format="YYYY-MM-DD HH:mm:ss" date-format="YYYY/MM/DD ddd" time-format="A hh:mm:ss" />
        <el-button icon="Plus" style="width: 100%; margin-top: 15px">新增时段</el-button>
      </el-form-item>
      <el-form-item label="所属门店：" style="width: 800px">
        <el-table :data="data.form.list">
          <el-table-column label="所属" align="center">
            <template #default="scope">
              <el-select>
                <!-- <el-option /> -->
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="所属门店" align="center">
            <template #default="scope">
              <el-select>
                <!-- <el-option /> -->
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="所属设备" align="center">
            <template #default="scope">
              <el-select>
                <!-- <el-option /> -->
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center">
            <template #default="scope">
              <el-button type="danger" link>删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form-item>
      <el-form-item style="width: 800px">
        <el-button icon="Plus" style="width: 100%">新增关联</el-button>
      </el-form-item>
    </el-form>
    <div class="form-btn">
      <el-button>取消</el-button>
      <el-button type="primary">确定</el-button>
    </div>

    <el-dialog v-model="dialogVisible" title="导入内容">
      <el-form inline>
        <el-form-item label="内容分类：">
          <el-select v-model="data.dialogForm.radio" placeholder="请选择内容分类">
            <el-option v-for="item in data.radioOptions" :key="item.value" :value="item.value" :label="item.label" />
          </el-select>
        </el-form-item>
        <el-form-item label="名称：">
          <el-input placeholder="请输入音频名称" />
        </el-form-item>
        <el-form-item label="分类：">
          <el-select placeholder="请选择音频分类">
            <!-- <el-option /> -->
          </el-select>
        </el-form-item>
        <el-form-item label="当前状态：">
          <el-select placeholder="请选择当前状态">
            <!-- <el-option /> -->
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="Plus">搜索</el-button>
          <el-button icon="Refresh">重置</el-button>
        </el-form-item>
      </el-form>
      <el-table>
        <el-table-column label="ID" align="center"></el-table-column>
        <el-table-column label="名称" align="center"></el-table-column>
        <el-table-column label="时长" align="center"></el-table-column>
        <el-table-column label="分类" align="center"></el-table-column>
        <el-table-column label="当前状态" align="center"></el-table-column>
        <el-table-column label="更新时间" align="center"></el-table-column>
        <el-table-column label="操作" align="center">
          <template #default="scope">
            <el-button type="primary" link>选择</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script setup>
const data = reactive({
  form: {
    audioList: [{
      audioName: '测试111111111111111111'
    }, {
      audioName: '测试111111111111111111'
    }, {
      audioName: '测试111111111111111111'
    }, {
      audioName: '测试111111111111111111'
    }]
  },
  rules: {},
  radioOptions: [{
    value: 1,
    label: '播放内容'
  }, {
    value: 2,
    label: 'Ohplay歌曲'
  }, {
    value: 3,
    label: '上传新内容'
  }],
  dialogForm: {
    radio: 1
  }
})

// 弹窗
const dialogVisible = ref(false)
// 打开弹窗
function getDialog() {
  dialogVisible.value = true
}
</script>

<style lang="scss" scoped>
.form {
  .el-form-item {
    width: 500px;
  }
}

.form-btn {
  margin-left: 100px;
}

.audioList {
  :deep(.el-form-item__content) {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    .el-tag {
      margin-bottom: 15px;
    }

    .audio {
      width: 200px;
      height: 200px;
      border: 1px solid #e9e9eb;
      border-radius: 8px;
      margin-bottom: 15px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      box-shadow: 0 0 6px 0 #e9e9eb;
      line-height: 10px;
      span{
        margin-top: 20px;
      }
    }
  }
}
</style>