first commit
This commit is contained in:
@@ -0,0 +1,353 @@
|
||||
<!--#
|
||||
layout("/mobile/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<van-nav-bar @click-left="history.back()" 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 v-show="false" :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"></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"></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="案  由"
|
||||
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="附  件" style="flex-flow: column" input-align="left">
|
||||
<template #label>
|
||||
<div class="mb10">附  件</div>
|
||||
</template>
|
||||
<template #input>
|
||||
<vant-file-upload :files.sync="formData.files"></vant-file-upload>
|
||||
</template>
|
||||
</van-field>
|
||||
<van-cell title="签  字" v-if="isSign()">
|
||||
<template #label>
|
||||
<mobile-sign class="mt20" ref="signature" h="0.25" :my_sign.sync="formData.sign"></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>
|
||||
var 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 mProposal.needSignState.map(v => v.stateCode).includes(100)
|
||||
},
|
||||
}
|
||||
},
|
||||
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.brief || this.formData.brief.length < this.config.words) {
|
||||
vant.Toast('提案案由最少需要' + this.config.words + '字')
|
||||
return
|
||||
}
|
||||
|
||||
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 = "/mobile/proposal/compose"
|
||||
} else {
|
||||
this.$toast.fail('失败');
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
},
|
||||
async doSubmit() {
|
||||
this.$refs["addForm"].validate().then(async () => {
|
||||
if (!this.formData.brief || this.formData.brief.length < this.config.words) {
|
||||
vant.Toast('提案案由最少需要' + this.config.words + '字')
|
||||
return
|
||||
}
|
||||
vant.Dialog.confirm({
|
||||
title: '提示',
|
||||
message: '确定要提交此提案吗?',
|
||||
}).then(async () => {
|
||||
if (this.formData.sign !== "") {
|
||||
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
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.$toast.success('成功');
|
||||
window.location.href = "/mobile/proposal/compose"
|
||||
} else {
|
||||
this.$toast.fail('失败');
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
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 mProposal.getProposalConfig()
|
||||
|
||||
vant.Dialog.alert({
|
||||
title: '撰写须知',
|
||||
message: this.config.writeRemind,
|
||||
}).then(() => {
|
||||
// on close
|
||||
});
|
||||
|
||||
this.meetingOptions = await mProposal.getOpenMeeting()
|
||||
const typeOptions = await mProposal.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 mProposal.getDelegation(this.formData.teacherMeetingId)
|
||||
|
||||
|
||||
delegationOptions.forEach(v => {
|
||||
this.delegationOptions.push({value: v.id, text: v.dbtname})
|
||||
})
|
||||
this.typeOptions = typeOptions.filter(v => v.value)
|
||||
console.log(this.typeOptions)
|
||||
|
||||
// typeOptions.forEach(v => {
|
||||
// this.typeOptions.push({value: v.id, text: v.typeName})
|
||||
// })
|
||||
|
||||
this.$set(this.formData, "delegationId", this.delegationOptions.length > 0 ? this.delegationOptions[0].value : '')
|
||||
this.$set(this.formData, "delegationName", this.delegationOptions.length > 0 ? 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>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user