农三轮代码提交

main
sunjianxi 2 years ago
parent 1b5d5a0509
commit 86037a4601
  1. 29
      components/tabbar.vue
  2. 125
      components/v-voice.vue
  3. 35
      pages.json
  4. 170
      pages/agricultural3W/date-search.vue
  5. BIN
      pages/agricultural3W/defaultImg.png
  6. 534
      pages/agricultural3W/index.vue
  7. 418
      pages/index/detail.vue
  8. BIN
      pages/investigation/defaultImg.png
  9. 905
      pages/investigation/detail.vue
  10. 15
      pages/investigation/task.vue
  11. 665
      pages/investigation/warningDetail.vue
  12. 306
      pages/knowledge/index.vue
  13. 7
      pages/logIn/logIn.vue
  14. 2
      pages/map/index.vue
  15. BIN
      static/nav/agricultural3W.png
  16. BIN
      static/nav/agricultural3W_active.png

@ -1,7 +1,7 @@
<template>
<view>
<u-tabbar activeColor="#2294E6" :value="name" :fixed="true" :placeholder="false" :safeAreaInsetBottom="false">
<u-tabbar-item :text="item.text" :name='item.text' @click="to(item)" v-for="(item,index) in list">
<u-tabbar-item :text="item.text" :name='item.text' @click="to(item)" v-for="(item,index) in list" style="width: 16.66%;">
<image class="u-page__item__slot-icon" slot="active-icon" :src="item.selectedIconPath"></image>
<image class="u-page__item__slot-icon" slot="inactive-icon" :src="item.iconPath"></image>
</u-tabbar-item>
@ -63,22 +63,40 @@
"text": "治理",
role: ['领导', '治理人员']
},
//
agricultural3W: {
"pagePath": "/pages/agricultural3W/index",
"iconPath": "/static/nav/agricultural3W.png",
"selectedIconPath": "/static/nav/agricultural3W_active.png",
"text": "农三轮",
role: ['村干部农三轮', '中队民警农三轮']
},
mine: {
"pagePath": "/pages/mine/index",
"iconPath": "/static/nav/mine.png",
"selectedIconPath": "/static/nav/mine_active.png",
"text": "我的",
role: ['领导', '排查人员', '治理人员']
role: ['领导', '排查人员', '治理人员', '村干部农三轮', '中队民警农三轮']
},
value: 0
}
},
computed: {
list() {
const routerArr = [this.home, this.approve, this.investigation, this.governance, this.mine]
let routerArr = [this.home, this.approve, this.investigation, this.governance, this.agricultural3W, this
.mine
]
const myRoles = this.$.getData('userInfo').role || []
return routerArr.filter(item => item.role.some(role => myRoles.includes(role)))
// return routerArr
routerArr = routerArr.filter(item => item.role.some(role => myRoles.includes(role)))
// if (routerArr.length > 5) {
// setTimeout(function() {
// let domList = document.getElementsByClassName('u-tabbar-item')
// for (let i = 0; i < domList.length; i++) {
// domList[i].style.width = '16.66%'
// }
// }, 0);
// }
return routerArr
}
},
created() {
@ -123,7 +141,6 @@
this.list.push(this.mine)
}
if (!role.includes('排查人员') && !role.includes('领导')) {
this.list.push(this.home)
this.list.push(this.approve)
this.list.push(this.investigation)

@ -1,5 +1,6 @@
<template>
<view class="input-content-com" :class="pointDown ? 'input-content-com-bg': ''">
<view class="input-content-com" :class="pointDown ? 'input-content-com-bg': ''" :textInfo="textInfo"
:change:textInfo="renderjs.getTextInfo" :taskId="taskId" :change:taskId="renderjs.getTaskId">
<view class="voice-content" v-if="pointDown">
<template v-if="speech">
<view class="voice-text font-family-SM">
@ -30,17 +31,22 @@
<view class="input-wrapper" :class="{ 'input-wrapper-expanded': isExpanded }">
<view class="topContent">
<uni-icons class="uni-icon" type="mic" size="30" @click="handleChange"></uni-icons>
<input ref="inputRef" v-show="!showVoice" class="uni-input"
<!-- <input ref="inputRef" v-show="!showVoice" class="uni-input"
:placeholder="disabled ? '请等待回复结束' : '请输入内容'" :value="inputValue"
@confirm="$emit('confirm', $event)" @input="onKeyInput" :disabled="disabled" />
@confirm="$emit('confirm', $event)" @input="onKeyInput" :disabled="disabled" /> -->
<input ref="inputRef" v-show="!showVoice" class="uni-input"
:placeholder="disabled ? '请等待回复结束' : '请输入内容'" :value="inputValue" @confirm="setTextInfo"
@input="onKeyInput" :disabled="disabled" />
<view class="voice-btn" v-show="showVoice" @touchstart="handleStart" @touchend="handleEnd"
@touchcancel="handleCancel">
{{pointDown ? '松开 结束' : '按住 说话'}}
</view>
<uni-icons v-if="showUpload" class="uni-icon" type="plus" size="30" @click="isExpanded = !isExpanded"
:disabled="disabled"></uni-icons>
<uni-icons v-if="showUpload &&!inputValue" class="uni-icon" type="plus" size="30"
@click="isExpanded = !isExpanded" :disabled="disabled"></uni-icons>
<button v-else class="sendBtn" @click="setTextInfo" :disabled="disabled">发送</button>
</view>
<!-- <view style='font-size: 10rpx;width: 100%;text-align: center;color: #fff;position: absolute;bottom: 0%;transform:scale(0.7)'>
内容由AI大模型生成请仔细甄别</view> -->
<view v-if="isExpanded" class="expanded">
<view @click="chooseImage" class="expandedItem">
<uni-icons class="camera-icon" type="image" size="28"></uni-icons>
@ -73,7 +79,11 @@
showUpload: {
type: Boolean,
default: true
}
},
taskId: {
type: String,
default: ''
},
},
computed: {
inputValue: {
@ -102,9 +112,11 @@
wsStatus: "CLOSED",
timer: null,
speeching: false,
closeing: false
closeing: false,
textInfo: '',
};
},
mounted() {},
onLoad() {},
onShow() {
console.log('SHOW')
@ -113,6 +125,9 @@
console.log('HIDE')
},
methods: {
setTextInfo() {
this.textInfo = this.inputValue
},
handleChange() {
if (this.disabled) {
return
@ -165,6 +180,7 @@
},
chooseImage() {
this.$emit('imageChoose')
this.isExpanded = false
// uni.chooseImage({
// count: 6, //9
// sizeType: ["original", "compressed"], //
@ -229,11 +245,90 @@
resultMsg(e) {
this.msg = e.replace(' ', '')
console.log('resultMsg', e);
},
propsConfirm(
text
) {
this.$emit('confirm',
text
)
},
dataSend(ev) {
this.$emit('dataSend',
ev,
)
}
}
};
</script>
<script module="renderjs" lang="renderjs">
import $ from "../common/globalJs/globalJs.js";
import {
fetchEventSource
} from "@microsoft/fetch-event-source";
export default {
data() {
taskId:''
},
mounted() {},
methods: {
getTaskId(taskId) {
this.taskId = taskId
},
getTextInfo(info) {
if (info) {
this.newSSE(info, '1')
}
},
newSSE(voiceText, answerId = '') {
console.log('输入框SSE触发', voiceText)
this.$ownerInstance.callMethod('propsConfirm',
voiceText
);
// const ctrl = new AbortController();
fetchEventSource($.chatUrl + "/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: ["text/event-stream", "application/json"],
},
body: JSON.stringify({
voiceText,
deptId: "3702000000",
id: "37020017407",
multiType: "",
sceneFlag: "",
stream: true,
type: this.taskId ? '1' : '0',
userId: "admin1",
taskId:this.taskId
}),
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
},
onmessage: (ev) => {
//
this.$ownerInstance.callMethod('dataSend', ev);
},
onclose: () => {
console.log('输入框SSE关闭');
this.loading = false;
this.expandedFlag = false
if (this.isExpanded) {
this.isExpanded = !this.isExpanded;
}
},
onerror(error) {
console.log("error", error);
throw error;
},
});
},
}
}
</script>
<style lang="scss">
@keyframes radius-animation {
100% {
@ -390,7 +485,7 @@
.uni-input {
height: 56rpx;
height: 66rpx;
line-height: 56rpx;
font-size: 30rpx;
padding: 0rpx 10rpx;
@ -420,7 +515,7 @@
box-sizing: border-box;
border-top: 1px solid #e2e4e9;
bottom: 1px solid #e2e4e9;
padding: 20rpx;
padding: 15rpx 20rpx;
background: rgba(240, 242, 247, 1);
.topContent {
@ -452,6 +547,14 @@
height: 60rpx;
}
}
.sendBtn {
background: #2663BF;
color: #fff;
font-size: 32rpx;
padding: 14rpx 20rpx;
border-radius: 10rpx;
}
}
}
</style>

@ -70,6 +70,28 @@
"navigationBarTextStyle": "white"
}
},
{
"path": "pages/investigation/detail",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "农三轮详情",
//
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/investigation/warningDetail",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "农三轮预警处理",
//
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#FFFFFF",
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/investigation/complete",
"style": {
@ -133,6 +155,13 @@
"navigationBarTextStyle": "black"
}
},
{
"path": "pages/agricultural3W/index",
"style": {
"navigationBarTitleText": "农三轮",
"navigationStyle": "custom"
}
},
{
"path": "pages/mine/index",
"style": {
@ -243,6 +272,12 @@
// "selectedIconPath": "static/nav/lean_active.png",
// "text": "治理"
},
{
"pagePath": "pages/agricultural3W/index"
// "iconPath": "static/nav/mine.png",
// "selectedIconPath": "static/nav/mine_active.png",
// "text": "农三轮"
},
{
"pagePath": "pages/mine/index"
// "iconPath": "static/nav/mine.png",

@ -0,0 +1,170 @@
<template>
<view class="search-content">
<view class="search-box">
<view class="tab-content">
<view :class="{
'tab-item': true,
'tab-item-active': tabActive == item.active
}" v-for="(item, index) in tabList" :key="item.active" @click="handleClick(item.active)" style="display: flex;">
<view>
{{item.name}}
</view>
<view style="margin-left: 10rpx;">
{{item.num}}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import VdatePicker from '@/components/u-view/v-date-picker/index.vue'
export default {
name: 'date-search',
components: {
VdatePicker
},
props: {
tabList: {
type: Array,
default: () => ([])
},
tabActive: {
type: [Number, String],
default: 0
},
startDate: {
type: String,
default: ''
},
endDate: {
type: String,
default: ''
}
},
computed: {
start: {
get() {
return this.startDate
},
set(value) {
this.$emit('update:startDate', value)
}
},
end: {
get() {
return this.endDate
},
set(value) {
this.$emit('update:endDate', value)
}
}
},
data() {
return {
timeShow: false,
}
},
methods: {
formatter(type, value) {
if (type === 'year') {
return `${value}`
}
if (type === 'month') {
return `${value}`
}
if (type === 'day') {
return `${value}`
}
return value
},
handleClick(active) {
if (this.tabActive != active) {
this.$emit('tabChange', active)
}
},
handleOpenDate() {
this.timeShow = true
},
getCurTimeForX() {
return (new Date()).getTime()
},
getMinTimeForX() {
return this.$moment('2021-01-01').valueOf()
},
formatTime(time) {
return this.$moment(time).format('YYYY-MM-DD')
},
handleOpen(key) {
this.$nextTick(() => {
this[key] = true
})
},
handleClear(key) {
this[key] = ''
this.$nextTick(() => {
if (!this.endDate && !this.startDate) {
this.$emit('handleSearch')
}
})
},
changeDate(timeArr) {
const [start, end] = timeArr
this.start = start
this.end = end
this.timeShow = false
this.$nextTick(() => {
this.$emit('handleSearch')
})
},
}
}
</script>
<style lang="scss">
.search-content {
padding-top: 12px;
font-size: 14px;
.search-box {
display: flex;
align-items: center;
justify-content: space-between;
height: 27px;
}
.tab-content {
display: flex;
align-items: center;
.tab-item {
border-radius: 4px;
padding: 4px 10px;
background: rgba(208, 222, 245, 1);
margin-right: 12px;
color: rgba(54, 63, 77, 1);
&-active {
background: rgba(60, 109, 196, 1);
color: rgba(255, 255, 255, 1);
}
}
}
.date-btn {
display: flex;
align-items: center;
&-icon {
width: 16px;
height: 16px;
margin-left: 5px;
}
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -0,0 +1,534 @@
<template>
<view id="page">
<view class="Width100 Box BorderBox">
<view class="Content BorderBox Width100">
<top-title :is-show-left="false" :title="'农三轮'" :rightWidth='60' class="custom_bg">
<template slot="right">
<image :src="$.imgSrc + '/mine/plus.png'" mode="aspectFit"
@click="$.open('/pages/investigation/detail')" class="InlineBlock imgIcon"></image>
</template>
</top-title>
</view>
<view class="query-form">
<view class="search-box">
<u-search placeholder="请输入名称" v-model="searchValue" actionText="" :showAction="false"
@search="handleSearch" @clear="handleSearch"></u-search>
</view>
<view class="tab">
<view v-for="tabItem in tabList" :key="tabItem.active" :class="{
'tab-item': true,
'active': tabItem.active == approve
}" @click="handleTabChange(tabItem.active)">
<text>{{tabItem.name}}</text>
</view>
</view>
</view>
<view class="Content MarginAuto BorderBox">
<dateSearch :tabList="approve == 1? tabTypeList1:tabTypeList2" :tabActive="classification"
:startDate.sync="startDate" :endDate.sync="endDate" @handleSearch="handleSearch"
@tabChange="queryTypeChange" />
<no-data v-if="!list.length" />
<view v-else class="List Width100 BorderBox">
<view class="Unit FontBold BorderBox Width100 MarginT_30rpx BG_FFFFFF" v-for="item in list"
:key='item.id' @click='handleClick(item)' v-if="approve == 1">
<image class="itemImg" :src="item.drivingImg ||require('./defaultImg.png')" mode="widthFix">
</image>
<view class="right">
<view class="title carNumber">{{ item.vehicleLicense }}</view>
<text class="title">{{ item.driverName }}</text>
<view class="type">
<text>{{ vehicleTypeConvert(item.vehicleType) }}</text>
<text style="margin-right: 5rpx;">{{ item.streetCommunity || '--' }}</text>
<text>{{ item.villageCommunity || '--' }}</text>
</view>
</view>
</view>
<view class="Unit FontBold BorderBox Width100 MarginT_30rpx BG_FFFFFF" v-for="item in list"
:key='item.warningId' v-if="approve == 2" @click='handleWarningClick(item)'>
<image class="itemImg" :src="item.drivingImg ||require('./defaultImg.png')" mode="widthFix">
</image>
<view class="right">
<view class="title carNumber">{{ item.vehicleLicense }}</view>
<text class="title">{{ item.illegalActivities }}</text>
<view class="type" style="display: flex;justify-content: space-between;">
<text>{{ item.driverName || '--' }}</text>
<text>{{ item.warningTimeFormat || '--' }}</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="loadmorestatus" v-show="!isEmpty" />
</view>
</view>
<Tabbar name="农三轮" v-if="tabbarShow"></Tabbar>
</view>
</template>
<script>
import NoData from "../../components/no-data.vue";
import TopTitle from "../../components/top-title";
import tabFun from '@/libs/function/tabbar.js'
import Tabbar from "../../components/tabbar.vue";
import dateSearch from "./date-search.vue";
export default {
//
components: {
NoData,
TopTitle,
Tabbar,
dateSearch
},
data() {
return {
// js
list: [],
isEmpty: false,
isMore: true,
pageNum: 1,
pageSize: 10,
searchValue: '',
classification: '0',
approve: '1',
status: '60',
startDate: '',
endDate: '',
tabbarShow: true,
tabList: [{
name: '信息登记',
active: '1',
},
{
name: '预警处理',
active: '2',
},
],
tabTypeList1: [{
name: '全部',
active: '0',
num: 0,
},
{
name: '已补录',
active: '1',
num: 0,
},
{
name: '未补录',
active: '2',
num: 0,
},
],
tabTypeList2: [],
loadmorestatus: 'loading',
enumList: {}
}
},
//
onLoad(e) {
this.$request
.globalRequest(
"/hiddenDanger/tricycle/getTricycleInfoEnumType",
"GET"
).then(res => {
this.enumList = res.result
})
if (this.$.getData('userInfo').role.some(i => i == '中队民警农三轮')) {
this.tabTypeList2 = [{
name: '未处理',
active: '0',
num: 0,
},
{
name: '已分配',
active: '1',
num: 0,
},
{
name: '已完成',
active: '2',
num: 0,
},
]
} else if (this.$.getData('userInfo').role.some(i => i == '村干部农三轮')) {
this.tabTypeList2 = [{
name: '未处理',
active: '0',
num: 0,
},
{
name: '已完成',
active: '2',
num: 0,
},
]
}
},
onShow() {
const approve = uni.getStorageSync('MySPtabIndex')
if (approve) {
this.approve = Number(approve)
uni.setStorageSync('MySPtabIndex', '')
}
uni.hideTabBar() //tabBar
this.pageNum = 1
this.list = [];
this.getList({})
// tabFun.tabbar()
// this.tabbarShow = false
// this.$nextTick(() => {
// this.tabbarShow = true
// })
},
//
computed: {},
//
methods: {
//
vehicleTypeConvert(vehicleType) {
if (vehicleType) {
return this.enumList.vehicleTypeEnum.find(i => i.enumvalue === vehicleType)?.enumname
} else {
'--'
}
},
handleSearch(keyWord) {
this.pageNum = 1
this.list = []
this.getList({
keyWord
})
},
queryTypeChange(tabKey) {
if (this.classification != tabKey) {
this.classification = tabKey
this.pageNum = 1
this.list = []
this.getList({
tabKey
})
}
},
handleTabChange(tabKey) {
if (this.approve != tabKey) {
this.classification = '0'
this.approve = tabKey
this.pageNum = 1
this.list = []
this.getList({})
}
},
getQueryStr(query) {
let myQuery = {
...query
}
if (myQuery.approve == 2) {
myQuery.startTime = this.startDate
myQuery.endTime = this.endDate
}
return Object.entries(myQuery).reduce((str, keyValue, index, self) => {
const [key, value] = keyValue
str += `${key}=${value}${index !== self.length - 1 ? '&' : ''}`
return str
}, '')
},
getList({
tabKey,
keyWord
}) {
this.loadmorestatus = 'loading'
this.isMore = true
//
if (this.approve == 1) {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleList`, {
nuserId: this.$.getData('token'),
status: tabKey || this.classification,
search: keyWord || '',
pageNum: this.pageNum,
pageSize: this.pageSize,
}, 'get').then(res => {
this.loadmorestatus = 'loadmore'
if (res.code === 200) {
if (res.result.total === 0) {
this.isEmpty = true;
} else {
this.isEmpty = false;
this.list.push(...res.result.list)
}
if (this.list.length >= res.result.total) {
this.loadmorestatus = 'nomore'
this.isMore = false
}
} else {
this.$.toast(res.message)
}
}).catch((err) => {
this.loadmorestatus = 'nomore'
uni.stopPullDownRefresh();
})
//
this.tabTypeList1.map(i => {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleList`, {
nuserId: this.$.getData('token'),
status: i.active,
search: keyWord || ''
}, 'get').then(res => {
i.num = res.result.total
})
})
} else if (this.approve == 2) {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleWarningList`, {
nuserId: this.$.getData('token'),
status: tabKey || this.classification,
search: keyWord || '',
pageNum: this.pageNum,
pageSize: this.pageSize,
}, 'get').then(res => {
this.loadmorestatus = 'loadmore'
if (res.code === 200) {
if (res.result.total === 0) {
this.isEmpty = true;
} else {
this.isEmpty = false;
this.list.push(...res.result.list)
}
if (this.list.length >= res.result.total) {
this.loadmorestatus = 'nomore'
this.isMore = false
}
} else {
this.$.toast(res.message)
}
}).catch((err) => {
this.loadmorestatus = 'nomore'
uni.stopPullDownRefresh();
})
//
this.tabTypeList2.map(i => {
this.$request.globalRequest(`hiddenDanger/tricycle/getTricycleWarningList`, {
nuserId: this.$.getData('token'),
status: i.active,
search: keyWord || ''
}, 'get').then(res => {
i.num = res.result.total
})
})
}
},
handleClick(row) {
this.$.open("/pages/investigation/detail" + "?id=" + row.id);
},
handleWarningClick(row) {
this.$.open("/pages/investigation/warningDetail" + "?warningId=" + row.warningId+ "&state=" + this.classification);
},
//
skipPage(even) {
// this.$.open(even)
},
},
onReady() {},
//
onUnload() {
},
//
onPullDownRefresh() {
this.pageNum = 1
this.list = [];
this.getList({})
},
//
onReachBottom() {
if (this.isMore) {
this.pageNum++
this.getList({})
}
},
}
</script>
<style>
</style>
<style lang="scss" scoped>
page {
background: #F6F8FA;
}
.imgIcon {
width: 40rpx;
height: 100%;
}
.imgIcon:nth-of-type(2) {
margin-left: 40rpx;
}
.img {
width: 40rpx;
height: 40rpx;
margin-left: 30rpx;
}
.trapezoidal {
position: relative;
display: inline-block;
min-width: 2em;
text-align: center;
padding: 3rpx 20rpx 3rpx 18rpx;
}
.trapezoidal::before,
.trapezoidal::after {
content: '';
position: absolute;
top: 0;
left: 0%;
width: 100%;
height: 100%;
border-radius: 0rpx 0 0 0;
background: #FF1111;
z-index: -1;
transform-origin: bottom;
transform: skew(18deg);
border: 0rpx solid #333;
box-sizing: border-box;
}
.trapezoidal::after {
left: auto;
right: 0;
transform: skew(-0deg);
border-radius: 0 0rpx 0 0;
background-color: #FF1111;
border-left: 0 none;
}
.query-form {
font-size: 16px;
height: 91px;
background: #ffffff;
box-shadow: 3px 0px 10px #ccc;
color: #666666;
position: sticky;
// top: var(--status-bar-height + 88rpx);
top: calc(var(--status-bar-height) + 88rpx);
z-index: 10;
.tab {
display: flex;
align-items: center;
justify-content: space-around;
.tab-item {
position: relative;
height: 41px;
line-height: 41px;
padding: 0 30rpx 0 30rpx;
border-bottom: 3px solid #fff;
display: flex;
align-items: center;
&.active {
color: rgb(60, 109, 195);
border-color: rgb(60, 109, 195);
}
.number {
font-weight: bold;
font-size: 18px;
margin-left: 10rpx;
}
}
}
.search-box {
padding: 10px 10px 3px;
}
}
.query-form2 {
height: 146px;
.date-content {
display: flex;
align-items: center;
padding: 15px 10px;
justify-content: space-between;
.date-item {
display: flex;
align-items: center;
&-label {
margin-right: 10px;
}
&-value {
width: 185rpx;
text-align: right;
}
}
}
}
.Box {
padding-top: var(--status-bar-height);
.Content {
width: calc(100% - 48rpx);
padding-bottom: 88rpx;
}
.Unit {
padding: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
box-shadow: 1px 1px 3px #ccc;
.trapezoidal {
position: absolute;
top: 0px;
right: 0px;
color: #ffffff;
font-size: 14px;
font-weight: normal;
z-index: 1;
}
.itemImg {
max-width: 132rpx;
max-height: 116rpx;
}
.right {
flex: 1;
padding-left: 30rpx;
.title {
font-size: 16px;
}
.carNumber {
width: 250rpx;
float: left;
}
.type {
font-size: 14px;
color: #666;
font-weight: normal;
text {
margin-right: 20rpx;
}
}
}
}
}
</style>

@ -1,5 +1,6 @@
<template>
<view class="detail">
<view class="detail" :data="params" :change:data="renderjs.renderjsGet" :imgArr="imgArr"
:change:imgArr="renderjs.getImgArr">
<!-- <view class="Content BorderBox Width100">
<top-title
:is-show-left="true"
@ -42,7 +43,7 @@
</view>
<scroll-view scroll-y="true" :scroll-top="scrollTop" :style="{
height: isExpanded ? 'calc(100% - 350rpx)' : 'calc(100% - 250rpx)',
height: isExpanded ? 'calc(100% - 350rpx)' : 'calc(100% - 260rpx)',
}" class="chatlist" id="scrollView" ref="scrollView" @click="clickContent">
<view class="cur-time font-family-SR">
{{curTime}}
@ -92,7 +93,6 @@
</u-checkbox-group>
</view>
<view v-if="item.answerOptions && item.answerOptions.length > 0 && item.optionType == 0"
:style="item.answerOptions.length > 2 ? 'display: flex; flex-wrap: wrap;' : ''"
:class="item.answerOptions.length > 2 ? '' : 'btnBox'">
@ -154,7 +154,8 @@
</view>
</view> -->
<vVoice :disabled="loading" v-model="inputValue" @confirm="handleSend" @imageChoose="chooseImage" />
<vVoice :disabled="loading" v-model="inputValue" @confirm="handleSend" @imageChoose="chooseImage"
:showUpload="true" @dataSend="receiveRenderData" :taskId="taskId"/>
<u-popup :show="showYinDao" @close="showYinDao = false">
<view class="custom-pop-head">
<view class="title">{{ dataYinDao.title }}</view>
@ -223,11 +224,17 @@
checkboxValue1: [],
showYinDao: false,
dataYinDao: '',
curTime: ''
curTime: '',
timerCount: -1,
timer: '',
tempStr: '',
imgArr: [],
taskId:''
};
},
onLoad(options) {
console.log(options);
this.curTime = this.$moment().format('HH:mm')
let params = options;
// params.deptId = "3702000000";
@ -237,8 +244,8 @@
// params.taskId = "000001";
// params.userId = "admin1";
this.params = params;
let str = "";
this.getChatHistory()
let str = "";
if (params.roadName) {
str += "路段名:" + params.roadName;
this.title = params.roadName + "智能排查";
@ -246,14 +253,12 @@
if (params.id != "undefined") {
str += ",id:" + params.id; //params.id
}
console.log(params);
return
if (params.id == 12121212) {
console.log('11111111111111111111111111111')
this.queryChat("开始隐患排查," + str);
} else {
// this.SSE("," + str, "1");
if (params.id != "undefined") {
console.log('2222222222222222222222222222222')
setTimeout(() => {
this.queryChat("开始隐患排查," + str);
}, 500)
@ -285,9 +290,77 @@
// }
// }
// },
watch: {
// watch
timerCount(newVal, oldVal) {
if (this.tempStr[newVal]) {
console.log('newValnewValnewValnewVal', this.tempStr, newVal, this.tempStr[newVal])
this.msgList[this.msgList.length - 1].data += this.tempStr[newVal]
} else {
clearInterval(this.timer)
this.timer = null
this.tempStr = ''
this.timerCount = -1
this.loading = false;
}
}
},
methods: {
receiveRenderData(data) {
const res = JSON.parse(data.data);
if (res?.code == 200 && res.result) {
this.tabkey = res.result.data.tabkey;
let content = res.result.data.content
if (this.tabkey - 1 != this.active) {
this.active = this.tabkey - 1 > 0 ? this.tabkey - 1 : 0;
}
// if (this.msgList.length == 0) {
// this.msgList = [{
// answerId: '0',
// data: content,
// }];
// } else {
//
if (this.msgList[this.msgList.length - 1].answerId == "1") {
this.tempStr += content
// this.msgList[this.msgList.length - 1].data +=
// content
} else {
//
this.msgList = [
...this.msgList,
{
answerId: "1",
data: '',
},
];
this.tempStr = content
if (!this.timer) {
this.timer = setInterval(() => {
this.timerCount = this.timerCount + 1
}, 50)
}
}
// }
// debugger
this.scrollBottom();
} else if (res?.code == 500 && res.message) {
this.msgList = [
...this.msgList,
{
answerId: "1",
data: res.message,
},
];
this.loading = false
}
},
clickYinDao(data) {
console.log('data12121 ========>', data)
this.showYinDao = true
// let newData = data.content + data.reference.content
// const timer = setInterval(() => {
@ -314,9 +387,77 @@
// data.content += data.reference.content
},
//
sseBack(ev) {
let answerId = '1'
let res = JSON.parse(ev.data);
console.log('resresresresresresresres', res)
this.taskId = res.result.taskId
if (res?.code == 200 && res.result) {
let content = res.result.data.content
let newdata = "";
let index = 0;
// const timer = setInterval(() => {
newdata = content[index] ? newdata += content[index] : newdata += '';
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;
}
if (this.msgList.length == 0) {
this.msgList = [{
answerId,
data: content,
optionType: res.result.data?.optionType,
answerOptions: res.result.data ? res.result.data
.answerOptions : [],
}, ];
} else {
content.split('').map((item, index) => {
//
setTimeout(() => {
if (this.msgList[this.msgList.length - 1].answerId == "1") {
//
this.msgList[this.msgList.length - 1].data +=
content;
this.msgList[this.msgList.length - 1].optionType =
res.result.data?.optionType;
this.msgList[this.msgList.length - 1].answerOptions =
res.result.data ? res.result.data.answerOptions : [];
} else {
//
this.msgList = [
...this.msgList,
{
answerId: "1",
data: content,
optionType: res.result.data?.optionType,
answerOptions: res.result.data ? res.result.data
.answerOptions : [],
},
];
}
}, index * 50)
})
}
// }, 50)
this.loading = false
// debugger
this.scrollBottom();
} else if (res?.code == 500 && res.message) {
this.msgList = [
...this.msgList,
{
answerId: "1",
data: res.message,
},
];
}
},
// SSE
SSE(voiceText, answerId) {
const ctrl = new AbortController();
// const ctrl = new AbortController();
fetchEventSource($.chatUrl + "/chat", {
method: "POST",
headers: {
@ -338,16 +479,14 @@
sectionId: this.params.sectionId,
sectionType: this.params.sectionType,
}),
signal: ctrl.signal,
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {},
onmessage: (ev) => {
console.log('ev ==========》', ev);
this.loading = true;
const res = JSON.parse(ev.data);
let res = JSON.parse(ev.data);
if (res?.code == 200 && res.result) {
console.log(res.result.data.tabkey);
console.log(res.result.data);
// 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) {
@ -358,8 +497,8 @@
answerId,
data: res.result.data.content,
optionType: res.result.data?.optionType,
answerOptions: res.result.data ? res.result.data.answerOptions :
[],
answerOptions: res.result.data ? res.result.data
.answerOptions : [],
}, ];
} else {
// debugger
@ -386,14 +525,12 @@
];
}
}
// debugger
this.scrollBottom();
}
// this.loading = true;
},
onclose: () => {
console.log(1111);
this.loading = false;
if (this.isExpanded) {
@ -401,10 +538,115 @@
}
},
onerror(error) {
console.log("error", error);
throw error;
},
});
return
var requestTask = uni.request({
url: $.chatUrl + "/chat",
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: ["text/event-stream", "application/json"],
},
dataType: 'json',
data: JSON.stringify({
voiceText,
deptId: "3702000000",
id: "37020017407",
multiType: "",
sceneFlag: "",
stream: true,
type: "0",
userId: "admin1",
}),
// signal: ctrl.signal,
// openWhenHidden: true,
// onopen: () => {
// console.log('onopneSSE')
// uni.showToast({
// title: 'open'
// })
// },
success: (ev) => {
// console.log('SSEmessageSSEmessageSSEmessageSSEmessage', ev);
let data = ev.data;
if (ev.statusCode == 200 && data) {
data = data.split('\n\n');
} else {
this.loading = false;
this.msgList = [
...this.msgList,
{
answerId: "1",
data: '未查询到相关信息',
},
];
}
data.map(res => {
res = JSON.parse(res.substring(5));
if (res?.code == 200 && res.result) {
this.loading = false;
// 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;
}
if (this.msgList.length == 0) {
this.msgList = [{
answerId,
data: res.result.data.content,
optionType: res.result.data?.optionType,
answerOptions: res.result.data ? res.result.data
.answerOptions : [],
}, ];
} else {
// debugger
//
if (this.msgList[this.msgList.length - 1].answerId == "1") {
//
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 ? res.result.data.answerOptions : [];
} else {
//
this.msgList = [
...this.msgList,
{
answerId: "1",
data: res.result.data.content,
optionType: res.result.data?.optionType,
answerOptions: res.result.data ? res.result.data
.answerOptions : [],
},
];
}
}
// debugger
this.scrollBottom();
requestTask.abort()
}
})
},
// onclose: () => {
// this.loading = false;
// this.expandedFlag = false
// if (this.isExpanded) {
// this.isExpanded = !this.isExpanded;
// }
// },
fail(error) {
requestTask.abort()
throw error;
},
});
},
async getChatHistory() {
@ -423,7 +665,6 @@
taskId: this.params.taskId
},
});
console.log('getChatHistory', res)
if (res && res.data && res.data.code == 200) {
const result = res.data.result
let id = 1
@ -444,7 +685,6 @@
id += 2
})
this.msgList = arr
console.log('msgList =========>', this.msgList)
}
},
@ -452,25 +692,6 @@
async queryChat(voiceText) {
// console.log(voiceText,"voiceText");
this.loading = true;
console.log({
voiceText,
sceneFlag: "",
sessionId: this.$.getData('sessionId'),
multiType: "",
userId: this.params.userId,
deptId: this.params.deptId,
stream: false,
type: "1",
id: this.params.id,
taskId: this.params.taskId,
sectionId: this.params.sectionId,
sectionType: this.params.sectionType,
// "user_id": "zzp",
// "kb_ids": ["KBa80ea15e786241eca70a20f136f4e34c"],
// "question": "",
// "streaming": true,
// "history": []
})
let sectionType = "2"
if (this.params.sectionType != 'null') {
sectionType = this.params.sectionType
@ -519,7 +740,6 @@
this.active = data.tabkey - 1 > 0 ? data.tabkey - 1 : 0;
}
if (data.content) {
console.log('1212111111111111111111111 ===========>', data)
this.changeMsgList(
data.answerId || "1",
data.content,
@ -550,9 +770,7 @@
this.isExpanded = !this.isExpanded;
}
} else {
if (err) {
console.log("request fail", err.errMsg);
}
if (err) {}
// uni.showToast({
// title: "",
// icon: "error",
@ -593,6 +811,7 @@
duration: 2000,
});
}
this.loading = true
if (text || this.inputValue) {
if (this.params.id == 12121212) {
this.changeMsgList("0", this.inputValue || text);
@ -602,7 +821,7 @@
// this.addQuestion(this.inputValue || text, "0");
// this.SSE(this.inputValue || text, "0");
this.changeMsgList("0", this.inputValue || text);
this.queryChat(this.inputValue || text);
// this.queryChat(this.inputValue || text);
this.scrollBottom();
}
this.inputValue = "";
@ -614,11 +833,9 @@
data = data.replace("undefined", '')
data = data.replace("null", '')
this.msgList = [...this.msgList]
console.log('this.msgList ==========>', this.msgList)
if (this.msgList.length > 0) {
id = this.msgList[this.msgList.length - 1].id + 1;
}
console.log('id ========>', id)
if (answerId == "1") {
//
let newdata = "";
@ -728,13 +945,12 @@
},
//
chooseImage() {
console.log('111')
uni.chooseImage({
count: 6, //9
sizeType: ["original", "compressed"], //
sourceType: ["album", 'camera'], //
success: async (res) => {
console.log(res);
this.imgArr = []
if (res.tempFilePaths && res.tempFilePaths.length) {
let str = "";
let jsonArr = [];
@ -744,18 +960,18 @@
str += `![图${i + 1}](${json.result})`;
jsonArr.push(json.result);
}
console.log(str);
this.imgArr = jsonArr
this.loading = true
if (this.id == 12121212) {
this.changeMsgList("0", str);
this.queryChat(res.tempFilePaths);
// this.queryChat(res.tempFilePaths);
} else {
// this.addQuestion(str, "0");
// this.SSE(jsonArr, "0");
this.changeMsgList("0", str);
let j = jsonArr.join(",");
this.queryChat(j);
// this.queryChat(j);
}
}
},
@ -774,7 +990,6 @@
});
},
handleGroup(item) {
console.log(item)
let text = "";
if (item.optionType) {
text = item.checkboxValue1.join(",");
@ -786,12 +1001,95 @@
handleGroup2(i) {
this.msgList[i].checkboxValue1 = []
this.$set(this.msgList, i, this.msgList[i])
},
},
};
</script>
<script module="renderjs" lang="renderjs">
import $ from "../../common/globalJs/globalJs.js";
import {
fetchEventSource
} from "@microsoft/fetch-event-source";
export default {
data() {
return {
firstFlag: false,
params: {}
}
},
mounted(option) {
},
methods: {
getImgArr(res) {
if (res.length) {
this.newSSE(res.join(), '0')
}
},
renderjsGet(val) {
if (this.firstFlag) {
return
} else {
this.params = val;
let str = "";
if (this.params.roadName) {
str += "路段名:" + this.params.roadName;
this.title = this.params.roadName + "智能排查";
}
if (this.params.id != "undefined") {
str += ",id:" + this.params.id; //params.id
}
this.newSSE('开始隐患排查' + str, '1')
}
},
newSSE(voiceText, answerId = '') {
// const ctrl = new AbortController();
fetchEventSource($.chatUrl + "/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: ["text/event-stream", "application/json"],
},
body: JSON.stringify({
voiceText,
sceneFlag: "",
// sessionId: $.getData('sessionId'),
multiType: "",
userId: this.params.userId,
deptId: this.params.deptId,
stream: true,
type: "1",
id: this.params.id,
taskId: this.params.taskId,
sectionId: this.params.sectionId,
sectionType: this.params.sectionType,
}),
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
},
onmessage: (ev) => {
//
this.$ownerInstance.callMethod('sseBack', ev);
},
onclose: (ev) => {
this.loading = false;
this.expandedFlag = false
if (this.isExpanded) {
this.isExpanded = !this.isExpanded;
}
},
onerror(error) {
console.log("error", error);
throw error;
},
});
},
}
}
</script>
<style scoped lang="scss">
.detail {
width: 100%;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -0,0 +1,905 @@
<template>
<view id="page">
<view class="Width100 Box BorderBox">
<view class="Content BorderBox Width100">
<top-title @skipPage="$.back(1)" :isCuMethod="true" :is-show-left="true" title="三轮车信息登记"
:rightWidth='120' class="custom_bg">
</top-title>
</view>
<view class="formBox">
<uni-forms :modelValue="formData" border>
<view class="label-box">
<view class="border"></view> 车辆信息
</view>
<uni-forms-item label="车辆号牌" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车辆号牌':''" v-model="formData.vehicleLicense"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="车辆类型" class="border-bottom" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click="handleShowDrop('vehicleType') ">
<u-picker :show="pickerType == 'vehicleType'" :columns="[this.enumList.vehicleTypeEnum]"
@cancel="pickerType = ''" keyName='enumname'
@confirm="e=>handleSelect(e,'vehicleType')"></u-picker>
<view style="width:200rpx;min-height: 50rpx;" :class="formData.vehicleType?'':'gary'">
{{editFlag?formData.vehicleType ||'请选择车辆类型':formData.vehicleType}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="车辆颜色" class="border-bottom" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click=" handleShowDrop('vehicleColor')">
<u-picker :show="pickerType == 'vehicleColor'" :columns="[this.enumList.vehicleColorEnum]"
@cancel="pickerType = ''" keyName='enumname' :disabled="!editFlag"
@confirm="e=>handleSelect(e,'vehicleColor')"></u-picker>
<view :class="formData.vehicleColor?'':'gary'">
{{editFlag?formData.vehicleColor ||'请选择车辆颜色':formData.vehicleColor}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="车辆品牌" class="border-bottom">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车辆品牌':''" v-model="formData.vehicleBrand"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="车架号" class="border-bottom" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车架号':''" v-model="formData.vin"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<view class="label-box">
<view class="border"></view> 驾驶人信息
</view>
<uni-forms-item label="驾驶人" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入驾驶人姓名':''" v-model="formData.driverName"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="身份证号" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入驾驶人身份证号':''" v-model="formData.driverIdNumber"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="联系电话" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入驾驶人联系电话':''" v-model="formData.driverPhone"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="准驾车型" class="border-top">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click="handleShowDrop('driverAuthorizedModel')">
<u-picker :show="pickerType === 'driverAuthorizedModel'"
:columns="[this.enumList.getVehicleAuthorizedModelEnum]" @cancel="pickerType = ''"
keyName='enumname' :disabled="!editFlag"
@confirm="e=>handleSelect(e,'driverAuthorizedModel')"></u-picker>
<view :class="formData.driverAuthorizedModel?'':'gary'">
{{editFlag?formData.driverAuthorizedModel || '请选择准驾车型':formData.driverAuthorizedModel}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="街镇" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click="handleShowDrop('streetCommunity')">
<u-picker :show="pickerType === 'streetCommunity'" :columns="[this.streetCommunityByXq]"
@cancel="pickerType = ''" keyName='jdname' :disabled="!editFlag"
@confirm="e=>handleSelect(e,'streetCommunity')"></u-picker>
<view :class="formData.streetCommunity?'':'gary'">
{{editFlag? formData.streetCommunity || '请选择街镇':formData.streetCommunity}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="村社区" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click="handleShowDrop('villageCommunity') ">
<u-picker :show="pickerType === 'villageCommunity'" :columns="[this.streetCommunityByJd]"
@cancel="pickerType = ''" keyName='sqname' :disabled="!editFlag"
@confirm="e=>handleSelect(e,'villageCommunity')"></u-picker>
<view :class="formData.villageCommunity?'':'gary'">
{{editFlag? formData.villageCommunity || '请选择街镇':formData.villageCommunity}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="村社区干部" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入村社区干部':''" v-model="formData.communityCadre"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<!-- <uni-forms-item label="村社区干部电话" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" placeholder="请输入村社区干部电话" v-model="formData.communityCadrePhone"
:disabled="!editFlag" />
</view>
</uni-forms-item> -->
</uni-forms>
</view>
<view class="formBox">
<uni-forms border>
<view class="label-box">
<view class="border"></view> 其他信息
</view>
<uni-forms-item label="保险购置情况" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click=" handleShowDrop('vehicleInsurance')">
<u-picker :show="pickerType === 'vehicleInsurance'"
:columns="[this.enumList.getVehicleInsuranceEnum]" @cancel="pickerType = ''"
keyName='enumname' :disabled="!editFlag"
@confirm="e=>handleSelect(e,'vehicleInsurance')"></u-picker>
<view :class="formData.vehicleInsurance?'':'gary'">
{{editFlag?formData.vehicleInsurance ||'请选择保险购置情况':formData.vehicleInsurance}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="车辆状态" class="border-top">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click="handleShowDrop('vehicleStatus') ">
<u-picker :show="pickerType === 'vehicleStatus'"
:columns="[this.enumList.getVehicleStatusEnum]" @cancel="pickerType = ''"
keyName='enumname' :disabled="!editFlag"
@confirm="e=>handleSelect(e,'vehicleStatus')"></u-picker>
<view :class="formData.vehicleStatus?'':'gary'">
{{editFlag?formData.vehicleStatus||'请选择车辆状态':formData.vehicleStatus}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="录入人员" class="border-top">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<view>
{{formData.insertPersonnel}}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="录入时间" class="border-top">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<view class="Height100">
{{ formData.insertTime }}
</view>
</view>
</uni-forms-item>
<uni-forms-item label="详细地址" class="border-top" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入详细地址':''" v-model="formData.driverAddress"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<view class="detail-item">
<uni-forms-item label="村干部见车主" label-position="top" label-width="100px" required />
<locationUpload :disabled="!editFlag" :fileList="cadreDriverImg"
@afterRead="(e) => afterRead(e, 'cadreDriverImg')"
@delete="(e) => deletePic(e, 'cadreDriverImg')" name="1" :maxCount="1"></locationUpload>
</view>
<view class="detail-item">
<uni-forms-item label="保证书" label-position="top" label-width="100px" required />
<locationUpload :disabled="!editFlag" :fileList="guaranteeImg"
@afterRead="(e) => afterRead(e, 'guaranteeImg')"
@delete="(e) => deletePic(e, 'guaranteeImg')" name="1" :maxCount="1"></locationUpload>
</view>
<view class="detail-item">
<uni-forms-item label="车主驾车" label-position="top" label-width="100px" required />
<locationUpload :disabled="!editFlag" :fileList="drivingImg"
@afterRead="(e) => afterRead(e, 'drivingImg')" @delete="(e) => deletePic(e, 'drivingImg')"
name="1" :maxCount="1"></locationUpload>
</view>
<view class="detail-item">
<uni-forms-item label="车主大头照" label-position="top" label-width="100px" required />
<locationUpload :disabled="!editFlag" :fileList="driverImg"
@afterRead="(e) => afterRead(e, 'driverImg')" @delete="(e) => deletePic(e, 'driverImg')"
name="1" :maxCount="1"></locationUpload>
</view>
</uni-forms>
</view>
<view class="bottom" v-if="!editFlag">
<view class="trapezoidal min" @click="editFlag = true">
<text>修改</text>
</view>
</view>
<view class="bottom" v-else-if="editFlag && !formData.vehicleId">
<view class="trapezoidal min" @click="handleSave">
<text>保存</text>
</view>
</view>
<three class="footer-buttons" :type="'view'" first-text="取消" next-text="确认" :second-primary="true"
@first="handleCancel" @last="handleSave" v-else />
<view style="width: 100%;height: 100rpx;"></view>
</view>
</view>
</template>
<script>
import NoData from "../../components/no-data.vue";
import Tabbar from "../../components/tabbar.vue";
import TopTitle from "../../components/top-title";
import $ from "../../common/globalJs/globalJs";
import taskInfo from "../../components/task-info.vue";
import uploadFile from "../../components/upload-file.vue";
import Three from "../../components/bottom-button/three.vue";
import BottomButton from "../../components/bottom-button/three.vue";
import dayjs from '@/uni_modules/uview-ui/libs/util/dayjs.js';
import locationUpload from '@/components/u-upload/index.js'
export default {
//
components: {
TopTitle,
NoData,
taskInfo,
uploadFile,
Three,
BottomButton,
locationUpload
},
data() {
return {
editFlag: false,
$: this.$,
formData: {
cadreDriverImg: "",
communityCadre: "",
communityCadrePhone: '',
driverAddress: "",
driverAuthorizedModel: "",
driverIdNumber: "",
driverImg: "",
driverName: "",
driverPhone: "",
drivingImg: "",
guaranteeImg: "",
insertPersonnel: "",
insertTime: "",
streetCommunity: "",
vehicleBrand: "",
vehicleColor: "",
vehicleInsurance: "",
vehicleLicense: "",
vehicleStatus: "",
vehicleType: "",
villageCommunity: "",
vin: ""
},
pickerType: '',
enumList: {},
streetCommunityByXq: [],
streetCommunityByJd: [],
fileList: [],
cadreDriverImg: [],
guaranteeImg: [],
drivingImg: [],
driverImg: [],
}
},
//
onLoad(e) {
//
this.$request
.globalRequest(
"/hiddenDanger/tricycle/getTricycleInfoEnumType",
"GET"
)
.then((res) => {
this.enumList = res.result
//
this.$request
.globalRequest(
"/hiddenDanger/config/getStreetCommunityByXq",
"GET"
)
.then((res) => {
res.result.map(i => {
if (this.streetCommunityByXq.every(j => i.jdname != j.jdname)) {
this.streetCommunityByXq.push(i)
}
})
if (e.id) {
this.getDetail(e.id);
} else {
this.editFlag = true
this.formData.insertTime = this.timestampToTime()
this.formData.insertPersonnel = this.$.getData('cusername')
}
});
});
//
this.$request
.globalRequest(
"/hiddenDanger/auth/getOperatorInformation", {
nuserid: this.$.getData('userInfo').username,
},
"GET"
)
.then((res) => {
if (res.code === 200) {
this.$.setData('cusername', res.result.cusername)
}
});
},
computed: {
},
onShow() {
},
methods: {
//
handleCancel() {
this.editFlag = false
this.getDetail(this.formData.id)
},
//
handleSave() {
if (this.cadreDriverImg[0]?.url) {
this.formData.cadreDriverImg = this.cadreDriverImg[0]?.url;
};
if (this.guaranteeImg[0]?.url) {
this.formData.guaranteeImg = this.guaranteeImg[0]?.url;
};
if (this.drivingImg[0]?.url) {
this.formData.drivingImg = this.drivingImg[0]?.url;
};
if (this.driverImg[0]?.url) {
this.formData.driverImg = this.driverImg[0]?.url;
};
const {
vehicleLicense,
vehicleType,
vehicleColor,
vin,
driverName,
driverIdNumber,
driverPhone,
streetCommunity,
villageCommunity,
communityCadre,
vehicleInsurance,
driverAddress,
cadreDriverImg,
guaranteeImg,
drivingImg,
driverImg,
driverAuthorizedModel,
vehicleStatus
} = this.formData;
if (!vehicleLicense || !vehicleType || !vehicleColor || !vin || !driverName || !driverIdNumber || !
driverPhone ||
!streetCommunity || !villageCommunity || !communityCadre || !vehicleInsurance || !driverAddress || !
cadreDriverImg || !guaranteeImg || !drivingImg || !driverImg) {
return this.$.toast("请输入完成表单必填项");
}
if (vehicleType) {
this.formData.vehicleType = this.enumList.vehicleTypeEnum?.find(i => i.enumname ==
vehicleType)?.enumvalue
}
if (vehicleColor) {
this.formData.vehicleColor = this.enumList.vehicleColorEnum?.find(i => i.enumname ==
vehicleColor)?.enumvalue
}
if (driverAuthorizedModel) {
this.formData.driverAuthorizedModel = this.enumList.getVehicleAuthorizedModelEnum?.find(
i => i.enumname ==
driverAuthorizedModel)?.enumvalue
}
if (vehicleInsurance) {
this.formData.vehicleInsurance = this.enumList.getVehicleInsuranceEnum?.find(i => i
.enumname ==
vehicleInsurance)?.enumvalue
}
if (vehicleStatus) {
this.formData.vehicleStatus = this.enumList.getVehicleStatusEnum?.find(i => i
.enumname ==
vehicleStatus)?.enumvalue
}
let streetCommunityValue = ''
let villageCommunityValue = ''
if (streetCommunity) {
streetCommunityValue = this.streetCommunityByXq?.find(i => i
.jdname ==
streetCommunity).jdcode
this.$request
.globalRequest(
"/hiddenDanger/config/getStreetCommunityByJq", {
jdcode: streetCommunityValue
},
"GET"
)
.then((res) => {
if (villageCommunity) {
villageCommunityValue = res.result?.find(i => i
.sqname ==
villageCommunity).sqcode
}
this.$request.globalRequest("/hiddenDanger/tricycle/saveTricycleInfo", {
...this.formData,
streetCommunity: streetCommunityValue,
villageCommunity: villageCommunityValue
},
"POST"
)
.then((res) => {
this.editFlag = false
if (this.formData.vehicleId) {
uni.showToast({
title: '修改成功'
})
} else {
uni.showToast({
title: '保存成功'
})
setTimeout(() => {
this.$.back(1)
}, 500);
}
});
});
}
},
getDetail(id) {
this.formData = {}
this.$request
.globalRequest(
"/hiddenDanger/tricycle/getTricycleInfoBaseById", {
id
},
"GET"
)
.then((res) => {
if (res.code === 200) {
this.formData = res.result
if (res.result.cadreDriverImg) {
this.cadreDriverImg = [{
url: res.result.cadreDriverImg,
name: ''
}]
}
if (res.result.guaranteeImg) {
this.guaranteeImg = [{
url: res.result.guaranteeImg,
name: ''
}]
}
if (res.result.drivingImg) {
this.drivingImg = [{
url: res.result.drivingImg,
name: ''
}]
}
if (res.result.driverImg) {
this.driverImg = [{
url: res.result.driverImg,
name: ''
}]
}
//
const {
vehicleType,
vehicleColor,
driverAuthorizedModel,
vehicleInsurance,
vehicleStatus,
streetCommunity,
villageCommunity
} = this.formData
if (vehicleType) {
this.formData.vehicleType = this.enumList.vehicleTypeEnum?.find(i => i.enumvalue ==
vehicleType)?.enumname
}
if (vehicleColor) {
this.formData.vehicleColor = this.enumList.vehicleColorEnum?.find(i => i.enumvalue ==
vehicleColor)?.enumname
}
if (driverAuthorizedModel) {
this.formData.driverAuthorizedModel = this.enumList.getVehicleAuthorizedModelEnum
?.find(
i => i.enumvalue ==
driverAuthorizedModel)?.enumname
}
if (vehicleInsurance) {
this.formData.vehicleInsurance = this.enumList.getVehicleInsuranceEnum?.find(i => i
.enumvalue ==
vehicleInsurance)?.enumname
}
if (vehicleStatus) {
this.formData.vehicleStatus = this.enumList.getVehicleStatusEnum?.find(i => i
.enumvalue ==
vehicleStatus)?.enumname
}
if (streetCommunity) {
this.formData.streetCommunity = this.streetCommunityByXq?.find(i => i
.jdcode ==
streetCommunity).jdname
this.$request
.globalRequest(
"/hiddenDanger/config/getStreetCommunityByJq", {
jdcode: streetCommunity
},
"GET"
)
.then((res) => {
this.streetCommunityByJd = res.result
if (villageCommunity) {
this.formData.villageCommunity = this.streetCommunityByJd?.find(i => i
.sqcode ==
villageCommunity).sqname
}
});
}
}
});
},
timestampToTime() {
var date = new Date()
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());
return Y + M + D; // YYYY-MM-DD
},
//
handleSelect(e, keyName) {
this.pickerType = 'keyName'
if (keyName == 'streetCommunity') {
if (this.formData.streetCommunity == e.value[0].jdname) {
return
}
this.formData.streetCommunity = e.value[0].jdname;
this.formData.villageCommunity = '';
//
this.$request
.globalRequest(
"/hiddenDanger/config/getStreetCommunityByJq", {
jdcode: e.value[0].jdcode
},
"GET"
)
.then((res) => {
this.streetCommunityByJd = res.result
});
} else if (keyName === 'villageCommunity') {
this.formData.villageCommunity = e.value[0].sqname;
} else {
this.formData[keyName] = e.value[0].enumname
}
},
//
handleShowDrop(pickerType) {
if (!this.editFlag) {
return
}
this.pickerType = pickerType
},
//id
uuid(len, binary) {
len = !len ? 36 : len;
binary = !binary ? 16 : binary;
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
.replace(/[xy]/g, function(c) {
var r = (Math.random() * binary) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(binary);
})
.substring(0, len);
},
uploadFilePromise(event) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.$.baseUrl + "/hiddenDanger/ftp/uploadFileToFtp", //
filePath: event?.file.url,
name: "file",
formData: {
position: event.position,
longitude: event.longitude,
latitude: event.latitude
},
success: (res) => {
resolve(res.data);
},
});
});
},
async afterRead(event, key) {
// console.log(key)
// multiple true , file
const id = this.uuid();
this[key].push({
id,
...event?.file,
status: "uploading",
message: "上传中",
});
const result = await this.uploadFilePromise(event);
const resultInfo = JSON.parse(result);
const index = this[key]?.findIndex((v) => v.id === id);
if (resultInfo.code == 200) {
this[key].splice(
index,
1,
Object.assign(event?.file, {
status: "success",
message: "",
result: resultInfo,
url: resultInfo.result,
})
);
} else {
this.$.toast("上传失败");
this[key].splice(
index,
1,
);
}
},
//
deletePic(event, keyName) {
if(!this.editFlag){
return
}
this[keyName].splice(event.index, 1);
},
},
onReady() {},
//
onUnload() {},
}
</script>
<style>
</style>
<style lang="scss" scoped>
.footer-buttons{
z-index: 3;
}
page {
background: #F6F8FA;
}
.query-form {
font-size: 16px;
height: 44px;
background: #ffffff;
box-shadow: 3px 0px 10px #ccc;
color: #666666;
position: sticky;
// top: var(--status-bar-height + 88rpx);
top: calc(var(--status-bar-height) + 88rpx);
z-index: 10;
.search-box {
padding: 10px 10px 3px;
}
}
.formBox {
margin: 30rpx 20rpx;
border: 1px solid #e6e6e6;
background: #ffffff;
padding: 0 20rpx 20rpx;
box-sizing: border-box;
/deep/ .uni-forms-item--border .uni-forms-item__content {
justify-content: flex-end;
text-align: right;
}
.photo {
width: 100%;
image {
width: 100%;
}
}
}
.Box {
padding-top: var(--status-bar-height);
.Content {
width: calc(100% - 48rpx);
padding-bottom: 88rpx;
}
.Unit {
padding: 12rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
box-shadow: 1px 1px 3px #ccc;
.trapezoidal {
position: absolute;
top: -0px;
right: 0px;
color: #ffffff;
font-size: 22rpx;
font-weight: normal;
z-index: 1;
}
image {
width: 200rpx;
}
.right {
flex: 1;
padding-left: 30rpx;
.title {
font-size: 16px;
width: 380rpx;
min-height: 80rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.type {
font-size: 14px;
color: #666;
font-weight: normal;
text {
margin-right: 20rpx;
}
}
}
}
}
.label-box {
display: flex;
align-items: center;
height: 110rpx;
font-size: 30rpx;
font-weight: 600;
.border {
background-color: #2663BF;
height: 35rpx;
width: 6rpx;
margin-right: 14rpx;
}
}
.label-box2 {
height: 100rpx;
}
.label-box-small {
font-size: 28rpx;
margin-top: -25rpx;
font-weight: 500;
}
.border-bottom {
border-bottom: 1px #eee solid;
}
.border-top {
border-top: 1px #eee solid;
}
/deep/ .uni-forms-item__label {
font-size: 28rpx;
height: auto;
margin-bottom: 20rpx;
white-space: nowrap;
}
/deep/ .u-input {
background-color: #ffffff !important;
}
.detail-item-flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.investigation-item-zl {
.uni-forms-item--border {
border: none;
}
border-top: 1px solid #eee;
}
.btn-right {
width: 100%;
text-align: right;
}
.bottom {
position: fixed;
bottom: 0;
width: calc(100% - 40rpx);
padding: 18rpx 20rpx;
height: 80rpx;
background: #FFFFFF;
border-top: 1px solid #cccccc;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 3;
}
.Img {
width: 512rpx;
height: 440rpx;
margin: 0 auto;
}
.trapezoidal {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 1;
width: 20%;
height: 100%;
box-sizing: border-box;
text-align: center;
border-radius: 10rpx;
line-height: 60rpx;
&.primary {
background: #2663BF;
color: #fff;
&::after,
&::before {
background: #2663BF;
}
}
}
.trapezoidal::before,
.trapezoidal::after {
content: '';
position: absolute;
top: 0;
width: 100%;
height: 100%;
border-radius: 10rpx;
background: #E9EDF5;
z-index: -1;
transform-origin: bottom;
box-sizing: border-box;
}
.trapezoidal::after {
left: auto;
right: 0;
border-radius: 10rpx;
background-color: #E9EDF5;
border-left: 0 none;
}
.gary {
color: gray;
}
</style>

@ -99,7 +99,7 @@
v-model="formItem.laneCount" placeholder="请输入车道数" @focus="focus" @blur="blur"
style='width:88%' />
<view class="Height100" v-else>{{ formItem.laneCount }}</view>
<view class="Height100">车道</view>
<view class="Height100" style="white-space: nowrap;">车道</view>
</view>
</uni-forms-item>
<uni-forms-item label="设计时速" name="designSpeed" required label-width="80">
@ -2140,7 +2140,18 @@
if (res.result.approveStatus > 0) {
this.$.toast('该隐患已排查完成,请勿重复提交')
} else {
this.curOperUser = res.result.curOperUser
this.$request
.globalRequest(
"/hiddenDanger/auth/getOperatorInformation", {
nuserid: res.result.curOperUser,
},
"GET"
)
.then((res) => {
if (res.code === 200) {
this.curOperUser = res.result.cusername
}
});
if (res.result.curOperUser === this.$.getData("token")) {
this.postSaveManualInvestigation()
} else {

@ -0,0 +1,665 @@
<template>
<view id="page">
<view class="Width100 Box BorderBox">
<view class="Content BorderBox Width100">
<top-title @skipPage="dealFlag?dealFlag = false: $.back(1)" :isCuMethod="true" :is-show-left="true"
:title="dealFlag?'处理': '预警处理'" :rightWidth='120' class="custom_bg">
</top-title>
</view>
<view class="formBox" v-if="!dealFlag">
<uni-forms :modelValue="formData" border>
<uni-forms-item label="抓拍时间">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车辆号牌':''" v-model="formData.warningTimeFormat"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="问题描述">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车辆号牌':''"
v-model="formData.problemDescription" :disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="违法行为">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车辆号牌':''" v-model="formData.illegalActivities"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="违法车辆">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车辆号牌':''" v-model="formData.vehicleLicense"
:disabled="!editFlag" />
</view>
</uni-forms-item>
<uni-forms-item label="车主">
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" :placeholder="editFlag?'请输入车辆号牌':''" v-model="formData.driverName"
:disabled="!editFlag" />
</view>
</uni-forms-item>
</uni-forms>
<image class="itemImg" :src="formData.illegalImg ||require('./defaultImg.png')" mode="widthFix">
</view>
<view class="formBox" v-else>
<uni-forms :modelValue="formData" border>
<uni-forms-item label="处理类型" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; "
@click="handleTypeFlag = true ">
<view v-if="dealData.handleType">
{{dealData.handleType}}
</view>
<view v-else class="gray">
请选择处理类型
</view>
</view>
</uni-forms-item>
<uni-forms-item label="处理结果" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<input type="text" placeholder="请填写处理结果" v-model="dealData.handleResult" />
</view>
</uni-forms-item>
<uni-forms-item label="照片" required>
<locationUpload :fileList="handleImg" @afterRead="(e) => afterRead(e, 'handleImg')"
@delete="(e) => deletePic(e, 'handleImg')" name="1" :maxCount="1"></locationUpload>
</uni-forms-item>
<uni-forms-item label="处理人" required>
<view class="Height100">
{{ dealData.handlePersonnel }}
</view>
</uni-forms-item>
<uni-forms-item label="处理时间" required>
<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
<view class="Height100">
{{ dealData.handleTime }}
</view>
</view>
</uni-forms-item>
</uni-forms>
</view>
<!-- 分配社区列表 -->
<u-picker :show="assignFlag" :columns="[squadronVillageList]" @cancel="assignFlag = false" keyName='sqname'
@confirm="assignTo"></u-picker>
<!-- 预警处理类型 -->
<u-picker :show="handleTypeFlag" :columns="[handleTypeEnum]" @cancel="handleTypeFlag = false"
keyName='sqname' @confirm="handleTypeSelect"></u-picker>
<three class="footer-buttons" :type="'view'" first-text="处理" next-text="分配" :second-primary="true"
@first="dealFlag = true" @last="assignFlag = true" v-if="propState!= '2'&& userFlag&&!dealFlag" />
<view class="bottom" v-if="propState!= '2'&& !userFlag&&dealFlag">
<view class="trapezoidal" @click="dealFlag = true" style="background: #2663BF;color: #fff;">
<text>处理</text>
</view>
</view>
<view class="bottom" v-if="propState!= '2'&&dealFlag">
<view class="trapezoidal" @click="handleDeal" style="background: #2663BF;color: #fff;">
<text>处理</text>
</view>
</view>
<view style="width: 100%;height: 100rpx;"></view>
</view>
</view>
</template>
<script>
import NoData from "../../components/no-data.vue";
import Tabbar from "../../components/tabbar.vue";
import TopTitle from "../../components/top-title";
import $ from "../../common/globalJs/globalJs";
import taskInfo from "../../components/task-info.vue";
import uploadFile from "../../components/upload-file.vue";
import Three from "../../components/bottom-button/three.vue";
import BottomButton from "../../components/bottom-button/three.vue";
import dayjs from '@/uni_modules/uview-ui/libs/util/dayjs.js';
import locationUpload from '@/components/u-upload/index.js'
export default {
//
components: {
TopTitle,
NoData,
taskInfo,
uploadFile,
Three,
BottomButton,
locationUpload
},
data() {
return {
editFlag: false,
$: this.$,
formData: {
communityCadre: "",
communityCadrePhone: '',
driverAddress: "",
driverAuthorizedModel: "",
driverIdNumber: "",
driverName: "",
driverPhone: "",
drivingImg: "",
insertPersonnel: "",
insertTime: "",
streetCommunity: "",
vehicleBrand: "",
vehicleColor: "",
vehicleInsurance: "",
vehicleLicense: "",
vehicleStatus: "",
vehicleType: "",
villageCommunity: "",
vin: ""
},
enumList: {},
streetCommunityByXq: [],
streetCommunityByJd: [],
squadronVillageList: [],
assignFlag: false,
dealFlag: false,
userFlag: false,
handleTypeFlag: false,
dealData: {
//
"warningId": "",
//
"handleType": "",
//
"handleResult": "",
//
"handlePersonnel": "",
//
"handleTime": "",
//
"handleImg": ""
},
handleImg: [],
handleTypeEnum: [],
propState: '2'
}
},
//
onLoad(e) {
if (this.$.getData('userInfo').role.some(i => i == '中队民警农三轮')) {
this.userFlag = true
}
if (e.warningId) {
console.log(e, 'warningIdwarningIdwarningIdwarningIdwarningIdwarningId')
this.getDetail(e.warningId);
}
if (this.propState) {
this.propState = this.propState
}
//
this.$request
.globalRequest(
"/hiddenDanger/auth/getOperatorInformation", {
nuserid: this.$.getData('userInfo').username,
},
"GET"
)
.then((res) => {
if (res.code === 200) {
this.$.setData('cusername', res.result.cusername)
}
});
this.$request
.globalRequest(
"/hiddenDanger/tricycle/getSquadronVillageList", {
nuserId: this.$.getData('userInfo').username,
},
"GET"
).then(res => {
if (res.code == 200) {
this.squadronVillageList = res.result
}
})
//
this.$request
.globalRequest(
"/hiddenDanger/tricycle/getHandleTypeEnum", {
nuserId: this.$.getData('userInfo').username,
},
"GET"
).then(res => {
if (res.code == 200) {
this.handleTypeEnum = res.result
}
})
this.dealData.handleTime = this.timestampToTime()
this.dealData.handlePersonnel = this.$.getData('cusername')
},
methods: {
//
handleCancel() {
this.editFlag = false
this.getDetail(this.formData.warningId)
},
//
handleTypeSelect(e) {
this.dealData.handleType = e.value[0]
this.handleTypeFlag = false
},
//
assignTo(e) {
if (e.value[0].sqcode) {
this.$request
.globalRequest(
"/hiddenDanger/tricycle/submitDistributionStatus", {
warningId: this.formData.warningId,
sqCode: e.value[0].sqcode
},
"GET"
).then(res => {
if (res.code == 200) {
this.$.toast(res.result);
setTimeout(() => {
this.assignFlag = false
this.$.back(1)
}, 500)
}
})
}
},
//
handleDeal() {
const {
handleType,
handleResult,
handlePersonnel,
handleTime
} = this.dealData
let handleImg = ''
if (this.handleImg[0] && this.handleImg[0]?.url) {
handleImg = this.handleImg[0]?.url
}
if (!handleType || !handleResult || !handlePersonnel || !handleTime | !handleImg) {
return this.$.toast("请输入完成表单必填项");
}
this.$request
.globalRequest(
"/hiddenDanger/tricycle/saveTricycleWarningHandle", {
"warningId": this.formData.warningId,
handleType,
handleResult,
handlePersonnel,
handleTime,
handleImg
},
"POST"
).then(res => {
if (res.code == 200) {
this.$.toast(res.result);
setTimeout(() => {
this.$.back(2)
}, 500)
}
})
},
getDetail(warningId) {
this.formData = {}
this.$request
.globalRequest(
"/hiddenDanger/tricycle/getWarningDetails", {
warningId
},
"GET"
)
.then((res) => {
if (res.code === 200) {
if (res.result[0]) {
this.formData = res.result[0]
} else {
this.$.toast("未查询到预警详情,请联系管理员")
}
}
});
},
timestampToTime() {
var date = new Date()
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
var h = date.getHours();
if (String(h).length < 2) {
h = '0' + String(h)
}
var m = date.getMinutes();
if (String(m).length < 2) {
m = '0' + String(m)
}
var s = date.getSeconds();
if (String(s).length < 2) {
s = '0' + String(s)
}
return Y + M + D + h + ':' + m + ':' + s; // YYYY-MM-DD
},
//id
uuid(len, binary) {
len = !len ? 36 : len;
binary = !binary ? 16 : binary;
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
.replace(/[xy]/g, function(c) {
var r = (Math.random() * binary) | 0,
v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(binary);
})
.substring(0, len);
},
uploadFilePromise(event) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.$.baseUrl + "/hiddenDanger/ftp/uploadFileToFtp", //
filePath: event?.file.url,
name: "file",
formData: {
position: event.position,
longitude: event.longitude,
latitude: event.latitude
},
success: (res) => {
resolve(res.data);
},
});
});
},
async afterRead(event, key) {
// console.log(key)
// multiple true , file
const id = this.uuid();
this[key].push({
id,
...event?.file,
status: "uploading",
message: "上传中",
});
const result = await this.uploadFilePromise(event);
const resultInfo = JSON.parse(result);
const index = this[key]?.findIndex((v) => v.id === id);
if (resultInfo.code == 200) {
this[key].splice(
index,
1,
Object.assign(event?.file, {
status: "success",
message: "",
result: resultInfo,
url: resultInfo.result,
})
);
} else {
this.$.toast("上传失败");
this[key].splice(
index,
1,
);
}
},
//
deletePic(event, keyName) {
if (!this.editFlag) {
return
}
this[keyName].splice(event.index, 1);
},
},
onReady() {},
//
onUnload() {},
}
</script>
<style>
</style>
<style lang="scss" scoped>
.itemImg {
max-width: 660rpx;
max-height: 580rpx;
margin: 0 auto;
}
.footer-buttons {
z-index: 3;
}
page {
background: #F6F8FA;
}
.query-form {
font-size: 16px;
height: 44px;
background: #ffffff;
box-shadow: 3px 0px 10px #ccc;
color: #666666;
position: sticky;
// top: var(--status-bar-height + 88rpx);
top: calc(var(--status-bar-height) + 88rpx);
z-index: 10;
.search-box {
padding: 10px 10px 3px;
}
}
.formBox {
margin: 30rpx 20rpx;
border: 1px solid #e6e6e6;
background: #ffffff;
padding: 0 20rpx 20rpx;
box-sizing: border-box;
/deep/ .uni-forms-item--border .uni-forms-item__content {
justify-content: flex-end;
text-align: right;
}
.photo {
width: 100%;
image {
width: 100%;
}
}
}
.Box {
padding-top: var(--status-bar-height);
.Content {
width: calc(100% - 48rpx);
padding-bottom: 88rpx;
}
.Unit {
padding: 12rpx;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
box-shadow: 1px 1px 3px #ccc;
.trapezoidal {
position: absolute;
top: -0px;
right: 0px;
color: #ffffff;
font-size: 22rpx;
font-weight: normal;
z-index: 1;
}
image {
width: 200rpx;
}
.right {
flex: 1;
padding-left: 30rpx;
.title {
font-size: 16px;
width: 380rpx;
min-height: 80rpx;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.type {
font-size: 14px;
color: #666;
font-weight: normal;
text {
margin-right: 20rpx;
}
}
}
}
}
.label-box {
display: flex;
align-items: center;
height: 110rpx;
font-size: 30rpx;
font-weight: 600;
.border {
background-color: #2663BF;
height: 35rpx;
width: 6rpx;
margin-right: 14rpx;
}
}
.label-box2 {
height: 100rpx;
}
.label-box-small {
font-size: 28rpx;
margin-top: -25rpx;
font-weight: 500;
}
.border-bottom {
border-bottom: 1px #eee solid;
}
.border-top {
border-top: 1px #eee solid;
}
/deep/ .uni-forms-item__label {
font-size: 28rpx;
height: auto;
margin-bottom: 20rpx;
white-space: nowrap;
}
/deep/ .u-input {
background-color: #ffffff !important;
}
.detail-item-flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.investigation-item-zl {
.uni-forms-item--border {
border: none;
}
border-top: 1px solid #eee;
}
.btn-right {
width: 100%;
text-align: right;
}
.bottom {
position: fixed;
bottom: 0;
width: calc(100% - 40rpx);
padding: 18rpx 20rpx;
height: 80rpx;
background: #FFFFFF;
border-top: 1px solid #cccccc;
display: flex;
justify-content: space-between;
align-items: center;
z-index: 3;
}
.Img {
width: 512rpx;
height: 440rpx;
margin: 0 auto;
}
.trapezoidal {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
flex: 1;
width: 20%;
height: 100%;
box-sizing: border-box;
text-align: center;
border-radius: 10rpx;
line-height: 60rpx;
&.primary {
background: #2663BF;
color: #fff;
&::after,
&::before {
background: #2663BF;
}
}
}
.trapezoidal::before,
.trapezoidal::after {
content: '';
position: absolute;
top: 0;
width: 100%;
height: 100%;
border-radius: 10rpx;
background: #E9EDF5;
z-index: -1;
transform-origin: bottom;
box-sizing: border-box;
}
.trapezoidal::after {
left: auto;
right: 0;
border-radius: 10rpx;
background-color: #E9EDF5;
border-left: 0 none;
}
.gray {
color: gray;
}
</style>

@ -1,5 +1,6 @@
<template>
<view class="detail" @touchmove="handleTouchMove" @touchstart="handleTouchStart">
<view class="detail" @touchmove="handleTouchMove" @touchstart="handleTouchStart" :imgArr="imgArr"
:change:imgArr="renderjs.getImgArr">
<scroll-view scroll-y="true" :scroll-top="scrollTop" :style="{
height: isExpanded ? 'calc(100% - 1rpx)' : 'calc(100% - 1rpx)',
}" class="chatlist" :class="{ 'chatlist-wrapper-expanded': isExpanded }" id="scrollView" ref="scrollView"
@ -19,7 +20,8 @@
<view class="text"> 你可以这样问我: </view>
<view class="tipQuestions">
<view class="" v-for="(item, index) in tipQuestions" :key="index">
<view class="tipItem" @click="handleBtn(item.text)">
<view class="tipItem" @click="renderjs.clickSSE" :textInfo="item.text">
<view class="title">
{{ item.title }}
</view>
@ -92,14 +94,14 @@
</view>
</view> -->
<vVoice :disabled="loading" v-model="inputValue" :showUpload="false" @confirm="handleSend" />
<vVoice :disabled="loading" v-model="inputValue" :showUpload="true" @confirm="handleSend"
@dataSend="receiveRenderData" :expandedFlag="expandedFlag" @imageChoose="chooseImage"/>
<!-- <view class="downward" v-if="isToBottom" @click="toBottom">
<u-icon name="arrow-downward"></u-icon>
</view> -->
</view>
</template>
<script>
// import AbortController from "abort-controller/dist/abort-controller";
import TopTitle from "../../components/top-title.vue";
@ -158,8 +160,28 @@
lastScrollTop: 0, //
temp: 0,
iconsType: '',
expandedFlag: false,
timerCount: -1,
timer: '',
tempStr: '',
imgArr: [],
};
},
watch: {
// watch
timerCount(newVal, oldVal) {
if (this.tempStr[newVal]) {
this.msgList[this.msgList.length - 1].data += this.tempStr[newVal]
} else {
clearInterval(this.timer)
this.timer = null
this.tempStr = ''
this.timerCount = -1
this.loading = false;
}
}
},
onLoad() {
let params = uni.getStorageSync("itemMessage");
// params = JSON.parse(decodeURIComponent(this.$route.query.params))
@ -185,6 +207,121 @@
}
},
methods: {
//
chooseImage() {
uni.chooseImage({
count: 6, //9
sizeType: ["original", "compressed"], //
sourceType: ["album", 'camera'], //
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++) {
const result = await this.uploadFilePromise(res.tempFilePaths[i]);
let json = JSON.parse(result);
str += `![图${i + 1}](${json.result})`;
jsonArr.push(json.result);
}
if (this.id == 12121212) {
this.changeMsgList("0", str);
this.queryChat(res.tempFilePaths);
} else {
// this.addQuestion(str, "0");
this.SSE(jsonArr, "0");
this.changeMsgList("0", str);
let j = jsonArr.join(",");
// this.queryChat(j);
}
}
},
});
},
// SSE
SSE(voiceText, answerId) {
// const ctrl = new AbortController();
this.loading = true;
fetchEventSource($.chatUrl + "/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: ["text/event-stream", "application/json"],
},
body: JSON.stringify({
voiceText,
deptId: "3702000000",
id: "37020017407",
multiType: "",
sceneFlag: "",
stream: true,
type: "0",
userId: "admin1",
}),
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
uni.showToast({
title: 'open触发'
})
},
onmessage: (ev) => {
console.log(ev, 'SSEmessage');
const res = JSON.parse(ev.data);
if (res?.code == 200 && res.result) {
this.loading = false;
console.log(res.result.data.tabkey);
console.log(res.result.data);
this.tabkey = res.result.data.tabkey;
if (this.tabkey - 1 != this.active) {
this.active = this.tabkey - 1 > 0 ? this.tabkey - 1 : 0;
}
if (this.msgList.length == 0) {
this.msgList = [{
answerId,
data: res.result.data.content,
}, ];
} else {
// debugger
//
if (this.msgList[this.msgList.length - 1].answerId == "1") {
//
this.msgList[this.msgList.length - 1].data +=
res.result.data.content;
} else {
//
this.msgList = [
...this.msgList,
{
answerId: "1",
data: res.result.data.content,
},
];
}
}
// debugger
// this.scrollBottom();
}
},
onclose: () => {
console.log('关闭sse');
this.loading = false;
this.expandedFlag = false
if (this.isExpanded) {
this.isExpanded = !this.isExpanded;
}
},
onerror(error) {
console.log("error", error);
throw error;
},
});
return
console.log(requestTask, 'requestTaskrequestTaskrequestTaskrequestTask')
},
async clickIcon(type, qaId) {
console.log(this.msgList)
this.msgList.forEach(item => {
@ -216,7 +353,8 @@
const params = {
qaId,
feedbackStatus: this.iconsType == '' ? 0 : (this.iconsType == 'handUp' ? 1 : 2),
feedbackStatus: this.iconsType == '' ? 0 : (this.iconsType == 'handUp' ? 1 :
2),
feedbackInfo: ''
}
// this.$request.globalRequest('/hitap/feadBack', params, 'POST').then(res => {
@ -285,7 +423,7 @@
},
async queryChat(voiceText) {
// console.log(voiceText,"voiceText");
console.log(voiceText, "voiceTextvoiceTextvoiceText");
clearInterval(this.timer)
this.loading = true;
this.scrollTop = Number(this.scrollTop) + 100;
@ -342,6 +480,7 @@
},
//
handleBtn(text) {
console.log('原handleBtn触发')
this.handleSend(text);
this.isHandleScroll = true
},
@ -351,6 +490,7 @@
},
//
handleSend(text) {
console.log('handleSend触发',text)
if (!this.inputValue & !text) {
uni.showToast({
title: "请输入内容",
@ -358,10 +498,12 @@
duration: 2000,
});
}
this.loading = true;
this.temp = 0
this.isHandleScroll = true
this.changeMsgList("0", this.inputValue || text);
this.queryChat(this.inputValue || text);
// this.queryChat(this.inputValue || text);
// this.SSE(this.inputValue || text, "0");
this.inputValue = "";
},
//
@ -458,27 +600,28 @@
sizeType: ["original", "compressed"], //
sourceType: ["album"], //
success: async (res) => {
console.log(res);
this.imgArr = []
if (res.tempFilePaths && res.tempFilePaths.length) {
let str = "";
let jsonArr = [];
for (let i = 0; i < res.tempFilePaths.length; i++) {
const result = await this.uploadFilePromise(res.tempFilePaths[i]);
const result = await this.uploadFilePromise(res.tempFilePaths[
i]);
let json = JSON.parse(result);
str += `![图${i + 1}](${json.result})`;
jsonArr.push(json.result);
}
console.log(str);
this.imgArr = jsonArr
this.loading = true
if (this.id == 12121212) {
this.changeMsgList("0", str);
this.queryChat(jsonArr);
// this.queryChat(jsonArr);
} else {
// this.addQuestion(str, "0");
// this.SSE(jsonArr, "0");
// this.SSE(jsonArr, "0");
this.changeMsgList("0", str);
let j = jsonArr.join(',')
this.queryChat(j);
// this.queryChat(j);
}
}
},
@ -487,7 +630,8 @@
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.$.baseUrl + "/hiddenDanger/ftp/uploadFileToFtp", //
url: this.$.baseUrl +
"/hiddenDanger/ftp/uploadFileToFtp", //
filePath: url,
name: "file",
success: (res) => {
@ -496,6 +640,70 @@
});
});
},
//sse
receiveRenderData(data) {
const res = JSON.parse(data.data);
if (res?.code == 200 && res.result) {
this.tabkey = res.result.data.tabkey;
let content = res.result.data.content
if (this.tabkey - 1 != this.active) {
this.active = this.tabkey - 1 > 0 ? this.tabkey - 1 : 0;
}
if (this.msgList.length == 0) {
this.msgList = [{
answerId: '0',
data: res.result.data.content,
}, ];
} else {
//
if (this.msgList[this.msgList.length - 1].answerId == "1") {
this.tempStr += content
//
// this.msgList[this.msgList.length - 1].data +=
// res.result.data.content;
} else {
//
this.msgList = [
...this.msgList,
{
answerId: "1",
data: '',
},
];
this.tempStr += content
if (!this.timer) {
this.timer = setInterval(() => {
this.timerCount = this.timerCount + 1
}, 50)
}
}
}
// debugger
this.scrollBottom();
}else if (res?.code == 500 && res.message) {
this.msgList = [
...this.msgList,
{
answerId: "1",
data: res.message,
},
];
this.loading = false
}
},
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;
this.scrollTop = this.scrollTop + 100;
});
},
},
// methods: {
// // SSE
@ -793,7 +1001,73 @@
// },
};
</script>
<script module="renderjs" lang="renderjs">
import $ from "../../common/globalJs/globalJs.js";
import {
fetchEventSource
} from "@microsoft/fetch-event-source";
export default {
data() {},
mounted() {},
methods: {
getImgArr(res) {
if (res.length) {
this.newSSE(res.join(), '0')
}
},
clickSSE(e) {
let textInfo = e.instance.$vm.$el.getAttribute('textInfo');
this.$ownerInstance.callMethod('handleSend', textInfo);
this.newSSE(textInfo)
},
newSSE(voiceText, answerId = '') {
console.log('新handleBtn触发', voiceText)
// const ctrl = new AbortController();
fetchEventSource($.chatUrl + "/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: ["text/event-stream", "application/json"],
},
body: JSON.stringify({
voiceText,
deptId: "3702000000",
id: "37020017407",
multiType: "",
sceneFlag: "",
stream: true,
type: "0",
userId: "admin1",
}),
// signal: ctrl.signal,
openWhenHidden: true,
onopen: () => {
console.log('onopneSSE')
// uni.showToast({
// title: 'open'
// })
},
onmessage: (ev) => {
//
this.$ownerInstance.callMethod('receiveRenderData', ev);
},
onclose: () => {
console.log('关闭sse');
this.loading = false;
this.expandedFlag = false
if (this.isExpanded) {
this.isExpanded = !this.isExpanded;
}
},
onerror(error) {
console.log("error", error);
throw error;
},
});
},
}
}
</script>
<style scoped lang="scss">
.detail {
width: 100%;

@ -270,7 +270,12 @@
setTimeout(() => {
this.$.hideLoading('登录中...')
this.isDisabled = false
this.$.openTab('/pages/index/index')
if (res.result.role.includes('领导') || res.result.role.includes('排查人员') || res
.result.role.includes('治理人员')) {
this.$.openTab('/pages/index/index')
} else {
this.$.openTab('/pages/agricultural3W/index')
}
}, 1500)
} else {
this.$.toast(res.message)

@ -988,7 +988,7 @@
}
.dialog-one {
height: 410rpx;
// height: 410rpx;
}
.dialog-two {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Loading…
Cancel
Save