service-list-info.vue 2.87 KB
<style>

</style>

<template>
<div>		
 <div class="pd-form fast-search-form" style="clear:both;">
    <div class="group-row group-row-2">
      <div class="form-group">
        <label for="cn1" class="label">搜索</label>
        <div class="control">
          <input type="text" id="cn1" v-model="search.title">
        </div>
      </div>
      <div class="group-row t-right">
      <button class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle" v-on:click="getData('search')">
      查 询</button>
    </div>
    </div>
    
 </div>



  <table class="itable itable-thead-13px itable-bordertop itable-td-long-text">  
    <tbody>
      <tr v-for="item in list">
        <td style="text-align:left;width:86%;">
             <a v-link="{path:'/serviceDetail/'+item.guid}" 
             class="service-link-1">
             {{item.title}}</a>
        </td>
        <td>{{item.creatdate}}</td>
      </tr>
    </tbody>
  </table> 

   <pagination 
   @page-change="getData" 
   :page-no.sync="search.page" 
   :total-pages.sync="search.totalPages"></pagination>	


</div>

</template>

<script>
module.exports={
	data:function(){
		return {
			search: {hptype:'',contenttype:'',
	          pageSize: 10,
	          page: 1,
	          totalPages: 0,title:''     
	        },list:[],
	        searchs:{},ids:'',initsearch:{hptype:'',contenttype:'',
	          pageSize: 10,
	          page: 1,
	          totalPages: 0,title:''       
	        }
		}
	},watch:{
		'$route.params':function(res){
			this.getData();
		}
	},methods:{
		getData:function(casetxt){	
			if(this.$route.params.type==undefined){
				return ;
			}
			var newids=this.$route.params.type+'_'+this.$route.params.id;
			if(this.ids==newids){
				var obj=Object.assign({},this.search)
				var s=Object.assign({},this.searchs)
			    s[this.ids]=obj;
			    this.$set('searchs',s);
			}else{
				this.ids=newids;
				if(this.searchs[this.ids]){
			    	var obj=Object.assign({},this.searchs[this.ids]);
			    	this.search=obj;
			    }else{
			    	var obj=Object.assign({},this.initsearch)
			    	var s=Object.assign({},this.searchs)
			    	s[this.ids]=obj;
			    	this.$set('searchs',s);
			    	this.search=obj;		    	
			    }
			}
			//this.ids=this.$route.params.type+'_'+this.$route.params.id;
		    	
			if(casetxt){
		        if( casetxt=='search' && 
		        	this.search.title.length==''){
		         	 return ;
		        }
		        this.search.page=1;       
		    }
		    this.search.hptype=this.$route.params.type;
		    this.search.contenttype=this.$route.params.id;
			Ajax.post('/platform/sys_helper_getList',
				this.search).then(function(res){
				var result=res.data;
				if(result.data && result.data.list){
					this.$set('list',result.data.list);
					this.search.totalPages = result.data.totalPages || 0;
				}
			}.bind(this))
		}
	},ready:function(){
		this.getData();
	},route:{
		activate:function(){
		}
	}
}
</script>