This commit is contained in:
2025-10-19 13:43:18 +08:00
parent 95133e6aca
commit c9e825ecb9
8 changed files with 227 additions and 51 deletions
@@ -45,6 +45,7 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
<el-form-item label="是否用于报名" prop="isEnrollSystem">
<el-radio-group v-model="formData.isEnrollSystem" size="small">
<el-radio border :label="true">活动报名</el-radio>
<el-radio border :label="false">活动管理</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
@@ -326,7 +327,8 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
</el-col>
<el-col :span="24">
<el-form-item label="报名表单" prop="formConfig">
<el-form-item label="报名表单" prop="formConfig"
v-if="formData.isEnrollSystem === true">
<custom-form-field v-model="formData.formConfig"></custom-form-field>
</el-form-item>
</el-col>
@@ -352,10 +354,10 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
<el-table :data="formData.goods" border height="200" size="mini"
style="width: 100%">
<el-table-column align="center" header-align="center" label="序号" sortable
<el-table-column label="序号" sortable
type="index" width="100">
</el-table-column>
<el-table-column align="center" header-align="center" label="物品名称"
<el-table-column label="物品名称"
prop="name">
<template slot-scope="{row}">
<el-input maxlength="50" placeholder="物品名称"
@@ -363,7 +365,7 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
v-model="row.name"></el-input>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="预算费用"
<el-table-column label="预算费用"
prop="price">
<template slot-scope="{row}">
<el-input maxlength="50"
@@ -371,7 +373,7 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
type="number" v-model="row.price"></el-input>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="实际费用"
<el-table-column label="实际费用"
prop="actualPrice">
<template slot-scope="{row}">
<el-input maxlength="50"
@@ -379,8 +381,7 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
type="number" v-model="row.actualPrice"></el-input>
</template>
</el-table-column>
<el-table-column align="center" fixed="right"
header-align="center"
<el-table-column fixed="right"
label="操作"
width="80px">
<template slot-scope="scope">
@@ -477,8 +478,11 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
</el-form>
<el-row type="flex" justify="end" class="mt20">
<el-button type="primary" plain @click="onSave">保存</el-button>
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交</el-button>
<el-button type="primary" @click="onFinishTask" v-else>提交</el-button>
<template v-if="formData.isEnrollSystem">
<el-button type="primary" @click="onSubmit" v-if="!taskId">提交</el-button>
<el-button type="primary" @click="onFinishTask" v-else>提交</el-button>
</template>
</el-row>
</el-card>
@@ -543,7 +547,8 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
address: [{required: true, message: "必填", trigger: ["blur", "change"]}],
plannedDate: [{required: true, message: "必填", trigger: ["blur", "change"]}],
time: [{required: true, message: "必填", trigger: ["blur", "change"]}],
cover: [{required: true, message: "必填", trigger: ["blur", "change"]}]
cover: [{required: true, message: "必填", trigger: ["blur", "change"]}],
signUpMethod: [{required: true, message: "必填", trigger: ["blur", "change"]}]
},
projectTypeList: [],
@@ -612,8 +617,10 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
formData.endPlannedDate = formData.plannedDate[1]
formData.plannedDate = null
}
this.$axios.post('/platform/activity/culture/applyActivity/save', {data: JSON.stringify(formData)}).then(res => {
this.$axios.post('/platform/activity/culture/applyActivity/save', {
data: JSON.stringify(formData),
userData: JSON.stringify(this.userData)
}).then(res => {
if (res.code === 0) {
this.$message.success("保存成功")
this.$emit("goBack")
@@ -725,8 +732,9 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
}
},
doAddUser() {
this.formData.tissuePersonList = this.userList.filter((v) => this.formData.tissuePersonList.some((x) => v.userId === x))
this.userData = this.userData.concat(this.formData.tissuePersonList)
const userList = this.userList.filter(v => this.formData.tissuePersonList.some(x => v.userId === x))
this.userData = this.userData.concat(userList)
this.formData.tissuePersonList = this.userData
this.userDialogVisible = false
},
async delUser(row) {
@@ -919,8 +927,8 @@ const ACTIVITY_CULTURE_APPLY_ACTIVITY = {
}
},
openEdit(row) {
this.taskId=row.startTaskId
this.bizId=row.id
this.taskId = row.startTaskId
this.bizId = row.id
this.activeName = "1"
this.init(row.id)
}
@@ -8,7 +8,7 @@ layout("/layouts/platform.html"){
<template>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="编号/名称">
<search-item label="年度">
<el-date-picker placeholder="按年度查询" type="year" v-model="pageForm.year"
value-format="yyyy"></el-date-picker>
</search-item>
@@ -31,6 +31,7 @@ layout("/layouts/platform.html"){
</el-card>
<el-card shadow="never">
<table-tool label="名额分配列表">
<el-button
size="small"
@@ -68,6 +69,7 @@ layout("/layouts/platform.html"){
return {
sessionOptions: [],
unionOptions: [],
}
},
components: {
@@ -2,7 +2,55 @@ const MANUAL_ALLOCATION_DIALOG = {
template: /*language=HTML*/ `
<el-dialog :visible.sync="manualAllocationDialog" title="手动分配名额" width="80%" :close-on-click-modal="false"
top="50px">
<table-tool label="分段设置">
<el-button @click="unionLimitQuickSetting" size="small"
type="primary">
应用分段设置
</el-button>
</table-tool>
<el-row :gutter="20" :key="index"
class="mb5" v-for="(item,index) in unionUserNumCalc">
<el-col :span="7">
<el-input-number :min="1" :precision="0"
:step="1" placeholder="请输入最小人数"
style="width: 100%"
v-model="item.startNum"></el-input-number>
</el-col>
<el-col :span="7">
<el-input-number :min="1" :precision="0"
:step="1" placeholder="请输入最大人数"
style="width: 100%"
v-model="item.endNum"></el-input-number>
</el-col>
<el-col :span="6">
<el-input-number :min="1" :precision="0"
:step="1" placeholder="请输入限制百分比"
style="width: 100%"
v-model="item.resultNum"></el-input-number>
</el-col>
<el-col :span="4" class="text-right">
<el-button @click="unionUserNumCalc.push({})"
icon="el-icon-plus"></el-button>
<el-button :disabled="unionUserNumCalc.length===1"
@click="unionUserNumCalc.splice(index,1)"
icon="el-icon-minus"></el-button>
</el-col>
</el-row>
<el-row class="mt10">
<div class="text-danger"
v-for="(item,index) in unionUserNumCalcTips">
<span class="mr10">({{index+1}}).</span> {{item}}
</div>
</el-row>
<table-tool label="比例设置">
<el-select v-model="settingsType"
placeholder="需要设置的列表"
style="width: 30%;">
<el-option :label="item.label"
:value="item.value"
:key="item.value"
v-for="item in settingsTypeOptions"></el-option>
</el-select>
一键比例:
<el-input-number
style="width: 150px"
@@ -23,7 +71,8 @@ const MANUAL_ALLOCATION_DIALOG = {
</el-button>
</table-tool>
<el-table :data="unionLimit" max-height="500">
<el-table :data="unionLimit" max-height="500" :summary-method="getSummaries"
show-summary>
<el-table-column prop="unionName" label="分工会"></el-table-column>
<el-table-column prop="memberCount" label="会员人数"></el-table-column>
<el-table-column align="center" prop="ratio" label="比例(%)">
@@ -59,7 +108,7 @@ const MANUAL_ALLOCATION_DIALOG = {
:precision="0"
:step="1"
:min="0"
:max="row.quota"
:max="row.allocationNum"
></el-input-number>
</template>
</el-table-column>
@@ -71,7 +120,7 @@ const MANUAL_ALLOCATION_DIALOG = {
:precision="0"
:step="1"
:min="0"
:max="row.quota"
:max="row.allocationNum"
></el-input-number>
</template>
</el-table-column>
@@ -83,7 +132,7 @@ const MANUAL_ALLOCATION_DIALOG = {
:precision="0"
:step="1"
:min="0"
:max="row.quota"
:max="row.allocationNum"
></el-input-number>
</template>
</el-table-column>
@@ -95,7 +144,7 @@ const MANUAL_ALLOCATION_DIALOG = {
:precision="0"
:step="1"
:min="0"
:max="row.quota"
:max="row.allocationNum"
></el-input-number>
</template>
</el-table-column>
@@ -107,7 +156,7 @@ const MANUAL_ALLOCATION_DIALOG = {
:precision="0"
:step="1"
:min="0"
:max="row.quota"
:max="row.allocationNum"
></el-input-number>
</template>
</el-table-column>-->
@@ -119,7 +168,7 @@ const MANUAL_ALLOCATION_DIALOG = {
:precision="0"
:step="1"
:min="0"
:max="row.quota"
:max="row.allocationNum"
></el-input-number>
</template>
</el-table-column>
@@ -131,7 +180,7 @@ const MANUAL_ALLOCATION_DIALOG = {
:precision="0"
:step="1"
:min="0"
:max="row.quota"
:max="row.allocationNum"
></el-input-number>
</template>
</el-table-column>
@@ -150,12 +199,94 @@ const MANUAL_ALLOCATION_DIALOG = {
data() {
return {
unionUserNumOneKeyRatio: null,
settingsType: "allocationNum",
sessionId: "",
unionLimit: [],
manualAllocationDialog: false,
unionUserNumCalc: [{}],
unionUserNumCalcTips: [],
settingsTypeOptions: [
{label: "分配人数", value: "allocationNum"},
{label: "高级职称代表数", value: "seniorTeaNum"},
{label: "中级职称及以下代表数", value: "intermediateBelowNum"},
{label: "干部代表数", value: "cadreNum"},
{label: "工人代表数", value: "workerNum"},
{label: "女代表数", value: "femaleNum"},
{label: "45岁以下代表数", value: "less45Num"},
]
}
},
methods: {
getSummaries(param) {
const {columns, data} = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '占代表总数的';
return;
}
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
if (index === 2) {
sums[index] = null;
} else if ([1, 3].includes(index)) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return Math.floor((prev + curr) * 100) / 100;
} else {
return prev;
}
}, 0);
sums[index] += ' 人';
} else {
const part = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return Math.floor((prev + curr) * 100) / 100;
} else {
return prev;
}
}, 0);
const totalValues = data.map(item => Number(item.allocationNum));
const total = totalValues.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return Math.floor((prev + curr) * 100) / 100;
} else {
return prev;
}
}, 0);
sums[index] = ((part / total) * 100).toFixed(2) + ' %'
console.log(((part / total) * 100).toFixed(2))
}
} else {
sums[index] = null;
}
});
return sums;
},
unionLimitQuickSetting() {
this.unionUserNumCalc.forEach((v, i) => {
const startNum = v.startNum
const endNum = v.endNum
const resultNum = v.resultNum
if (startNum > endNum) {
this.notifyWarning("第" + (i + 1) + "行设置错误")
} else {
this.unionLimit.forEach((x) => {
if (x.memberCount >= startNum && x.memberCount <= endNum) {
x.ratio = resultNum
const num = parseFloat((v.memberCount * x.ratio / 100).toFixed(0))
v.allocationNum = (num === 0 ? 1 : num)
}
})
this.$forceUpdate()
}
})
},
async doManualAllocationSub() {
const hasNull = this.unionLimit.some(v => v.allocationNum === undefined)
if (hasNull) {
@@ -196,12 +327,13 @@ const MANUAL_ALLOCATION_DIALOG = {
}
},
applyScaleSettings() {
const settingsType = this.settingsTypeOptions.find(v => v.value === this.settingsType)
this.unionLimit.forEach(v => {
v.ratio = this.unionUserNumOneKeyRatio
if (v.ratio) {
const num = parseFloat((v.memberCount * v.ratio / 100).toFixed(0))
v.allocationNum = (num === 0 ? 1 : num)
if (settingsType.value === "allocationNum") {
v.ratio = this.unionUserNumOneKeyRatio
}
const num = parseFloat((v.memberCount * this.unionUserNumOneKeyRatio / 100).toFixed(0))
v[settingsType.value] = (num === 0 ? 1 : num)
})
},
ratioChange(val, index) {
@@ -219,7 +351,10 @@ const MANUAL_ALLOCATION_DIALOG = {
},
async onOpen(sessionId) {
this.sessionId = sessionId
this.unionUserNumCalc = [{}]
this.manualAllocationDialog = true
this.unionUserNumOneKeyRatio = 0
this.settingsType = "allocationNum"
this.getUnionUsers()
}
}