123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <template>
- <view>
- <u--form :model="inputForm" labelWidth="100px" class="u-form" labelPosition="left" :rules="rules" ref="inputForm">
- <u-form-item label="标题" borderBottom prop="mailDTO.title">
- <u--input v-model="inputForm.mailDTO.title" placeholder="请输入标题" border="none"></u--input>
- </u-form-item>
- <u-form-item label="发送到" borderBottom prop="receiverIds">
- <user-select v-model="inputForm.receiverIds"></user-select>
- </u-form-item>
- <u-form-item label="内容" borderBottom prop="mailDTO.content">
- <u--textarea v-model="inputForm.mailDTO.content" placeholder="请输入内容" border="none"></u--textarea>
- </u-form-item>
- </u--form>
- <view class="bottom-wrap flex">
- <u-button
- type="error"
- text="存为草稿"
- @click="saveDraft"
- ></u-button>
- <u-button
- type="primary"
- text="发送邮件"
- @click="sendEmail"
- ></u-button>
- </view>
- </view>
- </template>
- <script>
- import userSelect from '@/components/user-select/user-select.vue'
- var graceChecker = require("@/common/graceChecker.js");
- import mailComposeService from "@/api/mail/mailComposeService";
- import userService from "@/api/sys/userService"
- export default {
-
- async onLoad(mail) {
- if(mail&&mail.id){
- let data = await mailComposeService.queryById(mail.id);
- this.inputForm = this.recover(this.inputForm, data);
- }
- },
- components:{
- userSelect
- },
- data () {
- return {
- data: [],
- inputForm: {
- id: '',
- status: '',
- receiverIds: '',
- mailDTO: {
- title: '',
- overview: '',
- content: ''
- }
- },
- rules: {
- 'receiverIds': [
- {
- required: true,
- message: '请选择收件人',
- trigger: ['blur', 'change']
- }
- ],
- 'mailDTO.title': [
- {
- required: true,
- message: '请输入邮件标题',
- trigger: ['blur', 'change']
- }
- ],
- 'mailDTO.content': [
- {
- required: true,
- message: '请输入邮件内容',
- trigger: ['blur', 'change']
- }
- ]
- }
- }
- },
- methods: {
- saveDraft () {
- this.inputForm.status = '0'
- this.formSubmit()
- },
- sendEmail () {
- this.inputForm.status = '1'
- this.formSubmit()
- },
- formSubmit: function(e) {
- //定义表单规则
- this.$refs.inputForm.validate().then(res => {
- uni.showLoading()
- mailComposeService.save(this.inputForm).then((data) => {
- uni.showToast({title:data, icon:"success"});
- uni.navigateTo({
- url: '/pages/apps/mail/inbox'
- })
- }).catch((e)=>{
- console.log(e)
- })
- })
- }
- }
- }
- </script>
|