fixd:问题修复

This commit is contained in:
shijing 2023-08-07 09:18:31 +08:00
parent 40a4998fcc
commit 64416039a8
12 changed files with 839 additions and 30 deletions

View File

@ -119,6 +119,8 @@ const install = (Vue, vm) => {
let thirdBltBind = (data={}) => vm.$u.post(`/third/tdevice/blt_bind/`, data); //解绑卡
let tdevice = (data={}) => vm.$u.get(`/third/tdevice/`, data); //设备列表
let eventCateList = (data={}) => vm.$u.get(`/ecm/event_cate/`, data); //算法列表
let algoCreate = (data={}) => vm.$u.post(`/ecm/algo_vchannel/`, data); //算法列表
vm.$u.api = {
getUserInfo ,
@ -219,7 +221,10 @@ const install = (Vue, vm) => {
permissions,
thirdBltBind,
tdevice
tdevice,
eventCateList,
algoCreate
};
}

View File

@ -0,0 +1,355 @@
<template>
<view class="select-container" v-show="show" @touchmove.stop.prevent>
<!-- <view
class="mask"
:class="activeClass ? 'mask-show' : ''"
@tap="onCancel(true)"
></view> -->
<view class="select-box" :class="activeClass ? 'select-box-show' : ''">
<view class="header">
<text class="cancel" @tap="onCancel">{{ cancelText }}</text>
<view class="all" @tap="onAllToggle" v-if="allShow">
<text :class="isAll ? 'all-active' : ''">全选 </text>
</view>
<text class="confirm" @tap="onConfirm">{{ confirmText }}</text>
</view>
<view class="body-warp">
<scroll-view class="body" scroll-y="true">
<slot v-if="!data.length" name="tips">
<view class="empty-tips">暂无数据~</view>
</slot>
<view
class="select-item"
:class="[
item.disabled ? 'disabled' : '',
selectedArr[index] ? 'selected' : '',
]"
v-for="(item, index) in data"
:key="item[valueName]"
@tap="onSelected(index)"
>
<view class="label">{{ item.name }}</view>
<text v-show="selectedArr[index]" class="selected-icon"></text>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<!-- 多选组件 -->
<script>
export default {
model: {
prop: "value",
event: ["input"],
},
data() {
return {
show: true, //
activeClass: false, //
selectedArr: [], //
selectedArrOld: [], //
};
},
onShow() {
console.log(this.serviceList);
},
computed: {
//
isAll() {
let wipeDisabledList = this.returnWipeDisabledList();
if (!wipeDisabledList.length) return false;
return !wipeDisabledList.includes(false);
},
},
props: {
//
value: {
type: Boolean,
default: true,
},
//
cancelText: {
type: String,
default: "取消",
},
//
confirmText: {
type: String,
default: "确认",
},
// labelkey
labelName: {
type: String,
default: "label",
},
// valuekey
valueName: {
type: String,
default: "value",
},
//
maskCloseAble: {
type: Boolean,
default: true,
},
//
allShow: {
type: Boolean,
default: true,
},
//
mode: {
type: String,
default: "multiple",
},
//
defaultSelected: {
type: Array,
default: function () {
return [];
},
},
//
data: {
type: Array,
required: true,
default: () => {
return [];
},
},
},
created() {
console.log(this.data, "111111");
},
watch: {
async value(newVal) {
this.show = newVal;
await this.$nextTick();
this.activeClass = newVal;
if (newVal) {
this.selectedArrOld = JSON.parse(JSON.stringify(this.selectedArr));
}
},
async data(newVal) {
this.data = newVal;
await this.$nextTick();
console.log(this.data);
},
show(newVal) {
this.$emit("input", newVal);
this.$emit("change", newVal);
},
data: {
//
handler(list) {
this.selectedArr = list.map((el) => false);
this.setItemActiveState();
},
deep: true,
immediate: true,
},
defaultSelected: {
handler() {
this.setItemActiveState();
},
deep: true,
immediate: true,
},
},
methods: {
//
setItemActiveState() {
if (this.data.length && this.defaultSelected.length) {
this.data.forEach((item, i) => {
for (let n = 0; n < this.defaultSelected.length; n++) {
if (
!item.disabled &&
item[this.valueName] === this.defaultSelected[n]
) {
this.selectedArr.splice(i, 1, true);
break;
}
}
});
}
},
/**
* 选择事件
* @index {Number} 点击下标
*/
onSelected(index) {
if(this.mode === "multiple"){
if (this.data[index].disabled) return;
let index2Active = this.selectedArr[index];
this.selectedArr.splice(index, 1, !index2Active);
}else{
let index0 ;
for(let i= 0;i<this.selectedArr.length;i++){
if(index==i){
let index2Active = this.selectedArr[index];
this.selectedArr.splice(index, 1, !index2Active);
}else{
this.selectedArr[i] = false;
}
}
}
// this.selectedIds.splice(i, 1, true);
},
//
onCancel(isMask) {
if (!isMask || this.maskCloseAble) {
this.show = false;
this.selectedArr = JSON.parse(JSON.stringify(this.selectedArrOld));
} else {
return;
}
this.$emit("cancel");
},
// disabled
returnWipeDisabledList() {
let arr = [];
this.selectedArr.forEach((el, index) => {
if (!this.data[index].disabled) arr.push(el);
});
return arr;
},
// /
onAllToggle() {
let wipeDisabledList = this.returnWipeDisabledList();
// disabledfalse
if (wipeDisabledList.includes(false)) {
this.selectedArr.forEach((el, index) => {
if (!this.data[index].disabled)
this.selectedArr.splice(index, 1, true);
});
} else {
this.selectedArr.forEach((el, index) => {
if (!this.data[index].disabled)
el = this.selectedArr.splice(index, 1, false);
});
}
},
//
onConfirm() {
console.log(11212);
this.show = false;
let selectedData = [];
this.selectedArr.forEach((el, index) => {
if (el) {
console.log(el);
selectedData.push(this.data[index]);
}
});
if (this.mode === "multiple") {
this.$emit("confirm", selectedData);
} else {
let backData = selectedData[0] || {};
this.$emit("confirm", backData);
}
},
},
};
</script>
<style lang="scss" scoped>
.select-container {
width: 100vw;
height: calc(100% - 110rpx);
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
padding: 10upx;
$paddingLR: 18rpx;
.mask {
width: 100%;
height: 100%;
background-color: $uni-bg-color-mask;
opacity: 0;
transition: opacity 0.3s;
&.mask-show {
opacity: 1;
}
}
//
.select-box {
width: 100%;
height: 100%;
background-color: #ffffff;
&.select-box-show {
transform: translateZ(0);
}
.header {
display: flex;
box-sizing: border-box;
width: 100%;
justify-content: space-between;
border-bottom: 1px solid $uni-border-color;
line-height: 76rpx;
font-size: 30rpx;
padding: 0 $paddingLR;
.cancel {
color: $uni-text-color-grey;
}
.all {
color: $uni-color-success;
.all-active {
&::after {
display: inline-block;
content: "✔";
padding-left: 8rpx;
}
}
}
.confirm {
color: $uni-color-primary;
}
}
.body-warp {
width: 100%;
height: calc(100% - 80rpx);
box-sizing: border-box;
padding: 20rpx $paddingLR;
}
.body {
width: 100%;
height: 100%;
overflow-y: auto;
.empty-tips {
margin-top: 25%;
text-align: center;
font-size: 26rpx;
color: $uni-color-error;
}
.select-item {
display: flex;
font-size: 26rpx;
line-height: 58rpx;
color: #303133;
position: relative;
transition: all 0.3s;
&.selected {
color: $uni-color-primary;
}
&.disabled {
color: $uni-text-color-disable;
}
> .label {
flex: 1;
text-align: center;
}
> .selected-icon {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
}
}
}
}
}
</style>

View File

@ -2,8 +2,8 @@
"name" : "曲阳金隅EHS",
"appid" : "__UNI__B00D419",
"description" : "曲阳金隅EHS",
"versionName" : "1.01.44",
"versionCode" : 101044,
"versionName" : "1.01.50",
"versionCode" : 10150,
"transformPx" : false,
/* 5+App */
"app-plus" : {

View File

@ -394,6 +394,22 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/my/suanfa",
"style": {
"navigationBarTitleText": "算法布设",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/my/alogadd",
"style": {
"navigationBarTitleText": "批量布设",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/visit/visitor",
"style": {
@ -428,6 +444,24 @@
}
}
,{
"path" : "pages/my/suanfa",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/my/alogadd",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",

121
pages/my/alogadd.vue Normal file
View File

@ -0,0 +1,121 @@
<template>
<view class="operation-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110upx" leftWidth="200rpx" leftText="选择监控"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<multiple-select
class="multipleSelect"
v-model="formData.vchannels"
:data="vchannelOptions"
:default-selected="defaultSelected"
@confirm="saveConfirm"
@cancel = "saveCancel"
:value="multipleShow"
></multiple-select>
</view>
</template>
<script>
var that;
import multipleSelect from "./../../components/multiple-select.vue";
import nonNullCheck from './../../utils/nonNullCheck.js';
export default {
name: "operation",
components: {
multipleSelect,
},
data() {
return {
defaultSelected: [], //
serviceList: [],//
formData: {
algo: '',
vchannels:[],
},
multipleShow:true,
vchannelOptions: [],
}
},
onLoad(params) {
this.formData.algo = params.algo;
},
onShow() {
this.getVchannelOptions();
},
methods: {
getVchannelOptions() {
this.$u.api.tdevice({ type: 60, page: 0}).then(res=>{
this.vchannelOptions = res;
})
},
saveConfirm(data){
debugger;
console.log(data)
let that = this;
let ids = [];
data.forEach(item=>{
ids.push(item.id)
})
that.formData.vchannels = ids;
console.log(that.formData)
// that.$u.api.algoCreate(that.formData).then(res=>{
// uni.navigateBack({
// delta: 1
// })
// })
},
saveCancel(){
uni.navigateBack({
delta: 1
})
},
/* 参数验证 */
paramsCheck() {
if (!nonNullCheck(this.formData.area)) {
uni.showToast({
title: '请选择监控设备',
icon: "none"
})
return false;
}
return true;
},
goBack() {
uni.navigateBack({
delta: 1
})
},
}
}
</script>
<style scoped>
/* 主体 */
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.operation-body {
background-color: #f3fbff;
padding-bottom: 20rpx;
}
.operation-body>>>uni-input {
/* height: 100%; */
font-size: 30rpx;
}
>>>.uni-navbar-btn-text text {
font-size: 32rpx !important;
}
.multipleSelect{
}
</style>

View File

@ -70,6 +70,12 @@
<text class="title-text">修改密码</text>
<uni-icons size="13" color="#b9b9b9" class="right-icon" type="right"></uni-icons>
</view>
<!-- <view class="enter-item" @click="goInto('suanfa')" v-if="vuex_user.type=='employee'">
<image style="width: 34rpx;height: 30rpx;" class="left-icon" src="../../static/my/wodeziliao.png"
mode=""></image>
<text class="title-text">算法布设</text>
<uni-icons size="13" color="#b9b9b9" class="right-icon" type="right"></uni-icons>
</view> -->
</view>
<view class="sign-out">
<button type="default" @click="signoutFn" class="sign-out-btn">退出账号</button>
@ -141,6 +147,11 @@
url: '/pages/my/passwordChange'
})
}
else if (type == "suanfa") {
uni.navigateTo({
url: '/pages/my/suanfa'
})
}
},
getUserInfo() {
var promise;

288
pages/my/suanfa.vue Normal file
View File

@ -0,0 +1,288 @@
<template>
<view class="list-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="400rpx" leftText="算法布设"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="oplCate-info">
<view class="uni-list-cell uni-list-cell-pd" v-for="row in dateList" :key="row.id" >
<view>
<view class="name">名称{{row.name}}</view>
<view class="name">标识:{{row.code}}</view>
<view class="name">
触发
<text v-if="row.trigger==10">监控</text>
<text v-else-if="row.trigger==20">定位</text>
</view>
<view class="name">
喇叭
<text v-if="row.speaker_on">已开</text>
<text v-else>未开</text>
<!-- <switch :checked="row.speaker_on" disabled="1"></switch> -->
</view>
<view class="name">
喇叭区域
<text v-if="row.filter_area_level==10">办公生活区以上</text>
<text v-else-if="row.filter_area_level==20">生产一般区以上</text>
<text v-else-if="row.filter_area_level==30">生产重点区以上</text>
</view>
<button v-if="vuex_user.type=='employee'" type="primary" size="mini" @click="bindBtl(row)">批量布设</button>
<!-- <button v-if="vuex_user.type=='employee'" type="primary" size="mini" @click="createNew(row)">新增布设</button> -->
</view>
</view>
</view>
<view id="detailWrap" v-if="detailLimited">
<view class="workerContainer">
<view style="font-size: 30upx;text-align: center;font-weight: 600;">新增布设</view>
<view class="form-info">
<view class="form-content ">
<view class="form-item border-bottom">
<view class="form-left">
<text class="form-left-text">关联算法</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.algo" :localdata="options">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="form-left-text">监控相机</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.vchannel" :localdata="vchanneloptions">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="form-left-text">常开</text>
</view>
<view class="form-right">
<switch :checked="formData.always_on"></switch>
</view>
</view>
</view>
</view>
<view class="btnsWrap">
<view class="btns cancel" @click="closeWorkerDetail">取消</view>
<view class="btns equit" @click="saveAlog">保存</view>
</view>
</view>
<!-- <icon class="closeDetailIcon" type="cancel" size="36" color="#fefefe" @click="closeWorkerDetail"/> -->
</view>
</view>
</template>
<script>
export default {
name: "myDateList",
data() {
return {
dateList: [],
options:[],
vchanneloptions:[],
detailLimited:false,
formData:{
always_on:true
}
}
},
onShow() {
// debugger;
// console.log(this.vuex_perm)
this.dateList = [];
this.getVchannel();
this.getDateLists();
},
methods: {
//
getDateLists(e) {
let that = this;
that.dateList =[];
that.$u.api.eventCateList({page: 0})
.then((res) => {
that.dateList = res;
let options = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
options.push(obj);
})
this.options = options
});
},
//
getVchannel() {
this.$u.api.tdevice({ type: 60, page: 0 }).then((res) => {
let vchannelOptions = [];
let obj = {};
res.forEach(item => {
obj.value = item.id;
obj.text = item.name;
vchannelOptions.push(obj);
})
this.vchannelOptions = vchannelOptions
debugger;
console.log(vchannelOptions)
});
},
bindBtl(row){
const params = `?algo=${row.id}`;
uni.navigateTo({
url: '/pages/my/alogadd'+params
})
},
switchChange(e) {
console.log(e,e.detail.value,'85');
},
createNew(){
this.detailLimited=true;
},
saveAlog(){
this.$u.api.algoCreate(this.formData).then((res) => {
this.detailLimited=false;
});
},
closeWorkerDetail(){
this.detailLimited=false;
},
goBack() {
uni.navigateBack({
delta: 1
})
},
}
}
</script>
<style>
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.list-body {
background-color: #f3fbff;
padding-bottom: 20px;
height: 100%;
min-height:100vh;
}
.oplCate-info {
width: 360px;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 5px;
padding: 12px 16px;
box-sizing: border-box;
margin-top: 12px;
}
.oplCate-info-title {
font-size: 32upx;
color: #333333;
font-weight: bold;
border-bottom: 1upx solid #eeeeee;
height: 70upx;
}
.row {
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell {
display: flex;
padding: 10upx;
padding: 30upx 0;
justify-content: space-between;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell:last-child {
border-bottom: 0;
}
.oplEditImg {
width: 40rpx;
height: 40upx;
background-size: cover;
background-image: url('@/static/workSpace/new_apply/update.png');
}
.oplAddImg {
width: 40rpx;
height: 40upx;
}
.add {
position: fixed;
bottom: 0;
width: 100%;
height: 120upx;
justify-content: center;
align-items: center;
}
.btn {
margin: auto;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
width: 70%;
}
.save-btn {
height: 80rpx;
color: #fff;
font-size: 30upx;
justify-content: center;
align-items: center;
}
#detailWrap{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 100;
background-color: rgba(0,0,0,.3);
}
.workerContainer{
background-color: #ffffff;
width: 90%;
margin: auto;
position: absolute;
top: 30%;
left: 5%;
border-radius: 20upx;
box-sizing: border-box;
padding: 20upx 20upx 100upx 20upx ;
}
.btnsWrap{
width: 100%;
display: flex;
position: absolute;
bottom: 0;
left: 0;
height: 80upx;
line-height: 80upx;
}
.btnsWrap>.btns{
width: 50%;
text-align: center;
color: #aaaaaa;
box-sizing: border-box;
border-top: 1upx solid #eeeeee;
}
.btnsWrap>.btns.equit{
color:#e64340 ;
border-left: 1upx solid #eeeeee;
}
</style>

View File

@ -88,8 +88,15 @@
</view>
<view class="uni-form-item">
<view class="title">检测人</view>
<uni-data-select class="content" :localdata="workerRange" v-model="formData.checker">
<!-- <uni-data-select class="content" :localdata="workerRange" v-model="formData.checker">
</uni-data-select>
-->
<view class="content" style="position: relative;">
<view @click="showCheckerPicker" style="position: relative;display: flex;">
<text type="text" >{{checker_name}}</text>
<uni-icons style="position: absolute; right: 0;top: 32upx;" type="arrowright" color="#999999"/>
</view>
</view>
</view>
<view class="uni-btn-v">
<button class="mini-btn" type="primary" size="mini" form-type="submit">确定</button>
@ -123,10 +130,10 @@
is_ok:true,
checker:'',
},
checker_name:'',
initform: {},
oplDetail:{},
gasCheckList: [],
workerRange: [],
certificateRange: [],
}
},
@ -137,11 +144,16 @@
onShow() {
this.gasCheckList = [];
this.getOplDetail();
this.getWorkerRange();
this.getGasCheckList();
this.getInit();
},
methods: {
showCheckerPicker() {
let params='?type=checker&typeName=checker_name'
uni.navigateTo({
url:"../../comm/userSelect/index"+params
})
},
remove(row){
this.$u.api.oplGasDelete(row.id).then(res => {
this.getGasCheckList()
@ -170,23 +182,6 @@
console.log(res);
});
},
//
getWorkerRange() {
let that = this;
that.$u.api.userList({
page: 0
}).then(res => {
let workerRange = [];
let obj = {};
res.forEach(item => {
obj = item;
obj.value = item.id;
obj.text = item.name;
workerRange.push(obj);
})
that.workerRange = workerRange
})
},
//
getGasCheckList() {
let that = this;

View File

@ -473,7 +473,7 @@
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}`;
params = `?oplId=${that.oplId}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
@ -482,7 +482,7 @@
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}`;
params = `?oplId=${res.id}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})

View File

@ -477,7 +477,7 @@
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}`;
params = `?oplId=${that.oplId}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
@ -486,7 +486,7 @@
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}`;
params = `?oplId=${res.id}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})

View File

@ -590,7 +590,7 @@
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}`;
params = `?oplId=${that.oplId}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
@ -599,7 +599,7 @@
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}`;
params = `?oplId=${res.id}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})

View File

@ -71,7 +71,7 @@
</view>
</view>
</view>
<button v-if="vuex_user.type=='employee'" type="warn" class="backCard" @click="bindBtl">退定位卡</button>
<button v-if="vuex_user.type=='employee'" type="warn" class="backCard" @click="bindBtl">定位卡查看</button>
<view id="detailWrap" v-if="detailLimited">
<view class="workerContainer">
<view v-if="itemDetail.employee_">