获取list选中行数据,当状态栏位不为【新增】是,点击编辑按钮弹出错误提醒
1.加button按钮
2.
<button class="edit" name="saleoppControl" url="${ctx}/scSaleopp/updateMain/">编辑</button>
<table class="frog-table" id="saleoppTable">
<thead>
<tr>
<th width="30px">序号</th>
<th width="100px">商机编号</th>
<th width="100px">商机名称</th>
<th width="180px">客户</th>
<th width="100px">商机金额</th>
<th width="100px">预计成交日期</th>
<th width="100px">商机阶段</th>
<th width="100px">业务部门</th>
<th width="90px">业务员</th>
<th width="100px">备注</th>
<th width="100px">状态</th>
</tr>
</thead>
<tbody>
<c:forEach items="${list}" var="scSaleopp" varStatus="status">
<tr target="slt_uid" rel="${scSaleopp.id}" id="${scSaleopp.id}">
<td>${page.pageBeginCount + status.index + 1}</td>
<td>${scSaleopp.saleOppNo}</td>
<td>${scSaleopp.saleOppName}</td>
<td>${scSaleopp.custName}</td>
<td>${scSaleopp.saleOppAMt}</td>
<td>${scSaleopp.expectDate}</td>
<td>${saleOppStageMap[scSaleopp.saleOppStage]}</td>
<td>${scSaleopp.salesUnit}</td>
<td>${scSaleopp.salesMan}</td>
<td>${scSaleopp.remark}</td>
<td>${scSaleopp.state}</td>
</tr>
</c:forEach>
</tbody>
</table>
<script>
//按钮管控
$('button[name=saleoppControl]').on('click',function (event) {
let jsObj = event.target;
let url = $(jsObj).attr("url");
let objClass = jsObj.getAttribute("class");
let selectTr = $('#saleoppTable').find('.selected');
let id = selectTr.attr("rel");
let status = selectTr.find("td:eq(10)")[0].innerText;
if(objClass=="edit"){
if (status!="新增"){
Dialog.error("该数据状态非新增,不能执行编辑操作!")
return ;
}
let opt ={
max: true,
title: "编辑界面"
}
Dialog.open(url+id,"",opt);
}
})
</script>