<template>
|
<a-card :bordered='false'>
|
<!-- 查询区域 -->
|
<div class='table-page-search-wrapper'>
|
<a-form layout='inline' @keyup.enter.native='searchQuery'>
|
<a-row :gutter='24'>
|
|
|
<template v-if='toggleSearchStatus'>
|
<a-col :md='24' :sm='24'>
|
<a-form-item label='选择项目'>
|
<j-select-multi-project v-model='queryParam.xm' />
|
</a-form-item>
|
</a-col>
|
|
</template>
|
|
<a-col :md='6' :sm='8'>
|
<span style='float: left;overflow: hidden;' class='table-page-search-submitButtons'>
|
<a-button type='primary' @click='searchQuery' icon='search'>查询</a-button>
|
<a-button type='primary' @click='searchReset' icon='reload' style='margin-left: 8px'>重置</a-button>
|
<a @click='handleToggleSearch' style='margin-left: 8px'>
|
{{ toggleSearchStatus ? '收起' : '展开' }}
|
<a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
|
</a>
|
</span>
|
</a-col>
|
|
</a-row>
|
</a-form>
|
</div>
|
<!-- 操作按钮区域 -->
|
<div class='table-operator' style='border-top: 5px'>
|
<!-- <a-button type="primary" icon="download" @click="handleExportXls('模板信息')">导出</a-button>-->
|
<!-- <a-button type="primary" icon="hdd" @click="recycleBinVisible=true">回收站</a-button>-->
|
<a-dropdown v-if='selectedRowKeys.length > 0'>
|
<a-menu slot='overlay' @click='handleMenuClick'>
|
<a-menu-item key='1'>
|
<a-icon type='delete' @click='batchDel' />
|
删除
|
</a-menu-item>
|
|
</a-menu>
|
<a-button style='margin-left: 8px'>
|
批量操作
|
<a-icon type='down' />
|
</a-button>
|
</a-dropdown>
|
|
|
</div>
|
|
<!-- table区域-begin -->
|
<div>
|
<a-table
|
:scroll='{x: tableWidth}'
|
bordered
|
size='small'
|
ref='table'
|
rowKey='xm'
|
:columns='columns'
|
:dataSource='dataSource'
|
:loading='loading'
|
:pagination='false'
|
@change='handleTableChange'>
|
|
|
<!-- 字符串超长截取省略号显示-->
|
<span slot='esContent' slot-scope='text'>
|
<j-ellipsis :value='text' :length='18' />
|
</span>
|
|
<span slot='tag' slot-scope='tag,item'>
|
|
<template v-if='item.cno'>
|
<span v-if='item.cno > item.curSeason' >
|
-
|
</span>
|
<span v-else>
|
{{ tag }}
|
</span>
|
</template>
|
|
</span>
|
|
<span slot='total' slot-scope='text'>
|
<a-tag v-if='text > 0' color='red'>
|
{{ text }}
|
</a-tag>
|
<a-tag v-else>
|
{{ text }}
|
</a-tag>
|
</span>
|
|
|
</a-table>
|
</div>
|
<!-- table区域-end -->
|
|
</a-card>
|
</template>
|
|
<script>
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
import { initDictOptions, filterDictText, filterMultiDictText } from '@/components/dict/JDictSelectUtil'
|
|
import JSelectMultiProject from '@comp/jeecgbiz/JSelectMultiProject'
|
import { getWeek, getLastWeek, getLastMonth, getLastQuarter, getLastYear } from '@/utils/util'
|
|
|
export default {
|
name: 'RightStatisticsUser',
|
components: { JSelectMultiProject },
|
mixins: [JeecgListMixin],
|
watch: {
|
extSource(newVal) {
|
if (newVal.length === 0) {
|
|
} else {
|
this.initColumns()
|
}
|
}
|
|
},
|
data() {
|
return {
|
extSort: false,
|
dateFormat: 'YYYY-MM-DD',
|
description: '周报年度工时页面',
|
disableMixinCreated: true,
|
// 表头
|
columns: [],
|
tableWidth: 0,
|
//用户字典信息
|
userDictOptions: [],
|
proTypeDictOptions: [],
|
url: {
|
list: '/wek/record/statisticsYearList'
|
}
|
}
|
},
|
|
methods: {
|
|
searchReset() {
|
this.queryParam = {}
|
this.loadData(1)
|
},
|
|
|
initColumns() {
|
let itemWidth = 90
|
this.columns = []
|
let width = this.$refs.table.$el.offsetWidth
|
let dataWidth = 300 + 50 + 60 + 13 * 4 * itemWidth
|
|
if (dataWidth > width) {
|
this.tableWidth = dataWidth
|
} else {
|
this.tableWidth = 0
|
itemWidth = (width - 300 - 50 - 60) / this.extSource.length
|
}
|
|
|
this.columns.push({
|
title: '序号',
|
dataIndex: '',
|
key: 'rowIndex',
|
fixed: 'left',
|
align: 'center',
|
width: 50,
|
customRender: function(t, r, index) {
|
return parseInt(index) + 1
|
}
|
})
|
this.columns.push({
|
title: '项目',
|
dataIndex: 'xmName',
|
width: 280,
|
fixed: 'left',
|
scopedSlots: { customRender: 'esContent' }
|
})
|
this.columns.push({
|
title: '负责人',
|
dataIndex: 'xmfzr',
|
align: 'center',
|
width: 80,
|
customRender: (text, record, index) => {
|
//字典值替换通用方法
|
return this.getDictText(text);
|
}
|
})
|
this.columns.push({
|
title: '项目类型',
|
dataIndex: 'xmlx',
|
align: 'center',
|
width: 80,
|
customRender: (text, record, index) => {
|
//字典值替换通用方法
|
return filterDictText(this.proTypeDictOptions,text)
|
}
|
})
|
this.columns.push({
|
title: '项目年份',
|
dataIndex: 'year',
|
align: 'center',
|
width: 80,
|
})
|
this.extSource.forEach(item => {
|
let childs = []
|
if (item.children) {
|
for (let i = 0; i < item.children.length; i++) {
|
let child = item.children[i]
|
childs.push({
|
title: child.title ,
|
dataIndex: child.column,
|
align: 'center',
|
width: itemWidth,
|
customRender: function(t, r, index) {
|
return child.wno > child.curWeek ? "-" : t
|
}
|
})
|
|
}
|
}
|
if(childs.length>0){
|
this.columns.push({
|
title: item.title,
|
width: itemWidth,
|
align: 'center',
|
children: childs
|
})
|
//没有child
|
}else {
|
this.columns.push({
|
title: item.title,
|
dataIndex: item.column,
|
width: itemWidth,
|
align: 'center',
|
scopedSlots: { customRender: 'tag' }
|
/* customRender: function(t, r, index) {
|
if(item.cno){
|
return item.cno > item.curSeason ? "-" : t
|
}else {
|
return t
|
}
|
}*/
|
})
|
}
|
|
})
|
|
|
this.$nextTick(() => {
|
window.dispatchEvent(new Event('resize'))
|
})
|
|
},
|
initDictConfig() {
|
//初始化字典 - 性别
|
initDictOptions('sys_user,realname,username').then((res) => {
|
if (res.success) {
|
this.$set(this.userDictOptions, 'username', res.result)
|
if (this.extSource) {
|
this.initColumns()
|
}
|
}
|
}),
|
initDictOptions('xmlx').then((res) => {
|
if (res.success) {
|
this.proTypeDictOptions = res.result
|
}
|
})
|
|
},
|
getDictText(text) {
|
return filterDictText(this.userDictOptions['username'], text)
|
}
|
|
},
|
|
|
created() {
|
this.loadData()
|
this.initDictConfig()
|
|
},
|
computed: {
|
week() {
|
return getWeek()
|
}
|
}
|
}
|
</script>
|
|
<style lang='less' scoped>
|
|
/deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item .ant-form-item-control {
|
height: auto;
|
}
|
|
/deep/ .ant-collapse-content-box {
|
margin: 0;
|
padding: 0;
|
}
|
</style>
|