261 lines
		
	
	
		
			6.5 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
		
		
			
		
	
	
			261 lines
		
	
	
		
			6.5 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| 
								 | 
							
								<template>
							 | 
						|||
| 
								 | 
							
									<!-- 查询框 检查记录 列表 -->
							 | 
						|||
| 
								 | 
							
									<view class="risk-record-page">
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
										<u-sticky>
							 | 
						|||
| 
								 | 
							
											<view class="filter-bar">
							 | 
						|||
| 
								 | 
							
												<!-- <view class="filter filter-date-range" @click="handleShowPicker({title: '时间区间', name: 'dateRange'})">
							 | 
						|||
| 
								 | 
							
													<text>{{dateFilterTxt}}</text>
							 | 
						|||
| 
								 | 
							
													<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
							 | 
						|||
| 
								 | 
							
												</view> -->
							 | 
						|||
| 
								 | 
							
												<uni-search-bar class="search-bar" radius="100" v-model="keyword" @confirm="handleSearch" @cancel="handleCancelSearch" @clear="handleCancelSearch" placeholder="搜索项目名称" cancel-button="none">
							 | 
						|||
| 
								 | 
							
													<uni-icons slot="searchIcon" color="#999999" size="16" type="search" class="search-slot" />
							 | 
						|||
| 
								 | 
							
												</uni-search-bar>
							 | 
						|||
| 
								 | 
							
												<view class="filter filter-status" @click="handleShowPicker({title: '状态', name: 'status'})">
							 | 
						|||
| 
								 | 
							
													<text>{{statusFilterTxt}}</text>
							 | 
						|||
| 
								 | 
							
													<u-icon size="14" style="margin-left: 4px;" name="arrow-down"></u-icon>
							 | 
						|||
| 
								 | 
							
												</view>
							 | 
						|||
| 
								 | 
							
											</view>
							 | 
						|||
| 
								 | 
							
										</u-sticky>
							 | 
						|||
| 
								 | 
							
										<view class="main">
							 | 
						|||
| 
								 | 
							
											<view class="content-list">
							 | 
						|||
| 
								 | 
							
												<common-card :dataSource="item" v-for="item in lists" @click="showDetail(item.ID,item.TaskID)">
							 | 
						|||
| 
								 | 
							
													<view class="content">
							 | 
						|||
| 
								 | 
							
														<view class="field">
							 | 
						|||
| 
								 | 
							
															<text class="left">制定部门:</text>
							 | 
						|||
| 
								 | 
							
															<text class="value" v-if="item.Nav_Department">{{item.Nav_Department.NAME}}</text>
							 | 
						|||
| 
								 | 
							
														</view>
							 | 
						|||
| 
								 | 
							
														<view class="field">
							 | 
						|||
| 
								 | 
							
															<text class="left">制定人:</text>
							 | 
						|||
| 
								 | 
							
															<text class="value" v-if="item.Nav_User">{{item.Nav_User.NAME}}</text>
							 | 
						|||
| 
								 | 
							
														</view>
							 | 
						|||
| 
								 | 
							
														<view class="field">
							 | 
						|||
| 
								 | 
							
															<text class="left">制定时间:</text>
							 | 
						|||
| 
								 | 
							
															<text class="value" v-if="item.CREATE_TIME">{{item.CREATE_TIME}}</text>
							 | 
						|||
| 
								 | 
							
														</view>
							 | 
						|||
| 
								 | 
							
														<view class="field">
							 | 
						|||
| 
								 | 
							
															<text class="left">状态:</text>
							 | 
						|||
| 
								 | 
							
															<text class="status">{{item.STATUS}}</text>
							 | 
						|||
| 
								 | 
							
														</view>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
													</view>
							 | 
						|||
| 
								 | 
							
												</common-card>
							 | 
						|||
| 
								 | 
							
											</view>
							 | 
						|||
| 
								 | 
							
										</view>
							 | 
						|||
| 
								 | 
							
										<u-picker :show="comPickerInfo.showPicker" :columns="comPickerInfo.columns" @confirm="onConfirmPicker" @cancel="closePicker"></u-picker>
							 | 
						|||
| 
								 | 
							
									</view>
							 | 
						|||
| 
								 | 
							
								</template>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<script>
							 | 
						|||
| 
								 | 
							
									import {
							 | 
						|||
| 
								 | 
							
										initFilter,
							 | 
						|||
| 
								 | 
							
										extendRule,
							 | 
						|||
| 
								 | 
							
										extendInclude
							 | 
						|||
| 
								 | 
							
									} from '../../../../utils/common'
							 | 
						|||
| 
								 | 
							
									import {
							 | 
						|||
| 
								 | 
							
										MineTypeIndex,
							 | 
						|||
| 
								 | 
							
										MineTypeName
							 | 
						|||
| 
								 | 
							
									} from '../../../../utils/enums.js'
							 | 
						|||
| 
								 | 
							
									import {
							 | 
						|||
| 
								 | 
							
										getEnum
							 | 
						|||
| 
								 | 
							
									} from '../../../../services/common';
							 | 
						|||
| 
								 | 
							
									import {
							 | 
						|||
| 
								 | 
							
										DeviceMaintenancePlanList
							 | 
						|||
| 
								 | 
							
									} from '../../../../services/apply/subPages/DM/dm'
							 | 
						|||
| 
								 | 
							
									export default {
							 | 
						|||
| 
								 | 
							
										data() {
							 | 
						|||
| 
								 | 
							
											return {
							 | 
						|||
| 
								 | 
							
												pageIndex: 0,
							 | 
						|||
| 
								 | 
							
												total: 0,
							 | 
						|||
| 
								 | 
							
												lists: [],
							 | 
						|||
| 
								 | 
							
												params: {},
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												keyword: '',
							 | 
						|||
| 
								 | 
							
												searchStartTime: '',
							 | 
						|||
| 
								 | 
							
												filterStatus: null,
							 | 
						|||
| 
								 | 
							
												dateFilterTxt: '时间区间',
							 | 
						|||
| 
								 | 
							
												statusFilterTxt: '状态筛选',
							 | 
						|||
| 
								 | 
							
												listStatus: '',
							 | 
						|||
| 
								 | 
							
												comPickerInfo: {
							 | 
						|||
| 
								 | 
							
													showPicker: false,
							 | 
						|||
| 
								 | 
							
													columns: [],
							 | 
						|||
| 
								 | 
							
													title: '',
							 | 
						|||
| 
								 | 
							
													name: ''
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
											}
							 | 
						|||
| 
								 | 
							
										},
							 | 
						|||
| 
								 | 
							
										onLoad() {
							 | 
						|||
| 
								 | 
							
											this.getEnums()
							 | 
						|||
| 
								 | 
							
										},
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
										methods: {
							 | 
						|||
| 
								 | 
							
											handleSearch() {
							 | 
						|||
| 
								 | 
							
												this.pageIndex = 0
							 | 
						|||
| 
								 | 
							
												this.loadData(false)
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											getEnums() {
							 | 
						|||
| 
								 | 
							
												var dataParm = {
							 | 
						|||
| 
								 | 
							
													'name': "PFStandardStatus"
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
												getEnum(dataParm).then(res => {
							 | 
						|||
| 
								 | 
							
													this.listStatus = res
							 | 
						|||
| 
								 | 
							
													this.loadData()
							 | 
						|||
| 
								 | 
							
												})
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											getNameById(id) {
							 | 
						|||
| 
								 | 
							
												const item = this.listStatus.find(item => item.ID === id);
							 | 
						|||
| 
								 | 
							
												return item ? item.NAME : '未知状态';
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											loadData(paginate) {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												this.pageIndex++
							 | 
						|||
| 
								 | 
							
												const orgId = uni.getStorageSync('orgId')
							 | 
						|||
| 
								 | 
							
												let json = initFilter(orgId, "", "CREATE_TIME", 1, this.pageIndex);
							 | 
						|||
| 
								 | 
							
												extendInclude(json, 'Nav_Department');
							 | 
						|||
| 
								 | 
							
												extendInclude(json, 'Nav_User');
							 | 
						|||
| 
								 | 
							
												json.SelectField = ["YEARPLAN", "CREATE_TIME", "STATUS_APPROVE", "Nav_Department.NAME", "Nav_User.NAME", "ID", "ORG_ID"]
							 | 
						|||
| 
								 | 
							
												// extendRule(json, 'STATECHECK', 2, 0);
							 | 
						|||
| 
								 | 
							
												if (this.keyword) {
							 | 
						|||
| 
								 | 
							
													extendRule(json, 'Nav_User.NAME', 9, this.keyword)
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												if (this.searchStartTime && this.searchStartTime.length > 0) {
							 | 
						|||
| 
								 | 
							
													extendRule(json, 'CHECKTIME', 6, this.searchStartTime)
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
												if (this.filterStatus !== null) {
							 | 
						|||
| 
								 | 
							
													extendRule(json, 'STATUS_APPROVE', 1, this.filterStatus)
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
												json.IsAllLoad = false
							 | 
						|||
| 
								 | 
							
												json.MenuParameter=''
							 | 
						|||
| 
								 | 
							
												json.OrgRule=[]
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												// json.IgnoreDataRule = true
							 | 
						|||
| 
								 | 
							
												DeviceMaintenancePlanList(json).then(res => {
							 | 
						|||
| 
								 | 
							
													this.total = res.TotalCount
							 | 
						|||
| 
								 | 
							
													for (let i = 0; i < res.Data.length; i++) {
							 | 
						|||
| 
								 | 
							
														res.Data[i].STATUS = this.getNameById(res.Data[i].STATUS_APPROVE)
							 | 
						|||
| 
								 | 
							
													}
							 | 
						|||
| 
								 | 
							
													const newRes = (res.Data || []).map(i => {
							 | 
						|||
| 
								 | 
							
														return {
							 | 
						|||
| 
								 | 
							
															...i,
							 | 
						|||
| 
								 | 
							
															title: i.YEARPLAN ? i.YEARPLAN : '',
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
														}
							 | 
						|||
| 
								 | 
							
													})
							 | 
						|||
| 
								 | 
							
													if (paginate) {
							 | 
						|||
| 
								 | 
							
														this.lists = this.lists.concat(newRes)
							 | 
						|||
| 
								 | 
							
													} else {
							 | 
						|||
| 
								 | 
							
														this.lists = newRes
							 | 
						|||
| 
								 | 
							
													}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												})
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
											showDetail(id, taskID) {
							 | 
						|||
| 
								 | 
							
												uni.navigateTo({
							 | 
						|||
| 
								 | 
							
													url: 'DM008_SHOWPRINT?ID=' + id + '&taskID=' + taskID
							 | 
						|||
| 
								 | 
							
												})
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
											handleShowPicker(p) {
							 | 
						|||
| 
								 | 
							
												let column = []
							 | 
						|||
| 
								 | 
							
												if (p.name === 'dateRange') {
							 | 
						|||
| 
								 | 
							
													column = ['全部', '当天', '最近三天', '最近一周', '最近一月']
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
												if (p.name === 'status') {
							 | 
						|||
| 
								 | 
							
													let arr = []
							 | 
						|||
| 
								 | 
							
													arr.push('全部')
							 | 
						|||
| 
								 | 
							
													this.listStatus.map(item => {
							 | 
						|||
| 
								 | 
							
														arr.push(item.NAME)
							 | 
						|||
| 
								 | 
							
													})
							 | 
						|||
| 
								 | 
							
													column = arr
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												this.comPickerInfo = {
							 | 
						|||
| 
								 | 
							
													showPicker: true,
							 | 
						|||
| 
								 | 
							
													title: p.title,
							 | 
						|||
| 
								 | 
							
													name: p.name,
							 | 
						|||
| 
								 | 
							
													columns: [column]
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											onConfirmPicker(e) {
							 | 
						|||
| 
								 | 
							
												if (this.comPickerInfo.name === 'dateRange') {
							 | 
						|||
| 
								 | 
							
													let currentDate = new Date();
							 | 
						|||
| 
								 | 
							
													if (e.indexs[0] === 2) {
							 | 
						|||
| 
								 | 
							
														currentDate.setDate(currentDate.getDate() - 3);
							 | 
						|||
| 
								 | 
							
													} else if (e.indexs[0] === 3) {
							 | 
						|||
| 
								 | 
							
														currentDate.setDate(currentDate.getDate() - 7);
							 | 
						|||
| 
								 | 
							
													} else if (e.indexs[0] === 4) {
							 | 
						|||
| 
								 | 
							
														currentDate.setMonth(currentDate.getMonth() - 1);
							 | 
						|||
| 
								 | 
							
													}
							 | 
						|||
| 
								 | 
							
													if (e.indexs[0] === 0) {
							 | 
						|||
| 
								 | 
							
														this.searchStartTime = ''
							 | 
						|||
| 
								 | 
							
														this.dateFilterTxt = '时间区间'
							 | 
						|||
| 
								 | 
							
													} else {
							 | 
						|||
| 
								 | 
							
														this.dateFilterTxt = e.value[0]
							 | 
						|||
| 
								 | 
							
														this.searchStartTime = uni.$u.timeFormat(currentDate, 'yyyy-mm-dd 00:00:00');
							 | 
						|||
| 
								 | 
							
													}
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
												if (this.comPickerInfo.name === 'status') {
							 | 
						|||
| 
								 | 
							
													if (e.indexs[0] == 0) {
							 | 
						|||
| 
								 | 
							
														this.filterStatus = null
							 | 
						|||
| 
								 | 
							
													} else {
							 | 
						|||
| 
								 | 
							
														this.filterStatus = this.listStatus[e.indexs[0] - 1].ID
							 | 
						|||
| 
								 | 
							
													}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
												this.closePicker()
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											closePicker() {
							 | 
						|||
| 
								 | 
							
												this.comPickerInfo = {
							 | 
						|||
| 
								 | 
							
													showPicker: false,
							 | 
						|||
| 
								 | 
							
													columns: [],
							 | 
						|||
| 
								 | 
							
													title: '',
							 | 
						|||
| 
								 | 
							
													name: ''
							 | 
						|||
| 
								 | 
							
												}
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
										},
							 | 
						|||
| 
								 | 
							
										computed: {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
										},
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
										onReachBottom() {
							 | 
						|||
| 
								 | 
							
											if (this.total > 10 * this.pageIndex) {
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
												this.loadData(true)
							 | 
						|||
| 
								 | 
							
											}
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
										},
							 | 
						|||
| 
								 | 
							
										watch: {
							 | 
						|||
| 
								 | 
							
											keyword(n, o) {
							 | 
						|||
| 
								 | 
							
												this.pageIndex = 0
							 | 
						|||
| 
								 | 
							
												this.keyword = n
							 | 
						|||
| 
								 | 
							
												this.loadData()
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											searchStartTime(n, o) {
							 | 
						|||
| 
								 | 
							
												this.pageIndex = 0
							 | 
						|||
| 
								 | 
							
												this.searchStartTime = n
							 | 
						|||
| 
								 | 
							
												this.loadData()
							 | 
						|||
| 
								 | 
							
											},
							 | 
						|||
| 
								 | 
							
											filterStatus(n, o) {
							 | 
						|||
| 
								 | 
							
												this.pageIndex = 0
							 | 
						|||
| 
								 | 
							
												this.filterStatus = n
							 | 
						|||
| 
								 | 
							
												this.loadData()
							 | 
						|||
| 
								 | 
							
											}
							 | 
						|||
| 
								 | 
							
										}
							 | 
						|||
| 
								 | 
							
									}
							 | 
						|||
| 
								 | 
							
								</script>
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								<style>
							 | 
						|||
| 
								 | 
							
									@import url("../../../../style/css/listTemplate.css");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
									.status {
							 | 
						|||
| 
								 | 
							
										background-color: rgba(5, 109, 232, 0.1);
							 | 
						|||
| 
								 | 
							
										color: #056DE8;
							 | 
						|||
| 
								 | 
							
										padding: 0px 5px 0px 5px;
							 | 
						|||
| 
								 | 
							
										border-radius: 5px;
							 | 
						|||
| 
								 | 
							
									}
							 | 
						|||
| 
								 | 
							
								</style>
							 |