<template>
    <a-modal v-model:visible="show" :width="900" @cancel="() => show = false" :title="props.title" :footer="null">
        <ul class="info">
            <li>
                <span>审核结果:{{ info?.shzt }}</span><span>审核意见:{{ shyjInfo }}</span>
            </li>
            <li>
                <p>访问地址:{{ info?.resInfo?.MAPINGURL }}</p>
            </li>
        </ul>
    </a-modal>
</template>

<script>
import { defineComponent, reactive, ref, onMounted, watch, toRefs } from 'vue';
import { message } from 'ant-design-vue';
import { session } from '/@/utils/Memory';
import moment from 'moment';
import { setHtmlImg } from '/@/views/minWidgets/CommonWay.js';
import { getResInCar, getResViewInfo, queryServiceTags } from '/@/api/resource/plat';
import { getAllTags } from '/@/api/sys/tag';


export default defineComponent({
    name: 'EmpowerInfo',
    components: {},
    props: {
        title: {
            type: String,
            default: '资源申请信息'
        }
    },
    setup(props, { emit }) {
        const show = ref(false);
        const info = ref({});
        const shyjInfo = ref("");


        function showInfo(e) {
            show.value = !show.value;
            if (e) getInfo(e);
        }

        function getInfo(e) {
            console.log("1111:", e);
            getResInCar({
                keyword: e.SERVICENAME,
                userId: session.getItem('userId')
            }).then(r => {
                if (r?.resp_code == 0 && r?.datas?.length) {
                    var a = r.datas.find(i => i.resInfo.SERVICEID == e.SERVICEID);
                    if (a) {
                        // var shyj = [];
                        // if (a?.shlc?.length > 1) {
                        //     a.shlc.map((i, index) => {
                        //         if (index != 0 && index != a.shlc.length - 1) {
                        //             shyj.push(i.USER_NAME + ":" + i.CHECKINFO)
                        //         }
                        //     })
                        // }
                        var shyj = a?.shlc?.slice(1, -1).map(i => i.USER_NAME + ":" + i.CHECKINFO) || [];
                        shyjInfo.value = shyj.join(";");
                        info.value = a;
                    }
                }
            })
        }

        return {
            shyjInfo,
            info,
            showInfo,
            show,
            props,
        };
    },
});
</script>
<style lang="less">
.info {
    padding: 20px;
}

.info li span {
    display: inline-block;
    width: 50%;
}

.info li {
    margin-bottom: 20px;
}
</style>