You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
7.9 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <section class="page-container border padding">
  3. <el-row>
  4. <el-input v-model="filters.key" style="width: 40%;" placeholder="模糊查询"></el-input>
  5. <mdp-date-range v-model="filters" start-key="startBizDate" end-key="endBizDate"></mdp-date-range>
  6. <el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmRptDatas" icon="el-icon-search">查询</el-button>
  7. <span style="float:right;">
  8. <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>
  9. </span>
  10. </el-row>
  11. <el-row class="padding-top">
  12. <!--列表 XmRptData xm_rpt_data-->
  13. <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%;">
  14. <el-table-column type="selection" width="55" show-overflow-tooltip fixed="left"></el-table-column>
  15. <el-table-column prop="rptName" label="报告名称" min-width="120" show-overflow-tooltip>
  16. <template slot-scope="scope">
  17. <span> {{scope.row.rptName}} </span>
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="bizDate" label="业务日期" min-width="120" show-overflow-tooltip>
  21. <template slot-scope="scope">
  22. <span> {{scope.row.bizDate}} </span>
  23. </template>
  24. </el-table-column>
  25. <el-table-column prop="cusername" label="创建人名称" min-width="120" show-overflow-tooltip>
  26. <template slot-scope="scope">
  27. <span> {{scope.row.cusername}} </span>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="操作" width="100" fixed="right">
  31. <template scope="scope">
  32. <el-button type="primary" @click="toRptDetail(scope.row)" icon="el-icon-s-data" plain>选择</el-button>
  33. </template>
  34. </el-table-column>
  35. </el-table>
  36. </el-row>
  37. <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>
  38. </section>
  39. </template>
  40. <script>
  41. import util from '@/common/js/util';//全局公共库
  42. import config from '@/common/config';//全局公共库
  43. import { initDicts,listXmRptData } from '@/api/xm/core/xmRptData';
  44. import { mapGetters } from 'vuex'
  45. export default {
  46. name:'xmRptDataList',
  47. components: {
  48. },
  49. props:['visible','xmRptConfig',],
  50. computed: {
  51. ...mapGetters(['userInfo']),
  52. },
  53. watch:{
  54. visible(val){
  55. if(val==true){
  56. this.initData();
  57. this.searchXmRptDatas()
  58. }
  59. }
  60. },
  61. data() {
  62. return {
  63. filters: {
  64. key: '',
  65. startBizDate:'',
  66. endBizDate:'',
  67. },
  68. xmRptDatas: [],//查询结果
  69. pageInfo:{//分页数据
  70. total:0,//服务器端收到0时,会自动计算总记录数,如果上传>0的不自动计算。
  71. pageSize:10,//每页数据
  72. count:false,//是否需要重新计算总记录数
  73. pageNum:1,//当前页码、从1开始计算
  74. orderFields:[],//排序列 如 ['sex','student_id'],必须为数据库字段
  75. orderDirs:[]//升序 asc,降序desc 如 性别 升序、学生编号降序 ['asc','desc']
  76. },
  77. load:{ list: false, edit: false, del: false, add: false },//查询中...
  78. sels: [],//列表选中数据
  79. dicts:{
  80. //sex: [{id:'1',name:'男'},{id:'2',name:'女'}]
  81. },//下拉选择框的所有静态数据 params={categoryId:'all',itemCodes:['sex']} 返回结果 {sex: [{id:'1',name:'男'},{id:'2',name:'女'}]}
  82. addFormVisible: false,//新增xmRptData界面是否显示
  83. addForm: {
  84. cfgId:'',id:'',rptName:'',rptData:'',cuserid:'',cbranchId:'',cusername:'',ctime:'',bizDate:'',bizType:''
  85. },
  86. editFormVisible: false,//编辑界面是否显示
  87. editForm: {
  88. cfgId:'',id:'',rptName:'',rptData:'',cuserid:'',cbranchId:'',cusername:'',ctime:'',bizDate:'',bizType:''
  89. },
  90. maxTableHeight:300,
  91. }
  92. },//end data
  93. methods: {
  94. ...util,
  95. handleSizeChange(pageSize) {
  96. this.pageInfo.pageSize=pageSize;
  97. this.getXmRptDatas();
  98. },
  99. handleCurrentChange(pageNum) {
  100. this.pageInfo.pageNum = pageNum;
  101. this.getXmRptDatas();
  102. },
  103. // 表格排序 obj.order=ascending/descending,需转化为 asc/desc ; obj.prop=表格中的排序字段,字段驼峰命名
  104. sortChange( obj ){
  105. if(obj.order==null){
  106. this.pageInfo.orderFields=[];
  107. this.pageInfo.orderDirs=[];
  108. }else{
  109. var dir='asc';
  110. if(obj.order=='ascending'){
  111. dir='asc'
  112. }else{
  113. dir='desc';
  114. }
  115. this.pageInfo.orderFields=[util.toLine(obj.prop)];
  116. this.pageInfo.orderDirs=[dir];
  117. }
  118. this.getXmRptDatas();
  119. },
  120. searchXmRptDatas(){
  121. this.pageInfo.count=true;
  122. this.getXmRptDatas();
  123. },
  124. //获取列表 XmRptData xm_rpt_data
  125. getXmRptDatas() {
  126. let params = {
  127. pageSize: this.pageInfo.pageSize,
  128. pageNum: this.pageInfo.pageNum,
  129. total: this.pageInfo.total,
  130. count:this.pageInfo.count
  131. };
  132. if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
  133. let orderBys=[];
  134. for(var i=0;i<this.pageInfo.orderFields.length;i++){
  135. orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
  136. }
  137. params.orderBy= orderBys.join(",")
  138. }
  139. if(this.filters.key){
  140. params.key=this.filters.key
  141. }
  142. if(this.filters.startBizDate){
  143. params.startBizDate=this.filters.startBizDate
  144. params.endBizDate=this.filters.endBizDate
  145. }
  146. if(!this.xmRptConfig || !this.xmRptConfig.id){
  147. return;
  148. }
  149. params.cfgId=this.xmRptConfig.id
  150. this.load.list = true;
  151. listXmRptData(params).then((res) => {
  152. var tips=res.data.tips;
  153. if(tips.isOk){
  154. this.pageInfo.total = res.data.total;
  155. this.pageInfo.count=false;
  156. this.xmRptDatas = res.data.data;
  157. }else{
  158. this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
  159. }
  160. this.load.list = false;
  161. }).catch( err => this.load.list = false );
  162. },
  163. //选择行xmRptData
  164. selsChange: function (sels) {
  165. this.sels = sels;
  166. },
  167. rowClick: function(row, event, column){
  168. this.editForm=row
  169. this.editFormBak={...row};
  170. this.$emit('row-click',row, event, column);// @row-click="rowClick"
  171. },
  172. initData: function(){
  173. },
  174. toRptDetail(row){
  175. this.$router.push({
  176. name:'rptHisDetail',
  177. query:{
  178. id:row.id
  179. }
  180. })
  181. },
  182. },//end methods
  183. mounted() {
  184. this.$nextTick(() => {
  185. initDicts(this);
  186. this.initData()
  187. this.searchXmRptDatas();
  188. this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmRptDataTable.$el)
  189. });
  190. }
  191. }
  192. </script>
  193. <style scoped>
  194. </style>