parent
54cf970de9
commit
7788f5be06
@ -0,0 +1,46 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function index (params,noloading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/temporary-plan/index",
|
||||
params,
|
||||
noloading
|
||||
})
|
||||
}
|
||||
|
||||
export function show (params,noloading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/temporary-plan/show",
|
||||
params,
|
||||
noloading
|
||||
})
|
||||
}
|
||||
|
||||
export function save (data,noloading=true) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/temporary-plan/save",
|
||||
data,
|
||||
noloading
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params,noloading=true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/temporary-plan/destroy",
|
||||
params,
|
||||
noloading
|
||||
})
|
||||
}
|
||||
|
||||
export function statistic(params,noloading=false) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/temporary-plan/statistic",
|
||||
params,
|
||||
noloading
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<!-- 查询配置 -->
|
||||
<div style="padding: 0 20px">
|
||||
<div ref="lxHeader">
|
||||
<LxHeader icon="md-apps" text="统计管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content"></div>
|
||||
<slot>
|
||||
<div>
|
||||
<Button type="primary" @click="select.page = 1,getList()" style="margin-left: 10px">查询</Button>
|
||||
<Button type="primary" @click="dialogFormVisible = true" style="margin-left: 10px">新增</Button>
|
||||
</div>
|
||||
</slot>
|
||||
</LxHeader>
|
||||
</div>
|
||||
|
||||
<div class="table-tree">
|
||||
<el-table stripe :data="tableData" class="v-table" :height="tableHeight" border style="width: 100%">
|
||||
<el-table-column type="index" align="center">
|
||||
</el-table-column>
|
||||
<el-table-column header-align="center" prop="name" label="名称" width="180" />
|
||||
<el-table-column align="center" prop="year" label="年份" width="120" />
|
||||
<el-table-column align="center" prop="type_detail.value" label="资金类型" width="140" />
|
||||
<el-table-column align="center" prop="department.name" label="部门" width="200" />
|
||||
<el-table-column header-align="center" align="right" prop="plan_money" label="计划额度" width="200" />
|
||||
<el-table-column header-align="center" align="right" prop="use_money" label="已使用额度" width="200" />
|
||||
|
||||
<el-table-column fixed="right" label="操作" width="300">
|
||||
<template slot-scope="{ row }">
|
||||
<Button ghost size="small" @click="edit(row)" type="primary" style="margin-left: 10px;">编辑</Button>
|
||||
<Button ghost size="small" @click="destroy(row)" type="error" style="margin-left: 10px;">删除</Button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination">
|
||||
<el-pagination @current-change="e => {
|
||||
select.page = e;
|
||||
getList()
|
||||
}"
|
||||
:current-page="select.page"
|
||||
:page-size="select.page_size"
|
||||
background
|
||||
layout="prev, pager, next" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog title="编辑" :visible.sync="dialogFormVisible" width="60%">
|
||||
<el-form :model="form" :rules="rules" ref="form" label-position="right" label-width="120px">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off" style="width: 300px"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="年份" prop="year">
|
||||
<el-date-picker :value="form.year.toString()" style="width: 300px;" type="year" value-format="yyyy" @input="e => form.year = e"></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门" prop="department_id">
|
||||
<el-select v-model="form.department_id" style="width: 300px">
|
||||
<el-option v-for="item in departments" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="资金类型" prop="type">
|
||||
<el-cascader
|
||||
:options="types"
|
||||
:props="{
|
||||
checkStrictly: false,
|
||||
label: 'name',
|
||||
value: 'id',
|
||||
}"
|
||||
:value="form.type ? Number(form.type) : ''"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 300px"
|
||||
@change="(e) => (form.type = e[e.length - 1] || '')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划额度" prop="plan_money">
|
||||
<el-input-number style="width: 300px" :precision="2" controls-position="right" v-model="form.plan_money" autocomplete="off"></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="已使用额度" prop="use_money">
|
||||
<el-input-number style="width: 300px" :precision="2" controls-position="right" v-model="form.use_money" autocomplete="off"></el-input-number>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { index, save, show, destroy } from "@/api/system/temporaryPlan"
|
||||
import LxHeader from "@/components/LxHeader/index.vue";
|
||||
import {getparameterTree} from "@/api/system/dictionary";
|
||||
import {listCommondepartment} from "@/api/common";
|
||||
import {deepCopy} from "@/utils";
|
||||
export default {
|
||||
components: {
|
||||
LxHeader
|
||||
},
|
||||
created() {
|
||||
this.initLoad();
|
||||
|
||||
},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
departments: [],
|
||||
types: [],
|
||||
dialogFormVisible: false,
|
||||
select: {
|
||||
page: 1,
|
||||
page_size: 20
|
||||
},
|
||||
form: {
|
||||
year: '',
|
||||
department_id: '',
|
||||
type: '',
|
||||
name: '',
|
||||
plan_money: 0,
|
||||
use_money: 0
|
||||
},
|
||||
copyForm: {
|
||||
year: '',
|
||||
department_id: '',
|
||||
type: '',
|
||||
name: '',
|
||||
plan_money: 0,
|
||||
use_money: 0
|
||||
},
|
||||
rules: {
|
||||
|
||||
},
|
||||
total: 0,
|
||||
tableHeight: 0,
|
||||
tableData: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initLoad() {
|
||||
var that = this;
|
||||
var clientHeight = document.documentElement.clientHeight
|
||||
var lxHeader_height = 96.5; //查询 头部
|
||||
var paginationHeight = 37; //分页的高度
|
||||
var topHeight = 50; //页面 头部
|
||||
let tableHeight = clientHeight - lxHeader_height - topHeight - paginationHeight - 20;
|
||||
that.tableHeight = tableHeight;
|
||||
|
||||
this.getList()
|
||||
this.getTypes()
|
||||
this.getDepartment()
|
||||
},
|
||||
|
||||
edit(row) {
|
||||
for(let key in this.form) {
|
||||
this.form[key] = row[key]
|
||||
}
|
||||
this.form['id'] = row.id
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
async getList() {
|
||||
try {
|
||||
const res = await index(this.select)
|
||||
console.log(res)
|
||||
this.total = res.total;
|
||||
this.tableData = res.data;
|
||||
} catch (err) {
|
||||
console.eror(err)
|
||||
}
|
||||
},
|
||||
//获取科室
|
||||
getDepartment() {
|
||||
listCommondepartment({show_tree:1}).then((res) => {
|
||||
this.departments = res;
|
||||
});
|
||||
},
|
||||
async getTypes() {
|
||||
const res = await getparameterTree({
|
||||
id: 3
|
||||
});
|
||||
const dataHandler = (data) => {
|
||||
data.forEach(i => {
|
||||
if (i.hasOwnProperty('detail')) {
|
||||
i.children = i.detail.map(j => {
|
||||
j.name = j.value
|
||||
return j;
|
||||
})
|
||||
} else {
|
||||
dataHandler(i['children'])
|
||||
}
|
||||
})
|
||||
return data;
|
||||
}
|
||||
this.types = dataHandler(res?.children) || []
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.form = deepCopy(this.copyForm)
|
||||
this.dialogFormVisible = false
|
||||
},
|
||||
async submit() {
|
||||
try {
|
||||
await save(this.form)
|
||||
this.form = deepCopy(this.copyForm)
|
||||
this.dialogFormVisible = false
|
||||
this.$message.success('操作成功')
|
||||
await this.getList()
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
},
|
||||
async destroy(row) {
|
||||
try {
|
||||
await this.$confirm('确认删除?','提示')
|
||||
await destroy({
|
||||
id: row.id
|
||||
})
|
||||
await this.getList()
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Loading…
Reference in new issue