<template>
|
<div class="app-container">
|
<div style="display: flex;justify-content: space-between">
|
<el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" >
|
<el-form-item label="检查日期:" >
|
<el-date-picker
|
v-model="queryParams.searchDate"
|
type="month"
|
value-format="YYYY-MM"
|
placeholder="请选择"
|
/>
|
</el-form-item>
|
<el-form-item >
|
<el-button type="primary" @click="getList">查询</el-button>
|
<el-button type="primary" plain @click="reset">重置</el-button>
|
<!-- <el-button type="primary">导出</el-button>-->
|
</el-form-item>
|
</el-form>
|
</div>
|
<!-- 表格数据 -->
|
<el-table v-loading="loading" :data="deptList" :border="true" row-key="deptId" default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
|
<el-table-column prop="deptName" label="部门名称" align="center"></el-table-column>
|
<el-table-column prop="checkCount" label="检查状态" align="center">
|
<template #default="scope">
|
<el-tag v-if="scope.row.checkCount > 0" type="success">已检查</el-tag>
|
<el-tag v-else type="danger">未检查</el-tag>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</template>
|
|
<script setup>
|
import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
import Cookies from "js-cookie";
|
import useUserStore from "@/store/modules/user";
|
import {listDept} from "@/api/system/dept";
|
import {
|
delDailySafetyInspect,
|
getDailySafetyInspectList,
|
getDeptCheckData,
|
saveDailySafetyInspect
|
} from "@/api/saftyCheck";
|
const { proxy } = getCurrentInstance();
|
const loading = ref(false);
|
const dialogRef = ref();
|
const state = reactive({
|
queryParams: {
|
searchDate: ''
|
},
|
deptList: [],
|
});
|
|
const { queryParams,deptList } = toRefs(state);
|
onMounted(async ()=>{
|
await getList()
|
})
|
|
onUnmounted(()=>{
|
|
})
|
|
function getList() {
|
getDeptCheckData(state.queryParams).then(response => {
|
state.deptList = proxy.handleTree(response.data, "deptId")
|
});
|
}
|
|
/** 重置新增的表单以及其他数据 */
|
const reset= async()=> {
|
state.queryParams = {
|
pageNum: 1,
|
pageSize: 10,
|
researchGroup: null,
|
searchCheckUserId: null,
|
checkType: null,
|
haveMainHazard: null,
|
checkBeginDate: '',
|
checkEndDate: ''
|
}
|
state.checkDate = []
|
await getList()
|
}
|
|
|
|
|
const handleClose = () => {
|
dialogRef.value.closeDialog()
|
}
|
|
</script>
|