@@ -5,23 +5,28 @@
:disabled="!edit" title="日志主题" required />
<l-select @input="setValue('JournalSend.JTypeId', $event)" :value="getValue('JournalSend.JTypeId')"
:disabled="!edit" :range="dataSource.JournalSend.JTypeId" title="日志类型" required />
<!-- <l-organize-picker @input="setValue('JournalSend.JReceiveId', $event)"
:value="getValue('JournalSend.JReceiveId')" :readonly="!edit" type="user" title="接收人" required /> -->
<l-organize-picker @input="setValue('JournalSend.JReceiveId', $event)"
:value="getValue('JournalSend.JReceiveId')" :readonly="!edit" type="user" title="接收人"
:multiple="true"
/>
<l-textarea @input="setValue('JournalSend.JContent', $event)" :value="getValue('JournalSend.JContent')"
:readonly="!edit" title="日志内容" required />
</view>
<view v-if="ready && edit" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
<l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
提交保存
保存
</l-button>
<l-button v-if="edit" @click="action('send',true)" size="lg" color="orange" class="block margin-top" block>
发送
</l-button>
<!-- <l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
编辑本页
</l-button> -->
<l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red"
<!-- < l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red"
class="block margin-top" block>
取消编辑
</l-button>
</l-button> -->
<!-- <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
删除
</l-button> -->
@@ -58,6 +63,7 @@
data() {
return {
contentTextArea:"",
// 页面相关参数
id: null,
mode: null,
@@ -82,12 +88,12 @@
dataSource: '0',
verify: "NotNull"
},
// JReceiveId: {
// type: 'organize',
// title: '接收人',
// dataType: 'user',
// verify: "NotNull"
// },
JReceiveId: {
type: 'organize',
title: '接收人',
dataType: 'user',
verify: "NotNull"
},
JContent: {
type: 'textarea',
title: '日志内容',
@@ -125,7 +131,7 @@
this.id = id
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
@@ -144,11 +150,43 @@
this.origin = await this.getDefaultForm()
} else {
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/Journal/form', this.id)
let doc = document.createElement("div");
doc.innerHTML = result.JournalSend.JContent;
let value = doc.innerText
result.JournalSend.JContent = value
this.origin = await this.formatFormData(result)
}
this.current = this.COPY(this.origin)
},
async save(tipFlag){
const verifyResult = this.verifyForm()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (tipFlag && !(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
if(tipFlag) this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
this.HTTP_POST('learun/adms/EducationalAdministration/Journal/savePt', postData, '表单提交保存失败')
.then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
if(tipFlag){
this.EMIT('EducationalAdministrationJournalSend-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
}
})
},
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
@@ -164,30 +202,7 @@
break
case 'save':
const verifyResult = this.verifyForm()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
this.HTTP_POST('learun/adms/EducationalAdministration/Journal/savePt', postData, '表单提交保存失败')
.then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationJournalSend-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
await this.save(true)
break
case 'delete':
@@ -208,7 +223,25 @@
this.this.TOAST('删除成功', 'success')
})
break
case 'send':
await this.save();
if (!(await this.CONFIRM('发送确认', '确定要发送本页表单内容吗?', true))) {
return
}
this.LOADING('正在发送...')
this.HTTP_POST('learun/adms/EducationalAdministration/Journal/send', this.id, '表单发送失败')
.then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationJournalSend-list-change')
this.NAV_BACK()
this.TOAST('发送成功')
})
break
default:
break
}