11111
parent
5c7df2fe8d
commit
ab28e7148d
|
@ -20,6 +20,9 @@
|
|||
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
|
||||
重置
|
||||
</el-button>
|
||||
<el-button v-waves class="filter-item" type="info" icon="el-icon-download" @click="exportExcel">
|
||||
导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -34,9 +37,10 @@
|
|||
'color': '#000'
|
||||
}"
|
||||
tooltip-effect="dark"
|
||||
highlight-current-row
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||
<el-table-column prop="CORP_NAME" label="公司名称" show-overflow-tooltip />
|
||||
|
@ -89,7 +93,9 @@
|
|||
<script>
|
||||
import Pagination from '@/components/Pagination' // 通过 el-pagination二次打包
|
||||
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 {
|
||||
name: 'IndexVue',
|
||||
components: { Pagination },
|
||||
|
@ -115,7 +121,8 @@ export default {
|
|||
total: 0,
|
||||
OUTSOURCED_NAME: '',
|
||||
CORP_NAME: '',
|
||||
varList: []
|
||||
varList: [],
|
||||
row: null
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -155,6 +162,55 @@ export default {
|
|||
goDetail(ID) {
|
||||
this.$parent.CORPINFO_ID = ID
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
import Pagination from '@/components/Pagination'
|
||||
import waves from '@/directive/waves'
|
||||
import formatDate from '../../../../utils/dateformat'
|
||||
import { requestFN } from '../../../../utils/request'
|
||||
import { requestFN } from '@/utils/request'
|
||||
|
||||
export default {
|
||||
components: { Pagination },
|
||||
|
|
|
@ -19,6 +19,20 @@
|
|||
<el-input v-model="searchForm.KEYWORDS" placeholder="请输入关键字"/>
|
||||
</el-form-item>
|
||||
</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-form-item label-width="10px">
|
||||
<el-button v-waves type="primary" icon="el-icon-search" @click="getList">
|
||||
|
@ -101,6 +115,9 @@ export default {
|
|||
searchForm: {
|
||||
KEYWORDS: '',
|
||||
TYPE: '',
|
||||
incidentDates: [],
|
||||
START_TIME: '',
|
||||
END_TIME: '',
|
||||
DEPARTMENT_ID: null
|
||||
}
|
||||
}
|
||||
|
@ -129,6 +146,11 @@ export default {
|
|||
// 获取列表
|
||||
getList() {
|
||||
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(
|
||||
'/keyProject/evaluationscore/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page,
|
||||
{
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
<el-button v-waves class="filter-item" type="success" icon="el-icon-refresh" @click="goKeyReset">
|
||||
重置
|
||||
</el-button>
|
||||
<el-button v-waves class="filter-item" type="danger" icon="el-icon-delete" @click="handleBatchDel">
|
||||
删除
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -67,6 +70,7 @@
|
|||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column
|
||||
:reserve-selection="true"
|
||||
|
@ -141,6 +145,8 @@ export default {
|
|||
ISCHECK: '',
|
||||
ISPUNISH: '',
|
||||
varList: [],
|
||||
/** 当前选中行 */
|
||||
multipleSelection: [],
|
||||
stateList: [
|
||||
// { ID: '0', NAME: '未申请' },
|
||||
// { ID: '1', NAME: '申请中' },
|
||||
|
@ -226,6 +232,49 @@ export default {
|
|||
goDetail(ID) {
|
||||
this.$parent.HIDDEN_ID = ID
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,18 +9,28 @@
|
|||
<!-- <el-input v-model="KEYWORDS" placeholder="搜索关键字" />-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="5">
|
||||
<el-col :span="4">
|
||||
<el-form-item label="重点工程名称">
|
||||
<el-input v-model="KEYWORDS" placeholder="搜索重点工程名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="5">
|
||||
<el-col :span="4">
|
||||
<el-form-item label="状态" label-width="50px">
|
||||
<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-select>
|
||||
</el-form-item>
|
||||
</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-form-item label-width="10px">
|
||||
<el-button v-waves class="filter-item" type="primary" icon="el-icon-search" @click="getQuery">
|
||||
|
@ -93,6 +103,8 @@ export default {
|
|||
},
|
||||
STATE: '',
|
||||
total: 0,
|
||||
UNITS_PIC_NAME: '',
|
||||
UNITS_PHONE: '',
|
||||
KEYWORDS: '',
|
||||
OUTSOURCED_NAME: '',
|
||||
stateList: [
|
||||
|
@ -134,6 +146,8 @@ export default {
|
|||
'/outsourced/list?showCount=' + this.listQuery.limit + '¤tPage=' + this.listQuery.page,
|
||||
{
|
||||
KEYWORDS: this.KEYWORDS,
|
||||
UNITS_PIC_NAME: this.UNITS_PIC_NAME,
|
||||
UNITS_PHONE: this.UNITS_PHONE,
|
||||
CORPINFO_ID: this.$parent.CORPINFO_ID,
|
||||
STATE: this.STATE
|
||||
}
|
||||
|
|
|
@ -220,10 +220,11 @@ export default {
|
|||
}
|
||||
},
|
||||
created() {
|
||||
// this.ROLE_ID
|
||||
console.log(this.$data)
|
||||
this.getList()
|
||||
this.getDict()
|
||||
this.getTreeList()
|
||||
// this.ROLE_ID
|
||||
},
|
||||
methods: {
|
||||
onChange(value) {
|
||||
|
|
|
@ -73,14 +73,19 @@
|
|||
<el-input v-model="search.INSPECTION_CASE" placeholder="检查情况" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-form-item label-width="10px">
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label-width="20px">
|
||||
<el-button v-waves type="primary" icon="el-icon-search" @click="getQuery">
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button v-waves type="success" icon="el-icon-refresh" @click="goKeyReset">
|
||||
重置
|
||||
</el-button>
|
||||
<el-button v-waves class="filter-item" type="info" icon="el-icon-download" @click="exportExcel">
|
||||
导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -230,6 +235,7 @@ import waves from '@/directive/waves' // waves directive
|
|||
import WriteSign from '@/components/WriteSign'
|
||||
import safetyFlowChart from '../../../hiddenUtil/safetyFlowChart'
|
||||
import SelectTree from '@/components/SelectTree'
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
components: { Pagination, WriteSign, safetyFlowChart, SelectTree },
|
||||
directives: { waves },
|
||||
|
@ -557,6 +563,73 @@ export default {
|
|||
INSPECTION_ORIGINATOR_SIGN_IMG: '' // 被检查单位现场负责人签字
|
||||
// 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('取消导出')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue