|
|
@@ -124,12 +124,12 @@
|
|
|
<el-row :gutter="12" class="form-row">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="传真:">
|
|
|
- <el-input v-model="localDetailData.fax" placeholder="请输入传真" @blur="onFaxBlur" :disabled="isViewMode" />
|
|
|
+ <el-input v-model="localDetailData.fax" placeholder="请输入传真" :disabled="isViewMode" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
- <el-form-item label="企业邮箱:">
|
|
|
- <el-input v-model="localDetailData.mailbox" placeholder="请输入企业邮箱" :disabled="isViewMode" />
|
|
|
+ <el-form-item label="企业邮箱:" :error="mailboxError">
|
|
|
+ <el-input v-model="localDetailData.mailbox" placeholder="请输入企业邮箱" @blur="onMailboxBlur" :disabled="isViewMode" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<!-- <el-col :span="8">
|
|
|
@@ -251,7 +251,7 @@
|
|
|
<el-col :span="24">
|
|
|
<div class="form-item">
|
|
|
<span class="label">工商地址:</span>
|
|
|
- <el-input v-model="businessInfo.businessAddress" placeholder="工商地址" style="width: 70%" :disabled="isViewMode" />
|
|
|
+ <el-input v-model="businessInfo.businessAddress" placeholder="工商地址" style="width: 70%" :disabled="true" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -288,86 +288,12 @@
|
|
|
<el-col :span="8" />
|
|
|
</el-row>
|
|
|
</div>
|
|
|
-
|
|
|
- <div class="section-title">ERP供应商信息</div>
|
|
|
- <el-form :model="erpSupplierInfoForm" label-width="120px" class="detail-form">
|
|
|
- <el-row :gutter="12" class="form-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="采购人员:">
|
|
|
- <el-select v-model="erpSupplierInfoForm.purchaseId" placeholder="请选择采购人员" class="w-full" filterable :disabled="isViewMode">
|
|
|
- <el-option v-for="item in erpStaffList" :key="item.staffId" :label="`${item.staffCode} , ${item.staffName}`" :value="item.staffId" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="采购开票类型:">
|
|
|
- <el-select
|
|
|
- v-model="erpSupplierInfoForm.purchaseInvoiceNo"
|
|
|
- placeholder="采购开票类型"
|
|
|
- class="w-full"
|
|
|
- filterable
|
|
|
- :disabled="isViewMode"
|
|
|
- @change="handInvoiceChange"
|
|
|
- >
|
|
|
- <el-option v-for="item in purchaseInvoice" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="单价含税:">
|
|
|
- <el-select v-model="erpSupplierInfoForm.unitPrice" placeholder="单价含税" class="w-full" filterable :disabled="isViewMode">
|
|
|
- <el-option v-for="item in unitPriceArr" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="12" class="form-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="税码:">
|
|
|
- <el-select v-model="erpSupplierInfoForm.rateId" placeholder="税码" class="w-full" filterable :disabled="isViewMode">
|
|
|
- <el-option v-for="item in taxrateList" :key="item.id" :label="item.taxrateNo" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="交易币别:">
|
|
|
- <el-select v-model="erpSupplierInfoForm.dealCurrencyId" placeholder="请选择交易币别" class="w-full" filterable :disabled="isViewMode">
|
|
|
- <el-option v-for="item in currencyList" :key="item.id" :label="item.currencyName" :value="item.id" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="账款归属:">
|
|
|
- <el-input v-model="localDetailData.supplierNo" disabled />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="12" class="form-row">
|
|
|
- <el-col :span="8">
|
|
|
- <el-form-item label="付款条件:">
|
|
|
- <el-select v-model="erpSupplierInfoForm.settlementMethod" placeholder="请选择付款条件" class="w-full" filterable :disabled="isViewMode">
|
|
|
- <el-option v-for="dict in payment_clause" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import ImageUpload from '@/components/ImageUpload/index.vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
-import { listErpSupplierInfo, getErpSupplierInfo } from '@/api/supplier/erpSupplierInfo';
|
|
|
-import { ErpSupplierInfoForm } from '@/api/supplier/erpSupplierInfo/types';
|
|
|
-import { listErpStaff } from '@/api/erpData/erpStaff';
|
|
|
-import { ErpStaffVO } from '@/api/erpData/erpStaff/types';
|
|
|
-import { listComCurrency } from '@/api/company/comCurrency';
|
|
|
-import { listTaxrate } from '@/api/company/taxrate';
|
|
|
-import { ComCurrencyVO } from '@/api/company/comCurrency/types';
|
|
|
-
|
|
|
-const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
-const { payment_clause } = toRefs<any>(proxy?.useDict('payment_clause'));
|
|
|
|
|
|
const props = defineProps<{
|
|
|
detailData: any;
|
|
|
@@ -388,26 +314,8 @@ const props = defineProps<{
|
|
|
formatDate: (date: any) => string;
|
|
|
}>();
|
|
|
|
|
|
-// erp供应商信息
|
|
|
-const erpSupplierInfoForm = reactive<ErpSupplierInfoForm>({
|
|
|
- id: undefined,
|
|
|
- supplierId: undefined,
|
|
|
- purchaseId: undefined,
|
|
|
- belongingDepartmentId: undefined,
|
|
|
- status: undefined,
|
|
|
- remark: undefined,
|
|
|
- unitPrice: 'True',
|
|
|
- dealCurrencyId: undefined,
|
|
|
- accountBelong: undefined,
|
|
|
- rateId: undefined,
|
|
|
- purchaseInvoiceId: undefined,
|
|
|
- purchaseInvoiceNo: undefined,
|
|
|
- purchaseInvoice: undefined,
|
|
|
- settlementMethod: undefined
|
|
|
-});
|
|
|
-
|
|
|
const emit = defineEmits<{
|
|
|
- (e: 'save', erpSupplierInfo: ErpSupplierInfoForm): void;
|
|
|
+ (e: 'save'): void;
|
|
|
(e: 'getBusinessInfo'): void;
|
|
|
(e: 'officeRegionChange', value: string[]): void;
|
|
|
(e: 'update:selectedOfficeRegion', value: string[]): void;
|
|
|
@@ -417,8 +325,6 @@ const emit = defineEmits<{
|
|
|
(e: 'update:detailData', value: any): void;
|
|
|
}>();
|
|
|
|
|
|
-const erpStaffList = ref<ErpStaffVO[]>([]);
|
|
|
-
|
|
|
const localDetailData = computed({
|
|
|
get: () => props.detailData,
|
|
|
set: (value) => emit('update:detailData', value)
|
|
|
@@ -429,25 +335,6 @@ const selectedOfficeRegionProxy = computed({
|
|
|
set: (value) => emit('update:selectedOfficeRegion', value)
|
|
|
});
|
|
|
|
|
|
-const unitPriceArr = ref([
|
|
|
- { label: '含税', value: 'True' },
|
|
|
- { label: '不含税', value: 'False' }
|
|
|
-]);
|
|
|
-
|
|
|
-const purchaseInvoice = ref([
|
|
|
- { label: '优易达专票', value: '0001' },
|
|
|
- { label: '江西优易云普票', value: '0016' },
|
|
|
- { label: '江西优易云专票', value: '0006' },
|
|
|
- { label: '无票', value: '0017' },
|
|
|
- { label: '新天利泰专票', value: '0003' },
|
|
|
- { label: '优易达(长沙)-普票', value: '0019' },
|
|
|
- { label: '优易达(长沙)-专票', value: '0018' },
|
|
|
- { label: '优易达普票', value: '0010' },
|
|
|
- { label: '优易智采(江西)-专票', value: '0020' }
|
|
|
-]);
|
|
|
-const taxrateList = ref<any[]>([]);
|
|
|
-const currencyList = ref<ComCurrencyVO[]>([]);
|
|
|
-
|
|
|
const onOfficeRegionChange = (val: unknown) => {
|
|
|
emit('officeRegionChange', (val || []) as string[]);
|
|
|
};
|
|
|
@@ -455,6 +342,8 @@ const onOfficeRegionChange = (val: unknown) => {
|
|
|
const fixedPhoneError = ref('');
|
|
|
const fixedPhoneReg = /^(\d{3,4}-?)?\d{7,8}(-\d{1,6})?$/;
|
|
|
const postCodeError = ref('');
|
|
|
+const mailboxError = ref('');
|
|
|
+const mailboxReg = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
|
|
|
|
const validateFixedPhone = (val: unknown) => {
|
|
|
const v = String(val ?? '').trim();
|
|
|
@@ -470,6 +359,13 @@ const validatePostCode = (val: unknown) => {
|
|
|
return '';
|
|
|
};
|
|
|
|
|
|
+const validateMailbox = (val: unknown) => {
|
|
|
+ const v = String(val ?? '').trim();
|
|
|
+ if (!v) return '';
|
|
|
+ if (!mailboxReg.test(v)) return '请输入正确的邮箱格式';
|
|
|
+ return '';
|
|
|
+};
|
|
|
+
|
|
|
const validateFax = (val: unknown) => {
|
|
|
const v = String(val ?? '').trim();
|
|
|
if (!v) return '';
|
|
|
@@ -493,45 +389,13 @@ watch(
|
|
|
{ immediate: true }
|
|
|
);
|
|
|
|
|
|
-const handInvoiceChange = (invoiceNo: any) => {
|
|
|
- const invoice = purchaseInvoice.value.find((invoice) => invoice.value === invoiceNo);
|
|
|
- erpSupplierInfoForm.purchaseInvoice = invoice?.label;
|
|
|
-};
|
|
|
-
|
|
|
-// 加载税码列表
|
|
|
-const loadTaxrateList = async () => {
|
|
|
- try {
|
|
|
- const res = await listTaxrate({
|
|
|
- isShow: '0',
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 1000
|
|
|
- });
|
|
|
- taxrateList.value = res.rows || [];
|
|
|
- // 默认选择第一个
|
|
|
- if (!erpSupplierInfoForm.rateId && taxrateList.value.length > 0) {
|
|
|
- erpSupplierInfoForm.rateId = taxrateList.value[0].id;
|
|
|
- }
|
|
|
- } catch (error) {}
|
|
|
-};
|
|
|
-
|
|
|
-// 加载币种列表
|
|
|
-const loadCurrencyList = async () => {
|
|
|
- try {
|
|
|
- const res = await listComCurrency({
|
|
|
- isShow: '0',
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 1000
|
|
|
- });
|
|
|
- currencyList.value = res.rows || [];
|
|
|
- // 默认选择第一个
|
|
|
- if (!erpSupplierInfoForm.dealCurrencyId && currencyList.value.length > 0) {
|
|
|
- erpSupplierInfoForm.dealCurrencyId = currencyList.value[0].id;
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('加载币种列表失败:', error);
|
|
|
- currencyList.value = [];
|
|
|
- }
|
|
|
-};
|
|
|
+watch(
|
|
|
+ () => props.detailData?.mailbox,
|
|
|
+ (v) => {
|
|
|
+ mailboxError.value = validateMailbox(v);
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+);
|
|
|
|
|
|
const onFixedPhoneBlur = () => {
|
|
|
fixedPhoneError.value = validateFixedPhone(props.detailData?.fixedPhone);
|
|
|
@@ -541,21 +405,15 @@ const onPostCodeBlur = () => {
|
|
|
postCodeError.value = validatePostCode(props.detailData?.postCode);
|
|
|
};
|
|
|
|
|
|
-// 加载员工列表
|
|
|
-const loadErpStaffList = async () => {
|
|
|
- try {
|
|
|
- const query: any = {};
|
|
|
- const res = await listErpStaff(query);
|
|
|
- erpStaffList.value = res.rows || [];
|
|
|
- } catch (error) {
|
|
|
- console.error('加载员工列表失败:', error);
|
|
|
- }
|
|
|
-};
|
|
|
const onFaxBlur = () => {
|
|
|
const err = validateFax(props.detailData?.fax);
|
|
|
if (err) ElMessage.warning(err);
|
|
|
};
|
|
|
|
|
|
+const onMailboxBlur = () => {
|
|
|
+ mailboxError.value = validateMailbox(props.detailData?.mailbox);
|
|
|
+};
|
|
|
+
|
|
|
const onSaveClick = () => {
|
|
|
const err = validateFixedPhone(props.detailData?.fixedPhone);
|
|
|
fixedPhoneError.value = err;
|
|
|
@@ -576,75 +434,16 @@ const onSaveClick = () => {
|
|
|
ElMessage.warning(faxErr);
|
|
|
return;
|
|
|
}
|
|
|
- emit('save', erpSupplierInfoForm);
|
|
|
-};
|
|
|
|
|
|
-// 加载ERP供应商信息
|
|
|
-const loadErpSupplierInfo = async (supplierId: string | number) => {
|
|
|
- if (!supplierId) {
|
|
|
- console.log('supplierId为空,跳过查询');
|
|
|
+ const mailboxErr = validateMailbox(props.detailData?.mailbox);
|
|
|
+ mailboxError.value = mailboxErr;
|
|
|
+ if (mailboxErr) {
|
|
|
+ ElMessage.warning(mailboxErr);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- try {
|
|
|
- const res = await listErpSupplierInfo({ supplierId, pageNum: 1, pageSize: 1 });
|
|
|
- console.log('ERP供应商信息查询结果:', res);
|
|
|
-
|
|
|
- if (res.rows && res.rows.length > 0) {
|
|
|
- const data = res.rows[0];
|
|
|
- Object.assign(erpSupplierInfoForm, {
|
|
|
- id: data.id,
|
|
|
- supplierId: data.supplierId,
|
|
|
- purchaseId: data.purchaseId,
|
|
|
- belongingDepartmentId: data.belongingDepartmentId,
|
|
|
- status: data.status,
|
|
|
- remark: data.remark,
|
|
|
- unitPrice: data.unitPrice || 'True',
|
|
|
- dealCurrencyId: data.dealCurrencyId,
|
|
|
- accountBelong: data.accountBelong,
|
|
|
- rateId: data.rateId,
|
|
|
- purchaseInvoiceId: data.purchaseInvoiceId,
|
|
|
- purchaseInvoiceNo: data.purchaseInvoiceNo,
|
|
|
- purchaseInvoice: data.purchaseInvoice,
|
|
|
- settlementMethod: data.settlementMethod
|
|
|
- });
|
|
|
- console.log('ERP供应商信息已回显:', erpSupplierInfoForm);
|
|
|
- } else {
|
|
|
- console.log('未查询到ERP供应商信息');
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- console.error('加载ERP供应商信息失败:', error);
|
|
|
- }
|
|
|
+ emit('save');
|
|
|
};
|
|
|
-
|
|
|
-watch(
|
|
|
- () => props.detailData?.supplierId,
|
|
|
- (newId) => {
|
|
|
- console.log('detailData变化:', props.detailData);
|
|
|
- console.log('detailData.id变化:', newId);
|
|
|
- if (newId) {
|
|
|
- loadErpSupplierInfo(newId);
|
|
|
- }
|
|
|
- },
|
|
|
- { immediate: true }
|
|
|
-);
|
|
|
-
|
|
|
-// 监听付款条件字典加载完成后默认选择第一个
|
|
|
-watch(
|
|
|
- () => payment_clause.value,
|
|
|
- (val) => {
|
|
|
- if (!erpSupplierInfoForm.settlementMethod && val && val.length > 0) {
|
|
|
- erpSupplierInfoForm.settlementMethod = val[0].value;
|
|
|
- }
|
|
|
- },
|
|
|
- { immediate: true }
|
|
|
-);
|
|
|
-
|
|
|
-onMounted(() => {
|
|
|
- loadErpStaffList();
|
|
|
- loadTaxrateList();
|
|
|
- loadCurrencyList();
|
|
|
-});
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|