|
|
@ -4,21 +4,28 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<script lang="ts"> |
|
|
|
<script lang="ts"> |
|
|
|
import { defineComponent, ref, unref } from 'vue'; |
|
|
|
import { defineComponent, ref, unref, watchEffect } from 'vue'; |
|
|
|
import { BasicForm, useForm } from '/@/components/Form'; |
|
|
|
import { BasicForm, useForm } from '/@/components/Form'; |
|
|
|
import { formSchema } from './data'; |
|
|
|
import { formSchema } from './data'; |
|
|
|
import { addPushEnterprise } from '/@/api/platform/common/controller/pushEnterprise'; |
|
|
|
import { addPushEnterprise, editPushEnterprise } from '/@/api/platform/common/controller/pushEnterprise'; |
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
import { useMessage } from '/@/hooks/web/useMessage'; |
|
|
|
|
|
|
|
import type { PushEnterprise } from '/@/api/platform/common/entity/pushEnterprise'; |
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent({ |
|
|
|
export default defineComponent({ |
|
|
|
components: { |
|
|
|
components: { |
|
|
|
BasicForm |
|
|
|
BasicForm |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
props: { |
|
|
|
|
|
|
|
pushEnterprise: { |
|
|
|
|
|
|
|
type: Object as PropType<PushEnterprise>, |
|
|
|
|
|
|
|
default: () => ({}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
emits: ['next'], |
|
|
|
emits: ['next'], |
|
|
|
setup(_, { emit }) { |
|
|
|
setup(props, { emit }) { |
|
|
|
const submitBtnLoading = ref(false); |
|
|
|
const submitBtnLoading = ref(false); |
|
|
|
const { createMessage } = useMessage(); |
|
|
|
const { createMessage } = useMessage(); |
|
|
|
const [registerForm, { validate }] = useForm({ |
|
|
|
const [registerForm , { validate, setFieldsValue }] = useForm({ |
|
|
|
labelWidth: 100, |
|
|
|
labelWidth: 100, |
|
|
|
schemas: formSchema, |
|
|
|
schemas: formSchema, |
|
|
|
submitButtonOptions: { |
|
|
|
submitButtonOptions: { |
|
|
@ -32,15 +39,25 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
showResetButton: false |
|
|
|
showResetButton: false |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
setFieldsValue(props.pushEnterprise); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watchEffect(() => { |
|
|
|
|
|
|
|
setFieldsValue(props.pushEnterprise); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
async function handleSubmit() { |
|
|
|
async function handleSubmit() { |
|
|
|
try { |
|
|
|
try { |
|
|
|
const formData = await validate(); |
|
|
|
const formData = await validate(); |
|
|
|
|
|
|
|
formData.status = 1; |
|
|
|
formData.license = Array(formData.license).join(','); |
|
|
|
formData.license = Array(formData.license).join(','); |
|
|
|
submitBtnLoading.value = true; |
|
|
|
submitBtnLoading.value = true; |
|
|
|
await addPushEnterprise(formData); |
|
|
|
if (!formData.id) { |
|
|
|
|
|
|
|
await addPushEnterprise(formData); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
await editPushEnterprise(formData); |
|
|
|
|
|
|
|
} |
|
|
|
createMessage.success('提交成功!'); |
|
|
|
createMessage.success('提交成功!'); |
|
|
|
emit('next'); |
|
|
|
emit('next', 1); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
submitBtnLoading.value = false; |
|
|
|
submitBtnLoading.value = false; |
|
|
|
} |
|
|
|
} |
|
|
|