|
@@ -1,388 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="content-container">
|
|
|
- <el-row class="tool-bar">
|
|
|
- <el-col :span="12" class="left">
|
|
|
- <div class="content-title">
|
|
|
- {{ title }}
|
|
|
- </div>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12" class="right">
|
|
|
- <el-input v-model="conditions.keywords" class="search-input m-right-15" placeholder="请输入内容">
|
|
|
- <el-button slot="append" icon="el-icon-search" @click="getData()" />
|
|
|
- </el-input>
|
|
|
- <el-button type="primary" @click="handleExport">导出Excel</el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row class="m-top-15">
|
|
|
- <el-table v-loading="listLoading" class="page-table" border :data="dataList" height="calc(100vh - 240px)">
|
|
|
- <el-table-column type="index" label="序号" header-align="center" align="center" width="80" />
|
|
|
-
|
|
|
- <el-table-column prop="riskPointTitle" label="风险点" header-align="center" align="center" width="120">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span>{{ row.riskPointTitle }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="accountName" label="检查人员" header-align="center" align="center" width="100">
|
|
|
- <template v-slot="{row}">
|
|
|
- <el-popover trigger="hover" placement="top">
|
|
|
- <p>部门: {{ row.groupName }}</p>
|
|
|
- <p>岗位: {{ row.positionName }}</p>
|
|
|
- <div slot="reference" class="name-wrapper">
|
|
|
- <i class="el-icon-user" /> {{ row.accountName }}
|
|
|
- </div>
|
|
|
- </el-popover>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="checkTime" label="检查时间" header-align="center" align="center" width="160">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span><i class="el-icon-time" /> {{ row.checkTime }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="taskTitle" label="任务名称" header-align="center" align="center" width="150">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span>{{ row.taskTitle }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="taskCatTitle" label="任务类型" header-align="center" align="center" width="100">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span>{{ row.taskCatTitle }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="hazardTitle" label="风险单元" header-align="center" align="center" width="120">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span>{{ row.hazardTitle }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="riskTitle" label="场所/环节/部位" header-align="center" align="center" width="120">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span>{{ row.riskTitle }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="measureContent" label="检查内容" header-align="left" align="left">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span>{{ row.measureContent }}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
-
|
|
|
- <el-table-column prop="checkResult" label="检查结果" header-align="center" align="center" width="90">
|
|
|
- <template v-slot="{row}">
|
|
|
- <span v-if="row.checkResult===0" style="color: #20f704">未检查</span>
|
|
|
- <span v-if="row.checkResult===1" style="color: #20f704">通过</span>
|
|
|
- <span v-if="row.checkResult===-1" style="color: #fc5c04">不通过</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
-
|
|
|
- <div class="pagination-wrap">
|
|
|
- <pagination v-show="total>0" :total="total" :page.sync="conditions.page" :limit.sync="conditions.limit" @pagination="getData" />
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
-import { getCheckRecordByPage, getCheckRecordByList } from '@/api/aqpt/checkRecordApi'
|
|
|
-import { formatDate, getWeekStartDate, getWeekEndDate, getMonthStartDate, getMonthEndDate, getYearStartDate, getYearEndDate, checkResult } from '@/utils'
|
|
|
-import Pagination from '@/components/Pagination'
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-
|
|
|
-export default {
|
|
|
- name: 'RecordList',
|
|
|
- components: { Pagination },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- dataList: [],
|
|
|
- total: 0,
|
|
|
- listLoading: false,
|
|
|
- downloadLoading: false,
|
|
|
- title: '',
|
|
|
- action: 'MyTotal',
|
|
|
- conditions: {
|
|
|
- page: 1,
|
|
|
- limit: 10,
|
|
|
- keywords: '',
|
|
|
- day: undefined,
|
|
|
- accountId: undefined,
|
|
|
- startDate: undefined,
|
|
|
- endDate: undefined,
|
|
|
- groupId: undefined,
|
|
|
- checkResult: 0
|
|
|
- },
|
|
|
- exportList: [],
|
|
|
- filename: '',
|
|
|
- autoWidth: true,
|
|
|
- bookType: 'xlsx'
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- ...mapGetters([
|
|
|
- 'userData'
|
|
|
- ])
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- this.accountId = this.userData.userId
|
|
|
- this.loadData('MyTotal')
|
|
|
- },
|
|
|
- methods: {
|
|
|
-
|
|
|
- // 重置查询条件
|
|
|
- resetConditionsData() {
|
|
|
- this.conditions.accountId = undefined
|
|
|
- this.conditions.groupId = undefined
|
|
|
- this.conditions.day = undefined
|
|
|
- this.conditions.startDate = undefined
|
|
|
- this.conditions.endDate = undefined
|
|
|
- this.conditions.checkResult = undefined
|
|
|
- },
|
|
|
-
|
|
|
- // 加载数据
|
|
|
- loadData(action) {
|
|
|
- this.action = action
|
|
|
- const groupId = this.userData.groupId
|
|
|
- const userId = this.userData.userId
|
|
|
-
|
|
|
- switch (action) {
|
|
|
- case 'MyTotal':
|
|
|
- this.title = '我检查的所有记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.accountId = userId
|
|
|
- break
|
|
|
- case 'MyPassed':
|
|
|
- this.title = '我检查通过的记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.accountId = userId
|
|
|
- this.conditions.checkResult = 1
|
|
|
- break
|
|
|
- case 'MyFailed':
|
|
|
- this.title = '我检查未通过的记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.accountId = userId
|
|
|
- this.conditions.checkResult = -1
|
|
|
- break
|
|
|
- case 'MyToday':
|
|
|
- this.title = '我今天的记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.accountId = userId
|
|
|
- this.conditions.day = formatDate(new Date())
|
|
|
- break
|
|
|
- case 'MyThisWeek':
|
|
|
- this.title = '我本周的记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.accountId = userId
|
|
|
- this.conditions.startDate = getWeekStartDate()
|
|
|
- this.conditions.endDate = getWeekEndDate()
|
|
|
- break
|
|
|
- case 'MyThisMonth':
|
|
|
- this.title = '我本月的记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.accountId = userId
|
|
|
- this.conditions.startDate = getMonthStartDate()
|
|
|
- this.conditions.endDate = getMonthEndDate()
|
|
|
- break
|
|
|
- case 'MyThisYear':
|
|
|
- this.title = '我本年度的记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.accountId = userId
|
|
|
- this.conditions.startDate = getYearStartDate()
|
|
|
- this.conditions.endDate = getYearEndDate()
|
|
|
- break
|
|
|
-
|
|
|
- case 'GroupTotal':
|
|
|
- this.title = '部门记录'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.groupId = groupId
|
|
|
- break
|
|
|
- case 'GroupPassed':
|
|
|
- this.title = '部门检查通过的'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.groupId = groupId
|
|
|
- this.conditions.checkResult = 1
|
|
|
- break
|
|
|
- case 'GroupFailed':
|
|
|
- this.title = '部门检查未通过的'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.groupId = groupId
|
|
|
- this.conditions.checkResult = -1
|
|
|
- break
|
|
|
- case 'GroupToday':
|
|
|
- this.title = '部门今天的'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.groupId = groupId
|
|
|
- this.conditions.day = formatDate(new Date())
|
|
|
- break
|
|
|
- case 'GroupThisWeek':
|
|
|
- this.title = '部门本周的'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.groupId = groupId
|
|
|
- this.conditions.startDate = getWeekStartDate()
|
|
|
- this.conditions.endDate = getWeekEndDate()
|
|
|
- break
|
|
|
- case 'GroupThisMonth':
|
|
|
- this.title = '部门本月的'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.groupId = groupId
|
|
|
- this.conditions.startDate = getMonthStartDate()
|
|
|
- this.conditions.endDate = getMonthEndDate()
|
|
|
- break
|
|
|
- case 'GroupThisYear':
|
|
|
- this.title = '部门本年度的'
|
|
|
- this.resetConditionsData()
|
|
|
- this.conditions.groupId = groupId
|
|
|
- this.conditions.startDate = getYearStartDate()
|
|
|
- this.conditions.endDate = getYearEndDate()
|
|
|
- break
|
|
|
- }
|
|
|
- this.getData()
|
|
|
- },
|
|
|
- // 加载数据
|
|
|
- getData() {
|
|
|
- this.listLoading = true
|
|
|
- getCheckRecordByPage(this.conditions).then((resp) => {
|
|
|
- const { code, data, total, msg } = resp
|
|
|
- this.listLoading = false
|
|
|
- if (code === 0) {
|
|
|
- this.total = total
|
|
|
- this.dataList = data
|
|
|
- } else {
|
|
|
- this.$message.error(msg)
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- console.log(error)
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- handleExport() {
|
|
|
- this.downloadLoading = true
|
|
|
- getCheckRecordByList(this.conditions).then((resp) => {
|
|
|
- const { code, data, msg } = resp
|
|
|
- if (code === 0) {
|
|
|
- this.exportList = data
|
|
|
- this.exportExcel()
|
|
|
- } else {
|
|
|
- this.$message.error(msg)
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- console.log(error)
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- // 导出EXCEL
|
|
|
- exportExcel() {
|
|
|
- import('@/vendor/Export2Excel').then(excel => {
|
|
|
- const tHeader = ['任务名称', '任务类别', '检查时间', '风险点', '风险单元', '危险因素', '检查内容', '检查结果']
|
|
|
- const filterVal = ['taskTitle', 'taskCatTitle', 'checkTime', 'riskPointTitle', 'hazardTitle', 'riskTitle', 'measureContent', 'checkResult']
|
|
|
- const list = this.exportList
|
|
|
- const data = this.formatJson(filterVal, list)
|
|
|
- excel.export_json_to_excel({
|
|
|
- header: tHeader,
|
|
|
- data,
|
|
|
- filename: this.filename,
|
|
|
- autoWidth: this.autoWidth,
|
|
|
- bookType: this.bookType
|
|
|
- })
|
|
|
- this.downloadLoading = false
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- formatJson(filterVal, jsonData) {
|
|
|
- return jsonData.map(v => filterVal.map(j => {
|
|
|
- if (j === 'checkResult') {
|
|
|
- return checkResult(v[j])
|
|
|
- } else {
|
|
|
- return v[j]
|
|
|
- }
|
|
|
- }))
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</script>
|
|
|
-<style lang="scss">
|
|
|
-</style>
|
|
|
-<style lang="scss" scoped>
|
|
|
-.content-container {
|
|
|
- background: #193142FF;
|
|
|
- margin-left: 15px;
|
|
|
- padding: 15px;
|
|
|
- height: calc(100vh - 100px);
|
|
|
-
|
|
|
- .page-title {
|
|
|
- font-size: 16px;
|
|
|
- font-weight: normal;
|
|
|
- color: #FFFFFF;
|
|
|
- }
|
|
|
-
|
|
|
- .tool-bar {
|
|
|
- .left {
|
|
|
- float: left;
|
|
|
- }
|
|
|
-
|
|
|
- .right {
|
|
|
- float: right;
|
|
|
- text-align: right;
|
|
|
- }
|
|
|
-
|
|
|
- .title {
|
|
|
- line-height: 36px;
|
|
|
- font-size: 26px;
|
|
|
- }
|
|
|
-
|
|
|
- .search-input {
|
|
|
- width: 300px;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- .el-dropdown {
|
|
|
- margin: 0 10px;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-.custom-switch-tag {
|
|
|
- width: 76px;
|
|
|
- height: 26px;
|
|
|
- background: #5EB777;
|
|
|
- border-radius: 13px;
|
|
|
- position: relative;
|
|
|
- font-size: 12px;
|
|
|
- line-height: 26px;
|
|
|
- text-align: left;
|
|
|
- text-indent: 10px;
|
|
|
- cursor: default;
|
|
|
-
|
|
|
- &::after {
|
|
|
- display: block;
|
|
|
- content: "";
|
|
|
- width: 14px;
|
|
|
- height: 14px;
|
|
|
- background: #FFFFFF;
|
|
|
- border-radius: 50%;
|
|
|
- right: 5px;
|
|
|
- top: 6px;
|
|
|
- position: absolute;
|
|
|
- }
|
|
|
-
|
|
|
- &.wait {
|
|
|
- background: none;
|
|
|
- border: 1px solid #3B5D73;
|
|
|
- color: #3B5D73;
|
|
|
- text-align: right;
|
|
|
- box-sizing: border-box;
|
|
|
- text-indent: 0;
|
|
|
- padding-right: 10px;
|
|
|
- line-height: 24px;
|
|
|
-
|
|
|
- &::after {
|
|
|
- top: 5px;
|
|
|
- background: #3B5D73;
|
|
|
- left: 5px;
|
|
|
- right: inherit;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-</style>
|