安宁pc前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

432 lines
15 KiB

<template>
<el-card shadow="never"
class="aui-card--fill">
<div class="mod-news__news}">
<el-form :inline="true"
:model="dataForm"
@keyup.enter.native="getDataListSearch()">
<el-form-item label="所属机构">
<el-cascader v-model="deptIdList"
:options="options"
:props="{ checkStrictly: true }"
clearable></el-cascader>
</el-form-item>
<el-form-item label="排序规则">
<el-select v-model="dataForm.category"
clearable
placeholder="排序规则">
<el-option v-for="item in categorys"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<br>
<el-form-item label="提交时间"
prop="startTime">
<el-date-picker v-model="dataForm.startTime"
type="date"
:picker-options="pickerBeginDateBefore"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期时间"
style="width:250px;"
@change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item label="至"
label-width="25px"
prop="endTime">
<el-date-picker v-model="dataForm.endTime"
type="date"
:picker-options="pickerBeginDateAfter"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期时间"
style="width:250px;"
@change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="success" @click="getDataListSearch()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button type="success" @click="exportHandle()">{{ $t('export') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('news:news:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('news:news:delete')"
type="danger"
@click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading"
:data="dataList"
border
@selection-change="dataListSelectionChangeHandle"
style="width: 100%;">
<el-table-column label="序号" header-align="center" align="center" width="50px">
<template slot-scope="scope">
{{scope.$index+1}}
</template>
</el-table-column>
<el-table-column prop="streetName"
label="街道名称"
header-align="center"
align="center"
min-width="150"
show-overflow-tooltip></el-table-column>
<el-table-column prop="partyMemberCount"
label="注册党员数量(已认证)"
header-align="center"
align="center"
width="180"></el-table-column>
<el-table-column prop="oldCount"
label="年龄超过50岁党员数量"
header-align="center"
align="center"
width="180"></el-table-column>
<el-table-column prop=""
label="老龄化比例"
header-align="center"
align="center"
width="120">
<template slot-scope="scope">
{{(scope.row.oldPercent*100).toFixed(2)}}%
</template>
</el-table-column>
<el-table-column prop="youngCount"
label="50岁以下党员数量"
header-align="center"
align="center"
width="150">
</el-table-column>
<el-table-column prop=""
label="年轻化比例"
header-align="center"
align="center"
width="150">
<template slot-scope="scope">
{{(scope.row.youngPercent*100).toFixed(2)}}%
</template>
</el-table-column>
<el-table-column el-table-column
prop="maleCount"
label="男"
header-align="center"
align="center"
width="50"></el-table-column>
<el-table-column prop="femaleCount"
label="女"
header-align="center"
align="center"
width="50"></el-table-column>
<el-table-column prop="unknownSexCount"
label="未知性别"
header-align="center"
align="center"
width="80"></el-table-column>
<el-table-column prop="partyAuthFailureCount"
label="党员认证失败数"
header-align="center"
align="center"
width="140"></el-table-column>
</el-table>
<!-- <el-pagination :current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination> -->
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"></add-or-update>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/analysis/user/page/dataRank',
getDataListIsPage: true,
deleteIsBatch: true,
exportURL: '/analysis/user/export/party'
},
dataForm: {
partyFlag: '1',
startTime:'',
endTime:''
},
time: '',
options: [],
deptIdList: [],
streetList: [],
communityList: [],
gridList: [],
categorys: [
{
value: '0',
label: '超过50岁最多人数'
}, {
value: '1',
label: '50岁以下最多人数'
}, {
value: '2',
label: '超过50岁最少人数'
}, {
value: '3',
label: '50岁以下最少人数'
}, {
value: '7',
label: '注册人数最多'
},
{
value: '8',
label: '注册人数最少'
}
],
onLine: {
id: '',
onLineState: ''
},
pickerBeginDateBefore: {
disabledDate: (time) => {
let beginDateVal = this.dataForm.endTime
if (beginDateVal) {
return time.getTime() > new Date(beginDateVal + ' 00:00:00').getTime()
}
}
},
pickerBeginDateAfter: {
disabledDate: (time) => {
let EndDateVal = this.dataForm.startTime
if (EndDateVal) {
return time.getTime() < new Date(EndDateVal + ' 00:00:00').getTime()
}
}
},
}
},
created () {
this.$http
.get(`/sys/user/deptOptions/getByLoginUser`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.options = res.data.options
})
.catch(() => { })
this.initTime()
// this.getDeptInfoList('street', localStorage.getItem('street') === null ? '1169154711480528897' : localStorage.getItem('street'))
// this.getListCategory()
},
methods: {
initTime () {
const end = new Date()
const start = new Date()
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
this.time = [start, end]
let year = start.getFullYear()
let month = start.getMonth() + 1
if (month < 10) {
month = '0' + month
}
let date = start.getDate()
if (date < 10) {
date = '0' + date
}
let startDate = year + '-' + month + '-' + date
let yearend = end.getFullYear()
let monthend = end.getMonth() + 1
if (monthend < 10) {
monthend = '0' + monthend
}
let dateend = end.getDate()
if (dateend < 10) {
dateend = '0' + dateend
}
let endDate = yearend + '-' + monthend + '-' + dateend
this.dataForm.startTime = startDate
this.dataForm.endTime = endDate
},
newsUpDownState: function (row) {
return row.newsUpDownState === '1' ? '下线' : '上线'
},
publishState: function (row) {
var stdt = new Date(row.newsReleaseStartTime.replace('-', '/'))
var eddt = new Date(row.newsReleaseEndTime.replace('-', '/'))
var nowdt = new Date()
if (row.newsUpDownState === '1') {
// 手动下线
return '已下线'
}
if (nowdt > stdt && nowdt < eddt && row.newsUpDownState === '0') {
return '已上线'
}
if (nowdt < stdt) {
return '未上线'
}
if (nowdt > eddt) {
return '已下线'
}
},
// 获取部门列表
getDeptInfoList (dataReceiver, faDeptId) {
this.$http.get(`/sys/dept/sublist/` + faDeptId).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
if (dataReceiver === 'street') {
this.streetList = res.data
} else if (dataReceiver === 'community') {
this.communityList = res.data
} else if (dataReceiver === 'grid') {
this.gridList = res.data
}
}).catch(() => { })
},
changeStreet (event) {
if (this.dataForm.streetId === '') {
this.communityList = []
this.gridList = []
this.dataForm.communityId = ''
this.dataForm.deptId = ''
return
}
this.dataForm.streetId = event
let choosenItem = this.streetList.filter(item => item.id === this.dataForm.streetId)[0]
this.initDeptIdAndName(choosenItem)
this.dataForm.communityId = this.dataForm.deptId = null
this.communityList = this.gridList = []
this.getDeptInfoList('community', event)
},
changeCommunity (event) {
if (this.dataForm.communityId === '') {
this.gridList = []
this.dataForm.deptId = ''
return
}
this.communityId = event
let choosenItem = this.communityList.filter(item => item.id === this.dataForm.communityId)[0]
this.initDeptIdAndName(choosenItem)
this.dataForm.deptId = null
this.gridList = []
this.getDeptInfoList('grid', event)
},
changeGrid (event) {
this.dataForm.deptId = event
let choosenItem = this.gridList.filter(item => item.id === this.deptId)[0]
this.initDeptIdAndName(choosenItem)
},
initDeptIdAndName (choosenItem) {
this.dataForm.dept = choosenItem.name
this.dataForm.deptId = choosenItem.id
},
// getListCategory () {
// this.$http.get(`/news/newscategory/category/`).then(({ data: res }) => {
// if (res.code !== 0) {
// return this.$message.error(res.msg)
// }
// this.categorys = res.data
// }).catch(() => { })
// },
modifyOnLine (row) {
this.$confirm(this.$t('prompt.info', { 'handle': '下线' }), this.$t('下线'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.onLine.id = row.id
this.onLine.onLineState = '0'
console.log(this.onLine)
this.$http.post(`/news/news/modifyOnLine/`, this.onLine).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
}
})
this.getDataList()
}).catch(() => { })
}).catch(() => { })
},
newsToBanner (row) {
this.$confirm(this.$t('prompt.info', { 'handle': '上banner' }), this.$t('上banner'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.post(`/news/news/newsToBanner/` + row.id).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
}
})
this.getDataList()
}).catch(() => { })
}).catch(() => { })
},
// 获取数据列表
getDataList () {
if (this.time === null) {
this.dataForm.startTime = ''
this.dataForm.endTime = ''
}
this.dataListLoading = true
this.$http.get(
this.mixinViewModuleOptions.getDataListURL,
{
params: {
order: this.order,
orderField: this.orderField,
page: this.mixinViewModuleOptions.getDataListIsPage ? this.page : null,
limit: this.mixinViewModuleOptions.getDataListIsPage ? this.limit : null,
...this.dataForm
}
}
).then(({ data: res }) => {
this.dataListLoading = false
if (res.code !== 0) {
this.dataList = []
this.total = 0
return this.$message.error(res.msg)
}
this.dataList = this.mixinViewModuleOptions.getDataListIsPage ? res.data.list : res.data
this.total = this.mixinViewModuleOptions.getDataListIsPage ? res.data.total : 0
}).catch(() => {
this.dataListLoading = false
})
}
},
watch: {
'deptIdList': function (val) {
if (val.length !== 0) {
this.dataForm.deptId = val[val.length - 1]
} else {
this.dataForm.deptId = ''
}
}
}
}
</script>