工作台代码提交
This commit is contained in:
@@ -1,18 +1,178 @@
|
||||
// pages/workBenchTodoList/index.js
|
||||
import request from "../../utils/request"
|
||||
import { getWorkOrderList } from "../../service/workBench"
|
||||
import { alertInfo, loadingFunc } from "../../utils/index";
|
||||
import { noticeFlowType } from "../../utils/data"
|
||||
const { OK } = request
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
page: 1,
|
||||
size: 20,
|
||||
noticeFlowType,
|
||||
actionItems: [{
|
||||
name: '确认',
|
||||
value: 'status'
|
||||
}],
|
||||
},
|
||||
showActionMenu(e) {
|
||||
console.log("e", e)
|
||||
this.setData({
|
||||
currentActionSheet: e.currentTarget.dataset.id
|
||||
});
|
||||
},
|
||||
hideActionMenu() {
|
||||
this.setData({
|
||||
currentActionSheet: null
|
||||
});
|
||||
},
|
||||
onMenuSelect(e) {
|
||||
const {
|
||||
value
|
||||
} = e.detail;
|
||||
const id = e.currentTarget.dataset.id;
|
||||
|
||||
if (value === 'detail') {
|
||||
this.jumpToDetail(id);
|
||||
}
|
||||
},
|
||||
jumpToDetail(id) {
|
||||
|
||||
// wx.navigateTo({
|
||||
// url: '/pages/workOrderDetail/index?id=' + id,
|
||||
// })
|
||||
},
|
||||
onConfirm(e) {
|
||||
const { type, data = {}, way } = e.detail;
|
||||
const that = this;
|
||||
switch(type) {
|
||||
case "park":
|
||||
this.setData({
|
||||
park: data.id,
|
||||
parkName: data.name,
|
||||
})
|
||||
break;
|
||||
case "tenement":
|
||||
this.setData({
|
||||
tenement: data.id,
|
||||
tenementName: data.name,
|
||||
})
|
||||
break;
|
||||
|
||||
case "noticeFlowType":
|
||||
this.setData({
|
||||
noticeFlowType: data,
|
||||
noticeFlowTypeName: data,
|
||||
page: 1,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await that.init()
|
||||
})
|
||||
});
|
||||
break;
|
||||
case "noticeFlowStatus":
|
||||
this.setData({
|
||||
noticeFlowStatus: data,
|
||||
noticeFlowStatusName: data,
|
||||
page: 1,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await that.init()
|
||||
})
|
||||
});
|
||||
break;
|
||||
case "meter":
|
||||
this.setData({
|
||||
meter: data.id,
|
||||
meterName: data.address,
|
||||
meterInfo: data,
|
||||
page: 1,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await that.init()
|
||||
})
|
||||
});
|
||||
break;
|
||||
}
|
||||
this.onCancel();
|
||||
},
|
||||
onCancel() {
|
||||
this.setData({
|
||||
show: false,
|
||||
title: "",
|
||||
type: "",
|
||||
})
|
||||
},
|
||||
onParkFocus(e) {
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "园区",
|
||||
type: 'park'
|
||||
})
|
||||
},
|
||||
onNoticeFlowFocus() {
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "类型",
|
||||
type: 'noticeFlowType'
|
||||
})
|
||||
},
|
||||
onNoticeFlowStatusFocus() {
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "确认状态",
|
||||
type: 'noticeFlowStatus'
|
||||
})
|
||||
},
|
||||
onMeterFocus(e) {
|
||||
const { park } = this.data;
|
||||
if (!park) {
|
||||
alertInfo("请先选择园区")
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
show: true,
|
||||
title: "电表",
|
||||
type: 'meter'
|
||||
})
|
||||
},
|
||||
onChangePage(e) {
|
||||
const that = this;
|
||||
this.setData({
|
||||
page: e.detail.currentIndex,
|
||||
}, () => {
|
||||
loadingFunc(async () => {
|
||||
await that.init()
|
||||
})
|
||||
})
|
||||
console.log("e", e)
|
||||
},
|
||||
async init() {
|
||||
const { page, size, park, tenement, meter, type, time, status } = this.data;
|
||||
const { code, message, data, total } = await getWorkOrderList({ page, size, park, tenement, meter, type, time, status })
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return;
|
||||
}
|
||||
this.setData({
|
||||
list: data?.map(item => {
|
||||
item.time = item?.created_at?.slice(0, 10)
|
||||
item.address = item?.target?.meter_data?.address;
|
||||
return item;
|
||||
}),
|
||||
totalPage: Math.ceil(total / size),
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
|
||||
loadingFunc(async () => {
|
||||
await this.init()
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,17 @@
|
||||
"search-select": "/components/searchSelect/index",
|
||||
"van-field": "@vant/weapp/field/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"searchSelectWrapper": "/components/searchSelectWrapper/index"
|
||||
"searchSelectWrapper": "/components/searchSelectWrapper/index",
|
||||
"van-empty": "@vant/weapp/empty/index",
|
||||
"table": "/components/table/table",
|
||||
"pagination": "/components/pagination/index",
|
||||
"empty": "/components/empty/index",
|
||||
"van-radio": "@vant/weapp/radio/index",
|
||||
"van-radio-group": "@vant/weapp/radio-group/index",
|
||||
"van-dialog": "@vant/weapp/dialog/index",
|
||||
"van-icon": "@vant/weapp/icon/index",
|
||||
"van-action-sheet": "@vant/weapp/action-sheet/index"
|
||||
|
||||
},
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
@@ -1,12 +1,99 @@
|
||||
<!--pages/workBenchTodoList/index.wxml-->
|
||||
<navigator canBack="{{true}}" title="工单列表" />
|
||||
<view class="wrapper">
|
||||
<van-row gutter="20">
|
||||
<van-col span="12">
|
||||
1
|
||||
</van-col>
|
||||
<van-col span="12">
|
||||
2
|
||||
</van-col>
|
||||
</van-row>
|
||||
</view>
|
||||
<searchSelectWrapper
|
||||
label="选择园区"
|
||||
placeholder="请选择园区"
|
||||
text="{{parkName}}"
|
||||
bind:search="onParkFocus"
|
||||
/>
|
||||
|
||||
<searchSelectWrapper
|
||||
label="选择电表"
|
||||
placeholder="请选择电表"
|
||||
text="{{meterName}}"
|
||||
bind:search="onMeterFocus"
|
||||
/>
|
||||
<searchSelectWrapper
|
||||
label="流程类型"
|
||||
placeholder="请选择流程类型"
|
||||
text="{{noticeFlowTypeName}}"
|
||||
bind:search="onNoticeFlowFocus"
|
||||
/>
|
||||
<searchSelectWrapper
|
||||
label="确认状态"
|
||||
placeholder="请选择确认状态"
|
||||
text="{{noticeFlowStatusName}}"
|
||||
bind:search="onNoticeFlowStatusFocus"
|
||||
/>
|
||||
<view>
|
||||
<view wx:if="{{list.length}}">
|
||||
<view class="tableWrapper">
|
||||
<view class="table">
|
||||
<view class="thead">
|
||||
<view class="th" style="flex: 0 0 130rpx;"> 时间</view>
|
||||
<view class="th" style="flex: 0 0 150rpx;"> 类型 </view>
|
||||
<view class="th" style="flex: 0 0 150rpx;">电表地址</view>
|
||||
<view class="th" style="flex: 0 0 150rpx;">状态</view>
|
||||
<view class="th"style="flex: 0 0 120rpx; justify-content: flex-end; display: flex; align-items: center;"> 操作 </view>
|
||||
</view>
|
||||
<view class="tbody">
|
||||
<van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
|
||||
<block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
|
||||
<view class="tr" style="display: flex; align-items: center; ">
|
||||
<view class="th" style="flex: 0 0 130rpx;">
|
||||
{{ item.time }}
|
||||
</view>
|
||||
<view class="th" style="flex: 0 0 150rpx;">
|
||||
{{ noticeFlowType[item.types - 1] }}
|
||||
</view>
|
||||
|
||||
<view class="th" style="flex: 0 0 150rpx;">
|
||||
{{ item.address }}
|
||||
</view>
|
||||
<view class="th" style="flex: 0 0 150rpx;">
|
||||
{{ item.flow_status === 1 ? "处理中" : "已确认" }}
|
||||
</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-data="{{index}}" 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
|
||||
class="primaryTextBtn"
|
||||
wx:if="{{item.flow_status === 1}}"
|
||||
data-id="{{item.id}}"
|
||||
> 确认 </view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</block>
|
||||
</van-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<pagination currentIndex="{{page}}" totalPage="{{totalPage}}" bind:pagingChange="onChangePage" />
|
||||
|
||||
</view>
|
||||
<empty bind:refresh="init" wx:else />
|
||||
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<search-select
|
||||
show="{{show}}"
|
||||
title="{{title}}"
|
||||
type="{{type}}"
|
||||
park="{{park}}"
|
||||
bindconfirm="onConfirm"
|
||||
bindcancel="onCancel"
|
||||
wx:if="{{show}}"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@@ -1 +1,71 @@
|
||||
/* pages/workBenchTodoList/index.wxss */
|
||||
/* pages/workBenchTodoList/index.wxss */
|
||||
|
||||
.table {
|
||||
width: 500rpx;
|
||||
|
||||
}
|
||||
|
||||
.tableWrapper {
|
||||
width: 100vw;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.thead {
|
||||
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
|
||||
}
|
||||
|
||||
.thead .th {
|
||||
padding: 10rpx;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.primaryTextBtn {
|
||||
color: #1989fa;
|
||||
}
|
||||
|
||||
.tbody {
|
||||
width: 500rpx;
|
||||
}
|
||||
|
||||
.tbody .tr {
|
||||
padding: 10rpx;
|
||||
border-bottom: 1rpx solid #EEEEEE;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.tbody .tr {
|
||||
word-break: break-all;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.more-icon {
|
||||
padding: 20rpx;
|
||||
color: #1989fa;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 基础标签样式 */
|
||||
.tag {
|
||||
display: inline-block;
|
||||
padding: 4px 5px;
|
||||
margin-right: 0px;
|
||||
border-radius: 16px;
|
||||
background: #07c160;
|
||||
color: white;
|
||||
font-size: 25rpx;
|
||||
}
|
||||
|
||||
/* 激活状态样式 */
|
||||
.tag.active {
|
||||
background: #07c160;
|
||||
color: white;
|
||||
}
|
||||
Reference in New Issue
Block a user