Browse Source

志愿者模块 后端界面代码

master
zhangyongzhangyong 6 years ago
parent
commit
633ce55039
  1. 170
      src/views/modules/user/volunteerinfo-add-or-update.vue
  2. 122
      src/views/modules/user/volunteerinfo-check.vue
  3. 116
      src/views/modules/user/volunteerinfo-detail.vue
  4. 158
      src/views/modules/user/volunteerinfo-points-adjust.vue
  5. 248
      src/views/modules/user/volunteerinfo.vue

170
src/views/modules/user/volunteerinfo-add-or-update.vue

@ -0,0 +1,170 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'">
<el-form-item label="用户ID" prop="userId">
<el-input v-model="dataForm.userId" placeholder="用户ID"></el-input>
</el-form-item>
<el-form-item label="姓名" prop="fullName">
<el-input v-model="dataForm.fullName" placeholder="姓名"></el-input>
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-input v-model="dataForm.sex" placeholder="性别"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="dataForm.mobile" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item label="身份证" prop="identityNo">
<el-input v-model="dataForm.identityNo" placeholder="身份证"></el-input>
</el-form-item>
<el-form-item label="出生日期" prop="birthday">
<el-input v-model="dataForm.birthday" placeholder="出生日期"></el-input>
</el-form-item>
<el-form-item label="爱心时长" prop="kindnessTime">
<el-input v-model="dataForm.kindnessTime" placeholder="爱心时长"></el-input>
</el-form-item>
<el-form-item label="参加活动次数" prop="participationNum">
<el-input v-model="dataForm.participationNum" placeholder="参加活动次数"></el-input>
</el-form-item>
<el-form-item label="积分" prop="points">
<el-input v-model="dataForm.points" placeholder="积分"></el-input>
</el-form-item>
<el-form-item label="网格ID" prop="girdId">
<el-input v-model="dataForm.girdId" placeholder="网格ID"></el-input>
</el-form-item>
<!-- <el-form-item label="父所有部门ID" prop="parentDeptIds">
<el-input v-model="dataForm.parentDeptIds" placeholder="父所有部门ID"></el-input>
</el-form-item>
<el-form-item label="父所有部门名称" prop="parentDeptNames">
<el-input v-model="dataForm.parentDeptNames" placeholder="父所有部门名称"></el-input>
</el-form-item>
<el-form-item label="所有部门ID" prop="allDeptIds">
<el-input v-model="dataForm.allDeptIds" placeholder="所有部门ID"></el-input>
</el-form-item>
<el-form-item label="所有部门名称" prop="allDeptNames">
<el-input v-model="dataForm.allDeptNames" placeholder="所有部门名称"></el-input>
</el-form-item> -->
<!-- <el-form-item label="所属道路" prop="road">
<el-input v-model="dataForm.road" placeholder="所属道路"></el-input>
</el-form-item>
<el-form-item label="小区名称" prop="villageName">
<el-input v-model="dataForm.villageName" placeholder="小区名称"></el-input>
</el-form-item>
<el-form-item label="住处" prop="dwellingPlace">
<el-input v-model="dataForm.dwellingPlace" placeholder="住处"></el-input>
</el-form-item> -->
<el-form-item label="审批状态" prop="auditStatus">
<el-input v-model="dataForm.auditStatus" placeholder="审批状态"></el-input>
</el-form-item>
<el-form-item label="居住地址" prop="address">
<el-input v-model="dataForm.address" placeholder="居住地址"></el-input>
</el-form-item>
<el-form-item label="自我介绍" prop="introduce">
<el-input v-model="dataForm.introduce" placeholder="自我介绍"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
dataForm: {
id: '',
userId: '',
fullName: '',
sex: '',
birthday: '',
mobile: '',
identityNo: '',
kindnessTime: '',
participationNum: '',
points: '',
girdId: '',
parentDeptIds: '',
parentDeptNames: '',
allDeptIds: '',
allDeptNames: '',
road: '',
villageName: '',
dwellingPlace: '',
address: '',
introduce: '',
registTime: '',
auditStatus: '',
failureReason: '',
auditTime: '',
auditor: '',
revision: '',
createdBy: '',
createdTime: '',
updatedBy: '',
updatedTime: ''
}
}
},
computed: {
dataRule () {
return {
userId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
fullName: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getInfo () {
this.$http.get(`/app-user/volunteerinfo/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => {})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.$http[!this.dataForm.id ? 'post' : 'put']('/app-user/volunteerinfo/', this.dataForm).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.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
</script>

122
src/views/modules/user/volunteerinfo-check.vue

@ -0,0 +1,122 @@
<template>
<el-dialog
:visible.sync="visible"
title="志愿者审核"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"
>
<el-form-item label="审核" prop="auditStatus">
<template>
<el-radio v-model="dataForm.auditStatus" label="1">通过</el-radio>
<el-radio v-model="dataForm.auditStatus" label="2">不通过</el-radio>
</template>
</el-form-item>
<el-form-item v-if="dataForm.auditStatus === '2'" label="填写原因" prop="failureReason">
<el-input
v-model="dataForm.failureReason"
maxlength="50"
show-word-limit
placeholder="请您填写取消原因,50字以内"
></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
dataForm: {
id: '', // id
auditStatus: '',
failureReason: '',
tagIds: []
},
tagOptions: [],
userGridList: []
}
},
computed: {
dataRule () {
return {
auditStatus: [
{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
]
}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
// data.dataForm.id = this.dataForm.id
// this.getInfo()
}
})
},
//
dataFormSubmitHandle: debounce(
function () {
this.$refs['dataForm'].validate(valid => {
if (!valid) {
return false
}
let postData = {
id: this.dataForm.id,
auditStatus: this.dataForm.auditStatus,
failureReason: this.dataForm.failureReason
}
this.$http['post'](
'/app-user/volunteerinfo/volunteerInfoCheck',
postData
)
.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.visible = false
this.$emit('refreshDataList')
}
})
})
.catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
),
showLeaderFlagFormatter (row, column, cellValue, index) {
if (cellValue === '1') {
return '是'
} else {
return '否'
}
}
}
}
</script>

116
src/views/modules/user/volunteerinfo-detail.vue

@ -0,0 +1,116 @@
<template>
<el-dialog
:visible.sync="visible"
title="用户详情"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : '110px'"
>
<el-form-item label="姓名" prop="fullName" v-if="dataForm.fullName">
<span>{{dataForm.fullName}}</span>
</el-form-item>
<el-form-item label="性别" prop="sex">
<span>{{dataForm.mobile}}</span>
</el-form-item>
<el-form-item label="出生日期" prop="birthday">
<span>{{dataForm.identityNo}}</span>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<span>{{dataForm.identityNo}}</span>
</el-form-item>
<el-form-item label="身份证号" prop="identityNo">
<span>{{dataForm.identityNo}}</span>
</el-form-item>
<el-form-item label="地址" prop="address">
<span>{{dataForm.address}}</span>
</el-form-item>
<el-form-item label="自我介绍" prop="introduce">
<span>{{dataForm.introduce}}</span>
</el-form-item>
<el-form-item label="积分" prop="points">
<span>{{dataForm.points}}</span>
</el-form-item>
<el-form-item label="成为志愿者时间" prop="registTime">
<span>{{dataForm.registTime}}</span>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false" type="primary">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
dataForm: {
id: '',
fullName: '',
sex: '',
birthday: '',
mobile: '',
identityNo: '',
address: '',
introduce: '',
points: '',
registTime: '',
tagIds: []
},
tagOptions: [],
userGridList: []
}
},
computed: {
dataRule () {
return {}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getInfo: debounce(
function () {
this.$http
.get(`/app-user/volunteerinfo/getVolunteerDetail/${this.dataForm.id}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
this.dataForm.tagIds = []
})
.catch(() => {})
},
1000,
{ leading: true, trailing: false }
),
showLeaderFlagFormatter (row, column, cellValue, index) {
if (cellValue === '1') {
return '是'
} else {
return '否'
}
}
}
}
</script>

158
src/views/modules/user/volunteerinfo-points-adjust.vue

@ -0,0 +1,158 @@
<template>
<el-dialog
:visible.sync="visible"
title="积分调整"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"
>
<el-form-item label="姓名" prop="fullName" v-if="dataForm.fullName">
<span>{{dataForm.fullName}}</span>
</el-form-item>
<el-form-item label="性别" prop="sex">
<span>{{dataForm.mobile}}</span>
</el-form-item>
<el-form-item label="出生日期" prop="birthday">
<span>{{dataForm.identityNo}}</span>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<span>{{dataForm.identityNo}}</span>
</el-form-item>
<el-form-item label="积分" prop="points">
<span>{{dataForm.points}}</span>
</el-form-item>
<!-- 积分日志表 -->
<el-form-item label="调整原因" prop="operationDesc">
<el-input v-model="dataForm.operationDesc" placeholder="调整原因"></el-input>
</el-form-item>
<!-- 积分调整 -->
<el-form-item label="积分调整" prop="operationType">
<span>+</span>
<el-input v-model="operationTypeAdd" v-if="false"></el-input>
<el-input-number v-model="operationTypeAdd" :min="0"></el-input-number>
<span>-</span>
<el-input v-model="operationTypeReduce" v-if="false"></el-input>
<el-input-number v-model="operationTypeReduce" :min="0"></el-input-number>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
operationTypeAdd: 0,
operationTypeReduce: 0,
dataForm: {
id: '',
userId: '',
operationType: '',
points: '',
operationDesc: '',
state: '',
tagIds: [],
remark: ''
},
tagOptions: [],
userGridList: []
}
},
computed: {
dataRule () {
return {}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
}
})
},
//
getInfo: debounce(
function () {
this.$http
.get(`/app-user/volunteerinfo/${this.dataForm.id}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
//
this.dataForm = {
...this.dataForm,
...res.data
}
this.dataForm.tagIds = []
})
.catch(() => {})
},
1000,
{ leading: true, trailing: false }
),
showLeaderFlagFormatter (row, column, cellValue, index) {
if (cellValue === '1') {
return '是'
} else {
return '否'
}
},
//
dataFormSubmitHandle: debounce(
function () {
this.$refs['dataForm'].validate(valid => {
if (!valid) {
return false
}
// (0-,1-)OPERATION_TYPE
// if (this.operationTypeAdd != 0 && this.operationTypeAdd != '') {
// this.operationType = 0
// this.points = operationTypeAdd;
// } else if (
// this.operationTypeReduce != 0 &&
// this.operationTypeReduce != ''
// ) {
// this.operationType = 0
// this.points = this.operationTypeReduce
// }
// POINTS
// let postData = {
// id: this.dataForm.id,
// userId: this.dataForm.userId,
// operationDesc: this.dataForm.operationDesc,
// failureReason: this.dataForm.failureReason
// }
})
},
1000,
{ leading: true, trailing: false }
)
},
//
watch: {
operationTypeAdd: function (val) {
this.operationTypeReduce = 0
},
operationTypeReduce: function (val) {
this.operationTypeAdd = 0
}
}
}
</script>

248
src/views/modules/user/volunteerinfo.vue

@ -0,0 +1,248 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-epdc__user}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<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-input v-model="dataForm.fullName" placeholder="姓名" clearable></el-input>
</el-form-item>
<el-form-item label="手机号">
<el-input v-model="dataForm.mobile" placeholder="手机号" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<!-- <el-form-item>
<el-button v-if="$hasPermission('user:volunteerinfo:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('user:volunteerinfo: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 type="selection" header-align="center" align="center" width="50"></el-table-column> -->
<!-- <el-table-column prop="id" label="主键" header-align="center" align="center"></el-table-column> -->
<!-- <el-table-column prop="userId" label="用户ID" header-align="center" align="center"></el-table-column> -->
<el-table-column prop="fullName" label="姓名" header-align="center" align="center"></el-table-column>
<el-table-column
prop="sex"
label="性别"
:formatter="sexState"
header-align="center"
align="center"
></el-table-column>
<el-table-column prop="birthday" label="出生日期" header-align="center" align="center"></el-table-column>
<el-table-column prop="mobile" label="联系电话" header-align="center" align="center"></el-table-column>
<el-table-column prop="identityNo" label="身份证" header-align="center" align="center"></el-table-column>
<el-table-column prop="registTime" label="认证时间" header-align="center" align="center"></el-table-column>
<el-table-column
prop="auditStatus"
label="状态"
:formatter="auditStatusState"
header-align="center"
align="center"
></el-table-column>
<el-table-column prop="kindnessTime" label="爱心时长" header-align="center" align="center"></el-table-column>
<el-table-column prop="points" label="积分" header-align="center" align="center"></el-table-column>
<el-table-column
:label="$t('handle')"
fixed="right"
header-align="center"
align="center"
width="200"
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="userDetailHandle(scope.row.id)">查看</el-button>
<el-button
type="text"
size="small"
@click="checkHandle(scope.row.id)"
v-if="scope.row.auditStatus == 0"
>审批</el-button>
<!-- <el-button type="text" size="small" @click="pointsAdjustHandle(scope.row.id)">积分调整</el-button> -->
<!-- <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">积分记录</el-button> -->
</template>
</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>
<!-- 弹窗, 查看 -->
<volunteerinfo-detail
v-if="volunteerinfoDetailVisible"
ref="volunteerinfoDetail"
@refreshDataList="getDataList"
></volunteerinfo-detail>
<!-- 弹窗, 审批 -->
<volunteerinfo-check
v-if="volunteerinfoCheckVisible"
ref="volunteerinfoCheck"
@refreshDataList="getDataList"
></volunteerinfo-check>
<!-- 弹窗, 积分调整 -->
<volunteerinfo-points-adjust
v-if="volunteerinfoPointsAdjustVisible"
ref="volunteerinfoPointsAdjust"
@refreshDataList="getDataList"
></volunteerinfo-points-adjust>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './volunteerinfo-add-or-update'
// import debounce from 'lodash/debounce'
import volunteerinfoDetail from './volunteerinfo-detail'
import volunteerinfoPointsAdjust from './volunteerinfo-points-adjust'
import volunteerinfoCheck from './volunteerinfo-check'
// import func from '../../../../vue-temp/vue-editor-bridge'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/app-user/volunteerinfo/page',
getDataListIsPage: true,
deleteURL: '/app-user/volunteerinfo',
deleteIsBatch: true
},
dataForm: {
id: '',
userId: '',
fullName: '',
sex: '',
birthday: '',
mobile: '',
identityNo: '',
registTime: '',
auditStatus: '',
kindnessTime: '',
points: '',
parentDeptIds: '',
parentDeptNames: '',
allDeptIds: '',
allDeptNames: '',
streetId: null,
communityId: null,
gridId: null,
leaderFlag: '0'
},
auditStatusType: 0,
deptIdList: [],
options: [],
volunteerinfoDetailVisible: false,
volunteerinfoPointsAdjustVisible: false,
volunteerinfoCheckVisible: false
}
},
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(() => {})
},
watch: {
deptIdList: function (val) {
if (val.length === 0) {
this.dataForm.streetId = ''
this.dataForm.communityId = ''
this.dataForm.gridId = ''
}
if (val.length === 1) {
this.dataForm.streetId = this.deptIdList[0]
this.dataForm.communityId = ''
this.dataForm.gridId = ''
}
if (val.length === 2) {
this.dataForm.streetId = this.deptIdList[0]
this.dataForm.communityId = this.deptIdList[1]
this.dataForm.gridId = ''
}
if (val.length === 3) {
this.dataForm.streetId = this.deptIdList[0]
this.dataForm.communityId = this.deptIdList[1]
this.dataForm.gridId = this.deptIdList[2]
}
}
},
methods: {
//
userDetailHandle (userId) {
this.volunteerinfoDetailVisible = true
this.$nextTick(() => {
this.$refs.volunteerinfoDetail.dataForm.id = userId
this.$refs.volunteerinfoDetail.init()
})
},
//
checkHandle (userId) {
this.volunteerinfoCheckVisible = true
this.$nextTick(() => {
this.$refs.volunteerinfoCheck.dataForm.id = userId
this.$refs.volunteerinfoCheck.init()
})
},
//
pointsAdjustHandle (userId) {
this.volunteerinfoPointsAdjustVisible = true
this.$nextTick(() => {
this.$refs.volunteerinfoPointsAdjust.dataForm.id = userId
this.$refs.volunteerinfoPointsAdjust.init()
})
},
//
sexState: function (row, column) {
let state = row.sex
if (state === '0') {
return '女'
} else if (state === '1') {
return '男'
}
},
//
auditStatusState: function (row, column) {
let state = row.auditStatus
if (state === '0') {
return '未审核'
} else if (state === '1') {
return '审核通过'
} else if (state === '2') {
return '审核不通过'
}
}
},
components: {
AddOrUpdate,
volunteerinfoDetail,
volunteerinfoPointsAdjust,
volunteerinfoCheck
}
}
</script>
Loading…
Cancel
Save