| | |
| | | <div class="system-menu-search mb15"> |
| | | <el-form :inline="true" > |
| | | <el-form-item label="姓名:"> |
| | | <el-input v-model="state.tableData.listQuery.searchParams.name" placeholder="姓名" ></el-input> |
| | | <el-input v-model="state.tableData.listQuery.searchParams.realName" placeholder="请输入姓名" ></el-input> |
| | | </el-form-item> |
| | | <el-button size="default" type="primary" class="ml10"> |
| | | <el-button size="default" type="primary" class="ml10" @click="search()"> |
| | | <el-icon> |
| | | <ele-Search /> |
| | | </el-icon> |
| | |
| | | </el-button> |
| | | |
| | | <el-table :data="state.tableData.data" style="width: 100%"> |
| | | <el-table-column align="center" prop="name" label="预警人员"/> |
| | | <el-table-column align="center" prop="realName" label="预警人员"/> |
| | | <el-table-column align="center" prop="phone" label="手机号"/> |
| | | <el-table-column label="操作" show-overflow-tooltip width="140"> |
| | | <el-table-column label="操作" show-overflow-tooltip align="center" width="240"> |
| | | <template #default="scope"> |
| | | <el-button size="small" text type="primary" @click="openDialog('查看', scope.row)">查看</el-button> |
| | | <el-button size="small" text type="primary" @click="openDialog('修改', scope.row)">修改</el-button> |
| | |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import {reactive, ref} from "vue"; |
| | | import {reactive, ref, onMounted} from "vue"; |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { PeopleDataState } from "/@/types/warning"; |
| | | import peopleDialog from "./component/peopleDialog.vue"; |
| | | import { warningPeopleApi } from "/@/api/warningManage/warningPeople"; |
| | | |
| | | const peopleRef = ref(); |
| | | const state = reactive<PeopleDataState>({ |
| | | tableData: { |
| | | data: [ |
| | | // { |
| | | // id: '1', |
| | | // name: '张三', |
| | | // phone: '112554566666' |
| | | // }, |
| | | // { |
| | | // id: '2', |
| | | // name: '李四', |
| | | // phone: '11254212321' |
| | | // } |
| | | ], |
| | | data: [], |
| | | total: 0, |
| | | loading: false, |
| | | listQuery: { |
| | | pageIndex: 1, |
| | | pageSize: 10, |
| | | searchParams:{ |
| | | name: '' |
| | | realName: '' |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | |
| | | const initPeopleData = () => { |
| | | console.log("数据列表") |
| | | //页面加载 |
| | | onMounted(() => { |
| | | initPeopleData(); |
| | | }); |
| | | |
| | | const initPeopleData = async () => { |
| | | let res = await warningPeopleApi().getWarnUserPage(state.tableData.listQuery); |
| | | if(res.data.code == 100) { |
| | | state.tableData.listQuery.pageIndex = res.data.pageIndex; |
| | | state.tableData.listQuery.pageSize = res.data.pageSize; |
| | | state.tableData.total = res.data.total; |
| | | state.tableData.data = res.data.data; |
| | | }else { |
| | | ElMessage({ |
| | | type: 'error', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }; |
| | | const onHandleSizeChange = (val: number) => { |
| | | state.tableData.listQuery.pageSize = val; |
| | |
| | | type: 'warning', |
| | | } |
| | | ) |
| | | .then(() => { |
| | | .then(async () => { |
| | | let res = await warningPeopleApi().delWarnUser({id: val.id}) |
| | | if(res.data.code == 100) { |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '删除成功', |
| | | }) |
| | | }) |
| | | state.tableData.listQuery.pageIndex = 1; |
| | | initPeopleData(); |
| | | }else { |
| | | ElMessage({ |
| | | type: 'error', |
| | | message: res.data.msg |
| | | }); |
| | | } |
| | | }) |
| | | }; |
| | | const search = () => { |
| | | state.tableData.listQuery.pageIndex = 1; |
| | | initPeopleData(); |
| | | }; |
| | | const reset = () => { |
| | | state.tableData.listQuery.searchParams.name = ''; |
| | | state.tableData.listQuery.pageIndex = 1; |
| | | state.tableData.listQuery.searchParams.realName = ''; |
| | | initPeopleData(); |
| | | } |
| | | </script> |
| | | <style scoped lang="scss"> |