|
|
|
@ -1,38 +1,71 @@
|
|
|
|
|
<template>
|
|
|
|
|
<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>
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref, unref, watch } from 'vue'
|
|
|
|
|
import { BasicModal, useModalInner } from '/@/components/Modal'
|
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
|
import { infoformSchema } from './columns.tsx'
|
|
|
|
|
import { editDataRule, getDataRuleInfo } from '/@/api/system/datarule'
|
|
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
permissionId: { type: String },
|
|
|
|
|
InfoId: { type: String },
|
|
|
|
|
})
|
|
|
|
|
watch(
|
|
|
|
|
() => props.permissionId,
|
|
|
|
|
(Nval) => {
|
|
|
|
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
|
|
|
resetFields()
|
|
|
|
|
setModalProps({ confirmLoading: false, loading: true })
|
|
|
|
|
isUpdate.value = !!data?.isUpdate
|
|
|
|
|
if (unref(isUpdate)) {
|
|
|
|
|
rowId.value = data.record.id
|
|
|
|
|
const res = await getDataRuleInfo({ id: unref(rowId) })
|
|
|
|
|
if (res.succeeded) {
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
permissionId: Nval,
|
|
|
|
|
...res.data,
|
|
|
|
|
field1: JSON.parse(res.data.dataRules),
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
watch(
|
|
|
|
|
() => props.InfoId,
|
|
|
|
|
(Nval) => {
|
|
|
|
|
if (Nval) {
|
|
|
|
|
rowId.value = Nval
|
|
|
|
|
GetData()
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
resetFields()
|
|
|
|
|
console.log(data.permissionId)
|
|
|
|
|
|
|
|
|
|
setFieldsValue({
|
|
|
|
|
permissionId: props.permissionId,
|
|
|
|
|
permissionId: data.permissionId,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
setModalProps({ loading: false })
|
|
|
|
|
})
|
|
|
|
|
// 声明Emits
|
|
|
|
|
const emit = defineEmits(['success', 'register'])
|
|
|
|
|
const isUpdate = ref(true)
|
|
|
|
@ -46,15 +79,6 @@
|
|
|
|
|
schemas: infoformSchema,
|
|
|
|
|
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) {
|
|
|
|
|
try {
|
|
|
|
|
const values = await validate()
|
|
|
|
@ -89,6 +113,7 @@
|
|
|
|
|
createMessage.error(res.message)
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
exit && closeModal()
|
|
|
|
|
} finally {
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|