EffectDetailDialog.vue 4.65 KB
<template>
  <baseDialog class="effect-detail-dialog"

              :config="config"

              :dialog-config="dialogConfig.config"

              :is-show.sync="dialogShow">

    <div class="content">

      <div class="block">

        <div class="business-box">

          <img class="bg"

               src="@/assets/strategy/strategy-analyse-bg.png">

          <div class="left">

            <div class="business-title">

              当前周期

            </div>

            <template v-for="(item, index) in row">

              <div :key="index"

                   class="business-item">

                <div class="label">

                  {{ item.categoryExtension == '全部' ? item.metricName : (item.categoryExtension + item.metricName) }}

                </div>

                <div class="value flex">

                  <template v-if="item.currentValue != null && item.currentValue >= 0">

                    {{ item.currentValue }}<template v-if="item.unit">

                      {{ item.unit }}

                    </template>

                  </template>

                  <template v-else>

                    -

                  </template>

                </div>

              </div>

            </template>

          </div>

          <div class="right">

            <div class="business-title">

              下一周期

            </div>

            <template v-for="(item, index) in row">

              <div :key="index"

                   class="business-item">

                <div class="label">

                  {{ item.categoryExtension == '全部' ? item.metricName : (item.categoryExtension + item.metricName) }}

                </div>

                <div class="value flex">

                  <template v-if="item.nextValue != null && item.nextValue >= 0">

                    {{ item.nextValue }}<template v-if="item.unit">

                      {{ item.unit }}

                    </template>

                    <img class="arrow"

                         :src="getIconSrc(formatIsRatio(item.nextValue - item.currentValue))" />

                  </template>

                  <template v-else>

                    -

                  </template>

                </div>

              </div>

            </template>

          </div>

        </div>

      </div>

    </div>

  </baseDialog>
</template>

<script>
const decline = require("@/assets/strategy/decline.png");

const just01 = require("@/assets/strategy/just01.png");

const rise = require("@/assets/strategy/rise.png");

export default {

	name: "EffectDetailDialog",

	props: {

		visible: {

			type: Boolean,

			default: false,

		},

		row: {

			type: Array,

			default: () => [],

		},

		searchParams: {

			type: Object,

			default: () => ({}),

		},

	},

	data() {
		return {

			config: {

				isShowFooter: false,

				cancel_name: "关闭",

				hideConfirmBtn: true,

			},

			dialogConfig: {

				config: {

					title: "效果分析",

					width: "720px",

				},

			},

		};
	},

	computed: {

		dialogShow: {

			get() {
				return this.visible;
			},

			set() {
				this.close();
			},

		},

	},

	methods: {

		close() {
			this.$emit("update:visible", false);
		},

		getIconSrc(name) {
			return {

				rise,

				decline,

				just01,

			}[name] ?? "";
		},

		formatIsRatio(delta) {
			return delta < 0 ? "decline" : delta == 0 ? "just01" : "rise";
		},

	},

};
</script>

<style scoped lang="scss">
.flex {
	display: flex;

	align-items: center;
}

.arrow {
	width: 16px;

	height: 16px;

	transform: translateY(1px);
}

.content {
	min-height: 289px;
}

.block {
	&-title {
		padding: 0 0 8px;
	}

	&-icon {
		width: 16px;

		height: 16px;

		margin-right: 4px;
	}

	.business-box {
		height: 289px;

		border-radius: 4px;

		position: relative;

		display: flex;

		box-sizing: border-box;

		padding: 10px;

		.bg {
			position: absolute;

			top: 0;

			left: 0;

			width: 100%;

			height: 100%;
		}

		.left,
		.right {
			width: 59%;

			display: flex;

			flex-direction: column;

			gap: 14px;

			position: relative;

			z-index: 2;

			.business-title {
				padding-top: 16px;

				color: #1d1d1d;

				font-size: 14px;

				font-weight: 500;
			}

			.business-item {
				display: flex;

				align-items: center;

				font-size: 13px;

				.label {
					min-width: 104px;

					color: #888888;
					margin-right: 10px;
				}

				.value {
					color: #1d1d1d;
				}
			}
		}

		.left {
			box-sizing: border-box;

			padding-left: 15%;
		}

		.right {
			border-radius: 4px;

			background: #ffffffcc;

			padding-left: 24px;

			.business-item {
				.value {
					color: #2a58ad;

					font-size: 16px;

					font-weight: 500;
				}
			}
		}
	}
}
</style>