|
|
@ -83,7 +83,7 @@ |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">客户名称:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="enterpriseName" class="form-control" type="text" readonly> |
|
|
|
<input id="enterpriseName" name="enterpriseName" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
@ -262,8 +262,9 @@ |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">业务员:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select name="businessMembers" id="businessMembers_add" class="form-control" required > |
|
|
|
</select> |
|
|
|
<input name="businessMembers" id="businessMembers_add" class="form-control" type="text" readonly required> |
|
|
|
<!-- <select name="businessMembers" id="businessMembers_add" class="form-control" required >--> |
|
|
|
<!-- </select>--> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="container"> |
|
|
@ -318,8 +319,10 @@ |
|
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
var loginName = [[${@permission.getPrincipalProperty('loginName')}]]; |
|
|
|
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]]; |
|
|
|
var customerList = []; |
|
|
|
var prefix = ctx + "system/salesOrder" |
|
|
|
$(function() { |
|
|
|
$("#businessMembers_add").val(loginName); |
|
|
|
var options = { |
|
|
|
id:'bootstrap-sub-table-order', |
|
|
|
pagination: false, |
|
|
@ -511,22 +514,22 @@ |
|
|
|
|
|
|
|
function selectBuniesessMembers(){ |
|
|
|
//获取业务员 |
|
|
|
$.ajax({ |
|
|
|
url: ctx + 'system/salesOrder/getBinessMembers', |
|
|
|
type: 'get', |
|
|
|
success: function (res) { |
|
|
|
console.log(res) |
|
|
|
if (res.rows.length > 0) { |
|
|
|
var usertData = res.rows; |
|
|
|
for (let i in usertData) { |
|
|
|
$("select[name='businessMembers']").append( |
|
|
|
"<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
$.modal.msgError(res.msg); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
// $.ajax({ |
|
|
|
// url: ctx + 'system/salesOrder/getBinessMembers', |
|
|
|
// type: 'get', |
|
|
|
// success: function (res) { |
|
|
|
// console.log(res) |
|
|
|
// if (res.rows.length > 0) { |
|
|
|
// var usertData = res.rows; |
|
|
|
// for (let i in usertData) { |
|
|
|
// $("select[name='businessMembers']").append( |
|
|
|
// "<option value='" + usertData[i].userName + "'>" + usertData[i].userName + "</option>"); |
|
|
|
// } |
|
|
|
// } else { |
|
|
|
// $.modal.msgError(res.msg); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// }); |
|
|
|
//获取单号 |
|
|
|
$.ajax({ |
|
|
|
url: prefix + "/getId", |
|
|
@ -543,33 +546,72 @@ |
|
|
|
allowClear: true, |
|
|
|
placeholder: "请选择客户", |
|
|
|
ajax:{ |
|
|
|
type: "post", |
|
|
|
url:ctx + "system/customer/customerList", |
|
|
|
type: "get", |
|
|
|
url:ctx + "system/customer/matchCustomerList", |
|
|
|
dataType:"json", |
|
|
|
delay:250, |
|
|
|
timeout: 10000, // 设置超时时间为10秒 |
|
|
|
cache:true, |
|
|
|
processResults: function (res, params) { |
|
|
|
var resultList = res.rows; |
|
|
|
console.log("传输的数值"); |
|
|
|
console.log(resultList); |
|
|
|
var options = []; |
|
|
|
for(var i= 0, len=resultList.length;i<len;i++){ |
|
|
|
var option = resultList[i]; |
|
|
|
option.id = resultList[i]["enterpriseCode"]; |
|
|
|
option.text = resultList[i]["enterpriseCode"]; |
|
|
|
options.push(option); |
|
|
|
} |
|
|
|
return { |
|
|
|
results: options, |
|
|
|
pagination: { |
|
|
|
if(res.code==0){ |
|
|
|
var resultList = res.data; |
|
|
|
customerList = resultList; |
|
|
|
// console.log(customerList); |
|
|
|
for(var i= 0, len=resultList.length;i<len;i++){ |
|
|
|
var option = resultList[i]; |
|
|
|
option.id = resultList[i]["enterpriseCode"]; |
|
|
|
option.text = resultList[i]["enterpriseCode"]; |
|
|
|
options.push(option); |
|
|
|
} |
|
|
|
return { |
|
|
|
results: options |
|
|
|
} |
|
|
|
}; |
|
|
|
return { |
|
|
|
results: [], |
|
|
|
// pagination: { |
|
|
|
// } |
|
|
|
}; |
|
|
|
}, |
|
|
|
escapeMarkup: function (markup) { return markup; }, |
|
|
|
// minimumInputLength: 1 |
|
|
|
minimumInputLength: 1 |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
$('#enterpriseName').on('input', function () { |
|
|
|
var enterpriseName = $(this).val().trim(); |
|
|
|
// 触发一次搜索以确保选项被加载 |
|
|
|
$("select[name='enterpriseCode']").val('').trigger('change'); // 清空下拉框 |
|
|
|
$("select[name='enterpriseCode']").val('').trigger('input'); // 触发输入事件,以重新加载下拉框 |
|
|
|
// 查找匹配的客户编号 |
|
|
|
var matchingCustomer = customerList.find(function (customer) { |
|
|
|
return customer.enterpriseName === enterpriseName; |
|
|
|
}); |
|
|
|
// console.log(customerList); |
|
|
|
console.log(matchingCustomer); |
|
|
|
if (matchingCustomer) { |
|
|
|
// 确保值已经存在于下拉框中 |
|
|
|
var enterpriseCode = matchingCustomer.enterpriseCode; |
|
|
|
|
|
|
|
console.log("下拉框的所有选项:"); |
|
|
|
var allOptions = $("select[name='enterpriseCode']").select2('data'); |
|
|
|
allOptions.forEach(function(option) { |
|
|
|
console.log("选项值:", option.id, "选项文本:", option.text); |
|
|
|
}); |
|
|
|
// 检查下拉框是否包含该值 |
|
|
|
if ($("select[name='enterpriseCode']").find("option[value='" + enterpriseCode + "']").length > 0) { |
|
|
|
// 设置下拉框的值 |
|
|
|
$("select[name='enterpriseCode']").val(enterpriseCode).trigger('change'); |
|
|
|
} else { |
|
|
|
console.error("尝试设置的值不存在于下拉框中:", enterpriseCode); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 清空下拉框的值 |
|
|
|
// $("select[name='enterpriseCode']").val(null).trigger('change'); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$('#enterpriseCode').on('select2:select', function (e) { |
|
|
|
var data = e.params.data; |
|
|
|
$("input[name='enterpriseName']").val(data.enterpriseName); |
|
|
|