Authored by 王涛

Merge branch 'master-500-dev-joke' into 'master-500-dev'

解决选择指标后切换页码后回显错误问题

解决选择指标后切换页码后回显错误问题

See merge request !752
@@ -108,8 +108,9 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -108,8 +108,9 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
108 { 108 {
109 title: '唯一标志', align: 'center', 109 title: '唯一标志', align: 'center',
110 templet: function (d) { 110 templet: function (d) {
111 - var radioDom = $('<input type="checkbox" name="isUnique" data-index="' + d.LAY_TABLE_INDEX + '" lay-skin="switch" lay-text="是|否" lay-filter="switchIsUnique">') ;  
112 - if (d.isUnique === '1') { //当是1时,表示时唯一标志 111 + var radioDom = $('<input type="checkbox" name="isUnique" data-index="' + (d.LAY_INDEX-1) + '" lay-skin="switch" lay-text="是|否" lay-filter="switchIsUnique">') ;
  112 + var isUnique = kpiFlagTableData[(d.LAY_INDEX-1)].isUnique;
  113 + if (isUnique === '1') { //当是1时,表示时唯一标志
113 radioDom.attr('checked', true); 114 radioDom.attr('checked', true);
114 }else{ 115 }else{
115 radioDom.attr('checked', false); 116 radioDom.attr('checked', false);
@@ -120,14 +121,15 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -120,14 +121,15 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
120 { 121 {
121 title: '排序', align: 'center', 122 title: '排序', align: 'center',
122 templet: function (d) { 123 templet: function (d) {
123 - var selectDom = $('<select class="defaultSortSel" class="layui-select" data-index="' + d.LAY_TABLE_INDEX + '" lay-filter="select-kpiflag-table-isSort">' + 124 + var selectDom = $('<select class="defaultSortSel" class="layui-select" data-index="' + (d.LAY_INDEX-1) + '" lay-filter="select-kpiflag-table-isSort">' +
124 '<option>无</option>' + 125 '<option>无</option>' +
125 '<option>正序</option>' + 126 '<option>正序</option>' +
126 '<option>倒序</option>' + 127 '<option>倒序</option>' +
127 '</select>'); 128 '</select>');
128 - if (d.defaultSort == 'asc') { 129 + var defaultSort = kpiFlagTableData[(d.LAY_INDEX-1)].defaultSort;
  130 + if (defaultSort == 'asc') {
129 selectDom.find('option:contains("正序")').attr('selected', 'selected'); 131 selectDom.find('option:contains("正序")').attr('selected', 'selected');
130 - } else if (d.defaultSort == 'desc') { 132 + } else if (defaultSort == 'desc') {
131 selectDom.find('option:contains("倒序")').attr('selected', 'selected'); 133 selectDom.find('option:contains("倒序")').attr('selected', 'selected');
132 } else { 134 } else {
133 selectDom.find('option:contains("无")').attr('selected', 'selected'); 135 selectDom.find('option:contains("无")').attr('selected', 'selected');
@@ -137,14 +139,15 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -137,14 +139,15 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
137 }, { 139 }, {
138 field: 'sort', title: '列表顺序', align: 'center', 140 field: 'sort', title: '列表顺序', align: 'center',
139 templet: function (d) { 141 templet: function (d) {
140 - var inputDom = $('<input id="txt-kpiflag-table-sort-' + d.LAY_TABLE_INDEX + '" data-index="' + d.LAY_TABLE_INDEX + '" type="number" autocomplete="off" class="layui-input txt-kpiflag-table-sort">');  
141 - if (d.sort != '' && d.sort != null) {  
142 - inputDom.attr("value", d.sort); 142 + var inputDom = $('<input id="txt-kpiflag-table-sort-' + (d.LAY_INDEX-1) + '" data-index="' + (d.LAY_INDEX-1) + '" type="number" autocomplete="off" class="layui-input txt-kpiflag-table-sort">');
  143 + var sort = kpiFlagTableData[(d.LAY_INDEX-1)].sort;
  144 + if (sort != null) {
  145 + inputDom.attr("value", sort);
143 } 146 }
144 return inputDom.prop('outerHTML'); 147 return inputDom.prop('outerHTML');
145 } 148 }
146 }, { 149 }, {
147 - title: '操作',width: 100, align: 'center', templet: '<div><span data-index="{{d.LAY_TABLE_INDEX}}" class="link link-kpiflag-delete">' + 150 + title: '操作',width: 100, align: 'center', templet: '<div><span data-index="{{(d.LAY_INDEX-1)}}" class="link link-kpiflag-delete">' +
148 '<a class="layui-btn layui-btn-xs layui-btn-normal" title="删除"><i class="layui-icon"></i></a></span>' 151 '<a class="layui-btn layui-btn-xs layui-btn-normal" title="删除"><i class="layui-icon"></i></a></span>'
149 }]], 152 }]],
150 done: function (res, curr, count) { 153 done: function (res, curr, count) {
@@ -508,7 +511,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -508,7 +511,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
508 kpiIdent: e.kpiIdent 511 kpiIdent: e.kpiIdent
509 }, 512 },
510 isUnique: '0', 513 isUnique: '0',
511 - sort: '1' 514 + sort: i
512 }); 515 });
513 } 516 }
514 }); 517 });
@@ -118,6 +118,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -118,6 +118,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
118 , even: true 118 , even: true
119 , data: restypepageKpiTableData 119 , data: restypepageKpiTableData
120 , cols: [[ 120 , cols: [[
  121 + {field: 'index', title: '序号', align: 'center', type: 'numbers'},
121 {field: 'kpiName', title: '指标名称', align: 'center'}, 122 {field: 'kpiName', title: '指标名称', align: 'center'},
122 { 123 {
123 field: 'kpiIdent', title: '指标分类', align: 'center', 124 field: 'kpiIdent', title: '指标分类', align: 'center',
@@ -139,17 +140,21 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -139,17 +140,21 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
139 { 140 {
140 title: '类型', align: 'center', 141 title: '类型', align: 'center',
141 templet: function (d) { 142 templet: function (d) {
142 - var selectDom = $('<select class="type" lay-search="" class="layui-select" data-index="' + d.LAY_TABLE_INDEX + '" lay-filter="select-restypepagekpi-table-type">' + 143 + var selectDom = $('<select class="typeSel" lay-search="" class="layui-select" data-index="' + (d.LAY_INDEX-1) + '" lay-filter="select-restypepagekpi-table-type">' +
143 restypekpitype + 144 restypekpitype +
144 '</select>'); 145 '</select>');
145 - selectDom.find('option:contains("' + d.type + '")').attr('selected', 'selected'); 146 + var index = (d.LAY_INDEX-1);
  147 + var type = restypepageKpiTableData[index].type;
  148 + selectDom.find('option[value="'+type+'"]').attr('selected', 'selected');
146 return selectDom.prop('outerHTML'); 149 return selectDom.prop('outerHTML');
147 } 150 }
148 }, { 151 }, {
149 - field: 'id', title: 'id', align: 'center', hide: true , templet: function (d) {  
150 - var inputDom = $('<input id="txt-restypepagekpi-table-id-' + d.LAY_TABLE_INDEX + '" data-index="' + d.LAY_TABLE_INDEX + '" autocomplete="off" class="layui-input txt-restypepagekpi-table-id">');  
151 - if (d.id != '' && d.id != null) {  
152 - inputDom.attr("value", d.id); 152 + field: 'id', title: 'id', align: 'center' , hide: true, templet: function (d) {
  153 + var inputDom = $('<input id="txt-restypepagekpi-table-id-' + (d.LAY_INDEX-1) + '" data-index="' + (d.LAY_INDEX-1) + '" autocomplete="off" class="layui-input txt-restypepagekpi-table-id">');
  154 + var index = (d.LAY_INDEX-1);
  155 + var id = restypepageKpiTableData[index].id;
  156 + if (id != '' && id != null) {
  157 + inputDom.attr("value", id);
153 } 158 }
154 return inputDom.prop('outerHTML'); 159 return inputDom.prop('outerHTML');
155 } 160 }
@@ -157,9 +162,9 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -157,9 +162,9 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
157 , { 162 , {
158 field: 'sort', title: '排序', align: 'center', 163 field: 'sort', title: '排序', align: 'center',
159 templet: function (d) { 164 templet: function (d) {
160 - var inputDom = $('<input id="txt-restypepagekpi-table-sort-' + d.LAY_TABLE_INDEX + '" data-index="' + d.LAY_TABLE_INDEX + '" type="number" autocomplete="off" class="layui-input txt-restypepagekpi-table-sort">'); 165 + var inputDom = $('<input id="txt-restypepagekpi-table-sort-' + (d.LAY_INDEX-1) + '" data-index="' + (d.LAY_INDEX-1) + '" type="number" autocomplete="off" class="layui-input txt-restypepagekpi-table-sort">');
161 if (d.sort != null) { 166 if (d.sort != null) {
162 - inputDom.attr("value", d.sort); 167 + inputDom.attr("value", restypepageKpiTableData[(d.LAY_INDEX-1)].sort);
163 } 168 }
164 return inputDom.prop('outerHTML'); 169 return inputDom.prop('outerHTML');
165 } 170 }
@@ -167,7 +172,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -167,7 +172,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
167 title: '操作', 172 title: '操作',
168 width: 100, 173 width: 100,
169 align: 'center', 174 align: 'center',
170 - templet: '<div><span data-index="{{d.LAY_TABLE_INDEX}}" class="link link-restypepagekpi-delete">' + 175 + templet: '<div><span data-index="{{(d.LAY_INDEX-1)}}" class="link link-restypepagekpi-delete">' +
171 '<a class="layui-btn layui-btn-xs layui-btn-normal" title="删除"><i class="layui-icon"></i></a></span>' 176 '<a class="layui-btn layui-btn-xs layui-btn-normal" title="删除"><i class="layui-icon"></i></a></span>'
172 }]], 177 }]],
173 done: function (res, curr, count) { 178 done: function (res, curr, count) {
@@ -279,7 +284,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem @@ -279,7 +284,7 @@ layui.define(['table', 'form', 'laydate', 'common', 'sessions', 'laydate', 'elem
279 kpiName: e.kpiName, 284 kpiName: e.kpiName,
280 kpiIdent: e.kpiIdent, 285 kpiIdent: e.kpiIdent,
281 type: 'base', 286 type: 'base',
282 - sort: '1' 287 + sort: i
283 }); 288 });
284 } 289 }
285 }); 290 });