Files
cmanager/src/views/report/main/innovation.vue

189 lines
4.8 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 21:09:42 +08:00
import {innovationServeCount , listAllServe} 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 21:09:42 +08:00
import { deepClone } from "@/util/util";
const columnEnum = {
"personCount": "服务总人数",
"policyCount": "政策推送总数",
"jobCount": "岗位推送总数",
"serveCount": "跟踪服务次数",
"successfulCount": "服务成功次数"
}
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 21:09:42 +08:00
headerAlign: '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 21:09:42 +08:00
serveData: [],
headTitle: '',
searchServeId: '',
2024-03-31 17:08:12 +08:00
}
},
created() {
2024-04-01 21:09:42 +08:00
this.getServeList().then((res) => {
if(res.length) {
this.headTitle = res[0].name
this.search.serveId = res[0].id
this.searchServeId = res[0].id
this.getList().then((records) => {
if(records.length) {
this.headTitle = records[0].name
}
})
}
})
2024-03-31 17:08:12 +08:00
},
computed: {
options() {
2024-04-01 21:09:42 +08:00
const serveHead = [{
label: this.headTitle,
display: false,
children: Object.keys(columnEnum).map((key) => ({
label: columnEnum[key],
prop: key,
display: false,
}))
}]
2024-03-31 17:08:12 +08:00
return {
...baseOptions,
column: [{
2024-04-01 21:09:42 +08:00
label: '服务名称',
prop: 'serveId',
hide: true,
display: false,
type:'select',
2024-03-31 17:23:13 +08:00
searchSpan: 6,
2024-04-01 21:09:42 +08:00
search:true,
searchClearable: false,
dicData: this.serveData,
props: {
label: 'name',
value: 'id'
}
2024-03-31 17:08:12 +08:00
},{
2024-04-01 21:09:42 +08:00
label: '机构名称',
prop: 'companyName',
2024-03-31 17:23:13 +08:00
search: true,
searchSpan: 6,
2024-04-01 21:09:42 +08:00
},
...serveHead,
{
2024-03-31 17:08:12 +08:00
label: '日期',
prop: 'date',
hide: true,
display: false,
type:'date',
2024-03-31 17:23:13 +08:00
searchSpan: 6,
2024-03-31 17:08:12 +08:00
searchRange:true,
search:true,
}]
}
}
},
methods: {
sizeChange(size) {
this.infoPages.size = size
this.getList()
},
currentChange(page) {
this.infoPages.page = page
this.getList()
},
searchChange(values, done) {
2024-04-01 21:09:42 +08:00
const ele = this.serveData.filter((item) => values.serveId === item.id)[0]
this.headTitle = ele.name
this.searchServeId = values.serveId
this.getList().then(() => done())
2024-03-31 17:08:12 +08:00
},
resetChange() {
2024-04-01 21:09:42 +08:00
this.search = { serveId: this.searchServeId }
2024-03-31 17:08:12 +08:00
let params = { size: 10, current: 1 }
this.getList()
},
2024-04-01 21:09:42 +08:00
getServeList() {
return new Promise(async (resolve, reject) => {
let resData = await listAllServe({id: '1767902578403028993'})
if(resData.data.code === 200) {
this.serveData = resData.data.data
resolve(resData.data.data)
} else {
reject()
}
})
2024-04-01 17:07:27 +08:00
},
2024-03-31 17:08:12 +08:00
getList(values) {
return new Promise(async(resolve, reject) => {
this.visible = true
let params = {
size: this.infoPages.size,
current: this.infoPages.currentPage,
...this.search,
}
2024-04-01 21:09:42 +08:00
if( Array.isArray(this.search.date) && this.search.date.length ) {
2024-03-31 17:08:12 +08:00
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 21:09:42 +08:00
const copySearch = deepClone(this.search)
2024-04-01 17:07:27 +08:00
let resData = await innovationServeCount(params)
2024-03-31 17:08:12 +08:00
if(resData.data.code === 200) {
const { records, current, total, size } = resData.data.data
this.infoData = records
this.infoPages = { ...this.infoPages, currentPage: current, total, size}
2024-04-01 17:07:27 +08:00
this.visible = false;
2024-04-01 21:09:42 +08:00
resolve(records)
setTimeout(() => {
this.search = copySearch
}, 0)
2024-03-31 17:08:12 +08:00
} else {
reject()
}
})
}
}
}
</script>
<style scoped lang="scss">
</style>