SubmitQualityInspect.vue 4.98 KB
<template>
    <el-container class="QualityInspectManagement">
        <el-header height="50px">
            <div>
                <span class="title-text">提交质检</span>
            </div>
        </el-header>


        <el-main>
            <el-menu mode="horizontal" @select="handleMenuSelect" :default-active="'1'">
                <el-menu-item :index="'1'">
                    待标注
                </el-menu-item>
                <el-menu-item :index="'5'">
                    审核驳回
                </el-menu-item>
                <el-menu-item :index="'6'">
                    审核通过
                </el-menu-item>
            </el-menu>
            <el-table :data="qualityInspectList" v-loading="isLoading">
                <el-table-column prop="taskName" label="taskName" align="center"></el-table-column>
                <el-table-column prop="packName" label="packName" align="center"></el-table-column>
                <el-table-column prop="accountId" label="所属公司" align="center">
                    <template #default="scope">
                        {{ companyMap[scope.row.accountId] }}
                    </template>
                </el-table-column>
                <el-table-column prop="count" label="count" align="center"></el-table-column>
                <el-table-column prop="finishCount" label="finishCount" align="center"></el-table-column>
                <el-table-column prop="toBeLabeledCount" label="toBeLabeledCount" align="center"></el-table-column>
                <el-table-column prop="operation" label="操作" align="center">
                    <template #default="scope">
                        <el-button @click="submitInspect(scope.row.packId)" type="text">提交审核</el-button>
                        <el-button @click="viewDetails(scope.row.packId)" type="text">查看详情</el-button>
                    </template>
                </el-table-column>
            </el-table>


        </el-main>
    </el-container>
</template>

<script>
import {reactive, ref, toRaw,} from "vue"
import {
    filterEmptyValueInObject, getKeyByValueInObject,
     resetForm
} from "@/PublicUtil/PublicUtil"
import qualityInspectApi from './SubmitQualityInspectApi'
import {ElMessageBox} from 'element-plus'
import {ElMessage} from 'element-plus'
import {getCompanyMap} from '@/Request/DictionaryRequest'
import {useRouter} from 'vue-router'

export default {
    setup() {
        // scalar
        const pageNum = ref(1)
        const pageSize = ref(10)
        const total = ref()
        const isLoading = ref(false)
        const router = useRouter()
        let selectedMenuIndex = '1'

        const qualityInspectList = ref([])

        // computed

        // mapping
        const companyMap = reactive({})

        // function
        const handlePageNumChange = function(num) {
            pageNum.value = num
            getQualityInspectList()
        }
        const handlePageSizeChange = function(size) {
            pageNum.value = 1
            pageSize.value = size
            getQualityInspectList()
        }

        const handleMenuSelect = function(index) {
            selectedMenuIndex = index
            getQualityInspectList()
        }

        const viewDetails = function(packId) {
            router.push(
                {
                    path: '/DataLabel/PeopleLabel',
                    query: {
                        packId: packId,
                        pageNum: 1,
                    }
                }
            )
        }

        const submitInspect = function(id) {
            qualityInspectApi.submitInspect(id).then(
                (r) => {
                    const message = r.msg
                    ElMessage(
                        {
                            message: `${message}`,
                        }
                    )
                }
            )
        }

        const getQualityInspectList = function() {
            isLoading.value = true
            qualityInspectApi.getQualityInspectList(selectedMenuIndex).then(
                ({data}) => {
                    isLoading.value = false

                    qualityInspectList.value = data
                    // formatPaginatedTableData(
                    //     qualityInspectList,
                    //     data,
                    //     total,
                    // )
                }
            )
        }

        const initialize = function() {
            getQualityInspectList()
            getCompanyMap(companyMap)
        }

        initialize()

        return {
            // scalar
            pageNum,
            pageSize,
            total,
            isLoading,
            qualityInspectList,
            // mapping
            companyMap,
            // function
            handlePageNumChange,
            handlePageSizeChange,
            getKeyByValueInObject,
            handleMenuSelect,
            viewDetails,
            submitInspect,
        }
    },
}
</script>
<style lang="less" scoped>
@import "./SubmitQualityInspect.less";
</style>