<template>
    <el-table
        :data="tableData"
        stripe
        style="width: 100%">
        <el-table-column
        prop="name"
        label="工程名称"
        width="220"
        show-overflow-tooltip>
        </el-table-column>
        <el-table-column
        prop="type"
        label="专业"
        width="140"
        show-overflow-tooltip>
            <template #default="scope">
                <span>{{scope.row.type | professionType}}</span>
            </template>
        </el-table-column>
<!--        <el-table-column-->
<!--        prop="state"-->
<!--        label="状态"-->
<!--        width="180"-->
<!--        show-overflow-tooltip>-->
<!--            <template slot-scope="scope">-->
<!--                <span>{{scope.row.state | state}}</span>-->
<!--            </template>-->
<!--        </el-table-column>-->
        <el-table-column
        prop="content"
        label="流程描述"
        width="180"
        show-overflow-tooltip>
        </el-table-column>
        <el-table-column
        prop="note"
        label="备注"
        width="400"
        show-overflow-tooltip>
        </el-table-column>
        <el-table-column
        prop="intm"
        label="操作时间"
        width="160">
            <template #default="scope">
                <span>{{scope.row.intm | intm}}</span>
            </template>
        </el-table-column>
        <el-table-column
        prop="persName"
        label="操作用户">
        </el-table-column>
    </el-table>
</template>
<script>
import request from '@/utils/gw_ajax_request.js'
import {formatDateTime2} from '@/utils/gw_date.js'
export default {
    props: ['rgstrId','professionType'],
    data(){
        return{
            tableData: []
        }
    },
    mounted(){
        this.getTableDataList()
    },
    methods:{
        getTableDataList(){
            let data = {
                regstrId: this.rgstrId,
                type: this.professionType
            }
            request.post(`/tac/active/log/list`,data).then(res=>{
                if(res.success){
                    this.tableData = res.data
                }else{
                    this.$message.error(res.message)
                }
            })
        }
    },
    watch:{
        rgstrId(){
            this.getTableDataList()
        },
        professionType(){
            this.getTableDataList()
        }
    },
    filters:{
        professionType(val){
            if(val == '1'){
                return '前期与设计'
            }else if(val == '2'){
                return '建设管理'
            }else if(val == '3'){
                return '计划下达与执行'
            }else if(val == '4'){
                return '资金使用与管理'
            }else if(val == '5'){
                return '工程质量'
            }else if(val == '6'){
                return '工程安全'
            }else{
                return ''
            }
        },
        state(val){
            if(!val){
                return '未督查'
            }else if(val == '1'){
                return '督查中'
            }else if(val == '2'){
                return '已督查'
            }else if(val == '3'){
                return '助理退回给专家'
            }else if(val == '4'){
                return '专家提交到助理'
            }else if(val == '5'){
                return '成果讨论阶段'
            }else if(val == '6'){
                return '中心修改阶段'
            }else if(val == '7'){
                return '司局修改阶段'
            }else{
                return ''
            }
        },
        intm(val){
            if(val){
                return formatDateTime2(val)
            }
        }
    }
}
</script>
<style>

</style>
