generated from Leo_Ding/web-template
111
This commit is contained in:
parent
8c23f026c9
commit
ef675c136e
14
src/apis/modules/aiRequest.js
Normal file
14
src/apis/modules/aiRequest.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* 图片管理接口
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
// 获取菜单列表
|
||||||
|
export const getDataList = (params) => request.basic.get('/api/v1/ai-requests', params)
|
||||||
|
// 获取菜单条数据
|
||||||
|
export const getMenu = (id) => request.basic.get(`/api/v1/ai-requests/${id}`)
|
||||||
|
// 添加菜单
|
||||||
|
export const createMenu = (params) => request.basic.post('/api/v1/ai-requests', params)
|
||||||
|
// 更新菜单
|
||||||
|
export const updateMenu = (id, params) => request.basic.put(`/api/v1/ai-requests/${id}`, params)
|
||||||
|
// 删除菜单
|
||||||
|
export const delMenu = (id) => request.basic.delete(`/api/v1/ai-requests/${id}`)
|
||||||
@ -1,8 +1,8 @@
|
|||||||
@font-face {
|
@font-face {
|
||||||
font-family: "iconfont"; /* Project id 4966438 */
|
font-family: "iconfont"; /* Project id 4966438 */
|
||||||
src: url('iconfont.woff2?t=1752205287294') format('woff2'),
|
src: url('iconfont.woff2?t=1753153732187') format('woff2'),
|
||||||
url('iconfont.woff?t=1752205287294') format('woff'),
|
url('iconfont.woff?t=1753153732187') format('woff'),
|
||||||
url('iconfont.ttf?t=1752205287294') format('truetype');
|
url('iconfont.ttf?t=1753153732187') format('truetype');
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconfont {
|
.iconfont {
|
||||||
@ -13,6 +13,10 @@
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-rengongzhinengbeifen:before {
|
||||||
|
content: "\e6b9";
|
||||||
|
}
|
||||||
|
|
||||||
.icon-yonghu:before {
|
.icon-yonghu:before {
|
||||||
content: "\e616";
|
content: "\e616";
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -5,6 +5,13 @@
|
|||||||
"css_prefix_text": "icon-",
|
"css_prefix_text": "icon-",
|
||||||
"description": "",
|
"description": "",
|
||||||
"glyphs": [
|
"glyphs": [
|
||||||
|
{
|
||||||
|
"icon_id": "24669053",
|
||||||
|
"name": "人工智能",
|
||||||
|
"font_class": "rengongzhinengbeifen",
|
||||||
|
"unicode": "e6b9",
|
||||||
|
"unicode_decimal": 59065
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"icon_id": "5270862",
|
"icon_id": "5270862",
|
||||||
"name": "用户群体-业务查询",
|
"name": "用户群体-业务查询",
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -68,4 +68,11 @@ const homeStatus = new EnumManager([
|
|||||||
// { value: 98, name: '禁用', color: '#bfbfbf' }, // 灰色(失效色)
|
// { value: 98, name: '禁用', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
])
|
])
|
||||||
export {activatyStatus,enumsStatus,orderStatus,announcementStatus,nbdMutualStatus,workTypeStatus,mettingStatus,userStatus,storeStatus,homeStatus}
|
//门店列表类型状态
|
||||||
|
const aiStatus = new EnumManager([
|
||||||
|
{ value: 1, name: '待审核', color: '#faad14' }, // 黄色(警告色)
|
||||||
|
{ value: 2, name: '启用', color: '#52c41a' }, // 绿色(进行中)
|
||||||
|
// { value: 98, name: '禁用', color: '#bfbfbf' }, // 灰色(失效色)
|
||||||
|
{ value: 99, name: '审核不通过', color: '#ff4d4f' } // 红色(错误色)
|
||||||
|
])
|
||||||
|
export {activatyStatus,enumsStatus,orderStatus,announcementStatus,nbdMutualStatus,workTypeStatus,mettingStatus,userStatus,storeStatus,homeStatus,aiStatus}
|
||||||
@ -48,5 +48,6 @@ export default {
|
|||||||
mettingMgt:'会议室管理',
|
mettingMgt:'会议室管理',
|
||||||
mettingRoom:'会议室列表',
|
mettingRoom:'会议室列表',
|
||||||
mettingYuYue:'预约记录',
|
mettingYuYue:'预约记录',
|
||||||
customer:'用户管理'
|
customer:'用户管理',
|
||||||
|
aiHelper:'AI助手'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,18 @@ export default [
|
|||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
permission: '*',
|
permission: '*',
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'aiHelper/index',
|
||||||
|
name: 'aiHelper',
|
||||||
|
component: 'pages/aiHelper/index.vue',
|
||||||
|
meta: {
|
||||||
|
icon: 'icon-rengongzhinengbeifen',
|
||||||
|
title: 'ai助手',
|
||||||
|
isMenu: true,
|
||||||
|
keepAlive: true,
|
||||||
|
permission: '*',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'activity/index',
|
path: 'activity/index',
|
||||||
|
|||||||
227
src/views/pages/aiHelper/components/EditDialog.vue
Normal file
227
src/views/pages/aiHelper/components/EditDialog.vue
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
<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-spin :spinning="spining">
|
||||||
|
<a-form ref="formRef" :model="formData" :rules="formRules">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-row :gutter="12">
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'名称'" name="name">
|
||||||
|
<a-input :placeholder="'请输入名称'" v-model:value="formData.name"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'描述'" name="description">
|
||||||
|
<a-input :placeholder="'请输入描述'" v-model:value="formData.description"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'服务地址'" name="serviceUrl">
|
||||||
|
<a-input :placeholder="'请输入服务地址'" v-model:value="formData.serviceUrl"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'apiKey'" name="apiKey">
|
||||||
|
<a-input :placeholder="'请输入apiKey'" v-model:value="formData.apiKey"></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'顺序'" name="sequence">
|
||||||
|
<a-input-number :placeholder="'请输入顺序'" v-model:value="formData.sequence"
|
||||||
|
style="width: 100%;"></a-input-number>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item :label="'状态'" name="status">
|
||||||
|
<a-radio-group v-model:value="formData.status" :options="aiStatus.getAll()"
|
||||||
|
disabled></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item :label="'封面'" name="imagePath">
|
||||||
|
<gx-upload v-model="formData.imagePath" :fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item :label="'头像'" name="icon">
|
||||||
|
<gx-upload v-model="formData.icon" :fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="8">
|
||||||
|
<a-form-item :label="'背景图'" name="background">
|
||||||
|
<gx-upload v-model="formData.background" :fileNumber="1" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</a-form>
|
||||||
|
</a-spin>
|
||||||
|
</a-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { cloneDeep } from 'lodash-es'
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import { config } from '@/config'
|
||||||
|
import apis from '@/apis'
|
||||||
|
import { useForm, useModal, useSpining } from '@/hooks'
|
||||||
|
import { message } from 'ant-design-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
import { createMenu, getMenu, updateMenu } from '@/apis/modules/aiRequest'
|
||||||
|
import { spliceUrl } from '@/utils/util'
|
||||||
|
import { aiStatus } from '@/enums/index.js'
|
||||||
|
const emit = defineEmits(['ok'])
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
|
const { formRecord, formData, formRef, formRules, resetForm } = useForm()
|
||||||
|
const { spining, showSpining, hideSpining } = useSpining()
|
||||||
|
const cancelText = ref(t('button.cancel'))
|
||||||
|
const okText = ref(t('button.confirm'))
|
||||||
|
const rolesValue = ref([])
|
||||||
|
const roles = ref([])
|
||||||
|
const img = ref('')
|
||||||
|
|
||||||
|
formRules.value = {
|
||||||
|
name: { required: true, message: '请输入名称' },
|
||||||
|
description:{required: true, message: '请输入描述'},
|
||||||
|
serviceUrl:{required: true, message: '请输入服务地址'},
|
||||||
|
apiKey:{required: true, message: '请输入描述'},
|
||||||
|
description:{required: true, message: '请输入描述'},
|
||||||
|
status: [{ required: true, message: '请选择状态', trigger: 'change' }],
|
||||||
|
sequence: [{ required: true, message: '请选择顺序', trigger: 'change' }],
|
||||||
|
imagePath: [{ required: true, message: '请上传图片', trigger: 'change' }],
|
||||||
|
icon: [{ required: true, message: '请上传图片', trigger: 'change' }],
|
||||||
|
background: [{ required: true, message: '请上传图片', trigger: 'change' }],
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新建
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
showModal({
|
||||||
|
type: 'create',
|
||||||
|
// 80对应about
|
||||||
|
title: '添加',
|
||||||
|
})
|
||||||
|
formData.value.status = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
async function handleEdit(record = {}) {
|
||||||
|
showModal({
|
||||||
|
type: 'edit',
|
||||||
|
title: t('pages.system.user.edit'),
|
||||||
|
})
|
||||||
|
showSpining()
|
||||||
|
const { data, success } = await apis.aiRequest.getMenu(record.id).catch()
|
||||||
|
if (!success) {
|
||||||
|
hideModal()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
hideSpining()
|
||||||
|
formData.value = { ...data }
|
||||||
|
formData.value.imagePath = [config('http.apiBasic') + data.imagePath]
|
||||||
|
formData.value.icon = [config('http.apiBasic') + data.icon]
|
||||||
|
formData.value.background = [config('http.apiBasic') + data.background]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
formRef.value.validateFields().then(async (values) => {
|
||||||
|
console.log(values)
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const params = {
|
||||||
|
...values,
|
||||||
|
imagePath: spliceUrl(formData.value?.imagePath[0]),
|
||||||
|
icon: spliceUrl(formData.value?.icon[0]),
|
||||||
|
background: spliceUrl(formData.value?.background[0]),
|
||||||
|
scene: 1,
|
||||||
|
status: 1
|
||||||
|
}
|
||||||
|
let result = null
|
||||||
|
switch (modal.value.type) {
|
||||||
|
case 'create':
|
||||||
|
result = await apis.aiRequest.createMenu(params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
case 'edit':
|
||||||
|
// result = await apis.aiRequest.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
result = await apis.aiRequest.updateMenu(formData.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
break
|
||||||
|
}
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
hideModal()
|
||||||
|
emit('ok')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
hideLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对权限组 过数据格式
|
||||||
|
*/
|
||||||
|
function formatArr(data, type = '') {
|
||||||
|
const rolesArr = []
|
||||||
|
data.forEach((item) => {
|
||||||
|
roles.value.forEach((r) => {
|
||||||
|
if (type === 'edit') {
|
||||||
|
if (item.role_id === r.value) {
|
||||||
|
rolesArr.push({
|
||||||
|
value: item.role_id,
|
||||||
|
label: r.label,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else if (r.value === item) {
|
||||||
|
rolesArr.push({
|
||||||
|
role_id: item,
|
||||||
|
role_name: r.label,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return rolesArr
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
img.value = ''
|
||||||
|
hideModal()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭后
|
||||||
|
*/
|
||||||
|
function onAfterClose() {
|
||||||
|
resetForm()
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
handleCreate,
|
||||||
|
handleEdit,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
221
src/views/pages/aiHelper/index.vue
Normal file
221
src/views/pages/aiHelper/index.vue
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
<template>
|
||||||
|
<a-row :gutter="8" :wrap="false">
|
||||||
|
<a-col flex="auto">
|
||||||
|
<a-card type="flex">
|
||||||
|
<x-action-bar class="mb-8-2">
|
||||||
|
<a-button 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" bordered="true" :loading="loading"
|
||||||
|
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||||
|
<template #bodyCell="{ column, record }">
|
||||||
|
<template v-if="'imagePath' === column.dataIndex">
|
||||||
|
<a-image :width="60"
|
||||||
|
:src="record.imagePath ? config('http.apiBasic') + record.imagePath : errImg" />
|
||||||
|
</template>
|
||||||
|
<template v-if="'icon' === column.dataIndex">
|
||||||
|
<a-image :width="60" :src="record.icon ? config('http.apiBasic') + record.icon : errImg" />
|
||||||
|
</template>
|
||||||
|
<template v-if="'background' === column.dataIndex">
|
||||||
|
<a-image :width="60"
|
||||||
|
:src="record.background ? config('http.apiBasic') + record.background : errImg" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-if="'status' === column.dataIndex">
|
||||||
|
<a-tag :color="aiStatus.getColor(record.status)">{{ aiStatus.getName(record.status)
|
||||||
|
}}</a-tag>
|
||||||
|
</template>
|
||||||
|
<template v-if="'action' === column.key">
|
||||||
|
<x-action-button @click="$refs.editDialogRef.handleEdit(record)">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ $t('pages.system.user.edit') }}</template>
|
||||||
|
<edit-outlined /> </a-tooltip></x-action-button>
|
||||||
|
<x-action-button @click="auditHandleEdit(record, 'audit')" v-if="record.status === 1">
|
||||||
|
<a-tooltip>
|
||||||
|
<template #title> {{ '审核' }}</template>
|
||||||
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
||||||
|
</a-tooltip>
|
||||||
|
</x-action-button>
|
||||||
|
<x-action-button @click="handleDelete(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>
|
||||||
|
<a-modal :open="open" :title="'审核'" :width="640" title="审核" ok-text="确认" cancel-text="取消" @ok="handleAuditEdit"
|
||||||
|
@cancel="open = false">
|
||||||
|
<a-card class="mb-8-2">
|
||||||
|
<a-form-item :label="'审核'" name="">
|
||||||
|
<a-radio-group v-model:value="auditStatus"
|
||||||
|
:options="[{ value: 2, label: '通过' }, { value: 99, label: '不通过' }]"></a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item :label="'备注'" name="">
|
||||||
|
<a-textarea v-model:value="remark"></a-textarea>
|
||||||
|
</a-form-item>
|
||||||
|
</a-card>
|
||||||
|
</a-modal>
|
||||||
|
<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 { statusUserTypeEnum } from '@/enums/system'
|
||||||
|
import { usePagination } from '@/hooks'
|
||||||
|
import errImg from '@/assets/blankSpace.png'
|
||||||
|
import EditDialog from './components/EditDialog.vue'
|
||||||
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||||
|
import { useI18n } from 'vue-i18n'
|
||||||
|
import { delMenu, getDataList } from '@/apis/modules/aiRequest'
|
||||||
|
import { aiStatus } from '@/enums/index.js'
|
||||||
|
defineOptions({
|
||||||
|
name: 'ai_helper',
|
||||||
|
})
|
||||||
|
const currentForm = ref({})
|
||||||
|
const open = ref(false)
|
||||||
|
const auditStatus = ref(2)
|
||||||
|
const remark = ref('')
|
||||||
|
const { t } = useI18n() // 解构出t方法
|
||||||
|
const columns = [
|
||||||
|
{ title: '名称', dataIndex: 'name', key: 'name' },
|
||||||
|
{ title: '描述', dataIndex: 'description', key: 'description' },
|
||||||
|
{ title: '封面', dataIndex: 'imagePath', width: 100, align: 'center' },
|
||||||
|
{ title: '头像', dataIndex: 'icon', width: 100, align: 'center' },
|
||||||
|
{ title: '背景图', dataIndex: 'background', align: 'center' },
|
||||||
|
{ title: '服务地址', dataIndex: 'serviceUrl', align: 'center' },
|
||||||
|
{ title: 'APIKKEY', dataIndex: 'apiKey', align: 'center' },
|
||||||
|
{ title: '状态', dataIndex: 'status', width: 120, align: 'center' },
|
||||||
|
// { title: '备注', dataIndex: 'remark', align: 'center' },
|
||||||
|
{ title: '顺序', dataIndex: 'sequence', width: 100, align: 'center' },
|
||||||
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 140, align: 'center' },
|
||||||
|
]
|
||||||
|
|
||||||
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
||||||
|
|
||||||
|
const editDialogRef = ref()
|
||||||
|
getPageList()
|
||||||
|
/**
|
||||||
|
* 获取用户列表
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
|
||||||
|
async function getPageList() {
|
||||||
|
try {
|
||||||
|
showLoading()
|
||||||
|
const { pageSize, current } = paginationState
|
||||||
|
const { success, data, total } = await apis.aiRequest
|
||||||
|
.getDataList({
|
||||||
|
pageSize,
|
||||||
|
current: current,
|
||||||
|
scene: 1,
|
||||||
|
...searchFormData.value,
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
if (config('http.code.success') === success) {
|
||||||
|
//筛选type的值80对应about
|
||||||
|
listData.value = data
|
||||||
|
paginationState.total = total
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
hideLoading()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const auditHandleEdit = (params) => {
|
||||||
|
currentForm.value = params
|
||||||
|
open.value = true
|
||||||
|
}
|
||||||
|
const handleAuditEdit = async () => {
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
...currentForm.value,
|
||||||
|
status: auditStatus.value,
|
||||||
|
remark: remark.value
|
||||||
|
}
|
||||||
|
const result = await apis.aiRequest.updateMenu(currentForm.value.id, params).catch(() => {
|
||||||
|
throw new Error()
|
||||||
|
})
|
||||||
|
if (config('http.code.success') === result?.success) {
|
||||||
|
getPageList()
|
||||||
|
open.value = false
|
||||||
|
message.success('审核成功')
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
message.error(error.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
function handleDelete({ id }) {
|
||||||
|
Modal.confirm({
|
||||||
|
title: t('pages.system.user.delTip'),
|
||||||
|
content: t('button.confirm'),
|
||||||
|
okText: t('button.confirm'),
|
||||||
|
onOk: () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
; (async () => {
|
||||||
|
try {
|
||||||
|
const { success } = await apis.aiRequest.delMenu(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 handleSearch() {
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function handleResetSearch() {
|
||||||
|
searchFormData.value = {}
|
||||||
|
resetPagination()
|
||||||
|
getPageList()
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 编辑完成
|
||||||
|
*/
|
||||||
|
async function onOk() {
|
||||||
|
await getPageList()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
||||||
Loading…
x
Reference in New Issue
Block a user