|
@@ -2,7 +2,7 @@
|
|
<div class="qpage">
|
|
<div class="qpage">
|
|
<el-form :inline="true" :model="queryForm" class="query-form-inline">
|
|
<el-form :inline="true" :model="queryForm" class="query-form-inline">
|
|
<el-form-item label="">
|
|
<el-form-item label="">
|
|
- <el-input v-model="queryForm.user" placeholder="请输入用户名关键字" />
|
|
|
|
|
|
+ <el-input v-model="queryForm.realName" placeholder="请输入姓名关键字" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
@@ -14,7 +14,7 @@
|
|
<CrudTable
|
|
<CrudTable
|
|
ref="crudTable"
|
|
ref="crudTable"
|
|
page-info-opts="total, prev, pager, next,sizes"
|
|
page-info-opts="total, prev, pager, next,sizes"
|
|
- url="./test/tableDatas.json"
|
|
|
|
|
|
+ url="/user/query"
|
|
:initWhere="{a:1,b:2}"
|
|
:initWhere="{a:1,b:2}"
|
|
:pageSize="20"
|
|
:pageSize="20"
|
|
>
|
|
>
|
|
@@ -24,18 +24,18 @@
|
|
</template>
|
|
</template>
|
|
<template #tabColumns>
|
|
<template #tabColumns>
|
|
<el-table-column fixed type="index" label="序号" width="60" align="center"/>
|
|
<el-table-column fixed type="index" label="序号" width="60" align="center"/>
|
|
- <el-table-column fixed prop="date" label="姓名" width="150" />
|
|
|
|
- <el-table-column prop="name" label="账号" width="120" />
|
|
|
|
|
|
+ <el-table-column fixed prop="realName" label="姓名" width="150" />
|
|
|
|
+ <el-table-column prop="loginId" label="账号" width="120" />
|
|
<el-table-column prop="state" label="所属部门" width="120" />
|
|
<el-table-column prop="state" label="所属部门" width="120" />
|
|
<el-table-column prop="state2" label="所辖部门" width="120" />
|
|
<el-table-column prop="state2" label="所辖部门" width="120" />
|
|
<el-table-column prop="city" label="角色" width="320" />
|
|
<el-table-column prop="city" label="角色" width="320" />
|
|
- <el-table-column prop="address" label="创建时间" width="600" />
|
|
|
|
|
|
+ <el-table-column prop="createTime" label="创建时间" width="600" />
|
|
<el-table-column prop="zip" label="操作" width="160" fixed="right">
|
|
<el-table-column prop="zip" label="操作" width="160" fixed="right">
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
<div class="tool-column">
|
|
<div class="tool-column">
|
|
<el-button type="primary" icon="edit" size="small" @click="openEditHandle(scope.row)">编辑</el-button>
|
|
<el-button type="primary" icon="edit" size="small" @click="openEditHandle(scope.row)">编辑</el-button>
|
|
|
|
|
|
- <el-button type="warning" icon="delete" size="small" @click="delHandle">删除</el-button>
|
|
|
|
|
|
+ <el-button type="warning" icon="delete" size="small" @click="delHandle(scope.row)">删除</el-button>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</template>
|
|
</template>
|
|
@@ -49,7 +49,7 @@
|
|
<el-dialog v-model="editDialogShow" title="用户编辑" :close-on-click-modal="false"
|
|
<el-dialog v-model="editDialogShow" title="用户编辑" :close-on-click-modal="false"
|
|
:destroy-on-close="true"
|
|
:destroy-on-close="true"
|
|
>
|
|
>
|
|
- <UserEdit ref="userEdit" key="eidt1"></UserEdit>
|
|
|
|
|
|
+ <UserEdit ref="userEdit" :record="crtEditRecord"></UserEdit>
|
|
<template #footer>
|
|
<template #footer>
|
|
<span class="dialog-footer">
|
|
<span class="dialog-footer">
|
|
<el-button @click="beforeCloseHandle('cancel')">取消</el-button>
|
|
<el-button @click="beforeCloseHandle('cancel')">取消</el-button>
|
|
@@ -65,10 +65,10 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import {reactive,ref} from 'vue'
|
|
import {reactive,ref} from 'vue'
|
|
- import {ElMessageBox} from 'element-plus'
|
|
|
|
|
|
+ import {ElMessageBox,ElMessage} from 'element-plus'
|
|
import CrudTable from "../../components/crudtable/CrudTable.vue"
|
|
import CrudTable from "../../components/crudtable/CrudTable.vue"
|
|
import UserEdit from "./UserEdit.vue"
|
|
import UserEdit from "./UserEdit.vue"
|
|
-
|
|
|
|
|
|
+ import userAPI from "@/api/user.js"
|
|
const crudTable=ref(null)
|
|
const crudTable=ref(null)
|
|
|
|
|
|
const isQuerying=ref(false)
|
|
const isQuerying=ref(false)
|
|
@@ -76,7 +76,7 @@
|
|
const editDialogShow=ref(false)
|
|
const editDialogShow=ref(false)
|
|
|
|
|
|
const queryForm = reactive({
|
|
const queryForm = reactive({
|
|
- user: ''
|
|
|
|
|
|
+ realName: ''
|
|
})
|
|
})
|
|
|
|
|
|
const queryHandle=()=>{
|
|
const queryHandle=()=>{
|
|
@@ -87,7 +87,7 @@
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- const delHandle=()=>{
|
|
|
|
|
|
+ const delHandle=(record)=>{
|
|
ElMessageBox.confirm(
|
|
ElMessageBox.confirm(
|
|
'确定要删除该用户吗?',
|
|
'确定要删除该用户吗?',
|
|
'操作确认',
|
|
'操作确认',
|
|
@@ -97,29 +97,41 @@
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}
|
|
}
|
|
).then(()=>{
|
|
).then(()=>{
|
|
- alert('ok');
|
|
|
|
|
|
+ userAPI.del({userId:record.userId}).then(resp=>{
|
|
|
|
+ if(resp.code!=0){
|
|
|
|
+ ElMessage.error(resp.msg)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ ElMessage.success('操作成功')
|
|
|
|
+ queryHandle()
|
|
|
|
+ })
|
|
}).catch(()=>{
|
|
}).catch(()=>{
|
|
- console.log('cancel del user')
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
const userEdit=ref(null)
|
|
const userEdit=ref(null)
|
|
-
|
|
|
|
- const openEditHandle=(record)=>{
|
|
|
|
- console.log(record)
|
|
|
|
|
|
+ const crtEditRecord=ref(null)
|
|
|
|
+ const openEditHandle=(record)=>{
|
|
editDialogShow.value=true
|
|
editDialogShow.value=true
|
|
|
|
+ crtEditRecord.value=record
|
|
}
|
|
}
|
|
|
|
|
|
- const beforeCloseHandle=(tag)=>{
|
|
|
|
|
|
+ const beforeCloseHandle=async (tag)=>{
|
|
if(tag==='cancel'){
|
|
if(tag==='cancel'){
|
|
editDialogShow.value=false
|
|
editDialogShow.value=false
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- userEdit.value.submitForm().then(()=>{
|
|
|
|
|
|
+ try{
|
|
|
|
+ await userEdit.value.submitForm()
|
|
editDialogShow.value=false
|
|
editDialogShow.value=false
|
|
queryHandle()
|
|
queryHandle()
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ catch(err){
|
|
|
|
+ console.log(err)
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|