first commit
This commit is contained in:
@@ -0,0 +1,333 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<style>
|
||||
.module_content {
|
||||
padding-top: 5px;
|
||||
height: calc(100vh - 155px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.right-tabs {
|
||||
height: calc(100vh - 110px);
|
||||
}
|
||||
|
||||
.module_wrap {
|
||||
height: calc(100vh - 110px);
|
||||
overflow-y: scroll;
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.module_wrap .module_box {
|
||||
display: flex;
|
||||
width: 250px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.module_wrap .module_box .module_icon {
|
||||
background-color: #31b48d;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
line-height: 50px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.module_wrap .module_box .module_icon i {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.module_wrap .module_box .module_info {
|
||||
width: 150px;
|
||||
border-radius: 0 5px 5px 0;
|
||||
border: 1px solid #eee;
|
||||
border-left: none;
|
||||
background-color: #fff;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.module_wrap .module_box .module_info .title {
|
||||
font-size: 20px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
color: #31b48d;
|
||||
}
|
||||
|
||||
.el-tree-node {
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
.el-tree-node__label {
|
||||
width: calc(100% - 24px);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="app">
|
||||
<guava ref="guava">
|
||||
<el-row :gutter="10" style="height: calc(100vh - 70px)">
|
||||
<el-col :span="5">
|
||||
<el-card shadow="never">
|
||||
<div>
|
||||
<el-input placeholder="请输入内容" v-model="projectFilterText">
|
||||
<template slot="append">
|
||||
<span @click="openAddProject" style="cursor: pointer">
|
||||
新增补助范围
|
||||
</span>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<div class="module_content">
|
||||
<el-tree :data="leftTreeData" :props="{label:'projectName'}" @node-click="projectClick"
|
||||
highlight-current>
|
||||
<span class="el-tree-node__label" slot-scope="{ node,data }">
|
||||
<span style="max-width: calc(100% - 70px);overflow: hidden;text-overflow: ellipsis; ">
|
||||
<i :class="node.level=== 1 ? 'el-icon-s-home' : node.level=== 2 ?'el-icon-coin' :''"></i>
|
||||
{{ (node || {}).label }}
|
||||
</span>
|
||||
<span style="width: 70px">
|
||||
<el-button type="text" size="mini"
|
||||
@click="openEditProject(data)">编辑</el-button>
|
||||
<el-button type="text" size="mini"
|
||||
@click="delProject(data)">删除</el-button>
|
||||
</span>
|
||||
</span>
|
||||
</el-tree>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="19" style="height: 100%">
|
||||
<el-card shadow="never" style="height: 100%">
|
||||
<el-row>
|
||||
<el-col :span="14" style="display: flex">
|
||||
<el-input v-model="queryForm.projectName" placeholder="请输入名称" size="small"
|
||||
clearable></el-input>
|
||||
<el-button type="primary" style="margin-left: 10px;"
|
||||
size="small"
|
||||
icon="el-icon-search" @click="diseaseList">查询
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10" style="text-align: right">
|
||||
<el-button type="primary" icon="el-icon-circle-plus-outline"
|
||||
size="small"
|
||||
@click="openAdd">
|
||||
新增子类
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="mt10" id="tableWrap" data-bottom="30">
|
||||
<el-table :data="tableData" style="width: 100%" border v-loading="tableLoading" height="100%">
|
||||
<el-table-column type="index" label="序号" width="60" align="center"
|
||||
:index="indexMethod"></el-table-column>
|
||||
<el-table-column prop="diseaseName" label="说明"
|
||||
align="center"></el-table-column>
|
||||
<el-table-column label="操作" width="300" align="center">
|
||||
<template slot-scope="{row}">
|
||||
<el-button type="primary" size="mini" @click="openEditDisease(row)">编辑</el-button>
|
||||
<el-button type="danger" size="mini" @click="delDisease(row.id)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</el-col>
|
||||
|
||||
<el-dialog :title="diseaseFormData.menuId?'编辑':'新增'" :visible.sync="diseaseDialogVisible" width="60%"
|
||||
:close-on-click-modal="false">
|
||||
<el-form :model="diseaseFormData" ref="diseaseForm" :rules="formRules" label-width="100px">
|
||||
<el-form-item label="" prop="" v-show="false">
|
||||
<el-input type="text" v-model="diseaseFormData.id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="说明" prop="diseaseName">
|
||||
<el-input maxlength="100"
|
||||
placeholder="菜单名称"
|
||||
type="textarea"
|
||||
v-model="diseaseFormData.diseaseName"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="diseaseDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="saveDisease">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="补助范围" :visible="projectDialog" width="40%">
|
||||
<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>
|
||||
|
||||
</el-row>
|
||||
</guava>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var vue = new Vue({
|
||||
el: '#app',
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
projectFormData: {},
|
||||
|
||||
|
||||
projectFilterText: null,
|
||||
|
||||
leftTreeData: [],
|
||||
selectProject: [],
|
||||
|
||||
diseaseDialogVisible: false,
|
||||
|
||||
diseaseFormData: {},
|
||||
|
||||
queryForm: {},
|
||||
|
||||
projectDialog: false
|
||||
}
|
||||
},
|
||||
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)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
delProject({id}) {
|
||||
this.$confirm('您确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.post(loc() + '/delProject', {id}).then(({msg}) => {
|
||||
this.notifySuccess(msg)
|
||||
this.projectList()
|
||||
})
|
||||
})
|
||||
},
|
||||
async projectList() {
|
||||
return new Promise(resolve => {
|
||||
$.post(loc() + '/projectList').then(({data}) => {
|
||||
this.leftTreeData = data
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
},
|
||||
projectClick(data, node) {
|
||||
this.selectProject = data
|
||||
this.diseaseList()
|
||||
},
|
||||
|
||||
openAdd() {
|
||||
this.diseaseFormData = {
|
||||
typeId: this.selectProject.id,
|
||||
}
|
||||
this.diseaseDialogVisible = true
|
||||
},
|
||||
openEditDisease(row) {
|
||||
this.diseaseFormData = {...row}
|
||||
this.diseaseDialogVisible = true
|
||||
},
|
||||
|
||||
saveDisease() {
|
||||
this.$refs.diseaseForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.diseaseFormData.typeId = this.selectProject.id
|
||||
$.post(loc() + '/saveDisease', this.diseaseFormData).then((res) => {
|
||||
this.diseaseDialogVisible = false
|
||||
this.notifySuccess(res.msg)
|
||||
this.diseaseList()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
delDisease(id) {
|
||||
this.$confirm('您确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.post('/platform/sys/appMenu/delDisease', {id}).then(({msg}) => {
|
||||
this.notifySuccess(msg)
|
||||
this.projectList()
|
||||
this.diseaseList()
|
||||
})
|
||||
})
|
||||
},
|
||||
async diseaseList() {
|
||||
this.tableLoading = true
|
||||
const {data} = await $.get(loc() + '/diseaseList', {
|
||||
projectId: this.selectProject.id, projectName: this.queryForm.projectName
|
||||
})
|
||||
this.tableLoading = false
|
||||
this.tableData = data
|
||||
},
|
||||
|
||||
roleList() {
|
||||
$.get('/platform/sys/appMenu/roles').then(res => {
|
||||
this.roles = res.data
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.projectList().then(() => {
|
||||
if (this.leftTreeData) {
|
||||
this.selectProject = this.leftTreeData[0]
|
||||
this.diseaseList()
|
||||
}
|
||||
})
|
||||
this.roleList()
|
||||
},
|
||||
async mounted() {
|
||||
await httpVueLoader('/components/plugins/Guava.vue', 'Guava')()
|
||||
calcTableHeight(['tableWrap'])
|
||||
window.onresize = () => {
|
||||
calcTableHeight(['tableWrap'])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
@@ -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