|
@ -50,19 +50,22 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">收货联系人:</label> |
|
|
<label class="col-sm-3 control-label">收货联系人(Ship To):</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<input name="customerDelivery" th:field="*{customerDelivery}" class="form-control" type="text" disabled> |
|
|
<select class="form-control" name="customerDelivery" th:field="*{customerDelivery}" id="customerDelivery" required> |
|
|
|
|
|
<!-- 这里动态生成生产单号选项 --> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">收货电话:</label> |
|
|
<label class="col-sm-3 control-label">收货电话(Ship To):</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" disabled> |
|
|
<input name="deliveryPhone" th:field="*{deliveryPhone}" class="form-control" type="text" disabled> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-3 control-label">收货地址:</label> |
|
|
<label class="col-sm-3 control-label">收货地址(Ship To):</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" disabled> |
|
|
<input name="deliveryAddress" th:field="*{deliveryAddress}" class="form-control" type="text" disabled> |
|
|
</div> |
|
|
</div> |
|
@ -138,6 +141,70 @@ |
|
|
$.operate.saveJson(prefix + "/salesDeliverGoods", jsonData); |
|
|
$.operate.saveJson(prefix + "/salesDeliverGoods", jsonData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadCustomerDelivery(); |
|
|
|
|
|
//获取已经选择客户Id相关的生产单号 |
|
|
|
|
|
function loadCustomerDelivery() { |
|
|
|
|
|
const url = ctx + 'system/customer/shippingList'; |
|
|
|
|
|
const data = { |
|
|
|
|
|
enterpriseCode: sysSalesOrder.enterpriseCode, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 使用 $.ajax 发送请求 |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
type: 'POST', |
|
|
|
|
|
url: url, |
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
data: data, |
|
|
|
|
|
success: function(response) { |
|
|
|
|
|
console.log("response:", response); |
|
|
|
|
|
|
|
|
|
|
|
if (response.code === 0 && Array.isArray(response.rows) && response.rows.length > 0) { |
|
|
|
|
|
const selectElement = $('#customerDelivery'); |
|
|
|
|
|
selectElement.empty(); |
|
|
|
|
|
|
|
|
|
|
|
// 存储每个客户名称对应的信息 |
|
|
|
|
|
const customerDataMap = {}; |
|
|
|
|
|
|
|
|
|
|
|
// 遍历返回的数据,添加为下拉框的选项并存储数据 |
|
|
|
|
|
$.each(response.rows, function(index, item) { |
|
|
|
|
|
const customerName = item.customerName; |
|
|
|
|
|
customerDataMap[customerName] = item; // 存储数据 |
|
|
|
|
|
|
|
|
|
|
|
// 添加选项到下拉框 |
|
|
|
|
|
selectElement.append($('<option>', {value: customerName}).text(customerName)); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 监听下拉框的选择变化 |
|
|
|
|
|
selectElement.on('change', function() { |
|
|
|
|
|
const selectedCustomerName = $(this).val(); |
|
|
|
|
|
if (selectedCustomerName in customerDataMap) { |
|
|
|
|
|
const selectedCustomer = customerDataMap[selectedCustomerName]; |
|
|
|
|
|
$('#deliveryPhone').val(selectedCustomer.customerPhone); |
|
|
|
|
|
$('#deliveryAddress').val(selectedCustomer.deliveryAddress); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 如果已经有了默认选项,则设置默认值 |
|
|
|
|
|
if (selectElement.children('option').length > 0) { |
|
|
|
|
|
selectElement.trigger('change'); |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
// 显示错误消息 |
|
|
|
|
|
$.modal.alertWarning("数据为空"); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
error: function(xhr, status, error) { |
|
|
|
|
|
// 处理错误情况 |
|
|
|
|
|
console.error('AJAX Error:', error); |
|
|
|
|
|
$.modal.alertWarning("请求失败,请稍后再试。"); |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//物料信息展示列表 |
|
|
//物料信息展示列表 |
|
|
$(function() { |
|
|
$(function() { |
|
|
var options = { |
|
|
var options = { |
|
|