Browse Source

优化

master
陈裕财 3 years ago
parent
commit
97ee2d7881
  1. 2
      src/router/routes_xm.js
  2. 280
      src/views/xm/rpt/indexForHis.vue

2
src/router/routes_xm.js

@ -644,7 +644,7 @@ export default {
children: [
{ path: 'his', component: _import('xm/rpt/indexForHis'), name: 'rptIndex', meta: { title: '历史报告',roles:["user"] }},
{ path: 'his', component: _import('xm/rpt/indexForHis'), name: 'rptHis', meta: { title: '历史报告',roles:["user"] }},
{ path: 'his/detail', component: _import('xm/rpt/indexForHisDetail'), name: 'rptHisDetail', meta: { title: '报告明细',roles:["user"] },hidden:true},
{ path: 'index', component: _import('xm/rpt/index'), name: 'rptIndex', meta: { title: '指标分析',roles:["user"] }},
{ path: 'branch/branchDatavFullScreen', name: 'branchDatavFullScreen', meta: { title: '机构效能',openTab:true,outUrl:"${curlDomain}/"+process.env.CONTEXT+"/"+process.env.VERSION+"/#/datav/xm/branch/branchDatavFullScreen" }},

280
src/views/xm/rpt/indexForHis.vue

@ -1,51 +1,287 @@
<template>
<section>
<section class="padding">
<el-row>
<comps-card v-if="xmRptData && xmRptData.id" ref="compsCard" :xm-rpt-data="xmRptData" :show-params="false"/>
<el-input v-model="filters.key" style="width: 40%;" placeholder="模糊查询"></el-input>
<mdp-date-range v-model="filters" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmRptDatas" icon="el-icon-search">查询</el-button>
<span style="float:right;">
<el-button type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true" icon="el-icon-delete" plain></el-button>
</span>
</el-row>
</section>
<el-row class="padding-top">
<!--列表 XmRptData xm_rpt_data-->
<el-table ref="xmRptDataTable" :data="xmRptDatas" :height="maxTableHeight" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="selection" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column prop="rptName" label="报告名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.rptName}} </span>
</template>
</el-table-column>
<el-table-column prop="bizDate" label="业务日期" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.bizDate}} </span>
</template>
</el-table-column>
<el-table-column prop="cusername" label="创建人名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.cusername}} </span>
</template>
</el-table-column>
<el-table-column label="操作" width="100" fixed="right">
<template scope="scope">
<el-button type="primary" @click="toRptDetail(scope.row)" icon="el-icon-s-data" plain>查看</el-button>
</template>
</el-table-column>
</el-table>
</el-row>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</section>
</template>
<script>
import compsCard from './CompsCardHisDetail'
import compsSet from './CompsSet'
import { listXmRptData } from '@/api/xm/core/xmRptData';
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmRptData, delXmRptData, batchDelXmRptData,editSomeFieldsXmRptData } from '@/api/xm/core/xmRptData';
import { mapGetters } from 'vuex'
export default {
components: {compsSet, compsCard},
computed: {
...mapGetters([
'userInfo'
]),
name:'xmRptDataList',
components: {
},
computed: {
...mapGetters(['userInfo']),
watch: {
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmRptDatas()
}
}
},
data() {
return {
xmRptData:null,
}
filters: {
key: '',
startBizDate:'',
endBizDate:'',
},
xmRptDatas: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmRptData
addForm: {
cfgId:'',id:'',rptName:'',rptData:'',cuserid:'',cbranchId:'',cusername:'',ctime:'',bizDate:'',bizType:''
},
editFormVisible: false,//
editForm: {
cfgId:'',id:'',rptName:'',rptData:'',cuserid:'',cbranchId:'',cusername:'',ctime:'',bizDate:'',bizType:''
},
maxTableHeight:300,
}
},//end data
methods: {
getXmRptData(){
var params={id:this.$router.query.id}
listXmRptData(params).then(res=>{
this.xmRptData=res.data.data[0]
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmRptDatas();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmRptDatas();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmRptDatas();
},
searchXmRptDatas(){
this.pageInfo.count=true;
this.getXmRptDatas();
},
// XmRptData xm_rpt_data
getXmRptDatas() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key=this.filters.key
}
if(this.filters.startBizDate){
params.startBizDate=this.filters.startBizDate
params.endBizDate=this.filters.endBizDate
}
this.load.list = true;
listXmRptData(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmRptDatas = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmRptData xm_rpt_data
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmRptData xm_rpt_data
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmRptDatas();
},
afterEditSubmit(){
this.editFormVisible=false;
},
toRptDetail(row){
this.$router.push({
name:'rptHisDetail',
query:{
id:row.id
}
})
},
//xmRptData
selsChange: function (sels) {
this.sels = sels;
},
//xmRptData
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id:row.id };
delXmRptData(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmRptDatas();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmRptData
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { id:i.id}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmRptData(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmRptDatas();
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
editSomeFields(row,fieldName,$event){
let params={};
if(this.sels.length>0){
if(!this.sels.some(k=> k.id==row.id)){
this.$notify({position:'bottom-left',showClose:true,message:'请编辑选中的行',type:'warning'})
Object.assign(this.editForm,this.editFormBak)
return;
}
params['ids']=this.sels.map(i=>i.id)
}else{
params['ids']=[row].map(i=>i.id)
}
params[fieldName]=$event
var func = editSomeFieldsXmRptData
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmRptDatas();
}
this.editFormBak=[...this.editForm]
}else{
Object.assign(this.editForm,this.editFormBak)
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'})
}
}).catch((e)=>Object.assign(this.editForm,this.editFormBak))
},
rowClick: function(row, event, column){
this.editForm=row
this.editFormBak={...row};
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
},//end methods
mounted() {
this.getXmRptData();
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmRptDatas();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmRptDataTable.$el)
});
}
}
</script>
<style lang="scss" scoped>
<style scoped>
</style>
Loading…
Cancel
Save