generated from Leo_Ding/web-template
用户黑名单
This commit is contained in:
parent
6abccd93de
commit
dd577b4868
@ -6,6 +6,9 @@ export const getCustomersList = (params) => request.basic.get('/api/v1/customers
|
|||||||
// 黑名单列表
|
// 黑名单列表
|
||||||
export const getBlackCustomersList = (params) => request.basic.get('/api/v1/blackCustomers', params)
|
export const getBlackCustomersList = (params) => request.basic.get('/api/v1/blackCustomers', params)
|
||||||
|
|
||||||
|
// 移除黑名单
|
||||||
|
export const deleteBlackCustomers = (id) => request.basic.delete(`/api/v1/blackCustomers/${id}`)
|
||||||
|
|
||||||
|
|
||||||
//获取单个banner
|
//获取单个banner
|
||||||
export const getBanner = (id) => request.basic.get(`/api/v1/banners/${id}`)
|
export const getBanner = (id) => request.basic.get(`/api/v1/banners/${id}`)
|
||||||
|
|||||||
@ -1,119 +0,0 @@
|
|||||||
<template>
|
|
||||||
<a-modal
|
|
||||||
:open="modal.open"
|
|
||||||
:title="modal.title"
|
|
||||||
:confirm-loading="modal.confirmLoading"
|
|
||||||
:after-close="onAfterClose"
|
|
||||||
@ok="handleOk"
|
|
||||||
@cancel="handleCancel">
|
|
||||||
<a-form
|
|
||||||
ref="formRef"
|
|
||||||
scroll-to-first-error
|
|
||||||
:model="formData"
|
|
||||||
:rules="formRules"
|
|
||||||
:label-col="{ style: { width: '80px' } }">
|
|
||||||
<a-form-item
|
|
||||||
label="标题"
|
|
||||||
name="title">
|
|
||||||
<a-input v-model:value="formData.title"></a-input>
|
|
||||||
</a-form-item>
|
|
||||||
</a-form>
|
|
||||||
</a-modal>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { cloneDeep } from 'lodash-es'
|
|
||||||
import apis from '@/apis'
|
|
||||||
import { useForm, useModal } from '@/hooks'
|
|
||||||
|
|
||||||
const emit = defineEmits(['ok'])
|
|
||||||
|
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
|
||||||
const { formRef, formRules, formRecord, formData, resetForm } = useForm()
|
|
||||||
|
|
||||||
formRules.value = {
|
|
||||||
title: { required: true, message: '请输入标题' },
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新建
|
|
||||||
*/
|
|
||||||
function handleCreate() {
|
|
||||||
showModal({
|
|
||||||
type: 'create',
|
|
||||||
title: '新建',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编辑
|
|
||||||
*/
|
|
||||||
function handleEdit(record = {}) {
|
|
||||||
showModal({
|
|
||||||
type: 'edit',
|
|
||||||
title: '编辑',
|
|
||||||
})
|
|
||||||
formRecord.value = record
|
|
||||||
formData.value = cloneDeep(record)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确定
|
|
||||||
*/
|
|
||||||
function handleOk() {
|
|
||||||
formRef.value
|
|
||||||
.validateFields()
|
|
||||||
.then(async (values) => {
|
|
||||||
try {
|
|
||||||
showLoading()
|
|
||||||
const params = {
|
|
||||||
...values,
|
|
||||||
}
|
|
||||||
let result = null
|
|
||||||
switch (modal.value.type) {
|
|
||||||
case 'create':
|
|
||||||
result = await apis.common.create(params).catch(() => {
|
|
||||||
throw new Error()
|
|
||||||
})
|
|
||||||
break
|
|
||||||
case 'edit':
|
|
||||||
result = await apis.common.update(formRecord.value.id, params).catch(() => {
|
|
||||||
throw new Error()
|
|
||||||
})
|
|
||||||
break
|
|
||||||
}
|
|
||||||
hideLoading()
|
|
||||||
if (200 === result?.code) {
|
|
||||||
hideModal()
|
|
||||||
emit('ok')
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
hideLoading()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
hideLoading()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 取消
|
|
||||||
*/
|
|
||||||
function handleCancel() {
|
|
||||||
hideModal()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关闭后
|
|
||||||
*/
|
|
||||||
function onAfterClose() {
|
|
||||||
resetForm()
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
handleCreate,
|
|
||||||
handleEdit,
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less" scoped></style>
|
|
||||||
@ -40,26 +40,15 @@
|
|||||||
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
|
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
|
||||||
:scroll="{ x: 1000 }" @change="onTableChange">
|
:scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record }">
|
||||||
<template v-if="'banner_type' === column.key">
|
<template v-if="'status' === column.key">
|
||||||
<!--状态-->
|
<!--状态-->
|
||||||
<a-tag v-if="record.banner_type == 1" color="processing">
|
<a-tag v-if="record.status == 'DISABLED'" color="red">
|
||||||
首页轮播图
|
|
||||||
</a-tag>
|
|
||||||
<!--状态-->
|
|
||||||
<a-tag v-else color="processing">
|
|
||||||
营销活动图
|
|
||||||
</a-tag>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-if="'is_recommend' === column.key">
|
|
||||||
<!--状态-->
|
|
||||||
<a-tag v-if="record.banner_type == true" color="processing">
|
|
||||||
启用
|
|
||||||
</a-tag>
|
|
||||||
<!--状态-->
|
|
||||||
<a-tag v-else color="processing">
|
|
||||||
禁用
|
禁用
|
||||||
</a-tag>
|
</a-tag>
|
||||||
|
<!--状态-->
|
||||||
|
<a-tag v-else color="processing">
|
||||||
|
启用
|
||||||
|
</a-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
||||||
@ -68,15 +57,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="'action' === column.key">
|
<template v-if="'action' === column.key">
|
||||||
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
|
||||||
<a-tooltip>
|
|
||||||
<template #title> {{ $t('pages.system.role.edit') }}</template>
|
|
||||||
<edit-outlined />
|
|
||||||
</a-tooltip>
|
|
||||||
</x-action-button>
|
|
||||||
<x-action-button @click="handleRemove(record)">
|
<x-action-button @click="handleRemove(record)">
|
||||||
<a-tooltip>
|
<a-tooltip>
|
||||||
<template #title> {{ $t('pages.system.delete') }}</template>
|
<template #title> 移出黑名单</template>
|
||||||
<delete-outlined style="color: #ff4d4f" />
|
<delete-outlined style="color: #ff4d4f" />
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</x-action-button>
|
</x-action-button>
|
||||||
@ -86,8 +69,6 @@
|
|||||||
</a-card>
|
</a-card>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|
||||||
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -98,7 +79,7 @@ import { formatUtcDateTime } from '@/utils/util'
|
|||||||
import { config } from '@/config'
|
import { config } from '@/config'
|
||||||
import { statusTypeEnum } from '@/enums/system'
|
import { statusTypeEnum } from '@/enums/system'
|
||||||
import { usePagination, useForm } from '@/hooks'
|
import { usePagination, useForm } from '@/hooks'
|
||||||
import EditDialog from './components/EditDialog.vue'
|
|
||||||
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { disabledDict, authenticationTypeDict } from '@/enums/dict'
|
import { disabledDict, authenticationTypeDict } from '@/enums/dict'
|
||||||
@ -133,7 +114,7 @@ const columns = [
|
|||||||
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } =
|
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } =
|
||||||
usePagination()
|
usePagination()
|
||||||
const { resetForm } = useForm()
|
const { resetForm } = useForm()
|
||||||
const editDialogRef = ref()
|
|
||||||
|
|
||||||
getPageList()
|
getPageList()
|
||||||
|
|
||||||
@ -158,6 +139,9 @@ async function getPageList() {
|
|||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
listData.value = data
|
listData.value = data
|
||||||
paginationState.total = total
|
paginationState.total = total
|
||||||
|
}else{
|
||||||
|
listData.value = []
|
||||||
|
paginationState.total = 0
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
hideLoading()
|
hideLoading()
|
||||||
@ -169,14 +153,14 @@ async function getPageList() {
|
|||||||
*/
|
*/
|
||||||
function handleRemove({ id }) {
|
function handleRemove({ id }) {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: t('pages.system.role.delTip'),
|
title: '提示',
|
||||||
content: t('button.confirm'),
|
content: '确定移出黑名单吗?',
|
||||||
okText: t('button.confirm'),
|
okText: t('button.confirm'),
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
; (async () => {
|
; (async () => {
|
||||||
try {
|
try {
|
||||||
const { success } = await apis.role.delRole(id).catch(() => {
|
const { success } = await apis.userControl.deleteBlackCustomers(id).catch(() => {
|
||||||
throw new Error()
|
throw new Error()
|
||||||
})
|
})
|
||||||
if (config('http.code.success') === success) {
|
if (config('http.code.success') === success) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user