This commit is contained in:
cclu 2024-11-28 19:14:27 +08:00
parent 8e14aff70d
commit d39becc206
7 changed files with 477 additions and 24 deletions

BIN
aiMap.zip

Binary file not shown.

BIN
src/assets/ai/dropDown.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/ai/pullUp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -92,6 +92,18 @@
} }
} }
.moreOption{
width: 100%;
display: flex;
align-items: center;
margin-top: 16px;
.optionItem{
color: #1890ff!important;
cursor: pointer;
margin-right: 16px;
}
}
.style1{ .style1{
color: #6590f5!important; color: #6590f5!important;
font-weight: bold; font-weight: bold;
@ -270,5 +282,59 @@
cursor: pointer; cursor: pointer;
} }
} }
.moreSelect{
width: 100%;
.filterFixed{
width: 100%;
box-sizing: border-box;
display: flex;
justify-content: flex-end;
.filterIcon{
width: 20px;
height: 20px;
cursor: pointer;
}
}
.filterBox{
width: 100%;
display: flex;
.filterList{
width: calc(100% - 28px);
box-sizing: border-box;
display: flex;
align-items: center;
flex-wrap: wrap;
.filterItem{
cursor: pointer;
margin-right: 6px;
padding: 4px 8px;
border-radius: 14px;
border: 1px solid rgb(90, 90, 90);
font-family: PingFangSC, "PingFang SC";
font-weight: 400;
font-size: 14px;
color: rgba(255, 255, 255, 0.85);
line-height: 20px;
text-align: left;
font-style: normal;
margin-bottom: 8px;
}
.selectFilterItem{
color: #1890ff !important;
border-color: #1890ff;
}
}
.filterIcon{
width: 15px;
height: 15px;
cursor: pointer;
margin-left: 8px;
}
}
}
} }
} }

View File

@ -9,6 +9,7 @@ import {
} from "../../../options/serveice"; } from "../../../options/serveice";
import request from "../../../request/requestConfig"; import request from "../../../request/requestConfig";
import { import {
getFieldEnumTree,
getFieldGetFieEnumList, getFieldGetFieEnumList,
handleGetANALYSISRULEDetail, handleGetANALYSISRULEDetail,
handleGetANALYSISRULEList, handleGetANALYSISRULEList,
@ -36,6 +37,11 @@ const thisQuestionId = ref<any>();
const clickTabList: any = [ const clickTabList: any = [
{ label: "基础信息", value: 1 }, { label: "基础信息", value: 1 },
{ label: "经营数据", value: 2 }, { label: "经营数据", value: 2 },
{ label: "在营商家", value: 3 },
{ label: "招商分析", value: 4 },
{ label: "收银监管", value: 5 },
{ label: "车辆归属", value: 6 },
{ label: "财务状况", value: 7 },
]; ];
// tab // tab
const selectTab = ref<number>(0); const selectTab = ref<number>(0);
@ -46,6 +52,14 @@ const isPrinting = ref<boolean>(false);
// //
const descObjRef = ref<any>(); const descObjRef = ref<any>();
const descListRef = ref<any>(); const descListRef = ref<any>();
//
const tradeObjRef = ref<any>();
//
const printingLoading = ref<boolean>(false);
//
const printingLoadingText = ref<string>("");
//
const bottomSelect = ref<boolean>(false);
onMounted(() => { onMounted(() => {
// //
@ -216,6 +230,15 @@ const handleConfigRequest = async (
return data.Result_Data; return data.Result_Data;
} else if (config.responseFormat === "List") { } else if (config.responseFormat === "List") {
return data.Result_Data.List; return data.Result_Data.List;
} else if (config.responseFormat === "nestingList") {
let resultNest: any = handleSetRowKeyTable(
wrapTreeNode(data.Result_Data.List)
);
//
if (config.calculateTotal) {
return handleGetListSumObj(resultNest, config.totalField);
}
return resultNest;
} }
} else { } else {
// //
@ -376,6 +399,122 @@ const handleConfigRequest = async (
} }
}; };
//
const handleGetListSumObj = (list: any, str: any) => {
// list str
if (str) {
//
let sumObj: any = {};
for (let key in str) {
if (key === "sum") {
if (str[key].indexOf(",") === -1) {
list.forEach((item: any) => {
if (item[str[key]]) {
if (sumObj[str[key] + "sum"]) {
sumObj[str[key] + "sum"] += Number(item[str[key]]);
} else {
sumObj[str[key] + "sum"] = Number(item[str[key]]);
}
}
});
} else {
let strList: any = str[key].split(",");
if (strList && strList.length > 0) {
strList.forEach((item: any) => {
list.forEach((subItem: any) => {
if (subItem[item]) {
if (sumObj[item + "sum"]) {
sumObj[item + "sum"] += Number(subItem[item]);
} else {
sumObj[item + "sum"] = Number(subItem[item]);
}
}
});
});
}
}
} else if (key === "greaterThan0") {
if (str[key].indexOf(",") === -1) {
list.forEach((item: any) => {
if (item[str[key]] > 0) {
if (sumObj[str[key] + "greaterThan0"]) {
sumObj[str[key] + "greaterThan0"] += 1;
} else {
sumObj[str[key] + "greaterThan0"] = 1;
}
}
});
} else {
let strList: any = str[key].split(",");
if (strList && strList.length > 0) {
strList.forEach((item: any) => {
list.forEach((subItem: any) => {
if (subItem[item]) {
if (sumObj[item + "greaterThan0"]) {
sumObj[item + "greaterThan0"] += 1;
} else {
sumObj[item + "greaterThan0"] = 1;
}
}
});
});
}
}
} else if (key === "lessThan0") {
if (str[key].indexOf(",") === -1) {
list.forEach((item: any) => {
if (item[str[key]] < 0) {
if (sumObj[str[key] + "lessThan0"]) {
sumObj[str[key] + "lessThan0"] += 1;
} else {
sumObj[str[key] + "lessThan0"] = 1;
}
}
});
} else {
let strList: any = str[key].split(",");
if (strList && strList.length > 0) {
strList.forEach((item: any) => {
list.forEach((subItem: any) => {
if (subItem[item]) {
if (sumObj[item + "lessThan0"]) {
sumObj[item + "lessThan0"] += 1;
} else {
sumObj[item + "lessThan0"] = 1;
}
}
});
});
}
}
}
}
console.log("sumObj", sumObj);
//
// for (let key in sumObj) {
// if (typeof sumObj[key] === "number") {
// sumObj[key] = formatNumber(sumObj[key]);
// }
// }
sumObj.dataLength = list.length;
//
let smallSum: number = 0;
list.forEach((item: any) => {
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
smallSum +=
subItem.children && subItem.children.length > 0
? subItem.children.length
: 0;
});
}
});
sumObj.smallSum = smallSum;
return sumObj;
}
};
// //
const handleGetReq = (configDetail: any, answer?: any) => { const handleGetReq = (configDetail: any, answer?: any) => {
let req: any = {}; let req: any = {};
@ -397,7 +536,8 @@ const handleGetReq = (configDetail: any, answer?: any) => {
ProvinceCode: "340000", ProvinceCode: "340000",
pushProvinceCode: "340000", pushProvinceCode: "340000",
}; };
// formatType 0 1 2 3 4: 5 6 7 8: 9 10: // formatType 0 1 2 3 4: 5 6 7 8: 9 10 11:
// formatType 10 now true|false afterOrBefore after|before count startOrEnd start|end dateType 1 YYYY 2 YYYY-MM 3 YYYY-MM-DD 4 YYYYMM
// fieldName resData value formatType0 haveDefault true使answer // fieldName resData value formatType0 haveDefault true使answer
// formatType7 value 1 2 3 // formatType7 value 1 2 3
if (realKey.formatType === 1) { if (realKey.formatType === 1) {
@ -438,8 +578,47 @@ const handleGetReq = (configDetail: any, answer?: any) => {
} else if (realKey.formatType === 8) { } else if (realKey.formatType === 8) {
req[key] = moment().format("MM"); req[key] = moment().format("MM");
} else if (realKey.formatType === 9) { } else if (realKey.formatType === 9) {
req[key] = moment().startOf("year").format("yyyyMM"); req[key] = moment().startOf("year").format("YYYYMM");
} else if (realKey.formatType === 10) { } else if (realKey.formatType === 10) {
if (realKey.now) {
if (realKey.startOrEnd === "start") {
req[key] = moment().startOf("month");
} else if (realKey.startOrEnd === "end") {
req[key] = moment().endOf("month");
}
if (realKey.dateType === 1) {
req[key] = moment(req[key]).format("YYYY");
} else if (realKey.dateType === 2) {
req[key] = moment(req[key]).format("YYYY-MM");
} else if (realKey.dateType === 3) {
req[key] = moment(req[key]).format("YYYY-MM-DD");
} else if (realKey.dateType === 4) {
req[key] = moment(req[key]).format("YYYYMM");
}
} else {
if (realKey.afterOrBefore === "after") {
req[key] = moment().add(realKey.count, "month");
} else if (realKey.afterOrBefore === "before") {
req[key] = moment().subtract(realKey.count, "month");
}
if (realKey.startOrEnd === "start") {
req[key] = moment(req[key]).startOf("month");
} else if (realKey.startOrEnd === "end") {
req[key] = moment(req[key]).endOf("month");
}
if (realKey.dateType === 1) {
req[key] = moment(req[key]).format("YYYY");
} else if (realKey.dateType === 2) {
req[key] = moment(req[key]).format("YYYY-MM");
} else if (realKey.dateType === 3) {
req[key] = moment(req[key]).format("YYYY-MM-DD");
} else if (realKey.dateType === 4) {
req[key] = moment(req[key]).format("YYYYMM");
}
}
} else if (realKey.formatType === 11) {
req[key] = props.currentServerPartDetail?.[realKey.fieldName] ?? ""; req[key] = props.currentServerPartDetail?.[realKey.fieldName] ?? "";
} }
} }
@ -520,6 +699,7 @@ const handleAnalyzeConfig = async (configDetail: any, answer: any) => {
// //
console.log("dsadsadasf", result); console.log("dsadsadasf", result);
console.log("OUTPUT_FORMAT", OUTPUT_FORMAT); console.log("OUTPUT_FORMAT", OUTPUT_FORMAT);
console.log("answer", answer);
let newResult: any; let newResult: any;
// responseType text json // responseType text json
@ -714,6 +894,7 @@ const handleChangeShow = (obj: any, addObj?: any) => {
isMoney: newObj.isMoney, isMoney: newObj.isMoney,
isRate: newObj.isRate, isRate: newObj.isRate,
showDic: newObj.showDic, showDic: newObj.showDic,
DicObj: newObj.DicObj,
}); });
} }
return columnsList; return columnsList;
@ -811,8 +992,9 @@ const handleConfigItemTable = async (
console.log("configObjconfigObjconfigObjconfigObj", configObj); console.log("configObjconfigObjconfigObjconfigObj", configObj);
// //
let timeStr: string = ""; let timeStr: string = "";
let OUTPUT_FORMAT: any;
if (configObj.OUTPUT_FORMAT) { if (configObj.OUTPUT_FORMAT) {
let OUTPUT_FORMAT = JSON.parse(configObj.OUTPUT_FORMAT); OUTPUT_FORMAT = JSON.parse(configObj.OUTPUT_FORMAT);
console.log("OUTPUT_FORMAT", OUTPUT_FORMAT); console.log("OUTPUT_FORMAT", OUTPUT_FORMAT);
if ( if (
(OUTPUT_FORMAT.DateFormat || OUTPUT_FORMAT.DateFormat === 0) && (OUTPUT_FORMAT.DateFormat || OUTPUT_FORMAT.DateFormat === 0) &&
@ -866,12 +1048,36 @@ const handleConfigItemTable = async (
...obj, ...obj,
haveTable: true, haveTable: true,
tableData: tableData, tableData: tableData,
ENABLE_CHART: configObj.ENABLE_CHART === 1,
ENABLE_PDF_EXPORT: configObj.ENABLE_PDF_EXPORT === 1,
ENABLE_VIEW_MORE: configObj.ENABLE_VIEW_MORE === 1,
columns: columns, columns: columns,
text: `为您查找${timeStr || ""}相关数据:`, text:
OUTPUT_FORMAT && !(tableData && tableData.length > 0)
? OUTPUT_FORMAT.noDataText
: `为您查找${timeStr || ""}相关数据:`,
}; };
isNewDialogLoading.value = false; isNewDialogLoading.value = false;
} }
} else {
let obj: any = JSON.parse(
JSON.stringify(dialogueList[dialogueList.length - 1])
);
dialogueList[dialogueList.length - 1] = {
...obj,
ENABLE_CHART: configObj.ENABLE_CHART === 1,
ENABLE_PDF_EXPORT: configObj.ENABLE_PDF_EXPORT === 1,
ENABLE_VIEW_MORE: configObj.ENABLE_VIEW_MORE === 1,
};
isNewDialogLoading.value = false;
} }
console.log(
"configObjconfigObjconfigObjconfigObjconfigObjconfigObjconfigObj",
configObj
);
// PDF
// else { // else {
// // text // // text
// let obj: any = JSON.parse( // let obj: any = JSON.parse(
@ -914,10 +1120,13 @@ const handleAnswerQuestions = async () => {
let searchRes: string = ""; let searchRes: string = "";
if (data.ServerpartId) { if (data.ServerpartId) {
// if (data.ShowMapPoint) {
emit("handleEnterySearch"); //
// emit("handleEnterySearch");
emit("handleLightServerpart", data.ServerpartId); //
emit("handleLightServerpart", data.ServerpartId);
}
if (data?.ServerpartInfoList && data?.ServerpartInfoList.length > 0) { if (data?.ServerpartInfoList && data?.ServerpartInfoList.length > 0) {
if (data?.AnalysisRuleId) { if (data?.AnalysisRuleId) {
} else { } else {
@ -1123,6 +1332,11 @@ const handleClickTab = async (value: number) => {
let searchObj: any = { let searchObj: any = {
1: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}基础信息`, 1: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}基础信息`,
2: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}经营数据`, 2: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}经营数据`,
3: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}在营商家`,
4: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}招商分析`,
5: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}收银监管`,
6: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}车辆归属`,
7: `${props.currentServerPartDetail?.SERVERPART_NAME || ""}财务状况`,
}; };
// //
handleAddDialogList(searchObj[value]); handleAddDialogList(searchObj[value]);
@ -1182,6 +1396,7 @@ const handleServerpartBasicInfo = async (config: any) => {
console.log("req", req); console.log("req", req);
// 驿 // 驿
let haveNull: boolean = handleHaveNullValue(req); let haveNull: boolean = handleHaveNullValue(req);
// //
let data: any; let data: any;
if (!haveNull) { if (!haveNull) {
@ -1239,44 +1454,100 @@ const handleServerpartBasicInfo = async (config: any) => {
}; };
// //
const handlePrintWord = async (element: any, htmlContent: any, speed = 20) => { const handlePrintWord = async (
// printWord; element: HTMLElement,
htmlContent: string,
speed = 20
) => {
return new Promise<void>((resolve) => { return new Promise<void>((resolve) => {
let i = 0; let i = 0;
const tempDiv = document.createElement("div"); const tempDiv = document.createElement("div");
tempDiv.innerHTML = htmlContent; tempDiv.innerHTML = htmlContent;
printWord.value = htmlContent; printWord.value = htmlContent;
const typeCharacter = () => {
const tagStack: HTMLElement[] = [element];
const typeCharacter = async () => {
if (i < tempDiv.innerHTML.length && isPrinting.value) { if (i < tempDiv.innerHTML.length && isPrinting.value) {
const char = tempDiv.innerHTML.charAt(i); const handleWaitRegex = /handleWait\((.*?)\)/;
if (char === "<") { const restContent = tempDiv.innerHTML.slice(i);
const tagEnd = tempDiv.innerHTML.indexOf(">", i); const match = handleWaitRegex.exec(restContent);
const tagContent = tempDiv.innerHTML.slice(i, tagEnd + 1);
element.innerHTML += tagContent; if (match && match.index === 0) {
i = tagEnd + 1; //
const param: string = match[1].trim().replace(/^["']|["']$/g, "");
await handleWait(param); // handleWait
i += match[0].length; // handleWait
} else { } else {
element.innerHTML += char === "\n" ? "<br>" : char; const char = tempDiv.innerHTML.charAt(i);
i++; if (char === "<") {
const tagEnd = tempDiv.innerHTML.indexOf(">", i);
const tagContent = tempDiv.innerHTML.slice(i, tagEnd + 1);
const isClosingTag = tagContent.startsWith("</");
if (isClosingTag) {
tagStack.pop();
} else {
const range = document.createRange();
const fragment = range.createContextualFragment(tagContent);
const newElement = fragment.firstChild as HTMLElement;
tagStack[tagStack.length - 1].appendChild(newElement);
if (!tagContent.endsWith("/>")) {
tagStack.push(newElement);
}
}
i = tagEnd + 1;
} else {
const textNode = document.createTextNode(
char === "\n" ? "\n" : char
);
tagStack[tagStack.length - 1].appendChild(textNode);
i++;
}
} }
setTimeout(typeCharacter, speed); setTimeout(typeCharacter, speed);
//
handleScrollToBottom(); handleScrollToBottom();
} else { } else {
isPrinting.value = false; isPrinting.value = false;
resolve(); // Promise resolved resolve();
} }
}; };
typeCharacter(); typeCharacter();
}); });
}; };
//
const handleWait = async (str: string) => {
return new Promise<void>((resolve) => {
printingLoading.value = true;
printingLoadingText.value = str;
setTimeout(() => {
printingLoading.value = false;
printingLoadingText.value = "";
resolve(); // resolve
}, 2000); // 1
});
};
// //
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
// //
const handleStopPrint = () => { const handleStopPrint = () => {
isPrinting.value = false; isPrinting.value = false;
}; };
//
const handleShowDataPie = () => {};
//
const handleGoSearchMore = () => {
window.open("http://saas.eshangtech.com/cloud/");
};
// pdf
const handleExportPDF = () => {};
// //
const props = defineProps<{ const props = defineProps<{
currentServerPartDetail: any; currentServerPartDetail: any;
@ -1342,6 +1613,26 @@ const handleGetFieldEnum = async () => {
descListRef.value = list; descListRef.value = list;
console.log("descObjRef.value", descObjRef.value); console.log("descObjRef.value", descObjRef.value);
} }
//
const BusinessTradeIdsList = await getFieldEnumTree({
FieldExplainField: "BusinessTradeIds",
});
if (BusinessTradeIdsList && BusinessTradeIdsList.length > 0) {
let BusinessTradeIdsObj: any = {};
BusinessTradeIdsList.forEach((item: any) => {
BusinessTradeIdsObj[item.value] = item.label;
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
BusinessTradeIdsObj[subItem.value] = subItem.label;
});
}
});
console.log("BusinessTradeIdsObj", BusinessTradeIdsObj);
tradeObjRef.value = BusinessTradeIdsObj;
}
}; };
// //
@ -1376,7 +1667,7 @@ const handleSetWarningData = async () => {
const handleSelectWarning = async (value: number) => { const handleSelectWarning = async (value: number) => {
handleAddDialogList( handleAddDialogList(
`${props.currentServerPartDetail?.SERVERPART_NAME || ""}${ `${props.currentServerPartDetail?.SERVERPART_NAME || ""}${
descObjRef.value[Number(value)] descObjRef.value[Number(value)] || "预警类型"
}` }`
); );
console.log("value", value); console.log("value", value);
@ -1480,6 +1771,11 @@ const handleSelectWarning = async (value: number) => {
emit("handleWarningMap", warningData); emit("handleWarningMap", warningData);
}; };
// tab
const handleShowTabList = () => {
bottomSelect.value = !bottomSelect.value;
};
defineExpose({ defineExpose({
handleGetBusinessTrade: () => { handleGetBusinessTrade: () => {
handleGetBusinessTrade(); handleGetBusinessTrade();
@ -1489,6 +1785,9 @@ defineExpose({
}, },
descObjRef, descObjRef,
descListRef, descListRef,
handleClickTab,
selectTab,
handleSelectWarning
}); });
</script> </script>
@ -1591,7 +1890,13 @@ defineExpose({
<template #default="scope"> <template #default="scope">
<template v-if="column.showDic"> <template v-if="column.showDic">
{{ descObjRef[Number(scope.row[column.prop])] }} {{
column.DicObj === "waringObj"
? descObjRef[Number(scope.row[column.prop])]
: column.DicObj === "tradeObjRef"
? tradeObjRef[Number(scope.row[column.prop])]
: ""
}}
</template> </template>
<template v-else> <template v-else>
{{ scope.row[column.prop] }} {{ scope.row[column.prop] }}
@ -1622,6 +1927,41 @@ defineExpose({
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div
class="moreOption"
v-if="
item.ENABLE_CHART ||
item.ENABLE_PDF_EXPORT ||
item.ENABLE_VIEW_MORE
"
>
<span
class="optionItem"
v-if="item.ENABLE_CHART"
@click="handleShowDataPie()"
>查看数据图表</span
>
<span
class="optionItem"
v-if="item.ENABLE_CHART"
@click="handleGoSearchMore()"
>查看更多</span
>
<span
class="optionItem"
v-if="item.ENABLE_CHART"
@click="handleExportPDF()"
>导出为PDF</span
>
</div>
<div
style="width: 100%; height: 80px"
v-if="printingLoading && index === dialogueList.length - 1"
v-loading="printingLoading"
:element-loading-text="printingLoadingText"
></div>
</div> </div>
<img <img
@ -1654,6 +1994,37 @@ defineExpose({
@click="handleSubmit()" @click="handleSubmit()"
/> />
</div> </div>
<div class="moreSelect">
<div v-if="!bottomSelect" class="filterFixed">
<img
class="filterIcon"
src="@/assets/ai/dropDown.png"
@click="handleShowTabList()"
/>
</div>
<div class="filterBox" v-if="bottomSelect">
<div class="filterList">
<div
v-for="(item, index) in clickTabList"
:key="index"
:class="
selectTab === item.value
? 'filterItem selectFilterItem'
: 'filterItem'
"
@click="handleClickTab(item.value)"
>
{{ item.label || "" }}
</div>
</div>
<img
class="filterIcon"
src="@/assets/ai/pullUp.png"
@click="handleShowTabList()"
/>
</div>
</div>
</div> </div>
</div> </div>

View File

@ -5,6 +5,14 @@
.el-form-item__label{ .el-form-item__label{
color: #fff!important; color: #fff!important;
} }
.el-form-item__content{
.el-select{
.el-select__wrapper{
background-color: transparent!important;
}
}
}
} }
.moreSelectBox{ .moreSelectBox{
margin-right: 8px; margin-right: 8px;

View File

@ -315,6 +315,10 @@ const handleClickPointLayer = async (detail: any) => {
// //
let nowSelect: string = RightSearchBoxRef.value.selectFilterList; let nowSelect: string = RightSearchBoxRef.value.selectFilterList;
await handleChangeMapShow(nowSelect); await handleChangeMapShow(nowSelect);
// //
// let selectTab: any = RobotDialogueBoxRef.value.selectTab;
// RobotDialogueBoxRef.value.handleClickTab(selectTab);
}; };
// //
@ -1145,7 +1149,11 @@ const handleGetBusinessFormat = async () => {
// //
const handleWarningData = async () => { const handleWarningData = async () => {
await RobotDialogueBoxRef.value.handleSetWarningData(); if (currentServerPartDetail) {
RobotDialogueBoxRef.value.handleSelectWarning()
} else {
await RobotDialogueBoxRef.value.handleSetWarningData();
}
}; };
// //