commit
This commit is contained in:
@@ -1,152 +0,0 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.el-descriptions__table {
|
||||
table-layout: fixed !important;
|
||||
}
|
||||
|
||||
.el-descriptions-item__cell {
|
||||
text-align: center !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<el-card shadow="never">
|
||||
<!--#include("/platform/activity/union/addPlanCommon.html"){}#-->
|
||||
</el-card>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let E = window.wangEditor
|
||||
const editors = {}
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
components: {
|
||||
'guava': httpVueLoader('/components/plugins/Guava.vue'),
|
||||
'plan-info': httpVueLoader('/components/activity/school/planInfo.vue'),
|
||||
},
|
||||
data() {
|
||||
let validContent = (rule, value, callback) => {
|
||||
if (!this.formData.content || !dd3s.html2txt(this.formData.content)) {
|
||||
callback(new Error('请填写计划内容'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
activityTypeList: [],
|
||||
eventList: [],
|
||||
formData: {
|
||||
type: '40002',
|
||||
name: '',
|
||||
time: '',
|
||||
event: '',
|
||||
content: ''
|
||||
},
|
||||
formRules: {
|
||||
type: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
time: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
money: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
event: [{required: true, message: '必填', trigger: ['blur']}],
|
||||
activityType: [{required: true, message: '必填', trigger: ['blur']}],
|
||||
content: [{validator: validContent, trigger: ['blur', 'change']}]
|
||||
},
|
||||
id: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
if (this.id) {
|
||||
sublime.jumpPagePjax('/platform/activity/plan/union')
|
||||
}
|
||||
},
|
||||
doHandle() {
|
||||
let url = this.formData.id ? "/doEdit" : "/doAdd"
|
||||
this.$refs["form"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
|
||||
const resp = await $.post('/platform/activity/plan' + url, {
|
||||
id: this.formData.id,
|
||||
name: this.formData.name,
|
||||
time: this.formData.time,
|
||||
content: this.formData.content,
|
||||
money: this.formData.money,
|
||||
event: JSON.stringify(this.formData.event),
|
||||
type: '40002',
|
||||
activityType: this.formData.activityType,
|
||||
})
|
||||
|
||||
if (resp.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: resp.msg,
|
||||
type: 'success',
|
||||
duration: 500,
|
||||
onClose: () => {
|
||||
sublime.jumpPagePjax('/platform/activity/plan/union')
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.$notify.error({title: '错误', message: '存在未填写的的必填项'});
|
||||
}
|
||||
});
|
||||
},
|
||||
initEditor() {
|
||||
let keys = ['content']
|
||||
keys.forEach(key => {
|
||||
$("#" + key).html("")
|
||||
editors[key] = new E('#' + key)
|
||||
editors[key].config.onchange = (html) => {
|
||||
this.formData[key] = html
|
||||
}
|
||||
editors[key].create()
|
||||
if (this.formData[key]) {
|
||||
editors[key].txt.html(this.formData[key])
|
||||
}
|
||||
})
|
||||
},
|
||||
async getEvents() {
|
||||
const {code, data, msg} = await $.get("/platform/activity/common/getEvents")
|
||||
return data
|
||||
},
|
||||
async getActivityType() {
|
||||
const {code, data, msg} = await $.get("/platform/activity/common/getActivityType")
|
||||
return data
|
||||
},
|
||||
async initData() {
|
||||
const id = GetQueryString("id")
|
||||
this.id = id
|
||||
if (id) {
|
||||
const resp = await $.post('/platform/activity/plan/findOne', {id})
|
||||
if (resp.code === 0) {
|
||||
const cloneRow = clone(resp.data)
|
||||
cloneRow.event = JSON.parse(cloneRow.event)
|
||||
this.formData = cloneRow
|
||||
this.$nextTick(() => {
|
||||
this.initEditor()
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
const self = this
|
||||
setTimeout(function () {
|
||||
self.initEditor()
|
||||
}, 100)
|
||||
//this.eventList = await this.getEvents()
|
||||
this.activityTypeList = await this.getActivityType()
|
||||
await this.initData()
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user