258 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			258 lines
		
	
	
		
			5.8 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list class="AppPetitionManage" isTabs>
 | |
|     <template slot="content">
 | |
|       <ai-search-bar class="search-bar">
 | |
|         <template slot="left">
 | |
|           <el-button type="primary" icon="iconfont iconAdd" @click="toAdd">发布活动</el-button>
 | |
|           <ai-select
 | |
|             v-model="search.isRealName"
 | |
|             @change="search.current = 1, getList()"
 | |
|             placeholder="是否实名"
 | |
|             :selectList="dict.getDict('wxCustomerAddWay')">
 | |
|           </ai-select>
 | |
|         </template>
 | |
|         <template slot="right">
 | |
|           <el-input
 | |
|             v-model="search.name"
 | |
|             class="search-input"
 | |
|             size="small"
 | |
|             @keyup.enter.native="search.current = 1, getList()"
 | |
|             placeholder="请输入备注、昵称、姓名"
 | |
|             clearable
 | |
|             @change="getList"
 | |
|             @clear="search.current = 1, search.name = '', getList()"
 | |
|             suffix-icon="iconfont iconSearch">
 | |
|           </el-input>
 | |
|         </template>
 | |
|       </ai-search-bar>
 | |
|       <ai-table
 | |
|         :tableData="tableData"
 | |
|         :col-configs="colConfigs"
 | |
|         :total="total"
 | |
|         ref="aitableex"
 | |
|         :current.sync="search.current"
 | |
|         :size.sync="search.size"
 | |
|         v-loading="isLoading"
 | |
|         @getList="getList">
 | |
|         <el-table-column slot="options" width="220px" fixed="right" label="操作" align="center">
 | |
|           <template slot-scope="{ row }">
 | |
|             <div class="table-options">
 | |
|               <el-button type="text" @click="toDetail(row.id)">详情</el-button>
 | |
|               <el-button type="text" @click="toAdd(row.id)">编辑</el-button>
 | |
|               <el-button type="text" @click="remove(row.id)">删除</el-button>
 | |
|             </div>
 | |
|           </template>
 | |
|         </el-table-column>
 | |
|       </ai-table>
 | |
|     </template>
 | |
|   </ai-list>
 | |
| </template>
 | |
| 
 | |
| <script>
 | |
|   import { mapState } from 'vuex'
 | |
| 
 | |
|   export default {
 | |
|     name: 'List',
 | |
| 
 | |
|     props: {
 | |
|       instance: Function,
 | |
|       dict: Object
 | |
|     },
 | |
| 
 | |
|     data () {
 | |
|       return {
 | |
|         search: {
 | |
|           current: 1,
 | |
|           size: 10,
 | |
|           name: '',
 | |
|           tagId: '',
 | |
|           wxUserId: '',
 | |
|           isRealName: ''
 | |
|         },
 | |
|         isLoading: false,
 | |
|         ids: [],
 | |
|         total: 10,
 | |
|         colConfigs: [
 | |
|           { prop: 'realName', label: '真实姓名', align: 'center' },
 | |
|           {
 | |
|             prop: 'identityNumber', label: '是否实名', align: 'center', 
 | |
|             render: (h, params) => {
 | |
|               return h('span', {
 | |
|               }, params.row.realName ? '是' : '否')
 | |
|             }
 | |
|           },
 | |
|           { prop: 'wxUserNames', label: '所属员工', align: 'center' },
 | |
|           { slot: 'tags' },
 | |
|           { prop: 'createTime', label: '添加时间', align: 'left' },
 | |
|           { prop: 'addWay', label: '添加渠道', align: 'center', formart: v => this.dict.getLabel('wxCustomerAddWay', v) },
 | |
|           { slot: 'options', label: '操作', align: 'center' }
 | |
|         ],
 | |
|         tableData: []
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     computed: {
 | |
|       ...mapState(['user'])
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       this.isLoading = true
 | |
|       this.dict.load(['wxCustomerAddWay']).then(() => {
 | |
|         this.getList()
 | |
|       })
 | |
|     },
 | |
| 
 | |
|     methods: {
 | |
|       getList() {
 | |
|         this.instance.post(`/app/wxcp/wxcustomer/list`, null, {
 | |
|           params: {
 | |
|             ...this.search
 | |
|           }
 | |
|         }).then(res => {
 | |
|           if (res.code == 0) {
 | |
|             this.tableData = res.data.records
 | |
|             this.total = res.data.total
 | |
| 
 | |
|             this.isLoading = false
 | |
|           } else {
 | |
|             this.isLoading = false
 | |
|           }
 | |
|         }).catch(() => {
 | |
|           this.isLoading = false  
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       toAdd (id) {
 | |
|         this.$emit('change', {
 | |
|           type: 'Add',
 | |
|           params: {
 | |
|             id
 | |
|           }
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       remove (id) {
 | |
|         this.$confirm('确定删除该数据?').then(() => {
 | |
|           this.instance.post(`/app/apppetition/delete?ids=${id}`).then(res => {
 | |
|             if (res.code == 0) {
 | |
|               this.$message.success('删除成功!')
 | |
|               this.getList()
 | |
|             }
 | |
|           })
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       toDetail (id) {
 | |
|         this.$emit('change', {
 | |
|           type: 'Detail',
 | |
|           params: {
 | |
|             id: id
 | |
|           }
 | |
|         })
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
|   .table-tags {
 | |
|     .el-tag {
 | |
|       margin-right: 8px;
 | |
|       margin-bottom: 8px;
 | |
|       border: 1px solid #D0D4DC;
 | |
|       background: #F3F4F7;
 | |
|       border-radius: 4px;
 | |
|       font-size: 13px;
 | |
|       color: #222222;
 | |
| 
 | |
|       &:last-child {
 | |
|         margin-right: 0;
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   .ellipsis {
 | |
|     overflow: hidden;
 | |
|     text-overflow:ellipsis;
 | |
|     white-space: nowrap;
 | |
|   }
 | |
| 
 | |
|   .tags {
 | |
|     .tag-item {
 | |
|       display: flex;
 | |
|       align-items: center;
 | |
|       padding-bottom: 30px;
 | |
|       padding-top: 30px;
 | |
|       border-bottom: 1px solid #EEEEEE;
 | |
| 
 | |
|       &:first-child {
 | |
|         padding-top: 0;
 | |
|       }
 | |
| 
 | |
|       .el-tag {
 | |
|         margin-right: 8px;
 | |
|         color: #222222;
 | |
|       }
 | |
| 
 | |
|       h2 {
 | |
|         width: 88px;
 | |
|         margin-right: 40px;
 | |
|         text-align: right;
 | |
|         color: #888888;
 | |
|         font-size: 14px;
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   .avatar {
 | |
|     text-align: right;
 | |
|     img {
 | |
|       position: relative;
 | |
|       top: 4px;
 | |
|       width: 40px;
 | |
|       height: 40px;
 | |
|       border-radius: 2px;
 | |
|       border: 1px solid #CCCCCC;
 | |
|     }
 | |
|   }
 | |
| 
 | |
|   .userinfo {
 | |
|     display: flex;
 | |
|     align-items: center;
 | |
|     line-height: 1;
 | |
| 
 | |
|     .userinfo-right__top {
 | |
|       display: flex;
 | |
|       align-items: center;
 | |
|       margin-bottom: 10px;
 | |
|       cursor: pointer;
 | |
|       white-space: nowrap;
 | |
|     }
 | |
| 
 | |
|     .userinfo-right__bottom {
 | |
|       text-align: left;
 | |
|     }
 | |
| 
 | |
|     i {
 | |
|       cursor: pointer;
 | |
|       font-style: normal;
 | |
|       color: #888888;
 | |
|       font-size: 14px;
 | |
|     }
 | |
| 
 | |
|     h3 {
 | |
|       margin-top: 0;
 | |
|       margin-bottom: 0;
 | |
|       margin-right: 8px;
 | |
|       color: #222222;
 | |
|       font-weight: normal;
 | |
|       font-size: 14px;
 | |
|     }
 | |
| 
 | |
|     span {
 | |
|       color: #3C7FC8;
 | |
|       white-space: nowrap;
 | |
|     }
 | |
|   }
 | |
| </style>
 |