预算计划

master
lion 8 months ago
parent 4d5907801a
commit 0687ca4751

@ -3,10 +3,10 @@ ENV = 'development'
# base api # base api
VUE_APP_DOMIAN=http://192.168.60.99:9003/ VUE_APP_DOMIAN=http://192.168.60.99:8003/
VUE_APP_BASE_API = '' VUE_APP_BASE_API = ''
VUE_APP_UPLOAD=http://192.168.60.99:8003/api/admin/upload-file VUE_APP_UPLOAD=http://192.168.60.99:8003/api/admin/upload-file
VUE_APP_OUT_URL = http://192.168.60.18:8001 VUE_APP_OUT_URL = http://192.168.60.18:2021
#VUE_APP_DOMIAN=http://192.168.60.99:9003/ #VUE_APP_DOMIAN=http://192.168.60.99:9003/
#VUE_APP_UPLOAD=http://192.168.60.99:9003/api/admin/upload-file #VUE_APP_UPLOAD=http://192.168.60.99:9003/api/admin/upload-file

@ -12,7 +12,7 @@
placement="bottom" placement="bottom"
:value="select.year" :value="select.year"
style="width: 130px;" style="width: 130px;"
@on-change="(e)=>select.year = e" @on-change="(e)=>{select.year = e, changeYear(e)}"
/> />
</span> </span>
@ -20,9 +20,30 @@
预算类型 预算类型
</span> </span>
<span> <span>
<Select v-model="select.type" placeholder="选择预算类型" style="width:130px;" clearable> <el-select
<Option v-for="item in types" :key="item.id" :value="item.id">{{ item.value }}</Option> v-model="select.typeName"
</Select> clearable
placeholder="选择预算类型"
style="width: 130px"
popper-class="budget-type-tree-select"
@change="changeType"
>
<el-option disabled value="" style="height:150px;overflow: scroll;">
<el-tree
ref="tree1"
style="width:300px"
default-expand-all
:default-checked-keys="checkArr"
:check-strictly="true"
:data="types"
show-checkbox
node-key="id"
highlight-current
:props="defaultProps"
@check="(data, node)=>{return getSelectedNodes(data,node,'tree1')}"
/>
</el-option>
</el-select>
</span> </span>
<span style="padding: 0 6px;"> <span style="padding: 0 6px;">
@ -37,7 +58,7 @@
<Button <Button
type="primary" type="primary"
style="margin-left: 10px" style="margin-left: 10px"
@click="()=>select={page:1,year:'', type:'', department:''}" @click="resetSelect"
>重置</Button> >重置</Button>
<Button style="margin-left: 10px" type="primary" @click=""> <Button style="margin-left: 10px" type="primary" @click="">
资金申请 资金申请
@ -67,7 +88,7 @@
<Page :total="total" show-elevator show-sizer @on-change="pageChange" @on-page-size-change="pageSizeChange" /> <Page :total="total" show-elevator show-sizer @on-change="pageChange" @on-page-size-change="pageSizeChange" />
</div> </div>
<payPlan ref="payPlan" :types="types" /> <payPlan ref="payPlan" :types="typesbefore" />
</div> </div>
</template> </template>
@ -79,16 +100,17 @@ import {
import { import {
listdeptNoAuth listdeptNoAuth
} from '@/api/system/department' } from '@/api/system/department'
import {
getparameter
} from '@/api/system/dictionary'
import { import {
moneyFormatter, moneyFormatter,
parseTime parseTime,
buildTree
} from '@/utils' } from '@/utils'
import { import {
mergeTableRow mergeTableRow
} from '@/utils/mergeTableRow' } from '@/utils/mergeTableRow'
import {
index as getPlanType
} from '@/api/budget/plantype.js'
import payPlan from './component/payPlan.vue' import payPlan from './component/payPlan.vue'
export default { export default {
@ -98,7 +120,14 @@ export default {
data() { data() {
return { return {
isShowAdd: false, isShowAdd: false,
types: [], types: [], //
typesbefore: [], //
checkArr: [], //
defaultProps: {
children: 'children',
label: 'name'
},
typeYear: this.$moment().format('YYYY'), //
form: { form: {
name: '', name: '',
type: '', type: '',
@ -220,6 +249,7 @@ export default {
page: 1, page: 1,
year: '', year: '',
type: '', type: '',
typeName: '', //
department: '' department: ''
}, },
departments: [], // departments: [], //
@ -231,6 +261,7 @@ export default {
}, },
created() { created() {
this.select.year = this.$moment().format('YYYY') this.select.year = this.$moment().format('YYYY')
this.typeYear = this.$moment().format('YYYY')
}, },
mounted() { mounted() {
this.getTypes() this.getTypes()
@ -238,12 +269,74 @@ export default {
this.getBudgets() this.getBudgets()
}, },
methods: { methods: {
//
changeYear(e) {
if (e) {
this.typeYear = e
this.getTypes()
}
},
//
changeType(e) {
if (!e) {
this.select.type = ''
this.select.typeName = ''
this.checkArr = []
if (this.$refs.tree1) {
this.$refs.tree1.setCheckedKeys([])
}
}
},
//
getSelectedNodes(data, node, ref) {
const ref_data = ref || 'tree1'
this.$refs[ref_data].setCheckedKeys([])
this.checkArr = []
if (data.children && data.children.length > 0) {
this.$Message.warning('当前节点不可选择')
this.select.type = ''
this.select.typeName = ''
this.$refs[ref_data].setCheckedKeys([])
return
}
this.$refs[ref_data].setCheckedKeys([]) //
this.$refs[ref_data].setCheckedNodes([data]) //
this.select.type = data.id
this.select.typeName = data.name
this.checkArr = [data.id]
this.$forceUpdate()
},
//
async getTypes() { async getTypes() {
const res = await getparameter({ const res = await getPlanType({
number: 'money_way' page_size: 999,
page: 1,
sort_name: 'sort',
sort_type: 'asc',
filter: [{
key: 'year',
op: 'eq',
value: this.typeYear || this.select.year || ''
}]
}) })
this.types = res.detail this.typesbefore = res.data
}, // this.types = buildTree(res.data)
},
//
resetSelect() {
this.select = {
page: 1,
year: this.$moment().format('YYYY'),
type: '',
typeName: '',
department: ''
}
this.checkArr = []
if (this.$refs.tree1) {
this.$refs.tree1.setCheckedKeys([])
}
},
//
objectSpanMethod({ objectSpanMethod({
row, row,
column, column,
@ -370,4 +463,87 @@ export default {
z-index: 2; z-index: 2;
} }
} }
::v-deep .el-checkbox__input .el-checkbox__inner {
border-radius: 50%;
}
</style>
<style lang="scss">
// body
.budget-type-tree-select {
min-width: 320px !important;
.el-select-dropdown__item {
height: auto;
padding: 0;
&.is-disabled {
color: #606266;
cursor: default;
opacity: 1;
&:hover {
background-color: transparent;
}
}
}
//
.el-tree {
background-color: transparent;
padding: 8px 0;
.el-tree-node {
.el-tree-node__content {
height: 32px;
line-height: 32px;
padding: 0 8px;
margin-bottom: 2px;
&:hover {
background-color: #f5f7fa;
}
}
.el-tree-node__label {
font-size: 14px;
color: #606266;
}
.el-checkbox {
margin-right: 8px;
.el-checkbox__input {
.el-checkbox__inner {
width: 14px;
height: 14px;
&::after {
height: 7px;
left: 4px;
width: 3px;
}
}
}
}
&.is-checked {
.el-tree-node__label {
color: #409eff;
font-weight: 500;
}
}
}
//
.el-tree-node.is-current > .el-tree-node__content {
background-color: #ecf5ff;
.el-tree-node__label {
color: #409eff;
}
}
}
}
</style> </style>

@ -30,14 +30,29 @@
<span style="padding: 0 6px;word-break: keep-all;">预算类型</span> <span style="padding: 0 6px;word-break: keep-all;">预算类型</span>
<span> <span>
<el-select <el-select
v-model="select.type" v-model="select.typeName"
size="small" size="small"
clearable clearable
placeholder="请选择预算类型" placeholder="请选择预算类型"
type="date"
style="width: 160px" style="width: 160px"
popper-class="budget-type-tree-select"
@change="changeType"
> >
<el-option v-for="item in type" :key="item.id" :value="item.id" :label="item.name" /> <el-option disabled value="" style="height:150px;overflow: scroll;">
<el-tree
ref="tree1"
style="width:300px"
default-expand-all
:default-checked-keys="checkArr"
:check-strictly="true"
:data="types"
show-checkbox
node-key="id"
highlight-current
:props="defaultProps"
@check="(data, node)=>{return getSelectedNodes(data,node,'tree1')}"
/>
</el-option>
</el-select> </el-select>
</span> </span>
@ -67,7 +82,7 @@
type="primary" type="primary"
style="margin-left: 10px" style="margin-left: 10px"
ghost ghost
@click="select = {pageIndex:1,year:'',type:'',department:'',name:''}" @click="resetSelect"
>重置</Button> >重置</Button>
<Button type="primary" style="margin-left: 10px" @click="getPlanProgress"></Button> <Button type="primary" style="margin-left: 10px" @click="getPlanProgress"></Button>
</slot> </slot>
@ -101,7 +116,8 @@ import {
index as getPlanType index as getPlanType
} from '@/api/budget/plantype.js' } from '@/api/budget/plantype.js'
import { import {
moneyFormatter moneyFormatter,
buildTree
} from '@/utils' } from '@/utils'
import { import {
mergeTableRow mergeTableRow
@ -110,13 +126,21 @@ import {
export default { export default {
data() { data() {
return { return {
type: [], // type: [], //
types: [], //
typesbefore: [], //
checkArr: [], //
defaultProps: {
children: 'children',
label: 'name'
},
departments: [], departments: [],
select: { select: {
page_size:999, page_size:999,
pageIndex: 1, pageIndex: 1,
year: '', year: '',
type: '', type: '',
typeName: '', //
department: '', department: '',
showDatePicker: '', showDatePicker: '',
start_created_at: '', start_created_at: '',
@ -249,7 +273,21 @@ export default {
await this.getDepartment() await this.getDepartment()
this.select.department = Number(this.$route.query.departmentId) || '' this.select.department = Number(this.$route.query.departmentId) || ''
this.select.type = Number(this.$route.query.type) || '' const routeType = Number(this.$route.query.type) || ''
if (routeType) {
this.select.type = routeType
// type ID
const typeItem = this.typesbefore.find(item => item.id === routeType)
if (typeItem) {
this.select.typeName = typeItem.name
this.checkArr = [routeType]
this.$nextTick(() => {
if (this.$refs.tree1) {
this.$refs.tree1.setCheckedKeys([routeType])
}
})
}
}
await this.getPlanProgress() await this.getPlanProgress()
}, },
@ -335,6 +373,55 @@ export default {
}] }]
}) })
this.type = res.data this.type = res.data
this.typesbefore = res.data
this.types = buildTree(res.data)
},
changeType(e) {
if (!e) {
this.select.type = ''
this.select.typeName = ''
this.checkArr = []
if (this.$refs.tree1) {
this.$refs.tree1.setCheckedKeys([])
}
}
},
getSelectedNodes(data, node, ref) {
const ref_data = ref || 'tree1'
this.$refs[ref_data].setCheckedKeys([])
this.checkArr = []
if (data.children && data.children.length > 0) {
this.$Message.warning('当前节点不可选择')
this.select.type = ''
this.select.typeName = ''
this.$refs[ref_data].setCheckedKeys([])
return
}
this.$refs[ref_data].setCheckedKeys([]) //
this.$refs[ref_data].setCheckedNodes([data]) //
this.select.type = data.id
this.select.typeName = data.name
this.checkArr = [data.id]
this.$forceUpdate()
},
resetSelect() {
this.select = {
pageIndex: 1,
year: '',
type: '',
typeName: '',
department: '',
showDatePicker: '',
start_created_at: '',
end_created_at: '',
sort_type: 'asc',
name: '',
page_size: 999
}
this.checkArr = []
if (this.$refs.tree1) {
this.$refs.tree1.setCheckedKeys([])
}
}, },
// //
pageChange(e) { pageChange(e) {
@ -432,4 +519,87 @@ export default {
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
::v-deep .el-checkbox__input .el-checkbox__inner {
border-radius: 50%;
}
</style>
<style lang="scss" scoped>
// body
.budget-type-tree-select {
min-width: 320px !important;
.el-select-dropdown__item {
height: auto;
padding: 0;
&.is-disabled {
color: #606266;
cursor: default;
opacity: 1;
&:hover {
background-color: transparent;
}
}
}
//
.el-tree {
background-color: transparent;
padding: 8px 0;
.el-tree-node {
.el-tree-node__content {
height: 32px;
line-height: 32px;
padding: 0 8px;
margin-bottom: 2px;
&:hover {
background-color: #f5f7fa;
}
}
.el-tree-node__label {
font-size: 14px;
color: #606266;
}
.el-checkbox {
margin-right: 8px;
.el-checkbox__input {
.el-checkbox__inner {
width: 14px;
height: 14px;
&::after {
height: 7px;
left: 4px;
width: 3px;
}
}
}
}
&.is-checked {
.el-tree-node__label {
color: #409eff;
font-weight: 500;
}
}
}
//
.el-tree-node.is-current > .el-tree-node__content {
background-color: #ecf5ff;
.el-tree-node__label {
color: #409eff;
}
}
}
}
</style> </style>

@ -10,7 +10,7 @@
<span> <span>
<el-switch v-model="select.type" :active-value="1" :inactive-value="2" active-text="" inactive-text="" @change="getList" /> <el-switch v-model="select.type" :active-value="1" :inactive-value="2" active-text="" inactive-text="" @change="getList" />
</span> </span>
<span style="padding: 0 6px;word-break: keep-all;">资金性质分类</span> <!-- <span style="padding: 0 6px;word-break: keep-all;">资金性质分类</span>
<span> <span>
<Select <Select
v-model="select.parameter_detail_id" v-model="select.parameter_detail_id"
@ -22,7 +22,7 @@
item.name item.name
}}</Option> }}</Option>
</Select> </Select>
</span> </span> -->
<span style="padding: 0 6px;word-break: keep-all;">年份</span> <span style="padding: 0 6px;word-break: keep-all;">年份</span>
<span> <span>
<DatePicker <DatePicker

Loading…
Cancel
Save