<template>
|
<a-card :bordered="false" class="device_list">
|
<!-- 查询区域 -->
|
<div style="width: 100%; background-color: #fff" class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<!--<a-col :md="6" :sm="6">-->
|
<!--<a-form-item label="名称">-->
|
<!--<a-input placeholder="输入名称查询" :readOnly="readOnly" v-model="queryParams.equipmentName"></a-input>-->
|
<!--</a-form-item>-->
|
<!--</a-col>-->
|
<a-col :md="6" :sm="6">
|
<a-form-item label="时间">
|
<a-range-picker @change="dateParamChange" :disabledDate="disabledDate" format="YYYY-MM-DD" v-model="dates"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="2" :sm="3" :xs="3">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
</a-col>
|
<a-col :md="2" :sm="2" :xs="2">
|
<a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
|
</a-col>
|
<a-col :md="5" :sm="5" :xs="5" v-if="this.rightcolval == 1">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :lg="3" :md="3" :sm="3" :xs="3">
|
<a-button type="primary" icon="download" @click="handleExportXls('利用率统计详情')">导出详情</a-button>
|
</a-col>
|
</a-row>
|
</a-form>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
|
<!--table区域-->
|
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
|
<i class="anticon anticon-info-circle ant-alert-icon">
|
</i> 已选择 <a><b>{{ selectedRowKeys1.length }}</b></a>项
|
<a style="margin-left: 24px" @click="onClearSelected1">清空</a>
|
</div>
|
<div class="Statistics_table">
|
<div class="Statistics_tableOne">
|
<div id="DeviceList">
|
<a-table ref="table" bordered size="middle" rowKey="index" :columns="columns"
|
:scroll="{y:50}" :dataSource="dataSource" :loading="loading" :pagination="false"
|
:rowSelection="{selectedRowKeys: selectedRowKeys1, onChange: onSelectChange1, type:'radio'}"
|
@change="handleTableChange">
|
</a-table>
|
</div>
|
</div>
|
<a-tabs :activeKey="activeKey">
|
<a-tab-pane key="1" tab="展示详情" force-render>
|
</a-tab-pane>
|
</a-tabs>
|
<div v-if="this.rightcolval == 1">
|
|
<div class="Statistics_tableTwo">
|
<a-card :bordered="false">
|
<div id="checkTypeList">
|
<!--<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;text-align: center">-->
|
<!--<span style="font-weight: bolder;font-size: 2vh;">↓↓↓↓↓↓↓↓详情展示↓↓↓↓↓↓↓↓↓</span>-->
|
<!--</div>-->
|
<a-table ref="table" size="middle" bordered rowKey="id" :columns="columns2"
|
:dataSource="dataSource2" :pagination="ipagination2" :loading="loading2"
|
@change="handleTableChange2">
|
<span slot="action" slot-scope="text, record">
|
<a v-show="record.checkType == 2" ref="checkType" @click="handleOpen(record.id,record.checkType)">不考核</a>
|
<a-popconfirm title="确认不考核吗?" @confirm="() => handleOpen(record.id,record.checkType)">
|
<a v-show="record.checkType == 1">考核</a>
|
</a-popconfirm>
|
</span>
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
</a-card>
|
</div>
|
|
|
</div>
|
|
|
</div>
|
</a-card>
|
</template>
|
|
<script>
|
import moment from 'moment'
|
import $ from 'jquery'
|
import { filterObj } from '@/utils/util'
|
import JDictSelectTag from '@/components/dict/JDictSelectTag'
|
import JDate from '../../../../../components/jeecg/JDate'
|
import {
|
requestPut,
|
deleteAction,
|
getAction,
|
postAction,
|
putAction,
|
downFile,
|
downFileExcl
|
} from '@/api/manage'
|
import '@/components/table2excel/table2excel'
|
// import {
|
// JeecgListMixin
|
// } from '@/mixins/JeecgListMixin'
|
import JInput from '@/components/jeecg/JInput'
|
import JEllipsis from '@/components/jeecg/JEllipsis'
|
import Tooltip from 'ant-design-vue/es/tooltip'
|
import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api'
|
export default {
|
name: 'UtilizationStatisticsList',
|
// mixins: [JeecgListMixin],
|
components: {
|
Tooltip,
|
JDictSelectTag,
|
JInput,
|
JDate,
|
JEllipsis
|
},
|
props: { nodeTree: '', Type:'',nodePeople: '' },
|
data() {
|
return {
|
activeKey: '1',
|
model1: {},
|
model2: {},
|
currentRoleId: '',
|
queryParam1: {},
|
queryParam2: {},
|
queryParamEquip:{},
|
queryParamPeople:{},
|
dataSource1: [],
|
dataSource2: [],
|
ipagination2: {
|
current: 1,
|
pageSize: 10,
|
pageSizeOptions: ['10', '20', '30'],
|
showTotal: (total, range) => {
|
return range[0] + '-' + range[1] + ' 共' + total + '条'
|
},
|
showQuickJumper: true,
|
showSizeChanger: true,
|
total: 0
|
},
|
// isorter1: {
|
// column: 'createTime',
|
// order: 'desc'
|
// },
|
// isorter2: {
|
// column: 'createTime',
|
// order: 'desc'
|
// },
|
filters1: {},
|
filters2: {},
|
dataSource:[],
|
loading1: false,
|
loading2: false,
|
selectedRowKeys1: [],
|
selectedRowKeys2: [],
|
selectionRows1: [],
|
selectionRows2: [],
|
test:{},
|
loading:false,
|
rightcolval:0,
|
slectTime:{},
|
readOnly:true,
|
dates: [],
|
queryParam: {},
|
queryParams:{},
|
dataStartsoucre:[],
|
columns: [
|
{
|
title: '利用率',
|
align: 'center',
|
dataIndex: 'useRate'
|
},
|
{
|
title: '故障率',
|
align: 'center',
|
dataIndex: 'faultRate'
|
},
|
{
|
title: '闲置率',
|
align: 'center',
|
dataIndex: 'idleRate'
|
},
|
],
|
columns2: [
|
{
|
title: '时间',
|
align: 'center',
|
dataIndex: 'theDate'
|
},
|
{
|
title: '设备编号',
|
align: 'center',
|
dataIndex: 'equipmentId'
|
},
|
{
|
title: '设备名称',
|
align: 'center',
|
dataIndex: 'equipmentName',
|
// sorter:true
|
},
|
{
|
title: '利用率(%)',
|
align: 'center',
|
dataIndex: 'useRate'
|
},
|
{
|
title: '故障率(%)',
|
align: 'center',
|
dataIndex: 'faultRate'
|
},
|
{
|
title: '闲置率(%)',
|
align: 'center',
|
dataIndex: 'idleRate'
|
},
|
{
|
title: '班次',
|
align: 'center',
|
dataIndex: 'shiftSubName'
|
},
|
{
|
title: '状态',
|
align: 'center',
|
dataIndex: 'mdcTypeStateName'
|
},
|
{
|
title: '是否考核',
|
dataIndex: 'action',
|
scopedSlots: {customRender: 'action'},
|
align: "center",
|
}
|
],
|
url: {
|
list: '/mdc/mdcRate/rateEquipmentIds',
|
list2:'/mdc/mdcRate/selectEquipmentId',
|
getEquipmentByPid: '/mdc/mdcequipment/getEquipmentByPid',
|
editTypeState:'/mdc/mdcRate/editTypeState',
|
exportXlsUrl:'/mdc/mdcRate/exportXls'
|
}
|
}
|
},
|
watch:{
|
Type(valmath){
|
// console.log(valmath);
|
this.rightcolval = 0
|
this.dataSource = [];
|
this.selectedRowKeys1 = []
|
this.selectionRows1 = []
|
this.queryParams.typeTree = valmath
|
// this.rightcolval = 0
|
|
},
|
nodeTree(val) { //监听currSelected 变化,将变化后的数值传递给 getCurrSelected 事件
|
if (JSON.stringify(val) != '{}') {
|
if (val.entity.equipmentId) {
|
this.queryParamEquip.parentId = ""
|
this.queryParamEquip.equipmentIds = val.entity.equipmentId
|
} else {
|
this.queryParamEquip.parentId = val.entity.id
|
this.queryParamEquip.equipmentIds = ''
|
}
|
this.searchQuery()
|
}
|
},
|
nodePeople(val){
|
if (JSON.stringify(val) != '{}') {
|
if (val.entity.equipmentId) {
|
this.queryParamPeople.parentId =''
|
this.queryParamPeople.equipmentIds = val.entity.equipmentId
|
} else {
|
this.queryParamPeople.parentId = val.entity.id
|
this.queryParamPeople.equipmentIds = ''
|
}
|
this.searchQuery()
|
}
|
}
|
|
},
|
methods: {
|
disabledDate(current){
|
//Can not slect days before today and today
|
return current && current > moment().subtract('days', 1);
|
},
|
numFilter(value) {
|
if (value) {
|
return parseFloat((value * 100).toFixed(2))
|
} else {
|
return '0'
|
}
|
},
|
// disabledDate(current) {
|
// return current && current > moment().subtract(1, "days"); //当天之后的不可选,不包括当天
|
// },
|
searchQuery(){
|
if(this.queryParams.typeTree == "1"){
|
this.queryParams.parentId = this.queryParamEquip.parentId
|
this.queryParams.equipmentIds = this.queryParamEquip.equipmentIds
|
}else{
|
this.queryParams.parentId = this.queryParamPeople.parentId
|
this.queryParams.equipmentIds = this.queryParamPeople.equipmentIds
|
}
|
//获取查询条件
|
let sqp = {}
|
if(this.superQueryParams){
|
sqp['superQueryParams']=encodeURI(this.superQueryParams)
|
sqp['superQueryMatchType'] = this.superQueryMatchType
|
}
|
var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
|
// param.pageNo = this.ipagination.current;
|
// param.pageSize = this.ipagination.pageSize;
|
param.field = this.getQueryField();
|
// console.log(param)
|
postAction(this.url.list,param).then((res) => {
|
if(res.success){
|
if(res.result == null){
|
this.rightcolval = 0
|
this.dataSource = res.result;
|
this.onClearSelected1()
|
}else{
|
for (var i = 0; i < res.result.length;i++){
|
res.result[i].faultRate = this.numFilter(res.result[i].faultRate)
|
res.result[i].idleRate = this.numFilter(res.result[i].idleRate)
|
res.result[i].useRate = this.numFilter(res.result[i].useRate)
|
}
|
this.rightcolval = 0
|
this.dataSource = res.result;
|
this.onClearSelected1()
|
}
|
}else{
|
this.$message.warning(res.message)
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
searchReset() {
|
// this.dates = [];
|
// this.queryParams = {}
|
// this.loadData();
|
// this.rightcolval = 0
|
// this.onClearSelected1()
|
|
|
this.typeTree = this.queryParams.typeTree
|
this.typeParent = this.queryParams.parentId
|
// this.typeEquipment = this.queryParams.equipmentId
|
this.queryParams = {}
|
this.queryParam = {}
|
this.dates = []
|
this.rightcolval = 0
|
this.queryParams.typeTree = this.typeTree
|
this.queryParams.parentId = this.typeParent
|
// this.queryParams.equipmentId = this.typeEquipment
|
// this.ipagination.current = 1
|
this.loadData();
|
this.onClearSelected1()
|
},
|
getQueryParams() {
|
//获取查询条件
|
let sqp = {}
|
if(this.superQueryParams){
|
sqp['superQueryParams']=encodeURI(this.superQueryParams)
|
sqp['superQueryMatchType'] = this.superQueryMatchType
|
}
|
var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters);
|
param.field = this.getQueryField();
|
// param.pageNo = this.ipagination.current;
|
// param.pageSize = this.ipagination.pageSize;
|
param.parentId = this.queryParams.parentId
|
param.typeTree = this.queryParams.typeTree
|
//获取用户定制的参数属性
|
if (this.getCustomQueryParams) {
|
param = this.getCustomQueryParams(param);
|
if(!param){
|
return false;
|
}
|
}
|
|
return filterObj(param);
|
},
|
loadData() {
|
if(!this.url.list){
|
this.$message.error("请设置url.list属性!")
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
// if (arg === 1) {
|
// this.ipagination.current = 1;
|
// }
|
var params = this.getQueryParams();//查询条件
|
|
if(!params){
|
return false;
|
}
|
this.loading = true;
|
postAction(this.url.list, params).then((res) => {
|
if (res.success) {
|
if(res.result !==null){
|
for (var i = 0; i < res.result.length;i++){
|
res.result[i].faultRate = this.numFilter(res.result[i].faultRate)
|
res.result[i].idleRate = this.numFilter(res.result[i].idleRate)
|
res.result[i].useRate = this.numFilter(res.result[i].useRate)
|
}
|
this.dataSource = res.result;
|
}else{
|
this.dataSource = res.result;
|
}
|
}else{
|
this.$message.warning(res.message)
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
dateParamChange(v1, v2) {
|
console.log(v1,v2)
|
this.queryParams.startTime = v2[0]
|
this.queryParams.endTime = v2[1]
|
},
|
handleOpen: function (id,checkType) {
|
if(checkType == 1){
|
checkType = 2
|
}else if(checkType == 2){
|
checkType = 1
|
}
|
putAction(this.url.editTypeState+'?id='+id+'&checkType='+checkType).then((res) => {
|
if(res.success){
|
this.loadData2()
|
}else{
|
this.$message.warning(res.message)
|
}
|
}).finally(() => {
|
this.loading = false
|
})
|
},
|
pQuery(parentId) {
|
this.queryParam.parentId = parentId[0]
|
if(this.selectedRowKeys.length >= 1) {
|
this.selectedRowKeys.length = 0
|
}
|
this.loadData()
|
},
|
onClearSelected1() {
|
this.selectedRowKeys1 = []
|
this.selectionRows1 = []
|
this.rightcolval = 0
|
// console.log(this.rightcolval)
|
},
|
onSelectChange1(selectedRowKeys, selectionRows) {
|
this.rightcolval = 1
|
this.selectedRowKeys1 = selectedRowKeys
|
this.selectionRows1 = selectionRows
|
this.model1 = Object.assign({}, selectionRows[0])
|
// console.log(this.model1)
|
this.currentRoleId = selectedRowKeys[0]
|
this.loadData2()
|
},
|
// onSelectChange(selectedRowKeys) {
|
// this.selectedRowKeys = selectedRowKeys
|
// },
|
getQueryParams2() {
|
//获取查询条件
|
let sqp = {}
|
if (this.superQueryParams2) {
|
sqp['superQueryParams'] = encodeURI(this.superQueryParams2)
|
sqp['superQueryMatchType'] = this.superQueryMatchType2
|
}
|
var param = Object.assign(sqp, this.queryParam2, this.isorter2, this.filters2)
|
param.field = this.getQueryField2()
|
param.pageNo = this.ipagination2.current
|
param.pageSize = this.ipagination2.pageSize
|
return filterObj(param)
|
},
|
getQueryField2() {
|
//TODO 字段权限控制
|
var str = 'id,'
|
this.columns2.forEach(function(value) {
|
str += ',' + value.dataIndex
|
})
|
return str
|
},
|
loadData2(arg) {
|
if (!this.url.list2) {
|
this.$message.error('请设置url.list2属性!')
|
return
|
}
|
//加载数据 若传入参数1则加载第一页的内容
|
if (arg === 1) {
|
this.ipagination2.current = 1
|
}
|
if (this.currentRoleId === '') return
|
let params = this.getQueryParams2()//查询条件
|
// let params = {};
|
|
params.startTime = this.queryParams.startTime
|
params.endTime = this.queryParams.endTime
|
params.parentId = this.queryParams.parentId
|
params.typeTree = this.queryParams.typeTree
|
params.equipmentId = this.queryParams.equipmentIds
|
params.roleId = this.currentRoleId
|
params.orderByName = "ascend";
|
this.loading2 = true
|
// console.log(params)
|
postAction(this.url.list2, params).then((res) => {
|
if (res.success) {
|
if(res.result !==null){
|
for (var i = 0; i < res.result.length;i++){
|
res.result[i].faultRate = this.numFilter(res.result[i].faultRate)
|
res.result[i].idleRate = this.numFilter(res.result[i].idleRate)
|
res.result[i].useRate = this.numFilter(res.result[i].useRate)
|
}
|
// console.log(res.result)
|
this.dataSource2 = res.result;
|
}else{
|
this.dataSource2 = res.result;
|
}
|
// this.ipagination2.total = res.result.total
|
|
}
|
this.loading2 = false
|
})
|
|
},
|
getQueryField() {
|
//TODO 字段权限控制
|
var str = "id,";
|
this.columns.forEach(function (value) {
|
str += "," + value.dataIndex;
|
});
|
return str;
|
},
|
handleTableChange(pagination, filters, sorter) {
|
//分页、排序、筛选变化时触发
|
//TODO 筛选
|
console.log(pagination)
|
if (Object.keys(sorter).length > 0) {
|
this.isorter.column = sorter.field;
|
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
|
}
|
this.ipagination = pagination;
|
this.loadData();
|
},
|
handleTableChange2(pagination, filters, sorter) {
|
//分页、排序、筛选变化时触发
|
//TODO 筛选
|
if (Object.keys(sorter).length > 0) {
|
this.isorter2.column = sorter.field
|
this.isorter2.order = 'ascend' == sorter.order ? 'asc' : 'desc'
|
}
|
this.ipagination2 = pagination
|
this.loadData2()
|
},
|
// handleTableChange2(pagination, filters, sorter) {
|
// // console.log(sorter);
|
// // console.log(sorter.order)
|
// //获取查询条件
|
// let sqp = {}
|
// if(this.superQueryParams){
|
// sqp['superQueryParams']=encodeURI(this.superQueryParams)
|
// sqp['superQueryMatchType'] = this.superQueryMatchType
|
// }
|
// var params = Object.assign(sqp, this.queryParam, this.isorter ,this.filters);
|
// // console.log(this.ipagination)
|
// params.field = this.getQueryField2();
|
// // param.pageNo = this.ipagination.current;
|
// // param.pageSize = this.ipagination.total;
|
// params.startTime = this.queryParams.startTime;
|
// params.endTime = this.queryParams.endTime;
|
// params.parentId = this.queryParams.parentId;
|
// // param.equipmentId = this.queryParams.equipmentId;
|
// params.typeTree = this.queryParams.typeTree
|
// params.orderByName = sorter.order;
|
// // console.log(params)
|
// this.loading2 = true;
|
// postAction(this.url.list2, params).then((res) => {
|
// if (res.success) {
|
// if(res.result !==null){
|
// for (var i = 0; i < res.result.length;i++){
|
// res.result[i].faultRate = this.numFilter(res.result[i].faultRate)
|
// res.result[i].idleRate = this.numFilter(res.result[i].idleRate)
|
// res.result[i].useRate = this.numFilter(res.result[i].useRate)
|
// }
|
// // console.log(res.result)
|
// this.dataSource2 = res.result;
|
// }else{
|
// this.dataSource2 = res.result;
|
// }
|
// // this.ipagination2.total = res.result.total
|
//
|
// }
|
// this.loading2 = false
|
// })
|
// //升序 降序
|
// // if(sorter.order == "ascend"){
|
// //
|
// // }
|
// // else if(sorter.order == "descend"){
|
// //
|
// // }
|
//
|
// //分页、排序、筛选变化时触发
|
// //TODO 筛选
|
// // console.log(pagination)
|
// // if (Object.keys(sorter).length > 0) {
|
// // this.isorter.column = sorter.field;
|
// // this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
|
// // }
|
// // this.ipagination = pagination;
|
// // this.loadData2();
|
// },
|
handleExportXls(fileName){
|
if(!fileName || typeof fileName != "string"){
|
fileName = "导出文件"
|
}
|
/*let param = this.getQueryParams2();*/
|
// if(this.selectedRowKeys && this.selectedRowKeys.length>0){
|
// param['selections'] = this.selectedRowKeys.join(",")
|
// }
|
if(this.queryParams.typeTree == "1"){
|
this.queryParams.parentId = this.queryParamEquip.parentId
|
}else{
|
this.queryParams.parentId = this.queryParamPeople.parentId
|
}
|
let params = {};
|
params.startTime = this.queryParams.startTime
|
params.endTime = this.queryParams.endTime
|
params.parentId = this.queryParams.parentId
|
params.typeTree = this.queryParams.typeTree
|
console.log("导出参数",params)
|
downFile(this.url.exportXlsUrl,params).then((data)=>{
|
if (!data) {
|
this.$message.warning("文件下载失败")
|
return
|
}
|
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
|
}else{
|
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
|
let link = document.createElement('a')
|
link.style.display = 'none'
|
link.href = url
|
link.setAttribute('download', fileName+'.xls')
|
document.body.appendChild(link)
|
link.click()
|
document.body.removeChild(link); //下载完成移除元素
|
window.URL.revokeObjectURL(url); //释放掉blob对象
|
}
|
})
|
},
|
exportExcel() {
|
$("#checkTypeList").table2excel({
|
exclude: ".noExl",
|
name: "Excel Document Name",
|
filename: "统计详情表",
|
exclude_img: true,
|
fileext: ".xls",
|
exclude_links: true,
|
exclude_inputs: true
|
});
|
},
|
},
|
created() {
|
// this.initEquipment('-1')
|
this.dates = [moment().subtract('days', 3), moment().subtract('days', 1)]
|
this.queryParams.startTime = moment(this.dates[0]).format('YYYY-MM-DD')
|
this.queryParams.endTime = moment(this.dates[1]).format('YYYY-MM-DD')
|
this.queryParams.typeTree = "1"
|
this.loadData()
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
@import '~@assets/less/common.less';
|
|
@media screen and (min-width: 1920px){
|
.device_list{
|
height: 813px!important;
|
overflow: scroll;
|
}
|
}
|
@media screen and (min-width: 1680px) and (max-width: 1920px){
|
.device_list{
|
height: 813px!important;
|
overflow: scroll;
|
}
|
}
|
@media screen and (min-width: 1400px) and (max-width: 1680px){
|
.device_list{
|
height: 665px!important;
|
overflow: scroll;
|
}
|
}
|
@media screen and (min-width: 1280px) and (max-width: 1400px){
|
.device_list{
|
height: 566px!important;
|
overflow: scroll;
|
}
|
}
|
@media screen and (max-width: 1280px){
|
.device_list{
|
height: 566px!important;
|
overflow: scroll;
|
}
|
}
|
</style>
|