diff --git a/src/main/webapp/jsp/kpi/kpiPlanAdd.jsp b/src/main/webapp/jsp/kpi/kpiPlanAdd.jsp index 80232d5f..a63c3e56 100644 --- a/src/main/webapp/jsp/kpi/kpiPlanAdd.jsp +++ b/src/main/webapp/jsp/kpi/kpiPlanAdd.jsp @@ -62,7 +62,8 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD selelct_4.val('').trigger("change"); - //TODO 代码有冲突 + // Initialize job dropdown with all jobs + onValueChange(); key = setInterval(() => { // console.log(document.getElementById('objUserName')) if ($('#objUserId').val() != old) { @@ -172,9 +173,17 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD function onValueChange() { // console.log($('#objUserId').val()) - $.post(ext.contextPath + "/user/getJsonJobByUser.do?userId=" + $('#objUserId').val(), function (data) { + $.get(ext.contextPath + "/user/getJsonJob.do", function (data) { + // Transform data to Select2 format: {id, text} + var transformedData = []; + $.each(data, function(index, item) { + transformedData.push({ + id: item.id, + text: item.name + }); + }); $("#jobId").select2({ - data: data, + data: transformedData, cache: false, placeholder: '请选择',//默认文字提示 // allowClear: true,//允许清空