2024年9月9日shanao
shanao 2024-10-15 18:14:18 +08:00
parent 5c7df2fe8d
commit ab28e7148d
7 changed files with 225 additions and 10 deletions

View File

@ -20,6 +20,9 @@
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset"> <el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
重置 重置
</el-button> </el-button>
<el-button v-waves class="filter-item" type="info" icon="el-icon-download" @click="exportExcel">
导出
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -34,9 +37,10 @@
'color': '#000' 'color': '#000'
}" }"
tooltip-effect="dark" tooltip-effect="dark"
highlight-current-row
border border
fit fit
highlight-current-row @current-change="handleCurrentChange"
> >
<el-table-column type="index" label="序号" width="50" align="center" /> <el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="CORP_NAME" label="公司名称" show-overflow-tooltip /> <el-table-column prop="CORP_NAME" label="公司名称" show-overflow-tooltip />
@ -89,7 +93,9 @@
<script> <script>
import Pagination from '@/components/Pagination' // el-pagination import Pagination from '@/components/Pagination' // el-pagination
import { requestFN } from '@/utils/request' import { requestFN } from '@/utils/request'
import waves from '@/directive/waves' // waves directive import waves from '@/directive/waves'
import axios from 'axios'
import dayjs from 'dayjs' // waves directive
export default { export default {
name: 'IndexVue', name: 'IndexVue',
components: { Pagination }, components: { Pagination },
@ -115,7 +121,8 @@ export default {
total: 0, total: 0,
OUTSOURCED_NAME: '', OUTSOURCED_NAME: '',
CORP_NAME: '', CORP_NAME: '',
varList: [] varList: [],
row: null
} }
}, },
created() { created() {
@ -155,6 +162,55 @@ export default {
goDetail(ID) { goDetail(ID) {
this.$parent.CORPINFO_ID = ID this.$parent.CORPINFO_ID = ID
this.$parent.activeName = this.activeName this.$parent.activeName = this.activeName
},
handleCurrentChange(row) {
this.row = row
},
exportExcel() {
if (this.row == null || this.row.CORPINFO_ID == null || this.row.CORPINFO_ID === '') {
this.$message.error('请选择公司')
return
}
this.$confirm('确定要下载' + this.row.CORP_NAME + '的检查数据吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.listLoading = false
const loading = this.$loading({
lock: true,
text: '加载中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
axios.get(config.httpurl + '/keyprojectcheck/export/excel/' + this.row.CORPINFO_ID, {
responseType: 'blob'
}).then(res => {
setTimeout(() => {
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.style.display = 'none'
downloadElement.href = href
downloadElement.download = this.row.CORP_NAME
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
this.$emit('getResult', '')
loading.close()
this.close()
}, 2000)
}).catch((e) => {
console.log(e)
loading.close()
this.$message.error('导出失败,或未查询到隐患')
})
}).catch(() => {
this.listLoading = false
})
} }
} }
} }

View File

@ -91,7 +91,7 @@
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import waves from '@/directive/waves' import waves from '@/directive/waves'
import formatDate from '../../../../utils/dateformat' import formatDate from '../../../../utils/dateformat'
import { requestFN } from '../../../../utils/request' import { requestFN } from '@/utils/request'
export default { export default {
components: { Pagination }, components: { Pagination },

View File

@ -19,6 +19,20 @@
<el-input v-model="searchForm.KEYWORDS" placeholder="请输入关键字"/> <el-input v-model="searchForm.KEYWORDS" placeholder="请输入关键字"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5">
<el-form-item label="考评时间" prop="incidentDates">
<el-date-picker
v-model="searchForm.incidentDates"
:default-time="['00:00:00', '23:59:59']"
value-format="yyyy-MM-dd HH:mm:ss"
format="yyyy-MM-dd"
style="width: 100%"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期" />
</el-form-item>
</el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label-width="10px"> <el-form-item label-width="10px">
<el-button v-waves type="primary" icon="el-icon-search" @click="getList"> <el-button v-waves type="primary" icon="el-icon-search" @click="getList">
@ -101,6 +115,9 @@ export default {
searchForm: { searchForm: {
KEYWORDS: '', KEYWORDS: '',
TYPE: '', TYPE: '',
incidentDates: [],
START_TIME: '',
END_TIME: '',
DEPARTMENT_ID: null DEPARTMENT_ID: null
} }
} }
@ -129,6 +146,11 @@ export default {
// //
getList() { getList() {
this.listLoading = true this.listLoading = true
const dates = this.searchForm.incidentDates
if (dates != null && dates.length === 2) {
this.searchForm.START_TIME = dates[0]
this.searchForm.END_TIME = dates[1]
}
requestFN( requestFN(
'/keyProject/evaluationscore/list?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page, '/keyProject/evaluationscore/list?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
{ {

View File

@ -50,6 +50,9 @@
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset"> <el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
重置 重置
</el-button> </el-button>
<el-button v-waves class="filter-item" type="danger" icon="el-icon-delete" @click="handleBatchDel">
删除
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -67,6 +70,7 @@
border border
fit fit
highlight-current-row highlight-current-row
@selection-change="handleSelectionChange"
> >
<el-table-column <el-table-column
:reserve-selection="true" :reserve-selection="true"
@ -141,6 +145,8 @@ export default {
ISCHECK: '', ISCHECK: '',
ISPUNISH: '', ISPUNISH: '',
varList: [], varList: [],
/** 当前选中行 */
multipleSelection: [],
stateList: [ stateList: [
// { ID: '0', NAME: '' }, // { ID: '0', NAME: '' },
// { ID: '1', NAME: '' }, // { ID: '1', NAME: '' },
@ -226,6 +232,49 @@ export default {
goDetail(ID) { goDetail(ID) {
this.$parent.HIDDEN_ID = ID this.$parent.HIDDEN_ID = ID
this.$parent.activeName = 'Info' this.$parent.activeName = 'Info'
},
/**
* 批量删除
*/
handleBatchDel() {
//
const selectedRows = this.multipleSelection
//
if (this.multipleSelection === '' || selectedRows.length === 0) {
this.$message.warning('请选择要删除的行')
return
}
//
this.$confirm('确定要删除这些记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// ID
let ids = ''
selectedRows.forEach(row => { ids += row.HIDDEN_ID + ',' })
//
const url = '/keyprojectcheck/delete/hidden/all'
requestFN(url, { DATA_IDS: ids }).then((response) => {
//
this.$message.success('删除成功')
this.getList()
// eslint-disable-next-line handle-callback-err
}).catch(() => {
this.$message.error('删除失败')
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
/**
* 表格行选择器处理
*/
handleSelectionChange(val) {
this.multipleSelection = val
} }
} }
} }

View File

@ -9,18 +9,28 @@
<!-- <el-input v-model="KEYWORDS" placeholder="搜索关键字" />--> <!-- <el-input v-model="KEYWORDS" placeholder="搜索关键字" />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="5"> <el-col :span="4">
<el-form-item label="重点工程名称"> <el-form-item label="重点工程名称">
<el-input v-model="KEYWORDS" placeholder="搜索重点工程名称" /> <el-input v-model="KEYWORDS" placeholder="搜索重点工程名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="4">
<el-form-item label="状态" label-width="50px"> <el-form-item label="状态" label-width="50px">
<el-select ref="SELECT_STATE" v-model="STATE" style="width: 100%;"> <el-select ref="SELECT_STATE" v-model="STATE" style="width: 100%;">
<el-option v-for="item in stateList" :key="item.ID" :label="item.NAME" :value="item.ID" /> <el-option v-for="item in stateList" :key="item.ID" :label="item.NAME" :value="item.ID" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4">
<el-form-item label="负责人姓名">
<el-input v-model="UNITS_PIC_NAME" placeholder="搜索负责人姓名" />
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label="负责人手机号">
<el-input v-model="UNITS_PHONE" placeholder="搜索负责人手机号" />
</el-form-item>
</el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label-width="10px"> <el-form-item label-width="10px">
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery"> <el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
@ -93,6 +103,8 @@ export default {
}, },
STATE: '', STATE: '',
total: 0, total: 0,
UNITS_PIC_NAME: '',
UNITS_PHONE: '',
KEYWORDS: '', KEYWORDS: '',
OUTSOURCED_NAME: '', OUTSOURCED_NAME: '',
stateList: [ stateList: [
@ -134,6 +146,8 @@ export default {
'/outsourced/list?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page, '/outsourced/list?showCount=' + this.listQuery.limit + '&currentPage=' + this.listQuery.page,
{ {
KEYWORDS: this.KEYWORDS, KEYWORDS: this.KEYWORDS,
UNITS_PIC_NAME: this.UNITS_PIC_NAME,
UNITS_PHONE: this.UNITS_PHONE,
CORPINFO_ID: this.$parent.CORPINFO_ID, CORPINFO_ID: this.$parent.CORPINFO_ID,
STATE: this.STATE STATE: this.STATE
} }

View File

@ -220,10 +220,11 @@ export default {
} }
}, },
created() { created() {
// this.ROLE_ID console.log(this.$data)
this.getList() this.getList()
this.getDict() this.getDict()
this.getTreeList() this.getTreeList()
// this.ROLE_ID
}, },
methods: { methods: {
onChange(value) { onChange(value) {

View File

@ -73,14 +73,19 @@
<el-input v-model="search.INSPECTION_CASE" placeholder="检查情况" /> <el-input v-model="search.INSPECTION_CASE" placeholder="检查情况" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="4"> </el-row>
<el-form-item label-width="10px"> <el-row>
<el-col>
<el-form-item label-width="20px">
<el-button v-waves type="primary" icon="el-icon-search" @click="getQuery"> <el-button v-waves type="primary" icon="el-icon-search" @click="getQuery">
搜索 搜索
</el-button> </el-button>
<el-button v-waves type="success" icon="el-icon-refresh" @click="goKeyReset"> <el-button v-waves type="success" icon="el-icon-refresh" @click="goKeyReset">
重置 重置
</el-button> </el-button>
<el-button v-waves class="filter-item" type="info" icon="el-icon-download" @click="exportExcel">
导出
</el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -230,6 +235,7 @@ import waves from '@/directive/waves' // waves directive
import WriteSign from '@/components/WriteSign' import WriteSign from '@/components/WriteSign'
import safetyFlowChart from '../../../hiddenUtil/safetyFlowChart' import safetyFlowChart from '../../../hiddenUtil/safetyFlowChart'
import SelectTree from '@/components/SelectTree' import SelectTree from '@/components/SelectTree'
import axios from 'axios'
export default { export default {
components: { Pagination, WriteSign, safetyFlowChart, SelectTree }, components: { Pagination, WriteSign, safetyFlowChart, SelectTree },
directives: { waves }, directives: { waves },
@ -258,7 +264,7 @@ export default {
INSPECTION_TIME: ['', ''], // INSPECTION_TIME: ['', ''], //
INSPECTION_STATUS: '', // INSPECTION_STATUS: '', //
INSPECTION_SUBJECT: '', // INSPECTION_SUBJECT: '', //
INSPECTION_CASE:'' // INSPECTION_CASE: '' //
}, },
statusList: [ statusList: [
{ ID: '', NAME: '请选择' }, { ID: '', NAME: '请选择' },
@ -557,6 +563,73 @@ export default {
INSPECTION_ORIGINATOR_SIGN_IMG: '' // INSPECTION_ORIGINATOR_SIGN_IMG: '' //
// INSPECTION_ORIGINATOR_SIGN_TIME: '', // // INSPECTION_ORIGINATOR_SIGN_TIME: '', //
} }
},
exportExcel() {
this.$confirm('确定要下载检查记录吗?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const loading = this.$loading({
lock: true,
text: '加载中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
const object = {
...this.search,
INSPECTION_TIME_START: this.search.INSPECTION_TIME[0],
INSPECTION_TIME_END: this.search.INSPECTION_TIME[1]
}
const formData = new FormData()
Object.keys({
...this.search,
INSPECTION_TIME_START: this.search.INSPECTION_TIME[0],
INSPECTION_TIME_END: this.search.INSPECTION_TIME[1]
}).forEach(key => {
const value = object[key]
if (Array.isArray(value)) {
value.forEach((subValue, i) => {
formData.append(key + `[${i}]`, subValue)
})
} else {
formData.append(key, object[key])
}
})
console.log(formData)
axios({
url: config.httpurl + 'safetyenvironmental/export/excel',
method: 'post',
headers: { 'content-type': 'application/x-www-form-urlencoded' },
responseType: 'blob',
data: formData
}).then(res => {
console.log('+++++++++++++++++++++++++++++')
const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' })
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)
downloadElement.style.display = 'none'
downloadElement.href = href
downloadElement.download = '检查记录'
// DOM
document.body.appendChild(downloadElement)
downloadElement.click()
document.body.removeChild(downloadElement)
window.URL.revokeObjectURL(href)
loading.close()
}).catch((e) => {
console.error(e)
loading.close()
if (e.response && e.response.status === 404) {
this.$message.error('未查询到数据')
} else {
this.$message.error('导出失败,请稍后再试')
}
})
}).catch(() => {
this.$message.warning('取消导出')
})
} }
} }
} }