lcw
This commit is contained in:
20939
package-lock.json
generated
20939
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -133,3 +133,69 @@ export const fxgbCzlfx = (params) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 分析报告-地域维度统计
|
||||||
|
export const jqypDywdtj = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/jjdbYp/fxbgDywdtj",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 分析报告 - 警情类型统计
|
||||||
|
export const jqypfxbgJqlxtj = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/lzJcjPjdb/fxbgJqlxtj",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 警情来源统计
|
||||||
|
|
||||||
|
export const jqypfxbgJqlytj = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/jjdbYp/fxbgJqlytj",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 分析报告
|
||||||
|
export const jqypfxbgTj = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/jjdbYp/fxbgTj",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 分析报告-时间维度-月分析
|
||||||
|
export const jqypfxbgYdfx = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/jjdbYp/fxbgYdfx",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 分析报告-时间维度-24小时分析
|
||||||
|
export const jqypfxbgXsfx = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/jjdbYp/fxbgXsfx",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 分析报告 - 处理结果分析
|
||||||
|
export const jqypfxbgCljgf = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/jjdbYp/fxgbCljgfx",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 分析报告-处置率分析
|
||||||
|
export const jqypfxbgCzlfx = (params) => {
|
||||||
|
return request({
|
||||||
|
url: api + "/jjdbYp/fxgbCzlfx",
|
||||||
|
method: "GET",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -111,4 +111,4 @@ onBeforeUnmount(() => {
|
|||||||
border: 1px dashed #e9e9e9;
|
border: 1px dashed #e9e9e9;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -126,8 +126,6 @@
|
|||||||
import PageTitle from "@/components/aboutTable/PageTitle.vue";
|
import PageTitle from "@/components/aboutTable/PageTitle.vue";
|
||||||
// import { useExportToPDF } from './components/a.js';
|
// import { useExportToPDF } from './components/a.js';
|
||||||
import Search from "@/components/aboutTable/Search.vue";
|
import Search from "@/components/aboutTable/Search.vue";
|
||||||
import html2canvas from 'html2canvas';
|
|
||||||
import jsPDF from 'jspdf';
|
|
||||||
|
|
||||||
import MaleNightingalePicture from './components/maleNightingalePicture.vue'
|
import MaleNightingalePicture from './components/maleNightingalePicture.vue'
|
||||||
import Histogram from './components/histogram.vue'
|
import Histogram from './components/histogram.vue'
|
||||||
@ -207,17 +205,14 @@ const sortingRatio = (data) => {
|
|||||||
// 提取所有number值
|
// 提取所有number值
|
||||||
// 计算总数
|
// 计算总数
|
||||||
const total = data.reduce((sum, item) => sum + item.number, 0);
|
const total = data.reduce((sum, item) => sum + item.number, 0);
|
||||||
|
|
||||||
// 找出第一大和第二大的值及其对应的name
|
// 找出第一大和第二大的值及其对应的name
|
||||||
const sortedData = [...data].sort((a, b) => b.number - a.number);
|
const sortedData = [...data].sort((a, b) => b.number - a.number);
|
||||||
|
|
||||||
const dataValue = sortedData.map(item => {
|
const dataValue = sortedData.map(item => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
ratio: total > 0 ? (item.number / total * 100).toFixed(2) + '%' : '0%',
|
ratio: total > 0 ? (item.number / total * 100).toFixed(2) + '%' : '0%',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return dataValue
|
return dataValue
|
||||||
}
|
}
|
||||||
// 地域统计
|
// 地域统计
|
||||||
|
@ -173,7 +173,7 @@ const tabHeightFn = () => {
|
|||||||
pageData.boxHeight = window.innerHeight - searchBox.value.offsetHeight - 250
|
pageData.boxHeight = window.innerHeight - searchBox.value.offsetHeight - 250
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
pageData.tableHeight = listBoxRef.value[0].offsetHeight - 40;
|
pageData.tableHeight = listBoxRef.value[0].offsetHeight - 40;
|
||||||
});
|
});
|
||||||
window.onresize = function () {
|
window.onresize = function () {
|
||||||
tabHeightFn();
|
tabHeightFn();
|
||||||
};
|
};
|
||||||
@ -317,12 +317,12 @@ watch(()=>D_BZ_SSZT.value, (val) => {
|
|||||||
border-radius: 4px 4px 4px 4px;
|
border-radius: 4px 4px 4px 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.echartsBox{
|
.echartsBox{
|
||||||
height: calc(100% - 30px);
|
height: calc(100% - 30px);
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.listBox{
|
.listBox{
|
||||||
@ -390,4 +390,19 @@ watch(()=>D_BZ_SSZT.value, (val) => {
|
|||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// .bts >>>p{
|
||||||
|
// font-size: 16px; font-family: 黑体;
|
||||||
|
// color: rgb(255, 0, 140);
|
||||||
|
// }
|
||||||
|
// .psj >>>p{
|
||||||
|
// text-indent: 2em;
|
||||||
|
// }
|
||||||
|
// .minbt >>>p{
|
||||||
|
// font-size: 16px; font-family: 楷体;
|
||||||
|
// }
|
||||||
|
// .nr >>>p{
|
||||||
|
// font-size: 16px; font-family: 仿宋;
|
||||||
|
// }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -108,15 +108,14 @@ const changeSize = (val) => {
|
|||||||
|
|
||||||
const getList = () =>{
|
const getList = () =>{
|
||||||
let params = {
|
let params = {
|
||||||
id:item.value.id,
|
ypid:item.value.id,
|
||||||
sjLx:sjlx.value,
|
// sjLx:sjlx.value,
|
||||||
pageCurrent:pageData.pageConfiger.pageCurrent,
|
pageCurrent:pageData.pageConfiger.pageCurrent,
|
||||||
pageSize:pageData.pageConfiger.pageSize,
|
pageSize:pageData.pageConfiger.pageSize,
|
||||||
}
|
}
|
||||||
pageData.tableConfiger.loading = true;
|
pageData.tableConfiger.loading = true;
|
||||||
qcckPost(params,'/mosty-gsxt/tsyp/getRyPage').then(res=>{
|
qcckPost(params,'/jjdbYp/getPageList').then(res=>{
|
||||||
pageData.tableConfiger.loading = false;
|
pageData.tableConfiger.loading = false;
|
||||||
console.log(res,'===');
|
|
||||||
pageData.tableData = res.records || []
|
pageData.tableData = res.records || []
|
||||||
pageData.total = res.total;
|
pageData.total = res.total;
|
||||||
}).catch(()=>{
|
}).catch(()=>{
|
||||||
|
@ -53,6 +53,7 @@ import Search from "@/components/aboutTable/Search.vue";
|
|||||||
import { qcckPost } from "@/api/qcckApi.js";
|
import { qcckPost } from "@/api/qcckApi.js";
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { reactive, ref, onMounted, getCurrentInstance, watch, nextTick } from "vue";
|
import { reactive, ref, onMounted, getCurrentInstance, watch, nextTick } from "vue";
|
||||||
|
import { jqypDywdtj, jqypfxbgJqlxtj, jqypfxbgYdfx, jqypfxbgJqlytj, jqypfxbgTj, jqypfxbgCljgf, jqypfxbgCzlfx, getDictItem } from '@/api/semanticAnalysis'
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { D_SG_SJLY, D_SG_TSYPGZ } = proxy.$dict("D_SG_SJLY", "D_SG_TSYPGZ"); //获取字典数据
|
const { D_SG_SJLY, D_SG_TSYPGZ } = proxy.$dict("D_SG_SJLY", "D_SG_TSYPGZ"); //获取字典数据
|
||||||
@ -141,7 +142,6 @@ const getLits = () => {
|
|||||||
...formData.value
|
...formData.value
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
console.log(params);
|
|
||||||
|
|
||||||
qcckPost(params, '/mosty-gsxt/tsyp/selectPage').then(res => {
|
qcckPost(params, '/mosty-gsxt/tsyp/selectPage').then(res => {
|
||||||
let arr = res.records || [];
|
let arr = res.records || [];
|
||||||
@ -153,16 +153,34 @@ const getLits = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleYp = (val) => {
|
const handleYp = async (val) => {
|
||||||
|
await funAll(val.id)
|
||||||
let params = { tsypid: val.id, }
|
let params = { tsypid: val.id, }
|
||||||
qcckPost(params, '/mosty-gsxt/wshs/getDcypbg').then(res => {
|
await qcckPost(params, '/mosty-gsxt/wshs/getDcypbg').then(res => {
|
||||||
let data = res || {};
|
let data = res || {};
|
||||||
let html = `<p class="html_bt">${data.bt}</p>`
|
const content = `
|
||||||
|
<p>为全面、客观、准确掌握全区公安机关的执法状况,自治区公安厅基于数据统计,对全区公安机关2021年度的执法状况作了客观分析。</p>
|
||||||
|
<p>一、执法状况总体分析</p>
|
||||||
|
<p>1.接处警情况</p>
|
||||||
|
<p>1.1接报警情</p>
|
||||||
|
`
|
||||||
|
// let html = `<p class="html_bt">${data.bt}</p>`
|
||||||
html += `<p>${data.head}</p>`
|
html += `<p>${data.head}</p>`
|
||||||
html += `<p>${data.nr}</p>`
|
// html += `<p>${data.nr}</p>`
|
||||||
|
html += `<p class="html_bt">${content}
|
||||||
|
${sortingRatioValue.fxbg}
|
||||||
|
${sortingRatioValue.jqlx}
|
||||||
|
${sortingRatioValue.jqly}
|
||||||
|
${sortingRatioValue.dywd}
|
||||||
|
${sortingRatioValue.ydfx}
|
||||||
|
${sortingRatioValue.czjgfx}
|
||||||
|
${sortingRatioValue.xlwdfx}
|
||||||
|
</p>`;
|
||||||
html += `<p>${data.bc}</p>`
|
html += `<p>${data.bc}</p>`
|
||||||
html += `<p>${data.end}</p>`
|
html += `<p>${data.end}</p>`
|
||||||
textContent.value = html;
|
console.log(html);
|
||||||
|
|
||||||
|
textContent.value = html
|
||||||
showModel.value = true;
|
showModel.value = true;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -187,6 +205,199 @@ const tabHeightFn = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const dataList = reactive({
|
||||||
|
dyTj: {
|
||||||
|
xAxisData: [],
|
||||||
|
seriesData: [],
|
||||||
|
},
|
||||||
|
jqlxTj: [],
|
||||||
|
jqlyTj: [],
|
||||||
|
CljgfTj: [],
|
||||||
|
XsfxTj: [],
|
||||||
|
})
|
||||||
|
const sortingRatioValue = reactive({
|
||||||
|
jqlx: "",
|
||||||
|
jqly: "",
|
||||||
|
dywd: "",
|
||||||
|
ydfx: "",
|
||||||
|
xlwdfx: "",
|
||||||
|
czjgfx: "",
|
||||||
|
fxbg: ""
|
||||||
|
})
|
||||||
|
const sortingRatio = (data) => {
|
||||||
|
// 提取所有number值
|
||||||
|
// 计算总数
|
||||||
|
const total = data.reduce((sum, item) => sum + item.number, 0);
|
||||||
|
// 找出第一大和第二大的值及其对应的name
|
||||||
|
const sortedData = [...data].sort((a, b) => b.number - a.number);
|
||||||
|
const dataValue = sortedData.map(item => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
ratio: total > 0 ? (item.number / total * 100).toFixed(2) + '%' : '0%',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return dataValue
|
||||||
|
}
|
||||||
|
const pageData = reactive({
|
||||||
|
parameter: { bjlbList: '' }
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const getDictItemList = () => {
|
||||||
|
const promes = {
|
||||||
|
dictCode: "00000000"
|
||||||
|
}
|
||||||
|
getDictItem(promes).then(res => {
|
||||||
|
pageData.parameter.bjlbList = res.map(item => item.dm).join(',')
|
||||||
|
console.log(pageData.parameter.bjlbList);
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
getDictItemList()
|
||||||
|
const funAll =async (val) => {
|
||||||
|
// await getfxbgDywdtj(val)
|
||||||
|
// await getfxbgJqlxtj(val)
|
||||||
|
// await getfxbgJqlytj(val)
|
||||||
|
// await getfxbgYdfx(val)
|
||||||
|
// await getfxgbCljgf(val)
|
||||||
|
// await getfxgbCzlfx(val)
|
||||||
|
// await getfxbgTj(val)
|
||||||
|
|
||||||
|
}
|
||||||
|
// 地域统计
|
||||||
|
const getfxbgDywdtj = (val) => {
|
||||||
|
jqypDywdtj({ypid:val}).then(res => {
|
||||||
|
dataList.dyTj.xAxisData = res.map(it => it.ssbm)
|
||||||
|
dataList.dyTj.seriesData = [];
|
||||||
|
for (let i = 0; i < res.length; i++) {
|
||||||
|
dataList.dyTj.seriesData[i] = [];
|
||||||
|
for (let j = 0; j < res.length; j++) {
|
||||||
|
dataList.dyTj.seriesData[i][j] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let i = 0; i < dataList.dyTj.seriesData.length; i++) {
|
||||||
|
dataList.dyTj.seriesData[i][i] = res[i].number
|
||||||
|
}
|
||||||
|
const model = sortingRatio(res)
|
||||||
|
sortingRatioValue.dywd = `<p>1.1.3地域维度</p><p>从地市分布地市来看,${model[0].ssbm}警情量最大,占到全区警情总量的${model[0].number}。其次为${model[1].ssbm}和${model[2].ssbm},两市警情量较为接近。警情量最少的为${model[model.length - 1].ssbm} </p>`
|
||||||
|
// sortingRatioValue.Dywdtj = sortingRatio(res)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 警情类型统计
|
||||||
|
const getfxbgJqlxtj = (val) => {
|
||||||
|
let params = {
|
||||||
|
...pageData.parameter,
|
||||||
|
ypid:val
|
||||||
|
}
|
||||||
|
jqypfxbgJqlxtj(params).then(res => {
|
||||||
|
// sortingRatioValue.Jqlx =
|
||||||
|
const model = sortingRatio(res)
|
||||||
|
sortingRatioValue.jqlx = `<p>1.1.1类型维度</p><p>按警情类型来看,${model[0].name}最多,占到${model[0].ratio};其次为${model[1].name}最多,占到${model[1].ratio}。</p>`
|
||||||
|
dataList.jqlxTj = res.map(item => {
|
||||||
|
return {
|
||||||
|
name: item.name,
|
||||||
|
value: item.number
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 警情来源统计
|
||||||
|
const getfxbgJqlytj = (val) => {
|
||||||
|
jqypfxbgJqlytj({ypid:val}).then(res => {
|
||||||
|
// sortingRatioValue.Lyfx =
|
||||||
|
const model = sortingRatio(res)
|
||||||
|
sortingRatioValue.jqly = `<p>1.1.2来源维度</p><p>按警情来源来看,${model[0].name}最多,占到${model[0].ratio};其次为${model[1].name}最多,占到${model[1].ratio}。</p>`
|
||||||
|
dataList.jqlyTj = res.map(item => {
|
||||||
|
return {
|
||||||
|
name: item.name,
|
||||||
|
value: item.number
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//分析报告-时间维度-月分析
|
||||||
|
const getfxbgYdfx = (val) => {
|
||||||
|
jqypfxbgYdfx({ypid:val}).then(res => {
|
||||||
|
// sortingRatioValue.Ydfx =
|
||||||
|
const model = sortingRatio(res)
|
||||||
|
sortingRatioValue.ydfx = `<p >1.1.4时间维度</p> <p>我们将所有警情按照月份划分进行统计发现,每月警情分布较为平均。最高月份为${model[0].month}月,占到${model[0].number};最低月份为${model[res.length - 1].month}月,占到${model[res.length - 1].number}。考虑是因为${model[0].month}月为我区传统旅游旺季,进藏人员较多。 ${model[res.length - 1].month}月一般春节及藏历新年期间,在藏人员较少。</p>
|
||||||
|
`
|
||||||
|
// dataList.ydTj = res.map(item => {
|
||||||
|
// return {
|
||||||
|
// name: item.month,
|
||||||
|
// value: item.number
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 分析报告-处理结果分析
|
||||||
|
const getfxgbCljgf = (val) => {
|
||||||
|
jqypfxbgCljgf({ypid:val}).then(res => {
|
||||||
|
// sortingRatioValue.Cljgf =
|
||||||
|
const model = sortingRatio(res)
|
||||||
|
dataList.CljgfTj = res.map(item => {
|
||||||
|
return {
|
||||||
|
name: item.name,
|
||||||
|
value: item.number
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let czjgfx = `从警情处置结果来看,`
|
||||||
|
model.forEach(item => {
|
||||||
|
czjgfx += `${item.name},占到${item.ratio};`
|
||||||
|
})
|
||||||
|
sortingRatioValue.czjgfx = `<p>1.2警情处置</p><p>1.2.1结果维度</p><p>${czjgfx}</p>`
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 分析报告-处置率分析
|
||||||
|
const getfxgbCzlfx = (val) => {
|
||||||
|
|
||||||
|
jqypfxbgCzlfx({ypid:val}).then(res => {
|
||||||
|
dataList.withinTj = [{
|
||||||
|
name: "超时分流(超过24小时)",
|
||||||
|
value: res.within24h ? res.within24h : 0
|
||||||
|
}, {
|
||||||
|
name: "按时分流(24小时内)",
|
||||||
|
value: res.over24h ? res.over24h : 0
|
||||||
|
}]
|
||||||
|
sortingRatioValue.xlwdfx = `<p>1.2.2效率维度</p><p>从处警效率来看,24小时以内处警的,占到${res.over24h}%。表明我区公安机关在接警之后能够在第一时间处警。</p>
|
||||||
|
`
|
||||||
|
// sortingRatioValue.Czlfx = sortingRatio(dataList.withinTj)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const getfxbgTj = (val) => {
|
||||||
|
jqypfxbgTj({ypid:val}).then(res => {
|
||||||
|
sortingRatioValue.fxbg = `<p>${Time()} ,全区公安机关共 接报各类警情${res.total}起,同比上升 ${res.tbbsb}%,同比上升${res.hbbsb}%</p>`
|
||||||
|
dataList.XsfxTj = res
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const Time = () => {
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
const startOfYear = new Date(currentYear, 0, 1); // 今年1月1日
|
||||||
|
const endOfYear = new Date(currentYear, 11, 31, 23); // 今年12月31日23:59:59.999
|
||||||
|
const year = startOfYear.getFullYear();
|
||||||
|
const month = String(startOfYear.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(startOfYear.getDate()).padStart(2, '0');
|
||||||
|
const endYear = endOfYear.getFullYear();
|
||||||
|
const endMonth = String(endOfYear.getMonth() + 1).padStart(2, '0');
|
||||||
|
const endDay = String(endOfYear.getDate()).padStart(2, '0');
|
||||||
|
return `${year}年${month}月${day}日 至${endYear}年${endMonth}月${endDay}日`
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -273,7 +484,7 @@ const tabHeightFn = () => {
|
|||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
border-top: 1px solid #ccc;
|
border-top: 1px solid #ccc;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,9 @@ const changeValue = (value) => {
|
|||||||
showPopup.value = true
|
showPopup.value = true
|
||||||
}
|
}
|
||||||
const classIndex=ref(0)
|
const classIndex=ref(0)
|
||||||
const handleChange = (val,index) => {
|
const handleChange = (val, index) => {
|
||||||
|
console.log(val.tqjg);
|
||||||
|
|
||||||
classIndex.value=index
|
classIndex.value=index
|
||||||
|
|
||||||
emitter.emit('getlistData', val.tqjg)
|
emitter.emit('getlistData', val.tqjg)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, toRaw, computed, watch, nextTick, onMounted,getCurrentInstance } from "vue";
|
import { ref, reactive, toRaw, computed, watch, nextTick, onMounted, getCurrentInstance } from "vue";
|
||||||
import formNewModel from "./formNewModel.vue"
|
import formNewModel from "./formNewModel.vue"
|
||||||
import emitter from "@/utils/eventBus.js";
|
import emitter from "@/utils/eventBus.js";
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
@ -40,37 +40,57 @@ const data = {
|
|||||||
40: "特征识别分析",
|
40: "特征识别分析",
|
||||||
}
|
}
|
||||||
const model = ref()
|
const model = ref()
|
||||||
|
const numberData = 0
|
||||||
|
const jx = (val) => {
|
||||||
|
if (val) {
|
||||||
|
const jsonObject = val;
|
||||||
|
if (Array.isArray(jsonObject)) {
|
||||||
|
model.value = jsonObject.reduce((acc, cur) => {
|
||||||
|
const key = Object.keys(cur)[0];
|
||||||
|
const prefix = key.substring(0, 2);
|
||||||
|
if (!acc[prefix] && prefix !== '50' && prefix !== '60') {
|
||||||
|
acc[prefix] = {
|
||||||
|
inputs: [],
|
||||||
|
model: {},
|
||||||
|
value: prefix
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (prefix === '50' || prefix === '60') {
|
||||||
|
acc[10].inputs.push({ label: cur[key].name, prop: key, type: "input", width: "33%" });
|
||||||
|
acc[10].model[key] = cur[key].content ? cur[key].content : '-';
|
||||||
|
} else {
|
||||||
|
acc[prefix].inputs.push({ label: cur[key].name, prop: key, type: "input", width: "33%" });
|
||||||
|
acc[prefix].model[key] = cur[key].content == '-' || cur[key].content == '' || cur[key].content == '无' ? '/' : cur[key].content;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
} else {
|
||||||
|
const str = JSON.parse(jsonObject);
|
||||||
|
jx(str)
|
||||||
|
numberData++
|
||||||
|
if (numberData == 3) {
|
||||||
|
numberData=0
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const json =props.listData ;
|
|
||||||
const jsonString = JSON.parse(json);
|
|
||||||
if (jsonString) {
|
|
||||||
const jsonObject = jsonString;
|
|
||||||
console.log(jsonObject);
|
|
||||||
model.value = jsonObject.reduce((acc, cur) => {
|
|
||||||
const key = Object.keys(cur)[0];
|
|
||||||
const prefix = key.substring(0, 2);
|
|
||||||
if (!acc[prefix] && prefix !== '50' && prefix !== '60') {
|
|
||||||
acc[prefix] = {
|
|
||||||
inputs: [],
|
|
||||||
model: {},
|
|
||||||
value: prefix
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (prefix === '50' || prefix === '60') {
|
|
||||||
acc[10].inputs.push({ label: cur[key].name, prop: key, type: "input", width: "33%" });
|
|
||||||
acc[10].model[key] = cur[key].content? cur[key].content : '-';
|
|
||||||
} else {
|
|
||||||
acc[prefix].inputs.push({ label: cur[key].name, prop: key, type: "input", width: "33%" });
|
|
||||||
acc[prefix].model[key] = cur[key].content=='-'||cur[key].content==''||cur[key].content=='无'? '/':cur[key].content ;
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
} else {
|
} else {
|
||||||
model.value = []
|
model.value = []
|
||||||
proxy.$message({ type: "error", message: "解析失败" });
|
proxy.$message({ type: "error", message: "解析失败" });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
onMounted(() => {
|
||||||
|
const json = props.listData;
|
||||||
|
const jsonString = JSON.parse(json);
|
||||||
|
jx(jsonString)
|
||||||
})
|
})
|
||||||
|
watch(() => props.listData, (val) => {
|
||||||
|
if (val) {
|
||||||
|
const json = val;
|
||||||
|
const jsonString = JSON.parse(json);
|
||||||
|
jx(jsonString)
|
||||||
|
}
|
||||||
|
},{deep:true})
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
emitter.emit('showDetails', true)
|
emitter.emit('showDetails', true)
|
||||||
}
|
}
|
||||||
|
@ -317,26 +317,26 @@ const getText = async (val) => {
|
|||||||
handleFx(obj)
|
handleFx(obj)
|
||||||
}
|
}
|
||||||
function simpleExtractJSON(text) {
|
function simpleExtractJSON(text) {
|
||||||
// 找到第一个 [
|
// 找到第一个 [
|
||||||
const startIndex = text.indexOf('[');
|
const startIndex = text.indexOf('[');
|
||||||
if (startIndex === -1) return null;
|
if (startIndex === -1) return null;
|
||||||
|
|
||||||
// 找到最后一个完整的 }
|
// 找到最后一个完整的 }
|
||||||
let lastBraceIndex = text.lastIndexOf('}');
|
let lastBraceIndex = text.lastIndexOf('}');
|
||||||
if (lastBraceIndex === -1) return null;
|
if (lastBraceIndex === -1) return null;
|
||||||
|
|
||||||
// 确保 } 后面没有其他字符(除了空格和换行)
|
// 确保 } 后面没有其他字符(除了空格和换行)
|
||||||
let endIndex = lastBraceIndex + 1;
|
let endIndex = lastBraceIndex + 1;
|
||||||
|
|
||||||
// 截取从 [ 到最后一个 } 的内容,然后加上 ]
|
// 截取从 [ 到最后一个 } 的内容,然后加上 ]
|
||||||
let jsonString = text.substring(startIndex, endIndex) + ']';
|
let jsonString = text.substring(startIndex, endIndex) + ']';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return JSON.parse(jsonString);
|
return JSON.parse(jsonString);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("简单修复失败:", error);
|
console.error("简单修复失败:", error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleFx = (val) => {
|
const handleFx = (val) => {
|
||||||
ElMessageBox.prompt('请输入名称', '提示', {
|
ElMessageBox.prompt('请输入名称', '提示', {
|
||||||
@ -349,44 +349,44 @@ const handleFx = (val) => {
|
|||||||
.then(({ value }) => {
|
.then(({ value }) => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
completions(val).then(res => {
|
completions(val).then(res => {
|
||||||
console.log(res,"分析报告数据");
|
// console.log(res,"分析报告数据");
|
||||||
let jsonString
|
let jsonString
|
||||||
let jsonMatch = res.choices[0].text.match(/\[[\s\S]*?\]/g);
|
let jsonMatch = res.choices[0].text.match(/\[[\s\S]*?\]/g);
|
||||||
if (!jsonMatch) {
|
if (!jsonMatch) {
|
||||||
jsonMatch = simpleExtractJSON(res.choices[0].text)
|
jsonMatch = simpleExtractJSON(res.choices[0].text)
|
||||||
jsonString = jsonMatch;
|
jsonString = jsonMatch;
|
||||||
} else {
|
} else {
|
||||||
jsonString = jsonMatch[0];
|
jsonString = jsonMatch[0];
|
||||||
}
|
|
||||||
if (jsonMatch) {
|
|
||||||
const promes = {
|
|
||||||
fxlb: selectType.value,
|
|
||||||
fxmc: value,
|
|
||||||
tqjg:JSON.stringify(jsonString),//提取结果
|
|
||||||
xyjg: res.choices[0].text,
|
|
||||||
...saveData.value
|
|
||||||
}
|
}
|
||||||
yyfxAdd(promes).then(res => {
|
if (jsonMatch) {
|
||||||
proxy.$message({ type: "success", message: "添加成功" });
|
const promes = {
|
||||||
emitter.emit('getYyfxSelectPage')
|
fxlb: selectType.value,
|
||||||
emitter.emit('getlistData',JSON.stringify(jsonString))
|
fxmc: value,
|
||||||
emitter.emit('showDetails', false)
|
tqjg: JSON.stringify(jsonString),//提取结果
|
||||||
}).catch(err => {
|
xyjg: res.choices[0].text,
|
||||||
console.log(err, "xxxxx");
|
...saveData.value
|
||||||
proxy.$message({ type: "error", message: "添加失败" });
|
}
|
||||||
})
|
yyfxAdd(promes).then(res => {
|
||||||
} else {
|
proxy.$message({ type: "success", message: "添加成功" });
|
||||||
proxy.$message({ type: "error", message: "解析失败,请重新上传分析" });
|
emitter.emit('getYyfxSelectPage')
|
||||||
}
|
emitter.emit('getlistData', JSON.stringify(jsonString))
|
||||||
}).catch(err => {
|
emitter.emit('showDetails', false)
|
||||||
console.log(err, 'vvvv');
|
}).catch(err => {
|
||||||
}).finally(() => {
|
console.log(err, "xxxxx");
|
||||||
loading.value = false
|
proxy.$message({ type: "error", message: "添加失败" });
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
proxy.$message({ type: "error", message: "解析失败,请重新上传分析" });
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err, 'vvvv');
|
||||||
|
}).finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
})
|
})
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,8 +4,8 @@ function resolve(dir) {
|
|||||||
return path.join(__dirname, dir);
|
return path.join(__dirname, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
const serverHost = "http://192.168.1.32:8006"//波哥
|
// const serverHost = "http://192.168.1.32:8006"//波哥
|
||||||
// const serverHost = "http://192.168.0.231:8006"//线上
|
const serverHost = "http://192.168.0.231:8006"//线上
|
||||||
// const serverHost = "http://192.168.1.117:8006"//周
|
// const serverHost = "http://192.168.1.117:8006"//周
|
||||||
// const serverHost = "http://192.168.1.98:8006"//毛毛
|
// const serverHost = "http://192.168.1.98:8006"//毛毛
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user