Files
UNION_NSI/target/classes/views/platform/manuscript/apply.html
T
2026-09-08 19:49:21 +08:00

245 lines
11 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>
.el-input-number input {
text-align: left !important;
}
.el-card {
min-height: calc(100vh - 70px);
}
</style>
<div id="app" v-cloak>
<guava>
<el-card shadow="never">
<template #header>
<h3 style="color: #1867b0">填写投稿</h3>
</template>
<div style="margin: 20px 250px 20px 250px">
<el-form :model="formData" ref="form" :rules="formRules" label-width="140px" label-position="right"
label-suffix="">
<el-row gutter="60">
<el-col :span="24">
<el-form-item prop="userName" label="投稿人">
<el-input v-model="formData.userName" readonly></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="type" label="投稿单位类型">
<el-radio-group v-model="formData.type" @change="typeChange">
<el-radio-button label="1" v-if="clubButton && ${@shiro.hasRole('H02')}">社团</el-radio-button>
<el-radio-button label="2" v-if="unionButton">分工会</el-radio-button>
<el-radio-button label="3" v-if="schoolButton">校工会</el-radio-button>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="manuscriptName" label="稿件标题">
<el-input v-model="formData.manuscriptName" type="text"></el-input>
</el-form-item>
</el-col>
<el-col :span="24" v-if="formData.type==1">
<el-form-item prop="clubId" label="所属社团">
<el-select v-model="formData.clubId" placeholder="请选择所属社团" style="width: 100%"
clearable>
<el-option
v-for="i in clubOption"
:key="i.id"
:label="i.name+'('+i.code+')'"
:value="i.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24" v-if="formData.type==2">
<el-form-item prop="unionId" label="所属分工会">
<el-select v-model="formData.unionId" placeholder="请选择所属分工会" style="width: 100%"
clearable>
<el-option
v-for="i in unionOption"
:key="i.id"
:label="i.unionname+'('+i.unioncode+')'"
:value="i.id">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="manuscriptCode" label="稿件类型">
<el-select v-model="formData.manuscriptCode" placeholder="请选择稿件类型" style="width: 100%"
clearable>
<el-option
v-for="i in manuscriptOption"
:key="i.manuscriptTypeCode"
:label="i.manuscriptTypeName+''+i.manuscriptTypeCode+''"
:value="i.manuscriptTypeCode">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="remark" label="说明">
<el-input v-model="formData.remark" type="textarea" rows="4"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item prop="files" label="新闻稿件">
<file-upload :files.sync="formData.files" card></file-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="float: right;margin: 20px 0">
<el-button @click="doAdd(false)">保 存</el-button>
<el-button type="primary" @click="doAdd(true)">投 稿</el-button>
</div>
</div>
</el-card>
</guava>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
clubs: [],
unions: [],
clubButton: true,
unionButton: true,
schoolButton: true,
manuscriptOption: [],
clubOption: [],
unionOption: [],
formRules: {
type: [{required: true, message: '必填', trigger: ['blur', 'change']}],
manuscriptName: [{required: true, message: '必填', trigger: ['blur', 'change']}],
manuscriptCode: [{required: true, message: '必填', trigger: ['blur', 'change']}],
unionId: [{required: true, message: '必填', trigger: ['blur', 'change']}],
clubId: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
}
},
components: {},
methods: {
async typeChange(val) {
if (val == 1 && "${@shiro.hasRole('sysadmin')}" === 'false' && "${@shiro.hasRole('club01')}" === 'true') {
this.$set(this.formData, "type", 1)
const id = await $.get(loc() + "/getClubByUserId")
this.clubOption = this.clubOption.filter(v => v.id === id)
this.$set(this.formData, "clubId", this.clubOption[0].id)
}
if (val == 2 && "${@shiro.hasRole('sysadmin')}" === 'false' && "${@shiro.hasRole('manuscript')}" === 'true') {
this.$set(this.formData, "type", 2)
this.unionOption = this.unionOption.filter(v => v.id === "${@shiro.getPrincipalProperty('unit').getUnionid()}")
if (this.unionOption && this.unionOption.length > 0) {
this.$set(this.formData, "unionId", this.unionOption[0].id)
}
}
if (val == 3 && "${@shiro.hasRole('sysadmin')}" === 'false' && "${@shiro.hasRole('H10')}" === 'true') {
this.$set(this.formData, "type", 3)
this.clubButton = false
this.unionButton = false
}
},
async doAdd(flag) {
const valid = await this.$refs["form"].validate()
if (valid) {
let method = this.formData.id ? "/doEdit" : "/doAdd"
const formData = JSON.parse(JSON.stringify(this.formData))
formData.files = JSON.stringify(formData.files)
const data = await $.post(loc() + method, {
data: JSON.stringify(formData),
flag: flag
})
if (data.code == 0) {
sublime.jumpPagePjax('/platform/manuscript/apply/list')
}
}
},
async openEdit(id) {
const resp = await $.get("/platform/manuscript/apply/findOne", {id})
if(resp.code===0){
const data = resp.data
this.formData = data
if (data.type == 2) {
this.clubButton = false
this.schoolButton = false
} else if (data.type == 1) {
this.unionButton = false
this.schoolButton = false
} else {
this.clubButton = false
this.unionButton = false
}
this.$set(this.formData, "userName", (data.username + '' + data.loginname + ''))
if (data.files) {
data.files = JSON.parse(data.files)
}
}else{
this.notifyWarning(resp.msg)
}
},
async init() {
const {data} = await $.get(loc() + "/getRoleByUserId")
this.$set(this.formData, "userName", "${@shiro.getPrincipalProperty('username')}" + ' (' + "${@shiro.getPrincipalProperty('loginname')}" + ')')
if ("${@shiro.hasRole('sysadmin')}" === 'false' && "${@shiro.hasRole('club01')}" === 'true') {
this.$set(this.formData, "type", 1)
const id = await $.get(loc() + "/getClubByUserId")
this.clubOption = this.clubOption.filter(v => v.id === id)
this.$set(this.formData, "clubId", this.clubOption[0].id)
} else if ("${@shiro.hasRole('sysadmin')}" === 'false' && "${@shiro.hasRole('manuscript')}" === 'true') {
this.$set(this.formData, "type", 2)
this.unionOption = this.unionOption.filter(v => v.id === "${@shiro.getPrincipalProperty('unit').getUnionid()}")
if (this.unionOption && this.unionOption.length > 0) {
this.$set(this.formData, "unionId", this.unionOption[0].id)
}
} else if ("${@shiro.hasRole('sysadmin')}" === 'false' && "${@shiro.hasRole('H10')}" === 'true') {
this.$set(this.formData, "type", 3)
this.clubButton = false
this.unionButton = false
}
}
},
async created() {
this.clubOption = await getClubs()
this.unionOption = await getUnions(null)
this.manuscriptOption = await manuscript.getManuscriptType()
let id = getQueryVariable("id")
id ? this.openEdit(id) : this.init()
}
})
</script>
<!--#
}
#-->