联调app

This commit is contained in:
guanj
2026-03-30 08:43:13 +08:00
parent 00e34c168f
commit 66cee2922d
64 changed files with 6112 additions and 2987 deletions

View File

@@ -12,13 +12,20 @@
<view class="uni-card__header" @click="jump(device)">
<view class="uni-card__header-box">
<view class="uni-card__header-avatar">
<view class="event-icon">
<view
class="event-icon"
:style="{ backgroundColor: getColor(device.runStatus, device.devType) }"
>
<!-- 动态图标根据类型切换 -->
<uni-icons
custom-prefix="iconfont"
:type="device.devType == 'Direct_Connected_Device' ? 'icon-shebei2' : 'icon-shebei1'"
:color="device.runStatus == 1 ? '#ff3b30' : '#67c23a'"
size="45"
:type="
device.devType == 'Direct_Connected_Device'
? 'icon-zaixianjianceshebei'
: 'icon-shebei1'
"
:color="device.runStatus == 1 ? '#ff3b30' : '#10B981'"
:size="device.devType == 'Direct_Connected_Device' ? '35' : '40'"
></uni-icons>
</view>
</view>
@@ -66,6 +73,7 @@
<text>{{ device.process == 2 ? '功能调试' : '出厂调试' }}</text>
</view>
</view>
<view class="pinToTop" v-if="device.isTop == 1"> 置顶 </view>
</uni-card>
</template>
<script>
@@ -133,16 +141,26 @@ export default {
})
}
},
getColor(status, type) {
if (status == 1) {
return '#ff3b3020'
} else {
return '#10b98120' //type == 'Direct_Connected_Device' ? '#10b98120' : ''
}
},
},
}
</script>
<style lang="scss">
.device-body {
padding: 20rpx;
padding: 10rpx 20rpx 20rpx;
.device-body-item {
display: flex;
justify-content: space-between;
font-size: 26rpx;
color: #666666;
line-height: 1.2;
}
}
.uni-card {
@@ -158,18 +176,19 @@ export default {
border-bottom: 2rpx #ebeef5 solid;
flex-direction: row;
align-items: center;
padding: 20rpx;
padding: 20rpx 20rpx 10rpx 0;
overflow: hidden;
}
}
.uni-card .uni-card__header .uni-card__header-content .uni-card__header-content-title {
font-size: 15px;
font-size: 28rpx;
color: #3a3a3a;
font-weight: 700;
}
.uni-card .uni-card__header .uni-card__header-content .uni-card__header-content-subtitle {
font-size: 12px;
// margin-top: 5px;
color: #909399;
color: #666666;
}
.uni-card .uni-card__header .uni-card__header-avatar .uni-card__header-avatar-image {
width: 40px;
@@ -191,8 +210,8 @@ export default {
}
.event-icon {
position: relative;
// width: 120rpx;
height: 120rpx;
width: 100rpx;
height: 100rpx;
border-radius: 12rpx;
display: flex;
justify-content: center;
@@ -232,4 +251,23 @@ export default {
background-color: #36cfc920;
color: #36cfc9;
}
.pinToTop {
background-color: $uni-theme-color;
width: 100rpx;
height: 60rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
font-size: 20rpx;
position: absolute;
top: 0rpx;
right: 0rpx;
position: absolute;
top: 0;
right: 0;
/* 核心:旋转成斜三角效果 */
transform: rotate(45deg) translate(50rpx, -10rpx);
transform-origin: top right;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<view class="nav choose">
<view class="nav-menu" :class="{ 'nav-menu-active': select.engineeringName }" @click="selectEngineering"
<view class="nav-menu" @click="selectEngineering" v-if="showQianTree"
>{{
// select.engineeringName + '>' + select.projectName + '>' + select.deviceName + '>' + select.lineName ||
// '全部工程'
@@ -10,7 +10,7 @@
.join('>')
: '全部工程'
}}
<uni-icons type="bottom" size="14" :color="select.engineeringName ? '#376cf3' : '#666'"></uni-icons>
<uni-icons type="bottom" size="14"></uni-icons>
</view>
<!-- 弹框组件 -->
<Cn-qianTree
@@ -19,6 +19,7 @@
:multiple="false"
:range="list"
:foldAll="true"
:singleChoice="singleChoice"
@confirm="treeConfirm"
@cancel="treeCancel"
></Cn-qianTree>
@@ -42,6 +43,12 @@
<uni-icons type="bottom" size="14"></uni-icons>
</view>
</uni-datetime-picker>
<picker @change="bindReport" v-if="report" :value="select.report" :range="reportList">
<view class="nav-menu"
>{{ reportList[select.report] }}
<uni-icons type="bottom" size="14"></uni-icons>
</view>
</picker>
<slot />
</view>
</template>
@@ -52,6 +59,9 @@ export default {
props: {
level: { type: Number, default: 3 },
showDatetime: { type: Boolean, default: true },
report: { type: Boolean, default: false },
singleChoice: { type: Boolean, default: false },
showQianTree: { type: Boolean, default: true },
},
data() {
const currentDate = this.getDate({
@@ -69,8 +79,10 @@ export default {
lineId: '', //测点ID
date: currentDate,
range: ['', ''],
report: 0,
},
list: [],
reportList: ['日报', '月报'],
}
},
created() {
@@ -86,29 +98,44 @@ export default {
getTree() {
this.clear()
lineTree().then((res) => {
let list = {
id: '',
pid: '0',
pids: '0',
name: '全部项目',
path: null,
provinceId: null,
cityId: null,
area: null,
remark: null,
sort: 0,
level: 0,
comFlag: null,
type: null,
lineType: null,
conType: null,
process: null,
isTop: 0,
children: [],
ndid: null,
let list = {}
if (this.singleChoice) {
let result = this.findFirstLevel(res.data)
console.log('🚀 ~ result:', result)
this.select.engineeringName = result.parents[0].name
this.select.engineeringId = result.parents[0].id //工程ID
this.select.projectName = result.parents[1].name
this.select.projectId = result.parents[1].id //項目ID
this.select.deviceName = result.parents[2].name
this.select.deviceId = result.parents[2].id //设备ID
this.select.lineName = result.node.name
this.select.lineId = result.node.id //测点ID
} else {
list = {
id: '',
pid: '0',
pids: '0',
name: '全部项目',
path: null,
provinceId: null,
cityId: null,
area: null,
remark: null,
sort: 0,
level: 0,
comFlag: null,
type: null,
lineType: null,
conType: null,
process: null,
isTop: 0,
children: [],
ndid: null,
}
}
this.list = this.filterTreeByLevel([list, ...res.data])
this.list = this.filterTreeByLevel(this.singleChoice ? res.data : [list, ...res.data])
// this.findFirstLevel( this.list)
})
},
// 递归过滤函数去除level > 2的节点
@@ -147,11 +174,13 @@ export default {
bindDateChange(e) {
this.select.date = e.detail.value
},
bindReport(e) {
this.select.report = e.detail.value
},
selectEngineering() {
this.$refs.qiantree._show()
},
getProjectList() {},
// 确定回调事件
treeConfirm(e) {
this.clear()
@@ -192,10 +221,33 @@ export default {
break
}
},
external(name, id) {
this.getTree()
this.select.engineeringId = id
this.select.engineeringName = name
},
// 取消回调事件
treeCancel(e) {
console.log(e)
},
findFirstLevel(list, parents = []) {
for (const item of list) {
// 当前就是 level=3
if (item.level === 3) {
return {
node: item, // 第一个 level=3
parents: parents, // 它的所有上级
}
}
// 递归子节点
if (item.children && item.children.length) {
const res = this.findFirstLevel(item.children, [...parents, item])
if (res) return res // 找到直接返回,不再循环
}
}
return null
},
},
computed: {

View File

@@ -20,10 +20,17 @@
class="uni-input"
radius="5"
placeholder="请输入关键字搜索"
clearButton="auto"
cancelButton="none"
clearButton="none"
@input="input"
/>
<!-- <uni-search-bar
v-model="searchValue"
clearButton="none"
bgColor="#fff"
placeholder="请输入关键词"
@input="input"
></uni-search-bar> -->
</view>
<view class="tki-tree-view">
@@ -59,7 +66,7 @@
>
<view
class="tki-tree-check-yes"
v-if="item.checked"
v-if="item.checked && (singleChoice ? item.rank == 3 : true)"
:class="{ radio: !multiple }"
:style="{ 'border-color': confirmColor }"
>
@@ -70,7 +77,7 @@
</view>
<view
class="tki-tree-check-no"
v-else
v-if="!item.checked && (singleChoice ? item.rank == 3 : true)"
:class="{ radio: !multiple }"
:style="{ 'border-color': confirmColor }"
></view>
@@ -101,6 +108,7 @@ export default {
type: String,
default: 'id',
},
singleChoice: { type: Boolean, default: false },
rangeKey: {
type: String,
default: 'name',
@@ -416,6 +424,10 @@ export default {
})
},
_treeItemSelect(item, index) {
if (item.rank != 3) {
if (this.singleChoice) return
}
// if(this.singleChoice)
this.treeList[index].checked = !this.treeList[index].checked
// 选父级, 子级自动全选
this.syncChecked(this.treeList, item.id, this.treeList[index].checked)

View File

@@ -21,7 +21,7 @@
bottom: 0rpx;
left: 0rpx;
z-index: 9999;
top: 160rpx;
top: 40%;
transition: all 0.3s ease;
transform: translateY(100%);
}