qa-regulatory-gwj-app/pages/branch-self-report/index/inspection-records.vue

289 lines
9.0 KiB
Vue
Raw Normal View History

2023-11-07 10:08:37 +08:00
<template>
<view class="content">
<view class="search card">
<u--input
prefixIcon="search"
placeholder="请输入关键字"
border="surround"
v-model="name"
2023-11-07 10:08:37 +08:00
clearable
shape="circle"
></u--input>
2024-10-10 10:14:31 +08:00
<view class="bth-mini ml-10">
<u-button type="success" text="确定" @click="resetList"></u-button>
</view>
2024-07-27 15:13:42 +08:00
2023-11-07 10:08:37 +08:00
</view>
<u-popup :show="popupShow" @close="popupShow = false" mode="right" :customStyle="{width:'85vw'}">
<view class="card">
2024-10-10 10:14:31 +08:00
<view class="pl-10 pr-10">
<u--form labelPosition="left">
<u-form-item label="清单名称" borderBottom>
<u--input
inputAlign="right"
placeholder="请输入清单名称"
border="none"
v-model="name"
2024-10-10 10:14:31 +08:00
clearable
></u--input>
</u-form-item>
<u-form-item label="检查部门" borderBottom>
<u--text :text="departmentName || '请选择'" @click="showTree"></u--text>
2024-10-10 10:14:31 +08:00
<tki-tree ref="tkitree" :range="deptRange" rangeKey="name" selectParent @confirm="confirmTree"/>
</u-form-item>
<u-form-item label="检查人" borderBottom>
<u--text :text="userName || '请选择'" @click="userShow = true"></u--text>
2024-10-10 10:14:31 +08:00
<u-picker :show="userShow" :columns="userList" keyName="USERNAME"
@cancel="userShow = false"
@confirm="pickerConfirm($event,'user')"></u-picker>
</u-form-item>
<u-form-item label="清单类型" borderBottom>
<u--text :text="typeName || '请选择'" @click="typeShow = true"></u--text>
2024-10-10 10:14:31 +08:00
<u-picker :show="typeShow" :columns="typeList" keyName="NAME"
@cancel="typeShow = false"
@confirm="pickerConfirm($event,'type')"></u-picker>
</u-form-item>
<u-form-item label="排查周期" borderBottom>
<u--text :text="periodicityName || '请选择'" @click="periodShow = true"></u--text>
2024-10-10 10:14:31 +08:00
<u-picker :show="periodShow" :columns="periodList" keyName="NAME"
@cancel="periodShow = false"
@confirm="pickerConfirm($event,'period')"></u-picker>
</u-form-item>
<u-form-item label="开始时间" borderBottom>
<u--text :text="startDate || '请选择'"
@click="startDateShow = true"></u--text>
<u-datetime-picker :show="startDateShow"
mode="date"
:value="Number(new Date())"
@cancel="startDateShow = false"
@confirm="startDateConfirm"></u-datetime-picker>
</u-form-item>
<u-form-item label="结束时间" borderBottom>
<u--text :text="endDate || '请选择'"
@click="endDateShow = true"></u--text>
<u-datetime-picker :show="endDateShow"
mode="date"
:value="Number(new Date())"
@cancel="endDateShow = false"
@confirm="endDateConfirm"></u-datetime-picker>
</u-form-item>
</u--form>
</view>
2023-11-07 10:08:37 +08:00
<view class="mt-10 flex-between">
2024-10-10 10:14:31 +08:00
<view class="flex1">
<u-button type="info" text="重置" @click="reset"></u-button>
</view>
<view class="ml-10 flex1">
<u-button type="primary" text="查询" @click="resetList"></u-button>
</view>
2023-11-07 10:08:37 +08:00
</view>
</view>
</u-popup>
<u-list @scrolltolower="scrolltolower" v-if="list.length > 0">
<u-list-item v-for="(item, index) in list" :key="index">
<view>
<view class="flex-between main-title">
<text>清单名称{{ item.name }}</text>
2023-11-07 10:08:37 +08:00
</view>
<view class="flex-between mt-10 subtitle">
<text>清单类型{{ item.typeName }}</text>
<text>排查周期{{ item.periodicityName }}</text>
2023-11-07 10:08:37 +08:00
</view>
<view class="flex-between mt-10 subtitle">
<text>部门{{ item.departmentName }}</text>
2023-11-07 10:08:37 +08:00
</view>
<view class="flex-between mt-10 subtitle">
<text>岗位{{ item.postName }}</text>
<text>人员{{ item.userName }}</text>
2023-11-07 10:08:37 +08:00
</view>
<view class="flex-between mt-10 subtitle">
<text>检查次数{{ item.checkCount }}</text>
<text>超期未检查次数{{ item.overtimeNumber }}</text>
2023-11-07 10:08:37 +08:00
</view>
2024-07-27 15:13:42 +08:00
<view class="flex-end mt-10 see_btn">
2024-10-10 10:14:31 +08:00
<u-button type="primary" text="查看" size="mini"
@click="fnNavigatorDetail(item.id)"></u-button>
2023-11-07 10:08:37 +08:00
</view>
</view>
</u-list-item>
</u-list>
<empty v-else></empty>
2024-10-10 10:14:31 +08:00
<fab-button type="search" @click="popupShow = true"/>
2023-11-07 10:08:37 +08:00
</view>
</template>
<script>
2024-10-10 10:14:31 +08:00
import {
getInspectionReportListManageList,
getDeptUser,
getCheckCycle,
getListType,
getInspectedDepartment
} from "@/api";
2024-10-10 10:14:31 +08:00
import FabButton from "@/components/fab_button/index.vue";
2023-11-07 10:08:37 +08:00
export default {
2024-10-10 10:14:31 +08:00
components: {FabButton},
2023-11-07 10:08:37 +08:00
data() {
return {
companyId: '',
name: '',
limit: 10,
curPage: 1,
2023-11-07 10:08:37 +08:00
totalPage: 0,
list: [],
popupShow: false,
departmentId: '',
departmentName: '',
2023-11-07 10:08:37 +08:00
deptRange: [],
userList: [],
userShow: false,
userName: '',
userId: '',
2023-11-07 10:08:37 +08:00
typeList: [],
typeShow: false,
typeName: '',
type: '',
2023-11-07 10:08:37 +08:00
periodList: [],
periodShow: false,
periodicityName: '',
periodicity: '',
2024-10-10 10:14:31 +08:00
startDateShow: false,
startDate: '',
endDateShow: false,
endDate: '',
2023-11-07 10:08:37 +08:00
}
},
onLoad(event) {
this.companyId = event.companyId;
2023-11-07 10:08:37 +08:00
this.resetList()
this.getDept()
this.fnGetCheckCycle()
this.fnGetListType()
},
2024-10-10 10:14:31 +08:00
methods: {
2023-11-07 10:08:37 +08:00
async getDept() {
let resData = await getInspectedDepartment({'CORPINFO_ID': this.companyId});
2023-11-07 10:08:37 +08:00
this.deptRange = JSON.parse(resData.zTreeNodes)
},
async fnGetDeptUser(detpId) {
let resData = await getDeptUser({'DEPARTMENT_ID': detpId});
this.$set(this.userList, 0, resData.userList)
},
async fnGetCheckCycle() {
let resData = await getCheckCycle();
this.$set(this.periodList, 0, resData.list)
},
async fnGetListType() {
let resData = await getListType();
this.$set(this.typeList, 0, resData.list)
},
2024-10-10 10:14:31 +08:00
async getData() {
2023-11-07 10:08:37 +08:00
this.popupShow = false
let { page } = await getInspectionReportListManageList({
companyId: this.companyId,
name: this.name,
departmentId: this.departmentId,
userId: this.userId,
type: this.type,
periodicity: this.periodicity,
startDate: this.startDate,
endDate: this.endDate,
limit: this.limit,
curPage: this.curPage,
2023-11-07 10:08:37 +08:00
});
this.list = [...this.list, ...page.list];
this.totalPage = page.totalPage;
2023-11-07 10:08:37 +08:00
},
resetList() {
this.limit = 10
this.curPage = 1
2023-11-07 10:08:37 +08:00
this.list = []
this.getData()
},
fnNavigatorDetail(id) {
2023-11-07 10:08:37 +08:00
uni.$u.route({
url: '/pages/branch-self-report/index/inspection-records-detail-list',
params: {
id,
companyId: this.companyId,
2023-11-07 10:08:37 +08:00
}
})
},
scrolltolower() {
this.curPage++;
if (this.totalPage >= this.curPage) this.getData();
2023-11-07 10:08:37 +08:00
},
showTree() {
this.$refs.tkitree._show()
},
confirmTree(e) {
this.departmentId = e[0].id
this.departmentName = e[0].name
2023-11-07 10:08:37 +08:00
this.fnGetDeptUser(e[0].id)
},
pickerConfirm(e, type) {
if (type === 'user') {
this.userId = e.value[0].USER_ID
this.userName = e.value[0].USERNAME
2023-11-07 10:08:37 +08:00
this.userShow = false;
}
if (type === 'type') {
this.type = e.value[0].BIANMA
this.typeName = e.value[0].NAME
2023-11-07 10:08:37 +08:00
this.typeShow = false;
}
if (type === 'period') {
this.periodicity = e.value[0].BIANMA
this.periodicityName = e.value[0].NAME
2023-11-07 10:08:37 +08:00
this.periodShow = false;
}
},
2024-10-10 10:14:31 +08:00
startDateConfirm(e) {
2023-11-07 10:08:37 +08:00
this.startDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
this.startDateShow = false
},
2024-10-10 10:14:31 +08:00
endDateConfirm(e) {
2023-11-07 10:08:37 +08:00
this.endDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
this.endDateShow = false
},
reset() {
this.popupShow = false
this.name = ''
this.departmentId = ''
this.departmentName = ''
this.userId = ''
this.userName = ''
this.type = ''
this.typeName = ''
this.periodicity = ''
this.periodicityName = ''
2023-11-07 10:08:37 +08:00
this.startDate = ''
this.endDate = ''
this.resetList()
}
}
}
</script>
2024-07-27 15:13:42 +08:00
<style scoped lang="scss">
2024-10-10 10:14:31 +08:00
.search {
2024-07-27 15:13:42 +08:00
display: flex;
2024-10-10 10:14:31 +08:00
.ml-10 {
2024-07-27 15:13:42 +08:00
margin-left: 10rpx;
}
2024-10-10 10:14:31 +08:00
.bth-mini {
2024-07-27 15:13:42 +08:00
width: 100rpx;
}
}
2024-10-10 10:14:31 +08:00
.see_btn {
2024-07-27 15:13:42 +08:00
width: 100rpx;
float: right;
}
2023-11-07 10:08:37 +08:00
</style>