Commit 082a85f4 authored by 张牧越's avatar 张牧越

接口对接

parent f3b2627f
NODE_ENV = "development"
Mock: true
VUE_APP_API_URL = "http://qjwl.ythplan.io/"
VUE_APP_RESOURCE_URL= "http://qjwl.ythplan.io/"
\ No newline at end of file
NODE_ENV = "production"
Mock: false
VUE_APP_API_URL = "http://qjwl.ythplan.io/"
VUE_APP_RESOURCE_URL= "http://qjwl.ythplan.io/"
\ No newline at end of file
File added
...@@ -5,15 +5,23 @@ ...@@ -5,15 +5,23 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
<title> <title>
绍兴二院兰亭院区(康复医院)工程 绍兴二院兰亭院区(康复医院)工程
</title> </title>
<style>
.el-icon-loading {
font-size: 40px !important;
}
.el-loading-text {
font-size: 24px !important;
}
</style>
</head> </head>
<body style="min-width: 1300px;"> <body style="min-width: 1300px;">
<noscript> <noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly wi thout JavaScript enabled.
Please enable it to continue.</strong> Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
......
...@@ -20,6 +20,9 @@ export default { ...@@ -20,6 +20,9 @@ export default {
}, },
}, },
mounted() { mounted() {
if (this.$route.query.token) {
localStorage.setItem("token", this.$route.query.token);
}
this.$nextTick(() => { this.$nextTick(() => {
this.bodyScale(); this.bodyScale();
}); });
......
...@@ -2,54 +2,71 @@ import request from "@/utils/request" ...@@ -2,54 +2,71 @@ import request from "@/utils/request"
export function getBaseData() { export function getBaseData() {
return request({ return request({
url: '/api/project/basedata', url: '/pweb/s/project/basedata',
method: 'get', method: 'get',
}) })
} }
export function getDeviceStatus() {
return request({
url: '/pweb/s/project/device/statis',
method: 'get',
})
}
export function getProgressDetail() {
return request({
url: '/pweb/s/project/progress',
method: 'get',
})
}
// real-name // real-name
export function getRealNameStatus() { export function getRealNameStatus() {
return request({ return request({
url: '/api/personel/basedata', url: '/pweb/s/personel/basedata',
method: 'get', method: 'get',
}) })
} }
export function getInOutData() { export function getInOutData() {
return request({ return request({
url: '/api/personel/latestweek/workinout', url: '/pweb/s/personel/latestweek/workinout',
method: 'get', method: 'get',
}) })
} }
export function getCurrentAttendance() { export function getCurrentAttendance() {
return request({ return request({
url: '/api/personel/attendance', url: '/pweb/s/personel/attendance',
method: 'get', method: 'get',
}) })
} }
export function getPersonAreaStatus() { export function getPersonAreaStatus() {
return request({ return request({
url: '/api/personel/area', url: '/pweb/s/personel/area',
method: 'get', method: 'get',
}) })
} }
export function getLastWeekAttendance() { export function getLastWeekAttendance() {
return request({ return request({
url: '/api/personel/latestweek/attendance', url: '/pweb/s/personel/latestweek/attendance',
method: 'get', method: 'get',
}) })
} }
export function getLastWeekWorkType() { export function getLastWeekWorkType() {
return request({ return request({
url: '/api/personel/latestweek/worktype/attendance', url: '/pweb/s/personel/latestweek/worktype/attendance',
method: 'get', method: 'get',
}) })
} }
export function getWorkTypeList() { export function getWorkTypeList() {
return request({ return request({
url: '/api/personel/worktype/statis', url: '/pweb/s/personel/worktype/statis',
method: 'get', method: 'get',
}) })
} }
...@@ -59,21 +76,40 @@ export function getWorkTypeList() { ...@@ -59,21 +76,40 @@ export function getWorkTypeList() {
// early-warning // early-warning
export function getAIdata() { export function getAIdata() {
return request({ return request({
url: '/api/aiwarning/basedata', url: '/pweb/s/aiwarning/basedata',
method: 'get', method: 'get',
}) })
} }
export function getWarningList() { export function getWarningList() {
return request({ return request({
url: '/api/aiwarning/list', url: '/pweb/s/aiwarning/list',
method: 'get', method: 'get',
}) })
} }
export function getMonthWarningStatis() { export function getMonthWarningStatis() {
return request({ return request({
url: '/api/aiwarning/month/statis', url: '/pweb/s/aiwarning/month/statis',
method: 'get',
})
}
//noise
export function getDeviceTotalStatus(params) {
return request({
url: '/pweb/s/device/basedata',
method: 'get',
params
})
}
export function getNoiseDeviceList(params) {
return request({
url: '/pweb/s/device/list',
method: 'get', method: 'get',
params
}) })
} }
\ No newline at end of file
...@@ -131,14 +131,14 @@ ...@@ -131,14 +131,14 @@
<img class="rt" src="@/assets/rt.png" alt="" /> <img class="rt" src="@/assets/rt.png" alt="" />
<img class="rb" src="@/assets/rb.png" alt="" /> <img class="rb" src="@/assets/rb.png" alt="" />
<img class="lb" src="@/assets/lb.png" alt="" /> <img class="lb" src="@/assets/lb.png" alt="" />
<img <el-carousel :interval="5000" arrow="always" height="48vh">
class="container-img" <el-carousel-item
:src=" v-for="(item, index) in screenDetail.plane_image_arr"
screenDetail.plane_image_arr[0] && :key="index"
screenDetail.plane_image_arr[0].url >
" <img class="container-img" :src="item.url" alt="" />
alt="" </el-carousel-item>
/> </el-carousel>
</div> </div>
</ShadowContainer> </ShadowContainer>
<Title text="工程进度" type="long"></Title> <Title text="工程进度" type="long"></Title>
...@@ -148,70 +148,31 @@ ...@@ -148,70 +148,31 @@
<img src="@/assets/progress.png" alt="" /> <img src="@/assets/progress.png" alt="" />
<div class="progress-container"> <div class="progress-container">
<div class="progress-day"> <div class="progress-day">
<div class="progress-count">342</div> <div class="progress-count">{{ progressDetail.zgq_num }}</div>
<div class="progress-text">总工期(天)</div> <div class="progress-text">总工期(天)</div>
</div> </div>
<div class="progress-day"> <div class="progress-day">
<div class="progress-count" style="color: #ffaf51">288</div> <div class="progress-count" style="color: #ffaf51">
{{ progressDetail.sg_num }}
</div>
<div class="progress-text">已施工(天)</div> <div class="progress-text">已施工(天)</div>
</div> </div>
</div> </div>
</div> </div>
<div class="steps"> <div class="steps">
<el-steps :active="active" finish-status="success"> <el-steps :active="progressDetail.step" finish-status="success">
<el-step> <el-step
<template #title> v-for="(progress, index) in progressDetail.progress_data"
<div class="step-title"> :key="index"
2022-02-19 >
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">开工</div>
</template>
</el-step>
<el-step>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">工程一</div>
</template>
</el-step>
<el-step>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">工程二</div>
</template>
</el-step>
<el-step>
<template #title>
<div class="step-title">
2022-02-19
<div class="step-status">已完成</div>
</div>
</template>
<template #description>
<div class="step-description">工程二</div>
</template>
</el-step>
<el-step>
<template #title> <template #title>
<div class="step-title"> <div class="step-title">
2022-02-19 {{ progress.over_date }}
<div class="step-status">进行中</div> <div class="step-status">{{ progress.status_text }}</div>
</div> </div>
</template> </template>
<template #description> <template #description>
<div class="step-description">工程二</div> <div class="step-description">{{ progress.name }}</div>
</template> </template>
</el-step> </el-step>
</el-steps> </el-steps>
...@@ -228,13 +189,13 @@ ...@@ -228,13 +189,13 @@
v-for="(status, index) in deviceStatus" v-for="(status, index) in deviceStatus"
:key="index" :key="index"
> >
<img class="status-img" :src="status.img" alt="" /> <img class="status-img" :src="status.icon_path" alt="" />
<div class="status-detail"> <div class="status-detail">
<div class="status-text"> <div class="status-text">
{{ status.text }} {{ status.name }}
</div> </div>
<div class="status-number"> <div class="status-number">
{{ status.counts }} {{ status.total }}
<span></span> <span></span>
</div> </div>
</div> </div>
...@@ -252,7 +213,7 @@ ...@@ -252,7 +213,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getBaseData } from "@/api/index"; import { getBaseData, getDeviceStatus, getProgressDetail } from "@/api/index";
export default { export default {
name: "Construction", name: "Construction",
data() { data() {
...@@ -342,6 +303,12 @@ export default { ...@@ -342,6 +303,12 @@ export default {
manageList: [], manageList: [],
plane_image_arr: [], plane_image_arr: [],
}, },
progressDetail: {
progress_data: [],
sg_num: 0,
zgq_num: 0,
step: 0,
},
}; };
}, },
methods: { methods: {
...@@ -511,11 +478,24 @@ export default { ...@@ -511,11 +478,24 @@ export default {
}, },
getBaseData() { getBaseData() {
getBaseData().then((res) => { getBaseData().then((res) => {
console.log(res);
if (res.status == 200) { if (res.status == 200) {
this.screenDetail = res.data; this.screenDetail = res.data;
} }
}); });
getDeviceStatus().then((res) => {
if (res.status == 200) {
this.deviceStatus = res.data.map((item) => {
return {
...item,
icon_path:
process.env.VUE_APP_RESOURCE_URL + "/" + item.icon_path,
};
});
}
});
getProgressDetail().then((res) => {
this.progressDetail = res.data;
});
}, },
}, },
mounted() { mounted() {
...@@ -737,7 +717,7 @@ export default { ...@@ -737,7 +717,7 @@ export default {
position: relative; position: relative;
.container-img { .container-img {
width: 100%; width: 100%;
height: 46vh; height: 48vh;
vertical-align: top; vertical-align: top;
} }
.lt, .lt,
......
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
:key="index" :key="index"
> >
<img src="@/assets/noise/icon_e_qi@2x.png" alt="" /> <img src="@/assets/noise/icon_e_qi@2x.png" alt="" />
{{ monitor.text }} {{ monitor.device_name }}
</div> </div>
</div> </div>
</ShadowContainer> </ShadowContainer>
...@@ -188,14 +188,12 @@ ...@@ -188,14 +188,12 @@
</div> </div>
</template> </template>
<script> <script>
import { getDeviceTotalStatus, getNoiseDeviceList } from "@/api/index";
export default { export default {
name: "Noise", name: "Noise",
data() { data() {
return { return {
pieChartData: [ pieChartData: {},
{ value: 4, name: "在线总数" },
{ value: 2, name: "离线总数" },
],
noiseData: [ noiseData: [
{ value: 4, name: "达标" }, { value: 4, name: "达标" },
{ value: 3, name: "超标" }, { value: 3, name: "超标" },
...@@ -234,18 +232,7 @@ export default { ...@@ -234,18 +232,7 @@ export default {
{ text: "报警标题:报警内容123123123", time: "2023-02-12 09:12" }, { text: "报警标题:报警内容123123123", time: "2023-02-12 09:12" },
{ text: "报警标题:报警内容123123123", time: "2023-02-12 09:12" }, { text: "报警标题:报警内容123123123", time: "2023-02-12 09:12" },
], ],
noiseMonitors: [ noiseMonitors: [],
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
{ text: "料仓扬尘监测" },
],
classOption: { classOption: {
singleHeight: 36, singleHeight: 36,
}, },
...@@ -253,12 +240,21 @@ export default { ...@@ -253,12 +240,21 @@ export default {
}, },
methods: { methods: {
renderDeviceChart() { renderDeviceChart() {
const pieData = [
{ value: this.pieChartData.zxCount, name: "在线设备数量" },
{ value: this.pieChartData.lxCount, name: "离线设备数量" },
{ value: this.pieChartData.bjCount, name: "报警设备数量" },
];
const chart = this.$echarts.init(this.$refs.deviceChart); const chart = this.$echarts.init(this.$refs.deviceChart);
let total = 0;
pieData.map((item) => {
total += item.value;
});
const option = { const option = {
title: { title: {
x: "27%", //X坐标 x: "27%", //X坐标
y: "35%", y: "35%",
text: "6", text: total,
subtext: "总数", subtext: "总数",
textAlign: "center", textAlign: "center",
textStyle: { textStyle: {
...@@ -282,9 +278,9 @@ export default { ...@@ -282,9 +278,9 @@ export default {
itemWidth: 12, itemWidth: 12,
icon: "rect", icon: "rect",
right: "10%", right: "10%",
top: "30%", top: "20%",
orient: "vertical", orient: "vertical",
itemGap: 40, itemGap: 20,
textStyle: { textStyle: {
color: "inherit", color: "inherit",
rich: { rich: {
...@@ -300,7 +296,7 @@ export default { ...@@ -300,7 +296,7 @@ export default {
}, },
}, },
formatter: (name) => { formatter: (name) => {
let data = this.pieChartData; let data = pieData;
let target; let target;
for (let i = 0, l = data.length; i < l; i++) { for (let i = 0, l = data.length; i < l; i++) {
if (data[i].name == name) { if (data[i].name == name) {
...@@ -326,11 +322,20 @@ export default { ...@@ -326,11 +322,20 @@ export default {
position: "center", position: "center",
}, },
data: this.pieChartData, data: pieData,
}, },
], ],
}; };
chart.setOption(option); chart.setOption(option);
this.$nextTick(() => {
// 解决echarts图表放大溢出父容器
const resizeOb = new ResizeObserver((entries) => {
for (const entry of entries) {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("device-chart"));
});
}, },
renderNoiseChart() { renderNoiseChart() {
const chart = this.$echarts.init(this.$refs.noiseChart); const chart = this.$echarts.init(this.$refs.noiseChart);
...@@ -546,9 +551,18 @@ export default { ...@@ -546,9 +551,18 @@ export default {
}; };
chart.setOption(option); chart.setOption(option);
}, },
getNoiseData() {
getDeviceTotalStatus({ top_cat: 9 }).then((res) => {
this.pieChartData = res.data;
this.renderDeviceChart();
});
getNoiseDeviceList({ top_cat: 9 }).then((res) => {
this.noiseMonitors = res.data;
});
},
}, },
mounted() { mounted() {
this.renderDeviceChart(); this.getNoiseData();
this.renderNoiseChart(); this.renderNoiseChart();
this.renderAQIChart(); this.renderAQIChart();
this.renderAqiQualityChart(); this.renderAqiQualityChart();
...@@ -559,7 +573,6 @@ export default { ...@@ -559,7 +573,6 @@ export default {
this.$echarts.getInstanceByDom(entry.target).resize(); this.$echarts.getInstanceByDom(entry.target).resize();
} }
}); });
resizeOb.observe(document.getElementById("device-chart"));
resizeOb.observe(document.getElementById("noise-chart")); resizeOb.observe(document.getElementById("noise-chart"));
resizeOb.observe(document.getElementById("aqi-chart")); resizeOb.observe(document.getElementById("aqi-chart"));
resizeOb.observe(document.getElementById("aqi-quality-chart")); resizeOb.observe(document.getElementById("aqi-quality-chart"));
......
...@@ -126,26 +126,32 @@ ...@@ -126,26 +126,32 @@
</div> </div>
</template> </template>
<script> <script>
import { getDeviceTotalStatus } from "@/api/index";
export default { export default {
name: "Tower", name: "Tower",
data() { data() {
return { return {
pieChartData: [ pieChartData: {},
{ value: 4, name: "在线总数" },
{ value: 3, name: "报警总数" },
{ value: 2, name: "离线总数" },
],
active: 3, active: 3,
}; };
}, },
methods: { methods: {
renderDeviceChart() { renderDeviceChart() {
const pieData = [
{ value: this.pieChartData.zxCount, name: "在线设备数量" },
{ value: this.pieChartData.lxCount, name: "离线设备数量" },
{ value: this.pieChartData.bjCount, name: "报警设备数量" },
];
const chart = this.$echarts.init(this.$refs.deviceChart); const chart = this.$echarts.init(this.$refs.deviceChart);
let total = 0;
pieData.map((item) => {
total += item.value;
});
const option = { const option = {
title: { title: {
x: "27%", //X坐标 x: "27%", //X坐标
y: "35%", y: "35%",
text: "9", text: total,
subtext: "总数", subtext: "总数",
textAlign: "center", textAlign: "center",
textStyle: { textStyle: {
...@@ -187,7 +193,7 @@ export default { ...@@ -187,7 +193,7 @@ export default {
}, },
}, },
formatter: (name) => { formatter: (name) => {
let data = this.pieChartData; let data = pieData;
let target; let target;
for (let i = 0, l = data.length; i < l; i++) { for (let i = 0, l = data.length; i < l; i++) {
if (data[i].name == name) { if (data[i].name == name) {
...@@ -212,12 +218,20 @@ export default { ...@@ -212,12 +218,20 @@ export default {
show: false, show: false,
position: "center", position: "center",
}, },
data: pieData,
data: this.pieChartData,
}, },
], ],
}; };
chart.setOption(option); chart.setOption(option);
this.$nextTick(() => {
// 解决echarts图表放大溢出父容器
const resizeOb = new ResizeObserver((entries) => {
for (const entry of entries) {
this.$echarts.getInstanceByDom(entry.target).resize();
}
});
resizeOb.observe(document.getElementById("device-chart"));
});
}, },
renderForceChart() { renderForceChart() {
const chart = this.$echarts.init(this.$refs.forceChart); const chart = this.$echarts.init(this.$refs.forceChart);
...@@ -383,9 +397,15 @@ export default { ...@@ -383,9 +397,15 @@ export default {
}; };
chart.setOption(option); chart.setOption(option);
}, },
getTowerData() {
getDeviceTotalStatus({ top_cat: 1, child_cat: 1 }).then((res) => {
this.pieChartData = res.data;
this.renderDeviceChart();
});
},
}, },
mounted() { mounted() {
this.renderDeviceChart(); this.getTowerData();
this.renderForceChart(); this.renderForceChart();
this.renderDipChart(); this.renderDipChart();
this.$nextTick(() => { this.$nextTick(() => {
......
import axios from 'axios' import axios from 'axios'
import Vue from 'vue'
import { Message, Loading } from 'element-ui';
import _ from 'lodash';
// loading框设置局部刷新,且所有请求完成后关闭loading框
let loadingInstance; //loading 实例
let needLoadingRequestCount = 0; //当前正在请求的数量
function showLoading() {
let main = document.querySelector('#app') //获取dom节点
if (main) {
if (needLoadingRequestCount === 0 && !loadingInstance) {
loadingInstance = Loading.service({
target: main, text: '正在加载...', background: 'rgba(0,0,0,0.6)', spinner: 'el-icon-loading'
});
}
needLoadingRequestCount++;
}
}
function closeLoading() {
Vue.nextTick(() => { // 以服务的方式调用的 Loading 需要异步关闭
needLoadingRequestCount--;
needLoadingRequestCount = Math.max(needLoadingRequestCount, 0); // 保证大于等于0
if (needLoadingRequestCount === 0) {
if (loadingInstance) {
hideLoading()
}
}
});
}
//防抖
var hideLoading = _.debounce(() => {
loadingInstance.close();
loadingInstance = null;
}, 10);
const request = axios.create({ const request = axios.create({
withCredentials: false withCredentials: false,
baseURL: process.env.VUE_APP_BASE_API,
}) })
request.interceptors.request.use( request.interceptors.request.use(
config => { config => {
const token = localStorage.getItem('token') const token = localStorage.getItem('token')
if (token) { if (token) {
config.headers['X-Access-Token'] = token config.headers['token'] = token
} }
showLoading()
return config return config
}, },
error => { error => {
console.log('error', error) closeLoading()
return Promise.reject(new Error(error).message) return Promise.reject(new Error(error).message)
} }
) )
request.interceptors.response.use( request.interceptors.response.use(
response => { response => {
console.log('.....', response) closeLoading()
if (response.data.status != 200) {
Message({
message: response.data.msg,
type: 'error'
})
}
if (response.data.status == 401) {
window.location.href = process.env.VUE_APP_RESOURCE_URL + 'pweb/m/login'
}
return response.data return response.data
}, },
error => { error => {
console.log('error', error) console.log(error)
closeLoading()
return Promise.reject(new Error(error).message) return Promise.reject(new Error(error).message)
} }
) )
......
...@@ -22,13 +22,10 @@ module.exports = defineConfig({ ...@@ -22,13 +22,10 @@ module.exports = defineConfig({
devServer: { devServer: {
port: 3000, port: 3000,
proxy: { proxy: {
'/api': { '^/pweb/s/': {
target: 'http://zezcje.natappfree.cc/pweb/s', target: process.env.VUE_APP_API_URL,
ws: false, ws: false,
changeOrigin: true, changeOrigin: true,
pathRewrite: {
'/api': ''
}
}, },
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment