@@ -53,164 +53,256 @@
//先声明
function openDetailIn(data) {
- };
+ }
function openDetailOut(data) {
- };
+ }
+
function openDetailTaking(data){
- };
- layui.use(['flow', 'layer', 'util'], function () {
+ }
+
+ function initApplicationIn(){
+
+ }
+
+ function initApplicationOut() {
+
+ }
+
+ function initStockTaking(){
+
+ }
+
+ layui.use(['flow', 'layer', 'util','element'], function () {
var $ = layui.jquery,
layer = layui.layer,
flow = layui.flow,
+ element = layui.element,
util = layui.util;
let size = 8;
let inpre = 0;
let takingPre = 0;
let outpre = 0;
- flow.load({
- elem: '#LAY_floor_stockTaking' //流加载容器
- , scrollElem: '#LAY_floor_stockTaking' //滚动条所在元素,一般不用填,此处只是演示需要。
- , isAuto: false
- , done: function (page, next) { //执行下一页的回调
- let result;
- let lis1 = [];
- $.get('/stockTaking/myApply?page=' + page + '&size=' + size, function (res) {
- result = res.data;
- var Width = "25%";
- if (isMobile()) {
- Width = "50%";
- }
- lis1.push("
");
- for (let i=0;i
');
- lis1.push('
'
- +result[i].createTime+'
');
- }
- lis1.push('');
- takingPre+=result.length;
- //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
- //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
- next(lis1.join(''), takingPre < res.count);
- });
+
+ $(function() {
+ initApplicationIn();
+ });
+
+ // 切换事件(绑定未完成任务的选项卡)
+ element.on('tab(myApplyTab)', function(obj){
+ let layId = $(obj.elem.context).attr("lay-id");
+ if(layId.includes("applicationIn")){
+ initApplicationIn();
+ }else if (layId.includes("applicationOut")){
+ initApplicationOut();
+ }else if(layId.includes("stockTaking")){
+ initStockTaking();
}
});
- flow.load({
- elem: '#LAY_floor_in' //流加载容器
- , scrollElem: '#LAY_floor_in' //滚动条所在元素,一般不用填,此处只是演示需要。
- , isAuto: false
- , done: function (page, next) { //执行下一页的回调
- let lis = [];
- let result;
- $.get('/depositoryRecord/myApply?page=' + page + '&size=' + size, function (res) {
- result = res.data;
- applicationIn = result["applicationIn"];
- InCount = result["InCount"];
- var Width = "25%";
- if (isMobile()) {
- Width = "50%";
- }
- lis.push("
");
- for (let i = 0; i < applicationIn.length; i++) {
- lis.push('
')
- lis.push('
'
- + applicationIn[i].applicantTime + '
');
- }
- lis.push('
');
- inpre += applicationIn.length;
- //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
- //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
- next(lis.join(''), inpre < InCount);
- });
+ initStockTaking =function() {
+ flow.load({
+ elem: '#LAY_floor_stockTaking' //流加载容器
+ , scrollElem: '#LAY_floor_stockTaking' //滚动条所在元素,一般不用填,此处只是演示需要。
+ , isAuto: false
+ , done: function (page, next) { //执行下一页的回调
+ let result;
+ let lis1 = [];
+ $.get('/stockTaking/myApply?page=' + page + '&size=' + size, function (res) {
+ result = res.data;
+ var Width = "25%";
+ if (isMobile()) {
+ Width = "50%";
+ }
+ lis1.push("
");
+ for (let i=0;i
');
+ lis1.push('
'
+ +result[i].createTime+'
');
+ }
+ lis1.push('');
+ takingPre+=result.length;
+ //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
+ //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
+ next(lis1.join(''), takingPre < res.count);
+ });
+ }
+ });
+ };
+ initApplicationIn = function() {
+ flow.load({
+ elem: '#LAY_floor_in' //流加载容器
+ , scrollElem: '#LAY_floor_in' //滚动条所在元素,一般不用填,此处只是演示需要。
+ , isAuto: false
+ , done: function (page, next) { //执行下一页的回调
+ let lis = [];
+ let result;
+ $.get('/depositoryRecord/myApply?page=' + page + '&size=' + size, function (res) {
+ result = res.data;
+ applicationIn = result["applicationIn"];
+ InCount = result["InCount"];
+ var Width = "25%";
+ if (isMobile()) {
+ Width = "50%";
+ }
+ lis.push("
");
+ for (let i = 0; i < applicationIn.length; i++) {
+ lis.push('
')
+ lis.push('
'
+ + applicationIn[i].applicantTime + '
');
+ }
+ lis.push('
');
+ inpre += applicationIn.length;
+ //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
+ //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
+ next(lis.join(''), inpre < InCount);
+ });
- }
- });
- flow.load({
- elem: '#LAY_floor_out' //流加载容器
- , scrollElem: '#LAY_floor_out' //滚动条所在元素,一般不用填,此处只是演示需要。
- , isAuto: false
- , done: function (page, next) { //执行下一页的回调
- let lis = [];
- let result;
- lis.push("
")
- $.get('/depositoryRecord/myApply?page=' + page + '&size=' + size, function (res) {
- result = res.data;
- applicationOut = result["applicationOut"];
- OutCount = result["OutCount"];
- var Width = "25%";
- if (isMobile()) {
- Width = "50%";
- }
+
+ }
+ });
+ };
+
+
+ initApplicationOut = function() {
+ flow.load({
+ elem: '#LAY_floor_out' //流加载容器
+ , scrollElem: '#LAY_floor_out' //滚动条所在元素,一般不用填,此处只是演示需要。
+ , isAuto: false
+ , done: function (page, next) { //执行下一页的回调
+ let lis = [];
+ let result;
lis.push("
")
- for (let i = 0; i < applicationOut.length; i++) {
+ $.get('/depositoryRecord/myApply?page=' + page + '&size=' + size, function (res) {
+ result = res.data;
+ applicationOut = result["applicationOut"];
+ OutCount = result["OutCount"];
+ var Width = "25%";
+ if (isMobile()) {
+ Width = "50%";
+ }
+ lis.push("
")
+ for (let i = 0; i < applicationOut.length; i++) {
- lis.push('
')
- lis.push('
'
- + applicationOut[i].applicantTime + '
');
+ lis.push('
')
+ lis.push('
'
+ + applicationOut[i].applicantTime + '
');
- }
- lis.push('
');
- outpre += applicationOut.length;
- //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
- //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
- next(lis.join(''), outpre < OutCount);
+ }
+ lis.push('
');
+ outpre += applicationOut.length;
+ //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
+ //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
+ next(lis.join(''), outpre < OutCount);
+ });
+ }
+ });
+ };
+
+
+
+ openDetailIn = function (item) {
+
+ if(isMobile()){
+ var index = layer.open({
+ title: '请求详情',
+ type: 2,
+ shade: 0.2,
+ maxmin: true,
+ shadeClose: true,
+ area: ['100%', '100%'],
+ content: '/form_step_look?id=' + item,
+ });
+ $(window).on("resize", function () {
+ layer.full(index);
+ });
+ }else{
+ layer.open({
+ title: '请求详情',
+ type: 2,
+ shade: 0.2,
+ maxmin: true,
+ offset: 'r',
+ anim: 'slideLeft', // 从右往左
+ shadeClose: true,
+ area: ['30%', '100%'],
+ content: '/form_step_look?id=' + item,
});
}
- });
- openDetailIn = function (item) {
- var index = layer.open({
- title: '请求详情',
- type: 2,
- shade: 0.2,
- maxmin: true,
- shadeClose: true,
- area: ['100%', '100%'],
- content: '/form_step_look?id=' + item,
- });
- $(window).on("resize", function () {
- layer.full(index);
- });
+
};
openDetailOut = function (item) {
- var index = layer.open({
- title: '请求详情',
- type: 2,
- shade: 0.2,
- maxmin: true,
- shadeClose: true,
- area: ['100%', '100%'],
- content: '/ApplicationOutView?id=' + item,
- });
- $(window).on("resize", function () {
- layer.full(index);
- });
+ if(isMobile()){
+ var index = layer.open({
+ title: '请求详情',
+ type: 2,
+ shade: 0.2,
+ maxmin: true,
+ shadeClose: true,
+ area: ['100%', '100%'],
+ content: '/ApplicationOutView?id=' + item,
+ });
+ $(window).on("resize", function () {
+ layer.full(index);
+ });
+ }else{
+ index = layer.open({
+ title: '请求详情',
+ type: 2,
+ shade: 0.2,
+ offset: 'r',
+ anim: 'slideLeft', // 从右往左
+ maxmin: true,
+ shadeClose: true,
+ area: ['40%', '100%'],
+ content: '/ApplicationOutView?id=' + item,
+ });
+ }
+
};
openDetailTaking = function (data) {
- var index = layer.open({
- title: '请求详情',
- type: 2,
- shade: 0.2,
- maxmin: true,
- shadeClose: true,
- area: ['100%', '100%'],
- content: '/StockTakingView?id='+data,
- end:function () {
- location.reload()
- }
- });
- $(window).on("resize", function () {
- layer.full(index);
- });
+ if(isMobile()){
+ var index = layer.open({
+ title: '请求详情',
+ type: 2,
+ shade: 0.2,
+ maxmin: true,
+ shadeClose: true,
+ area: ['100%', '100%'],
+ content: '/StockTakingView?id='+data,
+ end:function () {
+ location.reload()
+ }
+ });
+ $(window).on("resize", function () {
+ layer.full(index);
+ });
+ }else{
+ layer.open({
+ title: '请求详情',
+ type: 2,
+ shade: 0.2,
+ maxmin: true,
+ shadeClose: true,
+ offset: 'r',
+ anim: 'slideLeft', // 从右往左
+ area: ['30%', '100%'],
+ content: '/StockTakingView?id='+data,
+ end:function () {
+ location.reload()
+ }
+ });
+ }
+
};
//定义一个函数判断是手机端还是pc端
@@ -222,9 +314,6 @@
}
}
- $('body').on('click', '[data-refresh]', function () {
- location.reload();
- })
});