diff --git a/pages/index/detail.vue b/pages/index/detail.vue
index 7b4e1e9..91d6cd8 100644
--- a/pages/index/detail.vue
+++ b/pages/index/detail.vue
@@ -60,7 +60,7 @@
>
@@ -83,9 +85,55 @@
class="btn"
@click="handleBtn(text)"
v-for="(text, index) in item.options"
+ :key="index"
>{{ text }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 确认
+
@@ -175,10 +223,17 @@ export default {
allContent: "",
params: {},
tabkey: 0,
+ radiovalue1: "",
+ checkboxValue1: [],
};
},
onLoad(options) {
let params = options;
+ // params.deptId = "3702000000";
+ // params.id = "37020017609";
+ // params.sectionId = "37020017609";
+ // params.roadName = "023县道";
+ // params.taskId = "000001";
this.params = params;
let str = "";
if (params.roadName) {
@@ -192,7 +247,8 @@ export default {
if (params.id == 12121212) {
this.queryChat("开始隐患排查," + str);
} else {
- this.SSE("开始隐患排查," + str, "1");
+ // this.SSE("开始隐患排查," + str, "1");
+ this.queryChat("开始隐患排查," + str);
// if(this.msgListA.length==0){
// this.SSE("开始隐患排查," + str, '1')
// }else{
@@ -221,13 +277,13 @@ export default {
// 建立SSE长连接
SSE(voiceText, answerId) {
const ctrl = new AbortController();
- console.log(ctrl.signal);
fetchEventSource($.chatUrl + "/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: ["text/event-stream", "application/json"],
},
+
body: JSON.stringify({
voiceText,
sceneFlag: "",
@@ -236,11 +292,11 @@ export default {
userId: this.params.userId,
deptId: this.params.deptId,
stream: true,
- type: '1',
+ type: "1",
id: this.params.id,
taskId: this.params.taskId,
sectionId: this.params.sectionId,
- sectionType: this.params.sectionType,
+ // sectionType: this.params.sectionType,
}),
signal: ctrl.signal,
openWhenHidden: true,
@@ -253,6 +309,7 @@ export default {
console.log(res.result.data.tabkey);
console.log(res.result.data);
this.tabkey = res.result.data.tabkey;
+ this.optionType = res.result.data?.optionType;
if (this.tabkey - 1 != this.active) {
this.active = this.tabkey - 1 > 0 ? this.tabkey - 1 : 0;
}
@@ -261,6 +318,8 @@ export default {
{
answerId,
data: res.result.data.content,
+ optionType: res.result.data?.optionType,
+ answerOptions: res.result.data?.answerOptions || [],
},
];
} else {
@@ -270,6 +329,10 @@ export default {
//最后一个是回答
this.msgList[this.msgList.length - 1].data +=
res.result.data.content;
+ this.msgList[this.msgList.length - 1].optionType =
+ res.result.data?.optionType;
+ this.msgList[this.msgList.length - 1].answerOptions =
+ res.result.data?.answerOptions || [];
} else {
//最后一个是问题
this.msgList = [
@@ -277,6 +340,8 @@ export default {
{
answerId: "1",
data: res.result.data.content,
+ optionType: res.result.data?.optionType,
+ answerOptions: res.result.data?.answerOptions || [],
},
];
}
@@ -305,6 +370,7 @@ export default {
async queryChat(voiceText) {
// console.log(voiceText,"voiceText");
this.loading = true;
+
const [err, res] = await uni.request({
// url: 'http://10.16.3.159:8777/api/local_doc_qa/local_doc_chat',
url: $.chatUrl + "/chat",
@@ -318,13 +384,15 @@ export default {
data: {
voiceText,
sceneFlag: "",
- sessionId: this.sessionId,
- id: this.id,
+ sessionId: "",
multiType: "",
- userId: "admin1",
- deptId: "3702000000",
- type: 1,
+ userId: this.params.userId,
+ deptId: this.params.deptId,
stream: false,
+ type: "1",
+ id: this.params.id,
+ taskId: this.params.taskId,
+ sectionId: this.params.sectionId,
// "user_id": "zzp",
// "kb_ids": ["KBa80ea15e786241eca70a20f136f4e34c"],
// "question": "隐患排查流程是什么",
@@ -332,6 +400,7 @@ export default {
// "history": []
},
});
+
if (res && res.data && res.data.code == 200) {
// console.log('request success', res.data)
const { result = {} } = res.data;
@@ -343,6 +412,7 @@ export default {
this.changeMsgList(
data.answerId || "1",
data.content,
+ data.optionType,
data.answerOptions
);
}
@@ -375,15 +445,21 @@ export default {
this.scrollBottom();
},
scrollBottom() {
- this.$nextTick(() => {
- const height =
- this.$refs.scrollView &&
- this.$refs.scrollView.$refs &&
- this.$refs.scrollView.$refs.content
- ? this.$refs.scrollView.$refs.content.scrollHeight
- : 0;
- this.scrollTop = height;
- });
+ uni.createSelectorQuery().in(this).select('#scroll-view-content').boundingClientRect((res)=>{
+ let top = res.height-this.scrollViewHeight;
+ if(top>0){
+ this.scrollTop=top;
+ }
+ }).exec()
+ // this.$nextTick(() => {
+ // const height =
+ // this.$refs.scrollView &&
+ // this.$refs.scrollView.$refs &&
+ // this.$refs.scrollView.$refs.content
+ // ? this.$refs.scrollView.$refs.content.scrollHeight
+ // : 0;
+ // this.scrollTop = height;
+ // });
},
// 发送
handleSend(text) {
@@ -400,14 +476,17 @@ export default {
this.queryChat(this.inputValue || text);
this.scrollBottom();
} else {
- this.addQuestion(this.inputValue || text, "0");
- this.SSE(this.inputValue || text, "0");
+ // this.addQuestion(this.inputValue || text, "0");
+ // this.SSE(this.inputValue || text, "0");
+ this.changeMsgList("0", this.inputValue || text);
+ this.queryChat(this.inputValue || text);
+ this.scrollBottom();
}
this.inputValue = "";
}
},
// 更新列表信息
- changeMsgList(answerId, data, answerOptions) {
+ changeMsgList(answerId, data, optionType, answerOptions) {
let id = 1;
if (this.msgList.length > 0) {
id = this.msgList[this.msgList.length - 1].id + 1;
@@ -417,7 +496,6 @@ export default {
let newdata = "";
let index = 0;
const timer = setInterval(() => {
- console.log(this.msgList);
newdata = newdata += data[index];
if (this.msgList?.filter((item) => item.id == id).length == 0) {
this.msgList = [
@@ -442,10 +520,20 @@ export default {
: 0;
this.scrollTop = height;
});
+
if (newdata == data) {
- this.msgList[this.msgList.length - 1].options = answerOptions;
+ if (optionType == 0 || optionType == 1) {
+ this.msgList[this.msgList.length - 1].optionType = optionType;
+ this.msgList[this.msgList.length - 1].answerOptions =
+ answerOptions || [];
+ this.msgList[this.msgList.length - 1].checkboxValue1 = [];
+ this.msgList[this.msgList.length - 1].radiovalue1 = "";
+ } else {
+ this.msgList[this.msgList.length - 1].options = answerOptions;
+ }
clearInterval(timer);
}
+
}, 50);
} else {
this.msgList = [
@@ -492,24 +580,53 @@ export default {
count: 6, //默认9
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["album"], //从相册选择
- success: (res) => {
+ success: async (res) => {
+ console.log(res);
if (res.tempFilePaths && res.tempFilePaths.length) {
let str = "";
+ let jsonArr = [];
for (let i = 0; i < res.tempFilePaths.length; i++) {
- str += ``;
+ const result = await this.uploadFilePromise(res.tempFilePaths[i]);
+ let json = JSON.parse(result);
+ str += ``;
+ jsonArr.push(json.result);
}
+ console.log(str);
if (this.id == 12121212) {
this.changeMsgList("0", str);
this.queryChat(res.tempFilePaths);
} else {
- this.addQuestion(str, "0");
- this.SSE(res.tempFilePaths, "0");
+ // this.addQuestion(str, "0");
+ // this.SSE(jsonArr, "0");
+ this.changeMsgList("0", str);
+ this.queryChat(jsonArr);
}
}
},
});
},
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = uni.uploadFile({
+ url: this.$.baseUrl + "/hiddenDanger/ftp/uploadFileToFtp", // 仅为示例,非真实的接口地址
+ filePath: url,
+ name: "file",
+ success: (res) => {
+ resolve(res.data);
+ },
+ });
+ });
+ },
+ handleGroup(item) {
+ let text = "";
+ if (this.optionType) {
+ text = item.checkboxValue1.join(",");
+ } else {
+ text = item.radiovalue1;
+ }
+ this.handleSend(text);
+ },
},
};
diff --git a/pages/knowledge/index.vue b/pages/knowledge/index.vue
index 868f753..44dff88 100644
--- a/pages/knowledge/index.vue
+++ b/pages/knowledge/index.vue
@@ -34,7 +34,7 @@
@@ -423,8 +423,8 @@ export default {
multiType: "",
userId: "admin1",
deptId: "3702000000",
- type: 1,
- stream: false,
+ type: '0',
+ stream: true,
// "user_id": "zzp",
// "kb_ids": ["KBa80ea15e786241eca70a20f136f4e34c"],
// "question": "隐患排查流程是什么",
@@ -592,24 +592,42 @@ export default {
count: 6, //默认9
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["album"], //从相册选择
- success: (res) => {
+ success: async (res) => {
+ console.log(res)
if (res.tempFilePaths && res.tempFilePaths.length) {
let str = "";
+ let jsonArr = []
for (let i = 0; i < res.tempFilePaths.length; i++) {
- str += ``;
+ const result = await this.uploadFilePromise(res.tempFilePaths[i]);
+ let json = JSON.parse(result)
+ str += ``;
+ jsonArr.push(json.result)
}
+ console.log(str)
if (this.id == 12121212) {
this.changeMsgList("0", str);
this.queryChat(res.tempFilePaths);
} else {
this.addQuestion(str, "0");
- this.SSE(res.tempFilePaths, "0");
+ this.SSE(jsonArr, "0");
}
}
},
});
},
+ uploadFilePromise(url) {
+ return new Promise((resolve, reject) => {
+ let a = uni.uploadFile({
+ url: this.$.baseUrl + '/hiddenDanger/ftp/uploadFileToFtp', // 仅为示例,非真实的接口地址
+ filePath: url,
+ name: 'file',
+ success: (res) => {
+ resolve(res.data)
+ }
+ });
+ })
+ },
},
};
diff --git a/pages/map/index.vue b/pages/map/index.vue
index 0508ea7..ccc815a 100644
--- a/pages/map/index.vue
+++ b/pages/map/index.vue
@@ -36,7 +36,7 @@
智能排查
- 人工排查
+ 人工排查
查看排查详情
@@ -46,7 +46,7 @@
更换
智能排查
- 人工排查
+ 人工排查
查看排查详情
@@ -416,6 +416,7 @@ export default {
},
handleCheck(v) {
this.show = false;
+ this.show2 = false;
if (v == 1) {
// let json = {
// name: "023县道",