You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
329 lines
12 KiB
329 lines
12 KiB
5 years ago
|
<template>
|
||
|
<div class="statistics-container">
|
||
5 years ago
|
<div class="filter-table-view">
|
||
4 years ago
|
<el-form ref="filterForm" :inline="true">
|
||
5 years ago
|
<el-form-item label="提交时间" prop="endDateTime">
|
||
|
<el-date-picker
|
||
|
v-model="queryConditions.beginDateTime"
|
||
4 years ago
|
placeholder="开始时间"
|
||
5 years ago
|
type="datetime"
|
||
5 years ago
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||
4 years ago
|
/>
|
||
5 years ago
|
<span> 至 </span>
|
||
|
<el-date-picker
|
||
|
v-model="queryConditions.endDateTime"
|
||
5 years ago
|
:default-time="'23:59:59'"
|
||
4 years ago
|
placeholder="结束时间"
|
||
4 years ago
|
type="datetime"
|
||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||
4 years ago
|
/>
|
||
5 years ago
|
</el-form-item>
|
||
|
<el-form-item>
|
||
5 years ago
|
<el-button type="primary" @click="queryProjectResult">查询</el-button>
|
||
5 years ago
|
<el-button type="success" @click="exportProjectResult">导出</el-button>
|
||
5 years ago
|
</el-form-item>
|
||
|
</el-form>
|
||
|
</div>
|
||
|
<div class="result-table-view">
|
||
5 years ago
|
<el-table
|
||
4 years ago
|
:data="projectResultList"
|
||
4 years ago
|
header-cell-class-name="data-table-header"
|
||
|
stripe
|
||
5 years ago
|
@row-dblclick="(row, column, event)=>{
|
||
|
this.openDetailDrawerHandle(row)
|
||
|
}"
|
||
4 years ago
|
>
|
||
5 years ago
|
<el-table-column
|
||
|
type="selection"
|
||
4 years ago
|
width="55"
|
||
|
/>
|
||
5 years ago
|
<el-table-column
|
||
|
v-for="col in fixedCustomColumns" :key="`t${col}`"
|
||
4 years ago
|
:label="fixedDefaultLabelFormColumn[col]"
|
||
|
>
|
||
5 years ago
|
<template slot-scope="scope">
|
||
|
{{ scope.row[col] }}
|
||
|
</template>
|
||
5 years ago
|
</el-table-column>
|
||
5 years ago
|
<el-table-column
|
||
4 years ago
|
v-for="col in otherCustomColumns"
|
||
4 years ago
|
:key="col" :label="projectItemColumns[col]"
|
||
|
show-overflow-tooltip
|
||
4 years ago
|
>
|
||
5 years ago
|
<template slot-scope="scope">
|
||
|
{{ scope.row['processData'][col] }}
|
||
|
</template>
|
||
5 years ago
|
</el-table-column>
|
||
|
<el-table-column
|
||
4 years ago
|
:render-header="renderHeader"
|
||
4 years ago
|
fixed="right"
|
||
|
width="50"
|
||
4 years ago
|
>
|
||
5 years ago
|
<template slot-scope="scope">
|
||
4 years ago
|
<el-button size="small" type="text" @click="openDetailDrawerHandle(scope.row)">查看</el-button>
|
||
5 years ago
|
</template>
|
||
5 years ago
|
</el-table-column>
|
||
|
</el-table>
|
||
5 years ago
|
<el-drawer
|
||
4 years ago
|
:visible.sync="detailDrawer"
|
||
4 years ago
|
:with-header="false"
|
||
4 years ago
|
>
|
||
|
<el-scrollbar style="height: 100%;">
|
||
4 years ago
|
<el-card class="detail-container">
|
||
5 years ago
|
<div slot="header" class="clearfix">
|
||
|
<span>提交详情</span>
|
||
|
</div>
|
||
|
<div>
|
||
4 years ago
|
<div v-for="item in projectItemList" :key="item.id">
|
||
5 years ago
|
<h4>{{ item.label }}</h4>
|
||
4 years ago
|
<!-- 如果是文件输入-->
|
||
4 years ago
|
<div
|
||
|
v-if="item.type==17 &&activeResultRow&&activeResultRow['processData'][`field${item.formItemId}`]"
|
||
|
>
|
||
4 years ago
|
<el-link
|
||
4 years ago
|
v-for="file in JSON.parse(activeResultRow['processData'][`field${item.formItemId}`]['files'])"
|
||
|
:key="file"
|
||
|
:href="file.url" target="_blank"
|
||
4 years ago
|
type="primary"
|
||
|
>
|
||
4 years ago
|
<span> {{ file.fileName }}</span>
|
||
4 years ago
|
</el-link>
|
||
|
</div>
|
||
4 years ago
|
<el-tag v-else>
|
||
|
{{
|
||
5 years ago
|
activeResultRow ?
|
||
|
activeResultRow['processData'][`field${item.formItemId}`] : ''
|
||
|
}}
|
||
|
</el-tag>
|
||
5 years ago
|
</div>
|
||
|
</div>
|
||
|
</el-card>
|
||
|
</el-scrollbar>
|
||
|
</el-drawer>
|
||
4 years ago
|
<div style="display: flex; justify-content: center; margin-top: 10px;">
|
||
5 years ago
|
<el-pagination
|
||
|
v-if="total>10"
|
||
|
:current-page.sync="queryConditions.current"
|
||
4 years ago
|
:page-size.sync="queryConditions.size"
|
||
5 years ago
|
:total="total"
|
||
4 years ago
|
background
|
||
|
layout="total, prev, pager, next"
|
||
5 years ago
|
@current-change="queryProjectResult"
|
||
|
/>
|
||
|
</div>
|
||
5 years ago
|
</div>
|
||
5 years ago
|
<div class="custom-col-container">
|
||
4 years ago
|
<el-dialog :visible.sync="customColumnDialogVisible" center title="自定义显示列">
|
||
5 years ago
|
<el-row>
|
||
|
<el-col :span="3">
|
||
|
<span>显示列:</span>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
4 years ago
|
<el-divider />
|
||
5 years ago
|
<el-checkbox-group v-model="checkFixedCustomColumns">
|
||
|
<el-row>
|
||
4 years ago
|
<el-col v-for="(val, key) in fixedDefaultLabelFormColumn" :key="key" :span="4">
|
||
5 years ago
|
<el-checkbox :label="key">{{ val }}</el-checkbox>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
</el-checkbox-group>
|
||
4 years ago
|
<el-divider />
|
||
5 years ago
|
<el-checkbox-group v-model="checkOtherCustomColumns">
|
||
|
<el-row>
|
||
4 years ago
|
<el-col v-for="(val, key) in projectItemColumns" :key="key" :span="8">
|
||
5 years ago
|
<el-checkbox :label="key">{{ val }}</el-checkbox>
|
||
|
</el-col>
|
||
|
</el-row>
|
||
|
</el-checkbox-group>
|
||
|
<span slot="footer" class="dialog-footer">
|
||
|
<el-button @click="customColumnDialogVisible = false">取 消</el-button>
|
||
|
<el-button type="primary" @click="saveStatisticsCheckedColumns">确 定</el-button>
|
||
4 years ago
|
</span>
|
||
5 years ago
|
</el-dialog>
|
||
|
</div>
|
||
5 years ago
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
5 years ago
|
import _ from 'lodash'
|
||
5 years ago
|
|
||
5 years ago
|
import {getCheckedColumn, saveCheckedColumn} from '@/utils/db'
|
||
|
|
||
|
const fixedDefaultFormColumn = ['serialNumber', 'submitAddress', 'createTime']
|
||
|
const fixedDefaultLabelFormColumn = {serialNumber: '提交序号', submitAddress: '提交地址', createTime: '提交时间'}
|
||
5 years ago
|
|
||
|
export default {
|
||
4 years ago
|
name: 'ProjectStatistics',
|
||
5 years ago
|
components: {},
|
||
|
data() {
|
||
|
return {
|
||
4 years ago
|
projectKey: null,
|
||
5 years ago
|
customColumnDialogVisible: false,
|
||
4 years ago
|
// 固定自定义列 如序号等
|
||
5 years ago
|
fixedCustomColumns: fixedDefaultFormColumn,
|
||
4 years ago
|
// 选中的
|
||
5 years ago
|
checkFixedCustomColumns: fixedDefaultFormColumn,
|
||
|
fixedDefaultLabelFormColumn: fixedDefaultLabelFormColumn,
|
||
4 years ago
|
// 自定义表单属性
|
||
5 years ago
|
checkOtherCustomColumns: [],
|
||
|
otherCustomColumns: [],
|
||
|
projectResultList: [],
|
||
|
projectItemList: [],
|
||
5 years ago
|
projectData: null,
|
||
5 years ago
|
projectItemColumns: {},
|
||
5 years ago
|
total: 0,
|
||
5 years ago
|
detailDrawer: false,
|
||
4 years ago
|
activeResultRow: null,
|
||
4 years ago
|
// 查询条件
|
||
5 years ago
|
queryConditions: {
|
||
5 years ago
|
current: 1,
|
||
|
size: 10,
|
||
5 years ago
|
projectKey: '',
|
||
|
beginDateTime: '',
|
||
|
endDateTime: ''
|
||
5 years ago
|
}
|
||
|
}
|
||
4 years ago
|
},
|
||
|
mounted() {
|
||
4 years ago
|
this.projectKey = this.$route.query.key
|
||
4 years ago
|
this.queryConditions.projectKey = this.projectKey
|
||
|
this.queryProjectResult()
|
||
|
this.queryProjectItems()
|
||
|
this.queryProject()
|
||
5 years ago
|
}, methods: {
|
||
4 years ago
|
renderHeader() {
|
||
5 years ago
|
return (
|
||
5 years ago
|
<i class="el-icon-setting" style="color:currentColor"
|
||
4 years ago
|
onClick={() => this.customColumnDialogVisible = true}></i>
|
||
5 years ago
|
)
|
||
|
},
|
||
4 years ago
|
|
||
5 years ago
|
openDetailDrawerHandle(row) {
|
||
|
this.activeResultRow = row
|
||
5 years ago
|
this.detailDrawer = true
|
||
|
},
|
||
|
queryProject() {
|
||
|
this.$api.get(`/user/project/${this.projectKey}`).then(res => {
|
||
|
this.projectData = res.data
|
||
|
})
|
||
5 years ago
|
},
|
||
5 years ago
|
queryProjectResult() {
|
||
4 years ago
|
this.$api.get('/user/project/result/page', {params: this.queryConditions}).then(res => {
|
||
5 years ago
|
let {records, total, size} = res.data
|
||
|
this.projectResultList = records
|
||
|
this.total = total
|
||
|
this.queryConditions.size = size
|
||
5 years ago
|
})
|
||
5 years ago
|
},
|
||
|
saveStatisticsCheckedColumns() {
|
||
|
this.customColumnDialogVisible = false
|
||
|
this.fixedCustomColumns = this.checkFixedCustomColumns
|
||
|
this.otherCustomColumns = this.checkOtherCustomColumns
|
||
|
saveCheckedColumn(this.projectKey, {
|
||
|
fixedCustomColumns: this.fixedCustomColumns,
|
||
|
otherCustomColumns: this.otherCustomColumns
|
||
|
})
|
||
|
},
|
||
|
getDbCheckedColumns() {
|
||
5 years ago
|
let checkedColumn = getCheckedColumn(this.projectKey)
|
||
|
if (!checkedColumn) {
|
||
|
return
|
||
|
}
|
||
|
let {fixedCustomColumns, otherCustomColumns} = checkedColumn
|
||
5 years ago
|
if (fixedCustomColumns) {
|
||
|
this.fixedCustomColumns = fixedCustomColumns
|
||
|
this.checkFixedCustomColumns = fixedCustomColumns
|
||
|
}
|
||
|
if (otherCustomColumns) {
|
||
|
this.otherCustomColumns = otherCustomColumns
|
||
|
this.checkOtherCustomColumns = otherCustomColumns
|
||
|
}
|
||
|
},
|
||
5 years ago
|
exportProjectResult() {
|
||
4 years ago
|
if (!this.total) {
|
||
|
this.$message.error('无表单有效反馈结果,无法导出')
|
||
4 years ago
|
return
|
||
|
}
|
||
5 years ago
|
this.$api.get('user/project/result/export', {
|
||
|
params: this.queryConditions,
|
||
|
responseType: 'blob'
|
||
|
}).then(res => {
|
||
|
let blob = res
|
||
|
let downloadElement = document.createElement('a')
|
||
4 years ago
|
let href = window.URL.createObjectURL(blob) // 创建下载的链接
|
||
5 years ago
|
downloadElement.href = href
|
||
4 years ago
|
downloadElement.download = this.projectData.name + this.$dayjs().format('YYYYMMDDHHMM') + '.xls' // 下载后文件名
|
||
5 years ago
|
document.body.appendChild(downloadElement)
|
||
4 years ago
|
downloadElement.click() // 点击下载
|
||
|
document.body.removeChild(downloadElement) // 下载完成移除元素
|
||
|
window.URL.revokeObjectURL(href) // 释放掉blob对象
|
||
5 years ago
|
})
|
||
|
},
|
||
5 years ago
|
queryProjectItems() {
|
||
4 years ago
|
this.$api.get('/user/project/item/list', {params: {key: this.projectKey}}).then(res => {
|
||
5 years ago
|
if (res.data) {
|
||
4 years ago
|
res.data.map(item => {
|
||
5 years ago
|
_.set(this.projectItemColumns, `field${item.formItemId}`, item.label)
|
||
|
})
|
||
|
}
|
||
|
this.projectItemList = res.data
|
||
|
this.getDbCheckedColumns()
|
||
|
})
|
||
5 years ago
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
</script>
|
||
|
|
||
5 years ago
|
<style scoped>
|
||
5 years ago
|
.statistics-container {
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
4 years ago
|
padding-top: 30px;
|
||
5 years ago
|
min-height: 85vh;
|
||
4 years ago
|
background-color: #f7f7f7;
|
||
5 years ago
|
}
|
||
5 years ago
|
.custom-col-container >>> .el-checkbox__label {
|
||
|
width: 200px;
|
||
|
min-height: 25px;
|
||
|
line-height: 25px;
|
||
|
vertical-align: middle;
|
||
|
overflow: hidden;
|
||
|
white-space: nowrap;
|
||
|
text-overflow: ellipsis;
|
||
|
}
|
||
5 years ago
|
.result-table-view {
|
||
|
width: 80%;
|
||
5 years ago
|
margin: 6px auto;
|
||
5 years ago
|
}
|
||
4 years ago
|
.detail-container {
|
||
|
padding: 10px;
|
||
|
}
|
||
5 years ago
|
.filter-table-view {
|
||
|
width: 80%;
|
||
4 years ago
|
margin: 0 auto;
|
||
5 years ago
|
}
|
||
4 years ago
|
::v-deep .el-icon-setting {
|
||
5 years ago
|
font-size: 24px;
|
||
|
line-height: 25px;
|
||
|
color: white;
|
||
|
}
|
||
4 years ago
|
::v-deep .data-table-header .cell {
|
||
5 years ago
|
text-overflow: ellipsis !important;
|
||
|
white-space: nowrap !important;
|
||
|
}
|
||
5 years ago
|
|
||
4 years ago
|
/* 1.显示滚动条:当内容超出容器的时候,可以拖动: */
|
||
4 years ago
|
::v-deep .el-drawer__body {
|
||
5 years ago
|
overflow: auto;
|
||
4 years ago
|
|
||
5 years ago
|
/* overflow-x: auto; */
|
||
|
}
|
||
|
|
||
4 years ago
|
/* 2.隐藏滚动条,太丑了 */
|
||
4 years ago
|
::v-deep .el-drawer__container ::-webkit-scrollbar {
|
||
5 years ago
|
display: none;
|
||
|
}
|
||
|
|
||
5 years ago
|
</style>
|