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

197 lines
4.6 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.findUserNames || "暂无" }}</view>
<view>
隐患发现时间{{
item.DISCOVERYTIME ? formatTime(item.DISCOVERYTIME) : "暂无"
}}
</view>
</view>
<view class="flex-between subtitle mt-5">
<view>
隐患确认状态{{
item.STATE === "-2"
? "待确认"
: item.STATE === "16"
? "已打回"
: "已确认"
}}
</view>
<view class="flex-between">
<view
v-if="
item.STATE === '-2' && userInfo.USER_ID === item.CONFIRM_USER
"
>
<u-button
type="primary"
size="mini"
shape="circle"
text="确认"
@click="handleClickConfirm(item)"
/>
</view>
<view class="ml-10">
<u-button
type="primary"
size="mini"
shape="circle"
text="查看"
@click="handleClickView(item)"
/>
</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 HiddenDangerConfirmApi from "../../api/index";
import dayjs from "dayjs";
import { HIDDEN_LEVEL_COlOR, HIDDEN_SOURCE } from "@/utils/constant";
import { listMock } from "@/Mock/responseData.js";
export default {
components: { keyWordSearchInput, List },
data() {
return {
/** 全局store */
store: this.$store,
searchForm: {
HIDDENDESCR: "",
},
/** 请求是否已结束 */
isRequestEnd: false,
/** 分页配置 */
pagination: {
/** 展示总数 */
showCount: 10,
/** 当前页 */
currentPage: 1,
/** 状态确认 */
stateConfirm: "0",
/** 总页数 */
total: 0,
},
/** 列表数据存储 */
list: [],
};
},
created() {},
mounted() {},
// 页面展示后立刻触发
onShow() {
this.getList();
},
computed: {
hiddenLevelColor() {
return HIDDEN_LEVEL_COlOR;
},
hiddenSource() {
return HIDDEN_SOURCE;
},
userInfo() {
return this.$store.getters.getUserInfo;
},
/** 动态计算 list 列表的高度 */
calcListHeight() {
return this.totalHeight;
},
},
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;
// HiddenDangerConfirmApi.getHiddenDangerConfirmList({
// 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 = listMock;
this.pagination.total = listMock.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();
},
/** 处理点击确认按钮事件 */
handleClickConfirm(ext) {
uni.$u.route("/hiddenManageSubPackages/pages/hidden_confirm/confirm", {
HIDDEN_ID: ext.HIDDEN_ID,
});
},
/** 处理点击查看按钮事件 */
handleClickView(ext) {
uni.$u.route("/hiddenManageSubPackages/pages/hidden_confirm/view", {
HIDDEN_ID: ext.HIDDEN_ID,
});
},
},
};
</script>
<style lang="scss" scoped></style>