parent
4b7cd48796
commit
aea6bbfab6
@ -0,0 +1,83 @@
|
||||
export const tableOption = {
|
||||
searchMenuSpan: 6,
|
||||
columnBtn: false,
|
||||
border: true,
|
||||
// selection: true,
|
||||
index: false,
|
||||
indexLabel: '序号',
|
||||
stripe: true,
|
||||
menuAlign: 'center',
|
||||
menuWidth: 350,
|
||||
align: 'center',
|
||||
refreshBtn: true,
|
||||
searchSize: 'mini',
|
||||
addBtn: false,
|
||||
editBtn: false,
|
||||
delBtn: false,
|
||||
viewBtn: false,
|
||||
props: {
|
||||
label: 'label',
|
||||
value: 'value'
|
||||
},
|
||||
column: [
|
||||
{
|
||||
label: '档案ID',
|
||||
prop: 'portfolioId',
|
||||
search: false
|
||||
},
|
||||
{
|
||||
label: '会员ID',
|
||||
prop: 'userId',
|
||||
search: true
|
||||
},
|
||||
{
|
||||
label: '姓名',
|
||||
prop: 'name',
|
||||
search: true
|
||||
},
|
||||
{
|
||||
label: '出生日期',
|
||||
prop: 'birthDate',
|
||||
search: false
|
||||
},
|
||||
{
|
||||
label: '性别',
|
||||
prop: 'gender',
|
||||
search: true
|
||||
},
|
||||
{
|
||||
label: '民族',
|
||||
prop: 'ethnicity',
|
||||
search: false
|
||||
},
|
||||
{
|
||||
label: '身份证号码',
|
||||
prop: 'idCardNumber',
|
||||
search: true
|
||||
},
|
||||
{
|
||||
label: '联系电话',
|
||||
prop: 'phoneNumber',
|
||||
search: true
|
||||
},
|
||||
{
|
||||
label: '档案状态',
|
||||
prop: 'portfolioStatus',
|
||||
search: true,
|
||||
slot: true,
|
||||
type: 'select',
|
||||
dicData: [
|
||||
{
|
||||
label: '待审核',
|
||||
value: 0
|
||||
}, {
|
||||
label: '审核通过',
|
||||
value: 1
|
||||
}, {
|
||||
label: '审核未通过',
|
||||
value: -1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="!dataForm.detailOrCheck ? '档案详情' : '档案审核'"
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
<el-form
|
||||
ref="dataFormRef"
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
label-width="80px"
|
||||
@keyup.enter="onSubmit()"
|
||||
>
|
||||
<el-form-item
|
||||
label="用户头像"
|
||||
prop="pic"
|
||||
>
|
||||
<img
|
||||
v-if="dataForm.pic"
|
||||
:src="dataForm.pic"
|
||||
class="image"
|
||||
alt=""
|
||||
>
|
||||
<div v-else>
|
||||
无
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="用户昵称"
|
||||
prop="nickName"
|
||||
>
|
||||
<el-input
|
||||
v-model="dataForm.nickName"
|
||||
:disabled="true"
|
||||
placeholder="用户昵称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="状态"
|
||||
prop="status"
|
||||
>
|
||||
<el-radio-group v-model="dataForm.status">
|
||||
<el-radio :label="0">
|
||||
禁用
|
||||
</el-radio>
|
||||
<el-radio :label="1">
|
||||
正常
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span
|
||||
class="dialog-footer"
|
||||
>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="onSubmit()"
|
||||
>确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Debounce } from '@/utils/debounce'
|
||||
|
||||
const emit = defineEmits(['refreshDataList'])
|
||||
|
||||
const visible = ref(false)
|
||||
const dataForm = ref({
|
||||
userId: 0,
|
||||
portfolioId: 0,
|
||||
nickName: '',
|
||||
pic: '',
|
||||
status: 1,
|
||||
detailOrCheck: 0
|
||||
})
|
||||
const page = reactive({
|
||||
total: 0, // 总页数
|
||||
currentPage: 1, // 当前页数
|
||||
pageSize: 10 // 每页显示多少条
|
||||
})
|
||||
const dataRule = {
|
||||
nickName: [
|
||||
{
|
||||
required: true,
|
||||
message: '用户名不能为空',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
const dataFormRef = ref(null)
|
||||
const init = (params) => {
|
||||
dataForm.value.portfolioId = params.portfolioId || 0
|
||||
visible.value = true
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
})
|
||||
console.log(dataForm.value)
|
||||
if (dataForm.value.portfolioId) {
|
||||
http({
|
||||
url: http.adornUrl(`/user/portfolio/info/${dataForm.value.portfolioId}`),
|
||||
method: 'get',
|
||||
params: http.adornParams()
|
||||
})
|
||||
.then(({ data }) => {
|
||||
console.log(data)
|
||||
dataForm.value = data
|
||||
})
|
||||
}
|
||||
}
|
||||
defineExpose({ init })
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
const onSubmit = Debounce(() => {
|
||||
dataFormRef.value?.validate(valid => {
|
||||
if (valid) {
|
||||
http({
|
||||
url: http.adornUrl('/admin/user'),
|
||||
method: dataForm.value.userId ? 'put' : 'post',
|
||||
data: http.adornData({
|
||||
userId: dataForm.value.userId || undefined,
|
||||
nickName: dataForm.value.nickName,
|
||||
status: dataForm.value.status
|
||||
})
|
||||
})
|
||||
.then(() => {
|
||||
ElMessage({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
visible.value = false
|
||||
emit('refreshDataList', page)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<div class="mod-user">
|
||||
<avue-crud
|
||||
ref="crudRef"
|
||||
:page="page"
|
||||
:data="dataList"
|
||||
:option="tableOption"
|
||||
@search-change="onSearch"
|
||||
@selection-change="selectionChange"
|
||||
@on-load="getDataList"
|
||||
>
|
||||
<template #pic="scope">
|
||||
<span
|
||||
v-if="scope.row.pic"
|
||||
class="avue-crud__img"
|
||||
>
|
||||
<el-icon><Document/></el-icon>
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</template>
|
||||
|
||||
<template #portfolioStatus="scope">
|
||||
<el-tag
|
||||
v-if="scope.row.portfolioStatus === 0"
|
||||
type="info"
|
||||
>
|
||||
待审核
|
||||
</el-tag>
|
||||
<el-tag v-if="scope.row.portfolioStatus === 1" type="success">
|
||||
审核通过
|
||||
</el-tag>
|
||||
<el-tag v-if="scope.row.portfolioStatus === -1" type="danger">
|
||||
审核未通过
|
||||
</el-tag>
|
||||
</template>
|
||||
<template #menu="scope">
|
||||
<el-button
|
||||
v-if="isAuth('user:userPortfolio:detail')"
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
@click.stop="onDetailOrCheck({portfolioId: scope.row.portfolioId,detailOrCheck:0})"
|
||||
>
|
||||
详情
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isAuth('user:userPortfolio:approve')"
|
||||
type="danger"
|
||||
icon="el-icon-edit"
|
||||
@click.stop="onDetailOrCheck({portfolioId: scope.row.portfolioId,detailOrCheck:1})"
|
||||
>
|
||||
审核
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<detail-or-check
|
||||
v-if="detailOrCheckVisible"
|
||||
ref="detailOrCheckRef"
|
||||
@refresh-data-list="getDataList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { isAuth } from '@/utils'
|
||||
import { tableOption } from '@/crud/user/portfolio.js'
|
||||
import DetailOrCheck from './detail-or-check.vue'
|
||||
|
||||
const dataList = ref([])
|
||||
const dataListLoading = ref(false)
|
||||
const dataListSelections = ref([])
|
||||
const detailOrCheckVisible = ref(false)
|
||||
const page = reactive({
|
||||
total: 0, // 总页数
|
||||
currentPage: 1, // 当前页数
|
||||
pageSize: 10 // 每页显示多少条
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取数据列表
|
||||
*/
|
||||
const getDataList = (pageParam, params, done) => {
|
||||
dataListLoading.value = true
|
||||
http({
|
||||
url: http.adornUrl('/user/portfolio/page'),
|
||||
method: 'get',
|
||||
params: http.adornParams(
|
||||
Object.assign(
|
||||
{
|
||||
current: pageParam == null ? page.currentPage : pageParam.currentPage,
|
||||
size: pageParam == null ? page.pageSize : pageParam.pageSize
|
||||
},
|
||||
params
|
||||
)
|
||||
)
|
||||
})
|
||||
.then(({ data }) => {
|
||||
dataList.value = data.records
|
||||
page.total = data.total
|
||||
dataListLoading.value = false
|
||||
if (done) done()
|
||||
})
|
||||
}
|
||||
|
||||
const detailOrCheckRef = ref(null)
|
||||
/**
|
||||
* 详情 / 审核
|
||||
* @param param
|
||||
*/
|
||||
const onDetailOrCheck = (param) => {
|
||||
detailOrCheckVisible.value = true
|
||||
nextTick(() => {
|
||||
detailOrCheckRef.value?.init(param)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
*/
|
||||
const onSearch = (params, done) => {
|
||||
getDataList(page, params, done)
|
||||
}
|
||||
|
||||
/**
|
||||
* 多选变化
|
||||
*/
|
||||
const selectionChange = (val) => {
|
||||
dataListSelections.value = val
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in new issue