Browse Source

治理排行管理 - 目标管理功能开发 及 街道人员底数页面生成

master
zhangyongzhangyong 6 years ago
parent
commit
f290c52ce9
  1. 106
      src/views/modules/kpi/streetpersiongoalmonth-add-or-update.vue
  2. 186
      src/views/modules/kpi/streetpersiongoalmonth.vue
  3. 110
      src/views/modules/kpi/streetpersonbase-add-or-update.vue
  4. 65
      src/views/modules/kpi/streetpersonbase.vue

106
src/views/modules/kpi/streetpersiongoalmonth-add-or-update.vue

@ -0,0 +1,106 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false" width="30%" center>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '120px'">
<el-form-item label="年月" prop="monthYear">
<el-date-picker v-model="dataForm.monthYear"
type="month" clearable placeholder="选择月" style="width: 300px;" :disabled="dataForm.id?true:false"
value-format="yyyy-MM" format="yyyy-MM">
</el-date-picker>
</el-form-item>
<el-form-item label="群众目标比例" prop="residentGoalNum">
<el-input v-model="dataForm.residentGoalNum" placeholder="群众目标数" style="width: 300px;"></el-input>
<span>%</span>
</el-form-item>
<el-form-item label="党员目标比例" prop="partyGoalNum">
<el-input v-model="dataForm.partyGoalNum" placeholder="党员目标数" style="width: 300px;"></el-input>
<span>%</span>
</el-form-item>
<el-form-item label="企业目标比例" prop="companyGoalNum">
<el-input v-model="dataForm.companyGoalNum" placeholder="企业目标数" style="width: 300px;"></el-input>
<span>%</span>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()" :loading="loadingbut">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
dataForm: {
id: '',
street: '',
streetId: '',
monthYear: '',
residentGoalNum: '',
partyGoalNum: '',
companyGoalNum: ''
},
loadingbut: false, //
loadingbuttext: '确定'
}
},
computed: {
dataRule () {
return {
monthYear: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
residentGoalNum: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
partyGoalNum: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
companyGoalNum: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
]
}
}
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
// this.dataForm.id
this.dataForm.monthYear = this.dataForm.id
})
},
//
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false
}
this.loadingbut = true
this.loadingbuttext = '审核中...'
this.$http[!this.dataForm.id ? 'post' : 'put']('/kpi/streetpersiongoalmonth/', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
this.loadingbut = false
this.loadingbuttext = '确定'
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
this.loadingbut = false
this.loadingbuttext = '确定'
}
})
}).catch(() => {})
})
}, 1000, { 'leading': true, 'trailing': false })
}
}
</script>

186
src/views/modules/kpi/streetpersiongoalmonth.vue

@ -0,0 +1,186 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-__streetpersiongoalmonth}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-button type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="streetGoalScore" border @selection-change="dataListSelectionChangeHandle" @cell-click="clickCell" style="width: 100%;">
<el-table-column prop='monthYear' label="日期" width="100" header-align="center"></el-table-column>
<el-table-column v-for="(header, index) in headerContent" :key="index" :label="header.street" header-align="center">
<el-table-column :prop="header.streetId+'-ResidentGoalNum'" label="群众目标数" header-align="center"></el-table-column>
<el-table-column :prop="header.streetId+'-PartyGoalNum'" label="党员目标数" header-align="center"></el-table-column>
<el-table-column :prop="header.streetId+'-CompanyGoalNum'" label="企业目标数" header-align="center"></el-table-column>
</el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="100">
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.monthYear)" :disabled="scope.row.isDisabled=='0'">批量设置</el-button>
</template>
</el-table-column>
</el-table>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getStreetGoalScore"></add-or-update>
</div>
<div>
<el-dialog title="街道目标数设定" :visible.sync="dialogFormVisible" width="30%" center>
<el-form :model="dataForm">
<el-form-item label="目标比例" label-width="120px">
<el-input v-model="goalProportion" style="width: 300px;"></el-input>
<span>%</span>
</el-form-item>
<el-form-item label="目标人数" label-width="120px">
<el-input v-model="goalNumber" style="width: 300px;"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="upCellGoalNumber"> </el-button>
</div>
</el-dialog>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './streetpersiongoalmonth-add-or-update'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getStreetGoalName: '/kpi/streetpersiongoalmonth/queryStreetGoalName',
getDataListURL: '/kpi/streetpersiongoalmonth/streetGoalScore',
getDataListIsPage: true,
deleteURL: '/kpi/streetpersiongoalmonth',
deleteIsBatch: true
},
dataForm: {
id: '',
streetId: '',
monthYear: ''
},
isAddOrUpdateHandle: true,
headerContent: [], //
streetGoalScore: [], //
dialogFormVisible: false, // dialog
goalProportion: '', //
goalNumber: '', //
personBasicNumber: '', // //
personBasicNumberKey: '' // key{//}
}
},
created () {
this.getStreetName()
this.getStreetGoalScore()
},
watch: {
//
goalProportion: function (val) {
if (val.length === 0) {
this.goalProportion = ''
} else {
this.goalNumber = Math.round(this.personBasicNumber * (this.goalProportion / 100))
}
}
},
methods: {
//
getStreetName () {
this.$http
.get(`/kpi/streetpersiongoalmonth/queryStreetGoalName`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.headerContent = res.data
})
.catch(() => {})
},
//
getStreetGoalScore () {
this.$http
.get(`/kpi/streetpersiongoalmonth/streetGoalScore`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.streetGoalScore = res.data
})
.catch(() => {})
},
//
clickCell (row, column, event, cell) {
this.goalProportion = ''
this.goalNumber = ''
var columnId = column.property
if (columnId === 'monthYear') {
return false
}
if (column.property === undefined || column.property === '') {
return false
}
this.dialogFormVisible = true
this.dataForm.streetId = columnId // ID1202869594882400257-PartyGoalNum
// this.personBasicNumber = row[columnId] //
this.dataForm.monthYear = row.monthYear //
this.getStreetPersonBase(this.dataForm.streetId)
},
//
getStreetPersonBase (splicedStreetId) {
var streetId = splicedStreetId.split('-')
//
this.$http
.get(`/kpi/streetpersonbase/getStreetPersonBase/${streetId[0]}`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
if (streetId[1] === 'CompanyGoalNum') {
this.personBasicNumber = res.data.companyBaseNum
this.personBasicNumberKey = 'CompanyGoalNum'
} else if (streetId[1] === 'ResidentGoalNum') {
this.personBasicNumber = res.data.residentBaseNum
this.personBasicNumberKey = 'ResidentGoalNum'
} else if (streetId[1] === 'PartyGoalNum') {
this.personBasicNumber = res.data.partyBaseNum
this.personBasicNumberKey = 'PartyGoalNum'
}
})
.catch(() => {})
},
//
upCellGoalNumber () {
if (this.goalProportion.length === 0) {
return this.$message.error('请输入目标比例')
}
var streetId = this.dataForm.streetId.split('-')
var upCellForm = {
'streetId': streetId[0],
'monthYear': this.dataForm.monthYear,
'personBasicNumberKey': this.personBasicNumberKey,
'goalNumber': this.goalNumber
}
this.$http['post'](
'/kpi/streetpersiongoalmonth/updateStreetGoalScore', upCellForm).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.dialogFormVisible = false
this.getStreetGoalScore()
}
})
}).catch(() => {})
}
},
components: {
AddOrUpdate
}
}
</script>

110
src/views/modules/kpi/streetpersonbase-add-or-update.vue

@ -0,0 +1,110 @@
<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="街道" prop="street">
<el-input v-model="dataForm.street" placeholder="街道"></el-input>
</el-form-item>
<el-form-item label="街道ID" prop="streetId">
<el-input v-model="dataForm.streetId" placeholder="街道ID"></el-input>
</el-form-item>
<el-form-item label="群众底数" prop="residentBaseNum">
<el-input v-model="dataForm.residentBaseNum" placeholder="群众底数"></el-input>
</el-form-item>
<el-form-item label="党员底数" prop="partyBaseNum">
<el-input v-model="dataForm.partyBaseNum" placeholder="党员底数"></el-input>
</el-form-item>
<el-form-item label="企业底数" prop="companyBaseNum">
<el-input v-model="dataForm.companyBaseNum" 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: '',
street: '',
streetId: '',
residentBaseNum: '',
partyBaseNum: '',
companyBaseNum: ''
}
}
},
computed: {
dataRule () {
return {
street: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
streetId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
residentBaseNum: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
partyBaseNum: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
companyBaseNum: [
{ 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(`/kpi/streetpersonbase/${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']('/kpi/streetpersonbase/', 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>

65
src/views/modules/kpi/streetpersonbase.vue

@ -0,0 +1,65 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-__streetpersonbase}">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.id" placeholder="id" 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(':streetpersonbase:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
<el-table-column prop="street" label="街道" header-align="center" align="center"></el-table-column>
<el-table-column prop="residentBaseNum" label="群众底数" header-align="center" align="center"></el-table-column>
<el-table-column prop="partyBaseNum" label="党员底数" header-align="center" align="center"></el-table-column>
<el-table-column prop="companyBaseNum" label="企业底数" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button v-if="$hasPermission(':streetpersonbase:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button v-if="$hasPermission(':streetpersonbase:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</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>
</div>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './streetpersonbase-add-or-update'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/kpi/streetpersonbase/page',
getDataListIsPage: true,
deleteURL: '/kpi/streetpersonbase',
deleteIsBatch: true
},
dataForm: {
id: '',
streetId: ''
}
}
},
components: {
AddOrUpdate
}
}
</script>
Loading…
Cancel
Save