index.vue
12.1 KB
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
<template>
<view class="app-container">
<u-navbar :title="title" safeAreaInsetTop placeholder>
<view slot="left" class="text-red"></view>
</u-navbar>
<!-- <view class="">
<uv-drop-down ref="dropDown" sign="dropDown_1" :customStyle="{'justifyContent':'space-around'}"
:extra-icon="{name:'arrow-down-fill',color:'#666',size:'26rpx'}"
:extra-active-icon="{name:'arrow-up-fill',color:'#3c9cff',size:'26rpx'}">
<uv-drop-down-item name="type" type="2" label="项目公司" value="0">
</uv-drop-down-item>
<uv-drop-down-item name="type" type="2" label="是否竣工" value="0">
</uv-drop-down-item>
<uv-drop-down-item name="type" type="2" label="是否立管" value="0">
</uv-drop-down-item>
</uv-drop-down>
</view> -->
<view class="topSelectCss">
<view class="flex justify-around">
<view class="flex align-center" v-for="(item,index) of searchList" @click="openPicker(item)" :key="item.title">
<view class="text-lg">
<span v-if="searchForm[item.name]" class="text-red">
{{searchForm[item.name]}}
</span>
<span v-else>{{ item.title }}</span>
</view>
<view class="margin-left-xs" v-if="item.title == '财年'">
<u-icon name="calendar-fill" size="25"></u-icon>
</view>
<view class="margin-left-xs" v-else>
<u-icon v-if="currentName == item.key" color="#5875eb" name="arrow-up-fill" size="12"></u-icon>
<u-icon v-else name="arrow-down-fill" color="#999db0" size="12"></u-icon>
</view>
</view>
</view>
</view>
<view class="usuallyCard margin padding" v-if="list.length" v-for="(item,index) in list" :key="index">
<view class="flex flex-direction">
<view class="flex justify-between">
<view class="">
<text class="text-grey margin-right-xs">项目公司:</text>{{item.companyName || '--'}}
</view>
<view class="flex">
<!-- <u-tag bgColor="#EFF1FD" borderColor="#fff" color="#5875EE" size="mini" text="待审批"></u-tag> -->
</view>
</view>
<view class="margin-top-sm">
<text class="text-grey margin-right-xs">村(小区):</text>{{item.vlgOrCmty || '--'}}
</view>
<view class="margin-top-sm">
<text class="text-grey margin-right-xs">项目类型:</text>{{item.projectTypeName || '--'}}
</view>
</view>
<view class="flex justify-end margin-top">
<view class="margin-right" @click="handleDetail(item)">
<u-button shape="circle">查看详情</u-button>
</view>
<view class="margin-right" @click="handleOpen(item,'gcwh')" v-if="item.isCompleted === 'N' ">
<u-button shape="circle" color="#CF000D">工程维护</u-button>
</view>
<view class="" @click="handleOpen(item,'yywh')" v-if="!item.gasConnMtrRis">
<u-button shape="circle" color="#CF000D">运营维护</u-button>
</view>
</view>
<!-- <view class="nodeCss">
当前审批节点:项目公司_市场负责人
</view> -->
</view>
<u-loadmore :status="status" v-if="list.length > 0" />
<u-empty text="暂无数据" icon="/static/images/icon/nodata.png" v-else></u-empty>
<popUpFillIn :IgnitionID="IgnitionID" :type="btnType" title="工程维护" ref="popUpFillInRef" @getList="initData">
</popUpFillIn>
<!-- 字典下拉 -->
<u-picker :show="pickerShow" ref="uPicker" closeOnClickOverlay :columns="columns" @cancel="selectCancel"
@close="selectCancel" keyName="label" @confirm="selectConfirm"></u-picker>
<!-- 公司下拉-->
<u-picker :show="gsShow" ref="gsPicker" :title="gsName" closeOnClickOverlay :columns="companyList"
@cancel="gsCancel" @close="gsCancel" keyName="label" @confirm="gsConfirm" @change="changeHandler"></u-picker>
<!-- 时间下拉开始 -->
<TabBar :currentPagePath="this.$route.meta.pagePath"></TabBar>
</view>
</template>
<script>
import {
getCompanyCascader,
getMcConstructionList
} from '@/api/charge.js'
export default {
components: {},
props: {
},
data() {
return {
title: "施工维护",
keyword: "",
actionStyle: {
'color': '#fff',
'background': '#EC1E19',
'borderRadius': "15px",
'width': '60px',
'height': '25px',
'line-height': '25px',
},
btnType: "gcwh",
params: {
pageNum: 1,
pageSize: 10,
companyCode: "",
isCompleted: "",
gasConnMtrRis: ""
},
status: "loadmore",
list: [],
total: null,
IgnitionID: 0,
searchForm: {
companyCode: "",
isCompleted: "",
gasConnMtrRis:""
},
model: {},
currentName: "",
userCode: "",
gsShow: false,
pickerShow: false,
columns: [],
companyOption: [],
regionName: [],
groupName: [],
companyName: [],
gsName: "",
searchList: [{
title: '项目公司',
name: 'companyCode',
type: 'select',
key: 'company',
},
{
title: '是否竣工',
name: 'isCompleted',
type: 'select',
key: 'isCompleted',
dict: 'sys_cn_yn'
},
{
title: '是否通气到表前',
name: 'gasConnMtrRis',
type: 'select',
key: 'gasConnMtrRis',
dict: 'sys_cn_yn'
},
]
}
},
computed: {
companyList() {
return [this.regionName, this.groupName, this.companyName];
}
},
onReachBottom() {
let allTotal = this.params.pageNum * this.params.pageSize
if (allTotal < this.total) {
//当前条数小于总条数 则增加请求页数
this.params.pageNum++;
this.status = 'loading';
this.initData() //调用加载数据方法
} else {
this.status = "nomore"
// console.log('已加载全部数据')
}
},
onPullDownRefresh() {
this.params = {
pageNum: 1,
pageSize: 10,
}
this.searchForm = {}
this.keyword = "";
this.initData();
setTimeout(() => {
//结束下拉刷新
uni.stopPullDownRefresh();
}, 500);
},
// onLoad() {
// this.initData()
// },
onShow() {
this.getCompanyCascader();
this.initData();
},
methods: {
async initData() {
let {
code,
rows,
total
} = await getMcConstructionList(this.params);
if (code === 200) {
if (this.params.pageNum > 1) {
this.list = [...this.list, ...rows]
} else {
this.list = rows;
}
this.total = total;
console.log('list', JSON.parse(JSON.stringify(this.list)));
}
},
async getCompanyCascader() {
this.companyOption = (await getCompanyCascader()).data;
this.companyOption.forEach(item1 => {
this.regionName.push(item1);
item1.children.forEach(item2 => {
this.groupName.push(item2);
item2.children.forEach(item3 => {
this.companyName.push(item3);
});
});
});
console.log("当前公司类", this.companyOption);
},
async openPicker(data) {
console.log("下拉data", data)
this.currentName = data.key;
console.log('打印data-===', data);
if (data.type === 'select') {
if (data.key == 'company') {
this.gsColumns = [this.regionName, this.groupName, this.companyName];
this.gsName = `${this.regionName[0].label}`;
this.gsShow = true;
} else {
let dict = data.dict;
let dictArr = this.getDictDatas(dict);
this.columns = [dictArr];
this.pickerShow = true;
}
} else {
console.log('打印data===', data);
this.datetimeShow = true;
// this.showTimeParams.showStartDailog = true;
}
},
// 项目公司切换
changeHandler(e) {
const {
columnIndex,
value,
values, // values为当前变化列的数组内容
index,
indexs
// 微信小程序无法将picker实例传出来,只能通过ref操作
} = e
console.log(e);
// 当第一列值发生变化时,变化第二列(后一列)对应的选项
let [regionIndex, groupIndex, companyIndex] = indexs;
if (columnIndex === 0) {
this.gsName = value[0].label;
console.log(0, this.regionName)
// this.regionName = this.regionName[index]?.children || [];
this.groupName = this.regionName[index]?.children || [];
this.companyName = this.groupName[0]?.children || [];
console.log(1, this.regionName)
console.log(2, this.groupName)
console.log(3, this.companyName)
this.$refs.gsPicker.setIndexs([index, 0, 0], true)
} else if (columnIndex === 1) {
this.gsName = value[1].label;
this.groupName = this.regionName[index]?.children || [];
this.companyName = this.groupName[0]?.children || [];
this.$refs.gsPicker.setIndexs(indexs, true)
} else if (columnIndex === 2) {
this.gsName = value[2].label;
}
// let data2 = value[0].children;
// let data3 = data2[0].children;
// picker为选择器this实例,变化第二列对应的选项
// this.gsColumns = [this.regionName, data2, data3]
console.log("选择后", this.gsColumns);
},
selectConfirm(e) {
let data = e.value[0].value;
let dataLabel = e.value[0].label;
if (this.currentName === 'isCompleted') {
this.searchForm.isCompleted = dataLabel;
this.model.isCompleted = data;
this.params.isCompleted = data==='是'?'Y':'N';
}else if(this.currentName === 'gasConnMtrRis') {
this.searchForm.gasConnMtrRis = dataLabel;
this.model.gasConnMtrRis = data;
this.params.gasConnMtrRis = data==='是'?'Y':'N'
}
this.pickerShow = false;
this.currentName = '';
this.initData()
},
selectCancel(e) {
this.pickerShow = false;
this.currentName = '';
},
gsConfirm(e) {
console.log("公司", e);
this.model.regionName = e.value[0]?.value;
this.model.groupName = e.value[1]?.value;
this.model.companyName = e.value[2]?.label;
this.model.companyCode = e.value[2]?.value;
this.gsShow = false;
this.searchForm.companyCode = this.model.companyName.slice(0, 5) + '...';
this.params.companyCode = this.model.companyCode;
this.initData();
this.currentName = '';
},
gsCancel() {
this.gsShow = false;
this.currentName = '';
},
// 查看详情
handleDetail(item) {
uni.navigateTo({
url: '/pages/charge/constructionMaintenance/detail?objData=' + JSON.stringify(item)
})
},
handleOpen(item, type) {
this.IgnitionID = item.id;
this.btnType = type;
this.$refs.popUpFillInRef.open();
}
}
}
</script>
<style lang="scss" scoped>
/deep/.u-search__content {
width: 70vw;
padding-right: 140rpx;
}
/deep/.u-search__action {
position: absolute;
left: 50%;
}
.nodeCss {
position: relative;
display: flex;
justify-content: center;
align-items: center;
margin: 25rpx auto;
border-radius: 20rpx;
width: 95%;
height: 80rpx;
background: #EFF1FD;
color: #5875EB;
text-align: center;
}
.nodeCss::after {
content: '';
position: absolute;
top: 0%;
right: 25rpx;
transform: translate(-50%, -50%) rotate(45deg);
width: 10px;
height: 10px;
background: #EFF1FD;
border: 1px solid #EFF1FD;
border-style: none none solid solid;
}
.topSelectCss {
padding: 10px 20px;
background: #fff;
}
</style>