288 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			288 lines
		
	
	
		
			7.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
	<!-- 查询框 检查记录 列表 -->
 | 
						|
	<view class="risk-record-page">
 | 
						|
		<view class="main-page">
 | 
						|
			<scroll-view scroll-x="true" scroll-y="true">
 | 
						|
				<uni-table border stripe>
 | 
						|
					<uni-tr>
 | 
						|
						<uni-th width="40px" align="center" style="padding: 0;">序号</uni-th>
 | 
						|
						<uni-th width="150px" align="center">内容</uni-th>
 | 
						|
						<uni-th width="50px" align="center">操作</uni-th>
 | 
						|
					</uni-tr>
 | 
						|
					<uni-tr v-for="(item,index) in lists">
 | 
						|
						<uni-td width="40px" align="center" style="padding: 0;">{{ index+1 }}</uni-td>
 | 
						|
						<uni-td width="150px" class="td-modal">
 | 
						|
							<view>
 | 
						|
								<text style="font-weight: bold;">生产单元</text> : {{ getMineTypeName(item.MineType)}}
 | 
						|
							</view>
 | 
						|
							<view>
 | 
						|
								<text style="font-weight: bold;">检查层级</text> : {{ getCheckTypeName( item.CHECK_TYPE) }}
 | 
						|
							</view>
 | 
						|
							<view>
 | 
						|
								<text style="font-weight: bold;">检查类型</text> : {{ item.Nav_CheckType.NAME}}
 | 
						|
							</view>
 | 
						|
							<view>
 | 
						|
								<text style="font-weight: bold;">检查周期</text> : {{ getCheckCycle(item.CHECK_CYCLE)}}
 | 
						|
							</view>
 | 
						|
						</uni-td>
 | 
						|
						<uni-td width="50px" align="center">
 | 
						|
							<u-button type="primary" size="small" @click="showDetail(item)">选择</u-button>
 | 
						|
						</uni-td>
 | 
						|
					</uni-tr>
 | 
						|
 | 
						|
				</uni-table>
 | 
						|
			</scroll-view>
 | 
						|
		</view>
 | 
						|
		<u-modal :show="showTableOne" title="检查清单" class="modal-three" showCancelButton :showConfirmButton="false" @cancel="cancelButton('one')">
 | 
						|
			<view class="risk-record-page">
 | 
						|
				<view class="main-page">
 | 
						|
					<scroll-view scroll-x="true" scroll-y="true">
 | 
						|
						<uni-table border stripe>
 | 
						|
							<uni-tr>
 | 
						|
								<uni-th width="40px" align="center" style="padding: 0;">序号</uni-th>
 | 
						|
								<uni-th align="center">内容</uni-th>
 | 
						|
								<uni-th width="40px" align="center">操作</uni-th>
 | 
						|
							</uni-tr>
 | 
						|
							<uni-tr v-for="(item,index) in twolists">
 | 
						|
								<uni-td width="40px" align="center" style="padding: 0;">{{ index+1 }}</uni-td>
 | 
						|
								<uni-td class="td-modal">
 | 
						|
									<view><text style="font-weight: bold;">检查部门</text> : {{ item.Nav_Department.NAME}}</view>
 | 
						|
									<view><text style="font-weight: bold;">检查岗位</text> : {{ item.POST_NAME}}</view>
 | 
						|
								</uni-td>
 | 
						|
								<uni-td width="40px" align="center">
 | 
						|
									<u-button type="primary" size="small" @click="handleShowTable(index)">选择</u-button>
 | 
						|
 | 
						|
								</uni-td>
 | 
						|
							</uni-tr>
 | 
						|
 | 
						|
						</uni-table>
 | 
						|
					</scroll-view>
 | 
						|
				</view>
 | 
						|
			</view>
 | 
						|
		</u-modal>
 | 
						|
		<u-modal :show="showTable" title="检查清单" class="modal-three" showCancelButton @confirm="confirmButton('two')" @cancel="cancelButton('two')">
 | 
						|
			<table-own :tableData="threeList" @transmit="getMessage"></table-own>
 | 
						|
		</u-modal>
 | 
						|
		<view style="padding: 10px 16px;" class="bottom-button" v-if="showModal==2||showModal==1">
 | 
						|
			<u-button type="primary" @click="stepAdd" color="#3d4b70">上一步</u-button>
 | 
						|
		</view>
 | 
						|
	</view>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
	import {
 | 
						|
		initFilter,
 | 
						|
		extendRule,
 | 
						|
		extendInclude,
 | 
						|
		extendIgnoreDataRule
 | 
						|
	} from '../../../../utils/common'
 | 
						|
	import {
 | 
						|
		MineTypeIndex,
 | 
						|
		MineTypeName,
 | 
						|
		CheckTypeName,
 | 
						|
		CheckCycle
 | 
						|
	} from '../../../../utils/enums.js'
 | 
						|
	import {
 | 
						|
		GetSafeCheckListInfo,
 | 
						|
		SKEnterpriseLibrary,
 | 
						|
		GetCheckDetailList
 | 
						|
	} from '../../../../services/apply/subPages/SK/SKServices.js'
 | 
						|
 | 
						|
	import UniSearchBar from '../../../../uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue'
 | 
						|
	export default {
 | 
						|
		components: {
 | 
						|
			UniSearchBar
 | 
						|
		},
 | 
						|
		data() {
 | 
						|
			return {
 | 
						|
				pageIndex: 0,
 | 
						|
				total: 0,
 | 
						|
				lists: [],
 | 
						|
				twolists: [],
 | 
						|
				threeList: [],
 | 
						|
				nowIndex: 0,
 | 
						|
				params: {},
 | 
						|
				showModal: 0,
 | 
						|
				keyword: '',
 | 
						|
				searchStartTime: '',
 | 
						|
				filterStatus: null,
 | 
						|
				currentPage: 1, // 当前页码
 | 
						|
				pageSize: 10, // 每页显示数量
 | 
						|
				showTable: false,
 | 
						|
				showTableOne: false,
 | 
						|
				threeIndex:[]
 | 
						|
			}
 | 
						|
		},
 | 
						|
		onLoad() {
 | 
						|
			this.loadData()
 | 
						|
		},
 | 
						|
		created() {
 | 
						|
			this.loadData()
 | 
						|
		},
 | 
						|
 | 
						|
		methods: {
 | 
						|
			loadData() {
 | 
						|
				const orgId = uni.getStorageSync('orgId')
 | 
						|
				let json = initFilter(orgId);
 | 
						|
				extendIgnoreDataRule(json)
 | 
						|
				SKEnterpriseLibrary(json).then(res => {
 | 
						|
					// this.total = res.TotalCount
 | 
						|
					this.lists = (res || []).map(i => {
 | 
						|
						return {
 | 
						|
							...i,
 | 
						|
							title: MineTypeName[i.MineType],
 | 
						|
							Nav_CheckType: i.Nav_CheckType ? i.Nav_CheckType : {
 | 
						|
								NAME: ''
 | 
						|
							},
 | 
						|
						}
 | 
						|
					})
 | 
						|
				})
 | 
						|
			},
 | 
						|
			getMessage(e) {
 | 
						|
				this.threeIndex = e
 | 
						|
			},
 | 
						|
			stepAdd() {
 | 
						|
				this.showModal--
 | 
						|
			},
 | 
						|
			handleShowTable(index) {
 | 
						|
				// this.showModal++
 | 
						|
				this.showTable = true
 | 
						|
				this.nowIndex = index
 | 
						|
				// this.twolists[this.nowIndex].showTable = !this.twolists[this.nowIndex].showTable
 | 
						|
				this.threeList = this.twolists[index].Nav_ContentDatas
 | 
						|
 | 
						|
			},
 | 
						|
			getMineTypeName(mineType) {
 | 
						|
				return MineTypeName[mineType];
 | 
						|
			},
 | 
						|
			getCheckTypeName(CHECK_TYPE) {
 | 
						|
				return CheckTypeName[CHECK_TYPE]
 | 
						|
			},
 | 
						|
			getCheckCycle(Check_Cycle) {
 | 
						|
				return CheckCycle[Check_Cycle]
 | 
						|
			},
 | 
						|
			showDetail(item) {
 | 
						|
				const orgId = uni.getStorageSync('orgId')
 | 
						|
				this.showTableOne = true
 | 
						|
				this.currentPage = 1; // 重置页码
 | 
						|
				let json = initFilter(orgId, item.MineType, '', '', '', item.CHECK_TYPE_ID, item.CHECK_CYCLE, item.CHECK_TYPE);
 | 
						|
				extendIgnoreDataRule(json)
 | 
						|
				GetCheckDetailList(json).then(res => {
 | 
						|
					this.twolists = res
 | 
						|
					this.threeList = this.twolists[this.nowIndex].Nav_ContentDatas
 | 
						|
				})
 | 
						|
			},
 | 
						|
			confirmButton(name) {
 | 
						|
				if (name == 'one') {
 | 
						|
					this.showTableOne = false
 | 
						|
				} else {
 | 
						|
					let arr=[]
 | 
						|
					for(let i of this.threeIndex){
 | 
						|
						arr.push(this.twolists[this.nowIndex].Nav_ContentDatas[i])
 | 
						|
					}
 | 
						|
					this.$emit('transmitData', arr)
 | 
						|
					this.showTable = false;
 | 
						|
					this.showTableOne = false
 | 
						|
				}
 | 
						|
			},
 | 
						|
			cancelButton(name) {
 | 
						|
				if (name == 'one') {
 | 
						|
					this.showTableOne = false
 | 
						|
				} else {
 | 
						|
					this.showTable = false;
 | 
						|
				}
 | 
						|
			},
 | 
						|
			// 获取当前页的数据
 | 
						|
			getCurrentPageData(data) {
 | 
						|
				const start = (this.currentPage - 1) * this.pageSize;
 | 
						|
				const end = start + this.pageSize;
 | 
						|
				return data.slice(start, end);
 | 
						|
			},
 | 
						|
			// 获取当前页的起始序号
 | 
						|
			getPageStartIndex(data) {
 | 
						|
				return (this.currentPage - 1) * this.pageSize;
 | 
						|
			},
 | 
						|
			// 获取总页数
 | 
						|
			getTotalPages(data) {
 | 
						|
				return Math.ceil(data.length / this.pageSize);
 | 
						|
			},
 | 
						|
			// 上一页
 | 
						|
			prevPage(data) {
 | 
						|
				if (this.currentPage > 1) {
 | 
						|
					this.currentPage--;
 | 
						|
				}
 | 
						|
			},
 | 
						|
			// 下一页
 | 
						|
			nextPage(data) {
 | 
						|
				if (this.currentPage < this.getTotalPages(data)) {
 | 
						|
					this.currentPage++;
 | 
						|
				}
 | 
						|
			}
 | 
						|
		},
 | 
						|
	}
 | 
						|
</script>
 | 
						|
 | 
						|
 | 
						|
<style>
 | 
						|
	@import url("../../../../style/css/listTemplate.css");
 | 
						|
 | 
						|
	.pagination {
 | 
						|
		display: flex;
 | 
						|
		justify-content: flex-end;
 | 
						|
		align-items: center;
 | 
						|
		margin-top: 10px;
 | 
						|
		font-size: 14px;
 | 
						|
	}
 | 
						|
 | 
						|
 | 
						|
	.bottom-button {
 | 
						|
		position: fixed;
 | 
						|
		bottom: 0;
 | 
						|
		left: 0;
 | 
						|
		width: 100%;
 | 
						|
		padding: 10px 16px;
 | 
						|
		box-sizing: border-box;
 | 
						|
		background: #fff;
 | 
						|
		z-index: 999;
 | 
						|
	}
 | 
						|
 | 
						|
	.modal-container {
 | 
						|
		padding-bottom: 80px;
 | 
						|
		overflow-y: scroll;
 | 
						|
		overflow-x: scroll;
 | 
						|
		max-height: 400px;
 | 
						|
		width: 100%;
 | 
						|
	}
 | 
						|
 | 
						|
	.risk-record-page {
 | 
						|
		width: 100%;
 | 
						|
		max-height: 400px;
 | 
						|
		overflow-y: scroll;
 | 
						|
	}
 | 
						|
 | 
						|
	.main-page {
 | 
						|
		padding: 0px 5px;
 | 
						|
		max-height: 400px;
 | 
						|
	}
 | 
						|
 | 
						|
	.modal-one>>>.uni-table {
 | 
						|
		min-width: 0px !important;
 | 
						|
	}
 | 
						|
 | 
						|
	.modal-one>>>.uni-table-td {
 | 
						|
		padding: 8px 5px;
 | 
						|
	}
 | 
						|
 | 
						|
	.td-modal {
 | 
						|
		white-space: normal;
 | 
						|
		/* 允许文本换行 */
 | 
						|
		word-wrap: break-word;
 | 
						|
		/* 当单词太长时进行换行 */
 | 
						|
		word-break: break-all
 | 
						|
	}
 | 
						|
 | 
						|
	.modal-three>>>.u-modal__content {
 | 
						|
		/* overflow: scroll; */
 | 
						|
		padding: 12px 10px 25px 10px;
 | 
						|
	}
 | 
						|
</style> |