Files
zhgh_hhu/target/classes/views/platform/wakeshome/declaration/apply.html
T
2026-09-20 15:46:34 +08:00

222 lines
9.5 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.el-form .el-select, .el-form .el-date-editor {
width: 100%;
}
.el-divider {
background-color: #1867b0;
}
.el-divider__text {
color: #1867b0;
}
.w-e-text-container {
height: 250px !important;
}
</style>
<div id="app" v-clock>
<guava ref="guava">
<template>
<el-card shadow="never">
<template #header>
<el-row justify="space-between" type="flex">
<h3 style="color: rgb(24, 103, 176);">
{{id?'信息编辑':'信息填写'}}
</h3>
</el-row>
</template>
<el-form :model="formData" :rules="formRules" label-width="150px" ref="form">
<vi-title title="教工小家申报信息"></vi-title>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="填报人" prop="username">
<el-input readonly v-model="formData.username"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="填报人工号" prop="loginName">
<el-input readonly v-model="formData.loginName"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="联系方式" prop="mobile">
<el-input maxlength="11" v-model="formData.mobile"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="填报单位" prop="unionName">
<el-input readonly v-model="formData.unionName"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="创办时间" prop="foundTime">
<el-date-picker
v-model="formData.foundTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择创办日期">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="填报时间" prop="applyTime">
<el-input readonly v-model="formData.applyDate"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位位置" prop="position">
<el-input placeholder="请填写单位位置" v-model="formData.position"></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位面积" prop="area">
<el-input placeholder="请填写单位面积" v-model="formData.area"></el-input>
</el-form-item>
</el-col>
<el-col :lg="24" :sm="24">
<el-form-item label="单位信息" prop="details">
<el-input type="textarea" :rows="4"
placeholder="请填写单位信息"
v-model="formData.details"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
<el-form-item class="is-required" label="基层工会简况"
prop="basicInformation">
<text-editor v-model="formData.basicInformation"></text-editor>
<div style="text-align: right">
<span style="color: #0a84ff">当前字数:{{ formData.basicInformation ? (dd3s.html2txt(formData.basicInformation).length) : 0 }}</span>
<span>{{ ';最多500字' }}</span>
</div>
<!-- <el-input type="textarea" v-model="formData.basicInformation" maxlength="500" show-word-limit :rows="10"></el-input>-->
</el-form-item>
</el-col>
</el-row>
<el-form-item label="教工小家建设方案" prop="constructionPlan">
<text-editor v-model="formData.constructionPlan"></text-editor>
</el-form-item>
</el-form>
<el-row class="mt10" justify="center" type="flex">
<el-button @click="doSave()" style="width: 200px" type="primary">保 存</el-button>
<el-button @click="doSubmit()" style="width: 200px" type="primary">提 交
</el-button>
</el-row>
</el-card>
</template>
</guava>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
const validBasicInformation = (rule, value, callback) => {
if (!this.formData.basicInformation || !dd3s.html2txt(this.formData.basicInformation)) {
callback(new Error('请填写基层工会简况'));
} else if (dd3s.html2txt(this.formData.basicInformation).length > 500) {
console.log(11)
callback(new Error('基层工会简况最多500字'));
} else {
callback();
}
};
return {
id: '',
formData: {},
formRules: {
mobile: [{required: true, message: '手机号不能为空', trigger: 'blur'},
{pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号格式', trigger: 'blur'}],
basicInformation: [{
required: true,
message: '必填',
trigger: ['blur', 'change']
}],
constructionPlan: [{
required: true,
message: '必填',
trigger: ['blur', 'change']
}],
basicInformation: [{
validator: validBasicInformation,
trigger: ['blur', 'change']
}],
},
}
},
methods: {
async doSave() {
const resp = await $.post('/platform/wakeshome/declaration/apply/doSave', this.formData)
if (resp.code === 0) {
this.$message.success('保存成功')
setTimeout(() => {
sublime.jumpPagePjax('/platform/wakeshome/declaration/mine')
}, 500)
} else {
this.$message.warning('操作失败')
}
},
async doSubmit() {
try {
const valid = await this.$refs.form.validate()
if (valid) {
const resp = await $.post('/platform/wakeshome/declaration/apply/doSubmit', this.formData)
if (resp.code === 0) {
this.$message.success('提交成功')
setTimeout(() => {
sublime.jumpPagePjax('/platform/wakeshome/declaration/mine')
}, 500)
} else {
this.$message.warning('操作失败')
}
}
} catch (e) {
// this.$message.warning('请查看是否按要求填写')
}
},
async initFormData() {
if (!this.id) {
this.$set(this.formData, 'username', "${@shiro.getPrincipalProperty('username')}")
this.$set(this.formData, 'loginName', "${@shiro.getPrincipalProperty('loginname')}")
this.$set(this.formData, 'mobile', "${@shiro.getPrincipalProperty('mobile')}")
this.$set(this.formData, 'applyDate', moment().format('YYYY-MM-DD'))
this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}")
} else {
const resp = await $.get('/platform/wakeshome/declaration/apply/getInfoById', {id: this.id})
if (resp.code === 0) {
this.formData = resp.data
}
}
},
},
async created() {
this.id = GetQueryString("id")
this.initFormData();
}
})
</script>
<!--#
}
#-->