qa-prevention-xgf-app/safetyEnvirSubPackages/pages/inspected/list.vue

152 lines
4.3 KiB
Vue
Raw Normal View History

<template>
<view>
<!-- 吸顶搜索框 start -->
<key-word-search-input :inputSearchValue="searchForm.HIDDENDESCR" @search="resetList" is-has-filter
@showPicker="showPicker" />
<!-- 吸顶搜索框 end -->
<!-- 筛选器 start -->
<u-picker :show="show" :columns="columns" keyName="name" @cancel="show = false" @confirm="confirmPicker" />
<!-- 筛选器 end -->
<!-- 列表渲染 start -->
<list :list="list" @scrollToLower="scrollToLower">
<template #default="{ item }">
<view class="flex-between main-title">
<text style="font-size: 30upx; color: #000;">{{ item.INSPECTION_SUBJECT }}现场安全检查记录</text>
</view>
<view class="flex-between main-title">
<text>
检查状态{{ translate(item.INSPECTION_STATUS) }}
</text>
<text>检查类型{{ item.INSPECTION_TYPE_NAME }}</text>
</view>
<view class="flex-between main-title">
<text>检查人{{ item.INSPECTION_USER_NAME }}</text>
<text>检查发起人{{ item.INSPECTION_ORIGINATOR_NAME }}</text>
</view>
<view class="flex-between main-title">
<text>被检查人{{ item.INSPECTED_SITEUSER_NAME }}</text>
</view>
<view class="flex-between main-title">
<text>检查时间{{ item.INSPECTION_TIME_START }} {{ item.INSPECTION_TIME_END }}</text>
</view>
<view class="flex-end">
<!-- v-if="item.INSPECTION_STATUS === '2'" -->
<view>
<u-button type="primary" text="确认" size="mini" shape="circle" @click="goToDetail(item.INSPECTION_ID)" />
</view>
</view>
</template>
</list>
</view>
</template>
<script>
import { getInspectedList } from "../../api";
import keyWordSearchInput from "@/components/keyWordSearchInput/index.vue";
import List from "@/components/list/list.vue";
import { inspectedList } from "../../../Mock/safetyEnvirData";
export default {
components: { keyWordSearchInput, List },
data() {
return {
show: false,
columns: [
[
{ id: "", name: "请选择" },
{ id: "0", name: "待检查人核实" },
{ id: "1", name: "检查人核实中" },
{ id: "2", name: "待被检查人确认" },
{ id: "3", name: "已归档" },
{ id: "4", name: "指派中" },
{ id: "5", name: "指派完成" },
{ id: "6", name: "待验收" },
{ id: "7", name: "已验收" },
{ id: "-1", name: "检查人核实打回" },
{ id: "-2", name: "被检查人申辩" },
],
],
searchForm: {
HIDDENDESCR: "",
},
pageSize: 10,
currentPage: 1,
totalPage: 0,
list: [],
}
},
onShow() {
this.resetList();
},
methods: {
async getData() {
uni.showLoading({
title: "加载中",
});
// TODO: 目前因后端资源接口未完成,故注释接口数据接入逻辑
// let resData = await getInspectedList({
// showCount: this.pageSize,
// currentPage: this.currentPage,
// });
// this.list = [...this.list, ...resData.varList];
// this.totalPage = resData.page.totalPage;
// 虚拟 mock 数据渲染
setTimeout(() => {
this.list = inspectedList;
this.totalPage = inspectedList.length;
uni.hideLoading();
}, 400);
},
resetList() {
this.pageSize = 10;
this.currentPage = 1;
this.list = [];
this.getData();
},
showPicker() {
this.show = true;
},
confirmPicker(e) {
this.INSPECTION_STATUS = e.value[0].id;
this.show = false;
this.resetList();
},
/**
* 申辩处理按钮事件
*/
goToDetail(INSPECTION_ID) {
uni.$u.route({
url: "/safetyEnvirSubPackages/pages/inspected/detail",
params: {
INSPECTION_ID,
},
});
},
translate(id) {
for (var i = 0; i < this.columns.length; i++) {
if (this.columns[i].id == id) return this.columns[i].name
}
},
/**
* 滚动加载数据
*/
scrollToLower() {
this.currentPage++;
if (this.totalPage >= this.currentPage) this.getData();
},
}
}
</script>
<style scoped lang="scss">
.main-title {
font-size: 26upx;
color: #888;
}
</style>