<!-- 选择 -->
<template>
    <navigation title="我提交的技术鉴定表" :back-url="backUrl"></navigation>

    <view class="contentBox">
        <view class="topSearch">
            <uni-easyinput type="text" v-model="queryParams.keyword" prefixIcon="search" :inputBorder="false"
                @iconClick="getTechnicalList" placeholder="请输入搜索内容" />
        </view>

        <!-- 列表  -->
        <z-paging ref="pagingRef" class="containerBox" v-model="infoList" @query="getTechnicalList">
            <uni-list class="listBox">
                <uni-list-item v-for="item in infoList" :key="item.id" clickable @tap="onChecked(item)">
                    <template v-slot:body>
                        <view style="display: flex; flex-direction: column;  width: 100%;">
                            <!-- <view class="line title">
                                <p>技术鉴定表</p>
                                <p>{{ item?.appraisalNo }}</p>
                            </view> -->
                            <view class="line content">
                                <uv-upload :fileList="item?.fileUrlList" name="3" multiple
                                    :maxCount="item?.fileUrlList?.length" :previewFullImage="true"></uv-upload>
                            </view>

                            <view class="line content">
                                <p>备注</p>
                                <p>
                                    <text v-if="item?.remark">{{ item?.remark }}</text>
                                    <text v-else class="empty">未填写</text>
                                </p>
                            </view>
                            <view class="line content">
                                <p>创建时间</p>
                                <view>{{ formatDate(item?.createTime) }}</view>
                            </view>
                        </view>
                    </template>
                </uni-list-item>
            </uni-list>
        </z-paging>
    </view>
</template>
<script setup>
import { ref, toRefs } from 'vue';
import { onShow, onLoad } from "@dcloudio/uni-app";
import { myList } from '@/api/stockOut';
import { formatDate, objectToQuery } from '../../../until';
import Navigation from '../../../components/Navigation.vue';
const props = defineProps({
    pathParams: {
        type: Object,
        default: null,
        required: false
    }

})
const { pathParams } = toRefs(props)
// 数据：查询关键字
const queryParams = ref({
    keyword: ''
})
// 数据：返回路径
const backUrl = ref('')
// 绑定：加载屏
const pagingRef = ref(null)
// 数据
const infoList = ref([])
// 选中技术鉴定表
const onChecked = (item) => {
    if (item.appraisalNo) {

        uni.setStorageSync('app_technical', { ...item, appraisalNo: undefined });
        uni.navigateTo({
            url: backUrl.value
        });
    }
}
// 列表
const getTechnicalList = (pageNo, pageSize) => {
    queryParams.value.pageNum = pageNo
    myList(queryParams.value).then(res => {
        res.rows.forEach(e => {
            e.showMore = false;
        });
        infoList.value = res.rows
        pagingRef.value.complete(res.rows)
    }).catch(res => {
        pagingRef.value.complete(false)
    })
}

// 数据：路径参数
onLoad((options) => {
    pathParams.value = options
    const query = objectToQuery(options)
    backUrl.value = `/pages/warehousing/stockOut/components/technicalEvaluation${query}`

})
onShow(() => {
    pagingRef.value?.reload?.()
})
const onDownLoad = () => {

}
</script>
<style scoped lang="scss">
.topSearch {
    position: fixed;
    top: 65rpx;
    left: 0;
    right: 0;
    z-index: 999;
    padding: 4rpx;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;
}

.containerBox {
    padding-top: 125rpx !important;
    width: 100%;
    height: 100%;
    box-sizing: border-box;

    .zp-l-text-rpx {
        font-size: 12px;
    }
}

::v-deep.listBox {
    .uni-list {
        background-color: #F8F8FF;
    }

    .uv-upload {
        flex: none !important;
    }

    .uni-list-item {
        margin-bottom: 1rpx;
    }

    .uni-list-item__container {
        padding: 0;
    }

    .line {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #eee;
        padding: 12rpx;
    }

    .title {
        font-weight: 600;
        font-size: 14px;
    }

    .content {
        font-weight: 500;
        font-size: 13px;
    }

    .empty {
        color: #D3D3D3;
    }

}
</style>