first commit
This commit is contained in:
@@ -0,0 +1,406 @@
|
||||
<div id="app" class="platform" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<div class="search">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">年度</div>
|
||||
<div class="search-item-option">
|
||||
<el-date-picker
|
||||
style="width: 100%"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
type="year"
|
||||
placeholder="选择年">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">计划名称</div>
|
||||
<div class="search-item-option">
|
||||
<el-input v-model="pageForm.name" placeholder="请输入计划名称" clearable></el-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="window.type === 40002" class="search-item">
|
||||
<div class="search-item-label">工会名称</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.tissueId" placeholder="请选择工会" filterable clearable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in unionList"
|
||||
:key="item.id"
|
||||
:label="item.unionname"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="window.type === 40003" class="search-item">
|
||||
<div class="search-item-label">协会(社团)</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.tissueId" placeholder="请选择协会(社团)" filterable clearable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in clubList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <template v-if="searchMore">
|
||||
<div class="search-item">
|
||||
<div class="search-item-label">项目名称</div>
|
||||
<div class="search-item-option">
|
||||
<el-select v-model="pageForm.eventId" placeholder="请选择活动项目" filterable clearable
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in eventList"
|
||||
:key="item.id"
|
||||
:label="item.allName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
</template>-->
|
||||
|
||||
|
||||
<div class="search-query">
|
||||
<el-button type="primary" icon="el-icon-search" @click="pageData">搜索</el-button>
|
||||
<!-- <more v-model="searchMore"></more>-->
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt10">
|
||||
<!--<table-tool label="计划列表" :app="this">
|
||||
<!–<template #func>
|
||||
<el-button type="primary" icon="el-icon-edit-outline" size="small"
|
||||
@click="openAdd">
|
||||
创建活动计划
|
||||
</el-button>
|
||||
</template>–>
|
||||
</table-tool>-->
|
||||
|
||||
<el-table :data="tableData" style="width: 100%;margin-bottom: 20px" row-key="id"
|
||||
@sort-change="pageOrder" v-loading="tableLoading" :size="tableSize">
|
||||
|
||||
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
|
||||
width="80px"></el-table-column>
|
||||
|
||||
<el-table-column prop="year" label="年度"></el-table-column>
|
||||
|
||||
<el-table-column v-if="window.type === 40002" prop="unionname" label="所属工会" show-overflow-tooltip>
|
||||
<template scope="{row}">
|
||||
<span>{{unionList.find(x => x.id == row.tissueId) === undefined ? '' : unionList.find(x => x.id == row.tissueId).unionname}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column v-if="window.type === 40003" prop="clubname" label="协会(社团)" show-overflow-tooltip>
|
||||
<template scope="{row}">
|
||||
<span>{{clubList.find(x => x.id == row.tissueId) === undefined ? '' : clubList.find(x => x.id == row.tissueId).name}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="name" label="计划名称" show-overflow-tooltip></el-table-column>
|
||||
<!--<el-table-column prop="allName" label="活动项目" show-overflow-tooltip>
|
||||
</el-table-column>-->
|
||||
<el-table-column prop="activityTypeName" label="活动类型" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column prop="time" label="计划预计时间" sortable></el-table-column>
|
||||
<el-table-column prop="money" label="预算费用"></el-table-column>
|
||||
<!--<el-table-column prop="carryOut" label="计划状态">
|
||||
<template scope="{row}">
|
||||
<span v-if="row.carryOut" class="text-success">已执行</span>
|
||||
<span v-if="!row.carryOut" class="text-primary">未执行</span>
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
|
||||
<el-table-column prop="userOnline" align="center" header-align="center" label="操作" width="150px">
|
||||
<template scope="{row}">
|
||||
<el-dropdown @command="dropdownCommand">
|
||||
<el-button size="mini" :loading="row.loading">
|
||||
<i class="ti-settings"></i>
|
||||
<span class="ti-angle-down"></span>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="{type:'view',row}">
|
||||
查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'edit',row}">
|
||||
编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{type:'delete',row}">
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!--#include("/layouts/pagination.html"){}#-->
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<template #edit_func>
|
||||
<el-button type="primary" @click="operation">确 定</el-button>
|
||||
</template>
|
||||
|
||||
<template #edit>
|
||||
<vi-title title="填写计划信息"></vi-title>
|
||||
<el-form :model="formData" ref="form" :rules="formRules" label-width="100px" label-position="left"
|
||||
label-suffix=":" style="padding: 0 2%">
|
||||
|
||||
<!-- <el-form-item prop="type" label="活动类型">
|
||||
<el-radio-group v-model="formData.type">
|
||||
<el-radio label="2" border>分工会活动计划</el-radio>
|
||||
<el-radio label="3" border>协会(社团)活动计划</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>-->
|
||||
|
||||
<el-form-item prop="name" label="计划名称">
|
||||
<el-input maxlength="50" placeholder="请填写计划名称" v-model="formData.name"
|
||||
type="text"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="time" label="计划时间">
|
||||
<el-date-picker
|
||||
v-model="formData.time"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="event" label="活动项目">
|
||||
<!--<el-input maxlength="50" placeholder="请填写活动项目" v-model="formData.event"
|
||||
type="text"></el-input>-->
|
||||
<el-select v-model="formData.event" placeholder="请选择活动项目" filterable clearable multiple
|
||||
style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in eventList"
|
||||
:key="item.id"
|
||||
:label="item.allName"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item prop="content" label="计划内容" class="is-required">
|
||||
<div id="content"></div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<template #view>
|
||||
<plan-info ref="info"></plan-info>
|
||||
</template>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let E = window.wangEditor
|
||||
const editors = {}
|
||||
|
||||
const vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
let validContent = (rule, value, callback) => {
|
||||
if (!this.formData.content || !dd3s.html2txt(this.formData.content)) {
|
||||
callback(new Error('请填写计划内容'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
return {
|
||||
clubList: [],
|
||||
planUrl: "/platform/activity/plan",
|
||||
unionList: [],
|
||||
eventList: [],
|
||||
flag: false,
|
||||
pageForm: {
|
||||
type: type,
|
||||
year: new Date().getFullYear() + ''
|
||||
},
|
||||
formData: {
|
||||
name: '',
|
||||
time: '',
|
||||
event: '',
|
||||
content: ''
|
||||
},
|
||||
tableColumns: [
|
||||
{prop: 'name', label: '计划名称'},
|
||||
{prop: 'time', label: '计划预计时间'},
|
||||
{prop: 'allName', label: '活动项目'},
|
||||
{prop: 'carryOut', label: '计划状态'}
|
||||
],
|
||||
formRules: {
|
||||
type: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
name: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
time: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
event: [{required: true, message: '必填', trigger: ['blur', 'change']}],
|
||||
content: [{validator: validContent, trigger: ['blur', 'change']}]
|
||||
},
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'guava': httpVueLoader('/components/plugins/Guava.vue'),
|
||||
'plan-info': httpVueLoader('/components/activity/school/planInfo.vue'),
|
||||
},
|
||||
methods: {
|
||||
dropdownCommand(command) {
|
||||
const {type, row} = command
|
||||
if (type === 'view') {
|
||||
this.openView(row)
|
||||
} else if (type === 'edit') {
|
||||
this.openEdit(row)
|
||||
} else if (type === 'delete') {
|
||||
this.doDelete(row)
|
||||
}
|
||||
},
|
||||
openView(row) {
|
||||
const {id} = row
|
||||
this.$refs.info.getInfo(id)
|
||||
this.$refs.guava.view()
|
||||
},
|
||||
async openEdit(row) {
|
||||
|
||||
if (window.type === 40002) {
|
||||
sublime.jumpPagePjax('/platform/activity/plan/addUnionPlan?id=' + row.id)
|
||||
} else if (window.type === 40003) {
|
||||
sublime.jumpPagePjax('/platform/activity/plan/addClubPlan?id=' + row.id)
|
||||
} else if (window.type === 40001) {
|
||||
sublime.jumpPagePjax('/platform/activity/plan/addSchoolPlan?id=' + row.id)
|
||||
}
|
||||
},
|
||||
async openAdd() {
|
||||
this.formData = {}
|
||||
this.flag = false
|
||||
this.$refs.guava.edit()
|
||||
this.$nextTick(() => {
|
||||
this.initEditor()
|
||||
if (this.$refs['form']) {
|
||||
this.$refs['form'].resetFields()
|
||||
}
|
||||
|
||||
this.formData = {
|
||||
type: '40003',
|
||||
name: '',
|
||||
time: '',
|
||||
event: '',
|
||||
content: ''
|
||||
}
|
||||
})
|
||||
},
|
||||
async operation() {
|
||||
let url = this.formData.id ? "/doEdit" : "/doAdd"
|
||||
this.$refs["form"].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: '正在提交...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: COVER_LAYER_COLOR
|
||||
});
|
||||
|
||||
this.formData.type = this.pageForm.type
|
||||
|
||||
const resp = await $.post(this.planUrl + url, {
|
||||
id: this.formData.id,
|
||||
name: this.formData.name,
|
||||
time: this.formData.time,
|
||||
content: this.formData.content,
|
||||
event: JSON.stringify(this.formData.event),
|
||||
type: this.pageForm.type,
|
||||
})
|
||||
if (resp.code === 0) {
|
||||
this.pageData()
|
||||
this.$refs.guava.index()
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
loading.close()
|
||||
|
||||
} else {
|
||||
this.$notify.error({title: '错误', message: '存在未填写的的必填项'});
|
||||
}
|
||||
});
|
||||
},
|
||||
doDelete(row) {
|
||||
const {id} = row
|
||||
this.$confirm('确定要删除该计划吗?', '提示', {type: 'warning'}).then(async () => {
|
||||
const resp = await $.post(this.planUrl + "/doDelete", {id: id});
|
||||
if (resp.code === 0) {
|
||||
this.pageData()
|
||||
this.$refs.guava.index()
|
||||
this.notifySuccess(resp.msg)
|
||||
} else {
|
||||
this.notifyError(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
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])
|
||||
}
|
||||
})
|
||||
},
|
||||
pageData() {
|
||||
sublime.showLoadingbar();
|
||||
this.tableLoading = true
|
||||
$.post("/platform/activity/plan/pageData", this.pageForm, (data) => {
|
||||
sublime.closeLoadingbar();
|
||||
this.tableLoading = false
|
||||
if (data.code === 0) {
|
||||
this.tableData = data.data.list;
|
||||
this.pageForm.totalCount = data.data.totalCount;
|
||||
} else {
|
||||
this.$message.error(data.msg);
|
||||
}
|
||||
}, "json");
|
||||
},
|
||||
async getMyClub() {
|
||||
return await $.post('/platform/activity/yearSummary/getMyClub')
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.pageData()
|
||||
this.eventList = await activity.getEvents()
|
||||
this.unionList = await getUnions(null);
|
||||
this.clubList = await getClubs()
|
||||
const isAdmin = "${@shiro.hasAnyRoles('sysadmin', 'A06')}" === 'true'
|
||||
if (!isAdmin) {
|
||||
const selfUnion = "${@shiro.getPrincipalProperty('union').getId()}";
|
||||
this.unionList = [this.unionList.find(x => x.id === selfUnion)]
|
||||
|
||||
const clubs = await this.getMyClub()
|
||||
let clubArray = []
|
||||
for (let c of Array.from(clubs)) {
|
||||
const cl = this.clubList.find(x => x.id === c)
|
||||
if (cl) {
|
||||
clubArray.push(cl)
|
||||
}
|
||||
}
|
||||
this.clubList = clubArray
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user