|
@@ -44,7 +44,7 @@
|
|
|
label="是否EAW/EAP"
|
|
|
>
|
|
|
<a-radio-group
|
|
|
- v-model="currentFrom.asEawOrEap"
|
|
|
+ v-model="currentFrom.mawbDetail.asEawOrEap"
|
|
|
:options="plainOptions"
|
|
|
/>
|
|
|
</a-form-item>
|
|
@@ -357,10 +357,11 @@ const dialogVisible = ref(false);
|
|
|
*/
|
|
|
const currentFrom = ref<any>({
|
|
|
awbContact: {},
|
|
|
- mawbDetail: {},
|
|
|
+ mawbDetail: {
|
|
|
+ asEawOrEap: 1,
|
|
|
+ },
|
|
|
mawbPrice: {},
|
|
|
asIcs2: null,
|
|
|
- asEawOrEap: 1,
|
|
|
});
|
|
|
const chgsList = ref([]);
|
|
|
|
|
@@ -396,22 +397,24 @@ const title = computed((): string => {
|
|
|
*/
|
|
|
const costInfo = computed(() => {
|
|
|
const tmp = getCostInfo(chgsList);
|
|
|
- if (currentFrom.value.asIcs2 === 0) {
|
|
|
- const hsCodeItem = tmp.find(
|
|
|
- (item: { field: string }) => item.field === 'hsCode'
|
|
|
- );
|
|
|
- if (hsCodeItem) {
|
|
|
- // 修改 hsCode 对象的 rules
|
|
|
- hsCodeItem.rules = {
|
|
|
- required: true,
|
|
|
- message: '必填项不能为空',
|
|
|
- };
|
|
|
- }
|
|
|
- } else {
|
|
|
- const hsCodeItem = tmp.find((item) => item.field === 'hsCode');
|
|
|
- if (hsCodeItem) {
|
|
|
- // 修改 hsCode 对象的 rules
|
|
|
- hsCodeItem.rules = { required: false, message: '' };
|
|
|
+ if (modelType?.value === MODEL_TYPE.MAIN_ADD || isMain.value) {
|
|
|
+ if (currentFrom.value.asIcs2 === 0) {
|
|
|
+ const hsCodeItem = tmp.find(
|
|
|
+ (item: { field: string }) => item.field === 'hsCode'
|
|
|
+ );
|
|
|
+ if (hsCodeItem) {
|
|
|
+ // 修改 hsCode 对象的 rules
|
|
|
+ hsCodeItem.rules = {
|
|
|
+ required: true,
|
|
|
+ message: '必填项不能为空',
|
|
|
+ };
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const hsCodeItem = tmp.find((item) => item.field === 'hsCode');
|
|
|
+ if (hsCodeItem) {
|
|
|
+ // 修改 hsCode 对象的 rules
|
|
|
+ hsCodeItem.rules = { required: false, message: '' };
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return tmp;
|
|
@@ -448,8 +451,6 @@ const handleSubmit = async (e: any) => {
|
|
|
params.mawbPrice = currentFrom.value.mawbPrice;
|
|
|
params.mawbDetail = currentFrom.value.mawbDetail;
|
|
|
params.asIcs2 = currentFrom.value.asIcs2;
|
|
|
- params.asEawOrEap = currentFrom.value.asEawOrEap;
|
|
|
- console.log(JSON.stringify(params));
|
|
|
const res = await ApiObj.addMainWaybill(params);
|
|
|
if (res.code === 200) {
|
|
|
Message.success('新增主运单成功');
|
|
@@ -468,6 +469,8 @@ const handleSubmit = async (e: any) => {
|
|
|
if (isMain.value) {
|
|
|
params.mawbPrice = currentFrom.value.mawbPrice;
|
|
|
params.mawbDetail = currentFrom.value.mawbDetail;
|
|
|
+ params.asEawOrEap = currentFrom.value.asEawOrEap;
|
|
|
+ params.asIcs2 = currentFrom.value.asIcs2;
|
|
|
params.mawbDetail.fltNo =
|
|
|
params.mawbDetail.fltNoPrefix + params.mawbDetail.fltNoSuffix;
|
|
|
} else {
|
|
@@ -554,9 +557,9 @@ const openDialog = () => {
|
|
|
nextTick(() => {
|
|
|
currentFrom.value.awbContact = { ...fromData.value.awbContact };
|
|
|
if (isMain.value) {
|
|
|
+ currentFrom.value.mawbPrice = { ...fromData.value.mawbPrice };
|
|
|
currentFrom.value.mawbDetail = { ...fromData.value.mawbDetail };
|
|
|
- currentFrom.value.mawbDetail = { ...fromData.value.mawbDetail };
|
|
|
-
|
|
|
+ // mawbPrice.mawbPrice.wtValChgs
|
|
|
// 主运单补录
|
|
|
currentFrom.value.mawbPrice.ccWtChg = setZero(
|
|
|
currentFrom.value.mawbPrice.ccWtChg
|
|
@@ -629,37 +632,43 @@ const plainOptions = reactive([
|
|
|
watch(
|
|
|
() => currentFrom.value.asIcs2,
|
|
|
(newValue, oldValue) => {
|
|
|
- console.log('asIcs2 属性变化了:', newValue);
|
|
|
-
|
|
|
- if (newValue === 0) {
|
|
|
- nextTick(() => {
|
|
|
- // 使用代码动态添加 rules , find才能使页面进行渲染,遍历插入的无法生效
|
|
|
- const cnePostNoItem = gooderInfo.find(
|
|
|
- (item) => item.field === 'cnePostNo'
|
|
|
- );
|
|
|
- if (cnePostNoItem) {
|
|
|
- cnePostNoItem.rules = { required: true, message: '必填项不可为空!' };
|
|
|
- }
|
|
|
- const shpPostNoItem = shipperInfo.find(
|
|
|
- (item) => item.field === 'shpPostNo'
|
|
|
- );
|
|
|
- if (shpPostNoItem) {
|
|
|
- shpPostNoItem.rules = { required: true, message: '必填项不可为空!' };
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- nextTick(() => {
|
|
|
- gooderInfo.forEach((item: any) => {
|
|
|
- if (item.field === 'cnePostNo') {
|
|
|
- item.rules = [];
|
|
|
+ if (modelType?.value === MODEL_TYPE.MAIN_ADD || isMain.value) {
|
|
|
+ if (newValue === 0) {
|
|
|
+ nextTick(() => {
|
|
|
+ // 使用代码动态添加 rules , find才能使页面进行渲染,遍历插入的无法生效
|
|
|
+ const cnePostNoItem = gooderInfo.find(
|
|
|
+ (item) => item.field === 'cnePostNo'
|
|
|
+ );
|
|
|
+ if (cnePostNoItem) {
|
|
|
+ cnePostNoItem.rules = {
|
|
|
+ required: true,
|
|
|
+ message: '必填项不可为空!',
|
|
|
+ };
|
|
|
}
|
|
|
- });
|
|
|
- shipperInfo.forEach((item: any) => {
|
|
|
- if (item.field === 'shpPostNo') {
|
|
|
- item.rules = [];
|
|
|
+ const shpPostNoItem = shipperInfo.find(
|
|
|
+ (item) => item.field === 'shpPostNo'
|
|
|
+ );
|
|
|
+ if (shpPostNoItem) {
|
|
|
+ shpPostNoItem.rules = {
|
|
|
+ required: true,
|
|
|
+ message: '必填项不可为空!',
|
|
|
+ };
|
|
|
}
|
|
|
});
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ nextTick(() => {
|
|
|
+ gooderInfo.forEach((item: any) => {
|
|
|
+ if (item.field === 'cnePostNo') {
|
|
|
+ item.rules = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ shipperInfo.forEach((item: any) => {
|
|
|
+ if (item.field === 'shpPostNo') {
|
|
|
+ item.rules = [];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
);
|