| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div style="margin-bottom: 10px"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="Plus" |
| | | @click="openDialog('add',{})" |
| | | >新增</el-button> |
| | | </div> |
| | | <!-- 表格数据 --> |
| | | <el-table v-loading="loading" :data="dataList" :border="true"> |
| | | <el-table-column label="用户ID" prop="userID" align="center" /> |
| | | <el-table-column label="机构名称" prop="name" align="center" /> |
| | | <el-table-column label="信用代码" prop="code" align="center" /> |
| | | <el-table-column label="用户ID" prop="id" align="center"/> |
| | | <el-table-column label="机构名称" prop="agency.name" align="center"/> |
| | | <el-table-column label="信用代码" prop="agency.creditCode" align="center"/> |
| | | <el-table-column label="用户名" prop="username" align="center" /> |
| | | <el-table-column label="注册手机号" prop="phone" align="center" /> |
| | | <el-table-column label="注册审批" prop="examine" align="center" > |
| | | <el-table-column label="注册审批" prop="approve" align="center"> |
| | | <template #default="scope"> |
| | | <span v-if="scope.row.examine === 1">待审批</span> |
| | | <span v-if="scope.row.examine === 2">未通过</span> |
| | | <span v-if="scope.row.examine === 3">已通过</span> |
| | | <el-tag :type="scope.row.approve == 0?'success':scope.row.approve == 1?'':'danger'"> |
| | | {{scope.row.approve == 0?'审批通过':scope.row.approve == 1?'待审批':'未通过'}} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="状态" prop="status" align="center" > |
| | | <template #default="scope"> |
| | | <span v-if="scope.row.status === 1">可用</span> |
| | | <span v-if="scope.row.status === 2">不可用</span> |
| | | <el-switch |
| | | v-if="scope.row.approve == 0" |
| | | v-model="scope.row.status" |
| | | :active-value="0" |
| | | :inactive-value="1" |
| | | inline-prompt |
| | | active-text="正常" |
| | | inactive-text="停用" |
| | | @change="switchStatus($event,scope.row)" |
| | | /> |
| | | <span v-else>--</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="300px"> |
| | | <el-table-column label="操作" align="center" width="250" class-name="small-padding fixed-width" > |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="openDialog('review',scope.row)" >查看</el-button> |
| | | <el-button link type="primary" @click="openDialog('edit',scope.row)" v-hasPermi="['system:role:edit']">编辑</el-button> |
| | | <el-button link type="danger" v-if="!(scope.row.status === 1 && scope.row.examine === 3)" @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']">删除</el-button> |
| | | <el-button link type="primary" v-if="scope.row.examine === 3 && scope.row.status === 1" @click="stop(scope.row)" >停用</el-button> |
| | | <el-button link type="primary" v-if="scope.row.examine !== 3 && scope.row.status === 2" @click="pass(scope.row)" >审批通过</el-button> |
| | | <el-button link type="primary" @click="openDialog('view',scope.row)">查看</el-button> |
| | | <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button> |
| | | <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button> |
| | | <el-button link type="primary" v-if="isSuper && scope.row.approve !==0 " @click="openApprove(scope.row)">审批</el-button> |
| | | <el-button link type="primary" @click="openPwd('pwd',scope.row)">修改密码</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | v-model:limit="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | <supervise-dialog ref="superRef" @getList=getList></supervise-dialog> |
| | | <register ref="regRef"/> |
| | | <el-dialog v-model="appDialog" title="审批用户" width="30%" center align-center> |
| | | <el-radio-group v-model="appoveForm.approve" style="width: 100%"> |
| | | <el-radio :label="0" size="large" border>通过</el-radio> |
| | | <el-radio :label="2" size="large" border>驳回</el-radio> |
| | | </el-radio-group> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button @click="appDialog = false">取消</el-button> |
| | | <el-button type="primary" @click="confirmApproval">确认</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {getCurrentInstance, reactive, ref, toRefs} from "vue"; |
| | | import {ElMessageBox} from "element-plus"; |
| | | import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import superviseDialog from "../superviseUsers/components/superviseDialog.vue" |
| | | import { Register } from "@/layout/components"; |
| | | import {delMonitor, getAgencyList, changeApprove, changeStatus} from "../../../../api/sysUsers" |
| | | import Cookies from "js-cookie"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const loading = ref(false); |
| | | const superRef = ref(); |
| | | const regRef = ref(null) |
| | | const data = reactive({ |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | }, |
| | | total: 0, |
| | | dataList: [] |
| | | |
| | | |
| | | dataList: [], |
| | | isSuper: false, |
| | | appDialog: false, |
| | | appoveForm: { |
| | | id: null, |
| | | approve: null |
| | | } |
| | | }); |
| | | |
| | | const { queryParams, total, dataList } = toRefs(data); |
| | | const { queryParams, total, dataList, isSuper, appDialog, appoveForm } = toRefs(data); |
| | | |
| | | const getList = () => { |
| | | loading.value = true; |
| | | console.log("获取数据") |
| | | loading.value = false; |
| | | onMounted(()=>{ |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | | if(userInfo.identity == 0){data.isSuper = true} |
| | | getList() |
| | | }) |
| | | |
| | | onUnmounted(()=>{ |
| | | |
| | | }) |
| | | |
| | | const getList = async () => { |
| | | loading.value = true |
| | | const res = await getAgencyList(data.queryParams) |
| | | if(res.code == 200){ |
| | | data.dataList = res.data.list |
| | | data.total = res.data.total |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | loading.value = false |
| | | } |
| | | |
| | | const openPwd = (type, value) => { |
| | | superRef.value.openDialog(type, value); |
| | | } |
| | | |
| | | const openDialog = (type, value) => { |
| | | superRef.value.openDialog(type, value); |
| | | regRef.value.openDialog(type, value); |
| | | } |
| | | |
| | | const openApprove =(val)=>{ |
| | | data.appoveForm = { |
| | | id: null, |
| | | approve: null |
| | | } |
| | | data.appoveForm.id = val.id |
| | | data.appDialog = true |
| | | } |
| | | |
| | | const confirmApproval = async () =>{ |
| | | if(data.appoveForm.approve !== null){ |
| | | const res = await changeApprove(data.appoveForm) |
| | | if(res.code == 200){ |
| | | ElMessage.success('审批成功') |
| | | await getList() |
| | | data.appDialog = false |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | } |
| | | |
| | | const switchStatus = (e,val) => { |
| | | ElMessageBox.confirm( |
| | | '确定修改该机构当前状态?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then( async() => { |
| | | const res = await changeStatus({id: val.id,status: e}) |
| | | if(res.code == 200){ |
| | | ElMessage.success('状态修改成功') |
| | | await getList() |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | getList() |
| | | }) |
| | | |
| | | } |
| | | |
| | | /** 重置新增的表单以及其他数据 */ |
| | |
| | | type: 'warning', |
| | | }) |
| | | .then( async() => { |
| | | |
| | | const res = await delMonitor(val.id) |
| | | if(res.code == 200){ |
| | | ElMessage.success('数据删除成功') |
| | | getList() |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }) |
| | | } |
| | | const stop = (val) => { |
| | | |
| | | } |
| | | const pass= (val) => { |
| | | |
| | | } |
| | | </script> |