|
|
@ -56,7 +56,7 @@ |
|
|
|
<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'" :key="i"> |
|
|
|
v-if="item.type==='0'"> |
|
|
|
<el-form-item :label="item.distributionName" label-width="120px" |
|
|
|
:prop="'partyCaseDisrtibutionDTOList.'+i+'.distributionInfoCount'" |
|
|
|
:rules="dataRule.countNum"> |
|
|
@ -83,11 +83,12 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div style="padding-left: 120px" v-for="(item,i) in dataForm.partyCaseDisrtibutionDTOList" |
|
|
|
v-if="item.type==='1'" :key="i"> |
|
|
|
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)" |
|
|
|
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"> |
|
|
@ -103,178 +104,179 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import debounce from 'lodash/debounce' |
|
|
|
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' } |
|
|
|
], |
|
|
|
sort: [ |
|
|
|
{ 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') |
|
|
|
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'} |
|
|
|
], |
|
|
|
sort: [ |
|
|
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'} |
|
|
|
], |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, 1000, { 'leading': true, 'trailing': false }) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
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 { |
|
|
|