Files
zhgh_hhu/target/classes/views/platform/zgfw/lxy/HdMange.html
T
2026-09-20 15:46:34 +08:00

1127 lines
58 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--#
layout("/layouts/platform.html"){
#-->
<style>
input[type="file"] {
display: none
}
.w-e-text-container {
height: 250px !important;
}
.v-box .el-card__header {
padding: 5px 15px;
}
.el-select-dropdown {
z-index: 99999999 !important;
}
.el-loading-mask {
z-index: 99999999 !important;
}
.el-picker-panel {
z-index: 99999999 !important;
}
.d-select {
width: 300px;
}
.hdnr .el-form-item__label:before {
content: '*';
color: #F56C6C;
margin-right: 4px;
}
</style>
<div id="app" v-cloak>
<guava>
<el-row class="transition-row">
<transition name="el-zoom-in-center">
<div class="transition-item" v-show="v=='index'">
<el-card shadow="never">
<div class="btn-group tool-button mt5">
<el-date-picker
placeholder="选择年度"
type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
<div class="btn-group tool-button mt5">
<el-select class="d-select" clearable filterable
placeholder="请选择休养"
v-model="pageForm.pastQuota"
width="300px">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in lxyHd">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-select class="d-select" clearable filterable placeholder="请选择场地"
v-model="pageForm.hdcd"
width="300px">
<el-option
:key="item.id"
:label="item.hdcd"
:value="item.id"
v-for="item in lxyHdCd">
</el-option>
</el-select>
</div>
<div class="btn-group tool-button mt5">
<el-button @click="doSearch" icon="el-icon-search"
type="primary"></el-button>
</div>
<div class="pull-right offscreen-right mt5">
<el-button @click="openAdd" icon="el-icon-plus">创建休养</el-button>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<el-table :data="tableData" @sort-change="pageOrder" row-key="id"
style="width: 100%"
v-loading="tabLoading">
<el-table-column align="center" header-align="center" label="序号"
width="100px">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="休养名称"
prop="name"
width="300px">
<template scope="scope">
<el-link @click="lxy_app.openView(scope.row.id)" type="primary">
{{scope.row.name}}
</el-link>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="休养场地"
prop="hdcd"
show-overflow-tooltip></el-table-column>
<el-table-column align="center" header-align="center" label="休养时间"
prop="hdkssj"
sortable>
<template scope="scope">
{{scope.row.hdkssj}} 至 {{scope.row.hdjssj}}
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="报名时间"
prop="bmsj"
sortable width="330px">
<template scope="scope">
{{scope.row.bmkssj}} 至 {{scope.row.bmjzsj}}
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="状态"
prop="name">
<template scope="scope">
<span :class="lxy_app.getStatus(scope.row).class">{{lxy_app.getStatus(scope.row).name}}</span>
</template>
</el-table-column>
<el-table-column align="center" fixed="right" header-align="center"
label="操作"
width="250px">
<template scope="scope">
<!-- <el-button size="mini" @click="openView(scope.row.id)">查看</el-button>-->
<el-button @click="openEdit(scope.row.id)" plain
size="mini" type="primary">编辑
</el-button>
<el-button @click="doDelete(scope.row.id)" plain
size="mini" type="danger">删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
:current-page="pageForm.pageNumber"
:page-size="pageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="pageNumberChange"
@size-change="pageSizeChange"
layout="total, sizes, prev, pager, next">
</el-pagination>
</el-row>
</el-card>
</div>
</transition>
<!-- 新增 -->
<transition name="el-zoom-in-center">
<div class="transition-item" v-show="v=='add'">
<el-card class="box-card v-box" shadow="never">
<div class="clearfix" slot="header">
<el-button @click="v='index'" icon="el-icon-back"
style="font-size: 18px"
type="text">返回
</el-button>
</div>
<el-row style="padding: 0 10%;" v-loading="loading">
<el-steps :active="stepActive" finish-status="success" simple>
<el-step description="" title="休养信息">
</el-step>
<el-step description="" title="名额分配">
</el-step>
</el-steps>
<transition name="el-zoom-in-top">
<div class="transition-box" style="margin-top: 20px;"
v-show="stepActive==0">
<el-form :model="formData" :rules="formRules"
label-width="120px"
ref="form">
<el-form-item class="view-header" label="填写休养信息&emsp;"
label-width="135px">
</el-form-item>
<el-form-item label="休养名称" prop="name">
<el-input maxlength="100" placeholder="请填写休养名称"
type="text"
v-model="formData.name"></el-input>
</el-form-item>
<el-row gutter="20">
<el-col :span="12">
<el-form-item label="报名时间" label-width="120px"
prop="bmsj">
<el-date-picker
align="right"
end-placeholder="结束日期"
start-placeholder="开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.bmsj"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="休养时间" prop="hdsj">
<el-date-picker
align="right"
end-placeholder="结束日期"
start-placeholder="开始日期"
style="width: 100%"
type="daterange"
v-model="formData.hdsj"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="休养场地" prop="hdcd">
<el-input maxlength="100" placeholder="请填写休养场地"
type="text"
v-model="formData.hdcd"></el-input>
</el-form-item>
<el-form-item label="报名条件" prop="hdzysx">
<el-input maxlength="500" placeholder="请填写报名条件"
rows="4" type="textarea"
v-model="formData.hdzysx"></el-input>
</el-form-item>
<div class="hdnr">
<el-form-item label="具体要求" prop="hdnr">
<div id="lrEditor"></div>
</el-form-item>
</div>
<el-form-item label="附件上传" prop="accessory">
<el-upload
:auto-upload="false"
:file-list="fileList"
:on-change="handleChange"
:on-remove="handleRemove"
action="**"
limit="5"
name="file"
ref="upload">
<el-button size="small" type="primary">选择文件
</el-button>
</el-upload>
</el-form-item>
</el-form>
<div style="float: right;margin: 20px 0">
<el-button @click="next" type="primary">下一步</el-button>
</div>
</div>
</transition>
<transition name="el-zoom-in-bottom">
<div class="transition-box" style="margin-top: 20px;" v-show="stepActive==1">
<vi-title2 title="分段设置">
<template #func>
<el-button size="small" type="primary" @click="unionLimitQuickSetting">
应用分段设置
</el-button>
</template>
</vi-title2>
<el-row v-for="(item,index) in unionUserNumCalc" :gutter="20" class="mb5">
<el-col :span="7">
<el-input-number v-model="item.startNum" :precision="0" :step="1" :min="1"
placeholder="请输入最小人数"
style="width: 100%"></el-input-number>
</el-col>
<el-col :span="7">
<el-input-number v-model="item.endNum" :precision="0" :step="1" :min="1"
placeholder="请输入最大人数"
style="width: 100%"></el-input-number>
</el-col>
<el-col :span="6">
<el-input-number v-model="item.resultNum" :precision="0" :step="1" :min="1"
placeholder="请输入限制人数"
style="width: 100%"></el-input-number>
</el-col>
<el-col :span="4" class="text-right">
<el-button icon="el-icon-plus"
@click="unionUserNumCalc.push({})"></el-button>
<el-button icon="el-icon-minus" @click="unionUserNumCalc.splice(index,1)"
:disabled="unionUserNumCalc.length===1"></el-button>
</el-col>
</el-row>
<el-row class="mt10">
<div v-for="(item,index) in unionUserNumCalcTips" class="text-danger">
<span class="mr10">({{index+1}}).</span> {{item}}
</div>
</el-row>
<vi-title2 title="比例设置" class="mt20">
<template #func>
一键比例:
<el-input-number v-model="unionUserNumOneKeyRatio" :precision="0" :step="1"
:min="0"
placeholder="请输入一键比例"
size="small"
:max="100"></el-input-number>
<el-button size="small" type="primary" @click="applyScaleSettings"
class="ml5">应用比例设置
</el-button>
</template>
</vi-title2>
<el-table :data="unionUserNumberLimit" max-height="500px">
<el-table-column prop="unionname" label="分工会"></el-table-column>
<el-table-column prop="teacherCount" label="人数"></el-table-column>
<el-table-column prop="ratio" label="比例(%)">
<template scope="{row}">
<el-input-number v-model="row.ratio" :precision="0" :step="1" :min="0"
:max="100"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="limitNum" label="限制人数">
<template scope="{row}">
<el-input-number v-model="row.limitNum" :precision="0" :step="1"
:min="0"
:max="row.teacherCount"
@change="calSummaryCount"></el-input-number>
</template>
</el-table-column>
</el-table>
<el-row class="mt20" justify="end" type="flex">
<div class="text-danger"
style="width: 100%;font-size: 18px;display: flex;align-items: center;font-weight: bold">
限制总人数:{{summaryCount}}人
</div>
<el-button @click="clearUnionLimit" type="danger">清空分工会人数限制</el-button>
<!--<el-button @click="setUpUnionLimitDialog=false">取消</el-button>-->
<!--<el-button @click="doConfirmSetUpUnionLimit" type="primary">确定</el-button>-->
</el-row>
<!--<div class="pull-right offscreen-right mt5">
<span style="color:#409EFF">沿用之前活动名额&nbsp;&nbsp;</span>
<el-select @change="mefpChange" class="d-select" clearable
filterable
placeholder="请选择活动"
v-model="pastQuota" width="300px">
<el-option
:key="item.id"
:label="item.name"
:value="item.id"
v-for="item in lxyHd">
</el-option>
</el-select>
</div>
<el-table :data="unions_" height="70vh" size="medium">
<el-table-column align="center" header-align="center"
label="序号"
type="index"></el-table-column>
<el-table-column label="分工会" prop="unionname" sortable>
<template scope="{row}">
{{isDisPlayCode?'('+row.unioncode+')':null}}{{row.unionname}}
</template>
</el-table-column>
<el-table-column label="会员人数" prop="membercount"
sortable></el-table-column>
<el-table-column align="center" header-align="center"
label="名额" prop="number"
width="200px">
<template scope="scope">
<el-input-number :max="1000"
:min="0"
controls-position="right"
placeholder="请填写名额数"
v-model="scope.row.number"></el-input-number>
</template>
</el-table-column>
</el-table>-->
<div style="float: right;margin: 20px 0">
<el-button @click="stepActive=0">上一步</el-button>
<el-button :disabled="subDis" @click="doAdd()"
type="primary">提
交
</el-button>
</div>
</div>
</transition>
</el-row>
</el-card>
</div>
</transition>
<!-- 编辑 -->
<transition name="el-zoom-in-center">
<div class="transition-item" v-show="v=='edit'">
<el-card class="box-card v-box" shadow="never">
<div class="clearfix" slot="header">
<el-button @click="v='index'" icon="el-icon-back"
style="font-size: 18px"
type="text">返回
</el-button>
</div>
<el-row style="padding: 0 10%;" v-loading="loading">
<el-tabs stretch v-model="tabs_active">
<el-tab-pane label="休养信息" name="1">
<el-form :model="formData" :rules="formRules"
label-width="120px"
ref="form">
<vi-title title="修改休养信息"></vi-title>
<el-form-item label="休养名称" prop="name">
<el-input maxlength="100" placeholder="请填写休养名称"
type="text"
v-model="formData.name"></el-input>
</el-form-item>
<el-row gutter="20">
<el-col :span="12">
<el-form-item label="报名时间" label-width="120px"
prop="bmsj">
<el-date-picker
align="right"
end-placeholder="结束日期"
start-placeholder="开始日期"
style="width: 100%"
type="datetimerange"
v-model="formData.bmsj"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="休养时间" prop="hdsj">
<el-date-picker
align="right"
end-placeholder="结束日期"
start-placeholder="开始日期"
style="width: 100%"
type="daterange"
v-model="formData.hdsj"
value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="休养场地" prop="hdcd">
<el-input maxlength="100" placeholder="请填写休养场地"
type="text"
v-model="formData.hdcd"></el-input>
</el-form-item>
<el-form-item label="报名条件" prop="hdzysx">
<el-input maxlength="500" placeholder="请填写报名条件"
rows="4" type="textarea"
v-model="formData.hdzysx"></el-input>
</el-form-item>
<el-form-item label="休养内容" prop="hdnr">
<div id="lrEditor" v-if="v=='edit'"></div>
</el-form-item>
<el-form-item label="附件上传" prop="accessory">
<el-upload
:auto-upload="false"
:file-list="fileList"
:on-change="handleChange"
:on-remove="handleRemove"
action="**"
limit="5"
name="file"
ref="upload">
<el-button size="small" type="primary">选择文件
</el-button>
</el-upload>
</el-form-item>
</el-form>
<div style="float: right;margin: 20px 0">
<el-button :disabled="subDis" @click="doEdit()"
type="primary">修改基础数据
</el-button>
</div>
</el-tab-pane>
<el-tab-pane label="名额分配" name="2">
<vi-title2 title="分段设置">
<template #func>
<el-button size="small" type="primary" @click="unionLimitQuickSetting">
应用分段设置
</el-button>
</template>
</vi-title2>
<el-row v-for="(item,index) in unionUserNumCalc" :gutter="20" class="mb5">
<el-col :span="7">
<el-input-number v-model="item.startNum" :precision="0" :step="1" :min="1"
placeholder="请输入最小人数"
style="width: 100%"></el-input-number>
</el-col>
<el-col :span="7">
<el-input-number v-model="item.endNum" :precision="0" :step="1" :min="1"
placeholder="请输入最大人数"
style="width: 100%"></el-input-number>
</el-col>
<el-col :span="6">
<el-input-number v-model="item.resultNum" :precision="0" :step="1" :min="1"
placeholder="请输入限制人数"
style="width: 100%"></el-input-number>
</el-col>
<el-col :span="4" class="text-right">
<el-button icon="el-icon-plus"
@click="unionUserNumCalc.push({})"></el-button>
<el-button icon="el-icon-minus" @click="unionUserNumCalc.splice(index,1)"
:disabled="unionUserNumCalc.length===1"></el-button>
</el-col>
</el-row>
<el-row class="mt10">
<div v-for="(item,index) in unionUserNumCalcTips" class="text-danger">
<span class="mr10">({{index+1}}).</span> {{item}}
</div>
</el-row>
<vi-title2 title="比例设置" class="mt20">
<template #func>
一键比例:
<el-input-number v-model="unionUserNumOneKeyRatio" :precision="0" :step="1"
:min="0"
placeholder="请输入一键比例"
size="small"
:max="100"></el-input-number>
<el-button size="small" type="primary" @click="applyScaleSettings"
class="ml5">应用比例设置
</el-button>
</template>
</vi-title2>
<el-table :data="unionUserNumberLimit" max-height="500px">
<el-table-column prop="unionname" label="分工会"></el-table-column>
<el-table-column prop="teacherCount" label="人数"></el-table-column>
<el-table-column prop="ratio" label="比例(%)">
<template scope="{row}">
<el-input-number v-model="row.ratio" :precision="0" :step="1" :min="0"
:max="100"></el-input-number>
</template>
</el-table-column>
<el-table-column prop="limitNum" label="限制人数">
<template scope="{row}">
<el-input-number v-model="row.limitNum" :precision="0" :step="1"
:min="0"
:max="row.teacherCount"
@change="calSummaryCount"></el-input-number>
</template>
</el-table-column>
</el-table>
<el-row class="mt20" justify="end" type="flex">
<div class="text-danger"
style="width: 100%;font-size: 18px;display: flex;align-items: center;font-weight: bold">
限制总人数:{{summaryCount}}人
</div>
<el-button @click="clearUnionLimit" type="danger">清空分工会人数限制</el-button>
<!--<el-button @click="setUpUnionLimitDialog=false">取消</el-button>-->
<!--<el-button @click="doConfirmSetUpUnionLimit" type="primary">确定</el-button>-->
</el-row>
<div style="float: right;margin: 20px 0">
<el-button :disabled="subDis" @click="doEditMefp"
type="primary">修改名额分配
</el-button>
</div>
</el-tab-pane>
</el-tabs>
</el-row>
</el-card>
</div>
</transition>
</el-row>
</guava>
</div>
<script>
let E = window.wangEditor
let lrEditor = {}
const vue = new Vue({
el: '#app',
data() {
let validHdnr = (rule, value, callback) => {
if (!this.formData.hdnr || !dd3s.html2txt(this.formData.hdnr)) {
callback(new Error('请填写休养内容'));
} else {
callback();
}
};
return {
summaryCount: 0,
unionUserNumCalc: [{}],
unionUserNumOneKeyRatio: null,
unionUserNumberLimit: [],
pastQuota: "",
tabs_active: '1',
unions: [],
unions_: [],
lxyHd: [],
lxyHdCd: [],
stepActive: 0,
v: "index",
userOptions: [],
addDialogVisible: false,
editDialogVisible: false,
loading: false,
tabLoading: false,
userLoading: false,
formData: {},
tableData: [],
pageForm: {
year: new Date().getFullYear() + "",
searchName: "id",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: ""
},
formRules: {
name: [{required: true, message: '请填写休养名称', trigger: ['blur', 'change']}],
bmsj: [{required: true, message: '请选择报名时间', trigger: ['blur', 'change']}],
hdsj: [{required: true, message: '请选择休养时间', trigger: ['blur', 'change']}],
hdcd: [{required: true, message: '请填写休养场地', trigger: ['blur', 'change']}],
hdzysx: [{required: true, message: '请填写休养场地', trigger: ['blur', 'change']}],
hdnr: [{validator: validHdnr, trigger: ['blur', 'change']}],
},
subDis: false,
fileList: [],
delFiles: [],
}
},
methods: {
/*mefpChange() {
if (this.pastQuota === '') {
this.unions_ = this.unions.map(v => {
const o = {
ghid: v.id,
unionname: v.unionname,
number: 0,
unioncode: v.unioncode,
membercount: v.membercount
}
return o
})
return
}
$.post(base + "/platform/zgfw/lxy/hd/getPastQuota", {pastQuota: this.pastQuota}, res => {
this.unions_ = res.data
})
},*/
doEditMefp() {
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.post(base + "/platform/zgfw/lxy/hd/doEditMefp", {
mefp: JSON.stringify(this.unionUserNumberLimit),
hdId: this.id
}, (data) => {
loading.close()
if (data.code == 0) {
this.v = 'index'
this.$message({
message: '修改成功',
type: 'success'
});
this.pageData()
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
async next() {
if (!this.formData.hdnr || !dd3s.html2txt(this.formData.hdnr)) {
this.$message.warning("请填写具体要求")
}
this.$refs["form"].validate((valid) => {
if (valid) {
if (moment(this.formData.hdsj[0].valueOf()) < moment(this.formData.bmsj[1]).valueOf()) {
this.$message.warning('报名截止时间必须早于活动时间!');
return
}
this.stepActive = 1
}
})
this.lxyHd = await getLxyHd()
},
handleRemove(file, fileList) {
this.fileList = fileList;
if (file.status === "success") {
this.delFiles.push(file.id);
}
},
handleChange(file, fileList) {
const delFile = () => {
for (let i = 0; i < fileList.length; i++) {
if (file === fileList[i]) {
fileList.splice(i, 1);
}
}
}
if (this.size === 0) {
this.$message.warning("您选择的是空文件!");
delFile()
}
if (!uploadFileType.includes(file.name.split('.')[1])) {
this.$message.warning("文件格式不支持!");
delFile()
}
this.fileList = fileList;
},
async userRemoteMethod(query) {
if (query) {
this.userLoading = true
const arr = await searchUser(query)
this.userOptions = this.userOptions.filter(v => {
return v.id == this.formData.hdfzr
}).concat(arr.filter(v => {
return v.id != this.formData.hdfzr
}));
this.userLoading = false
}
},
doEdit() {
this.$refs["form"].validate((valid) => {
if (valid) {
this.formData.bmkssj = this.formData.bmsj[0]
this.formData.bmjzsj = this.formData.bmsj[1]
this.formData.hdkssj = this.formData.hdsj[0]
this.formData.hdjssj = this.formData.hdsj[1]
let formdata = new FormData();
for (let key in this.formData) {
if (key != 'mefp') {
formdata.append(key, this.formData[key] ? this.formData[key] : '');
}
}
this.fileList.forEach(function (val) {
if (val.status === 'ready') {
formdata.append("files", val.raw, val.raw.name);
}
});
formdata.append("delFiles", this.delFiles)
this.subDis = true
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.ajax({
url: "/platform/zgfw/lxy/hd/doEdit",
type: "post",
data: formdata,
processData: false,
contentType: false,
success: (data) => {
this.subDis = false
loading.close()
if (data.code === 0) {
this.v = 'index'
this.$message({
message: data.msg,
type: 'success'
});
this.pageData();
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
},
error: data => {
this.subDis = false
loading.close()
this.$message({
message: data.msg,
type: 'error'
});
}
});
}
});
},
async openEdit(id) {
this.id = id
this.pastQuota = ""
this.fileList = []
this.delFiles = []
this.formData = {}
this.stepActive = 0
this.v = 'edit'
this.tabs_active = '1'
this.loading = true
$.get(base + "/platform/zgfw/lxy/common/getHdInfo", {id}, (data) => {
if (data.code == 0) {
data.data.hdsj = [data.data.hdkssj, data.data.hdjssj]
data.data.bmsj = [data.data.bmkssj, data.data.bmjzsj]
data.data.mefp.map(m => {
const union = this.unions.find(un => un.id === m.ghid)
m.membercount = union.membercount
})
this.unions_ = data.data.mefp
this.formData = data.data
//files
data.data.files.forEach(v => {
this.fileList.push({
id: v.id,
name: v.filename,
url: v.filepath,
status: 'success'
})
})
this.$nextTick(() => {
$("#lrEditor").html("")
lrEditor = new E("#lrEditor")
lrEditor.config.onchange = (html) => {
this.formData.hdnr = html
}
lrEditor.create()
lrEditor.txt.html(data.data.hdnr)
})
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
this.loading = false
}, "json");
this.unionUserNumberLimit = []
this.unionUserNumOneKeyRatio = null
this.unionUserNumCalc = [{}]
// this.summaryCount = 0
await this.getLimitUnionData()
this.unionUserNumberLimit.forEach(v=>{
v.limitNum = this.unions_.find(item=>item.ghid===v.id).number
})
this.summaryCount = this.unionUserNumberLimit.reduce((accumulator, currentObject) => {
return accumulator + currentObject.limitNum;
}, 0);
},
doDelete(id) {
this.$confirm('确定要删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: (a, b) => {
if ("confirm" == a) {//确认后再执行
$.post(base + "/platform/zgfw/lxy/hd/delete", {id: id}, (data) => {
if (data.code == 0) {
this.$message({
message: data.msg,
type: 'success'
});
this.pageData();
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
}
}
});
},
doAdd() {
this.$refs["form"].validate((valid) => {
if (valid) {
this.formData.bmkssj = this.formData.bmsj[0]
this.formData.bmjzsj = this.formData.bmsj[1]
this.formData.hdkssj = this.formData.hdsj[0]
this.formData.hdjssj = this.formData.hdsj[1]
let formdata = new FormData();
for (let key in this.formData) {
formdata.append(key, this.formData[key] ? this.formData[key] : '');
}
this.fileList.forEach(function (val) {
formdata.append("files", val.raw, val.raw.name);
});
//const unions_ = this.unions_.filter(v => v.number)
formdata.append('mefp', JSON.stringify(this.unionUserNumberLimit))
this.subDis = true
const loading = this.$loading({
lock: true,
text: '数据提交中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.ajax({
url: "/platform/zgfw/lxy/hd/doAdd",
type: "post",
data: formdata,
processData: false,
contentType: false,
success: (data) => {
this.subDis = false
loading.close()
if (data.code === 0) {
this.v = 'index'
this.$message({
message: data.msg,
type: 'success'
});
this.v = 'index'
this.pageData();
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
},
error: data => {
this.subDis = false
loading.close()
this.$message({
message: data.msg,
type: 'error'
});
}
});
}
});
},
openAdd() {
this.pastQuota = ""
this.fileList = []
this.delFiles = []
this.formData = {}
this.unions_ = []
this.unions.map(v => {
this.unions_.push({
ghid: v.id,
unionname: v.unionname,
number: 0,
unioncode: v.unioncode,
membercount: v.membercount
})
})
this.stepActive = 0
this.v = 'add';
this.$nextTick(() => {
$("#lrEditor").html("")
lrEditor = new E("#lrEditor")
lrEditor.config.onchange = (html) => {
this.formData.hdnr = html
}
lrEditor.create()
})
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
this.unionUserNumberLimit = []
this.unionUserNumOneKeyRatio = null
this.unionUserNumCalc = [{}]
this.summaryCount = 0
this.getLimitUnionData()
},
doSearch() {
this.tabKey = new Date().getTime()
this.pageForm.pageNumber = 1
this.pageData()
},
pageOrder(column) {//按字段排序
this.pageForm.pageOrderName = column.prop;
this.pageForm.pageOrderBy = column.order;
this.pageData();
},
pageNumberChange(val) {//页码更新操作
this.pageForm.pageNumber = val;
this.pageData();
},
pageSizeChange(val) {//分页大小更新操作
this.pageForm.pageSize = val;
this.pageData();
},
pageData() {//加载分页数据
sublime.showLoadingbar();//显示loading
this.tabLoading = true
$.post(base + "/platform/zgfw/lxy/hd/pageData", this.pageForm, (data) => {
sublime.closeLoadingbar();//关闭loading
this.tabLoading = false
if (data.code == 0) {
this.tableData = data.data.list;
this.pageForm.totalCount = data.data.totalCount;
} else {
this.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
},
applyScaleSettings() {
this.unionUserNumberLimit.forEach(v => {
v.limitNum = parseFloat((v.teacherCount * this.unionUserNumOneKeyRatio / 100).toFixed(0))
if (v.ratio) {
v.limitNum = parseFloat((v.teacherCount * v.ratio / 100).toFixed(0))
}
})
this.calSummaryCount()
},
calSummaryCount() {
const array = this.unionUserNumberLimit
if (array) {
this.summaryCount = array.reduce((prev, curr) => {
const value = Number(curr.limitNum);
if (!isNaN(value)) {
return prev + curr.limitNum;
} else {
return prev;
}
}, 0)
}
},
unionLimitQuickSetting() {
this.unionUserNumCalc.forEach((v, i) => {
const startNum = v.startNum
const endNum = v.endNum
const resultNum = v.resultNum
if (startNum > endNum) {
this.$message.warning('第' + (i + 1) + '行设置错误')
} else {
this.unionUserNumberLimit.forEach(x => {
if (x.teacherCount >= startNum && x.teacherCount <= endNum) {
x.limitNum = resultNum
}
})
this.calSummaryCount()
}
})
},
async clearUnionLimit(){
const confirm = await this.$confirm('确定要清空分工会人数限制吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if ('confirm' === confirm) {
this.unionUserNumberLimit = []
this.unionUserNumOneKeyRatio = null
this.unionUserNumCalc = [{}]
this.summaryCount = 0
await this.getLimitUnionData()
}
},
async getLimitUnionData() {
const resp = await $.get('/platform/trainSingUp/manage/activity/add/getUnionLimit')
this.unionUserNumberLimit = resp.data
}
},
computed: {
unionUserNumCalcTips() {
return this.unionUserNumCalc.map(v => {
return (v.startNum ? v.startNum : '?') + '-' + (v.endNum ? v.endNum : '?') + '人的分工会,限报' + (v.resultNum ? v.resultNum : '?') + '人'
})
},
},
async created() {
const unions_resp = await $.get(loc() + '/getUnions')
this.unions = unions_resp.data
this.lxyHd = await getLxyHd()
this.lxyHdCd = await getlxyHdCd()
this.pageData();
}
})
</script>
<!--#layout("/platform/zgfw/lxy/dialogView.html"){}#-->
<!--#
}
#-->