first commit
This commit is contained in:
@@ -0,0 +1,351 @@
|
||||
<!--#
|
||||
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-cloak>
|
||||
<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="100px" ref="AddForm">
|
||||
<!-- <el-divider content-position="left">职工之家申请信息</el-divider>-->
|
||||
<vi-title title="教工小家申请信息"></vi-title>
|
||||
<el-row :gutter="20">
|
||||
|
||||
<el-col :lg="8" :sm="24">
|
||||
<el-form-item label="填报人" prop="username">
|
||||
<el-input readonly v-model="formData.username"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="8" :sm="24">
|
||||
<el-form-item label="联系方式" prop="mobile">
|
||||
<el-input v-model="formData.mobile" placeholder="请填写联系方式" maxlength="18"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="8" :sm="24">
|
||||
<el-form-item label="填报时间" prop="applyTime">
|
||||
<el-input readonly v-model="formData.applyTime"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :lg="8" :sm="24">
|
||||
<el-form-item label="填报类别" prop="category">
|
||||
<el-radio-group v-model="formData.category" size="small" @change="doChangeCategory">
|
||||
<el-radio label="校工会" border></el-radio>
|
||||
<el-radio label="分工会" border></el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="8" :sm="24">
|
||||
<el-form-item label="填报单位" prop="unionName">
|
||||
<el-input readonly v-model="formData.unionName"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- <el-divider content-position="left">职工之家详细信息</el-divider>-->
|
||||
<vi-title title="教工小家详细信息"></vi-title>
|
||||
<el-row :gutter="20">
|
||||
<el-col :lg="8" :sm="24">
|
||||
<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 :lg="8" :sm="24">
|
||||
<el-form-item label="单位位置" prop="position">
|
||||
<el-input placeholder="请填写单位位置" v-model="formData.position"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="8" :sm="24">
|
||||
<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-divider content-position="left">职工之家荣誉信息</el-divider>-->
|
||||
<vi-title title="教工小家荣誉信息"></vi-title>
|
||||
<el-row :gutter="20">
|
||||
<el-col :lg="24" :sm="24">
|
||||
<el-form-item class="is-required" label="获奖情况" prop="payStandard">
|
||||
<el-button
|
||||
@click="formData.awardInfo.push({awardTime:'',awardUnit:'',awardName:'',awardPic:''})"
|
||||
icon="el-icon-plus" size="mini"
|
||||
style="float: right;margin-bottom: 10px">
|
||||
添加
|
||||
</el-button>
|
||||
<span style="color: red">说明:各奖项图片只能上传一张。</span>
|
||||
<el-table
|
||||
:data="formData.awardInfo"
|
||||
border
|
||||
v-fit-columns
|
||||
size="mini"
|
||||
style="width: 100%">
|
||||
<el-table-column label="获奖日期" prop="awardTime">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item :prop="'awardInfo.'+$index+'.awardTime'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]"
|
||||
label-width="0">
|
||||
<el-date-picker
|
||||
v-model="row.awardTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择获奖日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="获奖单位" prop="awardUnit">
|
||||
<template scope="{row,$index}">
|
||||
<el-form-item :prop="'awardInfo.'+$index+'.awardUnit'"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]"
|
||||
label-width="0">
|
||||
<el-input clearable maxlength="100" placeholder="请输入获奖单位"
|
||||
v-model="row.awardUnit"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="奖项名称" prop="awardName">
|
||||
<template slot-scope="{row,$index}">
|
||||
<el-input clearable maxlength="100" placeholder="请输入奖项名称"
|
||||
v-model="row.awardName"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="奖项照片" prop="awardPic">
|
||||
<template scope="{row,$index}">
|
||||
<image-upload :limit="1" v-model="row.awardPic"></image-upload>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" header-align="center" label="操作" width="80">
|
||||
<template slot-scope="scope">
|
||||
<el-button :disabled="formData.awardInfo.length<=1"
|
||||
@click="formData.awardInfo.splice(scope.$index,1)" circle
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
type="danger"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<!-- <el-divider content-position="left">职工之家材料上传</el-divider>-->
|
||||
<vi-title title="教工小家材料上传"></vi-title>
|
||||
<el-row gutter="20">
|
||||
<el-col :lg="24" :sm="24">
|
||||
<el-form-item required label="图片上传" prop="picFiles">
|
||||
<file-upload :files.sync="formData.picFiles" card :max="10"
|
||||
:type="['jpg', 'png', 'jpeg']">
|
||||
<template #el-upload__tip>
|
||||
</template>
|
||||
</file-upload>
|
||||
<div class="el-upload__tip">请上传jpg、png、jpeg格式的图片,最多不超过10张</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :lg="24" :sm="24">
|
||||
<el-form-item required label="附件上传" prop="files">
|
||||
<file-upload :files.sync="formData.files" card :max="10"
|
||||
:type="['doc','docx','xls','xlsx','pdf','ppt', 'jpg', 'png', 'jpeg']">
|
||||
<template #el-upload__tip>
|
||||
</template>
|
||||
</file-upload>
|
||||
<div class="el-upload__tip">可上传照片、文档等资料</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<el-row class="mt10" v-if="disabled" justify="center" type="flex">
|
||||
<el-button @click="doSave()" style="width: 300px" type="primary">保 存
|
||||
</el-button>
|
||||
<el-button @click="doSubmit()" style="width: 300px" type="primary">提 交
|
||||
</el-button>
|
||||
</el-row>
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
formRules: {
|
||||
position: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
mobile: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
picFiles: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
files: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
},
|
||||
formData: {
|
||||
category: '分工会',
|
||||
awardInfo: [{awardTime: '', awardUnit: '', awardName: '', awardPic: ''}]
|
||||
},
|
||||
disabled: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async doSave() {
|
||||
let postUrl = ''
|
||||
if (this.formData.id) {
|
||||
postUrl = loc() + '/doEdit'
|
||||
} else {
|
||||
postUrl = loc() + '/doAdd'
|
||||
}
|
||||
const formData = this.doJsonStr(this.formData)
|
||||
formData.isSubmit = false;
|
||||
const resp = await $.post(postUrl, formData)
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
setTimeout(() => {
|
||||
sublime.jumpPagePjax('/platform/wakeshome/info/mine')
|
||||
}, 500)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
},
|
||||
async doSubmit() {
|
||||
try {
|
||||
const valid = await this.$refs['AddForm'].validate()
|
||||
if (valid) {
|
||||
let postUrl = ''
|
||||
if (this.formData.id) {
|
||||
postUrl = loc() + '/doEdit'
|
||||
} else {
|
||||
postUrl = loc() + '/doAdd'
|
||||
}
|
||||
const formData = this.doJsonStr(this.formData)
|
||||
formData.isSubmit = true
|
||||
const resp = await $.post(postUrl, formData)
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.msg)
|
||||
setTimeout(() => {
|
||||
sublime.jumpPagePjax('/platform/wakeshome/info/mine')
|
||||
}, 500)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
doChangeCategory() {
|
||||
if (this.formData.category === '校工会') {
|
||||
this.formData.unionName = '校工会'
|
||||
this.formData.unionId = null
|
||||
} else {
|
||||
this.formData.unionName = "${@shiro.getPrincipalProperty('union').getUnionname()}"
|
||||
this.formData.unionId = "${@shiro.getPrincipalProperty('union').getId()}"
|
||||
}
|
||||
},
|
||||
async initFormData() {
|
||||
if (!this.id) {
|
||||
this.$set(this.formData, 'username', "${@shiro.getPrincipalProperty('username')}")
|
||||
this.$set(this.formData, 'mobile', "${@shiro.getPrincipalProperty('mobile')}")
|
||||
this.$set(this.formData, 'applyTime', moment().format('YYYY-MM-DD'))
|
||||
this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}")
|
||||
} else {
|
||||
const resp = await $.get('/platform/wakeshome/info/mine/getInfoById', {id: this.id})
|
||||
if (resp.code === 0) {
|
||||
this.formData = {...resp.data}
|
||||
}
|
||||
}
|
||||
},
|
||||
doJsonStr(data) {
|
||||
const formData = clone(data)
|
||||
formData.awardInfo = JSON.stringify(this.formData.awardInfo)
|
||||
formData.picFiles = JSON.stringify(this.formData.picFiles)
|
||||
formData.files = JSON.stringify(this.formData.files)
|
||||
return formData;
|
||||
},
|
||||
async validateApply() {
|
||||
const resp = await $.get(loc() + '/validateApply')
|
||||
if (resp.code === 0) {
|
||||
this.disabled = true
|
||||
await this.getWakesHomeUnitInfo()
|
||||
} else {
|
||||
this.disabled = false
|
||||
this.$confirm('未获取到单位的建家申报记录,是否前往申报?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
setTimeout(() => {
|
||||
sublime.jumpPagePjax('/platform/wakeshome/declaration/apply')
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
},
|
||||
async getWakesHomeUnitInfo() {
|
||||
const resp = await $.get('/platform/wakeshome/declaration/apply/getWakesHomeUnitInfo')
|
||||
if (resp.code === 0 && resp.data) {
|
||||
this.$set(this.formData, 'foundTime', resp.data.foundTime)
|
||||
this.$set(this.formData, 'position', resp.data.position)
|
||||
this.$set(this.formData, 'area', resp.data.area)
|
||||
this.$set(this.formData, 'details', resp.data.details)
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.id = GetQueryString("id")
|
||||
this.initFormData()
|
||||
await this.validateApply()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user