flx:优化

This commit is contained in:
Rain_ 2025-11-27 17:15:44 +08:00
parent 6850d543f7
commit 1c1cdaeec3
6 changed files with 221 additions and 77 deletions

View File

@ -15,17 +15,38 @@
</van-field> </van-field>
<text @click="confirm">确认</text> <text @click="confirm">确认</text>
</view> </view>
<!-- <view class="g-picker-list"> --> <!-- 使用计算属性实现滚动加载 -->
<scroll-view class="g-picker-list" scroll-y="true"> <scroll-view
<view class="g-picker-item" v-for="(col, inx) in searchList" :key="inx" class="g-picker-list"
@click="checkItem(col, inx)"> scroll-y="true"
<view :class="['g-picker-item_label', col._check ? 'g-picker-item--actived' : '']" @scrolltolower="loadMore"
:style="{color: col._check ? activedColor : '#333'}">{{ col[filter.label] }}</view> ref="scrollView"
<u-icon class="g-picker-item_icon" v-show="col._check" name="checkbox-mark" >
:color="activedColor"></u-icon> <view
class="g-picker-item"
v-for="(col, inx) in displayData"
:key="col[this.filter.value] || inx"
@click="checkItem(col, inx)"
>
<view
:class="['g-picker-item_label', col._check ? 'g-picker-item--actived' : '']"
:style="{color: col._check ? activedColor : '#333'}"
>
{{ col[filter.label] }}
</view>
<u-icon
class="g-picker-item_icon"
v-show="col._check"
name="checkbox-mark"
:color="activedColor"
></u-icon>
</view>
<!-- 加载状态提示 -->
<view class="load-more" v-if="hasMoreData || isLoading">
<text v-if="isLoading">加载中...</text>
<text v-else-if="!hasMoreData">没有更多了</text>
</view> </view>
</scroll-view> </scroll-view>
<!-- </view> -->
</view> </view>
</van-popup> </van-popup>
</view> </view>
@ -90,6 +111,11 @@
placeholder: { placeholder: {
type: String, type: String,
default: "请选择" default: "请选择"
},
//
pageSize: {
type: Number,
default: 50
} }
}, },
data() { data() {
@ -98,6 +124,9 @@
columnsList: [], columnsList: [],
value_chx: [], value_chx: [],
searchName: "", searchName: "",
//
currentPage: 1,
isLoading: false
} }
}, },
watch: { watch: {
@ -115,21 +144,55 @@
this.$set(val, '_check', false) this.$set(val, '_check', false)
} }
} }
//
this.currentPage = 1
}, },
immediate: true immediate: true
}, },
//
searchName: {
handler() {
this.currentPage = 1
}
},
//
show: {
handler(newVal) {
if (newVal) {
this.$nextTick(() => {
//
if (this.$refs.scrollView) {
this.$refs.scrollView.scrollTop = 0
}
})
}
}
}
}, },
computed: { computed: {
searchList() { //
const resultList = this.columnsList.filter(item => this.searchName ? item[this.filter.label].includes(this.searchName) : true) filteredData() {
const resultList = this.columnsList.filter(item =>
this.searchName ? item[this.filter.label].includes(this.searchName) : true
)
//
this.defaultList.forEach(item => { this.defaultList.forEach(item => {
const find = resultList.find(ele => ele[this.filter.value] == item); const find = resultList.find(ele => ele[this.filter.value] == item);
if(find) { if(find) {
find._check = true; find._check = true;
} }
}) })
// console.log(resultList, 1111)
return resultList; return resultList;
},
// 使
displayData() {
//
const endIndex = this.currentPage * this.pageSize;
return this.filteredData.slice(0, endIndex);
},
//
hasMoreData() {
return this.displayData.length < this.filteredData.length;
} }
}, },
methods: { methods: {
@ -137,6 +200,20 @@
if (this.disabled) return if (this.disabled) return
this.show = true this.show = true
}, },
//
loadMore() {
//
if (this.isLoading || !this.hasMoreData) return;
this.isLoading = true;
//
setTimeout(() => {
//
this.currentPage++;
this.isLoading = false;
}, 100);
},
reShow() { reShow() {
let data = this.value.split(",") let data = this.value.split(",")
setTimeout(() => { setTimeout(() => {
@ -148,14 +225,11 @@
checkItem(col, inx) { checkItem(col, inx) {
col._check = !col._check col._check = !col._check
}, },
// close() {
// this.show = false
// this.$emit("close")
// },
confirm() { confirm() {
let value = [], let value = [],
label = [] label = []
this.value_chx = this.columns.filter(v => v._check) //
this.value_chx = this.columnsList.filter(v => v._check)
for (let val of this.value_chx) { for (let val of this.value_chx) {
value.push(val[this.filter.value]) value.push(val[this.filter.value])
label.push(val[this.filter.label]) label.push(val[this.filter.label])
@ -216,7 +290,6 @@
.g-picker-list { .g-picker-list {
min-height: 30vh; min-height: 30vh;
max-height: 60vh; max-height: 60vh;
// overflow-y: scroll;
.g-picker-item { .g-picker-item {
position: relative; position: relative;
@ -244,6 +317,14 @@
transform: translateY(-50%); transform: translateY(-50%);
} }
} }
//
.load-more {
text-align: center;
padding: 20rpx 0;
font-size: 24rpx;
color: #999;
}
} }
} }
} }

View File

@ -88,8 +88,8 @@ export function createApp() {
// app.config.globalProperties.url_config = 'http://182.90.224.237:51234/' //雄哥内网穿透地址 // app.config.globalProperties.url_config = 'http://182.90.224.237:51234/' //雄哥内网穿透地址
// app.config.globalProperties.url_config = 'http://jxj.zhgdyun.com:61212/' //杰哥内网穿透地址 // app.config.globalProperties.url_config = 'http://jxj.zhgdyun.com:61212/' //杰哥内网穿透地址
// app.config.globalProperties.url_config = 'http://192.168.34.221:28888/' //郭圣雄本地 // app.config.globalProperties.url_config = 'http://192.168.34.221:28888/' //郭圣雄本地
// app.config.globalProperties.url_config = 'http://192.168.34.221:9111/' //郭圣雄本地 app.config.globalProperties.url_config = 'http://192.168.34.221:19113/' //郭圣雄本地
app.config.globalProperties.url_config = 'http://101.43.164.214:11000/' //包头映射 // app.config.globalProperties.url_config = 'http://101.43.164.214:11000/' //包头映射
app.config.globalProperties.work_url = 'http://192.168.34.133:5173/wflowApp/#/' // 工作流地址 app.config.globalProperties.work_url = 'http://192.168.34.133:5173/wflowApp/#/' // 工作流地址
// app.config.globalProperties.url_config = 'http://182.90.224.237:51234/' //郭圣雄本地 // app.config.globalProperties.url_config = 'http://182.90.224.237:51234/' //郭圣雄本地
// app.config.globalProperties.url_config = 'http://192.168.34.155:19111/' //彭洁本地 // app.config.globalProperties.url_config = 'http://192.168.34.155:19111/' //彭洁本地

View File

@ -1,16 +1,20 @@
<template> <template>
<view> <view>
<view class="barBox"> <view class="barBox">
<headers :showBack="true"> <headers class="" :showBack="true">
<view class="headerName">
违章处置
</view>
</headers>
<!-- <headers :showBack="true">
<view class="title"> <view class="title">
<view class="backBtn"> <view class="backBtn">
<view> <view>
<!-- <span class="back" @click="goBack()">返回</span> -->
<span class="tip">违章处置</span> <span class="tip">违章处置</span>
</view> </view>
</view> </view>
</view> </view>
</headers> </headers> -->
</view> </view>
<view class="content"> <view class="content">
<view class="row-line"> <view class="row-line">
@ -45,7 +49,7 @@
</option> </option>
</select> --> </select> -->
<view class="row-input"> <view class="row-input">
<picker mode="selector" :range="workerList" range-key="workerName" @change="onChange" filterable> <!-- <picker mode="selector" :range="workerList" range-key="workerName" @change="onChange" filterable>
<view class="picker" style="margin-left: 24rpx;"> <view class="picker" style="margin-left: 24rpx;">
<view class="" style="color: #e1e1e1;" v-if="!selectedItem.workerName"> <view class="" style="color: #e1e1e1;" v-if="!selectedItem.workerName">
请选择违章人员 请选择违章人员
@ -54,7 +58,10 @@
{{selectedItem.workerName}} {{selectedItem.workerName}}
</view> </view>
</view> </view>
</picker> </picker> -->
<g-picker style="flex: 1" :searchFlag="true" :value="selectedItem.workerName" :columns="workerList"
:filter="{label: 'workerName', value: 'id'}" input-align="left"
@confirm="handleChangeEnterprise"></g-picker>
</view> </view>
</view> </view>
</view> </view>
@ -130,6 +137,13 @@
this.getWorkerList() this.getWorkerList()
}, },
methods: { methods: {
handleChangeEnterprise(e, values, labels) {
// console.log(e, values, labels)
// this.workerId = values.join(',');
this.workerId = values;
this.selectedItem.workerName = labels.join('、')
// selectedItem.workerName
},
onChange(e) { onChange(e) {
const index = e.detail.value; const index = e.detail.value;
this.selectedItem = this.workerList[index]; this.selectedItem = this.workerList[index];
@ -335,6 +349,9 @@
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 6rpx; border-radius: 6rpx;
.g-picker {
padding: 24rpx 32rpx;
}
} }
.select-container{ .select-container{
// height: 80px; // height: 80px;
@ -367,7 +384,8 @@
height: 44px; height: 44px;
line-height: 44px; line-height: 44px;
font-size: 40rpx; font-size: 40rpx;
width: 750rpx; width: 100%;
// width: 750rpx;
// background-color: #5181F6; // background-color: #5181F6;
// color: #fff; // color: #fff;
text-align: center; text-align: center;

View File

@ -1,16 +1,20 @@
<template> <template>
<view> <view>
<view class="barBox"> <view class="barBox">
<headers :showBack="true"> <headers class="" :showBack="true">
<view class="headerName">
违章处置
</view>
</headers>
<!-- <headers :showBack="true">
<view class="title"> <view class="title">
<view class="backBtn"> <view class="backBtn">
<view> <view>
<!-- <span class="back" @click="goBack()">返回</span> -->
<span class="tip">违章处置</span> <span class="tip">违章处置</span>
</view> </view>
</view> </view>
</view> </view>
</headers> </headers> -->
</view> </view>
<view class="content"> <view class="content">
<!-- <view class="row-line"> <!-- <view class="row-line">
@ -69,7 +73,7 @@
</view> </view>
<view class="row-content"> <view class="row-content">
<view class="row-input"> <view class="row-input">
<picker mode="selector" :range="workerList" range-key="workerName" @change="onChange" filterable> <!-- <picker mode="selector" :range="workerList" range-key="workerName" @change="onChange" filterable>
<view class="picker" style="margin-left: 24rpx;"> <view class="picker" style="margin-left: 24rpx;">
<view class="" style="color: #e1e1e1;" v-if="!selectedItem.workerName"> <view class="" style="color: #e1e1e1;" v-if="!selectedItem.workerName">
请选择违章人员 请选择违章人员
@ -78,7 +82,10 @@
{{selectedItem.workerName}} {{selectedItem.workerName}}
</view> </view>
</view> </view>
</picker> </picker> -->
<g-picker style="flex: 1" :searchFlag="true" :value="selectedItem.workerName" :columns="workerList"
:filter="{label: 'workerName', value: 'id'}" input-align="left"
@confirm="handleChangeEnterprise"></g-picker>
</view> </view>
</view> </view>
</view> </view>
@ -172,7 +179,13 @@
this.alarmType = this.alarmTypeItem.data this.alarmType = this.alarmTypeItem.data
console.log("change!!!!!!!!!") console.log("change!!!!!!!!!")
}, },
handleChangeEnterprise(e, values, labels) {
// console.log(e, values, labels)
// this.workerId = values.join(',');
this.workerId = values;
this.selectedItem.workerName = labels.join('、')
// selectedItem.workerName
},
confirm(){ confirm(){
console.log(">>>>>>>>>>>>>>>>>>>>>>>"); console.log(">>>>>>>>>>>>>>>>>>>>>>>");
console.log(this.selectedItem); console.log(this.selectedItem);
@ -509,6 +522,9 @@
display: flex; display: flex;
align-items: center; align-items: center;
border-radius: 6rpx; border-radius: 6rpx;
.g-picker {
padding: 24rpx 32rpx;
}
} }
.select-container{ .select-container{
// height: 80px; // height: 80px;

View File

@ -24,7 +24,7 @@
</picker> </picker>
</view> </view>
</view> </view>
<view class="alarm_main" :style="{paddingTop: (mobileTopHeight + 90) * 1.5 + 'rpx'}"> <view class="alarm_main" :style="{paddingTop: (mobileTopHeight + 110) * 1.5 + 'rpx'}">
<!-- <view class="alarm-item" v-for="(item,index) in listData" :key="index" @click="goHiidden()"> --> <!-- <view class="alarm-item" v-for="(item,index) in listData" :key="index" @click="goHiidden()"> -->
<view class="alarm-item" v-for="(item,index) in listData" :key="index"> <view class="alarm-item" v-for="(item,index) in listData" :key="index">
<view class="item-bottom"> <view class="item-bottom">
@ -55,7 +55,8 @@
<!-- <view class="header-info">{{}}</view> --> <!-- <view class="header-info">{{}}</view> -->
<view class="header-info"> <view class="header-info">
<!-- 车辆报警 --> <!-- 车辆报警 -->
{{ item.alarmType ? showType[item.alarmType - 1].value : '' }} <!-- {{ item.alarmType ? showType[item.alarmType].value : '' }} -->
{{ item.carNumber }}({{ item.currentSpeed }}km/h)
</view> </view>
<view class="logo"> <view class="logo">
<image src="/static/aiWarn/aiWarn.png"></image> <image src="/static/aiWarn/aiWarn.png"></image>
@ -112,42 +113,7 @@
systemInfo: { systemInfo: {
statusBarHeight: 0 statusBarHeight: 0
}, },
showType: [{ showType: [],
id: "",
value: '全部',
},{
id: 1,
value: '安全帽报警',
},
{
id: 2,
value: '明火报警'
},
{
id: 3,
value: '聚众报警'
},
{
id: 4,
value: '未戴安全帽报警'
},
{
id: 5,
value: '越界报警'
},
{
id: 6,
value: '闯入报警'
},
{
id: 7,
value: '反光衣报警'
},
{
id: 8,
value: '未穿反光衣'
},
],
btnAuth: true, btnAuth: true,
userInfo: {}, userInfo: {},
searchDate: "", searchDate: "",
@ -165,6 +131,7 @@
}) })
this.userInfo = JSON.parse(uni.getStorageSync('userInfo')); this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
this.searchForm.attendanceDate = GetDateStr(0, '-'); this.searchForm.attendanceDate = GetDateStr(0, '-');
this.getAlarmTypeList();
}, },
onShow() { onShow() {
this.systemInfo = uni.getStorageSync('systemInfo') this.systemInfo = uni.getStorageSync('systemInfo')
@ -197,6 +164,30 @@
console.log('this.mobileTopHeight', this.mobileTopHeight) console.log('this.mobileTopHeight', this.mobileTopHeight)
}, },
methods: { methods: {
getAlarmTypeList() {
this.sendRequest({
url: 'xmgl/dictionaryItem/list',
data: {
projectSn: this.projectSn,
dictionaryEncoding: "car_danger_detect_record_alarm_type"
},
success: res => {
if (res.code == 200) {
console.log('alarmTypeList', res)
const dataList = res.result.map(item => {
return {
id: item.data,
value: item.name,
}
})
this.showType = [{
id: "",
value: '全部',
}, ...dataList]
}
}
})
},
changeDate(e) { changeDate(e) {
this.searchForm.attendanceDate = e.detail.value this.searchForm.attendanceDate = e.detail.value
this.pageNo = 1 this.pageNo = 1

View File

@ -42,10 +42,28 @@
<view class="row-line"> <view class="row-line">
<view class="row-label"> <view class="row-label">
<text style="color: firebrick;">*</text> <text style="color: firebrick;">*</text>
<text>违规地点</text> <text>来源</text>
</view> </view>
<view class="row-content"> <view class="row-content">
<input class="uni-input" placeholder="请输入违规地点" :value="alarmDesc" @blur="bindTextAreaBlur" /> <input class="uni-input" placeholder="请输入来源" :value="alarmDesc" @blur="bindTextAreaBlur" />
</view>
</view>
<view class="row-line">
<view class="row-label">
<text style="color: firebrick;">*</text>
<text>车牌号</text>
</view>
<view class="row-content">
<input class="uni-input" placeholder="请输入车牌号" :value="carNumber" @blur="bindTextAreaBlur" />
</view>
</view>
<view class="row-line">
<view class="row-label">
<text style="color: firebrick;">*</text>
<text>当前车速(km/h)</text>
</view>
<view class="row-content">
<input class="uni-input" placeholder="请输入当前车速" :value="currentSpeed" @blur="bindTextAreaBlur" />
</view> </view>
</view> </view>
<view class="row-line"> <view class="row-line">
@ -170,6 +188,8 @@
isDis: '1', isDis: '1',
workerId: [], workerId: [],
alarmDesc: '', alarmDesc: '',
carNumber: "",
currentSpeed: "",
deductScore: '', deductScore: '',
workerList: [], workerList: [],
workerInfoList: [], workerInfoList: [],
@ -308,7 +328,21 @@
} }
if (!this.alarmDesc) { if (!this.alarmDesc) {
uni.showToast({ uni.showToast({
title: '请输入违规地点', title: '请输入来源',
icon: "none"
})
return
}
if (!this.carNumber) {
uni.showToast({
title: '请输入车牌号',
icon: "none"
})
return
}
if (!this.currentSpeed) {
uni.showToast({
title: '请输入当前车速',
icon: "none" icon: "none"
}) })
return return
@ -329,6 +363,8 @@
handleResult: 1, handleResult: 1,
handleDone: true, handleDone: true,
alarmDesc: this.alarmDesc, alarmDesc: this.alarmDesc,
carNumber: this.carNumber,
currentSpeed: this.currentSpeed,
handleType: this.isDis, handleType: this.isDis,
workerInfoList: this.workerId.map(item => { workerInfoList: this.workerId.map(item => {
return { return {
@ -384,7 +420,7 @@
url: 'xmgl/dictionaryItem/list', url: 'xmgl/dictionaryItem/list',
data: { data: {
projectSn: this.projectSn, projectSn: this.projectSn,
dictionaryEncoding: "ai_analyse_hard_ware_alarm_record_type" dictionaryEncoding: "car_danger_detect_record_alarm_type"
}, },
success: res => { success: res => {
if (res.code == 200) { if (res.code == 200) {
@ -416,9 +452,11 @@
} }
}, },
cleanForm() { cleanForm() {
this.workerId = '' this.workerId = '';
this.alarmDesc = '' this.alarmDesc = '';
this.deductScore = '' this.carNumber = '';
this.currentSpeed = '';
this.deductScore = '';
}, },
bindTextAreaBlur(e) { bindTextAreaBlur(e) {
this.alarmDesc = e.detail.value this.alarmDesc = e.detail.value