import { getMenus } from '@/api/system/menu' import { clientTypeArray, openTypeArray } from '@/utils/searchArray' import { SearchOutline } from '@vicons/ionicons5' import { NForm, NFormItem, NInput, NSpace, NButton, useMessage, NRadioGroup, NRadio, NSelect } from 'naive-ui' import { defineComponent, onMounted, PropType, reactive, ref } from 'vue' import { sysPaymentConfigSave, sysPaymentConfigUpdate } from '../../api' export default defineComponent({ name: 'role-operation', props: { type: { type: String, default: 'add' }, data: { type: Object as PropType, default: () => {} } }, emits: ['close', 'getList'], setup(props, { slots, attrs, emit }) { const forms = reactive({ paramName: null, paramValue: null, clientType: null, openType: null, description: null }) const btnLoading = ref(false) const formsRef = ref() const message = useMessage() const onSubmit = async () => { formsRef.value.validate(async (error: any) => { if (error) return false try { btnLoading.value = true if (props.type === 'add') { await sysPaymentConfigSave({ ...forms }) message.success('添加成功') } else if (props.type === 'edit') { await sysPaymentConfigUpdate({ ...forms, id: props.data.id }) message.success('修改成功') } emit('close') emit('getList') } catch (e: any) { console.log(e, 'e') } btnLoading.value = false }) } onMounted(async () => { if (props.type === 'edit') { const data = props.data forms.paramName = data.paramName forms.paramValue = data.paramValue forms.clientType = data.clientType forms.openType = data.openType forms.description = data.description } }) return () => (
emit('close')}> 取消 保存
) } })