156 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			156 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list class="list">
 | |
|     <ai-title slot="title" title="走访慰问" isShowBottomBorder></ai-title>
 | |
|     <template slot="content">
 | |
|       <div class="content">
 | |
|         <ai-search-bar bottomBorder>
 | |
|           <template #left>
 | |
|             <ai-select
 | |
|               v-model="search.applicationId"
 | |
|               clearable
 | |
|               placeholder="请选择对象类型"
 | |
|               :selectList="dictList"
 | |
|               @change="search.current = 1, getList()">
 | |
|             </ai-select>
 | |
|             <ai-select
 | |
|               v-model="search.reality"
 | |
|               clearable
 | |
|               placeholder="请选择现实状态"
 | |
|               :selectList="dict.getDict('visitCondolenceReality')"
 | |
|               @change="search.current = 1, getList()">
 | |
|             </ai-select>
 | |
|           </template>
 | |
|           <template #right>
 | |
|             <el-input
 | |
|               v-model="search.title"
 | |
|               size="small"
 | |
|               placeholder="标题、慰问对象、走访人"
 | |
|               clearable
 | |
|               v-throttle="() => {search.current = 1, getList()}"
 | |
|               @clear="search.current = 1, search.title = '', getList()"
 | |
|               suffix-icon="iconfont iconSearch">
 | |
|             </el-input>
 | |
|           </template>
 | |
|         </ai-search-bar>
 | |
|         <ai-table
 | |
|           :tableData="tableData"
 | |
|           :col-configs="colConfigs"
 | |
|           :total="total"
 | |
|           style="margin-top: 16px;"
 | |
|           :current.sync="search.current"
 | |
|           :size.sync="search.size"
 | |
|           @getList="getList">
 | |
|           <el-table-column slot="options" width="120px" 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="remove(row.id)">删除</el-button>
 | |
|               </div>
 | |
|             </template>
 | |
|           </el-table-column>
 | |
|         </ai-table>
 | |
|       </div>
 | |
|     </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,
 | |
|           title: '',
 | |
|           reality: '',
 | |
|           menuLevel3Name: ''
 | |
|         },
 | |
|         dictList: [],
 | |
|         info: {},
 | |
|         colConfigs: [
 | |
|           { prop: 'title', label: '标题' },
 | |
|           { prop: 'visitTime', align: 'center', label: '走访时间' },
 | |
|           { prop: 'name', align: 'center', label: '慰问对象' },
 | |
|           { prop: 'menuLevel3Name', align: 'center', label: '对象类型' },
 | |
|           { prop: 'reality', align: 'center', label: '现实状态', formart: v => v ? this.dict.getLabel('visitCondolenceReality', v) : '-' },
 | |
|           { prop: 'createUserName', align: 'center', label: '走访人' }
 | |
|         ],
 | |
|         tableData: [],
 | |
|         total: 0
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     computed: {
 | |
|       ...mapState(['user'])
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       this.getDictList()
 | |
|       this.dict.load(['visitCondolenceReality']).then(() => {
 | |
|         this.getList()
 | |
|       })
 | |
|     },
 | |
| 
 | |
|     methods: {
 | |
|       getList () {
 | |
|         this.instance.post(`/app/appvisitvondolence/list`, null, {
 | |
|           params: {
 | |
|             ...this.search
 | |
|           }
 | |
|         }).then(res => {
 | |
|           if (res.code == 0) {
 | |
|             this.tableData = res.data.records
 | |
|             this.total = res.data.total
 | |
|           }
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       getDictList () {
 | |
|         this.instance.post(`/app/appapplicationinfo/queryApplicationListByType`).then(res => {
 | |
|           if (res.code == 0) {
 | |
|             this.dictList = res.data.map(v => {
 | |
|               return {
 | |
|                 dictValue: v.id,
 | |
|                 dictName: v.applicationName
 | |
|               }
 | |
|             })
 | |
|           }
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       remove(id) {
 | |
|         this.$confirm('确定删除该数据?').then(() => {
 | |
|           this.instance.post(`/app/appvisitvondolence/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 scoped lang="scss">
 | |
|   .list {
 | |
|   }
 | |
| </style>
 |