1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <div class="pageBox">
- <simple-line-chart :height="'100px'" v-for="(item, index) in chartData" :key="index" :title="item.title" :data="item.data" :color="item.color" :lineTitle="item.lineTitle" />
- </div>
- </template>
- <script>
- import SimpleLineChart from "../../components/chart/line/simple-line-chart.vue";
- export default {
- setup() {},
- components: { SimpleLineChart },
- data() {
- return {
- chartData:[]
- };
- },
- created() {
- this.wtId = this.$route.params.wtId;
- this.requestData();
- },
-
- methods:{
- requestData(){
- let that=this;
- that.API.requestData({
- method: "POST",
- subUrl: "healthsub/hsFjValueIndex",
- data:{
- wtId: that.wtId
- },
- success(res) {
- const color=["green","yellow","purple","blue","orange"];
- let chartData=[];
- let lineTitle=[];
- res.data.xData.forEach(ele=>{
- lineTitle.push(new Date(ele).formatDate("hh:mm"));
- });
- res.data.datasets.forEach((ele,index)=>{
- chartData.push({
- title:ele.name,
- data:ele.data,
- color:color[index],
- lineTitle
- });
- });
- that.chartData=chartData;
- },
- });}
- }
- };
- </script>
- <style lang="less" scoped>
- .pageBox {
- width: 100%;
- height:calc(100% - 1.481vh * 2);
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- margin:1.481vh 0;
- .chart{
- width: 100%;
- height:25%;
- }
- }
- </style>
|