All files / src/components/u-process-record.vue index.designer.vue

52% Statements 13/25
8.33% Branches 2/24
11.11% Functions 1/9
54.16% Lines 13/24

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115      1x   1x     1x                                                                                                                                                                                                           1x 1x      
<template>
    <div v-if="$env.VUE_APP_DESIGNER">
        <template v-if="type === 'timeline'">
            <u-timeline :data-source="list">
                <template #item="current">
                    <u-timeline-item>
                        <div :class="$style.title">{{ current.item.nodeTitle }}</div>
                        <div :class="$style.item">
                            <div :class="$style.left">
                                <div :class="$style.label">{{ $tt('assignee') }}</div>
                                <div :class="$style.label">{{ $tt('recordCreateTime') }}</div>
                                <div :class="$style.label">{{ $tt('nodeOperation') }}</div>
                                <div :class="$style.label">{{ $tt('comment') }}</div>
                            </div>
                            <div :class="$style.content">
                                <div :class="$style.value">{{ current.item.userName || '-' }}</div>
                                <div :class="$style.value">{{ current.item.recordCreateTime || '-' }}</div>
                                <div :class="$style.value">{{ current.item.nodeOperation || '-' }}</div>
                                <div :class="$style.value">{{ current.item.comment || '-' }}</div>
                            </div>
                        </div>
                    </u-timeline-item>
                </template>
            </u-timeline>
        </template>
        <template v-else>
            <u-table-view :data-source="list">
                <u-table-view-column :title="$tt('currentNode')">
                    <template #cell="current"> {{ current.item.nodeTitle || '-' }}</template>
                </u-table-view-column>
                <u-table-view-column :title="$tt('assignee')">
                    <template #cell="current"> {{ current.item.userName || '-' }}</template>
                </u-table-view-column>
                <u-table-view-column :title="$tt('recordCreateTime')">
                    <template #cell="current"> {{ current.item.recordCreateTime }}</template>
                </u-table-view-column>
                <u-table-view-column :title="$tt('nodeOperation')">
                    <template #cell="current"> {{ current.item.nodeOperation || '-' }}</template>
                </u-table-view-column>
                <u-table-view-column :title="$tt('comment')">
                    <template #cell="current"> {{ current.item.comment }}</template>
                </u-table-view-column>
            </u-table-view>
        </template>
    </div>
    <component
        v-else
        is="u-process-record-real"
        v-bind="[$attrs, $props]"
        v-on="$listeners">
    </component>
</template>
<script>
import i18nMixin from '../../mixins/i18n';
export default {
    mixins: [i18nMixin('u-process-record')],
    props: {
        type: {
            type: String,
            default: 'table',
        },
    },
    data() {
        return {
            list: [
                {
                    nodeTitle: '发起任务',
                    userName: '章三',
                    recordCreateTime: '2023-12-21 10:20:20',
                    nodeOperation: 'submit',
                    comment: '无',
                },
                {
                    nodeTitle: '审批任务',
                    userName: '李四',
                    recordCreateTime: '2023-12-21 10:20:20',
                    nodeOperation: 'consent',
                    comment: '无',
                },
                {
                    nodeTitle: '审批任务',
                    userName: '李四',
                    recordCreateTime: '2023-12-21 10:20:20',
                    nodeOperation: 'consent',
                    comment: '无',
                },
            ],
        };
    },
};
</script>
 
<style module>
.item {
    display: flex;
}
.left {
    min-width: 9%;
    margin-right: 10px;
}
.label {
    color: var(--process-record-label-color);
}
.value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.title {
    font-weight: 500;
    color: var(--process-record-title-color);
}
</style>