vxe回返bug
This commit is contained in:
parent
12c5116dfd
commit
f1e801e9ad
@ -115,7 +115,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
children: [
|
||||
{
|
||||
path: 'type/data/:dictType',
|
||||
component: () => import('@/views/system/dict/data.vue'),
|
||||
component: () => import('@/views/system/dict/index.vue'),
|
||||
name: 'data',
|
||||
meta: {
|
||||
title: '字典数据',
|
||||
@ -123,7 +123,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
hidden: true,
|
||||
canTo: true,
|
||||
icon: '',
|
||||
activeMenu: 'system/dict/data'
|
||||
activeMenu: 'system/dict/index'
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -162,7 +162,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
|
||||
children: [
|
||||
{
|
||||
path: 'job-log',
|
||||
component: () => import('@/views/infra/job/logger/index.vue'),
|
||||
component: () => import('@/views/infra/job/JobLog.vue'),
|
||||
name: 'JobLog',
|
||||
meta: {
|
||||
noCache: true,
|
||||
|
@ -62,7 +62,7 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||
import { CommonStatusEnum } from '@/utils/constants'
|
||||
import * as FormApi from '@/api/bpm/form'
|
||||
import { encodeConf, encodeFields, setConfAndFields } from '@/utils/formCreate'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
// import { useClipboard } from '@vueuse/core'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息
|
||||
|
@ -22,7 +22,7 @@ import { rules, allSchemas } from './leave.data'
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { push } = useRouter() // 路由
|
||||
|
||||
// const { query } = useRoute()
|
||||
// 表单参数
|
||||
const actionLoading = ref(false) // 按钮 Loading
|
||||
const formRef = ref<FormExpose>() // 表单 Ref
|
||||
@ -43,6 +43,8 @@ const submitForm = async () => {
|
||||
// data.endTime = XEUtils.toDateString(data.endTime, 'yyyy-MM-dd HH:mm:ss')
|
||||
data.startTime = Date.parse(new Date(data.startTime).toString()).toString()
|
||||
data.endTime = Date.parse(new Date(data.endTime).toString()).toString()
|
||||
// console.log(query.id, 'query.id')
|
||||
// data.id = query.id
|
||||
// 添加的提交
|
||||
await LeaveApi.createLeaveApi(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
|
@ -105,7 +105,10 @@ const handleSelect = async (row) => {
|
||||
// 情况二:业务表单
|
||||
} else if (row.formCustomCreatePath) {
|
||||
await router.push({
|
||||
path: row.formCustomCreatePath
|
||||
path: row.formCustomCreatePath,
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
})
|
||||
// 这里暂时无需加载流程图,因为跳出到另外个 Tab;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@
|
||||
show-checkbox
|
||||
:props="defaultProps"
|
||||
:data="deptTreeOptions"
|
||||
empty-text="加载中,请稍后"
|
||||
empty-text="加载中,请稍候"
|
||||
multiple
|
||||
/>
|
||||
</el-form-item>
|
||||
|
@ -32,7 +32,7 @@
|
||||
</template>
|
||||
<script setup lang="ts" name="Build">
|
||||
import formCreate from '@form-create/element-ui'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
// import { useClipboard } from '@vueuse/core'
|
||||
|
||||
const { t } = useI18n()
|
||||
const message = useMessage()
|
||||
|
@ -89,7 +89,7 @@ import type { UploadInstance, UploadRawFile, UploadProps, UploadFile } from 'ele
|
||||
import { allSchemas } from './fileList.data'
|
||||
import * as FileApi from '@/api/infra/fileList'
|
||||
import { getAccessToken, getTenantId } from '@/utils/auth'
|
||||
import { useClipboard } from '@vueuse/core'
|
||||
// import { useClipboard } from '@vueuse/core'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
157
src/views/mp/account/AccountForm.vue
Normal file
157
src/views/mp/account/AccountForm.vue
Normal file
@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<Dialog :title="modelTitle" v-model="modelVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="rules"
|
||||
label-width="120px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="微信号" prop="account">
|
||||
<template #label>
|
||||
<span>
|
||||
<el-tooltip
|
||||
content="在微信公众平台(mp.weixin.qq.com)的菜单 [设置与开发 - 公众号设置 - 账号详情] 中能找到「微信号」"
|
||||
placement="top"
|
||||
>
|
||||
<Icon icon="ep:question-filled" style="vertical-align: middle" />
|
||||
</el-tooltip>
|
||||
微信号
|
||||
</span>
|
||||
</template>
|
||||
<el-input v-model="formData.account" placeholder="请输入微信号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="appId" prop="appId">
|
||||
<template #label>
|
||||
<span>
|
||||
<el-tooltip
|
||||
content="在微信公众平台(mp.weixin.qq.com)的菜单 [设置与开发 - 公众号设置 - 基本设置] 中能找到「开发者ID(AppID)」"
|
||||
placement="top"
|
||||
>
|
||||
<Icon icon="ep:question-filled" style="vertical-align: middle" />
|
||||
</el-tooltip>
|
||||
appId
|
||||
</span>
|
||||
</template>
|
||||
<el-input v-model="formData.appId" placeholder="请输入公众号 appId" />
|
||||
</el-form-item>
|
||||
<el-form-item label="appSecret" prop="appSecret">
|
||||
<template #label>
|
||||
<span>
|
||||
<el-tooltip
|
||||
content="在微信公众平台(mp.weixin.qq.com)的菜单 [设置与开发 - 公众号设置 - 基本设置] 中能找到「开发者密码(AppSecret)」"
|
||||
placement="top"
|
||||
>
|
||||
<Icon icon="ep:question-filled" style="vertical-align: middle" />
|
||||
</el-tooltip>
|
||||
appSecret
|
||||
</span>
|
||||
</template>
|
||||
<el-input v-model="formData.appSecret" placeholder="请输入公众号 appSecret" />
|
||||
</el-form-item>
|
||||
<el-form-item label="token" prop="token">
|
||||
<el-input v-model="formData.token" placeholder="请输入公众号token" />
|
||||
</el-form-item>
|
||||
<el-form-item label="消息加解密密钥" prop="aesKey">
|
||||
<el-input v-model="formData.aesKey" placeholder="请输入消息加解密密钥" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" v-model="formData.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="modelVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import * as AccountApi from '@/api/mp/account'
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const modelVisible = ref(false) // 弹窗的是否展示
|
||||
const modelTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: '',
|
||||
account: '',
|
||||
appId: '',
|
||||
appSecret: '',
|
||||
token: '',
|
||||
aesKey: '',
|
||||
remark: ''
|
||||
})
|
||||
const rules = reactive({
|
||||
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
|
||||
account: [{ required: true, message: '公众号账号不能为空', trigger: 'blur' }],
|
||||
appId: [{ required: true, message: '公众号 appId 不能为空', trigger: 'blur' }],
|
||||
appSecret: [{ required: true, message: '公众号密钥不能为空', trigger: 'blur' }],
|
||||
token: [{ required: true, message: '公众号 token 不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
modelVisible.value = true
|
||||
modelTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await AccountApi.getAccount(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
if (!formRef) return
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value
|
||||
if (formType.value === 'create') {
|
||||
await AccountApi.createAccount(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await AccountApi.updateAccount(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
modelVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: '',
|
||||
account: '',
|
||||
appId: '',
|
||||
appSecret: '',
|
||||
token: '',
|
||||
aesKey: '',
|
||||
remark: ''
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
91
src/views/system/post/form.vue
Normal file
91
src/views/system/post/form.vue
Normal file
@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<!-- 弹窗 -->
|
||||
<XModal :title="modelTitle" :loading="modelLoading" v-model="modelVisible">
|
||||
<!-- 表单:添加/修改 -->
|
||||
<Form
|
||||
ref="formRef"
|
||||
v-if="['create', 'update'].includes(actionType)"
|
||||
:schema="allSchemas.formSchema"
|
||||
:rules="rules"
|
||||
/>
|
||||
<!-- 表单:详情 -->
|
||||
<Descriptions
|
||||
v-if="actionType === 'detail'"
|
||||
:schema="allSchemas.detailSchema"
|
||||
:data="detailData"
|
||||
/>
|
||||
<template #footer>
|
||||
<!-- 按钮:保存 -->
|
||||
<XButton
|
||||
v-if="['create', 'update'].includes(actionType)"
|
||||
type="primary"
|
||||
:title="t('action.save')"
|
||||
:loading="actionLoading"
|
||||
@click="submitForm()"
|
||||
/>
|
||||
<!-- 按钮:关闭 -->
|
||||
<XButton :loading="actionLoading" :title="t('dialog.close')" @click="modelVisible = false" />
|
||||
</template>
|
||||
</XModal>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import type { FormExpose } from '@/components/Form'
|
||||
import * as PostApi from '@/api/system/post'
|
||||
import { rules, allSchemas } from './post.data'
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
// 弹窗相关的变量
|
||||
const modelVisible = ref(false) // 是否显示弹出层
|
||||
const modelTitle = ref('') // 弹出层标题
|
||||
const modelLoading = ref(false) // 弹出层loading
|
||||
const actionType = ref('') // 操作按钮的类型
|
||||
const actionLoading = ref(false) // 按钮 Loading
|
||||
const formRef = ref<FormExpose>() // 表单 Ref
|
||||
const detailData = ref() // 详情 Ref
|
||||
|
||||
// 打开弹窗
|
||||
const openModal = async (type: string, id?: number) => {
|
||||
modelVisible.value = true
|
||||
modelLoading.value = true
|
||||
modelTitle.value = t('action.' + type)
|
||||
actionType.value = type
|
||||
// 设置数据
|
||||
if (id) {
|
||||
const res = await PostApi.getPostApi(id)
|
||||
if (type === 'update') {
|
||||
unref(formRef)?.setValues(res)
|
||||
} else if (type === 'detail') {
|
||||
detailData.value = res
|
||||
}
|
||||
}
|
||||
modelLoading.value = false
|
||||
}
|
||||
defineExpose({ openModal }) // 提供 openModal 方法,用于打开弹窗
|
||||
|
||||
// 提交新增/修改的表单
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
const elForm = unref(formRef)?.getElFormRef()
|
||||
if (!elForm) return
|
||||
const valid = await elForm.validate()
|
||||
if (!valid) return
|
||||
// 提交请求
|
||||
actionLoading.value = true
|
||||
try {
|
||||
const data = unref(formRef)?.formModel as PostApi.PostVO
|
||||
if (actionType.value === 'create') {
|
||||
await PostApi.createPostApi(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await PostApi.updatePostApi(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
modelVisible.value = false
|
||||
emit('success')
|
||||
} finally {
|
||||
actionLoading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user