装表的时候过滤已经选择的互感器

This commit is contained in:
2025-11-17 15:51:41 +08:00
parent 771bacdafa
commit db1adea70a
5 changed files with 81 additions and 30 deletions

View File

@@ -22,6 +22,8 @@ Component({
building: String,
isBack: Boolean,
filterBind: Boolean,
filterData: Array,
filterType: String
},
observers: {
"show,type,filterBind": function(newShow, newType) {
@@ -189,15 +191,21 @@ Component({
})
},
async onSearchCollection() {
const { searchText = "" } = this.data;
const { searchText = "", filterData, filterType } = this.data;
const { code, message, data: parks = [] } = await getCollectionList({keyword: searchText, page: 1, status: 1});
if (code !== OK) {
alertInfo(message)
return
}
let columns = parks;
if (filterType === 'collection') {
columns = columns.filter(item => {
return !filterData.includes(item.id)
})
}
this.setData({
columns: parks?.map(item => `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`),
list: parks,
columns: columns?.map(item => `${item.transformerId}-倍率:${item.ratio}-${item.manufacturer}`),
list: columns,
})
},
async onSearchMeter() {

View File

@@ -15,6 +15,7 @@ Page({
time: "",
area: "",
placeholder: "",
collections: [],
},
/**
@@ -179,18 +180,7 @@ Page({
sn: e.detail,
})
},
onConfirm(e) {
console.log("e", e)
const { type, data = {}, way } = e.detail;
const {collection, park, tenement} = this.data;
switch(type) {
case "park":
this.setData({
park: data.id,
parkName: data.name,
selfManagement: data.selfManagement,
})
if (park !== data.id) {
clearData() {
this.setData({
tenement: null,
tenementName: null,
@@ -214,7 +204,22 @@ Page({
flat: null,
valley: null,
area: null,
collections: [],
})
},
onConfirm(e) {
console.log("e", e)
const { type, data = {}, way } = e.detail;
const {collection, park, tenement} = this.data;
switch(type) {
case "park":
this.setData({
park: data.id,
parkName: data.name,
selfManagement: data.selfManagement,
})
if (park !== data.id) {
this.clearData()
}
break;
case "tenement":
@@ -266,26 +271,33 @@ Page({
});
break;
case "collection":
const newCollects = this.data.collections;
let newData = {}
if (collection === "A") {
newCollects[0] = data.id
newData = {
collectionA: data.id,
collectionAName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`,
collectionARatio: data.ratio,
collections: newCollects
}
}
if (collection === "B") {
newCollects[1] = data.id
newData = {
collectionB: data.id,
collectionBName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`,
collectionBRatio: data.ratio,
collections: newCollects
}
}
if (collection === "C") {
newCollects[2] = data.id
newData = {
collectionC: data.id,
collectionCName: `${data.transformerId}-倍率:${data.ratio}-${data.manufacturer}`,
collectionCRatio: data.ratio,
collections: newCollects
}
}
this.setData(newData);
@@ -300,21 +312,30 @@ Page({
})
},
clearCollectionA() {
const newCollects = this.data.collections;
newCollects[0] = null;
this.setData({
collectionA: null,
collectionAName: null,
collections: newCollects,
})
},
clearCollectionB() {
const newCollects = this.data.collections;
newCollects[1] = null;
this.setData({
collectionB: null,
collectionBName: null,
collections: newCollects,
})
},
clearCollectionC() {
const newCollects = this.data.collections;
newCollects[2] = null;
this.setData({
collectionC: null,
collectionCName: null,
collections: newCollects,
})
},
changeAddress(e) {
@@ -414,6 +435,11 @@ Page({
return;
}
alertSuccess("新增成功")
this.setData({
park: null,
parkName: null,
})
this.clearData()
wx.navigateTo({
url: '/pages/workBenchTodoList/index',
})

View File

@@ -184,6 +184,8 @@
park="{{park}}"
building="{{building}}"
bindconfirm="onConfirm"
filterData="{{collections}}"
filterType="collection"
bindcancel="onCancel"
placeholder="{{placeholder}}"
wx:if="{{show}}"

View File

@@ -19,8 +19,19 @@ Page({
}],
},
showActionMenu(e) {
const { id, status } = e.currentTarget.dataset;
this.setData({
currentActionSheet: e.currentTarget.dataset.id
currentActionSheet: id,
actionItems: status === 0 ? [{
name: '详情',
value: 'detail'
}, {
name: '确认',
value: 'ok'
}] : [{
name: '详情',
value: 'detail'
}]
});
},
onClearPark() {
@@ -82,7 +93,10 @@ onMenuSelect(e) {
return
}
alertSuccess("确认成功")
this.init();
const that = this;
setTimeout(() => {
that.init();
}, 300)
},
jumpToDetail(id) {

View File

@@ -63,13 +63,14 @@
{{ item.current_user_audit_status === 0 ? "处理中" : "已确认" }}
</view>
<view class="th" style="flex: 0 0 120rpx; justify-content: flex-end; display: flex; align-items: center;">
<van-icon name="ellipsis" size="24px" bind:tap="showActionMenu" data-id="{{item.id}}" data-data="{{index}}" class="more-icon" />
<van-icon name="ellipsis" size="24px" bind:tap="showActionMenu" data-id="{{item.id}}" data-data="{{index}}" data-status="{{item.current_user_audit_status}}" class="more-icon" />
<van-action-sheet
show="{{ currentActionSheet === item.id }}"
actions="{{ actionItems }}"
bind:close="hideActionMenu"
bind:select="onMenuSelect"
data-id="{{item.id}}"
close-on-click-action
/>
<!-- <view