order-info.vue 1.77 KB
<template>
    <layout-body>
        <Table border :columns="columns" :data="dataList" :show-header="false"></Table>
    </layout-body>
</template>

<script>
    import _ from 'lodash';
    import {DiffService} from 'services/repository';

    export default {
        props: {
            id: {
                type: Number
            }
        },
        data() {
            return {
                columns: [{
                    width: 200,
                    align: 'right',
                    key: 'label'
                }, {
                    key: 'value'
                }],
                dataList: []
            };
        },
        created() {
            this.diffService = new DiffService();
            this.diffService.detail({id: this.id})
                .then(res => {
                    let fields = [{
                        label: '主题:',
                        value: 'subject'
                    }, {
                        label: '分类:',
                        value: 'typeName'
                    }, {
                        label: '到货单号:',
                        value: 'orderNumber'
                    }, {
                        label: '紧急程度:',
                        value: 'emergencyDegreeName'
                    }, {
                        label: '品牌:',
                        value: 'brandName'
                    }, {
                        label: '描述:',
                        value: 'content'
                    }];

                    _.each(fields, item => {
                        item.value = res.data[item.value] || '-';
                    });

                    this.dataList = fields;
                });
        },
        methods: {
        }
    };
</script>

<style lang="scss">
</style>