d56bd957
“wangming”
修复问题,组建AI
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
|
<template>
<view class="main">
<view class="toptitle">
<view class="toptitle_left" @click="ht">
<u-icon name="arrow-left" color="#fff" size="20"></u-icon>
</view>
<view class="toptitle_title">
备件支持
</view>
</view>
<view class="title">
<u-search shape="square" :clearabled="true" :showAction="false" placeholder="请输入关键字" v-model="form.mc" ></u-search>
<!-- <view class="l1" @click="show = true">
<image src="../../../static/sx.png" style="width: 20px;" mode="widthFix"></image>
<span style="margin-right: 3px;">{{title}}</span>
</view> -->
</view>
<view class="title" style="">
<view class="" style="width: 100%;display: flex;justify-content: flex-end;">
<view class="" style="display: flex;align-items: center;">
<span style="font-size: 30rpx;">设备类型:</span>
<uni-data-picker placeholder="请选择设备分类" popup-title="请选择设备分类" :localdata="dataTree" v-model="classes"
@change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
</uni-data-picker>
</view>
</view>
</view>
<u-picker :show="show" :columns="columns" @confirm="confirm" @cancel="show = false"></u-picker>
<view class="box" v-for="item in list" @click="xq(item)">
<view class="top" style="margin-bottom: 10px;">
<span class="f1">{{item.mc}}</span>
</view>
<view class="top2">
<span class="f4">备件编号</span>
<span class="f5">{{item.bh}}</span>
</view>
<view class="top2">
<span class="f4">规格</span>
<span class="f5">{{item.gg}}</span>
</view>
<view class="top2">
<span class="f4">位置</span>
<span class="f5">{{item.wz}}</span>
</view>
<view class="xx">
</view>
<view class="footer">
<span>{{timestampToTime(item.fbsj)}}</span>
<view class="">
<u-button size="small" type="primary" text="查看"></u-button>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
classes: '',
dataTree: [],
keyword: "",
show: false,
columns: [
['设备名','备件名称/备件编号','关键词']
],
title: "关键词",
list:[],
form:{
currentPage:1,
pageSize:10,
mc:"",
bjfl:""
},
nv_length:0
}
},
onReachBottom() {
var page = Math.ceil(this.nv_length / 10);
if (page > parseInt(this.form.currentPage)) {
this.form.currentPage = parseInt(this.form.currentPage) + 1
this.bjyzclist();
} else {
uni.showToast({
icon: "error",
title: "没有更多内容"
})
}
},
watch:{
'form.mc'(newVal, oldVal){
console.log('name changed', newVal, oldVal)
this.form.pageSize = 10
this.form.currentPage = 1
this.list = []
this.bjyzclist();
},
},
onLoad() {
this.bjyzclist();
this.hqcpfl();
},
methods:{
onchange(e){
console.log("onchange",e);
if(e.detail.value.length > 1){
var index = e.detail.value.length - 1
this.form.bjfl = e.detail.value[index].value
}
if(e.detail.value.length == 1){
this.form.bjfl = e.detail.value[0].value
}
if(e.detail.value.length == 0){
this.form.bjfl = ''
}
this.form.currentPage = 1
this.form.pageSize = 10
this.list = []
this.bjyzclist();
},
onpopupclosed(e){
console.log("onpopupclosed",e);
},
onpopupopened(e){
console.log("onpopupopened",e);
},
onnodeclick(e){
console.log("onnodeclick",e);
},
// 获取分类
hqcpfl(){
this.API.hqcpfl("625969064434468101").then(res=>{
console.log("获取分类",res);
if(res.code == 200){
if(res.data.list.length > 0){
var arr = []
for(let i = 0;i < res.data.list.length;i++){
var info = {
text:"",
value:"",
children:[]
}
info.text = res.data.list[i].fullName
info.value = res.data.list[i].id
if(res.data.list[i].children != null && res.data.list[i].children != '' && res.data.list[i].children.length > 0){
for(let s = 0;s < res.data.list[i].children.length;s++){
var info1 = {
text:res.data.list[i].children[s].fullName,
value:res.data.list[i].children[s].id,
children:[]
}
if(res.data.list[i].children[s].children.length > 0 && res.data.list[i].children[s].children != null && res.data.list[i].children[s].children != ''){
for(let t = 0;t < res.data.list[i].children[s].children.length;t++){
var info2 = {
text:res.data.list[i].children[s].children[t].fullName,
value:res.data.list[i].children[s].children[t].id,
children:[]
}
info1.children.push(info2)
}
}
info.children.push(info1)
}
}
arr.push(info)
}
this.dataTree = arr
}
}
})
},
timestampToTime(timestamp) {
const date = new Date(timestamp); //时间戳为10位需*1000,13位不需乘
const Y = date.getFullYear() + '-';
const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
const D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
const h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
const m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
const s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D + h + m + s;
},
bjyzclist(){
this.API.bjyzclist(this.form).then(res=>{
this.nv_length = res.data.pagination.total
console.log("111",res);
if(res.data.list.length > 0){
for(let i = 0;i < res.data.list.length;i++){
this.list.push(res.data.list[i])
}
}else{
if(this.form.currentPage = 1){
this.list = []
}
}
})
},
ht(){
uni.navigateBack({
delta: 1
});
},
confirm(e){
console.log("11",e);
this.title = e.value[0]
this.show = false
this.keyword = ''
},
xq(item){
var data = JSON.stringify(item)
uni.setStorageSync("detail",data)
uni.navigateTo({
url:"/pages/new/bjzc/detail"
})
},
}
}
</script>
<style scoped lang="scss">
@import '../zlgl/index.scss';
</style>
|