HistoryTarget.vue 3.27 KB
<template>
  <baseDialog class="detail-content"
              :config="config"
              :dialog-config="dialogConfig.config"
              :is-show.sync="dialogShow">
    <div class="content">
      <d2-table ref="table"
                class="table"
                :has-num="false"
                :has-page="false"
                :search-form="formSearch"
                :table-data="list"
                :table-params="tableParams">
      </d2-table>
      <div class="block"></div>
    </div>
  </basedialog>
</template>

<script>
import {
	getStrategyMerchantAnalysisIndexHistory,
} from "@api/earlyWarningManager";

export default {
	name: "HistoryTarget",
	inject: [
		"GET_PARAMS_INFO",
	],
	props: {
		visible: {
			type: Boolean,
			default: false,
		},
		index: {
			type: Number,
			default: 0,
		},
	},
	data() {
		return {
			config: {
				isShowFooter: true,
				cancel_name: "返回",
				hideConfirmBtn: true,
			},
			dialogConfig: {
				config: {
					title: "历史兜底目标",
					width: "600px",
				},
			},
			formSearch: {},
			tableParams: {
				tableColumns: [
					{
						label: "月份",
						prop: "recordYearMonth",
						minWidth: 64,
					},
					{
						label: "渗透率兜底目标",
						minWidth: 80,
						formatter: (row) => {
							let val = row[
								{
									0: "ewPenetrationRate",
									1: "ewAxbPenetrationRate",
									2: "batteryPenetrationRate",
									3: "ewLtPenetrationRate",
								}[this.index]
							] || null;
							return val != null ? val + "%" : "-";
						},
					},
					{
						label: "转化率兜底目标",
						minWidth: 80,
						formatter: (row) => {
							let val = row[
								{
									0: "ewConRate",
									1: "ewAxbConRate",
									2: "batteryConversionRate",
									3: "ewLtConRate",
								}[this.index]
							] || null;
							return val != null ? val + "%" : "-";
						},
					},
				],
			},
			list: [],
		};
	},
	computed: {
		dialogShow: {
			get() {
				return this.visible;
			},
			set(val) {
				this.close();
			},
		},
		merchantId() {
			let [merchantId] = this.GET_PARAMS_INFO().merchantIds;
			return merchantId;
		},
	},
	watch: {
		visible(val) {
			if (val) {
				this.list = [];
				this.getList();
			}
		},
	},

	mounted() {
	},
	methods: {
		close() {
			this.$emit("dialogClose");
		},
		async getList() {
			const { merchantId } = this;
			const data = await getStrategyMerchantAnalysisIndexHistory({
				bizs: 1,
				merchantId,
			});
			this.list = data;
		},
	},
};
</script>

<style lang="scss" scoped>
.flex {
	display: flex;
	align-items: center;
}
::v-deep.el-dialog__wrapper {
	overflow: hidden !important;
	.el-dialog {
		margin: 50vh auto 0 !important;
		transform: translateY(-50%);
		.el-dialog__body {
			padding: 0;
			// padding-bottom: 24px;
			// border-bottom: 1px solid #e6e6e6;
		}
		.el-dialog__footer {
			margin-top: auto;
			border-top: 1px solid #e5e5e5;
			padding: 15px 20px 15px;
		}
		.dialog-footer {
			border-top: none;
			padding: 0;
		}
	}
}
.detail-content {
	.content {
		height: 592px;
		box-sizing: border-box;
		padding: 20px;
		overflow-y: auto;
		.table {
			width: 100%;
		}
	}
}
</style>