Browse Source

11/21/17:00 民意感知1.1

main
parent
commit
cefa03c91d
  1. 114
      src/api/outrequest.ts
  2. 2
      src/api/request.ts
  3. 99
      src/api/screen/jwpy.ts
  4. 194
      src/views/datav/Gobal.vue
  5. 1442
      src/views/datav/Jwpy.vue
  6. 8
      vite.config.ts

114
src/api/outrequest.ts

@ -0,0 +1,114 @@
import { getToken, deleteToken } from '@/utils/token'
import feedback from '@/utils/feedback'
export const BASE_PATH = ''
type Options = {
url: string,
method?: 'GET' | 'POST' | 'PUT' | 'DELETE',
headers?: Record<string, string>,
query?: Record<string, any>,
params?: Record<string, any>,
body?: string | FormData | Record<string, any>,
showErrorMsg: bool
};
function get(options: Options) {
options.method = 'GET';
return ajax(options.url, options)
}
function post(options: Options) {
options.method = 'POST';
return ajax(options.url, options)
}
function put(options: Options) {
options.method = 'PUT';
return ajax(options.url, options)
}
function del(options: Options) {
options.method = 'DELETE';
return ajax(options.url, options)
}
let isRelogin = false;
function ajax(url: string, options: Options) {
const headers: Record<string, string> = {
"Authorization": getToken()
};
let body: string | FormData;
if (options?.params && Object.keys(options.params).length > 0) {
if (options.method === 'GET') {
options.query = options.params;
} else {
body = JSON.stringify(options.params);
}
}
if (options?.query) {
// 解决 query 的值为 undefined 的情况
if (options.query instanceof Object) {
const params = {}
for (let k of Object.keys(options.query)) {
if (options.query[k] === undefined || options.query[k] === null) {
continue;
}
params[k] = options.query[k]
}
url += (url.indexOf('?') > -1 ? '&' : '?') + new URLSearchParams(params).toString();
} else {
url += (url.indexOf('?') > -1 ? '&' : '?') + new URLSearchParams(options.query).toString();
}
}
if (options?.body) {
if (options.body instanceof FormData) {
body = options.body;
} else {
headers["Content-Type"] = "application/json"
if (options.body instanceof String) {
body = options.body;
}
if (options.body instanceof Array || (options.body instanceof Object && Object.keys(options.body).length > 0)) {
body = JSON.stringify(options.body);
}
}
}
return new Promise((resolve, reject) => {
fetch(`${BASE_PATH}${url}`, {
method: options.method,
body: body,
headers: { ...headers, ...options.headers }
}).then(response => {
if (response.status === 413) {
return;
}
return response.json();
}).then(res => {
if (res.code === 200 || res.httpStatusCode===0) {
resolve(res.data)
} else {
let message = res.message;
if (res.code === 401) {
deleteToken()
location.href = '/'
}
feedback.msgError(message)
reject(res)
}
})
})
}
const outrequest = {
get,
post,
put,
del
}
export default outrequest;

2
src/api/request.ts

@ -88,7 +88,7 @@ function ajax(url: string, options: Options) {
}
return response.json();
}).then(res => {
if (res.code === 200) {
if (res.code === 200 || res.httpStatusCode===0) {
resolve(res.data)
} else {
let message = res.message;

99
src/api/screen/jwpy.ts

@ -0,0 +1,99 @@
import outrequest from "../outrequest";
export function GetDCQK() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetDCQK`,
body: formData
});
}
export function GetBMYYBQS() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetBMYYBQS`,
body: formData
});
}
export function GetZHMYLPM() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetZHMYLPM`,
body: formData
});
}
export function GetRCSQQK() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetRCSQQK`,
body: formData
});
}
export function GetDXFX() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetDXFX`,
body: formData
});
}
export function GetZRSJXF() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetZRSJXF`,
body: formData
});
}
export function GetGLFW() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetGLFW`,
body: formData
});
}
export function GetDITU() {
let formData = new FormData();
formData.append("PeriodId", 6);
formData.append("PeriodSonID", -1);
formData.append("OrgNo", 4301);
formData.append("TaskID", 2);
return outrequest.post({
url: `/out-police-service/api/DSJ/GetDITU`,
body: formData
});
}

194
src/views/datav/Gobal.vue

@ -155,7 +155,7 @@ const ywzblist = ref([]); // 业务类型占比
const wtlxlist = ref([]); //
const tcwtlist = ref([]); //
const mapData = ref([]); //
let gobalTempMapVoList = [
let gobalTempMapVoList = ref([
{
"name": "天心分局",
"totalPro": 11,
@ -165,106 +165,11 @@ let gobalTempMapVoList = [
"policePro": 11,
"reviewPro": 11
}
]; //
]); //
// endregion
const router = useRouter();
// region
echarts.registerMap("changsha", changshaMap);
const option = ref({
geo: {
map: "changsha",
},
tooltip: {
trigger: 'item',
formatter: function (params) {
console.log(params)
const dataItem = gobalTempMapVoList.find(item => item.name.includes(params.name.substring(0, 2)));
if (dataItem) {
return `
<div class="tooltip">
<div class="tooltip-title">${dataItem.name}</div>
<div class="tooltip-content">
<ul class="tooltip-ul" >
<li>问题总数 <span>${dataItem.totalPro}</span></li>
<li>督察问题 <span>${dataItem.supervisePro}</span></li>
<li>案件核查问题 <span>${dataItem.caseVerifyPro}</span></li>
<li>信访投诉问题 <span>${dataItem.mailPro}</span></li>
<li>民意感知问题 <span>${dataItem.policePro}</span></li>
</ul>
</div>
</div>`;
} else {
return `<div class="tooltip">
<div class="tooltip-title">${dataItem.name}</div>
<div class="tooltip-content">
<ul class="tooltip-ul"">
<li>问题总数 <span>0</span></li>
<li>督察问题 <span>0</span></li>
<li>案件核查问题 <span>0</span></li>
<li>信访投诉问题 <span>0</span></li>
<li>民意感知问题 <span>0</span></li>
</ul>
</div>
</div>`;
}
},
// backgroundColor: "#031577", //
// borderColor: "#0A2F86",
// borderWidth: 0, // 1
// borderRadius: 3, // 3
// shadowBlur: 0, // 8
// shadowOffsetX: 0, // 0
// shadowOffsetY: 0, // 6
},
visualMap: {
type: "piecewise",
bottom: 10,
pieces: [
{ min: 0, max: 500, label: "问题数低于500" }, { min: 501, max: 1000, label: "问题数介于500-1000" }, { min: 1001, label: "问题数高于1000" },
],
right: 10,
realtime: false,
orient: "horizontal",
textStyle: {
color: "#fff",
},
calculable: true,
inRange: {
color: ["#4987F6", "#F6A149", "#D34343",],
},
},
series: [
{
name: "长沙",
type: "map",
map: "changsha",
hoverAnimation: true,
label: {
show: true,
color: "white",
},
itemStyle: {
normal: {
areaColor: "#02215E",
borderColor: "#1773c3",
},
},
emphasis: {
areaColor: "#FFD700", //
borderColor: "#FF0000", //
borderWidth: 4 //
},
data: gobalTempMapVoList.map(item => ({
name: item.name,
value: item.totalPro // totalPro value
}))
}
],
})
// endregion
// region线
@ -410,7 +315,7 @@ function getData() {
});
getAllGobalCount(time.value).then((res) => {
overview.value = res.overview;
gobalTempMapVoList = res.gobalTempMapVoList;
gobalTempMapVoList.value = res.gobalTempMapVoList;
});
getGobalRecentlyTrendByMonth(new Date().getFullYear()).then((res) => {
proTrend.value.xAxis.data = res.monthList;
@ -430,6 +335,7 @@ onMounted(() => {
watch(time, () => {
getData();
});
// endregion
const colors = [
{
@ -447,6 +353,98 @@ const colors = [
];
// region
echarts.registerMap("changsha", changshaMap);
const option = ref({
geo: {
map: "changsha",
},
tooltip: {
trigger: 'item',
formatter: function (params) {
// console.log(gobalTempMapVoList.value)
const dataItem = gobalTempMapVoList.value.find(item => item.name.includes(params.name.substring(0, 2)));
// console.log(dataItem.name)
if (dataItem) {
return `
<div class="tooltip">
<div class="tooltip-title">${dataItem.name}</div>
<div class="tooltip-content">
<ul class="tooltip-ul" >
<li>问题总数 <span>${dataItem.totalPro}</span></li>
<li>督察问题 <span>${dataItem.supervisePro}</span></li>
<li>案件核查问题 <span>${dataItem.caseVerifyPro}</span></li>
<li>信访投诉问题 <span>${dataItem.mailPro}</span></li>
<li>民意感知问题 <span>${dataItem.policePro}</span></li>
</ul>
</div>
</div>`;
} else {
return `<div class="tooltip">
<div class="tooltip-title">${dataItem.name}</div>
<div class="tooltip-content">
<ul class="tooltip-ul"">
<li>问题总数 <span>0</span></li>
<li>督察问题 <span>0</span></li>
<li>案件核查问题 <span>0</span></li>
<li>信访投诉问题 <span>0</span></li>
<li>民意感知问题 <span>0</span></li>
</ul>
</div>
</div>`;
}
},
},
visualMap: {
type: "piecewise",
bottom: 10,
pieces: [
{ min: 0, max: 500, label: "问题数低于500", color:"#F6A149" },
{ min: 501, max: 1000, label: "问题数介于500-1000", color:"#F6A149"},
{ min: 1001, label: "问题数高于1000" , color:"#D34343"},
],
right: 10,
realtime: false,
orient: "horizontal",
textStyle: {
color: "#fff",
},
calculable: true,
},
series: [
{
name: "长沙",
type: "map",
map: "changsha",
hoverAnimation: true,
label: {
show: true,
color: "white",
},
itemStyle: {
normal: {
areaColor: "#02215E",
borderColor: "#1773c3",
},
},
emphasis: {
areaColor: "#FFD700", //
borderColor: "#FF0000", //
borderWidth: 4 //
},
data: gobalTempMapVoList.value.map(item => {
const data = {
name: item.name,
value: item.totalPro,
};
console.log(item.totalPro); //
return data;
})
}
],
})
// endregion

1442
src/views/datav/Jwpy.vue

File diff suppressed because it is too large Load Diff

8
vite.config.ts

@ -28,7 +28,13 @@ export default ({ mode }) => {
target: 'http://127.0.0.1:8080/',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/api\/v2/, '')
}
},
'/out-police-service/': {
target: 'http://127.0.0.1:8080/',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/out-polic-service/, '')
},
}
},
plugins: [

Loading…
Cancel
Save