Files
UNION_HUTB/target/classes/views/mobile/proposal/writeproposal.html
T
2026-09-09 09:14:28 +08:00

339 lines
15 KiB
HTML

<!--#
layout("/mobile/platform.html"){
#-->
<div id="app" v-cloak>
<van-nav-bar @click-left="location.href='/mobile/index/toHome?type=民主管理'" fixed left-arrow placeholder
title="撰写提案"></van-nav-bar>
<van-form :show-error-message="false" input-align="right" ref="addForm">
<van-cell-group class="mt10" inset>
<van-field label="代表姓名" name="username" readonly
value="${@shiro.getPrincipalProperty('username')}"></van-field>
<van-field :value="formData.createTime" label="提案时间" name="createTime"
readonly></van-field>
<van-field :rules="[{ required:true, message: '请填写提案名称'}]" label="提案名称" name="proposalName"
placeholder="请填写提案名称"
required v-model="formData.proposalName"></van-field>
<van-field :rules="[{ required:true, message: '请选择提案方式'}]" @click="showMannerCodePicker = true" clickable
label="提案方式"
name="mannerName"
placeholder="点击选择提案方式"
readonly required
v-model="formData.mannerName"></van-field>
<van-popup position="bottom" round v-model:show="showMannerCodePicker">
<van-picker :columns="mannerList" @cancel="showMannerCodePicker = false" @confirm="onMannerCodeConfirm"
show-toolbar>
</van-picker>
</van-popup>
<van-field :value="formData.teacherMeeting" label="所属教代会" name="teacherMeeting"
readonly></van-field>
<van-field :rules="[{ required:true, message: '请选择所属代表团'}]"
@click="${@shiro.hasRole('jdhdb01')} ? '' : showDelegationNamePicker = true" clickable
label="所属代表团" name="delegationName"
placeholder="点击选择所属代表团"
readonly
required v-if="formData.mannerCode!='W03'"
v-model="formData.delegationName" v-show="false"></van-field>
<van-popup position="bottom" round v-model:show="showDelegationNamePicker">
<van-picker :columns="delegationOptions" @cancel="showDelegationNamePicker = false"
@confirm="onDelegationNameConfirm"
show-toolbar>
</van-picker>
</van-popup>
<van-field :rules="[{ required:true, message: '请选择所属委员会'}]" @click="showCommitteeNamePicker = true"
clickable label="所属委员会"
name="committeeName"
placeholder="点击选择所属委员会"
readonly required
v-if="formData.mannerCode=='W03'" v-model="formData.committeeName"></van-field>
<van-popup position="bottom" round v-model:show="showCommitteeNamePicker">
<van-picker :columns="committeeOptions" @cancel="showCommitteeNamePicker = false"
@confirm="onCommitteeNameConfirm"
show-toolbar>
</van-picker>
</van-popup>
<van-field @click="showTypeNamePicker = true" clickable label="提案类型"
name="typeName"
placeholder="点击选择提案类型"
readonly
v-model="formData.typeName"
v-show="false"></van-field>
<van-popup position="bottom" round v-model:show="showTypeNamePicker">
<van-picker :columns="typeOptions" @cancel="showTypeNamePicker = false" @confirm="onTypeNameConfirm"
show-toolbar>
</van-picker>
</van-popup>
<van-field
:rules="[{ required:true, message: '请输入案由'}]"
autosize
clearable
label="案&emsp;&emsp;由"
maxlength="1000"
placeholder="请输入案由"
required
rows="5"
show-word-limit
type="textarea"
v-model="formData.brief"
></van-field>
<van-field
:rules="[{ required:true, message: '请输入建议措施'}]"
autosize
clearable
label="建议措施"
maxlength="1000"
placeholder="请输入建议措施"
required
rows="5"
show-word-limit
type="textarea"
v-model="formData.measures"
></van-field>
<!-- <van-field name="files" label="附&emsp;&emsp;件" style="flex-flow: column" input-align="left">
<template #label>
<div class="mb10">附&emsp;&emsp;件</div>
</template>
<template #input>
<vant-file-upload :files.sync="formData.files"></vant-file-upload>
</template>
</van-field>-->
<van-cell title="签&emsp;&emsp;字" v-if="isSign()">
<template #label>
<mobile-sign :my_sign.sync="formData.sign" class="mt20" h="0.25" ref="signature"></mobile-sign>
</template>
</van-cell>
</van-cell-group>
<div style="display: flex;justify-content: space-around;padding: 20px 0 20px 0;">
<van-button :color="themeColor" @click="doAdd" style="flex: 1;margin: 0 10px 0 10px">保存提案
</van-button>
<van-button :color="themeColor" @click="doSubmit" style="flex: 1;margin: 0 10px 0 10px"
v-if="formData.mannerCode!='W01'">提交
</van-button>
</div>
</van-form>
</div>
<script>
const vue = new Vue({
el: '#app',
mixins: [mobileMixins],
data() {
return {
showMannerCodePicker: false,
showDelegationNamePicker: false,
showCommitteeNamePicker: false,
showTypeNamePicker: false,
config: {},
allMannerList: [],
mannerList: [],
meetingOptions: [],
typeOptions: [],
delegationOptions: [],
committeeOptions: [],
formData: {
username: '${@shiro.getPrincipalProperty("username")}',
createTime: moment().format('YYYY-MM-DD'),
delegationId: '',
sign: '',
id: '',
mannerCode: 'W01'
},
isSign: () => {
return proposal.needSignState.map(v => v.stateCode).includes(proposal.UNSUBMIT)
},
}
},
components: {
'vant-file-upload': httpVueLoader('/components/plugins/VantFileUpload.vue'),
'mobile-sign': httpVueLoader('/components/sign/mobileSign.vue'),
},
mounted() {
this.$nextTick(() => {
if (this.$refs.signature) {
this.$refs.signature.getMySign()
}
})
},
methods: {
async doAdd() {
let method = this.formData.id ? "/doEdit" : "/doAdd"
this.$refs['addForm'].validate().then(async () => {
if (this.formData.sign !== "") {
this.$refs.signature.submitSign()
}
let data = clone(this.formData)
if (data.files) {
data.files = JSON.stringify(data.files)
}
$.post('/platform/proposal/transact/compose' + method, {
data: JSON.stringify(data),
sign: data.sign
}).then(res => {
if (res.code == 0) {
this.$toast.success('成功');
window.location.href = "/platform/mobile/proposal/compose"
} else {
this.$toast.fail('失败');
}
})
})
},
async doSubmit() {
const valid = await this.$refs["addForm"].validate()
if (valid) {
const confirm = await this.$confirm('确定要提交此提案吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info',
})
if ("confirm" === confirm) {
this.$refs.signature.submitSign()
/* this.$refs.signature.submitSign()
if (this.$refs.signature.checkNull()) {
vant.Toast('请签名!')
return
}
await this.$refs.signature.updateSign()*/
this.$refs.signature.submitSign()
let data = clone(this.formData)
if (data.files) {
data.files = JSON.stringify(data.files)
}
const resp = await $.post("/platform/proposal/transact/writeproposal/doSubmit", {
data: JSON.stringify(data),
sign: data.sign
})
requestLaterFun(resp, () => {
this.$notify.success({title: '成功', message: resp.msg})
window.location.href = "/platform/mobile/proposal/compose"
}, () => {
this.$notify.warning({title: '警告', message: resp.msg})
})
}
}
},
onTypeNameConfirm(val) {
this.$set(this.formData, "typeName", val.text)
this.$set(this.formData, "typeId", val.value)
this.showTypeNamePicker = false;
},
onCommitteeNameConfirm(val) {
this.$set(this.formData, "committeeName", val.text)
this.$set(this.formData, "committeeId", val.value)
this.showCommitteeNamePicker = false;
},
onDelegationNameConfirm(val) {
this.$set(this.formData, "delegationName", val.text)
this.$set(this.formData, "delegationId", val.value)
this.showDelegationNamePicker = false;
},
onMannerCodeConfirm(val) {
this.$set(this.formData, "mannerName", val.text)
this.$set(this.formData, "mannerCode", val.value)
this.showMannerCodePicker = false;
},
async getDictByCode() {
const {data} = await $.get("/platform/proposal/basics/config/getDictByCode", {code: "proposal_manner"})
return data
},
async initData() {
this.allMannerList = await this.getDictByCode("proposal_manner");
this.config = await proposal.getProposalConfig()
this.meetingOptions = await proposal.getOpenMeeting()
const typeOptions = await proposal.getProposalType()
this.$set(this.formData, "teacherMeetingId", this.meetingOptions ? this.meetingOptions[0].id : null)
this.$set(this.formData, "teacherMeeting", this.meetingOptions ? this.meetingOptions[0].jdhallname : null)
const delegationOptions = await proposal.getDelegation(this.formData.teacherMeetingId)
delegationOptions.forEach(v => {
this.delegationOptions.push({value: v.id, text: v.dbtname})
})
typeOptions.forEach(v => {
this.typeOptions.push({value: v.id, text: v.typeName})
})
this.$set(this.formData, "delegationId", this.delegationOptions ? this.delegationOptions[0].value : '')
this.$set(this.formData, "delegationName", this.delegationOptions ? this.delegationOptions[0].text : '')
const jgcy = await $.post("/platform/proposal/transact/writeproposal/getJdhJgcy", {jdhid: this.formData.teacherMeetingId})
const cbdwFzr = await $.post("/platform/proposal/transact/writeproposal/getCbdwFzr")
if (jgcy.data > 0) {
const jgName = await $.post("/platform/proposal/transact/writeproposal/getJgNameByuser")
jgName.data.forEach(v => {
this.committeeOptions.push({value: v.id, text: v.name})
})
}
if (this.allMannerList.length > 0) {
this.config.manner.forEach(v => {
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('jdhdb01')}" === 'true' && v === "W01") {
const data = this.allMannerList.find(z => z.code == v)
this.mannerList.push({value: data.code, text: data.name})
}
if ("${@shiro.hasRole('sysadmin')||(@shiro.hasRole('jdhdb01')&&@shiro.hasRole('jdhdbt01'))}" === 'true' && v === "W02") {
const data = this.allMannerList.find(z => z.code == v)
this.mannerList.push({value: data.code, text: data.name})
}
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('jdhdb01')}" === 'true' && v === "W03" && jgcy.data > 0) {
const data = this.allMannerList.find(z => z.code == v)
this.mannerList.push({value: data.code, text: data.name})
}
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('jdhdb01')}" === 'true' && v === "W04" && cbdwFzr.data > 0) {
const data = this.allMannerList.find(z => z.code == v)
this.mannerList.push({value: data.code, text: data.name})
}
})
this.$set(this.formData, "mannerId", this.mannerList ? this.mannerList[0].value : '')
this.$set(this.formData, "mannerName", this.mannerList ? this.mannerList[0].text : '')
}
}
},
created() {
this.initData()
}
})
</script>
<!--#
}
#-->