|
|
|
@ -4,9 +4,12 @@ |
|
|
|
@ 备注: 指标图 |
|
|
|
--> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { analyzeChartData } from "@/api/chart/index"; |
|
|
|
import { echatsViews } from "@/api/DesignForm/types"; |
|
|
|
import { targetInfo } from "@/api/chart/type"; |
|
|
|
const props = withDefaults( |
|
|
|
defineProps<{ |
|
|
|
uuid: string; |
|
|
|
data: echatsViews; |
|
|
|
tableKey: string; |
|
|
|
}>(), |
|
|
|
@ -16,8 +19,209 @@ const props = withDefaults( |
|
|
|
}, |
|
|
|
} |
|
|
|
); |
|
|
|
const listAry = ref<targetInfo>([]); |
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2025-07-23 13:38:00 |
|
|
|
@ 功能: 获取指标数据 |
|
|
|
*/ |
|
|
|
const getTargetData = () => { |
|
|
|
if (props.uuid && props.uuid != "") { |
|
|
|
analyzeChartData({ tableKey: props.tableKey, chartId: props.uuid }).then((data) => { |
|
|
|
console.log("获取指标数据---->1", data); |
|
|
|
listAry.value = data.data; |
|
|
|
}); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2025-06-26 09:47:45 |
|
|
|
@ 功能: 判断是否有收缩条件 |
|
|
|
*/ |
|
|
|
const searBut = (val: string) => { |
|
|
|
if (props.data.search.searchBut && Array.isArray(props.data.search.searchBut)) { |
|
|
|
if (props.data.search.searchBut.includes(val)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
}; |
|
|
|
watch( |
|
|
|
() => props.data, |
|
|
|
(val: any) => { |
|
|
|
getTargetData(); |
|
|
|
}, |
|
|
|
{ deep: true } |
|
|
|
); |
|
|
|
onMounted(() => { |
|
|
|
nextTick(() => { |
|
|
|
getTargetData(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
<template> |
|
|
|
<div>指标图</div> |
|
|
|
<div> |
|
|
|
<el-space wrap class="spaceBox"> |
|
|
|
<svg-icon icon-class="zydq" :size="20" /> |
|
|
|
<el-text>{{ props.data.title }}</el-text> |
|
|
|
</el-space> |
|
|
|
<el-form |
|
|
|
v-if="props.data.search" |
|
|
|
:inline="true" |
|
|
|
label-width="auto" |
|
|
|
class="demo-form-inline" |
|
|
|
> |
|
|
|
<el-form-item v-for="item in props.data.search.factor" :label="item.lable"> |
|
|
|
<el-date-picker |
|
|
|
v-if="item.type == 3 && item.timeType == 'ymdhms'" |
|
|
|
v-model="item.value" |
|
|
|
type="daterange" |
|
|
|
range-separator="To" |
|
|
|
start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" |
|
|
|
value-format="x" |
|
|
|
/> |
|
|
|
<el-date-picker |
|
|
|
v-else-if="item.type == 3 && item.timeType == 'year'" |
|
|
|
v-model="item.value" |
|
|
|
type="yearrange" |
|
|
|
range-separator="To" |
|
|
|
start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" |
|
|
|
value-format="x" |
|
|
|
/> |
|
|
|
<el-date-picker |
|
|
|
v-else-if="item.type == 3 && item.timeType == 'month'" |
|
|
|
v-model="item.value" |
|
|
|
type="monthrange" |
|
|
|
range-separator="To" |
|
|
|
start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" |
|
|
|
value-format="x" |
|
|
|
/> |
|
|
|
<el-date-picker |
|
|
|
v-else-if="item.type == 3 && item.timeType == 'day'" |
|
|
|
v-model="item.value" |
|
|
|
type="daterange" |
|
|
|
range-separator="To" |
|
|
|
start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" |
|
|
|
value-format="x" |
|
|
|
/> |
|
|
|
<el-date-picker |
|
|
|
v-else-if="item.type == 3 && item.timeType == 'hour'" |
|
|
|
v-model="item.value" |
|
|
|
type="datetimerange" |
|
|
|
range-separator="To" |
|
|
|
start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" |
|
|
|
value-format="x" |
|
|
|
/> |
|
|
|
<el-date-picker |
|
|
|
v-else-if="item.type == 3 && item.timeType == 'minute'" |
|
|
|
v-model="item.value" |
|
|
|
type="datetimerange" |
|
|
|
range-separator="To" |
|
|
|
start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" |
|
|
|
value-format="x" |
|
|
|
/> |
|
|
|
<el-date-picker |
|
|
|
v-else-if="item.type == 3 && item.timeType == 'second'" |
|
|
|
v-model="item.value" |
|
|
|
type="datetimerange" |
|
|
|
range-separator="To" |
|
|
|
start-placeholder="起始时间" |
|
|
|
end-placeholder="结束时间" |
|
|
|
value-format="x" |
|
|
|
/> |
|
|
|
<el-select |
|
|
|
v-else-if="item.options != null" |
|
|
|
v-model="item.value" |
|
|
|
clearable |
|
|
|
placeholder="请选择" |
|
|
|
> |
|
|
|
<el-option |
|
|
|
v-for="item in item.options" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-input v-else v-model="item.value" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item v-if="props.data.search.state"> |
|
|
|
<el-button v-if="searBut('search')" type="primary" @click="onSubmit" |
|
|
|
>查询</el-button |
|
|
|
> |
|
|
|
<el-button v-if="searBut('reset')" @click="resetForm(ruleFormRef)" |
|
|
|
>重置</el-button |
|
|
|
> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div class="targetBox"> |
|
|
|
<el-scrollbar height="340px"> |
|
|
|
<el-row style="width: 98%; margin-left: 1%" :gutter="10"> |
|
|
|
<el-col v-for="(item, index) in listAry" :span="8" :key="index"> |
|
|
|
<el-card shadow="always"> |
|
|
|
<div class="targetBody"> |
|
|
|
<div class="targetTitle">{{ item.title }}</div> |
|
|
|
<div v-for="itemSun in item.list" class="targetContent"> |
|
|
|
{{ itemSun.name }}:{{ itemSun.value }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-card> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-scrollbar> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<style lang="scss" scoped></style> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.barBox { |
|
|
|
height: 250px; |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
.spaceBox { |
|
|
|
margin-top: 15px; |
|
|
|
span { |
|
|
|
font-size: 20px; |
|
|
|
} |
|
|
|
} |
|
|
|
.demo-form-inline { |
|
|
|
padding: 10px 0 0px 0; |
|
|
|
} |
|
|
|
.demo-form-inline .el-input { |
|
|
|
--el-input-width: 200px; |
|
|
|
} |
|
|
|
|
|
|
|
.demo-form-inline .el-select { |
|
|
|
--el-select-width: 200px; |
|
|
|
} |
|
|
|
.targetBox { |
|
|
|
width: 100%; |
|
|
|
.targetCard { |
|
|
|
width: 25%; |
|
|
|
} |
|
|
|
|
|
|
|
:deep .el-col { |
|
|
|
margin-top: 10px; |
|
|
|
} |
|
|
|
:deep .el-card { |
|
|
|
min-height: 150px; |
|
|
|
} |
|
|
|
.targetBody { |
|
|
|
padding: 10px; |
|
|
|
.targetTitle { |
|
|
|
text-align: center; |
|
|
|
font-size: 16px; |
|
|
|
font-weight: bold; |
|
|
|
} |
|
|
|
.targetContent { |
|
|
|
text-align: left; |
|
|
|
font-size: 14px; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
|