master
parent
33c445e75f
commit
e85f0b1a19
@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div>
|
||||
<xy-dialog ref="dialog" :width="60" :is-show.sync="isShow" :type="'normal'" :title="'数据查看'">
|
||||
<template v-slot:default>
|
||||
<el-descriptions class="margin-top" :column="2" border direction="vertical">
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
业务类型
|
||||
</template>
|
||||
{{form.business_id_details?form.business_id_details[0]['name']:''}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
填报区域
|
||||
</template>
|
||||
{{form.area_id_details?form.area_id_details[0]['name']:''}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
填报年份
|
||||
</template>
|
||||
{{form.year}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
填报月份
|
||||
</template>
|
||||
{{monthArr[parseInt(form.month)-1]}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="year_datas.length>0" :span="2">
|
||||
<template slot="label">
|
||||
年度预算
|
||||
</template>
|
||||
<div>
|
||||
<xy-table :list="year_datas" :isPage="false" :height="150"
|
||||
:table-item="year_datas_item">
|
||||
<template v-slot:btns>
|
||||
<div></div>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :span="2">
|
||||
<template slot="label">
|
||||
数据填报
|
||||
</template>
|
||||
<div>
|
||||
<xy-table :list="fill_datas" :isPage="false" :height="550"
|
||||
:table-item="fill_datas_item">
|
||||
<template v-slot:btns>
|
||||
<div></div>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</template>
|
||||
</xy-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
show,
|
||||
} from "@/api/system/baseForm.js"
|
||||
export default {
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShow: false,
|
||||
type: 'show',
|
||||
id: '',
|
||||
table_name: 'fills',
|
||||
year_datas: [],
|
||||
business_id: '',
|
||||
monthArr: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
||||
year_datas_item: [{
|
||||
prop: 'year',
|
||||
label: '年份',
|
||||
align: 'center',
|
||||
// width: 100
|
||||
}, {
|
||||
prop: 'all_year',
|
||||
label: '年度总预算',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
prop: 'quarter_1',
|
||||
label: '第一季度预算',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
prop: 'quarter_2',
|
||||
label: '第二季度预算',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
prop: 'quarter_3',
|
||||
label: '第三季度预算',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}, {
|
||||
prop: 'quarter_4',
|
||||
label: '第四季度预算',
|
||||
align: 'center',
|
||||
width: 150
|
||||
}],
|
||||
fill_datas:[],
|
||||
fill_datas_item: [{
|
||||
type: 'index',
|
||||
width: 50,
|
||||
}, {
|
||||
prop: 'business_type.name',
|
||||
label: '填报类别',
|
||||
align: 'left',
|
||||
// width: 620
|
||||
}, {
|
||||
prop: 'business_data.name',
|
||||
label: '填报数据',
|
||||
align: 'left',
|
||||
width: 320
|
||||
}, {
|
||||
prop: 'value',
|
||||
label: '填报值',
|
||||
align: 'left',
|
||||
width: 320
|
||||
}],
|
||||
form: {},
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
async getBusiness() {
|
||||
const res = await show({
|
||||
id: this.business_id,
|
||||
table_name: 'businesses',
|
||||
json_data_fields: ['area_ids'],
|
||||
})
|
||||
// 区域年度预算
|
||||
|
||||
this.year_datas = res.id_budgets_business_id_relation.filter(item => {
|
||||
return item.area_id === this.form.area_id && item.year == this.form.year
|
||||
})
|
||||
console.log(this.form.area_id,this.form.year,this.year_datas)
|
||||
},
|
||||
async getDetail() {
|
||||
await show({
|
||||
id: this.id,
|
||||
table_name: this.table_name,
|
||||
json_data_fields: ['area_id', 'business_id'],
|
||||
}).then(res => {
|
||||
this.form = this.base.deepCopy(res)
|
||||
this.form.business_id_details = res.business_id_details?res.business_id_details:[],
|
||||
this.form.area_id_details = res.area_id_details?res.area_id_details:[]
|
||||
this.fill_datas = res.id_fill_datas_fill_id_relation?res.id_fill_datas_fill_id_relation:[]
|
||||
})
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
async isShow(newVal) {
|
||||
if (newVal) {
|
||||
await this.getDetail()
|
||||
await this.getBusiness()
|
||||
} else {
|
||||
this.id = ''
|
||||
this.business_id = ''
|
||||
this.year_datas = []
|
||||
this.fill_datas = []
|
||||
this.type = "show"
|
||||
this.form = {}
|
||||
this.$refs['dialog'].reset()
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// ::v-deep .area_ids,
|
||||
// ::v-deep .name{
|
||||
// flex-basis: 100%;
|
||||
// }
|
||||
</style>
|
||||
@ -0,0 +1,273 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content">
|
||||
<div class="searchwrap" style="display: flex;align-items: center;">
|
||||
<div>
|
||||
<el-select style="width:100%" clearable v-model="select.business_id" placeholder="请选择业务">
|
||||
<el-option v-for="item in list_bus" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-select style="width:100%" clearable v-model="select.area_id" placeholder="请选择区域">
|
||||
<el-option v-for="item in list_area" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-date-picker style="width:100%" format="yyyy" value-format="yyyy" v-model="select.year" type="year"
|
||||
placeholder="选择年份">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="select.page=1,getList()">查询</el-button>
|
||||
</div>
|
||||
<!-- <div>
|
||||
<el-button type="primary" size="small" @click="editIndex('add')">新增</el-button>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<xy-table :list="list" :total="total" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange"
|
||||
:table-item="table_item">
|
||||
<template v-slot:business_id>
|
||||
<el-table-column align='center' width="360" label="业务" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.business_id_details && scope.row.business_id_details.length>0">
|
||||
<el-tag>{{scope.row.business_id_details[0]['name']}}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<template v-slot:area_id>
|
||||
<el-table-column align='center' width="240" label="填报区域" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-if="scope.row.area_id_details && scope.row.area_id_details.length>0">
|
||||
<el-tag>{{scope.row.area_id_details[0]['name']}}</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' fixed="right" label="操作" width="240" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="stateObj.login_id===scope.row.admin_id || stateObj.is_admin" type="primary" size="small"
|
||||
@click="editIndex('editor',scope.row.id,scope.row.business_id)">编辑</el-button>
|
||||
<el-popconfirm v-if="stateObj.login_id===scope.row.admin_id || stateObj.is_admin" style="margin:0 10px"
|
||||
@confirm="deleteList(scope.row.id)" title="确定删除吗?">
|
||||
<el-button type="danger" size="small" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
|
||||
<add-year ref="addYear" @refresh="getList"></add-year>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addYear from './components/addYear.vue';
|
||||
import {
|
||||
index,
|
||||
destroy
|
||||
} from "@/api/system/baseForm.js"
|
||||
import state from '@/store/modules/user.js'
|
||||
export default {
|
||||
components: {
|
||||
addYear
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
name: '',
|
||||
table_name: 'budgets',
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
business_id: '',
|
||||
area_id: '',
|
||||
year: '',
|
||||
},
|
||||
stateObj: {},
|
||||
list_bus: [],
|
||||
list_area:[],
|
||||
total: 0,
|
||||
list: [],
|
||||
table_item: [{
|
||||
type: 'index',
|
||||
width: 50,
|
||||
fixed: 'left'
|
||||
}, {
|
||||
prop: 'year',
|
||||
label: '预算年份',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
prop: 'business_id',
|
||||
label: '预算业务',
|
||||
align: 'center',
|
||||
width: 360,
|
||||
}, {
|
||||
prop: 'area_id',
|
||||
label: '填报区域',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
prop: 'all_year',
|
||||
label: '年度总预算',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
prop: 'quarter_1',
|
||||
label: '第一季度预算',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
prop: 'quarter_2',
|
||||
label: '第二季度预算',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
prop: 'quarter_3',
|
||||
label: '第三季度预算',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
prop: 'quarter_4',
|
||||
label: '第四季度预算',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
prop: 'admin.name',
|
||||
label: '填报人',
|
||||
align: 'center',
|
||||
width: 120
|
||||
}, {
|
||||
|
||||
prop: 'created_at',
|
||||
label: '填报时间',
|
||||
align: 'center',
|
||||
width: 180
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.stateObj = state.state
|
||||
if (this.$route.query.id) {
|
||||
this.select.business_id = parseInt(this.$route.query.id)
|
||||
}
|
||||
if (this.$route.query.area_id) {
|
||||
this.select.area_id = parseInt(this.$route.query.area_id)
|
||||
}
|
||||
this.getBusinessList()
|
||||
this.getAreaList()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
async getBusinessList() {
|
||||
const res = await index({
|
||||
page_size: 999,
|
||||
page: 1,
|
||||
table_name: 'businesses',
|
||||
})
|
||||
this.list_bus = res.data
|
||||
},
|
||||
async getAreaList() {
|
||||
const res = await index({
|
||||
page_size: 999,
|
||||
page: 1,
|
||||
table_name: 'areas',
|
||||
})
|
||||
this.list_area = res.data
|
||||
},
|
||||
editIndex(type, id, business_id) {
|
||||
if (type == 'editor') {
|
||||
this.$refs.addYear.id = id
|
||||
this.$refs.addYear.setBusinessId(business_id)
|
||||
this.$refs.addYear.business_id = business_id
|
||||
}
|
||||
this.$refs.addYear.type = type
|
||||
this.$refs.addYear.isShow = true
|
||||
},
|
||||
pageIndexChange(e) {
|
||||
this.select.page = e
|
||||
this.getList()
|
||||
},
|
||||
pageSizeChange(e) {
|
||||
this.select.page_size = e
|
||||
this.select.page = 1
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
const res = await index({
|
||||
page_size: this.select.page_size,
|
||||
page: this.select.page,
|
||||
table_name: this.select.table_name,
|
||||
json_data_fields: ['area_id', 'business_id'],
|
||||
filter: [{
|
||||
"key": "business_id",
|
||||
"op": "eq",
|
||||
"value": this.select.business_id ? this.select.business_id : ''
|
||||
},{
|
||||
"key": "area_id",
|
||||
"op": "eq",
|
||||
"value": this.select.area_id ? this.select.area_id : ''
|
||||
}, {
|
||||
"key": "year",
|
||||
"op": "eq",
|
||||
"value": this.select.year ? this.select.year : ''
|
||||
}, {
|
||||
"key": "area_id",
|
||||
"op": "eq",
|
||||
"value": this.select.area_id ? this.select.area_id : ''
|
||||
}],
|
||||
})
|
||||
this.list = res.data
|
||||
this.total = res.total
|
||||
},
|
||||
deleteList(id) {
|
||||
var that = this;
|
||||
destroy({
|
||||
id: id,
|
||||
table_name: this.select.table_name
|
||||
}).then(response => {
|
||||
this.$Message.success('操作成功');
|
||||
this.getList()
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
reject(error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.searchwrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
|
||||
span {
|
||||
min-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue