From e078216c29fcde02d5b9bf033f0010df730e2c33 Mon Sep 17 00:00:00 2001 From: qiankunpingtai Date: Mon, 6 May 2019 10:16:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A1=E9=87=8F=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86js=E6=95=88=E7=8E=87=E4=BD=8E?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- erp_web/pages/manage/unit.html | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/erp_web/pages/manage/unit.html b/erp_web/pages/manage/unit.html index c36b433a..1e1a841e 100644 --- a/erp_web/pages/manage/unit.html +++ b/erp_web/pages/manage/unit.html @@ -116,10 +116,17 @@ {field: 'id', width: 35, align: "center", checkbox: true}, { title: '操作', field: 'op', align: "center", width: 60, - formatter: function (value, rec) { + formatter: function (value, rec,index) { + /** + * create by: qiankunpingtai + * create time: 2019/5/6 9:33 + * website:https://qiankunpingtai.cn + * description: + * 修改效率低下的js实现 + */ var str = ''; - var rowInfo = rec.id + 'AaBb' + rec.uname; - str += '   '; + // var rowInfo = rec.id + 'AaBb' + rec.uname; + str += '   '; str += ''; return str; } @@ -370,15 +377,16 @@ }); //编辑信息 - function editUnit(unitTotalInfo) { - var unitInfo = unitTotalInfo.split("AaBb"); - - oldUnit = unitInfo[1]; + function editUnit(index) { + // var unitInfo = unitTotalInfo.split("AaBb"); + //获取当前行 + var rowsdata = $("#tableData").datagrid("getRows")[index]; + oldUnit = rowsdata.uname; $('#unitDlg').dialog('open').dialog('setTitle', ' 编辑计量单位'); $(".window-mask").css({width: webW, height: webH}); - unitID = unitInfo[0]; + unitID = rowsdata.id; //焦点在名称输入框==定焦在输入文字后面 - var name = unitInfo[1]; + var name = rowsdata.uname; var basicName = name.substring(0, name.indexOf(",")); //基础单位 $("#basicName").val(basicName); var otherItem = name.substring(name.indexOf(",") + 1); @@ -388,7 +396,7 @@ lastNum = lastNum.replace(")", ""); $("#otherNum").val(lastNum); $("#unitName").text(basicName); - url = '/unit/update?id=' + unitInfo[0]; + url = '/unit/update?id=' + rowsdata.id; } //检查名称是否存在 ++ 重名无法提示问题需要跟进