This commit is contained in:
cclu 2024-11-21 19:20:56 +08:00
parent 76eb430ea5
commit 8bb086a400
10 changed files with 714 additions and 175 deletions

View File

@ -2,7 +2,7 @@
* @Author: cclu 1106109051@qq.com
* @Date: 2024-11-18 11:40:21
* @LastEditors: cclu 1106109051@qq.com
* @LastEditTime: 2024-11-19 09:33:22
* @LastEditTime: 2024-11-21 10:44:39
* @FilePath: \aiRobot\index.html
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@ -13,7 +13,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>地图测试</title>
<base href="/map/">
<base href="/aiMap/">
</head>
<body>
<div id="app"></div>

View File

@ -64,6 +64,16 @@
background: rgba(27, 27, 27, 0.51);
border-radius: 4px;
padding: 8px 12px;
.firstClickTab{
width: 100%;
.clickItem{
margin-right: 8px;
cursor: pointer;
color: rgb(24, 144, 255);
text-decoration: none;
}
}
.el-loading-mask{
background-color: transparent!important;
.el-loading-spinner{
@ -76,25 +86,66 @@
}
.elTable{
background-color: transparent !important;
.el-table__inner-wrapper{
.el-table__header-wrapper{
.el-table__header{
thead{
tr{
background: transparent !important;
th{
background: transparent !important;
.cell{
color: #fff!important;
}
}
}
}
}
}
.el-table__body-wrapper{
.el-scrollbar{
.el-scrollbar__wrap{
.el-scrollbar__view{
.el-table__body{
.el-table__row{
background: transparent !important;
color: #fff!important;
}
tr:hover>td.el-table__cell{
background: transparent !important;
color: #fff!important;
}
.el-table__row--level-0{
.el-table__cell{
.cell{
display: flex;
align-items: center;
// display: flex;
// align-items: center;
.el-table__expand-icon{
.el-icon{
color: #fff;
}
}
}
}
}
.el-table__row--level-1{
.el-table__cell{
.cell{
display: flex;
align-items: center;
// display: flex;
// align-items: center;
.el-table__indent{
padding-left: 0!important;
}
@ -104,8 +155,8 @@
.el-table__row--level-2{
.el-table__cell{
.cell{
display: flex;
align-items: center;
// display: flex;
// align-items: center;
.el-table__indent{
padding-left: 0!important;
}
@ -115,8 +166,8 @@
.el-table__row--level-3{
.el-table__cell{
.cell{
display: flex;
align-items: center;
// display: flex;
// align-items: center;
.el-table__indent{
padding-left: 0!important;
}
@ -126,8 +177,8 @@
.el-table__row--level-4{
.el-table__cell{
.cell{
display: flex;
align-items: center;
// display: flex;
// align-items: center;
.el-table__indent{
padding-left: 0!important;
}
@ -150,6 +201,11 @@
}
}
.dialogContent::-webkit-scrollbar {
width: 0px; /* 隐藏水平滚动条 */
height: 0px; /* 隐藏垂直滚动条 */
}
.inputBox{
width: 100%;
box-sizing: border-box;

View File

@ -1,11 +1,17 @@
<script setup lang="ts">
import { log } from "console";
import moment from "moment";
import { onMounted, reactive, ref } from "vue";
import { formatNumber, wrapTreeNode } from "../../../options/serveice";
import { h, nextTick, onMounted, reactive, ref, watch } from "vue";
import {
formatNumber,
parseThousandSeparatedNumber,
wrapTreeNode,
} from "../../../options/serveice";
import request from "../../../request/requestConfig";
import {
handleGetANALYSISRULEDetail,
handleGetANALYSISRULEList,
handleSynchroSENTENCE,
handleTranslateSentence,
} from "../service";
import "./RobotDialogueBox.less";
@ -20,6 +26,12 @@ let dialogueList = reactive<any>([]);
const searchText = ref<string>();
//
const isNewDialogLoading = ref<boolean>(false);
// id
const thisQuestionId = ref<any>();
// tab
const clickTabList: any = [{ label: "基础信息", value: 1 }];
// tab
const selectTab = ref<number>(0);
onMounted(() => {
//
@ -35,12 +47,14 @@ const handleGetShowDailogBox = () => {
type: 1,
text: "",
isFirst: true,
isOver: false,
};
dialogueList.push(obj);
showDialogBox.value = true;
setTimeout(() => {
dialogueList[0].text = "猜你想了解:";
dialogueList[0].isOver = true;
isNewDialogLoading.value = false;
}, 1000);
}
@ -50,11 +64,10 @@ const handleCloseDialogbox = () => {
showDialogBox.value = false;
};
//
const handleAddDialogList = () => {
console.log("searchText", searchText.value);
const handleAddDialogList = (text: string) => {
let userObj: any = {
type: 2,
text: searchText.value,
text: text,
isFirst: false,
};
let robotObj: any = {
@ -64,14 +77,64 @@ const handleAddDialogList = () => {
};
dialogueList.push(userObj);
handleScrollToBottom();
dialogueList.push(robotObj);
handleScrollToBottom();
isNewDialogLoading.value = true;
};
//
const handleLastUpdate = (str: any) => {
dialogueList[dialogueList.lengtg - 1].text = str;
dialogueList[dialogueList.length - 1].text = str;
dialogueList[dialogueList.length - 1].isOver = true;
isNewDialogLoading.value = false;
handleScrollToBottom();
};
// rowKey
const handleSetRowKeyTable = (list: any) => {
console.log("list", list);
if (list && list.length > 0) {
let res: any = JSON.parse(JSON.stringify(list));
res.forEach((item: any, index: number) => {
item.rowKey = `${index + 1}`;
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any, subIndex: number) => {
subItem.rowKey = `${index + 1}-${subIndex + 1}`;
if (subItem.children && subItem.children.length > 0) {
subItem.children.forEach((thirdItem: any, thirdIndex: number) => {
thirdItem.rowKey = `${index + 1}-${subIndex + 1}-${
thirdIndex + 1
}`;
if (thirdItem.children && thirdItem.children.length > 0) {
thirdItem.children.forEach(
(fourthItem: any, fourthIndex: number) => {
fourthItem.rowKey = `${index + 1}-${subIndex + 1}-${
thirdIndex + 1
}-${fourthIndex + 1}`;
if (fourthItem.children && fourthItem.children.length > 0) {
fourthItem.children.forEach(
(fifthItem: any, fifthIndex: number) => {
fourthItem.rowKey = `${index + 1}-${subIndex + 1}-${
thirdIndex + 1
}-${fourthIndex + 1}-${fifthIndex + 1}`;
}
);
}
}
);
}
});
}
});
}
});
return res;
} else {
return [];
}
};
//
const handleConfigRequest = async (
url: any,
@ -88,12 +151,13 @@ const handleConfigRequest = async (
}
if (config.responseFormat === "nestingList") {
data = wrapTreeNode(data.Result_Data.List);
data = handleSetRowKeyTable(wrapTreeNode(data.Result_Data.List));
} else {
data = data.Result_Data.List;
data = handleSetRowKeyTable(data.Result_Data.List);
}
let newRes: any;
console.log("data", data);
let newRes: any;
//
//
if (answer?.ServerpartId && answer?.ServerpartId.indexOf(",") === -1) {
@ -102,17 +166,18 @@ const handleConfigRequest = async (
//
if (config?.serverpart) {
if (data && data.length > 0) {
data.forEach((item: any) => {
data.forEach((item: any, index: number) => {
if (config?.serverpart === 1) {
newRes = [item];
} else {
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
item.children.forEach((subItem: any, subIndex: number) => {
if (config?.serverpart === 2) {
newRes = [subItem];
} else {
if (subItem.children && subItem.children.length > 0) {
subItem.children.forEach((thirdItem: any) => {
subItem.children.forEach(
(thirdItem: any, thirdIndex: number) => {
if (config?.serverpart === 3) {
newRes = [thirdItem];
} else {
@ -120,14 +185,17 @@ const handleConfigRequest = async (
thirdItem.children &&
thirdItem.children.length > 0
) {
thirdItem.children.forEach((fourthItem: any) => {
thirdItem.children.forEach(
(fourthItem: any, fourthIndex: number) => {
if (config?.serverpart === 4) {
newRes = [fourthItem];
}
});
}
);
}
}
});
}
);
}
}
});
@ -212,7 +280,7 @@ const handleAnalyzeConfig = async (configDetail: any, answer: any) => {
let currentUser: any = {
ProvinceCode: "340000",
};
// formatType 0 1 2 3 name resData value 1
// formatType 0 1 2 3 name resData value 1 4:
if (realKey.formatType === 1) {
req[key] = answer[realKey.fieldName];
} else if (realKey.formatType === 0) {
@ -223,6 +291,8 @@ const handleAnalyzeConfig = async (configDetail: any, answer: any) => {
req[key] = answer[realKey.fieldName]
? moment(answer[realKey.fieldName]).format("YYYY")
: "";
}else if(realKey.formatType === 4){
req[key] = props.currentServerPartDetail[realKey.fieldName];
}
}
}
@ -239,24 +309,92 @@ const handleAnalyzeConfig = async (configDetail: any, answer: any) => {
answer
);
}
//
let newRes: any = [];
if (result && result.length > 0) {
result.forEach((item: any, index: number) => {
item.rowKey = `${index + 1}`;
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any, subIndex: number) => {
subItem.rowKey = `${index + 1}-${subIndex + 1}`;
//
console.log("dsadsadasf", result);
const newResult: any = handleChangeTableList(result, newRESPONSE_CONFIG);
console.log("newResult", newResult);
return newResult;
};
//
const handleChangeTableList = (list: any, config: any) => {
if (list && list.length > 0) {
let res: any = [];
list.forEach((item: any) => {
let obj: any = handleChangeListItem(item);
console.log("321312", obj);
obj = handleChangeObj(obj, config);
res.push(obj);
});
return res;
} else {
return [];
}
};
//
const handleChangeListItem = (item: any, parentKey?: any) => {
if (item) {
let obj: any = {};
for (let key in item) {
if (
typeof item[key] === "object" &&
item[key] !== null &&
key !== "children"
) {
let newObj: any = handleChangeListItem(item[key], key);
for (let smallKey in newObj) {
obj[`${key}${smallKey}`] = newObj[smallKey];
}
} else {
obj[key] = item[key];
}
}
return obj;
}
};
//
const handleChangeObj = (obj: any, config: any) => {
if (obj) {
let newObj: any = JSON.parse(JSON.stringify(obj));
for (let key in config) {
if (newObj[key]) {
let configObj: any = config[key];
for (let samllKey in configObj) {
//
if (configObj["isTenThousand"] && samllKey === "isTenThousand") {
newObj[key] =
typeof newObj[key] === "number"
? newObj[key] / 10000
: formatNumber(
parseThousandSeparatedNumber(newObj[key]) / 10000
);
}
//
if (configObj["isRate"] && samllKey === "isRate") {
newObj[key] = newObj[key] + "%";
}
//
if (configObj["isMoney"] && samllKey === "isMoney") {
console.log("newObj[key]2", newObj[key]);
newObj[key] =
typeof newObj[key] === "number"
? formatNumber(newObj[key])
: formatNumber(parseThousandSeparatedNumber(newObj[key]));
}
}
}
}
let obj = disasseListObj(item);
newRes.push(obj);
});
if (newObj.children && newObj.children.length > 0) {
newObj.children = handleChangeTableList(newObj.children, config);
}
return newObj;
} else {
return {};
}
console.log("newRes", newRes);
return newRes;
};
//
@ -323,95 +461,20 @@ const disassembleObjects = (obj: any, parentKey: any) => {
//
const handleChangeShow = (obj: any, addObj?: any) => {
// prop
let moneyList: any = [
"金额",
"营收",
"应收",
"缴款",
"费用",
"额",
"数值",
"增长值",
];
let rateList: any = ["同比", "环比", "率", "增长率", "比例"];
let columnsList: any = [];
for (let key in obj) {
//
let isMoney: boolean = false;
//
let isName: boolean = false;
// %
let isRate: boolean = false;
//
let isObject: boolean = false;
if (typeof obj[key] === "string") {
moneyList.forEach((item: any) => {
if (obj[key].indexOf(item) !== -1) {
isMoney = true;
}
});
if (obj[key].indexOf("名") !== -1) {
isName = true;
}
rateList.forEach((item: any) => {
if (obj[key].indexOf(item) !== -1 && !isMoney) {
isRate = true;
}
});
} else if (
typeof obj[key] === "object" &&
obj[key] !== null &&
key !== "ShopINCList" &&
key !== "children"
) {
isObject = true;
}
let newObj: any = obj[key];
if (isObject) {
// let resObj = {
// label: key,
// children: handleChangeShow(),
// };
let resObj = disassembleObjects(obj[key], key);
console.log("resObj222", resObj);
if (resObj && resObj.length > 0) {
resObj.forEach((item: any) => {
columnsList.push(item);
});
}
// columnsList.push(resObj);
} else {
let resObj: any = {
width: isName ? 250 : 150,
label: isName
? `${obj[key] || ''}`
: `<div style="text-align: center">${
(addObj?.name ? addObj?.name + "" : "") + obj[key]
}</div>`,
prop: (addObj?.key ? addObj?.key + "" : "") + key,
// valueType: isMoney ? "digit" : "",
align: isMoney ? "right" : "",
columnsList.push({
width: newObj.width,
label: newObj.label,
prop: newObj.prop,
align: newObj.align,
"show-overflow-tooltip": true,
isSlot: false,
isMoney: isMoney,
isRate: isRate,
};
if (isRate) {
resObj.isSlot = true;
// resObj.formatter = (_: any, record: any) => {
// return record[key] ? record[key] + "%" : "";
// };
}
if (isMoney) {
resObj.isSlot = true;
// resObj.formatter = (_: any, record: any) => {
// return record[key] ? `<span>${formatNumber(record[key])}</span>` : "";
// };
}
columnsList.push(resObj);
}
isSlot: newObj.isSlot,
isMoney: newObj.isMoney,
isRate: newObj.isRate,
});
}
return columnsList;
};
@ -436,10 +499,13 @@ const handleConfigItemTable = (tableData: any, configObj: any, answer: any) => {
//
if (configObj) {
let resObj: any = JSON.parse(configObj.RESPONSE_CONFIG);
console.log("resObj", resObj);
console.log("answer", answer);
let columns: any = [];
if (resObj) {
//
let columns: any = handleChangeShow(resObj);
//
columns = handleChangeShow(resObj);
console.log("columns", columns);
}
let obj: any = JSON.parse(
JSON.stringify(dialogueList[dialogueList.length - 1])
);
@ -448,11 +514,26 @@ const handleConfigItemTable = (tableData: any, configObj: any, answer: any) => {
haveTable: true,
tableData: tableData,
columns: columns,
text: `${answer?.RevenueAnalysis}${
answer?.StartDate ? answer?.StartDate : ""
}${answer?.EndDate ? "-" + answer?.EndDate : ""}`,
};
isNewDialogLoading.value = false;
searchText.value = "";
}
handleScrollToBottom();
};
//
const handleScrollToBottom = () => {
const div: any = document.getElementById("dialogContent");
console.log("div", div);
setTimeout(() => {
nextTick(() => {
if (div) {
div.scrollTop = div.scrollHeight; // scrollTop scrollHeight
}
});
}, 100);
};
//
@ -460,18 +541,60 @@ const handleAnswerQuestions = async () => {
const req: any = {
Sentence: searchText.value,
ProvinceCode: "340000",
DialogCode: thisQuestionId.value || "",
};
//
searchText.value = "";
const data = await handleTranslateSentence(req);
console.log("data", data);
let searchRes: string = "";
// ServerpartInfoList
if (data?.ServerpartInfoList && data?.ServerpartInfoList.length > 0) {
emit("handleEnterySearch");
emit("handleLightServerpart", data?.ServerpartInfoList);
let obj: any = JSON.parse(
JSON.stringify(dialogueList[dialogueList.length - 1])
);
let str: string = ``;
data?.ServerpartInfoList.forEach((item: any) => {
if (str) {
str += `${item.SERVERPART_NAME}`;
} else {
str = `${item.SERVERPART_NAME}`;
}
});
dialogueList[dialogueList.length - 1] = {
...obj,
text: data?.RevenueAnalysis || "",
// `${str}`
};
isNewDialogLoading.value = false;
} else if (data?.RevenueAnalysis) {
//
if (data?.AnalysisRuleId) {
// id
const configDetail = await handleGetANALYSISRULEDetail({
ANALYSISRULEId: data?.AnalysisRuleId,
// id id id configDetail
let configDetail: any;
const configList: any = await handleGetANALYSISRULEList({
searchParameter: {
ANALYSISRULE_ID: data?.AnalysisRuleId,
current: 1,
pageSize: 10,
},
sortstr: "RULE_PRIORITY asc",
PageIndex: 1,
pagesize: 999999,
});
console.log("configList", configList);
//
if (configList && configList.length > 0) {
configDetail = configList[0];
}
// const configDetail = await handleGetANALYSISRULEDetail({
// ANALYSISRULEId: data?.AnalysisRuleId,
// });
console.log("configDetail", configDetail);
//
if (configDetail) {
@ -487,15 +610,148 @@ const handleAnswerQuestions = async () => {
}
} else {
handleLastUpdate("小驿还无法理解,请换个说法,我会不停努力学习的!");
searchRes = "查询失败";
}
// id id
const logData: any = await handleSynchroSENTENCE({
DIALOG_CODE: thisQuestionId.value,
SENTENCE_CONTENT: req.Sentence,
SENTENCE_RESULT: data?.RevenueAnalysis || "查询失败",
SENTENCE_TYPE: data?.SentenceType,
SENTENCE_STATE:
searchRes === "查询失败" || data?.RevenueAnalysis === "无法识别。"
? 0
: 1,
OPERATE_DATE: moment().format("YYYY-MM-DD HH:mm:ss"),
STAFF_NAME: "新项目",
// STAFF_ID
});
console.log("logData", logData);
if (thisQuestionId.value) {
} else {
thisQuestionId.value = logData?.DIALOG_CODE;
}
};
//
const handleSubmit = async () => {
if (searchText.value) {
//
handleAddDialogList();
handleAddDialogList(searchText.value);
//
await handleAnswerQuestions();
}
};
//
const handleClickTab = async (value: number) => {
selectTab.value = value;
console.log("handleClickTab", props.currentServerPartDetail);
let searchObj: any = {
1: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}基础信息`,
};
//
handleAddDialogList(searchObj[value]);
//
const configDetail: any = await handleGetConfigList(searchObj[value]);
if (value === 1) {
handleServerpartBasicInfo(configDetail);
}
};
// id
const handleGetConfigList = async (str: string) => {
const data = await handleGetANALYSISRULEList({
searchParameter: {
ANALYSISRULE_ID: "",
current: 1,
pageSize: 10,
},
pagesize: 999999,
PageIndex: 1,
});
console.log("data", data);
let detailObj: number = 0;
if (data && data.length > 0) {
data.forEach((item: any) => {
if (str.indexOf(item.TRIGGER_WORDS) !== -1 && item.RULE_SOURCE === 1000) {
detailObj = item;
}
});
}
console.log("detailObj", detailObj);
return detailObj;
};
//
const handleServerpartBasicInfo = async (config: any) => {
console.log("config", config);
let newReq: any = config.PARAM_TEMPLATE
? JSON.parse(config.PARAM_TEMPLATE)
: ""; //
let newRESPONSE_CONFIG: any = config.RESPONSE_CONFIG
? JSON.parse(config.RESPONSE_CONFIG)
: ""; //
let newPARSING_RULES: any = config.PARSING_RULES
? JSON.parse(config.PARSING_RULES)
: ""; //
let OUTPUT_FORMAT: any = config.OUTPUT_FORMAT
? JSON.parse(config.OUTPUT_FORMAT)
: ""; //
console.log("newReq", newReq);
console.log("newRESPONSE_CONFIG", newRESPONSE_CONFIG);
console.log("newPARSING_RULES", newPARSING_RULES);
console.log("OUTPUT_FORMAT", OUTPUT_FORMAT);
//
let req: any = {}
if(newPARSING_RULES){
}
};
//
const props = defineProps<{
currentServerPartDetail: any;
}>();
//
const emit = defineEmits<{
(e: "handleLightServerpart", infoList: any): void; //
(e: "handleEnterySearch"): void; //
}>();
//
watch(
() => props.currentServerPartDetail,
(newVal, oldVal) => {
console.log("new", newVal);
console.log("old", oldVal);
if (newVal) {
if (selectTab.value !== 0) {
handleClickTab(selectTab.value);
}
}
},
{ deep: true }
);
//
const handleFormatter = (
row: any,
column: any,
cellValue: any,
index: number
) => {
return h("div", { style: "text-align:center" }, [
JSON.stringify(row), // label
]);
};
</script>
@ -512,7 +768,7 @@ const handleSubmit = async () => {
</div>
<div class="dialogBox">
<!-- 实际的对话框方框 -->
<div class="dialogContent">
<div id="dialogContent" class="dialogContent">
<div
class="dialogueBoxItem"
v-for="(item, index) in dialogueList"
@ -530,16 +786,31 @@ const handleSubmit = async () => {
class="dialogueTextBox"
v-loading="isNewDialogLoading && index === dialogueList.length - 1"
>
{{ item.text || "" }}
<div>{{ item.text || "" }}</div>
<div v-if="item.haveTable">
<div
v-if="item.isFirst && item.isOver"
style="margin-top: 8px"
class="firstClickTab"
>
<div
v-for="(item, index) in clickTabList"
:key="index"
class="clickItem"
@click="handleClickTab(item.value)"
>
{{ item.label || "" }}
</div>
</div>
<div v-if="item.haveTable" style="margin-top: 8px">
<el-table
:data="item.tableData"
border
:fit="true"
tree-props="treeProps"
row-key="rowKey"
class="elTable"
:max-height="500"
>
<el-table-column
v-for="(column, index) in item.columns"
@ -547,21 +818,37 @@ const handleSubmit = async () => {
:prop="column.prop"
:label="column.label"
:width="column.width"
:align="column.align"
header-align="center"
>
<!-- :formatter="handleFormatter" -->
<!-- 自定义表头内容 -->
<template #header>
<div v-html="column.label"></div>
</template>
<!-- 默认的单元格内容渲染 -->
<template #default="{ row }">
<div v-if="column.isSlot">
<!-- <template #default="{ row }">
<div
v-if="column.isSlot"
:style="{
justifyContent:
column.align === 'right'
? 'flex-end'
: column.align === 'left'
? 'flex-start'
: column.align === 'center'
? 'center'
: '',
}"
>
<span v-html="renderCell(row, column)"></span>
</div>
<div v-else>
<span>{{ row[column.prop] }}</span>
</div>
</template>
</template> -->
</el-table-column>
</el-table>
</div>
@ -586,7 +873,7 @@ const handleSubmit = async () => {
<img
class="searchIcon"
src="@/assets/ai/searchIconBlue.png"
@clcik="handleSubmit()"
@click="handleSubmit()"
/>
</div>
</div>

View File

@ -19,6 +19,8 @@ let defaultServerPartList = reactive<any>([]);
let ServerpartTypeObj = reactive<any>({});
//
const isShowLoading = ref<boolean>(false);
//
const currentServerPartDetail = ref<any>();
onMounted(async () => {
scene.value = new Scene({
@ -78,7 +80,15 @@ const handleGetAllService = async () => {
};
const data = await handleGetServerpartList(req);
console.log("data", data);
defaultServerPartList = data;
if (data && data.length > 0) {
let res: any = [];
data.forEach((item: any) => {
if (item.SPREGIONTYPE_ID !== 89 && item.SPREGIONTYPE_ID) {
res.push(item);
}
});
defaultServerPartList = res;
}
return data;
};
@ -116,8 +126,6 @@ const handleAllServiceMarkedPoint = async () => {
});
pointLayer.on("mousemove", (ev: any) => {
const detail: any = ev.feature;
console.log("detail", detail);
hoverPoint.value.style.top = `${ev.y}px`;
hoverPoint.value.style.left = `${ev.x}px`;
hoverPoint.value.style.display = "block";
@ -137,9 +145,78 @@ const handleAllServiceMarkedPoint = async () => {
hoverPoint.value.style.display = "none";
});
//
pointLayer.on("click", (e) => {
console.log("e", e);
handleClickPointLayer(e.feature);
});
//
pointLayer.on("unclick", () => {
handleChangeToDefault();
});
scene.value.addLayer(pointLayer);
};
//
const handleClickPointLayer = (detail: any) => {
//
currentServerPartDetail.value = detail;
//
handleAddSelect(detail);
};
//
const handleAddSelect = (detail: any) => {
let current: any = handleGetThisLayer("lightPointLayer");
if (current) {
scene.value.removeLayer(current);
}
const lightPointLayer = new PointLayer({});
lightPointLayer.name = "lightPointLayer";
lightPointLayer.shape("circle");
lightPointLayer.size(15);
lightPointLayer.color("#efff19");
lightPointLayer.style({
opacity: 0.6,
});
lightPointLayer.source([detail], {
parser: {
type: "json",
x: "SERVERPART_X",
y: "SERVERPART_Y",
},
});
scene.value.addLayer(lightPointLayer);
};
//
const handleChangeToDefault = () => {
//
currentServerPartDetail.value = undefined;
//
const list: any = ["lightPointLayer", "searchPointLayerText"];
list.forEach((item: any) => {
let current: any = handleGetThisLayer(item);
if (current) {
scene.value.removeLayer(current);
}
});
//
let current: any = handleGetThisLayer("pointLayer");
current.color("SPREGIONTYPE_ID", (value: number) => {
return Number(value || 0) === 65 ||
Number(value || 0) === 45 ||
Number(value || 0) === 47
? "#34B6B7"
: "#CEF8D6";
});
current.render();
};
//
const handlePointHover = () => {
const el = document.createElement("div");
@ -170,12 +247,105 @@ const handleGetEnumeration = async () => {
}
ServerpartTypeObj = typeObj;
};
//
//
const handleLightServerpart = (infoList: any) => {
let current: any = handleGetThisLayer("searchPointLayerText");
let idList: any = [];
infoList.forEach((item: any) => {
idList.push(item.SERVERPART_ID);
});
let searchRes: any = [];
defaultServerPartList.forEach((item: any) => {
if (idList.indexOf(item.SERVERPART_ID) !== -1) {
searchRes.push(item);
}
});
//
if (current) {
scene.value.removeLayer(current);
}
let searchPointLayerText = new PointLayer({
zIndex: 9,
});
searchPointLayerText.name = "searchPointLayerText";
searchPointLayerText.source(searchRes, {
parser: {
type: "json",
x: "SERVERPART_X",
y: "SERVERPART_Y",
},
});
searchPointLayerText.shape("circle");
searchPointLayerText.size(8);
searchPointLayerText.color("#fdff3d");
searchPointLayerText.style({
opacity: 0.7, //
});
searchPointLayerText.on("mousemove", (ev: any) => {
const detail: any = ev.feature;
hoverPoint.value.style.top = `${ev.y}px`;
hoverPoint.value.style.left = `${ev.x}px`;
hoverPoint.value.style.display = "block";
hoverPoint.value.innerHTML = `<div>
<div>${detail?.SERVERPART_NAME || ""}</div>
</div>`;
});
//
searchPointLayerText.on("mouseout", (ev: any) => {
hoverPoint.value.style.display = "none";
});
scene.value.addLayer(searchPointLayerText);
};
// id id
const handleSelectedServerpart = (id: any) => {
if (defaultServerPartList && defaultServerPartList.length > 0) {
let seletObj: any = {};
defaultServerPartList.forEach((item: any) => {
if (item.SERVERPART_ID === id) {
seletObj = item;
}
});
}
};
//
const handleGetThisLayer = (name: string) => {
let res: any;
let allLayers: any = scene.value.getLayers();
console.log("allLayers", allLayers);
if (allLayers && allLayers.length > 0) {
allLayers.forEach((item: any) => {
if (item.name === name) {
res = item;
}
});
}
if (res) {
return res;
}
};
//
const handleEnterySearch = () => {
let current: any = handleGetThisLayer("pointLayer");
current.color("#dededd");
current.render();
};
</script>
<template>
<div id="map" class="mapBox">
<div class="RobotBox">
<RobotDialogueBox />
<RobotDialogueBox
@handleLightServerpart="handleLightServerpart"
@handleEnterySearch="handleEnterySearch"
:currentServerPartDetail="currentServerPartDetail"
/>
</div>
</div>
</template>

View File

@ -58,3 +58,22 @@ export async function handleGetANALYSISRULEDetail(params: any) {
// 拿到配置列表 多个的时候按照优先级去选择
export async function handleGetANALYSISRULEList(params: any) {
const data: any = await request.post('/Analysis/GetANALYSISRULEList', params)
if (data.Result_Code !== 100) {
return data
}
return data.Result_Data.List
}
// 语义识别接口 同步接口
export async function handleSynchroSENTENCE(params: any) {
const data: any = await request.post('/Analysis/SynchroSENTENCE', params)
if (data.Result_Code !== 100) {
return data
}
return data.Result_Data
}

View File

@ -19,3 +19,10 @@ export const formatNumber = (num: number) => {
return num.toLocaleString(); // 使用千分号,不保留小数位
}
}
// 把可能是带千分号的数字 变为数字
export const parseThousandSeparatedNumber = (str: string) => {
if (!str) return 0; // 如果字符串为空返回0
const cleaned = str.replace(/,/g, ""); // 移除千分号
return parseFloat(cleaned); // 转换为数字
};

View File

@ -44,7 +44,7 @@ const errorHandler = (error: any): any => {
// 创建 axios 实例
const instance = axios.create({
baseURL: 'https://api.eshangtech.com/EShangApiMain', // 默认请求前缀
timeout: 10000, // 请求超时时间
timeout: 60000, // 请求超时时间
headers: {
'Content-Type': 'application/json',
},

View File

@ -44,7 +44,7 @@ const errorHandler = (error: any): any => {
// 创建 axios 实例
const instance = axios.create({
baseURL: 'https://api.eshangtech.com/CommercialApi', // 默认请求前缀
timeout: 10000, // 请求超时时间
timeout: 60000, // 请求超时时间
headers: {
'Content-Type': 'application/json',
},

View File

@ -44,7 +44,7 @@ const errorHandler = (error: any): any => {
// 创建 axios 实例
const instance = axios.create({
baseURL: 'https://api.eshangtech.com/', // 默认请求前缀
timeout: 10000, // 请求超时时间
timeout: 60000, // 请求超时时间
headers: {
'Content-Type': 'application/json',
},

View File

@ -14,7 +14,7 @@ export default defineConfig({
plugins: [
vue(),
],
base: '/map',
base: '/aiMap',
build: {
outDir: 'dist', // 打包输出目录
assetsDir: 'assets', // 静态资源目录