|
|
@@ -14,7 +14,8 @@
|
|
|
<view class="bases_search">
|
|
|
<view class="bases_search_text">
|
|
|
<u-icon name="search" class="search" @click="searchs"></u-icon>
|
|
|
- <input type="text" v-model="inputdata" placeholder="请输入设备编号" @change="handleSearch" @confirm="handleSearch" />
|
|
|
+ <input type="text" v-model="inputdata" placeholder="请输入设备编号" @change="handleSearch"
|
|
|
+ @confirm="handleSearch" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="loading" v-if="loadingtf">
|
|
|
@@ -101,6 +102,9 @@
|
|
|
computed: {
|
|
|
currentType() {
|
|
|
return this.typeList[this.current]
|
|
|
+ },
|
|
|
+ currentEquipmentIDList(){
|
|
|
+ return map(this.selectedGroupByNameIDs[this.currentType.type_name],'device_id')
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -176,7 +180,7 @@
|
|
|
this.assignments = this.assignment[0]
|
|
|
const dataList = res.data[0] && map(res.data[0].children, item => {
|
|
|
return assign({}, item, {
|
|
|
- check: !!this.selectedDataSource[item.type_name]
|
|
|
+ check: this.currentEquipmentIDList.includes(item.type_name)
|
|
|
})
|
|
|
});
|
|
|
this.equipmentList = this.page === 1 ? dataList : concat(this.equipmentList, dataList);
|
|
|
@@ -218,22 +222,13 @@
|
|
|
// this.forchange(this.obj)
|
|
|
},
|
|
|
checkboxchange(e, items) {
|
|
|
- console.log(e.detail, 'checkbox ', typeof e.detail.value)
|
|
|
+ console.log(e.detail, 'checkbox ', typeof e.detail.value,items)
|
|
|
this.obj[this.assignments.type_name] = JSON.parse(JSON.stringify(e.detail.value))
|
|
|
const originCurrentTypeIDList = this.selectedGroupByNameIDs[this.currentType.type_name] || []
|
|
|
- this.selectedGroupByNameIDs[this.currentType.type_name] = uniqBy(concat(originCurrentTypeIDList, map(e
|
|
|
+ this.selectedGroupByNameIDs[this.currentType.type_name] = map(e
|
|
|
.detail.value, id => ({
|
|
|
device_id: id
|
|
|
- }), 'device_id')))
|
|
|
-
|
|
|
- if (!this.selectedDataSource[e.detail.value]) {
|
|
|
- this.selectedDataSource[e.detail.value] = {
|
|
|
- "type_name": this.currentType.type_name,
|
|
|
- "device_id": e.detail.value
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ }))
|
|
|
},
|
|
|
clickLeft() {
|
|
|
uni.navigateBack({
|
|
|
@@ -272,11 +267,24 @@
|
|
|
this.page = 1;
|
|
|
this.equipmentList = [];
|
|
|
this.getFourbase();
|
|
|
- }
|
|
|
+ },
|
|
|
+ initEquipmentList() {
|
|
|
+ const result = map(this.bindEquipmentList, item => {
|
|
|
+ return {
|
|
|
+ device_id: item[1],
|
|
|
+ type_name: item[0]
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ this.selectedDataSource = zipObject(map(result, 'device_id'), result);
|
|
|
+ this.selectedGroupByNameIDs = groupBy(result, item => item.type_name);
|
|
|
+
|
|
|
+ this.getEquipmentList();
|
|
|
+ },
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
this.base_id = option.base_id
|
|
|
- console.log(this.base_id)
|
|
|
+ console.log(this.base_id,'onload ----- equipment list')
|
|
|
if (this.base_id) {
|
|
|
this.ybase()
|
|
|
} else {
|
|
|
@@ -290,6 +298,30 @@
|
|
|
this.isTop = false
|
|
|
}
|
|
|
},
|
|
|
+ onShow() {
|
|
|
+ console.warn('onshow ---------------------- 123')
|
|
|
+ uni.getStorage({
|
|
|
+ key: 'typeid',
|
|
|
+ success: (res) => {
|
|
|
+ var arr = []
|
|
|
+ // for(var key in JSON.parse(res.data)){
|
|
|
+ // console.log(key)
|
|
|
+ // for(var i=0;i<JSON.parse(res.data)[key].length;i++){
|
|
|
+ // var obj={
|
|
|
+ // name:key,
|
|
|
+ // arr:JSON.parse(res.data)[key][i]
|
|
|
+ // }
|
|
|
+ // arr.push(obj)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ console.warn(JSON.parse(res.data), 'get storage typeid 1 all location')
|
|
|
+ // this.baseobj = arr
|
|
|
+ },
|
|
|
+ fail(){
|
|
|
+ console.log('fail')
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
onReachBottom() {
|
|
|
this.page++;
|
|
|
this.getFourbase();
|