<template>
  <el-dialog custom-class="ba-operate-dialog" :model-value="showDialog" @close="showDialog=false"
    :title="detailData.handleStatusName">
    <div class="mt-20">
      <el-descriptions title="" direction="vertical" :column="4" border>
        <el-descriptions-item label="问题来源">{{detailData.sourceType===0?'显示屏幕':detailData.sourceType===1?'内置应用':'手机应用'}}
        </el-descriptions-item>
        <el-descriptions-item label="反馈类型">{{detailData.feedbackType===0?'功能':detailData.feedbackType===1?'优化':'其他'}}
        </el-descriptions-item>
        <el-descriptions-item label="联系人">{{detailData.contactName}}</el-descriptions-item>
        <el-descriptions-item label="联系电话">{{detailData.contactMobile}}</el-descriptions-item>
        <el-descriptions-item label="备注" :span="4">{{detailData.feedbackContent}}</el-descriptions-item>
        <el-descriptions-item label="图片" :span="4">
          <div style="display: flex;flex-flow: wrap">
            <el-image  :preview-src-list="detailData.feedbackPictureUrl" :src="item" v-for="(item,index) in detailData.feedbackPictureUrl" style="height: 100px;width: 100px;padding:10px" :key="index"></el-image>
          </div>
        </el-descriptions-item>
      </el-descriptions>
    </div>
    <div style="margin-top: 20px">
      <div style="display: flex;justify-content: space-between;margin-top: 10px">
        <span>处理情况：</span>
      </div>
      <el-input style="margin-top: 10px" type="textarea" rows="6" v-model="detailData.handleRemark">
      </el-input>
    </div>
    <div class="flex justify-flex-end mt-20">
      <el-button type="primary" @click="save">保存</el-button>
    </div>
  </el-dialog>
</template>

<script setup lang="ts">
import { nextTick, ref, toRaw } from 'vue'
import request from '/@/api/request'
import { feedback, member } from '/@/api/controllerUrls'

let props = defineProps({
    data: {
        type: Object,
        default: {},
    },
})

let detailData = ref({})
let showDialog = ref(false)

function openDialog(value: any) {
    showDialog.value = true
    nextTick(() => {
        getData(value)
    })
}

function getData(value: any) {
    request.index(feedback, { id: value.id }, 'detail').then((res) => {
        detailData.value = res.data
    })
}

function save() {
    request.edit(feedback, { id: detailData.value.id, handleRemark: detailData.value.handleRemark }, 'confirm').then((res) => {
        detailData.value = res.data
    })
}

defineExpose({
    openDialog,
})
</script>

<style scoped>
</style>
