导出和条件搜索
This commit is contained in:
parent
36fc52b119
commit
a0b3d62482
|
@ -119,6 +119,7 @@
|
||||||
<el-form-item v-if="form.ruleType === 'FINAL'" label="商户结算具体要求" prop="specialBusinessContent">
|
<el-form-item v-if="form.ruleType === 'FINAL'" label="商户结算具体要求" prop="specialBusinessContent">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="form.specialBusinessContent"
|
v-model="form.specialBusinessContent"
|
||||||
|
type="textarea"
|
||||||
placeholder="请输入"
|
placeholder="请输入"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
|
@ -8,14 +8,42 @@
|
||||||
placeholder="请输入关键字"
|
placeholder="请输入关键字"
|
||||||
clearable
|
clearable
|
||||||
/> -->
|
/> -->
|
||||||
<el-select v-model="listQuery.source" clearable class="filter-item" placeholder="请选择积分来源">
|
<el-select v-model="listQuery.source" clearable class="filter-item" style="margin-right: 10px" placeholder="请选择积分来源">
|
||||||
<el-option v-for="item of sourceOptions" :key="item.value" v-bind="item" />
|
<el-option v-for="item of sourceOptions" :key="item.value" v-bind="item" />
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<el-date-picker
|
||||||
|
v-model="listQuery.dateArr"
|
||||||
|
type="datetimerange"
|
||||||
|
class="filter-item"
|
||||||
|
style="margin-right: 10px"
|
||||||
|
range-separator="至"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
value-format="timestamp"
|
||||||
|
align="right"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
<el-cascader
|
||||||
|
v-model="listQuery.regionIds"
|
||||||
|
class="filter-item"
|
||||||
|
style="width:240px"
|
||||||
|
:options="regions"
|
||||||
|
:props="{ checkStrictly: true }"
|
||||||
|
placeholder="行政区域"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
style="margin-left:10px"
|
style="margin-left:10px"
|
||||||
@click="handleSearch"
|
@click="handleSearch"
|
||||||
>搜索</el-button>
|
>搜索</el-button>
|
||||||
|
<el-button
|
||||||
|
:loading="exportLoading"
|
||||||
|
icon="el-icon-download"
|
||||||
|
type="primary"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="handleExport"
|
||||||
|
>导出</el-button>
|
||||||
</div>
|
</div>
|
||||||
<el-table :data="list" border style="width: 100%">
|
<el-table :data="list" border style="width: 100%">
|
||||||
<el-table-column label="用户名" prop="residentInformation.name" />
|
<el-table-column label="用户名" prop="residentInformation.name" />
|
||||||
|
@ -51,6 +79,7 @@
|
||||||
<script>
|
<script>
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
import { recordList } from '@/api/fingertipIntegral'
|
import { recordList } from '@/api/fingertipIntegral'
|
||||||
|
import { getRegions } from '@/api/region'
|
||||||
import { sourceOptions } from './options'
|
import { sourceOptions } from './options'
|
||||||
export default {
|
export default {
|
||||||
components: { Pagination },
|
components: { Pagination },
|
||||||
|
@ -76,10 +105,16 @@ export default {
|
||||||
keyword: undefined,
|
keyword: undefined,
|
||||||
source: undefined,
|
source: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
userId: undefined
|
userId: undefined,
|
||||||
|
dateArr: [],
|
||||||
|
regionIds: []
|
||||||
},
|
},
|
||||||
list: undefined,
|
list: undefined,
|
||||||
|
|
||||||
|
regionSearchVal: undefined,
|
||||||
|
regions: [],
|
||||||
|
exportLoading: false,
|
||||||
|
|
||||||
sourceOptions
|
sourceOptions
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -93,15 +128,101 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.getRegions()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getList() {
|
getList() {
|
||||||
recordList(this.listQuery).then(res => {
|
const listQuery = JSON.parse(JSON.stringify(this.listQuery))
|
||||||
|
const { dateArr, regionIds } = listQuery
|
||||||
|
if (dateArr) {
|
||||||
|
listQuery.startDate = dateArr[0] / 1000
|
||||||
|
listQuery.endDate = dateArr[1] / 1000
|
||||||
|
}
|
||||||
|
listQuery.regionIds = regionIds.join(',')
|
||||||
|
recordList(listQuery).then(res => {
|
||||||
this.list = res.d.records
|
this.list = res.d.records
|
||||||
this.total = res.d.total
|
this.total = res.d.total
|
||||||
// this.pageSize = res.d.pageSize
|
// this.pageSize = res.d.pageSize
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getRegions() {
|
||||||
|
getRegions().then(res => {
|
||||||
|
const tempData = res.d
|
||||||
|
const countyArr = [] // 县,1
|
||||||
|
tempData.map(county => {
|
||||||
|
const countyObj = {
|
||||||
|
value: county.root.id,
|
||||||
|
label: county.root.name,
|
||||||
|
disabled: !county.root.check,
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
countyArr.push(countyObj)
|
||||||
|
county.node.map(town => {
|
||||||
|
const townObj = {
|
||||||
|
value: town.root.id,
|
||||||
|
label: town.root.name,
|
||||||
|
disabled: !town.root.check,
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
countyObj.children.push(townObj)
|
||||||
|
town.node.map(country => {
|
||||||
|
townObj.children.push({
|
||||||
|
value: country.root.id,
|
||||||
|
label: country.root.name,
|
||||||
|
disabled: !country.root.check
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.regions = countyArr
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleExport() {
|
||||||
|
const that = this
|
||||||
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
|
const tHeader = ['用户名', '积分来源', '获取积分数', '获取时间']
|
||||||
|
const filterVal = ['residentInformation.name', 'source', 'num', 'createDate']
|
||||||
|
this.exportLoading = true
|
||||||
|
const listQuery = JSON.parse(JSON.stringify(this.listQuery))
|
||||||
|
const { dateArr, regionIds } = listQuery
|
||||||
|
if (dateArr) {
|
||||||
|
listQuery.startDate = dateArr[0] / 1000
|
||||||
|
listQuery.endDate = dateArr[1] / 1000
|
||||||
|
}
|
||||||
|
listQuery.regionIds = regionIds.join(',')
|
||||||
|
listQuery.size = 999999
|
||||||
|
recordList(listQuery).then(res => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.exportLoading = false
|
||||||
|
}, 3000)
|
||||||
|
|
||||||
|
const data = that.formatJson(filterVal, res.d.records)
|
||||||
|
excel.export_json_to_excel({
|
||||||
|
header: tHeader,
|
||||||
|
data: data,
|
||||||
|
filename: '积分流水'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
formatJson(filterVal, jsonData) {
|
||||||
|
return jsonData.map(v =>
|
||||||
|
filterVal.map(j => {
|
||||||
|
let value
|
||||||
|
if (j === 'createDate') {
|
||||||
|
value = this.$options.filters['parseTime'](v[j])
|
||||||
|
} else if (j === 'residentInformation.name') {
|
||||||
|
value = v['residentInformation']['name']
|
||||||
|
} else if (j === 'source') {
|
||||||
|
value = this.$options.filters['optionsFilter'](v[j], sourceOptions)
|
||||||
|
} else {
|
||||||
|
value = v[j]
|
||||||
|
}
|
||||||
|
// if (!value && value !== 0) value = "N/A";
|
||||||
|
return value
|
||||||
|
})
|
||||||
|
)
|
||||||
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
const { listQuery } = this
|
const { listQuery } = this
|
||||||
this.listQuery.lastPageIndex = 1
|
this.listQuery.lastPageIndex = 1
|
||||||
|
|
|
@ -333,8 +333,8 @@ export default {
|
||||||
handleRExport(item) {
|
handleRExport(item) {
|
||||||
const that = this
|
const that = this
|
||||||
import('@/vendor/Export2Excel').then(excel => {
|
import('@/vendor/Export2Excel').then(excel => {
|
||||||
const tHeader = ['商户姓名', '日期', '群众姓名', '积分数量', '积分交易备注', '积分来源']
|
const tHeader = ['商户姓名', '日期', '群众姓名', '积分数量', '积分兑换金额(元)', '积分交易备注']
|
||||||
const filterVal = ['businessName', 'createDate', 'massesName', 'num', 'remark', 'source']
|
const filterVal = ['businessName', 'createDate', 'massesName', 'num', 'money', 'remark']
|
||||||
this.loading = true
|
this.loading = true
|
||||||
// const listQuery = JSON.parse(JSON.stringify(this.listQuery))
|
// const listQuery = JSON.parse(JSON.stringify(this.listQuery))
|
||||||
// const { dateArr } = listQuery
|
// const { dateArr } = listQuery
|
||||||
|
|
Loading…
Reference in New Issue