generated from Leo_Ding/web-template
1
This commit is contained in:
parent
e7abc8be0f
commit
a9fd22c5a3
0
src/apis/modules/platform.js
Normal file
0
src/apis/modules/platform.js
Normal file
@ -89,5 +89,8 @@ export default {
|
|||||||
systemSettings: '短息、支付参数设置',
|
systemSettings: '短息、支付参数设置',
|
||||||
allSetting: '短息、支付配置列表',
|
allSetting: '短息、支付配置列表',
|
||||||
bannerMgt: '图片轮播管理',
|
bannerMgt: '图片轮播管理',
|
||||||
bannerList: '图片轮播列表',
|
bannerList: '图片列表',
|
||||||
|
platform: '平台管理',
|
||||||
|
platformList: '产品优势列表',
|
||||||
|
tagList: '标签列表',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { GiftOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'activities',
|
name: 'activities',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: GiftOutlined,
|
||||||
title: '活动管理',
|
title: '活动管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { PayCircleOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'balance',
|
name: 'balance',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: PayCircleOutlined,
|
||||||
title: '余额管理',
|
title: '余额管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { AuditOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'certification',
|
name: 'certification',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-liushui',
|
icon: AuditOutlined,
|
||||||
title: '认证管理',
|
title: '认证管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { PrinterOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'bannerMgt',
|
name: 'bannerMgt',
|
||||||
component: 'bannerMgt/index.vue',
|
component: 'bannerMgt/index.vue',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-banner',
|
icon: PrinterOutlined,
|
||||||
title: '轮播图管理',
|
title: '轮播图管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { ApartmentOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'computing',
|
name: 'computing',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: ApartmentOutlined,
|
||||||
title: '算力管理',
|
title: '算力管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { PushpinOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'computingPoints',
|
name: 'computingPoints',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: PushpinOutlined,
|
||||||
title: '算力点管理',
|
title: '算力点管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { WalletOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'computingTicket',
|
name: 'computingTicket',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: WalletOutlined,
|
||||||
title: '算力券管理',
|
title: '算力券管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { DatabaseOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'container',
|
name: 'container',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: DatabaseOutlined,
|
||||||
title: '容器/实例管理',
|
title: '容器/实例管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { PrinterOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'contract',
|
name: 'contract',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-chongzhi',
|
icon: PrinterOutlined,
|
||||||
title: '提现管理',
|
title: '提现管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { ProfileOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'exchangeRecord',
|
name: 'exchangeRecord',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: ProfileOutlined,
|
||||||
title: '算力兑换记录管理',
|
title: '算力兑换记录管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { FileImageOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'img',
|
name: 'img',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: FileImageOutlined,
|
||||||
title: '镜像管理',
|
title: '镜像管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import invoice from './invoice'
|
|||||||
import activities from './activities'
|
import activities from './activities'
|
||||||
import systemSettings from './systemSettings'
|
import systemSettings from './systemSettings'
|
||||||
import bannerMgt from './bannerMgt'
|
import bannerMgt from './bannerMgt'
|
||||||
|
import platform from './platform'
|
||||||
export default [
|
export default [
|
||||||
...home,
|
...home,
|
||||||
...form,
|
...form,
|
||||||
@ -65,4 +66,5 @@ export default [
|
|||||||
...activities,
|
...activities,
|
||||||
...systemSettings,
|
...systemSettings,
|
||||||
...bannerMgt,
|
...bannerMgt,
|
||||||
|
...platform,
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { ProjectOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'invoice',
|
name: 'invoice',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: ProjectOutlined,
|
||||||
title: '发票管理',
|
title: '发票管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { FileTextOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'order',
|
name: 'order',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: FileTextOutlined,
|
||||||
title: '实例订单管理',
|
title: '实例订单管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
52
src/router/routes/platform.js
Normal file
52
src/router/routes/platform.js
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import { BarsOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{
|
||||||
|
path: 'platform',
|
||||||
|
name: 'platform',
|
||||||
|
component: 'RouteViewLayout',
|
||||||
|
meta: {
|
||||||
|
icon: BarsOutlined,
|
||||||
|
title: '平台管理',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'platformList',
|
||||||
|
name: 'platformList',
|
||||||
|
component: 'platform/platformList/index.vue',
|
||||||
|
meta: {
|
||||||
|
title: '产品优势列表',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'bannerList',
|
||||||
|
name: 'bannerList',
|
||||||
|
component: 'platform/bannerList/index.vue',
|
||||||
|
meta: {
|
||||||
|
title: '图片列表',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'tagList',
|
||||||
|
name: 'tagList',
|
||||||
|
component: 'platform/tagList/index.vue',
|
||||||
|
meta: {
|
||||||
|
title: '标签列表',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { DesktopOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'resource',
|
name: 'resource',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: DesktopOutlined,
|
||||||
title: 'GPU资源管理',
|
title: 'GPU资源管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { CommentOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'systemSettings',
|
name: 'systemSettings',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: CommentOutlined,
|
||||||
title: '短息、支付参数设置',
|
title: '短息、支付参数设置',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { SettingOutlined } from '@ant-design/icons-vue'
|
import { TeamOutlined } from '@ant-design/icons-vue'
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@ -6,7 +6,7 @@ export default [
|
|||||||
name: 'userControl',
|
name: 'userControl',
|
||||||
component: 'RouteViewLayout',
|
component: 'RouteViewLayout',
|
||||||
meta: {
|
meta: {
|
||||||
icon: 'icon-zhifudingjin',
|
icon: TeamOutlined,
|
||||||
title: '用户管理',
|
title: '用户管理',
|
||||||
isMenu: true,
|
isMenu: true,
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
|||||||
158
src/views/platform/bannerList/components/EditDialog.vue
Normal file
158
src/views/platform/bannerList/components/EditDialog.vue
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
<template>
|
||||||
|
<a-modal :open="modal.open" :title="modal.title" :width="640" :confirm-loading="modal.confirmLoading"
|
||||||
|
:after-close="onAfterClose" :cancel-text="cancelText" :ok-text="okText" @ok="handleOk" @cancel="handleCancel">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="$t('pages.system.role.form.name')" name="name">
|
||||||
|
<a-input v-model:value="formData.name"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="$t('pages.system.role.form.sequence')" name="sequence">
|
||||||
|
<a-input :defaultValue="0" type="number" v-model:value="formData.sequence"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="$t('pages.system.role.form.status')" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status" :options="[
|
||||||
|
{ label: $t('pages.system.role.form.status.enabled'), value: 'enabled' },
|
||||||
|
{ label: $t('pages.system.role.form.status.disabled'), value: 'disabled' },
|
||||||
|
]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'描述'">
|
||||||
|
<a-textarea v-model:value="formData.description"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'上传图片'" name="permissions">
|
||||||
|
<GxUpload :fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal } from '@/hooks'
|
||||||
|
import GxUpload from '@/components/GxUpload/index.vue'
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
formData.value.enabled='enabled'
|
||||||
|
formRules.value = {
|
||||||
|
name: { required: true, message: t('pages.system.role.form.name.placeholder') },
|
||||||
|
code: { required: true, message: t('pages.system.role.form.code.placeholder') },
|
||||||
|
status: { required: true, message: t('pages.system.role.form.status.placeholder') },
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
title: t('pages.system.role.add'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: t('pages.system.role.edit'),
|
||||||
|
})
|
||||||
|
|
||||||
|
const { data, success } = await apis.role.getRole(record.id).catch()
|
||||||
|
if (!success) {
|
||||||
|
message.error(t('component.message.error.save'))
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let menus = []
|
||||||
|
if (data.menus) {
|
||||||
|
for (let item of data.menus) {
|
||||||
|
menus.push(item.menu_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkedKeys.value = menus
|
||||||
|
formRecord.value = data
|
||||||
|
formData.value = cloneDeep(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
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.banner.createBanner(params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
result = await apis.banner.updateBanner(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
211
src/views/platform/bannerList/index.vue
Normal file
211
src/views/platform/bannerList/index.vue
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
<template>
|
||||||
|
<x-search-bar class="mb-8-2">
|
||||||
|
<template #default="{ gutter, colSpan }">
|
||||||
|
<a-form :model="searchFormData" layout="inline">
|
||||||
|
<a-row :gutter="gutter">
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item :label="$t('pages.system.role.form.name')" name="name">
|
||||||
|
<a-input :placeholder="$t('pages.system.role.form.code.placeholder')"
|
||||||
|
v-model:value="searchFormData.name"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col class="align-right" v-bind="colSpan">
|
||||||
|
<a-space>
|
||||||
|
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||||
|
<a-button ghost type="primary" @click="handleSearch">
|
||||||
|
{{ $t('button.search') }}
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</x-search-bar>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined></plus-outlined>
|
||||||
|
</template>
|
||||||
|
添加图片
|
||||||
|
</a-button>
|
||||||
|
</x-action-bar>
|
||||||
|
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
|
||||||
|
:scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'banner_type' === column.key">
|
||||||
|
<!--状态-->
|
||||||
|
<a-tag v-if="record.banner_type == 1" color="processing">
|
||||||
|
首页轮播图
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<template v-if="'createAt' === column.key">
|
||||||
|
{{ formatUtcDateTime(record.created_at) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<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)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ $t('pages.system.delete') }}</template>
|
||||||
|
<delete-outlined style="color: #ff4d4f" />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { formatUtcDateTime } from '@/utils/util'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { statusTypeEnum } from '@/enums/system'
|
||||||
|
import { usePagination, useForm } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'systemRole',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '缩略图', dataIndex: 'code', width: 200 },
|
||||||
|
{ title: '名称', dataIndex: 'name', width: 150 },
|
||||||
|
{ title: '类型', dataIndex: 'banner_type', key: 'banner_type', width: 150 },
|
||||||
|
{ title: t('pages.system.role.form.created_at'), key: 'createAt', fixed: 'right', width: 120 },
|
||||||
|
{ title: '是否启用', key: 'is_recommend', fixed: 'is_recommend', width: 120 },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 120 },
|
||||||
|
]
|
||||||
|
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } =
|
||||||
|
usePagination()
|
||||||
|
const { resetForm } = useForm()
|
||||||
|
const editDialogRef = ref()
|
||||||
|
|
||||||
|
getPageList()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { data, total } = await apis.banner
|
||||||
|
.getBannerList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
...searchFormData.value,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (data.length > 0) {
|
||||||
|
listData.value = data
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除
|
||||||
|
*/
|
||||||
|
function handleRemove({ id }) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('pages.system.role.delTip'),
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.role.delRole(id).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success(t('component.message.success.delete'))
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
resetForm()
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
119
src/views/platform/platformList/components/EditDialog.vue
Normal file
119
src/views/platform/platformList/components/EditDialog.vue
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<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>
|
||||||
231
src/views/platform/platformList/index.vue
Normal file
231
src/views/platform/platformList/index.vue
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
<template>
|
||||||
|
<x-search-bar class="mb-8-2">
|
||||||
|
<template #default="{ gutter, colSpan }">
|
||||||
|
<a-form :model="searchFormData" layout="inline">
|
||||||
|
<a-row :gutter="gutter">
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item :label="'用户名'" name="userName">
|
||||||
|
<a-input :placeholder="'请输入用户名'" v-model:value="searchFormData.userName"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item :label="'用户联系方式'" name="phone">
|
||||||
|
<a-input :placeholder="'请输入用户联系方式'" v-model:value="searchFormData.phone"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col class="align-right" v-bind="colSpan">
|
||||||
|
<a-space>
|
||||||
|
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||||
|
<a-button ghost type="primary" @click="handleSearch">
|
||||||
|
{{ $t('button.search') }}
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</x-search-bar>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<!-- <a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined></plus-outlined>
|
||||||
|
</template>
|
||||||
|
添加图片
|
||||||
|
</a-button> -->
|
||||||
|
</x-action-bar>
|
||||||
|
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
|
||||||
|
:scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'banner_type' === column.key">
|
||||||
|
<!--状态-->
|
||||||
|
<a-tag v-if="record.banner_type == 1" color="processing">
|
||||||
|
首页轮播图
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<template v-if="'createAt' === column.key">
|
||||||
|
{{ formatUtcDateTime(record.created_at) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<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)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ $t('pages.system.delete') }}</template>
|
||||||
|
<delete-outlined style="color: #ff4d4f" />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { formatUtcDateTime } from '@/utils/util'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { statusTypeEnum } from '@/enums/system'
|
||||||
|
import { usePagination, useForm } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { disabledDict, authenticationTypeDict } from '@/enums/dict'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'systemRole',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '用户姓名', dataIndex: 'customerName', width: 200 },
|
||||||
|
{ title: '用户联系方式', dataIndex: 'phone', width: 150 },
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
width: 150,
|
||||||
|
customRender: ({ text }) => disabledDict.getLabel(text) || text,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '账号类型',
|
||||||
|
key: 'accountType',
|
||||||
|
dataIndex: 'accountType',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ text }) => authenticationTypeDict.getLabel(text) || text,
|
||||||
|
},
|
||||||
|
{ title: '拉黑时间', key: 'blackTime', dataIndex: 'blackTime', width: 160 },
|
||||||
|
{ title: '解除时间', key: 'unblackTime', dataIndex: 'unblackTime', width: 160 },
|
||||||
|
{ title: '拉黑原因', key: 'blacklistReason', dataIndex: 'blacklistReason', width: 220 },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 120 },
|
||||||
|
]
|
||||||
|
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } =
|
||||||
|
usePagination()
|
||||||
|
const { resetForm } = useForm()
|
||||||
|
const editDialogRef = ref()
|
||||||
|
|
||||||
|
getPageList()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { data, total } = await apis.userControl
|
||||||
|
.getBlackCustomersList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
...searchFormData.value,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (data.length > 0) {
|
||||||
|
listData.value = data
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除
|
||||||
|
*/
|
||||||
|
function handleRemove({ id }) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('pages.system.role.delTip'),
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.role.delRole(id).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success(t('component.message.success.delete'))
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
// resetForm()
|
||||||
|
// resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
119
src/views/platform/tagList/components/EditDialog.vue
Normal file
119
src/views/platform/tagList/components/EditDialog.vue
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<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>
|
||||||
231
src/views/platform/tagList/index.vue
Normal file
231
src/views/platform/tagList/index.vue
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
<template>
|
||||||
|
<x-search-bar class="mb-8-2">
|
||||||
|
<template #default="{ gutter, colSpan }">
|
||||||
|
<a-form :model="searchFormData" layout="inline">
|
||||||
|
<a-row :gutter="gutter">
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item :label="'用户名'" name="userName">
|
||||||
|
<a-input :placeholder="'请输入用户名'" v-model:value="searchFormData.userName"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
|
||||||
|
<a-col v-bind="colSpan">
|
||||||
|
<a-form-item :label="'用户联系方式'" name="phone">
|
||||||
|
<a-input :placeholder="'请输入用户联系方式'" v-model:value="searchFormData.phone"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col class="align-right" v-bind="colSpan">
|
||||||
|
<a-space>
|
||||||
|
<a-button @click="handleResetSearch">{{ $t('button.reset') }}</a-button>
|
||||||
|
<a-button ghost type="primary" @click="handleSearch">
|
||||||
|
{{ $t('button.search') }}
|
||||||
|
</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</x-search-bar>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<!-- <a-button v-action="'add'" type="primary" @click="$refs.editDialogRef.handleCreate()">
|
||||||
|
<template #icon>
|
||||||
|
<plus-outlined></plus-outlined>
|
||||||
|
</template>
|
||||||
|
添加图片
|
||||||
|
</a-button> -->
|
||||||
|
</x-action-bar>
|
||||||
|
<a-table :columns="columns" :data-source="listData" :loading="loading" :pagination="paginationState"
|
||||||
|
:scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'banner_type' === column.key">
|
||||||
|
<!--状态-->
|
||||||
|
<a-tag v-if="record.banner_type == 1" color="processing">
|
||||||
|
首页轮播图
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<template v-if="'createAt' === column.key">
|
||||||
|
{{ formatUtcDateTime(record.created_at) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<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)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ $t('pages.system.delete') }}</template>
|
||||||
|
<delete-outlined style="color: #ff4d4f" />
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</a-table>
|
||||||
|
</a-card>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
|
||||||
|
<edit-dialog ref="editDialogRef" @ok="onOk"></edit-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { message, Modal } from 'ant-design-vue'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { formatUtcDateTime } from '@/utils/util'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import { statusTypeEnum } from '@/enums/system'
|
||||||
|
import { usePagination, useForm } from '@/hooks'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { disabledDict, authenticationTypeDict } from '@/enums/dict'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'systemRole',
|
||||||
|
})
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '用户姓名', dataIndex: 'customerName', width: 200 },
|
||||||
|
{ title: '用户联系方式', dataIndex: 'phone', width: 150 },
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
dataIndex: 'status',
|
||||||
|
key: 'status',
|
||||||
|
width: 150,
|
||||||
|
customRender: ({ text }) => disabledDict.getLabel(text) || text,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '账号类型',
|
||||||
|
key: 'accountType',
|
||||||
|
dataIndex: 'accountType',
|
||||||
|
width: 120,
|
||||||
|
customRender: ({ text }) => authenticationTypeDict.getLabel(text) || text,
|
||||||
|
},
|
||||||
|
{ title: '拉黑时间', key: 'blackTime', dataIndex: 'blackTime', width: 160 },
|
||||||
|
{ title: '解除时间', key: 'unblackTime', dataIndex: 'unblackTime', width: 160 },
|
||||||
|
{ title: '拉黑原因', key: 'blacklistReason', dataIndex: 'blacklistReason', width: 220 },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 120 },
|
||||||
|
]
|
||||||
|
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, searchFormData, resetPagination } =
|
||||||
|
usePagination()
|
||||||
|
const { resetForm } = useForm()
|
||||||
|
const editDialogRef = ref()
|
||||||
|
|
||||||
|
getPageList()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { data, total } = await apis.userControl
|
||||||
|
.getBlackCustomersList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
...searchFormData.value,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (data.length > 0) {
|
||||||
|
listData.value = data
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除
|
||||||
|
*/
|
||||||
|
function handleRemove({ id }) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('pages.system.role.delTip'),
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.role.delRole(id).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
resolve()
|
||||||
|
message.success(t('component.message.success.delete'))
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
|
function onTableChange({ current, pageSize }) {
|
||||||
|
paginationState.current = current
|
||||||
|
paginationState.pageSize = pageSize
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索
|
||||||
|
*/
|
||||||
|
function handleSearch() {
|
||||||
|
// resetForm()
|
||||||
|
// resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
Loading…
x
Reference in New Issue
Block a user