qa-prevention-xgf-app/hiddenManageSubPackages/pages/hidden_acceptance/index.vue

206 lines
4.9 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view>
<!-- 吸顶搜索框 start -->
<key-word-search-input
:inputSearchValue="searchForm.HIDDENDESCR"
@search="handleSearch"
/>
<!-- 吸顶搜索框 end -->
<!-- 列表渲染 start -->
<list :list="list" @scrollToLower="scrollToLower">
<template #default="{ item }">
<view class="flex-between main-title">
<view class="u-line-1">{{ item.HIDDENDESCR || "暂无" }}</view>
<view :class="hiddenLevelColor[item.HIDDENLEVEL]">
{{ item.HIDDENLEVELNAME }}
</view>
</view>
<view class="flex-between subtitle mt-5">
<view>来源{{ hiddenSource[item.SOURCE] }}</view>
</view>
<view class="flex-between subtitle mt-5">
<view>整改人{{ item.RECTIFICATIONORNAME || "暂无" }}</view>
<view>
整改时间{{
item.RECTIFICATIONTIME
? formatTime(item.RECTIFICATIONTIME)
: "暂无"
}}
</view>
</view>
<view class="flex-between subtitle mt-5">
<view>隐患发现人{{ item.findUserNames || "暂无" }}</view>
<view>
隐患发现时间{{
item.DISCOVERYTIME ? formatTime(item.DISCOVERYTIME) : "暂无"
}}
</view>
</view>
<view class="flex-between subtitle mt-5">
<view>隐患确认人{{ item.confirmUserName || "暂无" }}</view>
<view>
隐患确认时间{{
item.CONFIRM_TIME ? formatTime(item.CONFIRM_TIME) : "暂无"
}}
</view>
</view>
<view class="flex-between subtitle mt-5">
<view>隐患状态{{ statusList[item.STATE] }}</view>
<view class="flex-between">
<view>
<u-button
type="primary"
size="mini"
shape="circle"
@click="handleClickAcceptance(item)"
>
验收
</u-button>
</view>
<view class="ml-10">
<u-button
type="primary"
size="mini"
shape="circle"
@click="handleClickView(item)"
>
查看
</u-button>
</view>
</view>
</view>
</template>
</list>
<!-- 列表渲染 end -->
</view>
</template>
<script>
import keyWordSearchInput from "@/components/keyWordSearchInput/index.vue";
import List from "@/components/list/list.vue";
import * as HiddenAcceptanceApi from "../../api/index";
import dayjs from "dayjs";
import { HIDDEN_LEVEL_COlOR, HIDDEN_SOURCE } from "@/utils/constant";
import { hidden_acceptance_list } from "@/Mock/responseData.js";
export default {
components: { keyWordSearchInput, List },
onLoad() {},
data() {
return {
store: this.$store, // 全局store
searchForm: {
HIDDENDESCR: "",
},
isRequestEnd: false, // 请求是否已结束
pagination: {
showCount: 10,
currentPage: 1,
stateConfirm: "0",
total: 0,
},
statusList: {
"-2": "待确认",
"-1": "已过期",
1: "未整改",
2: "已整改",
3: "已复查",
4: "已验收",
5: "已忽略",
6: "重大隐患",
7: "待处理特殊隐患",
8: "特殊处理隐患",
},
list: [],
};
},
// 页面展示后立刻触发
onShow() {
this.getList();
},
created() {},
computed: {
hiddenLevelColor() {
return HIDDEN_LEVEL_COlOR;
},
hiddenSource() {
return HIDDEN_SOURCE;
},
},
mounted() {},
methods: {
/** 处理搜索事件 */
async handleSearch(val) {
this.pagination = {
...this.pagination,
currentPage: 1,
showCount: 10,
total: 0,
};
await this.getList(val);
},
/** 获取列表数据 */
getList() {
if (this.isRequestEnd) return null;
uni.showLoading({
title: "加载中",
});
let { USER_ID, CORPINFO_ID, DEPARTMENT_ID } = this.store.state.userInfo;
// HiddenAcceptanceApi.getHiddenList({
// USER_ID: USER_ID,
// CORPINFO_ID,
// currentPage: this.pagination.currentPage,
// showCount: this.pagination.showCount,
// DISPOSESTATE: 2,
// stateConfirm: this.pagination.stateConfirm,
// USERDEPT: DEPARTMENT_ID,
// SELFUSERID: USER_ID,
// corpinfoId: CORPINFO_ID,
// loginUserId: USER_ID,
// });
// 虚拟 mock 数据渲染
setTimeout(() => {
this.list = hidden_acceptance_list;
this.pagination.total = hidden_acceptance_list.length;
uni.hideLoading();
}, 400);
},
/** 格式化日期时间 */
formatTime(val) {
return dayjs(val).format("YYYY-MM-DD");
},
/** 向下滚动加载数据 */
async scrollToLower() {
this.pagination.currentPage = this.pagination.currentPage++;
if (this.total >= this.pagination.currentPage) await this.getList();
},
/** 验收按钮点击事件 */
handleClickAcceptance(ext) {
uni.$u.route(
"/hiddenManageSubPackages/pages/hidden_acceptance/acceptance",
{
HIDDEN_ID: ext.HIDDEN_ID,
}
);
},
/** 查看按钮点击事件 */
handleClickView(ext) {
uni.$u.route("/hiddenManageSubPackages/pages/hidden_acceptance/view", {
HIDDEN_ID: ext.HIDDEN_ID,
});
},
},
};
</script>
<style scoped lang="scss"></style>