tctip demo页面>

Layui在A页面打开B页面,在B打开C,如何在关闭了C之后刷新B

selectOption() {
              var screen = admin.screen();
              var width, height;
              if (screen > 3) {
                  width = '70%';
                  height = '80%';
              } else if (screen == 3) {
                  width = '85%';
                  height = '90%';
              } else {
                  width = '95%';
                  height = '90%';
              }
              var uuid = laiease.utils.generateUUID();
              layer.open({
                  type: 2,
                  title: '选择薪酬项',
                  content: 'optionselect.html?programId=' + activeData.program.programId + '&uuid=' + uuid,
                  area: [width, height],
                  btn: ['添加薪酬项','确定', '取消'],
                  btn1: function(index, layero){
                      var width, height;
                      width = '95%';
                      height = '90%';
                      layer.open({
                          type: 2,
                          title: '选择薪酬项',
                          content: '../option/optionsetting.html',
                          area: [width, height],
                          btn: ['确定', '取消'],
                          yes: function (index, layero) {
                              layer.closeAll('loading');
                              layer.close(index); //关闭弹层
                              //刷新子页面
                              $(window.document).find("iframe")[0].contentWindow.location.reload(true);
                          }
                      });
                  },
                  btn2: function (index, layero) {
                      var iframeWindow = window['layui-layer-iframe' + index];
                      var checkStatus = iframeWindow.layui.table.checkStatus('option-table'),
                          checkData = checkStatus.data; //得到选中的数据
                      if (checkData.length === 0) {
                          return layer.msg('请至少选择一条数据!', {icon: 5, shift: 6});
                      } else if (checkData.length === 1) {
                          var verifyData = checkData[0];
                          if (verifyData.parentId == '0') {
                              return layer.msg('请至少选择一条数据,请选择具体子项目!', {icon: 5, shift: 6});
                          }
                      }
                      var data = {
                          optionList: checkData,
                          programId: activeData.program.programId
                      }
                      layer.load(2, {shade: 0.2});
                      admin.req({
                          type: 'post',
                          data: data,
                          url: laiease.webServer + '/web/programItems/saveSelectedOption',
                          done: function (res) {
                              if (res.data.status) {
                                  layer.closeAll('loading');
                                  layer.close(index); //关闭弹层
                                  layer.msg('添加成功', {icon: 1});
                                  table.reload('program-item-table', {page: {curr: 1}});
                              } else {
                                  layer.msg('添加失败', {icon: 5});
                              }
                          }
                      });
                  }
              });
          },
posted @ 2020-09-17 10:09  张怼怼吖  阅读(275)  评论(0编辑  收藏  举报