136 lines
3.5 KiB
Vue
136 lines
3.5 KiB
Vue
<!--
|
|
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
|
* No deletion without permission, or be held responsible to law.
|
|
* @author gaoxq
|
|
-->
|
|
<template>
|
|
<BasicModal
|
|
v-bind="$attrs"
|
|
:showFooter="true"
|
|
:showOkBtn="false"
|
|
@register="registerModal"
|
|
width="60%"
|
|
>
|
|
<template #title>
|
|
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
|
<span> {{ getTitle.value }} </span>
|
|
</template>
|
|
<BasicForm @register="registerForm" />
|
|
</BasicModal>
|
|
</template>
|
|
<script lang="ts" setup name="ViewsBizCompanyForm">
|
|
import { ref, unref, computed } from 'vue';
|
|
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
|
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
|
import { router } from '@jeesite/core/router';
|
|
import { Icon } from '@jeesite/core/components/Icon';
|
|
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
|
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
|
import { BizCompany, bizCompanySave, bizCompanyForm } from '@jeesite/biz/api/biz/company';
|
|
|
|
const emit = defineEmits(['success', 'register']);
|
|
|
|
const { t } = useI18n('biz.company');
|
|
const { showMessage } = useMessage();
|
|
const { meta } = unref(router.currentRoute);
|
|
const record = ref<BizCompany>({} as BizCompany);
|
|
|
|
const getTitle = computed(() => ({
|
|
icon: meta.icon || 'i-ant-design:book-outlined',
|
|
value: t('查看公司信息'),
|
|
}));
|
|
|
|
const inputFormSchemas: FormSchema<BizCompany>[] = [
|
|
{
|
|
label: t('公司名称'),
|
|
field: 'companyName',
|
|
component: 'Input',
|
|
componentProps: {
|
|
maxlength: 100,
|
|
},
|
|
dynamicDisabled: true,
|
|
colProps: { md: 24, lg: 24 },
|
|
},
|
|
{
|
|
label: t('公司地址'),
|
|
field: 'address',
|
|
component: 'Input',
|
|
componentProps: {
|
|
maxlength: 255,
|
|
},
|
|
colProps: { md: 24, lg: 24 },
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('联系人员'),
|
|
field: 'contactPerson',
|
|
component: 'Input',
|
|
componentProps: {
|
|
maxlength: 100,
|
|
},
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('联系电话'),
|
|
field: 'phoneNumber',
|
|
component: 'Input',
|
|
componentProps: {
|
|
maxlength: 20,
|
|
},
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('电子邮箱'),
|
|
field: 'email',
|
|
component: 'Input',
|
|
componentProps: {
|
|
maxlength: 100,
|
|
},
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('公司状态'),
|
|
field: 'compStatus',
|
|
component: 'Select',
|
|
componentProps: {
|
|
dictType: 'ustatus',
|
|
allowClear: true,
|
|
},
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('官方网址'),
|
|
field: 'websiteUrl',
|
|
component: 'Input',
|
|
componentProps: {
|
|
maxlength: 255,
|
|
},
|
|
colProps: { md: 24, lg: 24 },
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('备注说明'),
|
|
field: 'remarks',
|
|
component: 'InputTextArea',
|
|
colProps: { md: 24, lg: 24 },
|
|
dynamicDisabled: true,
|
|
},
|
|
];
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizCompany>({
|
|
labelWidth: 120,
|
|
schemas: inputFormSchemas,
|
|
baseColProps: { md: 24, lg: 12 },
|
|
});
|
|
|
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
setModalProps({ loading: true });
|
|
await resetFields();
|
|
const res = await bizCompanyForm(data);
|
|
record.value = (res.bizCompany || {}) as BizCompany;
|
|
record.value.__t = new Date().getTime();
|
|
await setFieldsValue(record.value);
|
|
setModalProps({ loading: false });
|
|
});
|
|
</script>
|