examineRecord.vue 8.46 KB
<template>
    <div class="examine-record">
        <div class="title">
            审核记录
        </div>
        <template v-if="list && list.length">
            <div v-if="list.length > 2 && useExpand"
                 class="up-down"
                 @click="handleToggleVisible">
                <el-button size="mini"
                           type="text"
                           :icon="visible ? 'el-icon-arrow-up' : 'el-icon-arrow-down'" />
                {{ visible ? "收起" : "展开" }}
            </div>
            <div style="width:100%;">
                <div class="record-div">
                    <div v-for="(item, index) in getList"
                         :key="index"
                         class="record-div-d">
                        <span class="span-txt-one text-hide">
                            {{ item.status ? $$(statusForShow, [item.status], "text") : "" }}
                        </span>
                        <span class="span-txt-two status-wrapper">
                            <span :class="item.status ? examineStatusClass[item.status] : ''">
                                {{
                                    item.status
                                        ? $$(statusForShow, [item.status], "status")
                                        : ""
                                }}
                            </span>
                            <span v-if="item.rejectedStatus">
                                <span style="display: inline-block; margin: 0 8px">至</span>
                                <span>
                                    {{
                                        item.rejectedStatus
                                            ? $$(
                                                rejectedForShow,
                                                [item.rejectedStatus],
                                                "rejectedStatus",
                                            )
                                            : ""
                                    }}
                                </span>
                            </span>
                        </span>
                        <span class="span-txt-two reviewer item-wrapper ">
                            <span>审核人:</span>
                            <div class="value">
                                <el-tooltip class="item"
                                            popper-class="remark-popper-class"
                                            effect="dark"
                                            :content="item.reviewedBy"
                                            placement="bottom">
                                    <el-button type="text" class="value-btn text-hide">
                                        {{ item.reviewedBy }}
                                    </el-button>
                                </el-tooltip>
                            </div>

                        </span>
                        <span class="span-txt-two ">
                            审核时间:{{ item.reviewedDateFormat || item.reviewedDate }}
                        </span>
                        <span v-if="item.remark" class="span-txt-two remark item-wrapper">
                            <span class="label">备注:</span>
                            <div class="value">
                                <el-tooltip class="item"
                                            popper-class="remark-popper-class"
                                            effect="dark"
                                            :content="item.remark"
                                            placement="bottom">
                                    <el-button type="text" class="value-btn text-hide">
                                        {{ item.remark }}
                                    </el-button>
                                </el-tooltip>
                            </div>

                        </span>
                        <span v-if="[4, 6, 7, 9, 11].includes(item.status)"
                              class="span-txt-two reject-cause item-wrapper">
                            <span class="label">驳回原因:</span>
                            <div class="value">
                                <el-tooltip class="item"
                                            popper-class="remark-popper-class"
                                            effect="dark"
                                            :content="item.rejectCause"
                                            placement="bottom">
                                    <el-button type="text" class="text-hide value-btn">
                                        {{ item.rejectCause }}
                                    </el-button>
                                </el-tooltip>
                            </div>
                        </span>
                    </div>

                </div>
            </div>
        </template>
        <div v-else class="emptyCom">
            <img :src="emptyImg"
                 class="emptyImg"
                 alt="" />
            <span class="tips">暂无数据</span>
        </div>
    </div>
</template>

<script>
import emptyImg from "@/assets/empty.png";

export default {
	name: "",
	props: {
		list: {
			required: true,
			type: Array,
		},
		useExpand: {
			type: Boolean,
			default: true,
		},
	},
	data() {
		return {
			visible: false,
			emptyImg,
			examineStatusClass: {
				2: "greenSp",
				4: "redSp",
				5: "greenSp",
				6: "redSp",
				7: "redSp",
				8: "greenSp",
				9: "redSp",
				10: "greenSp",
				11: "redSp",
			},
			statusForShow: {
				2: { text: "运营审核", status: "通过" },
				4: { text: "运营审核", status: "驳回" },
				5: { text: "商务审核", status: "通过" },
				6: { text: "商务审核", status: "驳回" },
				7: { text: "采购驳回", status: "驳回" },
				8: { text: "总监审核", status: "通过" },
				9: { text: "总监审核", status: "驳回" },
				10: { text: "经理通过", status: "通过" },
				11: { text: "经理驳回", status: "驳回" },
			},
			rejectedForShow: {
				1: { rejectedStatus: "采购商户" },
				2: { rejectedStatus: "运营审核" },
				3: { rejectedStatus: "商务审核" },
				6: { rejectedStatus: "经理审核" },
			},
		};
	},
	computed: {
		getList() {
			// 如果不使用展开功能, 直接返回整个list
			if (!this.useExpand) {
				return this.list;
			}
			if (this.visible) {
				return this.list;
			} else {
				return this.list.slice(0, 2);
			}
		},

	},
	mounted() {

	},
	methods: {
		handleToggleVisible() {
			this.visible = !this.visible;
		},
	},
};
</script>

<style scoped lang="scss">
.examine-record {
	position: relative;
	width: 100%;
	min-height: 60px;
	border-radius: 4px;
	border: 1px solid #fafafa;
	background: #fafafa;

	> .title {
		padding: 16px 20px;
		line-height: 20px;
		font-weight: 600;
		font-size: 16px;
		color: #333333;
		text-align: left;
	}

	.up-down {
		position: absolute;
		right: 20px;
		top: 20px;
		width: 42px;
		height: 20px;
		font-family: PingFangSC-Regular;
		color: #2a58ad;
		font-size: 12px;
		cursor: pointer;
	}

	.record-div {
		padding: 0 20px 16px;
		font-size: 14px;
		color: #666666;
		overflow: hidden;
		width: 100%;
		box-sizing: border-box;
		.record-div-d {
			margin-top: 10px;
			overflow: hidden;
			width: 100%;
			position: relative;
			display: flex;
			align-items: center;
			padding: 4px 0 4px 24px;
			box-sizing: border-box;

			&::before {
				position: absolute;
				content: "";
				left: 6px;
				top: 50%;
				transform: translateY(-50%);
				width: 6px;
				height: 6px;
				background: #185efe;
				border-radius: 6px;
			}
			> .span-txt-one {
				max-width: 5em;
			}
			.span-txt-two {
				margin-left: 12px;
				flex-shrink: 0;
				&.status-wrapper {
					width: 180px;
				}
				&.reviewer {
					width: 140px;
				}
				&.remark {
					flex: 1;
				}
				&.reject-cause {
					flex: 1;
				}
				&.item-wrapper {
					overflow: hidden;
					display: flex;
					align-items: center;
					.label {
						flex-shrink: 0;
					}
					.value {
						flex: 1;
						text-align: left;
						overflow: hidden;
						.value-btn {
							max-width: 100%;
							padding: 0;
						}
					}
				}
			}
		}

		.greenSp {
			color: #4aca74;
		}

		.redSp {
			color: #eb4e4e;
		}
	}

	.emptyCom {
		display: flex;
		flex-direction: column;
		flex-wrap: wrap;
		justify-content: center;
		align-items: center;

		.emptyImg {
			width: 64px;
		}
		.tips {
			font-size: 14px;
			color: #999999;
			margin: 20px 0;
		}
	}
}
</style>