|
|
@ -351,50 +351,51 @@ const search = val => { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
function updateOptions(allDropdowns) { |
|
|
|
function updateOptions(allDropdowns) { |
|
|
|
// 拉平所有的下拉框组到一个单一数组中 |
|
|
|
// 拉平所有的下拉框组到一个单一数组中 |
|
|
|
let dropdowns = [].concat(...allDropdowns); |
|
|
|
let dropdowns = [].concat(...allDropdowns); |
|
|
|
|
|
|
|
|
|
|
|
// 遍历每个下拉框 |
|
|
|
// 遍历每个下拉框 |
|
|
|
dropdowns.forEach((dropdown, index, self) => { |
|
|
|
dropdowns.forEach((dropdown, index, self) => { |
|
|
|
// 取出当前下拉框选中的值 |
|
|
|
// 取出当前下拉框选中的值 |
|
|
|
let selectedValue = dropdown.Warehousecategory; |
|
|
|
let selectedValue = dropdown.Warehousecategory; |
|
|
|
|
|
|
|
|
|
|
|
// 更新其他下拉框的options状态 |
|
|
|
// 更新其他下拉框的options状态 |
|
|
|
self.forEach(otherDropdown => { |
|
|
|
self.forEach(otherDropdown => { |
|
|
|
if (dropdown !== otherDropdown) { // 确保不是自身 |
|
|
|
if (dropdown !== otherDropdown) { |
|
|
|
otherDropdown.options.forEach(option => { |
|
|
|
// 确保不是自身 |
|
|
|
// 如果选项值和当前下拉框选中值相同,则禁用该选项 |
|
|
|
otherDropdown.options.forEach(option => { |
|
|
|
if (option.value === selectedValue) { |
|
|
|
// 如果选项值和当前下拉框选中值相同,则禁用该选项 |
|
|
|
option.disabled = true; |
|
|
|
if (option.value === selectedValue) { |
|
|
|
} else { |
|
|
|
option.disabled = true; |
|
|
|
// 如果其他逻辑导致应保持禁用,可以在这里加上,下面的语句是检查是否已在别处被选中 |
|
|
|
} else { |
|
|
|
let isSelectedSomewhereElse = self.some(d => d !== otherDropdown && d.Warehousecategory === option.value); |
|
|
|
// 如果其他逻辑导致应保持禁用,可以在这里加上,下面的语句是检查是否已在别处被选中 |
|
|
|
option.disabled = isSelectedSomewhereElse; |
|
|
|
let isSelectedSomewhereElse = self.some( |
|
|
|
} |
|
|
|
d => d !== otherDropdown && d.Warehousecategory === option.value |
|
|
|
}); |
|
|
|
); |
|
|
|
} |
|
|
|
option.disabled = isSelectedSomewhereElse; |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 选择框值发生改变 |
|
|
|
// 选择框值发生改变 |
|
|
|
const selectChange = data => { |
|
|
|
const selectChange = data => { |
|
|
|
// console.log(data, 'data'); |
|
|
|
// console.log(data, 'data'); |
|
|
|
// console.log(form.value.dispatchCubeCategoryData,'dispatchCubeCategoryData111'); |
|
|
|
// console.log(form.value.dispatchCubeCategoryData,'dispatchCubeCategoryData111'); |
|
|
|
// console.log(form.value.dispatchWeightCategoryData,'dispatchWeightCategoryData222'); |
|
|
|
// console.log(form.value.dispatchWeightCategoryData,'dispatchWeightCategoryData222'); |
|
|
|
// console.log(form.value.dispatchPieceCategoryData,'dispatchPieceCategoryData333'); |
|
|
|
// console.log(form.value.dispatchPieceCategoryData,'dispatchPieceCategoryData333'); |
|
|
|
|
|
|
|
|
|
|
|
let allDropdowns = [form.value.StoragecategoryData]; |
|
|
|
|
|
|
|
// 更新选项 |
|
|
|
|
|
|
|
updateOptions(allDropdowns); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let allDropdowns = [form.value.StoragecategoryData]; |
|
|
|
|
|
|
|
// 更新选项 |
|
|
|
|
|
|
|
updateOptions(allDropdowns); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
const wxselectChange = () => { |
|
|
|
|
|
|
|
let allDropdowns = [form.value.AdditionalcategoriesData]; |
|
|
|
|
|
|
|
// 更新选项 |
|
|
|
|
|
|
|
updateOptions(allDropdowns); |
|
|
|
}; |
|
|
|
}; |
|
|
|
const wxselectChange=()=>{ |
|
|
|
|
|
|
|
let allDropdowns = [form.value.AdditionalcategoriesData]; |
|
|
|
|
|
|
|
// 更新选项 |
|
|
|
|
|
|
|
updateOptions(allDropdowns); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const formCopy = ref({}); //拷贝对象 |
|
|
|
const formCopy = ref({}); //拷贝对象 |
|
|
|
const SelectOpin = ref(null); //当前点击的品类搜索框 |
|
|
|
const SelectOpin = ref(null); //当前点击的品类搜索框 |
|
|
|
const $route = useRoute(); //获取地址栏参数 |
|
|
|
const $route = useRoute(); //获取地址栏参数 |
|
|
@ -659,81 +660,80 @@ const Submit = () => { |
|
|
|
if (!valid) { |
|
|
|
if (!valid) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
ElMessageBox.confirm('是否保存?', '提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
|
|
}).then(async () => { |
|
|
|
|
|
|
|
pageLoading.value = true; |
|
|
|
|
|
|
|
await emit('request-data'); //通知父页面传递数据 |
|
|
|
|
|
|
|
console.log(props, 'props'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!props.templateData.TemplateName) { |
|
|
|
await emit('request-data'); //通知父页面传递数据 |
|
|
|
|
|
|
|
console.log(props, 'props'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!props.templateData.TemplateName) { |
|
|
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
|
|
message: '请输入模板名称', |
|
|
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
form.value.name = props.templateData.TemplateName; //模板名称 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!props.templateData.brand) { |
|
|
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
|
|
message: '请选择品牌', |
|
|
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
form.value.brandId = props.templateData.brand; //品牌ID |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
form.value.serviceType = props.templateData.ServiceType.join(','); //顶部选择的服务类型 |
|
|
|
|
|
|
|
// 如果勾选了区分品类判断是否填写了仓储品类配置 |
|
|
|
|
|
|
|
if (form.value.warehouseIsByCategory) { |
|
|
|
|
|
|
|
let storage = form.value.StoragecategoryData.find(res => !res.warehousePieceCategory); //查看仓储品类配置是否完全没有填写 |
|
|
|
|
|
|
|
if (storage) { |
|
|
|
|
|
|
|
// 如果勾选了,并且查到了有没有填写的就提示必须填写 |
|
|
|
ElMessage({ |
|
|
|
ElMessage({ |
|
|
|
message: '请输入模板名称', |
|
|
|
message: '请填完整写仓储品类配置', |
|
|
|
type: 'warning', |
|
|
|
type: 'warning', |
|
|
|
}); |
|
|
|
}); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
form.value.name = props.templateData.TemplateName; //模板名称 |
|
|
|
// 如果都填写了进行数据处理 |
|
|
|
|
|
|
|
form.value.warehousePieceCategory = form.value.StoragecategoryData.map( |
|
|
|
|
|
|
|
res => res.warehousePieceCategory |
|
|
|
|
|
|
|
).join(','); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (form.value.warehousePieceCategory) { |
|
|
|
|
|
|
|
form.value.warehousePieceCategory = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!props.templateData.brand) { |
|
|
|
} |
|
|
|
|
|
|
|
// 如果勾选了附加费是否按品类计费判断是否填写了附加品类配置 |
|
|
|
|
|
|
|
if (form.value.warehouseIsCategorySubjoin) { |
|
|
|
|
|
|
|
let Surcharge = form.value.AdditionalcategoriesData.find(res => !res.warehousePieceCategory); //查看附加费品类配置是否完全没有填写 |
|
|
|
|
|
|
|
if (Surcharge) { |
|
|
|
|
|
|
|
// 如果勾选了,并且查到了有没有填写的就提示必须填写 |
|
|
|
ElMessage({ |
|
|
|
ElMessage({ |
|
|
|
message: '请选择品牌', |
|
|
|
message: '请填写完整附加品类配置', |
|
|
|
type: 'warning', |
|
|
|
type: 'warning', |
|
|
|
}); |
|
|
|
}); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
form.value.brandId = props.templateData.brand; //品牌ID |
|
|
|
// 如果都填写了进行数据处理 |
|
|
|
} |
|
|
|
form.value.warehouseSubjoinCategory = form.value.AdditionalcategoriesData.map( |
|
|
|
form.value.serviceType = props.templateData.ServiceType.join(','); //顶部选择的服务类型 |
|
|
|
res => res.warehousePieceCategory |
|
|
|
// 如果勾选了区分品类判断是否填写了仓储品类配置 |
|
|
|
).join(','); |
|
|
|
if (form.value.warehouseIsByCategory) { |
|
|
|
|
|
|
|
let storage = form.value.StoragecategoryData.find(res => !res.warehousePieceCategory); //查看仓储品类配置是否完全没有填写 |
|
|
|
|
|
|
|
if (storage) { |
|
|
|
|
|
|
|
// 如果勾选了,并且查到了有没有填写的就提示必须填写 |
|
|
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
|
|
message: '请填完整写仓储品类配置', |
|
|
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果都填写了进行数据处理 |
|
|
|
|
|
|
|
form.value.warehousePieceCategory = form.value.StoragecategoryData.map( |
|
|
|
|
|
|
|
res => res.warehousePieceCategory |
|
|
|
|
|
|
|
).join(','); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (form.value.warehousePieceCategory) { |
|
|
|
|
|
|
|
form.value.warehousePieceCategory = ''; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 如果勾选了附加费是否按品类计费判断是否填写了附加品类配置 |
|
|
|
} else { |
|
|
|
if (form.value.warehouseIsCategorySubjoin) { |
|
|
|
if (form.value.warehouseSubjoinCategory) { |
|
|
|
let Surcharge = form.value.AdditionalcategoriesData.find( |
|
|
|
form.value.warehouseSubjoinCategory = ''; |
|
|
|
res => !res.warehousePieceCategory |
|
|
|
|
|
|
|
); //查看附加费品类配置是否完全没有填写 |
|
|
|
|
|
|
|
if (Surcharge) { |
|
|
|
|
|
|
|
// 如果勾选了,并且查到了有没有填写的就提示必须填写 |
|
|
|
|
|
|
|
ElMessage({ |
|
|
|
|
|
|
|
message: '请填写完整附加品类配置', |
|
|
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果都填写了进行数据处理 |
|
|
|
|
|
|
|
form.value.warehouseSubjoinCategory = form.value.AdditionalcategoriesData.map( |
|
|
|
|
|
|
|
res => res.warehousePieceCategory |
|
|
|
|
|
|
|
).join(','); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (form.value.warehouseSubjoinCategory) { |
|
|
|
|
|
|
|
form.value.warehouseSubjoinCategory = ''; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log(form.value, '要提交的参数'); |
|
|
|
console.log(form.value, '要提交的参数'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ElMessageBox.confirm('是否保存?', '提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
|
|
type: 'warning', |
|
|
|
|
|
|
|
}).then(async () => { |
|
|
|
|
|
|
|
pageLoading.value = true; |
|
|
|
if (props.templateData.code || $route.query.id) { |
|
|
|
if (props.templateData.code || $route.query.id) { |
|
|
|
// 编辑接口 |
|
|
|
// 编辑接口 |
|
|
|
let data = { |
|
|
|
let data = { |
|
|
@ -742,6 +742,7 @@ const Submit = () => { |
|
|
|
checkType: '3', //服务类型(仓储固定参数) |
|
|
|
checkType: '3', //服务类型(仓储固定参数) |
|
|
|
}; |
|
|
|
}; |
|
|
|
console.log('编辑操作'); |
|
|
|
console.log('编辑操作'); |
|
|
|
|
|
|
|
|
|
|
|
$_putpriceTemplate(data) |
|
|
|
$_putpriceTemplate(data) |
|
|
|
.then(res => { |
|
|
|
.then(res => { |
|
|
|
console.log(res, '编辑成功之后返回值'); |
|
|
|
console.log(res, '编辑成功之后返回值'); |
|
|
|