Files
UNION_NSI/target/classes/views/platform/projectfunding/manage.html
T
2026-09-08 19:49:21 +08:00

180 lines
6.9 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.viewTable .el-descriptions__table {
table-layout: fixed !important;
}
.viewTable .el-descriptions-item__cell {
text-align: center !important;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<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
placeholder="选择年度"
type="year"
@change="doSearch"
style="width: 100%"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">项目名称:</div>
<div class="search-item-option">
<el-input @keyup.enter.native="doSearch" clearable
placeholder="请输入项目名称"
style="width: 100%"
v-model="pageForm.projectName">
</el-input>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="项目列表">
<template #func>
<el-button @click="openAdd" size="medium" type="primary">新建项目</el-button>
</template>
</table-tool>
<el-table :data="tableData" :size="tableSize">
<el-table-column :index="indexMethod" align="center" header-align="center" label="序号" type="index"
width="80px"></el-table-column>
<el-table-column
:label="column.label"
:prop="column.prop"
:width="column.width"
:sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
>
</el-table-column>
<el-table-column label="操作" width="250px">
<template scope="{row}">
<!--<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>-->
<el-button @click="openEdit(row)" size="mini" type="primary">编辑</el-button>
<el-button @click="doDelete(row)" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
<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>
new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
title:'',
DialogVisible:false,
subDis: false,
tableColumns: [
{label: '项目名称', prop: 'projectName', sortable: true},
{label: '创建时间', prop: 'createTime', sortable: true},
],
pageForm:{
year:moment().format('YYYY'),
},
formData:{},
formRules: {
projectName: [{required: true, message: '必选', trigger: ['blur', 'change']}],
},
}
},
methods: {
openAdd() {
this.title = "添加项目"
this.formData = {}
this.DialogVisible = true;
if (this.$refs['addForm']) {
this.$refs['addForm'].resetFields()
}
},
openEdit(data) {
this.title = "编辑项目"
this.formData = data
this.DialogVisible = true;
},
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.notifySuccess(resp.msg)
this.pageData()
}else{
this.notifyWarning(resp.msg)
}
loading.close()
}
});
},
async doDelete(row) {
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)
}
}
}
});
},
},
created() {
this.pageData();
}
})
</script>
<!--#
}
#-->