|
|
|
@ -166,27 +166,39 @@ |
|
|
|
<el-tabs v-model="activeTab" style="margin-top: 0px; width: 99%;" @tab-click="handleTabClick" class="customer-tab" type="border-card"> |
|
|
|
<!-- 基本信息 --> |
|
|
|
<el-tab-pane label="基本信息" name="base"> |
|
|
|
<inspection-request-detail ref="inspectionRequestDetail" :detail-data="currentRow" @update-success="getMainData"/> |
|
|
|
<div class="tab-pane-content" :style="tabPaneContentStyle"> |
|
|
|
<inspection-request-detail ref="inspectionRequestDetail" :detail-data="currentRow" @update-success="getMainData"/> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<!-- 验货明细 --> |
|
|
|
<el-tab-pane label="验货明细" name="detail"> |
|
|
|
<inspection-request-detail-tab ref="inspectionDetailTab" :detail-data="currentRow" :table-height="detailHeight" /> |
|
|
|
<div class="tab-pane-content" :style="tabPaneContentStyle"> |
|
|
|
<inspection-request-detail-tab ref="inspectionDetailTab" :detail-data="currentRow" :table-height="tabTableHeight" /> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<!-- 验货关联PO明细 --> |
|
|
|
<el-tab-pane label="验货关联PO明细" name="poDetail"> |
|
|
|
<inspection-request-po-detail-tab ref="poDetailTab" :detail-data="currentRow" :table-height="detailHeight" /> |
|
|
|
<div class="tab-pane-content" :style="tabPaneContentStyle"> |
|
|
|
<inspection-request-po-detail-tab ref="poDetailTab" :detail-data="currentRow" :table-height="tabTableHeight" /> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<!-- 验货结果 --> |
|
|
|
<el-tab-pane label="验货结果" name="result"> |
|
|
|
<inspection-result-tab ref="resultTab" :detail-data="currentRow" :table-height="detailHeight" /> |
|
|
|
<div class="tab-pane-content" :style="tabPaneContentStyle"> |
|
|
|
<inspection-result-tab ref="resultTab" :detail-data="currentRow" :table-height="tabTableHeight" /> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<!-- 费用明细 --> |
|
|
|
<el-tab-pane label="费用明细" name="fee"> |
|
|
|
<inspection-request-fee-tab ref="feeTab" :detail-data="currentRow" :table-height="detailHeight" /> |
|
|
|
<!-- 费用明细(供应商专用页不展示) --> |
|
|
|
<el-tab-pane v-if="!isSupplierPageMode" label="费用明细" name="fee"> |
|
|
|
<div class="tab-pane-content" :style="tabPaneContentStyle"> |
|
|
|
<inspection-request-fee-tab ref="feeTab" :detail-data="currentRow" :table-height="tabTableHeight" /> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
<!-- 附件管理 --> |
|
|
|
<el-tab-pane label="附件管理" name="attachment"> |
|
|
|
<inspection-request-attachment-tab ref="attachmentTab" :detail-data="currentRow" :table-height="detailHeight" /> |
|
|
|
<!-- 附件管理(供应商专用页不展示) --> |
|
|
|
<el-tab-pane v-if="!isSupplierPageMode" label="附件管理" name="attachment"> |
|
|
|
<div class="tab-pane-content" :style="tabPaneContentStyle"> |
|
|
|
<inspection-request-attachment-tab ref="attachmentTab" :detail-data="currentRow" :table-height="tabTableHeight" /> |
|
|
|
</div> |
|
|
|
</el-tab-pane> |
|
|
|
</el-tabs> |
|
|
|
|
|
|
|
@ -519,6 +531,13 @@ |
|
|
|
<el-form-item label="供应商名称"> |
|
|
|
<el-input v-model="addFormData.supplierName" readonly style="width: 220px" /> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button |
|
|
|
type="primary" |
|
|
|
size="medium" |
|
|
|
style="margin-top: 0px" |
|
|
|
@click="openAddressCreateDialog">新增地址</el-button> |
|
|
|
</el-form-item> |
|
|
|
<!-- <el-form-item label="地址关键词">--> |
|
|
|
<!-- <el-input--> |
|
|
|
<!-- v-model="addressSearch.keyword"--> |
|
|
|
@ -567,6 +586,125 @@ |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 新增供应商地址(与供应商主数据地址页签新增弹窗保持一致) --> |
|
|
|
<el-dialog |
|
|
|
title="供应商地址" |
|
|
|
:close-on-click-modal="false" |
|
|
|
v-drag |
|
|
|
:visible.sync="addressCreateDialogVisible" |
|
|
|
@closed="handleAddressCreateDialogClosed" |
|
|
|
width="600px" |
|
|
|
append-to-body> |
|
|
|
<el-form |
|
|
|
ref="addressCreateFormRef" |
|
|
|
:model="addressCreateForm" |
|
|
|
:rules="addressCreateRules" |
|
|
|
label-position="top" |
|
|
|
label-width="100px"> |
|
|
|
<!-- 供应商ID / 城市简称 / 是否在用 --> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="供应商ID" prop="supplierId"> |
|
|
|
<el-input v-model="addressCreateForm.supplierId" disabled /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="所在城市简称" prop="cityShort"> |
|
|
|
<el-input v-model="addressCreateForm.cityShort" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="是否在用" prop="active"> |
|
|
|
<el-select v-model="addressCreateForm.active" style="width: 100%"> |
|
|
|
<el-option label="Y" value="Y" /> |
|
|
|
<el-option label="N" value="N" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 公司名称 --> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="公司名称" prop="companyName"> |
|
|
|
<el-input v-model="addressCreateForm.companyName" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 联系人 / 电话 / 地址类型 --> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="联系人" prop="contact"> |
|
|
|
<el-input v-model="addressCreateForm.contact" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="联系电话" prop="phoneNo"> |
|
|
|
<el-input v-model="addressCreateForm.phoneNo" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="地址类型" prop="addressType"> |
|
|
|
<sys-dict-select |
|
|
|
v-model="addressCreateForm.addressType" |
|
|
|
dict-type="address_type" |
|
|
|
placeholder="请选择地址类型" |
|
|
|
width="100%" |
|
|
|
filterable |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 邮箱 --> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="邮箱" prop="email"> |
|
|
|
<el-input v-model="addressCreateForm.email" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 原产国 / 装运港 --> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="原产国" prop="originCountry"> |
|
|
|
<el-input v-model="addressCreateForm.originCountry" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item prop="portOfLoading"> |
|
|
|
<span slot="label" style="cursor: pointer" @click="getBaseList(2018, 'addressPortOfLoading')"><a href="#">装运港</a></span> |
|
|
|
<el-input v-model="addressCreateForm.portOfLoading" readonly /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 地址 --> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="地址" prop="address"> |
|
|
|
<el-input v-model="addressCreateForm.address" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<!-- 备注 --> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="24"> |
|
|
|
<el-form-item label="备注" prop="memo"> |
|
|
|
<el-input v-model="addressCreateForm.memo" type="textarea" :rows="1" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<span slot="footer" class="dialog-footer" style="margin-top: 10px; display: block"> |
|
|
|
<el-button type="primary" :loading="addressCreateSaving" @click="saveCreatedAddress">保存</el-button> |
|
|
|
<el-button :disabled="addressCreateSaving" @click="addressCreateDialogVisible = false">关闭</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog |
|
|
|
title="从订单选择供应商" |
|
|
|
:visible.sync="orderSupplierDialogVisible" |
|
|
|
@ -722,8 +860,9 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { searchInspectionRequestHeaderList, queryPoPage, queryPoSupplierPage, queryPoSupplierOrderPage, saveInspectionRequest, deleteInspectionRequest, confirmInspectionRequest, applyChangeInspectionRequest, getInspectionRequestDetailSubList, updateInspectionRequest, downloadTemplate, previewUpload, batchSave } from '@/api/inspection/inspectionRequestHeader.js' |
|
|
|
import { searchSrmSupplierAddressList } from '@/api/srm/srmSupplier.js' |
|
|
|
import { searchSrmSupplierAddressList, createSrmSupplierAddress, searchSrmSupplierList } from '@/api/srm/srmSupplier.js' |
|
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|
|
|
import SysDictSelect from '@/components/dict/SysDictSelect.vue' |
|
|
|
import ComInspectionRequestDetail from './com_inspectionRequestDetail.vue' |
|
|
|
import ComInspectionRequestDetailTab from './com_inspectionRequestDetailTab.vue' |
|
|
|
import ComInspectionRequestPoDetailTab from './com_inspectionRequestPoDetailTab.vue' |
|
|
|
@ -735,6 +874,17 @@ import excel from '@/utils/excel-util.js' |
|
|
|
|
|
|
|
export default { |
|
|
|
props: { |
|
|
|
/** |
|
|
|
* 供应商专用模式开关 |
|
|
|
* - false:通用验货申请页(默认,内部人员场景) |
|
|
|
* - true :供应商专用页(由 inspectionRequestListSupplier.vue 传入) |
|
|
|
* |
|
|
|
* 打开后会触发: |
|
|
|
* 1) 查询条件精简; |
|
|
|
* 2) 查询强制按当前登录用户绑定供应商编码过滤; |
|
|
|
* 3) 新增时供应商固定为当前登录用户供应商; |
|
|
|
* 4) 隐藏从订单选择供应商入口及部分PO筛选项。 |
|
|
|
*/ |
|
|
|
supplierMode: { |
|
|
|
type: Boolean, |
|
|
|
default: false |
|
|
|
@ -742,6 +892,7 @@ export default { |
|
|
|
}, |
|
|
|
components: { |
|
|
|
Chooselist, |
|
|
|
SysDictSelect, |
|
|
|
InspectionRequestDetail: ComInspectionRequestDetail, |
|
|
|
InspectionRequestDetailTab: ComInspectionRequestDetailTab, |
|
|
|
InspectionRequestPoDetailTab: ComInspectionRequestPoDetailTab, |
|
|
|
@ -757,6 +908,7 @@ export default { |
|
|
|
currentRow: {}, |
|
|
|
tagNo: '', |
|
|
|
searchType: '', |
|
|
|
// 供应商模式上下文:来自 /sys/user/info(user.supplierNo / user.supplierName) |
|
|
|
currentSupplierNo: '', |
|
|
|
currentSupplierName: '', |
|
|
|
activeTab: 'base', |
|
|
|
@ -825,6 +977,53 @@ export default { |
|
|
|
addressSearch: { |
|
|
|
keyword: '' |
|
|
|
}, |
|
|
|
// 新增供应商地址弹窗(用于验货地址弹窗内快速维护地址) |
|
|
|
addressCreateDialogVisible: false, |
|
|
|
addressCreateSaving: false, |
|
|
|
addressCreateForm: { |
|
|
|
supplierId: '', |
|
|
|
site: this.$store.state.user.site || this.$store.state.user.currentSite || '', |
|
|
|
addressId: '', |
|
|
|
companyName: '', |
|
|
|
cityShort: '', |
|
|
|
contact: '', |
|
|
|
phoneNo: '', |
|
|
|
address: '', |
|
|
|
addressType: '验货地址', |
|
|
|
active: 'Y', |
|
|
|
email: '', |
|
|
|
originCountry: '', |
|
|
|
portOfLoading: '', |
|
|
|
memo: '', |
|
|
|
createBy: this.$store.state.user.name, |
|
|
|
updateBy: this.$store.state.user.name |
|
|
|
}, |
|
|
|
addressCreateRules: { |
|
|
|
supplierId: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, trigger: 'blur' } |
|
|
|
], |
|
|
|
site: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, trigger: 'blur' } |
|
|
|
], |
|
|
|
cityShort: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, message: ' ', trigger: 'blur' } |
|
|
|
], |
|
|
|
address: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, message: ' ', trigger: 'blur' } |
|
|
|
], |
|
|
|
companyName: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, message: ' ', trigger: 'blur' } |
|
|
|
], |
|
|
|
contact: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, message: ' ', trigger: 'blur' } |
|
|
|
], |
|
|
|
phoneNo: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, message: ' ', trigger: 'blur' } |
|
|
|
], |
|
|
|
addressType: [ |
|
|
|
{ required: true, validator: this.validateAddressCreateField, message: ' ', trigger: 'change' } |
|
|
|
] |
|
|
|
}, |
|
|
|
applyChangeDialogVisible: false, |
|
|
|
applyChangeLoading: false, |
|
|
|
applyChangeForm: { |
|
|
|
@ -1139,20 +1338,59 @@ export default { |
|
|
|
isEditDialogMode () { |
|
|
|
return this.addDialogMode === 'edit' |
|
|
|
}, |
|
|
|
// 统一封装模式判断,避免模板与方法里反复写 this.supplierMode === true |
|
|
|
isSupplierPageMode () { |
|
|
|
return this.supplierMode === true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 统一页签内容容器高度(单位:px)。 |
|
|
|
* 业务意图: |
|
|
|
* - 验货申请各页签切换时保持同一视觉高度,避免忽高忽低导致页面跳动; |
|
|
|
* - 当窗口高度异常或未初始化时提供安全兜底,避免出现 0 高度导致内容不可见。 |
|
|
|
*/ |
|
|
|
normalizedTabPaneHeight () { |
|
|
|
const rawHeight = Number(this.detailHeight) |
|
|
|
if (!rawHeight || rawHeight <= 0) { |
|
|
|
return 300 |
|
|
|
} |
|
|
|
return Math.floor(rawHeight) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 页签内容区内联样式(供所有 tab pane 复用)。 |
|
|
|
* 关键输出: |
|
|
|
* - 固定高度:所有页签保持一致; |
|
|
|
* - 自动滚动:当单个页签内容超出时在页签内部滚动,不撑高外层布局。 |
|
|
|
*/ |
|
|
|
tabPaneContentStyle () { |
|
|
|
return { |
|
|
|
height: `${this.normalizedTabPaneHeight}px` |
|
|
|
} |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 表格类页签统一高度(单位:px)。 |
|
|
|
* 设计说明: |
|
|
|
* - 预留少量内边距,避免表格底部与容器边框贴边; |
|
|
|
* - 设置最小值,防止极端窗口尺寸下表格渲染异常。 |
|
|
|
*/ |
|
|
|
tabTableHeight () { |
|
|
|
return Math.max(this.normalizedTabPaneHeight - 10, 120) |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
this.$nextTick(() => { |
|
|
|
// 统一计算主表格和详情页签的高度,确保一致 |
|
|
|
const calculatedHeight = (window.innerHeight - 220) / 2 |
|
|
|
const calculatedHeight = (window.innerHeight - 250) / 2 |
|
|
|
this.height = calculatedHeight |
|
|
|
this.detailHeight = calculatedHeight |
|
|
|
this.initPageData() |
|
|
|
}) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
/** |
|
|
|
* 页面初始化入口: |
|
|
|
* - 通用模式:直接查询; |
|
|
|
* - 供应商模式:先加载当前用户供应商信息,再按供应商过滤查询。 |
|
|
|
*/ |
|
|
|
async initPageData () { |
|
|
|
if (!this.isSupplierPageMode) { |
|
|
|
this.getMainData() |
|
|
|
@ -1167,6 +1405,13 @@ export default { |
|
|
|
this.pageIndex = 1 |
|
|
|
this.getMainData() |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 读取当前登录用户绑定的供应商信息。 |
|
|
|
* 数据来源:GET /sys/user/info |
|
|
|
* 结果用途: |
|
|
|
* - currentSupplierNo:查询强制过滤 + 新增固定回填 |
|
|
|
* - currentSupplierName:新增供应商名称展示 |
|
|
|
*/ |
|
|
|
async loadCurrentUserSupplierContext () { |
|
|
|
try { |
|
|
|
const { data } = await this.$http({ |
|
|
|
@ -1199,6 +1444,10 @@ export default { |
|
|
|
return false |
|
|
|
} |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 将当前用户供应商写入查询条件。 |
|
|
|
* 说明:supplierName 这里清空,避免名称模糊匹配干扰 supplierNo 精准过滤。 |
|
|
|
*/ |
|
|
|
applyCurrentSupplierToSearchFilters () { |
|
|
|
if (!this.currentSupplierNo) { |
|
|
|
return false |
|
|
|
@ -1207,6 +1456,9 @@ export default { |
|
|
|
this.searchData.supplierName = '' |
|
|
|
return true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 将当前用户供应商写入新增表单(只读展示)。 |
|
|
|
*/ |
|
|
|
applyCurrentSupplierToAddForm () { |
|
|
|
if (!this.currentSupplierNo) { |
|
|
|
return false |
|
|
|
@ -1293,6 +1545,12 @@ export default { |
|
|
|
// 防止 Druid 拦截 where 1=1 |
|
|
|
conSql = " and username <> '' " |
|
|
|
} |
|
|
|
if (val === 2018) { |
|
|
|
if (type === 'addressPortOfLoading') { |
|
|
|
strVal = this.addressCreateForm.portOfLoading || '' |
|
|
|
} |
|
|
|
conSql = " and port_name <> '' " |
|
|
|
} |
|
|
|
this.$refs.baseList.init(val, strVal, conSql) |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -1346,6 +1604,11 @@ export default { |
|
|
|
this.orderSupplierSearch.planner = plannerVal |
|
|
|
} |
|
|
|
} |
|
|
|
if (this.tagNo === 2018) { |
|
|
|
if (this.searchType === 'addressPortOfLoading') { |
|
|
|
this.addressCreateForm.portOfLoading = val.port_name || val.code || '' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 查询数据 |
|
|
|
@ -1539,6 +1802,9 @@ export default { |
|
|
|
this.addressSearch = { |
|
|
|
keyword: '' |
|
|
|
} |
|
|
|
this.addressCreateDialogVisible = false |
|
|
|
this.addressCreateSaving = false |
|
|
|
this.addressCreateForm = this.buildAddressCreateFormBySupplier('') |
|
|
|
this.orderSupplierDialogVisible = false |
|
|
|
this.orderSupplierLoading = false |
|
|
|
this.orderSupplierList = [] |
|
|
|
@ -1643,6 +1909,147 @@ export default { |
|
|
|
this.$refs.baseList.init(520, this.addFormData.supplierNo || '', conSql) |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 新增供应商地址弹窗字段校验(与供应商地址页签新增逻辑保持一致)。 |
|
|
|
* 规则:必填字段不能为空字符串(仅空格也视为无效)。 |
|
|
|
*/ |
|
|
|
validateAddressCreateField (rule, value, callback) { |
|
|
|
const normalizedValue = value === null || value === undefined ? '' : String(value).trim() |
|
|
|
if (!normalizedValue) { |
|
|
|
callback(new Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
callback() |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 构建“新增供应商地址”弹窗的默认表单对象。 |
|
|
|
* supplierId 固定使用当前验货申请选中的供应商编码,避免录错供应商。 |
|
|
|
*/ |
|
|
|
buildAddressCreateFormBySupplier (supplierId) { |
|
|
|
const currentSite = String(this.$store.state.user.site || this.$store.state.user.currentSite || '').trim() |
|
|
|
return { |
|
|
|
supplierId: supplierId || '', |
|
|
|
site: currentSite, |
|
|
|
addressId: '', |
|
|
|
companyName: '', |
|
|
|
cityShort: '', |
|
|
|
contact: '', |
|
|
|
phoneNo: '', |
|
|
|
address: '', |
|
|
|
addressType: '验货地址', |
|
|
|
active: 'Y', |
|
|
|
email: '', |
|
|
|
originCountry: '', |
|
|
|
portOfLoading: '', |
|
|
|
memo: '', |
|
|
|
createBy: this.$store.state.user.name, |
|
|
|
updateBy: this.$store.state.user.name |
|
|
|
} |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 在“选择验货地址”弹窗内快速新增供应商地址。 |
|
|
|
* 界面字段与 /srmSupplier-supplierList 地址页签新增弹窗保持一致。 |
|
|
|
*/ |
|
|
|
openAddressCreateDialog () { |
|
|
|
const supplierNo = (this.addFormData.supplierNo || '').trim() |
|
|
|
if (!supplierNo) { |
|
|
|
this.$message.warning('请先选择供应商') |
|
|
|
return |
|
|
|
} |
|
|
|
this.addressCreateForm = this.buildAddressCreateFormBySupplier(supplierNo) |
|
|
|
this.addressCreateDialogVisible = true |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.addressCreateFormRef) { |
|
|
|
this.$refs.addressCreateFormRef.clearValidate() |
|
|
|
} |
|
|
|
}) |
|
|
|
this.fetchSupplierInfoForAddressCreate(supplierNo) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 根据供应商编码回填默认信息(公司名称/联系人/电话/邮箱/地址)。 |
|
|
|
* 仅在新增地址弹窗中用于提高录入效率,不覆盖用户已输入内容。 |
|
|
|
*/ |
|
|
|
fetchSupplierInfoForAddressCreate (supplierNo) { |
|
|
|
const normalizedSupplierNo = String(supplierNo || '').trim() |
|
|
|
const currentSite = String(this.$store.state.user.site || this.$store.state.user.currentSite || '').trim() |
|
|
|
if (!normalizedSupplierNo || !currentSite) { |
|
|
|
return |
|
|
|
} |
|
|
|
searchSrmSupplierList({ |
|
|
|
site: currentSite, |
|
|
|
supplierNo: normalizedSupplierNo, |
|
|
|
page: 1, |
|
|
|
limit: 1 |
|
|
|
}).then(({ data }) => { |
|
|
|
if (!(data && data.code === 0)) { |
|
|
|
return |
|
|
|
} |
|
|
|
const pageData = data.data || data.page |
|
|
|
const supplierList = pageData && pageData.list ? pageData.list : (Array.isArray(pageData) ? pageData : []) |
|
|
|
if (!supplierList || supplierList.length === 0) { |
|
|
|
return |
|
|
|
} |
|
|
|
const supplierData = supplierList[0] || {} |
|
|
|
this.addressCreateForm.companyName = supplierData.supplierName || supplierData.companyName || this.addressCreateForm.companyName || '' |
|
|
|
if (!this.addressCreateForm.contact) { |
|
|
|
this.addressCreateForm.contact = supplierData.contact || '' |
|
|
|
} |
|
|
|
if (!this.addressCreateForm.phoneNo) { |
|
|
|
this.addressCreateForm.phoneNo = supplierData.phoneNo || supplierData.phoneNo1 || '' |
|
|
|
} |
|
|
|
if (!this.addressCreateForm.email) { |
|
|
|
this.addressCreateForm.email = supplierData.email || supplierData.email1 || '' |
|
|
|
} |
|
|
|
if (!this.addressCreateForm.address) { |
|
|
|
this.addressCreateForm.address = supplierData.address || '' |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
console.error('查询供应商信息失败:', error) |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 保存新增供应商地址并刷新地址列表。 |
|
|
|
* 保存成功后不关闭“选择验货地址”弹窗,便于用户立即选择新地址。 |
|
|
|
*/ |
|
|
|
saveCreatedAddress () { |
|
|
|
if (!this.$refs.addressCreateFormRef) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.$refs.addressCreateFormRef.validate((valid) => { |
|
|
|
if (!valid) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.addressCreateSaving = true |
|
|
|
this.addressCreateForm.createBy = this.$store.state.user.name |
|
|
|
this.addressCreateForm.updateBy = this.$store.state.user.name |
|
|
|
createSrmSupplierAddress(this.addressCreateForm).then(({ data }) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success('新增供应商地址成功') |
|
|
|
this.addressCreateDialogVisible = false |
|
|
|
this.loadAddressList() |
|
|
|
} else { |
|
|
|
this.$alert(data.msg || '新增供应商地址失败', '错误', { confirmButtonText: '确定' }) |
|
|
|
} |
|
|
|
}).catch((error) => { |
|
|
|
console.error('保存供应商地址失败:', error) |
|
|
|
this.$message.error('保存失败: ' + (error.message || '网络错误')) |
|
|
|
}).finally(() => { |
|
|
|
this.addressCreateSaving = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 新增地址弹窗关闭后的收尾动作: |
|
|
|
* - 清理校验状态 |
|
|
|
* - 重置为当前供应商默认表单,避免残留上次输入 |
|
|
|
*/ |
|
|
|
handleAddressCreateDialogClosed () { |
|
|
|
if (this.$refs.addressCreateFormRef) { |
|
|
|
this.$refs.addressCreateFormRef.clearValidate() |
|
|
|
} |
|
|
|
this.addressCreateForm = this.buildAddressCreateFormBySupplier(this.addFormData.supplierNo || '') |
|
|
|
this.addressCreateSaving = false |
|
|
|
}, |
|
|
|
|
|
|
|
// 打开验货地址选择弹窗(仅查询当前供应商的验货地址) |
|
|
|
openAddressDialog () { |
|
|
|
@ -1654,6 +2061,7 @@ export default { |
|
|
|
this.addressPageIndex = 1 |
|
|
|
this.addressSearch.keyword = '' |
|
|
|
this.addressCurrentRow = null |
|
|
|
this.addressCreateForm = this.buildAddressCreateFormBySupplier(this.addFormData.supplierNo || '') |
|
|
|
this.loadAddressList() |
|
|
|
}, |
|
|
|
|
|
|
|
@ -2712,6 +3120,17 @@ export default { |
|
|
|
font-size: 13px; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 验货申请详情页签统一高度容器: |
|
|
|
* 1) 固定高度:保证“基本信息/明细/结果/费用/附件”视觉高度一致; |
|
|
|
* 2) 内部滚动:内容超高时在当前页签滚动,避免整体布局抖动。 |
|
|
|
*/ |
|
|
|
.tab-pane-content { |
|
|
|
width: 100%; |
|
|
|
overflow-y: auto; |
|
|
|
overflow-x: hidden; |
|
|
|
} |
|
|
|
|
|
|
|
/deep/ .customer-tab .el-tabs__content { |
|
|
|
padding: 5px !important; |
|
|
|
} |
|
|
|
|