first commit
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app">
|
||||
<guava>
|
||||
<el-card shadow="never">
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mt10">
|
||||
<table-tool :app="this" label="补助分类">
|
||||
<template #func>
|
||||
<el-button size="small" type="primary" @click="openAddProject">新增分类</el-button>
|
||||
</template>
|
||||
</table-tool>
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column type="expand">
|
||||
<template scope="{row}">
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column type="index" label="序号" width="100px"></el-table-column>
|
||||
<el-table-column label="补助项目" prop="projectName"></el-table-column>
|
||||
<el-table-column label="操作" width="200px">
|
||||
<template scope="{row}">
|
||||
<el-button size="mini" type="primary" @click="openEditProject(row)">新增子类</el-button>
|
||||
<el-button size="mini" type="primary" @click="openEditProject(row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<el-dialog title="补助项目" :visible.sync="projectDialog" width="40%" :close-on-click-modal="false">
|
||||
<el-form :model="projectFormData" ref="projectForm" label-width="120px">
|
||||
<el-form-item label="补助项目" prop="projectName"
|
||||
:rules="[{required:true,message:'必填',trigger:['change','blur']}]">
|
||||
<el-input v-model="projectFormData.projectName" maxlength="20" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="projectDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="saveProject">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
projectDialog: false,
|
||||
projectFormData: {},
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openAddProject() {
|
||||
this.projectDialog = true
|
||||
if (this.$refs.projectForm) {
|
||||
this.$refs.projectForm.resetFields()
|
||||
}
|
||||
},
|
||||
openEditProject(row) {
|
||||
this.projectDialog = true
|
||||
this.$nextTick(() => {
|
||||
this.projectFormData = {...row}
|
||||
})
|
||||
},
|
||||
|
||||
saveProject() {
|
||||
this.$refs.projectForm.validate(async valid => {
|
||||
if (valid) {
|
||||
const resp = await $.post(loc() + '/saveProject', this.projectFormData)
|
||||
if (resp.code === 0) {
|
||||
this.projectDialog = false
|
||||
this.notifySuccess(resp.msg)
|
||||
this.pageData()
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
async pageData() {
|
||||
sublime.showLoadingbar()
|
||||
const resp = await $.post(loc() + '/pageData')
|
||||
sublime.closeLoadingbar()
|
||||
if (resp.code === 0) {
|
||||
this.tableData = resp.data
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.pageData()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user