vxe回返bug

This commit is contained in:
gexinzhineng/gxzn27 2023-04-03 17:48:38 +08:00
parent 12c5116dfd
commit f1e801e9ad
9 changed files with 262 additions and 9 deletions

View File

@ -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,

View File

@ -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() //

View File

@ -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'))

View File

@ -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
}

View File

@ -64,7 +64,7 @@
show-checkbox
:props="defaultProps"
:data="deptTreeOptions"
empty-text="加载中,请稍"
empty-text="加载中,请稍"
multiple
/>
</el-form-item>

View File

@ -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()

View File

@ -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() //

View 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) // 12
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>

View 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>