修改收支项目js效率低下的问题
This commit is contained in:
@@ -142,11 +142,18 @@
|
|||||||
{title: '类型', field: 'type', width: 100, align: "center"},
|
{title: '类型', field: 'type', width: 100, align: "center"},
|
||||||
{title: '描述', field: 'remark', width: 200},
|
{title: '描述', field: 'remark', width: 200},
|
||||||
{
|
{
|
||||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
||||||
|
/**
|
||||||
|
* create by: qiankunpingtai
|
||||||
|
* create time: 2019/5/5 10:30
|
||||||
|
* website:https://qiankunpingtai.cn
|
||||||
|
* description:
|
||||||
|
* 修改效率低下的js实现
|
||||||
|
*/
|
||||||
var str = '';
|
var str = '';
|
||||||
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type + 'AaBb' + rec.remark;
|
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type + 'AaBb' + rec.remark;
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editInOutItem(\'' + rowInfo + '\');"/> <a onclick="editInOutItem(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editInOutItem(\'' + index + '\');"/> <a onclick="editInOutItem(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteInOutItem(\'' + rowInfo + '\');"/> <a onclick="deleteInOutItem(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteInOutItem(\'' + rec.id + '\');"/> <a onclick="deleteInOutItem(\'' + rec.id + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,16 +226,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除收支项目
|
//删除收支项目
|
||||||
function deleteInOutItem(inOutItemInfo) {
|
function deleteInOutItem(id) {
|
||||||
$.messager.confirm('删除确认', '确定要删除此收支项目吗?', function (r) {
|
$.messager.confirm('删除确认', '确定要删除此收支项目吗?', function (r) {
|
||||||
if (r) {
|
if (r) {
|
||||||
var inOutItemTotalInfo = inOutItemInfo.split("AaBb");
|
// var inOutItemTotalInfo = inOutItemInfo.split("AaBb");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/inOutItem/batchDeleteInOutItemByIds",
|
url: "/inOutItem/batchDeleteInOutItemByIds",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: ({
|
data: ({
|
||||||
ids: inOutItemTotalInfo[0]
|
ids: id
|
||||||
}),
|
}),
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
if(res && res.code == 200) {
|
if(res && res.code == 200) {
|
||||||
@@ -236,7 +243,7 @@
|
|||||||
} else {
|
} else {
|
||||||
if(res && res.code == 601){
|
if(res && res.code == 601){
|
||||||
var jsondata={};
|
var jsondata={};
|
||||||
jsondata.ids=inOutItemTotalInfo[0];
|
jsondata.ids=id;
|
||||||
jsondata.deleteType='2';
|
jsondata.deleteType='2';
|
||||||
var type='single';
|
var type='single';
|
||||||
batDeleteInOutItemForceConfirm(res,"/inOutItem/batchDeleteInOutItemByIds",jsondata,type);
|
batDeleteInOutItemForceConfirm(res,"/inOutItem/batchDeleteInOutItemByIds",jsondata,type);
|
||||||
@@ -398,21 +405,23 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
//编辑收支项目
|
//编辑收支项目
|
||||||
function editInOutItem(inOutItemTotalInfo) {
|
function editInOutItem(index) {
|
||||||
var inOutItemInfo = inOutItemTotalInfo.split("AaBb");
|
// var inOutItemInfo = inOutItemTotalInfo.split("AaBb");
|
||||||
|
//获取当前行
|
||||||
|
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||||
var row = {
|
var row = {
|
||||||
name: inOutItemInfo[1],
|
name: rowsdata.name,
|
||||||
type: inOutItemInfo[2],
|
type: rowsdata.type,
|
||||||
remark: inOutItemInfo[3]
|
remark: rowsdata.remark
|
||||||
};
|
};
|
||||||
oldInOutItem = inOutItemInfo[1];
|
oldInOutItem = rowsdata.name;
|
||||||
$('#inOutItemDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑收支项目');
|
$('#inOutItemDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑收支项目');
|
||||||
$(".window-mask").css({width: webW, height: webH});
|
$(".window-mask").css({width: webW, height: webH});
|
||||||
$('#inOutItemFM').form('load', row);
|
$('#inOutItemFM').form('load', row);
|
||||||
inOutItemID = inOutItemInfo[0];
|
inOutItemID = rowsdata.id;
|
||||||
//焦点在名称输入框==定焦在输入文字后面
|
//焦点在名称输入框==定焦在输入文字后面
|
||||||
$("#inOutItem").val("").focus().val(inOutItemInfo[1]);
|
$("#inOutItem").val("").focus().val(rowsdata.name);
|
||||||
url = '/inOutItem/update?id=' + inOutItemInfo[0];
|
url = '/inOutItem/update?id=' + rowsdata.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
//检查收支项目 名称是否存在 ++ 重名无法提示问题需要跟进
|
//检查收支项目 名称是否存在 ++ 重名无法提示问题需要跟进
|
||||||
|
|||||||
Reference in New Issue
Block a user