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

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

View File

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

View File

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

View File

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

View File

@@ -63,13 +63,14 @@
{{ item.current_user_audit_status === 0 ? "处理中" : "已确认" }} {{ item.current_user_audit_status === 0 ? "处理中" : "已确认" }}
</view> </view>
<view class="th" style="flex: 0 0 120rpx; justify-content: flex-end; display: flex; align-items: center;"> <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 <van-action-sheet
show="{{ currentActionSheet === item.id }}" show="{{ currentActionSheet === item.id }}"
actions="{{ actionItems }}" actions="{{ actionItems }}"
bind:close="hideActionMenu" bind:close="hideActionMenu"
bind:select="onMenuSelect" bind:select="onMenuSelect"
data-id="{{item.id}}" data-id="{{item.id}}"
close-on-click-action close-on-click-action
/> />
<!-- <view <!-- <view