4 changed files with 684 additions and 0 deletions
@ -0,0 +1,190 @@ |
|||
<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' : '120px'"> |
|||
<el-form-item> |
|||
<el-form-item label="被打分部门" prop="deptId" v-if="!dataForm.id" style="margin-left: -120px; width: 400px;"> |
|||
<el-cascader |
|||
v-model="deptIdList" |
|||
:options="options" |
|||
:props="{ checkStrictly: true }" |
|||
filterable |
|||
clearable |
|||
></el-cascader> |
|||
</el-form-item> |
|||
</el-form-item> |
|||
<el-form-item label="考核起始日" prop="monthString" style="width: 200px"> |
|||
<el-date-picker v-model="dataForm.monthString" :disabled="dataForm.id?true:false" |
|||
type="month" clearable placeholder="选择月" |
|||
value-format="yyyy-MM" format="yyyy-MM"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<!-- <el-form-item label="考核年度" prop="year"> |
|||
<el-input v-model="dataForm.year" placeholder="考核年度"></el-input> |
|||
</el-form-item> --> |
|||
<!-- <el-form-item label="考核打分类型 0-月,1-年" prop="scoreType"> |
|||
<el-input v-model="dataForm.scoreType" placeholder="考核打分类型 0-月,1-年"></el-input> |
|||
</el-form-item> --> |
|||
<el-form-item label="得分" prop="manualScore" style="width: 400px"> |
|||
<el-select v-model="dataForm.manualScore"> |
|||
<el-option |
|||
v-for="item in manualScoreType" |
|||
:key="item.id" |
|||
:label="item.name" |
|||
:value="item.id"> |
|||
</el-option> |
|||
</el-select> |
|||
</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: '', |
|||
deptId: '', |
|||
deptName: '', |
|||
month: '', |
|||
monthString: '', |
|||
year: '', |
|||
scoreType: 0, |
|||
creatorDeptId: '', |
|||
creatorDeptName: '', |
|||
score: 0, |
|||
manualScore: '', |
|||
parentDeptIds: '', |
|||
parentDeptNames: '', |
|||
allDeptIds: '', |
|||
allDeptNames: '', |
|||
revision: '', |
|||
createdBy: '', |
|||
createdTime: '', |
|||
updatedBy: '', |
|||
updatedTime: '', |
|||
delFlag: '' |
|||
}, |
|||
// 所属机构配置 |
|||
deptIdList: [], |
|||
options: [], |
|||
manualScoreType: [ |
|||
{ |
|||
'id': '优', |
|||
'name': '优' |
|||
}, |
|||
{ |
|||
'id': '良', |
|||
'name': '良' |
|||
}, |
|||
{ |
|||
'id': '中', |
|||
'name': '中' |
|||
}, |
|||
{ |
|||
'id': '差', |
|||
'name': '差' |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
deptId: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
monthString: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
manualScoreType: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
manualScore: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
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(() => {}) |
|||
}, |
|||
methods: { |
|||
init () { |
|||
this.visible = true |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
this.dataForm.allDeptNames = '' |
|||
this.dataForm.deptId = '' |
|||
if (this.dataForm.id) { |
|||
this.getInfo() |
|||
} |
|||
this.deptIdList = [] |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo () { |
|||
this.$http.get(`/kpi/manualscore-zlph/${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/manualscore-zlph/', 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 }) |
|||
}, |
|||
watch: { |
|||
'deptIdList': function (val) { |
|||
if (val.length === 0) { |
|||
this.dataForm.deptId = '' |
|||
} else if (val.length > 0) { |
|||
this.dataForm.deptId = this.deptIdList[val.length - 1] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style type="text/css"> |
|||
.el-input--suffix .el-input__inner { |
|||
padding-right: 50px |
|||
} |
|||
</style> |
|||
@ -0,0 +1,211 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div class="mod-__manualscore}"> |
|||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|||
<el-form-item> |
|||
<el-form-item label="所属机构"> |
|||
<el-cascader |
|||
v-model="deptIdList" |
|||
:options="options" |
|||
:props="{ checkStrictly: true }" |
|||
filterable |
|||
clearable |
|||
></el-cascader> |
|||
</el-form-item> |
|||
</el-form-item> |
|||
<el-form-item label="考核周期起始月"> |
|||
<el-date-picker v-model="dataForm.month" |
|||
type="month" clearable placeholder="选择月" |
|||
value-format="yyyy-MM" format="yyyy-MM"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item label="被打分机构类型"> |
|||
<el-select v-model="dataForm.deptType"> |
|||
<el-option |
|||
v-for="item in kpiManualRuleList" |
|||
:key="item.id" |
|||
:label="item.deptName" |
|||
:value="item.id"> |
|||
</el-option> |
|||
</el-select> |
|||
</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('manualscore-zlph:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="info" @click="exportTemplate()">导出录入模板</el-button> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-upload class="upload-demo" |
|||
ref="upload" |
|||
v-loading="dataListLoading" |
|||
:action="uploadUrl" |
|||
:limit="1" |
|||
:on-success='uploadSuccess' |
|||
:on-error='errorExceed' |
|||
accept=".xls,.xlsx"> |
|||
<el-button type="primary">导入打分结果</el-button> |
|||
</el-upload> |
|||
</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="deptName" label="被打分部门" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="month" :formatter="showMonthYMD" label="考核起始日" header-align="center" align="center"></el-table-column> |
|||
<!-- <el-table-column prop="year" label="考核年度" header-align="center" align="center"></el-table-column> --> |
|||
<el-table-column prop="scoreType" label="考核打分类型" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="creatorDeptName" label="打分的部门名称" header-align="center" align="center"></el-table-column> |
|||
<el-table-column prop="score" 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 type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</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 './manualscore-add-or-update-zlph' |
|||
import Cookies from 'js-cookie' |
|||
import qs from 'qs' |
|||
export default { |
|||
mixins: [mixinViewModule], |
|||
data () { |
|||
return { |
|||
mixinViewModuleOptions: { |
|||
getDataListURL: '/kpi/manualscore-zlph/page', |
|||
getDataListIsPage: true, |
|||
deleteURL: '/kpi/manualscore-zlph', |
|||
deleteIsBatch: true, |
|||
exportTemplateURL: '/kpi/manualscore-zlph/exportTemplate' |
|||
}, |
|||
dataForm: { |
|||
id: '', |
|||
deptType: 'street_party', // 被打分的机构类型 |
|||
month: '', |
|||
deptId: '', |
|||
scoreType: '0' // 考核打分类型 0-月,1-年 |
|||
}, |
|||
upLoadUrl: '', |
|||
// 所属机构配置 |
|||
deptIdList: [], |
|||
options: [], |
|||
kpiManualRuleList: [ |
|||
{ |
|||
'id': 'street_party', |
|||
'deptName': '街道' |
|||
}, |
|||
{ |
|||
'id': 'community_party', |
|||
'deptName': '社区' |
|||
}, |
|||
{ |
|||
'id': 'grid_party', |
|||
'deptName': '网格' |
|||
} |
|||
] |
|||
} |
|||
}, |
|||
components: { |
|||
AddOrUpdate |
|||
}, |
|||
created () { |
|||
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/kpi/manualscore-zlph/importManualScoreExcel?token=${Cookies.get('token')}` |
|||
// 所属机构创建 |
|||
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(() => {}) |
|||
}, |
|||
methods: { |
|||
// 导出录入模板 |
|||
exportTemplate () { |
|||
let month = this.dataForm.month |
|||
let deptType = this.dataForm.deptType |
|||
let scoreType = this.dataForm.scoreType |
|||
let deptId = this.dataForm.deptId |
|||
let params = qs.stringify({ |
|||
'token': Cookies.get('token'), |
|||
'month': month, |
|||
'deptType': deptType, |
|||
'scoreType': scoreType, |
|||
'deptId': deptId |
|||
}) |
|||
// let paramsJson = { |
|||
// 'month': month, 'deptType': deptType, 'scoreType': scoreType |
|||
// } |
|||
if (!deptType) { |
|||
return this.$message.error('考核规则不能为空') |
|||
} |
|||
if (!month) { |
|||
return this.$message.error('考核周期起始月不能为空') |
|||
} |
|||
// 表格检查 |
|||
// this.$http.get(`/kpi/manualscore-zlph/checkExportTemplate`, { params: paramsJson }).then(({ data: res }) => { |
|||
// if (res.code !== 0) { |
|||
// return this.$message.error(res.msg) |
|||
// } else { |
|||
window.location.href = `${window.SITE_CONFIG['apiURL']}${this.mixinViewModuleOptions.exportTemplateURL}?${params}` |
|||
// } |
|||
// }).catch(() => { }) |
|||
}, |
|||
errorExceed (file, fileList) { |
|||
this.$message.error('上传失败请重试') |
|||
}, |
|||
uploadSuccess (response, file, fileList) { |
|||
this.dataListLoading = false |
|||
this.$refs.upload.clearFiles() |
|||
if (response.code !== 0 || (response.data !== null && response.data.length > 0)) { |
|||
this.errordataList = response.data |
|||
if (this.errordataList != null && this.errordataList.length > 0) { |
|||
this.faultDataVisible = true |
|||
} else { |
|||
this.$message.error(response.msg) |
|||
} |
|||
return |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.getDataList() |
|||
} |
|||
}) |
|||
}, |
|||
showMonthYMD (row, column) { |
|||
return row.month.substring(0, 10) |
|||
} |
|||
}, |
|||
watch: { |
|||
'deptIdList': function (val) { |
|||
if (val.length === 0) { |
|||
this.dataForm.deptId = '' |
|||
} else if (val.length > 0) { |
|||
this.dataForm.deptId = this.deptIdList[val.length - 1] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
@ -0,0 +1,283 @@ |
|||
<template> |
|||
<el-card shadow="never" class="aui-card--fill"> |
|||
<div v-loading="loading"> |
|||
<el-form :inline="true" :model="dataForm" :rules="dataRule" ref="dataForm" |
|||
@keyup.enter.native="dataFormSubmitHandle()" |
|||
:label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|||
|
|||
<div> |
|||
<el-form-item label="党员基本情况:" label-width="120px" prop="partyCaseCategoryDTOList.0.categoryInfo" |
|||
:rules="dataRule.categoryInfo0"> |
|||
<el-input type="textarea" v-model="dataForm.partyCaseCategoryDTOList[0].categoryInfo" |
|||
style="width:800px" maxLength="200" |
|||
placeholder="请输入党员基本内容,限制200字以内"></el-input> |
|||
</el-form-item> |
|||
</div> |
|||
<div style="padding-left: 120px"> |
|||
<span class="line-h-40" style="font-weight: bold">各个街道党员人数:图表内容</span> |
|||
<el-form-item label="全区党员人数:" label-width="150px" prop="partyCaseCategoryDTOList.0.parytAmount" |
|||
:rules="dataRule.parytAmount"> |
|||
<el-input v-model="dataForm.partyCaseCategoryDTOList[0].parytAmount" |
|||
oninput="value=value.replace(/[^\d]/g,'')" |
|||
@change="parytAmountNumberChange()"></el-input> |
|||
</el-form-item> |
|||
<span class="line-h-40">名</span> |
|||
</div> |
|||
<div style="padding-left: 120px"> |
|||
<div style="width: 50%;display: inline-block;" v-for="(item,i) in dataForm.partyCaseNumberDTOList" |
|||
:key="i"> |
|||
<el-form-item :label="item.streetName" label-width="150px" |
|||
:prop="'partyCaseNumberDTOList.'+i+'.partyCount'" :rules="dataRule.countNum"> |
|||
<el-input class="input-count" @change="streetNumberChange(i,item.streetId)" |
|||
oninput="value=value.replace(/[^\d]/g,'')" |
|||
v-model="dataForm.partyCaseNumberDTOList[i].partyCount"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="占党员总数" label-width="100px" prop="categoryInfo"> |
|||
<el-input class="input-percent" :readonly="true" |
|||
v-model="dataForm.partyCaseNumberDTOList[i].partyCountPercent"></el-input> |
|||
</el-form-item> |
|||
<span class="line-h-40">%</span> |
|||
</div> |
|||
</div> |
|||
|
|||
<div> |
|||
<el-form-item label="党员年龄分布:" label-width="120px" prop="partyCaseCategoryDTOList.1.categoryInfo" |
|||
:rules="dataRule.categoryInfo1"> |
|||
<el-input type="textarea" v-model="dataForm.partyCaseCategoryDTOList[1].categoryInfo" |
|||
style="width:800px" maxLength="100" |
|||
placeholder="请输入党员年龄介绍内容,限制100字以内"></el-input> |
|||
</el-form-item> |
|||
<div style="padding-left: 120px"> |
|||
<span class="line-h-40" style="font-weight: bold">党员年龄分布:图表内容</span></div> |
|||
</div> |
|||
<div style="padding-left: 120px" v-for="(item,i) in dataForm.partyCaseDisrtibutionDTOList" |
|||
v-if="item.type==='0'"> |
|||
<el-form-item :label="item.distributionName" label-width="120px" |
|||
:prop="'partyCaseDisrtibutionDTOList.'+i+'.distributionInfoCount'" |
|||
:rules="dataRule.countNum"> |
|||
<el-input class="input-count" @change="disrtibutionNumberChange(i,item.type)" |
|||
oninput="value=value.replace(/[^\d]/g,'')" |
|||
v-model="dataForm.partyCaseDisrtibutionDTOList[i].distributionInfoCount"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="占党员总数" label-width="100px" prop="categoryInfo"> |
|||
<el-input class="input-percent" :readonly="true" |
|||
v-model="dataForm.partyCaseDisrtibutionDTOList[i].distributionInfoPercent"></el-input> |
|||
</el-form-item> |
|||
<span class="line-h-40">%</span> |
|||
</div> |
|||
|
|||
<div> |
|||
<el-form-item label="党员职业分布:" label-width="120px" prop="partyCaseCategoryDTOList.2.categoryInfo" |
|||
:rules="dataRule.categoryInfo2"> |
|||
<el-input type="textarea" v-model="dataForm.partyCaseCategoryDTOList[2].categoryInfo" |
|||
style="width:800px" maxLength="100" |
|||
placeholder="请输入党员职业介绍内容,限制100字以内"></el-input> |
|||
</el-form-item> |
|||
<div style="padding-left: 120px"> |
|||
<span class="line-h-40" style="font-weight: bold">党员职业分布:图表内容</span> |
|||
</div> |
|||
</div> |
|||
<div style="padding-left: 120px" v-for="(item,i) in dataForm.partyCaseDisrtibutionDTOList" |
|||
v-if="item.type==='1'"> |
|||
<el-form-item :label="item.distributionName" label-width="120px" |
|||
:prop="'partyCaseDisrtibutionDTOList.'+i+'.distributionInfoCount'" |
|||
:rules="dataRule.countNum"> |
|||
<el-input class="input-count" @change="disrtibutionNumberChange(i,item.type)" |
|||
v-model="dataForm.partyCaseDisrtibutionDTOList[i].distributionInfoCount"></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="占党员总数" label-width="100px" prop="categoryInfo"> |
|||
<el-input class="input-percent" :readonly="true" |
|||
v-model="dataForm.partyCaseDisrtibutionDTOList[i].distributionInfoPercent"></el-input> |
|||
</el-form-item> |
|||
<span class="line-h-40">%</span> |
|||
</div> |
|||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</el-form> |
|||
</div> |
|||
</el-card> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
dataForm: { |
|||
partyCaseCategoryDTOList: [ |
|||
{ |
|||
type: '-1', |
|||
categoryInfo: '', |
|||
parytAmount: 0, |
|||
}, { |
|||
type: '0', |
|||
categoryInfo: '', |
|||
}, { |
|||
type: '1', |
|||
categoryInfo: '', |
|||
}], |
|||
partyCaseDisrtibutionDTOList: [ |
|||
{ |
|||
distributionName: '30岁以下:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '0' |
|||
}, { |
|||
distributionName: '31至50岁:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '0' |
|||
}, { |
|||
distributionName: '51至60岁:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '0' |
|||
}, { |
|||
distributionName: '61至70岁:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '0' |
|||
}, { |
|||
distributionName: '70岁以上:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '0' |
|||
}, { |
|||
distributionName: '在岗职工:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '1' |
|||
} |
|||
, { |
|||
distributionName: '离退休人员:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '1' |
|||
} |
|||
, { |
|||
distributionName: '其他职业:', |
|||
distributionInfoCount: 0, |
|||
distributionInfoPercent: 0, |
|||
type: '1' |
|||
}], |
|||
partyCaseNumberDTOList: [], |
|||
}, |
|||
loading:true, |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule() { |
|||
return { |
|||
categoryInfo0: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
categoryInfo1: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
categoryInfo2: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
parytAmount: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
countNum: [ |
|||
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|||
], |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.init(); |
|||
}, |
|||
methods: { |
|||
init() { |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields(); |
|||
this.getInfo() |
|||
}) |
|||
}, |
|||
// 获取信息 |
|||
getInfo() { |
|||
this.$http.get(`/cloudAnalysis/partycasecategory/getDetail`).then(({data: res}) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
if (res.data.partyCaseCategoryDTOList.length > 0) { |
|||
this.dataForm.partyCaseCategoryDTOList = res.data.partyCaseCategoryDTOList; |
|||
} |
|||
if (res.data.partyCaseDisrtibutionDTOList.length > 0) { |
|||
this.dataForm.partyCaseDisrtibutionDTOList = res.data.partyCaseDisrtibutionDTOList; |
|||
} |
|||
if (res.data.partyCaseNumberDTOList.length > 0) { |
|||
this.dataForm.partyCaseNumberDTOList = res.data.partyCaseNumberDTOList; |
|||
} else { |
|||
this.getStreetInfo(); |
|||
} |
|||
this.loading=false; |
|||
}).catch(() => { |
|||
this.loading=false; |
|||
}); |
|||
}, |
|||
// 获取街道信息 |
|||
getStreetInfo() { |
|||
this.$http.get(`/cloudAnalysis/partycasenumber/getStreet`).then(({data: res}) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.dataForm.partyCaseNumberDTOList = res.data; |
|||
}).catch(() => { |
|||
}) |
|||
}, |
|||
// 计算占比 |
|||
streetNumberChange(i, streetId) { |
|||
this.dataForm.partyCaseNumberDTOList[i].partyCountPercent = parseInt(Math.round(100 * this.dataForm.partyCaseNumberDTOList[i].partyCount / this.dataForm.partyCaseCategoryDTOList[0].parytAmount)) |
|||
}, |
|||
disrtibutionNumberChange(i, type) { |
|||
this.dataForm.partyCaseDisrtibutionDTOList[i].distributionInfoPercent = parseFloat((100 * this.dataForm.partyCaseDisrtibutionDTOList[i].distributionInfoCount / this.dataForm.partyCaseCategoryDTOList[0].parytAmount).toFixed(2)) |
|||
}, |
|||
parytAmountNumberChange() { |
|||
for (const i of this.dataForm.partyCaseNumberDTOList) { |
|||
i.partyCountPercent = parseInt(Math.round(100 * i.partyCount / this.dataForm.partyCaseCategoryDTOList[0].parytAmount)) |
|||
} |
|||
for (const i of this.dataForm.partyCaseDisrtibutionDTOList) { |
|||
i.distributionInfoPercent = parseFloat((100 * i.distributionInfoCount / this.dataForm.partyCaseCategoryDTOList[0].parytAmount).toFixed(2)) |
|||
} |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.$http[!this.dataForm.partyCaseCategoryDTOList[0].id ? 'post' : 'put']('/cloudAnalysis/partycasecategory/', 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.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => { |
|||
}) |
|||
}) |
|||
}, 1000, {'leading': true, 'trailing': false}) |
|||
} |
|||
} |
|||
</script> |
|||
<style scoped> |
|||
.line-h-40 { |
|||
line-height: 40px; |
|||
} |
|||
|
|||
.input-count { |
|||
width: 150px; |
|||
} |
|||
|
|||
.input-percent { |
|||
width: 70px; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue