224 lines
9.3 KiB
HTML
224 lines
9.3 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
<style>
|
|
.dialog-footer .el-button {
|
|
padding: 12px 30px;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<guava ref="guava">
|
|
<el-card shadow="never">
|
|
<div class="btn-group tool-button ">
|
|
<el-date-picker
|
|
v-model="pageForm.year"
|
|
type="year"
|
|
@change="doSearch"
|
|
value-format="yyyy"
|
|
placeholder="选择年">
|
|
</el-date-picker>
|
|
</div>
|
|
<div class="btn-group tool-button">
|
|
<el-input placeholder="请输入项目名称" clearable v-model="pageForm.projectName"
|
|
@keyup.enter.native="doSearch">
|
|
</el-input>
|
|
</div>
|
|
<div class="btn-group tool-button">
|
|
<el-button type="primary" icon="el-icon-search" @click="doSearch"></el-button>
|
|
</div>
|
|
|
|
<div class="pull-right offscreen-right">
|
|
<el-button type="primary" icon="el-icon-plus" @click="openAdd">添加项目</el-button>
|
|
</div>
|
|
</el-card>
|
|
<el-card shadow="never" class="mt20">
|
|
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
|
v-loading="tabLoading">
|
|
<el-table-column align="center" header-align="center" label="序号" width="120px">
|
|
<template scope="scope">
|
|
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="项目名称" prop="projectName" header-align="center"
|
|
align="center"></el-table-column>
|
|
<el-table-column label="创建时间" prop="createTime" header-align="center"
|
|
align="center"></el-table-column>
|
|
<el-table-column align="center" header-align="center" label="操作" fixed="right"
|
|
width="160px">
|
|
<template slot-scope="{row}">
|
|
<el-button @click="openEdit(row)" type="primary" size="mini">编辑</el-button>
|
|
<el-button @click="doDelete(row)" type="danger" size="mini">删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!--#include("/layouts/pagination.html"){}#-->
|
|
</el-card>
|
|
|
|
|
|
<template #edit>
|
|
<vi-title title="项目信息"></vi-title>
|
|
<div>
|
|
<el-form :model="formData" ref="addForm" :rules="formRules" label-width="100px">
|
|
<el-row :gutter="20">
|
|
<el-col>
|
|
<el-form-item label="项目名称" prop="projectName">
|
|
<el-input type="text" v-model="formData.projectName" maxlength="50" placeholder="请填写项目名称"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col>
|
|
<el-form-item prop="groupId" label="面向对象">
|
|
<div style="display: flex; justify-content: space-between">
|
|
<div style="width: 99%">
|
|
<el-select prop="groupId" placeholder="人员范围"
|
|
v-model="formData.groupId"
|
|
style="width: 99%;"
|
|
clearable
|
|
filterable>
|
|
<el-option v-for="item in activityGroupList"
|
|
:label="item.groupName"
|
|
:value="item.groupId"></el-option>
|
|
</el-select>
|
|
</div>
|
|
<div>
|
|
<el-button
|
|
@click="$refs.drawerUserScope.userScopeDialog = true"
|
|
type="primary">设置
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
|
|
<div style="float: right;margin: 20px 0">
|
|
<el-button type="primary" :disabled="subDis" @click="operation">确 定</el-button>
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
</guava>
|
|
|
|
<drawer-user-scope
|
|
@group_change="getActivityGroup"
|
|
ref="drawerUserScope"
|
|
:group_id.sync="formData.groupId"
|
|
></drawer-user-scope>
|
|
|
|
<!-- <el-dialog :title="title" :visible.sync="DialogVisible" :close-on-click-modal="false" width="40%">-->
|
|
<!-- <el-form :model="formData" ref="addForm" :rules="formRules"-->
|
|
<!-- label-width="100px">-->
|
|
<!-- <el-form-item label="项目名称" prop="projectName">-->
|
|
<!-- <el-input type="text" v-model="formData.projectName" maxlength="50" placeholder="请填写项目名称"></el-input>-->
|
|
<!-- </el-form-item>-->
|
|
<!-- </el-form>-->
|
|
|
|
<!-- <span slot="footer" class="dialog-footer">-->
|
|
<!-- <el-button @click="DialogVisible = false">取 消</el-button>-->
|
|
<!-- <el-button type="primary" :disabled="subDis" @click="operation">确 定</el-button>-->
|
|
<!-- </span>-->
|
|
<!-- </el-dialog>-->
|
|
</div>
|
|
|
|
<script>
|
|
var vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
data() {
|
|
return {
|
|
title: "",
|
|
subDis: false,
|
|
DialogVisible: false,
|
|
tabLoading: false,
|
|
pageForm: {},
|
|
formRules: {
|
|
projectName: [{required: true, message: '必选', trigger: ['blur', 'change']}],
|
|
groupId: [{required: true, message: '必选', trigger: ['blur', 'change']}],
|
|
},
|
|
formData:{},
|
|
activityGroupList: [],
|
|
}
|
|
},
|
|
components: {
|
|
'guava': httpVueLoader('/components/plugins/Guava.vue'),
|
|
'drawer-user-scope': httpVueLoader('/components/plugins/DrawerUserScope.vue'),
|
|
},
|
|
methods: {
|
|
openAdd() {
|
|
this.title = "添加项目"
|
|
this.formData = {}
|
|
// this.DialogVisible = true;
|
|
if (this.$refs['addForm']) {
|
|
this.$refs['addForm'].resetFields()
|
|
}
|
|
this.$refs.guava.edit()
|
|
},
|
|
openEdit(data) {
|
|
this.title = "编辑项目"
|
|
this.formData = data
|
|
// this.DialogVisible = true;
|
|
this.$refs.guava.edit()
|
|
},
|
|
async operation() {
|
|
let method = this.formData.id ? "/doEdit" : "/doAdd"
|
|
this.$refs["addForm"].validate(async (valid) => {
|
|
if (valid) {
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '正在提交...',
|
|
spinner: 'el-icon-loading',
|
|
background: COVER_LAYER_COLOR
|
|
});
|
|
const resp = await $.post(loc() + method, this.formData)
|
|
|
|
if(resp.code===0){
|
|
// this.DialogVisible = false
|
|
this.$refs.guava.index()
|
|
this.notifySuccess(resp.msg)
|
|
this.pageData()
|
|
}else{
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
loading.close()
|
|
}
|
|
});
|
|
},
|
|
async doDelete(row) {
|
|
let self = this
|
|
this.$confirm('确定要删除吗?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
callback: async (a, b) => {
|
|
if ("confirm" === a) {
|
|
const resp = await $.get(loc() + "/doDelete", {id: row.id})
|
|
|
|
if(resp.code===0){
|
|
this.notifySuccess(resp.msg)
|
|
this.pageData()
|
|
}else{
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
async getActivityGroup() {
|
|
const resp = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
|
|
this.activityGroupList = resp.data
|
|
}
|
|
},
|
|
async created() {
|
|
this.pageData()
|
|
this.getActivityGroup()
|
|
}
|
|
})
|
|
</script>
|
|
<!--#
|
|
}
|
|
#-->
|