|
|
|
@ -3,6 +3,110 @@ |
|
|
|
@ 时间: 2025-06-26 15:20:37 |
|
|
|
@ 备注: 柱状图 |
|
|
|
--> |
|
|
|
|
|
|
|
<template> |
|
|
|
<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 ref="propsUuid" class="barBox" :id="props.uuid"></div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { analyzeChartData } from "@/api/chart/index"; |
|
|
|
import { echatsViews } from "@/api/DesignForm/types"; |
|
|
|
@ -29,7 +133,8 @@ const props = withDefaults( |
|
|
|
}, |
|
|
|
} |
|
|
|
); |
|
|
|
var myChart = ref<any>(); |
|
|
|
const myChart = ref<any>(); |
|
|
|
const propsUuid = ref(null) |
|
|
|
const seriesAnlay = (listVal: any[]) => { |
|
|
|
if (listVal && Array.isArray(listVal)) { |
|
|
|
listVal.forEach((item: any) => { |
|
|
|
@ -47,8 +152,9 @@ const seriesAnlay = (listVal: any[]) => { |
|
|
|
@ 功能: 画图 |
|
|
|
*/ |
|
|
|
const drawPictures = () => { |
|
|
|
|
|
|
|
if (props.uuid && props.uuid != "") { |
|
|
|
myChart.value = echarts.init(document.getElementById(props.uuid) as HTMLDivElement); |
|
|
|
|
|
|
|
analyzeChartData({ |
|
|
|
tableKey: props.tableKey, |
|
|
|
chartId: props.uuid, |
|
|
|
@ -156,28 +262,58 @@ const drawPictures = () => { |
|
|
|
// }); |
|
|
|
console.log("画图完毕---->", props); |
|
|
|
// myChart.value.resize(); |
|
|
|
} |
|
|
|
}else { |
|
|
|
myChart.value.setOption({ |
|
|
|
grid: { |
|
|
|
left: "2%", |
|
|
|
right: "2%", |
|
|
|
bottom: "15%", |
|
|
|
top: "15%", |
|
|
|
containLabel: true, |
|
|
|
}, |
|
|
|
xAxis: { |
|
|
|
data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], |
|
|
|
}, |
|
|
|
yAxis: {}, |
|
|
|
legend: { |
|
|
|
data: ["销量", "销量科技"], |
|
|
|
}, |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
name: "销量", |
|
|
|
type: "bar", |
|
|
|
data: [5, 20, 36, 10, 10, 20], |
|
|
|
}, |
|
|
|
{ |
|
|
|
name: "销量科技", |
|
|
|
type: "bar", |
|
|
|
data: [15, 21, 26, 70, 18, 29], |
|
|
|
}, |
|
|
|
], |
|
|
|
}); |
|
|
|
// myChart.value.resize(); |
|
|
|
} |
|
|
|
}; |
|
|
|
//获取当前激活的项目 |
|
|
|
const controlData = computed(() => { |
|
|
|
return store.controlAttr; |
|
|
|
}); |
|
|
|
watch( |
|
|
|
() => props.kuandu, |
|
|
|
(val: any) => { |
|
|
|
console.log("画图完毕--改变-->", val); |
|
|
|
drawPictures(); |
|
|
|
}, |
|
|
|
{ deep: true } |
|
|
|
); |
|
|
|
watch( |
|
|
|
() => props.data, |
|
|
|
(val: any) => { |
|
|
|
console.log("画图完毕--改变-->", val); |
|
|
|
drawPictures(); |
|
|
|
}, |
|
|
|
{ deep: true } |
|
|
|
); |
|
|
|
// watch( |
|
|
|
// () => props.kuandu, |
|
|
|
// (val: any) => { |
|
|
|
// console.log("画图完毕--改变-->", val); |
|
|
|
// drawPictures(); |
|
|
|
// }, |
|
|
|
// { deep: true } |
|
|
|
// ); |
|
|
|
// watch( |
|
|
|
// () => props.data, |
|
|
|
// (val: any) => { |
|
|
|
// console.log("画图完毕--改变-->", val); |
|
|
|
// drawPictures(); |
|
|
|
// }, |
|
|
|
// { deep: true } |
|
|
|
// ); |
|
|
|
/** |
|
|
|
@ 作者: 秦东 |
|
|
|
@ 时间: 2025-06-26 09:47:45 |
|
|
|
@ -196,114 +332,33 @@ const onSubmit = () => { |
|
|
|
drawPictures(); |
|
|
|
}; |
|
|
|
onMounted(() => { |
|
|
|
nextTick(() => { |
|
|
|
if(propsUuid.value){ |
|
|
|
myChart.value = echarts.init(propsUuid.value); |
|
|
|
myChart.value.setOption({ |
|
|
|
grid: { |
|
|
|
left: "2%", |
|
|
|
right: "2%", |
|
|
|
bottom: "15%", |
|
|
|
top: "15%", |
|
|
|
containLabel: true, |
|
|
|
}, |
|
|
|
xAxis: { |
|
|
|
data: [], |
|
|
|
}, |
|
|
|
yAxis: {}, |
|
|
|
series: [ |
|
|
|
], |
|
|
|
}); |
|
|
|
drawPictures(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
onUnmounted(() => { |
|
|
|
if (myChart.value !== null && myChart.value !== undefined) { |
|
|
|
myChart.value.dispose(); // 销毁实例,释放资源 |
|
|
|
} |
|
|
|
}) |
|
|
|
</script> |
|
|
|
<template> |
|
|
|
<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="barBox" :id="props.uuid"></div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.barBox { |
|
|
|
height: 250px; |
|
|
|
|