<template>
    <div class="lj-card-item">
        <mu-row>
            <mu-col span="3" class="lj-card-secondary-title">质检单号：</mu-col>
            <mu-col span="7" class="lj-card-secondary-content">{{item.billcode}}</mu-col>
            <mu-col span="2">
                <lj-status-badge :value="getStatus(item.flag,item.SecFlag,item.saveflag,item.ifspecial,item.buyerAuditflag)" :statusDic="statusDic"/>
            </mu-col>
            <mu-col span="3" class="lj-card-secondary-title">物料名称：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content">{{item.mtrlname}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">物料编码：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content">{{item.mtrlcode}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">规格：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content">{{item.mtrlmode}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">送检单号：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content">{{item.relcode}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">指令单号：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content">{{item.ordercode}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">销售订单号：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content">{{item.saletaskcode}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">物料类别：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content">{{item.mtrltype}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">数量：</mu-col>
            <mu-col span="3" class="lj-card-secondary-content">{{item.qty}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title">单位：</mu-col>
            <mu-col span="3" class="lj-card-secondary-content">{{item.unit}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title" v-if="item.status !== ''">{{userInfo.statusname}}：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content" v-if="item.status !== ''">{{item.status}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title" v-if="item.woodcode !== ''">{{userInfo.woodcodename}}：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content" v-if="item.woodcode !== ''">{{item.woodcode}}</mu-col>
            <mu-col span="3" class="lj-card-secondary-title" v-if="item.pcode !== ''">{{userInfo.pcodename}}：</mu-col>
            <mu-col span="9" class="lj-card-secondary-content" v-if="item.pcode !== ''">{{item.pcode}}</mu-col>
        </mu-row>
    </div>
</template>

<script>
    import LjStatusBadge from "components/lj-status-badge";

    export default {
        name: "cpcheck-item",
        components: {
            LjStatusBadge
        },
        props: {
            item: {
                // 传入数据
                type: Object
            }
        },
        data() {
            return {
                showCount: 0,
                statusDic:{
                    "待质检": {dscrp: "待质检", color: "Warn"},
                    "待初审": {dscrp: "待初审", color: "Alert"},
                    "待采购审": {dscrp: "待采购审", color: "Alert"},
                    "待二审": {dscrp: "待二审", color: "Normal"},
                    "已完成": {dscrp: "已完成", color: "Pass"}
                },
                userInfo:{},
                // selectMode: false
            }
        },
        created() {
            this.userInfo = $lj.getStorage("userInfo");
        },
        methods: {
            getStatus(flag,secflag,saveflag,ifspecial,buyerAuditflag){
                if (saveflag == 0 && flag == 0 && secflag == 0){
                    return "待质检";
                }
                if (flag == 0){
                    return "待初审";
                }
                if (ifspecial == 1 && buyerAuditflag == 0 && secflag == 0){
                    return "待采购审"
                }
                if (secflag == 0){
                    return "待二审";
                }
                return "已完成";
            }
        },
        filters: {
            dateFormat: function(parm) {
                if (parm){
                    return parm.substring(0, 10)
                } else {
                    return parm;
                }
            }
        }
    }
</script>