169 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			169 lines
		
	
	
		
			5.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
| <template>
 | |
|   <ai-list class="notice">
 | |
|     <template slot="title">
 | |
|       <ai-title title="风险告知" isShowBottomBorder></ai-title>
 | |
|     </template>
 | |
|     <template slot="content">
 | |
|       <ai-search-bar bottomBorder>
 | |
|         <template #left>
 | |
|           <ai-select
 | |
|             v-model="search.riskType"
 | |
|             clearable
 | |
|             placeholder="请选择风险类型"
 | |
|             :selectList="dict.getDict('fpRiskType')"
 | |
|             @change="search.current = 1, getList()">
 | |
|           </ai-select>
 | |
|           <el-button icon="iconfont iconAdd" type="primary" size="small" @click="toAdd('')">添加 </el-button>
 | |
|         </template>
 | |
|         <template #right>
 | |
|           <el-input
 | |
|             v-model="search.name"
 | |
|             size="small"
 | |
|             placeholder="姓名/风险说明/操作人"
 | |
|             clearable
 | |
|             v-throttle="() => {search.current = 1, getList()}"
 | |
|             @clear="search.current = 1, search.name = '', getList()"
 | |
|             suffix-icon="iconfont iconSearch">
 | |
|           </el-input>
 | |
|         </template>
 | |
|       </ai-search-bar>
 | |
|       <ai-search-bar bottomBorder style="margin-top: 12px;">
 | |
|         <template #left>
 | |
|           <el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除 </el-button>
 | |
|         </template>
 | |
|         <template #right>
 | |
|           <ai-download :instance="instance" url="/app/apppreventionreturntopovertyriskperson/export" :params="search" fileName="风险预警人员" :disabled="tableData.length == 0">
 | |
|             <el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button>
 | |
|           </ai-download>
 | |
|           <ai-import :instance="instance" :dict="dict" type="apppreventionreturntopovertyriskperson" :importParams="search" name="风险预警人员" @success="getList()">
 | |
|             <el-button icon="iconfont iconImport">导入</el-button>
 | |
|           </ai-import>
 | |
|         </template>
 | |
|       </ai-search-bar>
 | |
|       <ai-table
 | |
|         :tableData="tableData"
 | |
|         :col-configs="colConfigs"
 | |
|         :total="total"
 | |
|         style="margin-top: 12px;"
 | |
|         :current.sync="search.current"
 | |
|         :size.sync="search.size"
 | |
|         @selection-change="(v) => (ids = v.map((e) => e.id))"
 | |
|         @getList="getList">
 | |
|         <el-table-column slot="tags" label="标签">
 | |
|           <template slot-scope="{ row }">
 | |
|             <div class="table-tags">
 | |
|               <el-tag type="info" v-for="(item, index) in row.tags" size="small" :key="index">{{ item }}</el-tag>
 | |
|             </div>
 | |
|           </template>
 | |
|         </el-table-column>
 | |
|         <el-table-column slot="options" width="120px" fixed="right" label="操作" align="center">
 | |
|           <div class="table-options" slot-scope="{ row }">
 | |
|             <el-button type="text" @click="toDetail(row.id)">详情</el-button>
 | |
|             <el-button type="text" @click="remove(row.id)">删除</el-button>
 | |
|           </div>
 | |
|         </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,
 | |
|           title: '',
 | |
|           riskType: ''
 | |
|         },
 | |
|         ids: [],
 | |
|         total: 10,
 | |
|         colConfigs: [
 | |
|           { type: 'selection' },
 | |
|           {prop: 'name', label: '姓名', align: 'left'},
 | |
|           {prop: 'phone', label: '联系方式', align: 'center' },
 | |
|           {prop: 'riskType', label: '风险类型', align: 'center', formart: v => this.dict.getLabel('fpRiskType', v) },
 | |
|           {prop: 'areaName', label: '所属区域', align: 'center' },
 | |
|           {prop: 'remarks', label: '备注说明', align: 'center' },
 | |
|           {prop: 'createTime', label: '操作时间', align: 'center'},
 | |
|           {prop: 'visitUserName', label: '操作人', align: 'center' },
 | |
|           {prop: 'createTime', label: '归口部门', align: 'center' },
 | |
|           {slot: 'options', label: '操作'}
 | |
|         ],
 | |
|         tableData: []
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     computed: {
 | |
|       ...mapState(['user'])
 | |
|     },
 | |
| 
 | |
|     created () {
 | |
|       this.dict.load('fpRiskType').then(() => {
 | |
|         this.getList()
 | |
|       })
 | |
|     },
 | |
| 
 | |
|     methods: {
 | |
|       getList() {
 | |
|         this.instance.post(`/app/apppreventionreturntopovertyriskperson/list`, null, {
 | |
|           params: {
 | |
|             ...this.search
 | |
|           }
 | |
|         }).then(res => {
 | |
|           if (res.code == 0) {
 | |
|             this.tableData = res.data.records
 | |
|             this.total = res.data.total
 | |
|           }
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       removeAll () {
 | |
|         var id = this.ids.join(',')
 | |
|         this.remove(id)
 | |
|       },
 | |
| 
 | |
|       remove(id) {
 | |
|         this.$confirm('确定删除该数据?').then(() => {
 | |
|           this.instance.post(`/app/apppreventionreturntopovertyriskperson/delete?ids=${id}`).then(res => {
 | |
|             if (res.code == 0) {
 | |
|               this.$message.success('删除成功!')
 | |
|               this.getList()
 | |
|             }
 | |
|           })
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       toDetail (id) {
 | |
|         this.$emit('change', {
 | |
|           type: 'Detail',
 | |
|           params: {
 | |
|             id: id || ''
 | |
|           }
 | |
|         })
 | |
|       },
 | |
| 
 | |
|       toAdd(id) {
 | |
|         this.$emit('change', {
 | |
|           type: 'Add',
 | |
|           params: {
 | |
|             id: id || ''
 | |
|           }
 | |
|         })
 | |
|       }
 | |
|     }
 | |
|   }
 | |
| </script>
 | |
| 
 | |
| <style lang="scss" scoped>
 | |
| </style>
 |