|
@@ -90,16 +90,18 @@ const handleChatDetail = async ({ sessionId }) => {
|
|
|
const { data } = await chatApi.getAnswerHistoryDetail({ sessionId });
|
|
|
|
|
|
let echartData = [];
|
|
|
-
|
|
|
+ let whichWay = null;
|
|
|
chatDataSource.value = data.map(item => {
|
|
|
if ( item.remark ) {
|
|
|
- echartData = item.echartWithTableData = formatData(JSON.parse(item.remark));
|
|
|
+ const remark = JSON.parse(item.remark);
|
|
|
+ whichWay = remark.whichWay;
|
|
|
+ echartData = item.echartWithTableData = formatData(remark);
|
|
|
}
|
|
|
|
|
|
return { ...item, loading: false };
|
|
|
})
|
|
|
|
|
|
- echartData.length && createEchart(echartData);
|
|
|
+ echartData.length && createEchart(echartData, whichWay);
|
|
|
|
|
|
currenSessionId.value = sessionId;
|
|
|
|
|
@@ -138,8 +140,6 @@ const onRegenerate = async (question, options) => {
|
|
|
innerLoading: false
|
|
|
})
|
|
|
|
|
|
- console.log( "chatDataSource", chatDataSource.value );
|
|
|
-
|
|
|
scrollToBottomIfAtBottom();
|
|
|
}
|
|
|
}
|
|
@@ -192,7 +192,7 @@ const handleSubmit = async (question, params) => {
|
|
|
|
|
|
if (isChart.value) {
|
|
|
const { data } = await orderApi.postOrderChart(params);
|
|
|
- const reuslt = formatData(data);
|
|
|
+ const reuslt = formatData({...data, whichWay: workOrderParams.value.whichWay});
|
|
|
|
|
|
option.echartWithTableData = reuslt;
|
|
|
}
|
|
@@ -210,11 +210,11 @@ const handleSubmit = async (question, params) => {
|
|
|
innerLoading: false,
|
|
|
})
|
|
|
|
|
|
- createEchart(option.echartWithTableData);
|
|
|
+ createEchart(option.echartWithTableData, workOrderParams.value.whichWay);
|
|
|
|
|
|
scrollToBottom();
|
|
|
|
|
|
- onRegenerate(question, params)
|
|
|
+ onRegenerate(question, params);
|
|
|
|
|
|
}, 2 * 1000);
|
|
|
}
|
|
@@ -256,14 +256,13 @@ const handleCreateOrder = async () => {
|
|
|
}
|
|
|
|
|
|
// 创建echart图形
|
|
|
-const createEchart = (echartData) => {
|
|
|
-
|
|
|
+const createEchart = (echartData, whichWay) => {
|
|
|
setTimeout(() => {
|
|
|
- echartData.forEach(({ key, xAxisData, yAxisData }) => {
|
|
|
+ echartData.forEach(({ key, xAxisData, yAxisData, }) => {
|
|
|
const dom = document.getElementById(key);
|
|
|
chartInstance[key] = echarts.init(dom, null, { width: 680, height: 300 });
|
|
|
|
|
|
- const option = getOrderAreaOptions({ xAxisData, yAxisData });
|
|
|
+ const option = getOrderAreaOptions({ xAxisData, yAxisData, whichWay });
|
|
|
|
|
|
chartInstance[key].setOption(option);
|
|
|
})
|
|
@@ -277,16 +276,28 @@ const formatData = (data) => {
|
|
|
csGroup: '出水指标',
|
|
|
hyGroup: '化验指标'
|
|
|
}
|
|
|
- return Object.entries(data).map(([key, value]) => {
|
|
|
+ const { whichWay, jsGroup, csGroup, hyGroup } = data;
|
|
|
+ return Object.entries({jsGroup, csGroup, hyGroup}).map(([key, value]) => {
|
|
|
if ( value.length ) {
|
|
|
const [ xAxisData, yAxisData ] = formatEchart(value);
|
|
|
const [ item ] = value;
|
|
|
- const columns = Object.keys(item).map(k => ({
|
|
|
- title: ORDER_OPTION_ENUM[k],
|
|
|
- key: k,
|
|
|
- width: '150px',
|
|
|
- align: 'center',
|
|
|
- }))
|
|
|
+ const columns = Object.keys(item).map(k => {
|
|
|
+ const wihteKeyList = ['jsSlq', 'csSlqc'];
|
|
|
+ let unit = '';
|
|
|
+
|
|
|
+ if(wihteKeyList.includes(k)) {
|
|
|
+ unit = whichWay === 1? '(m³/h)' : '(m³/d)';
|
|
|
+ } else if (k !== 'time') {
|
|
|
+ unit= '(mg/L)';
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ title: ORDER_OPTION_ENUM[k] + unit,
|
|
|
+ key: k,
|
|
|
+ width: '150px',
|
|
|
+ align: 'center'
|
|
|
+ }
|
|
|
+ })
|
|
|
const data = value.map(item => {
|
|
|
Object.entries(item).forEach(([k, v]) => {
|
|
|
!v && v!=0 && (item[k] = '-');
|
|
@@ -401,7 +412,7 @@ onUnmounted(() => {
|
|
|
<NDataTable
|
|
|
bordered
|
|
|
size="small"
|
|
|
- :scroll-x="item.columns.length > 5 ? 1200: 670"
|
|
|
+ :scroll-x="item.columns.length > 4 ? 1200: 670"
|
|
|
:max-height="250"
|
|
|
:single-line="false"
|
|
|
:columns="item.columns"
|