预算计划

master
lion 3 months ago
parent 4d5907801a
commit 0687ca4751

@ -3,10 +3,10 @@ ENV = 'development'
# 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_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_UPLOAD=http://192.168.60.99:9003/api/admin/upload-file

@ -12,7 +12,7 @@
placement="bottom"
:value="select.year"
style="width: 130px;"
@on-change="(e)=>select.year = e"
@on-change="(e)=>{select.year = e, changeYear(e)}"
/>
</span>
@ -20,9 +20,30 @@
预算类型
</span>
<span>
<Select v-model="select.type" placeholder="选择预算类型" style="width:130px;" clearable>
<Option v-for="item in types" :key="item.id" :value="item.id">{{ item.value }}</Option>
</Select>
<el-select
v-model="select.typeName"
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 style="padding: 0 6px;">
@ -37,7 +58,7 @@
<Button
type="primary"
style="margin-left: 10px"
@click="()=>select={page:1,year:'', type:'', department:''}"
@click="resetSelect"
>重置</Button>
<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" />
</div>
<payPlan ref="payPlan" :types="types" />
<payPlan ref="payPlan" :types="typesbefore" />
</div>
</template>
@ -79,16 +100,17 @@ import {
import {
listdeptNoAuth
} from '@/api/system/department'
import {
getparameter
} from '@/api/system/dictionary'
import {
moneyFormatter,
parseTime
parseTime,
buildTree
} from '@/utils'
import {
mergeTableRow
} from '@/utils/mergeTableRow'
import {
index as getPlanType
} from '@/api/budget/plantype.js'
import payPlan from './component/payPlan.vue'
export default {
@ -98,7 +120,14 @@ export default {
data() {
return {
isShowAdd: false,
types: [],
types: [], //
typesbefore: [], //
checkArr: [], //
defaultProps: {
children: 'children',
label: 'name'
},
typeYear: this.$moment().format('YYYY'), //
form: {
name: '',
type: '',
@ -220,6 +249,7 @@ export default {
page: 1,
year: '',
type: '',
typeName: '', //
department: ''
},
departments: [], //
@ -231,6 +261,7 @@ export default {
},
created() {
this.select.year = this.$moment().format('YYYY')
this.typeYear = this.$moment().format('YYYY')
},
mounted() {
this.getTypes()
@ -238,12 +269,74 @@ export default {
this.getBudgets()
},
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() {
const res = await getparameter({
number: 'money_way'
const res = await getPlanType({
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({
row,
column,
@ -370,4 +463,87 @@ export default {
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>

@ -30,14 +30,29 @@
<span style="padding: 0 6px;word-break: keep-all;">预算类型</span>
<span>
<el-select
v-model="select.type"
v-model="select.typeName"
size="small"
clearable
placeholder="请选择预算类型"
type="date"
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>
</span>
@ -67,7 +82,7 @@
type="primary"
style="margin-left: 10px"
ghost
@click="select = {pageIndex:1,year:'',type:'',department:'',name:''}"
@click="resetSelect"
>重置</Button>
<Button type="primary" style="margin-left: 10px" @click="getPlanProgress"></Button>
</slot>
@ -101,7 +116,8 @@ import {
index as getPlanType
} from '@/api/budget/plantype.js'
import {
moneyFormatter
moneyFormatter,
buildTree
} from '@/utils'
import {
mergeTableRow
@ -110,13 +126,21 @@ import {
export default {
data() {
return {
type: [], //
type: [], //
types: [], //
typesbefore: [], //
checkArr: [], //
defaultProps: {
children: 'children',
label: 'name'
},
departments: [],
select: {
page_size:999,
pageIndex: 1,
year: '',
type: '',
typeName: '', //
department: '',
showDatePicker: '',
start_created_at: '',
@ -249,7 +273,21 @@ export default {
await this.getDepartment()
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()
},
@ -335,6 +373,55 @@ export default {
}]
})
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) {
@ -432,4 +519,87 @@ export default {
</script>
<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>

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

Loading…
Cancel
Save