Score
0
Watch 3.3K Star 7.4K Fork 3.5K

卓源软件 / JeeSite 4.xJavaAGPL-3.0

select的二级联动怎么写比较好

Open
xia_alngf  Opened this issue

<div class="form-group">
	<label class="control-label col-sm-4" title=""> <span class="required ">*</span> ${text('所属公司')}:<i class="fa icon-question hide"></i></label>
	<div class="col-sm-8">
	    <#form:listselect id="companyId" path="companyId" title="公司选择" 
	    labelPath="companyName" url="${ctx}/company/zlqCompany/companySelect" allowClear="false" checkbox="false" itemCode="id" itemName="name" />
	</div>
</div>
				
<div class="form-group">
	<label class="control-label col-sm-4" title=""> <span class="required hide">*</span> ${text('员工')}:<i class="fa icon-question hide"></i></label>
	<div class="col-sm-8">
	    <#form:listselect path="staffId" title="员工选择" labelPath="staffName" url="${ctx}/company/zlqStaff/staffSelect" allowClear="false" checkbox="false" itemCode="id" itemName="name" />
	</div>
</div>

两个下拉框已经可以用但是不能联动,第一个查询所有的公司,第二个查询所有的员工,现在想把查询公司的ID作为参数给到员工选择里面。不知道怎么写?

total 2 participants

Comments (1)

马云 2019-12-19 20:14
<script>
	function findByPlace(v) {
		$.ajax({
			type : "post",
			async : false,
			url : "${ctx}/knowledge/knowledgeBase/getTypeByPlaceId",
			data : {
				'faultPlaceId' : v
			},
			dataType : "json",
			success : function(msg) {
				$("#faultTypeId").empty();
				// console.log(msg);
				if (msg.length > 0) {
					for (var i = 0; i < msg.length; i++) {
						var partId = msg[i].id;
						var partName = msg[i].name;
						var option = $("<option>").attr({
							"value" : partId
						}).text(partName);
						$("#faultTypeId").append(option);
					}
					$("#faultTypeId option:first").prop("selected", 'selected');
					$("#faultTypeId").change();

				}
			},
			error : function(json) {
				$.jBox.alert("网络异常!");
			}
		});
	}

onchange="findtemplate(this.options[this.options.selectedIndex].value)

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
Java
1
https://gitee.com/thinkgem/jeesite4.git
git@gitee.com:thinkgem/jeesite4.git
thinkgem
jeesite4
JeeSite 4.x

Help Search