|
|
@ -1,38 +1,71 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<BasicForm @register="registerForm"> </BasicForm>
|
|
|
|
<BasicModal
|
|
|
|
|
|
|
|
v-bind="$attrs"
|
|
|
|
|
|
|
|
:use-wrapper="true"
|
|
|
|
|
|
|
|
:title="getTitle"
|
|
|
|
|
|
|
|
width="50%"
|
|
|
|
|
|
|
|
@register="registerModal"
|
|
|
|
|
|
|
|
@ok="handleSave"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<BasicForm @register="registerForm"> </BasicForm>
|
|
|
|
|
|
|
|
<!--右下角按钮-->
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
|
|
<a-button
|
|
|
|
|
|
|
|
pre-icon="ant-design:close-outlined"
|
|
|
|
|
|
|
|
type="warning"
|
|
|
|
|
|
|
|
:loading="loading"
|
|
|
|
|
|
|
|
ghost
|
|
|
|
|
|
|
|
style="margin-right: 0.8rem"
|
|
|
|
|
|
|
|
@click="closeModal"
|
|
|
|
|
|
|
|
>取消</a-button
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-button
|
|
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
|
|
:loading="loading"
|
|
|
|
|
|
|
|
pre-icon="ant-design:check-outlined"
|
|
|
|
|
|
|
|
style="margin-right: 0.8rem"
|
|
|
|
|
|
|
|
@click="handleSave(false)"
|
|
|
|
|
|
|
|
>仅保存</a-button
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<a-button
|
|
|
|
|
|
|
|
pre-icon="ant-design:check-circle-outlined"
|
|
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
|
|
:loading="loading"
|
|
|
|
|
|
|
|
@click="handleSave(true)"
|
|
|
|
|
|
|
|
>保存并关闭</a-button
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</BasicModal>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref, unref, watch } from 'vue'
|
|
|
|
import { ref, unref, watch } from 'vue'
|
|
|
|
|
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal'
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
import { infoformSchema } from './columns.tsx'
|
|
|
|
import { infoformSchema } from './columns.tsx'
|
|
|
|
import { editDataRule, getDataRuleInfo } from '/@/api/system/datarule'
|
|
|
|
import { editDataRule, getDataRuleInfo } from '/@/api/system/datarule'
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
const props = defineProps({
|
|
|
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
|
|
permissionId: { type: String },
|
|
|
|
resetFields()
|
|
|
|
InfoId: { type: String },
|
|
|
|
setModalProps({ confirmLoading: false, loading: true })
|
|
|
|
})
|
|
|
|
isUpdate.value = !!data?.isUpdate
|
|
|
|
watch(
|
|
|
|
if (unref(isUpdate)) {
|
|
|
|
() => props.permissionId,
|
|
|
|
rowId.value = data.record.id
|
|
|
|
(Nval) => {
|
|
|
|
const res = await getDataRuleInfo({ id: unref(rowId) })
|
|
|
|
setFieldsValue({
|
|
|
|
if (res.succeeded) {
|
|
|
|
permissionId: Nval,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
|
|
() => props.InfoId,
|
|
|
|
|
|
|
|
(Nval) => {
|
|
|
|
|
|
|
|
if (Nval) {
|
|
|
|
|
|
|
|
rowId.value = Nval
|
|
|
|
|
|
|
|
GetData()
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
resetFields()
|
|
|
|
|
|
|
|
setFieldsValue({
|
|
|
|
setFieldsValue({
|
|
|
|
permissionId: props.permissionId,
|
|
|
|
...res.data,
|
|
|
|
|
|
|
|
field1: JSON.parse(res.data.dataRules),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
} else {
|
|
|
|
)
|
|
|
|
console.log(data.permissionId)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
|
|
|
permissionId: data.permissionId,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setModalProps({ loading: false })
|
|
|
|
|
|
|
|
})
|
|
|
|
// 声明Emits
|
|
|
|
// 声明Emits
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
const isUpdate = ref(true)
|
|
|
|
const isUpdate = ref(true)
|
|
|
@ -46,15 +79,6 @@
|
|
|
|
schemas: infoformSchema,
|
|
|
|
schemas: infoformSchema,
|
|
|
|
showActionButtonGroup: false,
|
|
|
|
showActionButtonGroup: false,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
async function GetData() {
|
|
|
|
|
|
|
|
const res = await getDataRuleInfo({ id: unref(rowId) })
|
|
|
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
|
|
|
...res.data,
|
|
|
|
|
|
|
|
field1: JSON.parse(res.data.dataRules),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
async function handleSave(exit) {
|
|
|
|
async function handleSave(exit) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const values = await validate()
|
|
|
|
const values = await validate()
|
|
|
@ -89,6 +113,7 @@
|
|
|
|
createMessage.error(res.message)
|
|
|
|
createMessage.error(res.message)
|
|
|
|
loading.value = false
|
|
|
|
loading.value = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exit && closeModal()
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
loading.value = false
|
|
|
|
loading.value = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|