| | |
| | | |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <ElButton @click="handleCancel">取消</ElButton> |
| | | <ElButton type="primary" @click="handleSubmit">确定</ElButton> |
| | | <ElButton @click="handleCancel">{{ t('common.cancel') }}</ElButton> |
| | | <ElButton type="primary" @click="handleSubmit">{{ t('common.confirm') }}</ElButton> |
| | | </span> |
| | | </template> |
| | | </ElDialog> |
| | |
| | | |
| | | <script setup> |
| | | import { computed, nextTick, reactive, ref, watch } from 'vue' |
| | | import { useI18n } from 'vue-i18n' |
| | | import ArtForm from '@/components/core/forms/art-form/index.vue' |
| | | import { |
| | | buildCompanysDialogModel, |
| | |
| | | const emit = defineEmits(['update:visible', 'submit']) |
| | | const formRef = ref() |
| | | const form = reactive(createCompanysFormState()) |
| | | const { t } = useI18n() |
| | | |
| | | const isEdit = computed(() => props.dialogType === 'edit') |
| | | const dialogTitle = computed(() => (isEdit.value ? '编辑往来企业' : '新增往来企业')) |
| | | const dialogTitle = computed(() => |
| | | isEdit.value ? t('pages.basicInfo.companys.dialog.titleEdit') : t('pages.basicInfo.companys.dialog.titleCreate') |
| | | ) |
| | | |
| | | const rules = computed(() => ({ |
| | | name: [{ required: true, message: '请输入企业名称', trigger: 'blur' }], |
| | | breifCode: [{ required: true, message: '请输入助记码', trigger: 'blur' }], |
| | | type: [{ required: true, message: '请选择企业类型', trigger: 'change' }] |
| | | name: [{ required: true, message: t('pages.basicInfo.companys.validation.name'), trigger: 'blur' }], |
| | | breifCode: [{ required: true, message: t('pages.basicInfo.companys.validation.briefCode'), trigger: 'blur' }], |
| | | type: [{ required: true, message: t('pages.basicInfo.companys.validation.type'), trigger: 'change' }] |
| | | })) |
| | | |
| | | const formItems = computed(() => [ |
| | | { |
| | | label: '企业编码', |
| | | label: t('pages.basicInfo.companys.table.code'), |
| | | key: 'code', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '留空将自动生成', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.code'), |
| | | clearable: true, |
| | | disabled: isEdit.value |
| | | } |
| | | }, |
| | | { |
| | | label: '企业名称', |
| | | label: t('pages.basicInfo.companys.table.name'), |
| | | key: 'name', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入企业名称', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.name'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '英文别名', |
| | | label: t('pages.basicInfo.companys.table.nameEn'), |
| | | key: 'nameEn', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入英文别名', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.nameEn'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '助记码', |
| | | label: t('pages.basicInfo.companys.table.briefCode'), |
| | | key: 'breifCode', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入助记码', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.briefCode'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '企业类型', |
| | | label: t('pages.basicInfo.companys.table.type'), |
| | | key: 'type', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择企业类型', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.type'), |
| | | clearable: true, |
| | | filterable: true, |
| | | options: props.typeOptions |
| | | } |
| | | }, |
| | | { |
| | | label: '联系人', |
| | | label: t('pages.basicInfo.companys.table.contact'), |
| | | key: 'contact', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入联系人', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.contact'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '联系电话', |
| | | label: t('pages.basicInfo.companys.table.tel'), |
| | | key: 'tel', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入联系电话', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.tel'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '邮箱', |
| | | label: t('pages.basicInfo.companys.table.email'), |
| | | key: 'email', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入邮箱', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.email'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '邮编', |
| | | label: t('pages.basicInfo.companys.table.postCode'), |
| | | key: 'pcode', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入邮编', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.postCode'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '省份', |
| | | label: t('pages.basicInfo.companys.table.province'), |
| | | key: 'province', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入省份', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.province'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '城市', |
| | | label: t('pages.basicInfo.companys.table.city'), |
| | | key: 'city', |
| | | type: 'input', |
| | | props: { |
| | | placeholder: '请输入城市', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.city'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '地址', |
| | | label: t('pages.basicInfo.companys.table.address'), |
| | | key: 'address', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | placeholder: '请输入地址', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.address'), |
| | | clearable: true |
| | | } |
| | | }, |
| | | { |
| | | label: '状态', |
| | | label: t('table.status'), |
| | | key: 'status', |
| | | type: 'select', |
| | | props: { |
| | | placeholder: '请选择状态', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.status'), |
| | | clearable: true, |
| | | options: getCompanysStatusOptions() |
| | | options: getCompanysStatusOptions(t) |
| | | } |
| | | }, |
| | | { |
| | | label: '备注', |
| | | label: t('table.remark'), |
| | | key: 'memo', |
| | | type: 'input', |
| | | span: 24, |
| | | props: { |
| | | type: 'textarea', |
| | | rows: 3, |
| | | placeholder: '请输入备注', |
| | | placeholder: t('pages.basicInfo.companys.placeholders.memo'), |
| | | clearable: true |
| | | } |
| | | } |