<!--
 * @Descripttion: (轮播图/tb_banner 详情弹窗)
 * @version: (1.0)
 * @Author: (lwh)
 * @Date: (2023-10-09)
 * @LastEditors: (lwh)
 * @LastEditTime: (2023-10-09)
-->
 <template>
  <el-dialog v-model="props.modelValue" title="轮播图信息详情" width="900px" @closed="closeDialog" @open="openDialog">
    <el-form ref="formRef" :model="formData" :disabled="true">

      <el-row :gutter="20">
	  

    
    
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="位置" >
              <el-select v-model="formData.bannerPosition" >
                <el-option v-for="item in  banner_position " :key="item.dictValue" :label="item.dictLabel" :value="parseInt(item.dictValue)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="图片" >
              <UploadImage ref="uploadRef" v-model="formData.bannerImg" :limit="1" :fileSize="5"
              :drag="true" :isShowTip="false" :isDisabled="true"/>
            </el-form-item>
          </el-col>
    
          <el-col :lg="12">
            <el-form-item :label-width="labelWidth" label="排序" >
              <el-input-number v-model.number="formData.bannerSort" controls-position="right" :precision="2" />
            </el-form-item>
          </el-col>






      </el-row>
    </el-form>
  </el-dialog>
</template>

<script setup>
import { ElMessage } from 'element-plus'
import { reactive, ref, watch } from "vue";


// 打开弹窗时回调
const openDialog = async () => {
   await getbanner_position()

}

const formData = ref({
  ...props.data,
});
watch(props, async (v) => {
  formData.value = v.data;
});

// -业务参数
// 位置字典选项列表
const banner_position = ref([]);

// -业务方法
// 字典获取
async function getbanner_position() {
  await proxy.getDicts('banner_position').then((res) => {
    banner_position.value = res.data
  })
}



// 基础参数
const formRef = ref();
const labelWidth = 100;
const { proxy } = getCurrentInstance()
const props = defineProps({
  modelValue: Boolean,
  data: Object,
  done: Function,
});
const emits = defineEmits(["update:modelValue"]);


// -基础方法
const closeDialog = () => {
  emits("update:modelValue", false);
};

</script>
