Commit fbd61e11 by yyq1988

代码优化

parent dd57d543
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
} }
function removeRow(index, rowId, rowDelFlag){ function removeRow(index, rowId, rowDelFlag){
if(rowId){ if(rowId){
var delFlag = rowDelFlag === 1 ? 0 : 1 var delFlag = rowDelFlag == 1 ? 0 : 1
updateRow(index, { updateRow(index, {
delFlag: delFlag delFlag: delFlag
}) })
......
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
function removeRow(index, rowId, rowDelFlag) { function removeRow(index, rowId, rowDelFlag) {
if (rowId) { if (rowId) {
var delFlag = rowDelFlag === 1 ? 0 : 1 var delFlag = rowDelFlag == 1 ? 0 : 1
updateRow(index, { updateRow(index, {
delFlag: delFlag delFlag: delFlag
}) })
......
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
function removeRow(index, rowId, rowDelFlag) { function removeRow(index, rowId, rowDelFlag) {
if (rowId) { if (rowId) {
var delFlag = rowDelFlag === 1 ? 0 : 1 var delFlag = rowDelFlag == 1 ? 0 : 1
updateRow(index, { updateRow(index, {
delFlag: delFlag delFlag: delFlag
}) })
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
field: '', field: '',
title: '操作', title: '操作',
formatter: function (value, row, index) { formatter: function (value, row, index) {
var text = '删除'; var text = row.delFlag == 1 ? '撤销删除' : '删除';
var result = ["<a href='javascript:void(0);' onclick=\"removeRow(" + index + ", '" + row.id + "', '" + row.delFlag + "')\">" + text + "</a>"] var result = ["<a href='javascript:void(0);' onclick=\"removeRow(" + index + ", '" + row.id + "', '" + row.delFlag + "')\">" + text + "</a>"]
return result.join(''); return result.join('');
} }
...@@ -183,10 +183,17 @@ ...@@ -183,10 +183,17 @@
} }
function removeRow(index, rowId, rowDelFlag) { function removeRow(index, rowId, rowDelFlag) {
$(selector).bootstrapTable("remove", { if (rowId && rowId != 'undefined') {
field: '$index', var delFlag = rowDelFlag == 1 ? 0 : 1
values: [index] updateRow(index, {
}) delFlag: delFlag
})
} else {
$(selector).bootstrapTable("remove", {
field: '$index',
values: [index]
})
}
} }
function updateRow(index, row) { function updateRow(index, row) {
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
function removeRow(index, rowId, rowDelFlag) { function removeRow(index, rowId, rowDelFlag) {
if (rowId) { if (rowId) {
var delFlag = rowDelFlag === 1 ? 0 : 1 var delFlag = rowDelFlag == 1 ? 0 : 1
updateRow(index, { updateRow(index, {
delFlag: delFlag delFlag: delFlag
}) })
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
*/ */
function removeRow(index, rowId, rowDelFlag){ function removeRow(index, rowId, rowDelFlag){
if(rowId){ if(rowId){
var delFlag = rowDelFlag === 1 ? 0 : 1 var delFlag = rowDelFlag == 1 ? 0 : 1
updateRow(index, { updateRow(index, {
delFlag: delFlag delFlag: delFlag
}) })
......
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
*/ */
function removeRow(index, rowId, rowDelFlag){ function removeRow(index, rowId, rowDelFlag){
if(rowId){ if(rowId){
var delFlag = rowDelFlag === 1 ? 0 : 1 var delFlag = rowDelFlag == 1 ? 0 : 1
updateRow(index, { updateRow(index, {
delFlag: delFlag delFlag: delFlag
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment