180 lines
6.7 KiB
HTML
180 lines
6.7 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
<div id="app" v-cloak>
|
|
<guava ref="guava">
|
|
<el-card shadow="never">
|
|
<!--#include("/platform/evaluate/include_evaluate_edit.html"){}#-->
|
|
</el-card>
|
|
</guava>
|
|
</div>
|
|
|
|
<script>
|
|
|
|
let E = window.wangEditor
|
|
const editors = {}
|
|
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
components: {
|
|
'fgh-select': httpVueLoader('/components/plugins/FghSelect.vue?v=1.0.0'),
|
|
'drawer-user-scope': httpVueLoader('/components/plugins/DrawerUserScope.vue'),
|
|
},
|
|
data() {
|
|
let validProgram = (rule, value, callback) => {
|
|
if (!this.formData.program || !dd3s.html2txt(this.formData.program)) {
|
|
callback(new Error('请填写评选表彰程序'));
|
|
} else {
|
|
callback();
|
|
}
|
|
};
|
|
return {
|
|
stepActive: 0,
|
|
formData: {
|
|
time: [],
|
|
unionLimit: [],
|
|
},
|
|
formRules: {
|
|
name: [{required: true, message: '请填写评优评先名称', trigger: ['blur', 'change']}],
|
|
honor: [{required: true, message: '请选择类型', trigger: ['blur', 'change']}],
|
|
time: [{required: true, message: '请选择申请时间', trigger: ['blur', 'change']}],
|
|
groupId: [{required: true, message: '请选择参加人员范围', trigger: ['blur', 'change']}],
|
|
conditions: [{required: true, message: '请填写评选条件', trigger: ['blur', 'change']}],
|
|
pxxmlx: [{required: true, message: '请填写评选项目类型', trigger: ['blur', 'change']}],
|
|
program: [{validator: validProgram, trigger: ['blur', 'change']}],
|
|
},
|
|
unions: [],
|
|
unionTableData: [],
|
|
activityGroupList: [],
|
|
honorOptions: [],
|
|
radioActive: '直接分配',
|
|
rate: 0,
|
|
honor: {},
|
|
fpme: [],
|
|
}
|
|
},
|
|
methods: {
|
|
cascaderChange(o) {
|
|
for (const item of this.honorOptions) {
|
|
this.honor = item.children.find(x => {
|
|
return x.value === o
|
|
})
|
|
if (this.honor) {
|
|
this.formData.honorTypeId = item.value
|
|
return
|
|
}
|
|
}
|
|
},
|
|
initEditor() {
|
|
|
|
let keys = ['program']
|
|
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 initData() {
|
|
const id = GetQueryString("id")
|
|
this.id = id
|
|
if (id) {
|
|
const resp = await $.post('/platform/evaluate/findOne', {id})
|
|
if (resp.code === 0) {
|
|
this.formData = resp.data.evaluate
|
|
this.$set(this.formData, 'time', [this.formData.startTime, this.formData.endTime])
|
|
this.formData.honor = this.formData.honorId
|
|
this.fpme = resp.data.fpme
|
|
this.cascaderChange(this.formData.honorId)
|
|
this.$nextTick(() => {
|
|
this.initEditor()
|
|
})
|
|
}
|
|
}
|
|
},
|
|
async next() {
|
|
this.unionTableData = []
|
|
this.$refs.form.validate(async (valid) => {
|
|
if (valid) {
|
|
this.stepActive = 1
|
|
} else {
|
|
this.$notify({title: '警告', message: '存在未填的必填项', type: 'warning'})
|
|
}
|
|
});
|
|
},
|
|
async doAdd() {
|
|
this.formData.startTime = this.formData.time[0]
|
|
this.formData.endTime = this.formData.time[1]
|
|
this.formData.honorId = this.honor.value
|
|
|
|
if (this.honor.parentName === '集体荣誉' && !this.formData.directions) {
|
|
this.$notify({title: '警告', message: '请填写评选名额的说明', type: 'warning'})
|
|
return
|
|
}
|
|
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '正在提交...',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
});
|
|
const resp = await $.post('/platform/Evaluate/doHandle', {
|
|
evaluate: JSON.stringify(this.formData),
|
|
data: this.honor.parentName === '个人荣誉' ? JSON.stringify(this.unionTableData) : JSON.stringify([])
|
|
})
|
|
if (resp.code === 0) {
|
|
loading.close();
|
|
this.$notify({
|
|
title: '成功',
|
|
message: resp.msg,
|
|
type: 'success',
|
|
duration: 500,
|
|
onClose: () => {
|
|
sublime.jumpPagePjax('/platform/evaluate/manage')
|
|
}
|
|
});
|
|
}
|
|
},
|
|
async getActivityGroup() {
|
|
const resp = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
|
|
this.activityGroupList = resp.data
|
|
},
|
|
async getHonor() {
|
|
const resp = await $.get('/platform/evaluate/getHonor')
|
|
this.honorOptions = resp.data
|
|
},
|
|
doBack() {
|
|
if (GetQueryString("id") !== '') {
|
|
sublime.jumpPagePjax('/platform/evaluate/manage')
|
|
}
|
|
},
|
|
},
|
|
async created() {
|
|
const self = this
|
|
setTimeout(function () {
|
|
self.initEditor()
|
|
}, 100)
|
|
await this.getActivityGroup()
|
|
await this.getHonor()
|
|
await this.initData()
|
|
},
|
|
watch: {
|
|
'rate'(o) {
|
|
this.unionTableData.forEach(item => {
|
|
item.number = Math.round(item.membercount * o / 100)
|
|
})
|
|
},
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#-->
|