Files
cmanager/src/views/report/talentPool/confirmed.vue

163 lines
4.0 KiB
Vue
Raw Normal View History

2024-03-31 17:08:12 +08:00
<template>
<basic-container style="position: relative">
<avue-crud
:data="infoData"
:option="options"
:search.sync="search"
2024-04-01 17:07:27 +08:00
:table-loading="visible"
2024-03-31 17:08:12 +08:00
:page.sync="infoPages"
@search-change="searchChange"
@search-reset="resetChange"
@size-change="sizeChange"
@current-change="currentChange"
>
</avue-crud>
</basic-container>
</template>
<script>
2024-04-01 17:07:27 +08:00
import {confirmCount} from '@/api/report/report'
2024-03-31 17:08:12 +08:00
import CustomLoading from "@/components/Custom-Loading/index.vue";
import { dateFormat } from "@/util/date";
2024-04-01 17:07:27 +08:00
const columnEnum = {
2024-04-07 16:01:18 +08:00
'data1': '总数',
'data2': '机构登记数',
2024-04-07 20:16:35 +08:00
'data3': '大库识别数',
2024-04-01 17:07:27 +08:00
}
2024-03-31 17:08:12 +08:00
const pages = { total: 0, size: 10, currentPage: 1 }
const baseOptions = {
dateBtn: false,
addBtn: false,
editBtn: false,
delBtn: false,
height: "auto",
reserveSelection: false,
border: true,
columnBtn: false,
refreshBtn: false,
menu: false,
tip: false,
searchMenuSpan: 6,
selection: false,
2024-04-01 17:07:27 +08:00
headerAlign: 'center',
2024-04-02 15:03:57 +08:00
align: 'center',
2024-03-31 17:08:12 +08:00
}
export default {
components: {CustomLoading},
data() {
return {
infoPages: Object.assign({}, pages),
infoData: [],
visible: false,
search: {},
2024-04-01 17:07:27 +08:00
headColum: [],
2024-03-31 17:08:12 +08:00
}
},
created() {
this.getList()
},
computed: {
options() {
2024-04-01 17:07:27 +08:00
const tableHead = this.headColum.map((item, index) => ({
2024-04-07 16:01:18 +08:00
label: item.gname,
2024-04-01 17:07:27 +08:00
display:false,
children: Object.keys(columnEnum).map((key) => ({
label: columnEnum[key],
2024-04-07 16:01:18 +08:00
prop: `${index}_${item.gid}_${key}`,
2024-04-01 17:07:27 +08:00
display:false,
2024-04-07 16:01:18 +08:00
width: 100,
2024-04-01 17:07:27 +08:00
}))
}))
2024-04-07 16:01:18 +08:00
const headTitle = {
label: '机构名称',
prop: 'name',
search: true,
fixed: true,
}
if(this.infoPages.total !== 0) {headTitle.width = 200}
2024-03-31 17:08:12 +08:00
return {
...baseOptions,
2024-04-01 17:07:27 +08:00
height: 200,
width:200,
2024-04-07 16:01:18 +08:00
column: [
headTitle,
2024-04-01 17:07:27 +08:00
...tableHead,
{
label: '日期',
prop: 'date',
hide: true,
display: false,
type:'date',
searchSpan: 8,
searchRange:true,
search:true,
}]
2024-03-31 17:08:12 +08:00
}
}
},
methods: {
sizeChange(size) {
this.infoPages.size = size
this.getList()
},
currentChange(page) {
this.infoPages.page = page
this.getList()
},
searchChange(values, done) {
this.getList().then(() => {done()})
},
resetChange() {
this.search = {}
let params = { size: 10, current: 1 }
this.getList()
},
getList(values) {
return new Promise(async(resolve, reject) => {
this.visible = true
let params = {
size: this.infoPages.size,
current: this.infoPages.currentPage,
...this.search,
}
if( Array.isArray(this.search.date) && this.search.date.length ) {
const [stime, etime] = this.search.date
params.stime = dateFormat(stime, "yyyy-MM-dd")
params.etime = dateFormat(etime, "yyyy-MM-dd")
delete params.date
}
2024-04-01 17:07:27 +08:00
let resData = await confirmCount(params)
2024-03-31 17:08:12 +08:00
if(resData.data.code === 200) {
2024-04-07 16:01:18 +08:00
const { current, size ,total, records } = resData.data.data
2024-04-01 17:07:27 +08:00
this.infoData = records.map((item) => ({
...item,
...this.decompose(item.list)
}))
2024-04-07 16:01:18 +08:00
const columnInfo = records.length ? records[0].list : []
2024-04-01 17:07:27 +08:00
this.headColum = columnInfo
2024-03-31 17:08:12 +08:00
this.infoPages = { ...this.infoPages, currentPage: current, total, size}
2024-04-01 17:07:27 +08:00
this.visible = false;
resolve(true)
2024-03-31 17:08:12 +08:00
} else {
reject()
}
})
2024-04-01 17:07:27 +08:00
},
decompose(list) {
let obj = {}
for (let i = 0; i < list.length; i++) {
const item = list[i]
2024-04-07 16:01:18 +08:00
Object.keys(item.dataVO).forEach((vitem) => {
obj[`${i}_${item.gid}_${vitem}`] = item.dataVO[vitem]
2024-04-01 17:07:27 +08:00
})
}
return obj
2024-03-31 17:08:12 +08:00
}
}
}
</script>
<style scoped lang="scss">
</style>