<template>
|
<Dialog v-model="dialogVisible" :title="dialogTitle" width="47%">
|
<div class="card" @click="openForm('ATOM')">
|
<img src="../img/ATOM.png" alt="Card Image" class="card-img"/>
|
<div class="card-body">
|
<p class="card-title-text">{{ "原子指标" }}</p>
|
<p class="card-text">{{ "从0开始创建一个新指标" }}</p>
|
</div>
|
</div>
|
<div class="card" @click="openForm('DER')">
|
<img src="../img/DER.png" alt="Card Image" class="card-img"/>
|
<div class="card-body">
|
<p class="card-title-text">{{ "派生指标" }}</p>
|
<p class="card-text">{{ "基于单个原子指标通过条件过滤派生出的新指标" }}</p>
|
</div>
|
</div>
|
<div class="card" @click="openForm('CAL')">
|
<img src="../img/CAL.png" alt="Card Image" class="card-img"/>
|
<div class="card-body">
|
<p class="card-title-text">{{ "复合指标" }}</p>
|
<p class="card-text">{{ "基于一组原子指标通过条件过滤派生出的新指标" }}</p>
|
</div>
|
</div>
|
</Dialog>
|
<AtomIndDefineForm ref="atomFormRef" @success="getList" />
|
<DerIndDefineForm ref="derFormRef" @success="getList" />
|
<CalIndDefineForm ref="calFormRef" @success="getList" />
|
</template>
|
<script lang="ts" setup>
|
import * as DataSetApi from '@/api/data/ind/data/data.set'
|
import AtomIndDefineForm from './AtomIndDefineForm.vue'
|
import DerIndDefineForm from './DerIndDefineForm.vue'
|
import CalIndDefineForm from './CalIndDefineForm.vue'
|
|
defineOptions({ name: 'IndDataSetForm' })
|
|
const { t } = useI18n() // 国际化
|
const message = useMessage() // 消息弹窗
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogTitle = ref('') // 弹窗的标题
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
/** 打开弹窗 */
|
const open = async (type: string) => {
|
dialogVisible.value = true
|
dialogTitle.value = t('action.' + type)
|
formType.value = type
|
}
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
const atomFormRef = ref()
|
const derFormRef = ref()
|
const calFormRef = ref()
|
const openForm = (category: string) => {
|
if(category === 'ATOM'){
|
atomFormRef.value.open("create",null)
|
}else if(category === 'DER'){
|
derFormRef.value.open("create",null)
|
}else if(category === 'CAL'){
|
calFormRef.value.open("create",null)
|
}
|
}
|
</script>
|
|
<style scoped>
|
.card {
|
width: 25vh;
|
margin: 10px 16px;
|
display: inline-block;
|
vertical-align: top;
|
border: 1px solid #ddd;
|
border-radius: 4px;
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
height: 30vh;
|
cursor: pointer;
|
}
|
.card-img {
|
width: 100%;
|
height: 150px;
|
object-fit: cover;
|
}
|
|
.card-body {
|
padding: 10px;
|
text-align: center;
|
}
|
.card-title-text{
|
font-size: larger;
|
}
|
.card-text {
|
font-size: smaller;
|
margin: 0;
|
}
|
</style>
|