YYC
2023-05-29 397dbf892f842c834af17a91c788c94fd96003f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
var url = null;
var auditList = null;
var workAuditData = null;
//工单审核列表
var data = {
    "interfaceId": "5703",
    "outId": "10703",
    "reqDateTime": new Date(),
    "tokenAuth": "",
    "data": {
        "deptId": "",
    }
};
//工单审核
var data1 = {
    "interfaceId": "5704",
    "outId": "10704",
    "reqDateTime": new Date(),
    "tokenAuth": "",
    "data": {
        "id": "",
        "status": ""
    }
};
 
function init() {
    var user = JSON.parse(localStorage.getItem('user'));
    var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
    url = user.url + "/api-phone/v35/gateway";
    data.tokenAuth = user.tokenAuth;
    data1.tokenAuth = user.tokenAuth;
    data.data.deptId = selectDeptId;
 
    getAuditList();
}
 
//获取工单审核列表
function getAuditList() {
    console.log(JSON.stringify(data.data),"work-aduit","工单审核列表")
    mui.ajax(url, {
        type: "POST",
        dataType: "json",
        crossDomain: true,
        contentType: "application/json;charset=utf-8",
        data: JSON.stringify(data),
        success: function(result) {
            if (result.code == "0000") {
                auditList = result.data;
                // console.log(JSON.stringify(auditList))
                renderAuditList();
            } else {
                renderAuditList();
                mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
            }
        },
        error: function() {
            renderAuditList();
            mui.alert('系统繁忙,请重新登录尝试!', '提示', ["确定"], function() {}, "div");
 
        }
    })
    auditList = [{
            "id": "59",
            "deptName": "1号仓",
            "applyUser": "in anim exercitation",
            "applyUserName": "郝军",
            "type": "exercitation reprehenderit sint",
            "startTime": "1974-07-05 21:56",
            "endTime": "2013-08-19 05:43",
            "info": "sed adipisicing quis irure",
            "depotId": "90",
            "depotName": "即传状新五际"
        },
        {
            "id": "39",
            "deptName": "1号仓",
            "applyUser": "dolor laboris",
            "applyUserName": "袁强",
            "type": "sed et sit irure eu",
            "startTime": "2015-10-25 12:30",
            "endTime": "1971-04-18 19:34",
            "info": "reprehenderit qui quis pariatur anim",
            "depotId": "89",
            "depotName": "当入物还算"
        },
        {
            "id": "55",
            "deptName": "3号仓",
            "applyUser": "quis",
            "applyUserName": "宋丽",
            "type": "in",
            "startTime": "1994-10-12 18:25",
            "endTime": "2008-01-19 00:26",
            "info": "ex ullamco id dolor",
            "depotId": "42",
            "depotName": "新常技位中"
        },
        {
            "id": "50",
            "deptName": "2号仓",
            "applyUser": "dolor",
            "applyUserName": "黄超",
            "type": "nostrud elit",
            "startTime": "2018-07-07 10:25",
            "endTime": "2000-11-07 10:02",
            "info": "et minim",
            "depotId": "53",
            "depotName": "人离它军题"
        }
    ]
}
 
function renderAuditList() {
    var html = '';
    if (auditList && auditList.length > 0) {
        $.each(auditList, function(index, item) {
            html += '<li><div class="con"><div class="top"><div class="left">';
            html += '<div class="line"><div class="t">申请人: </div><div class="v">' + item.applyUserName +'</div></div></div>';
            html += '<div class="right"><div class="icon" info="' + item.info + '"><img src="images/icons/g-i26.png" alt=""></div></div></div>';
            html +=
                '<div class="box"><ul class="gd-list"><li><a href="" class="con" style="background-image: url(images/icons/a-bg12.png);">';
            html += '<div class="tit">业务类型:</div><div class="name">' + item.type + '</div></a></li>';
            html += '<li><a href="" class="con" style="background-image: url(images/icons/a-bg13.png);">';
            html += '<div class="tit">关联仓库:</div><div class="name">' + (item.depotName == null ? "--" : item
                .depotName) + '</div></a></li></ul>';
            html += '<div class="time">有效期: ' + item.startTime + '至' + item.endTime + ' </div>';
            html += '<div class="btns"><a href="" id = "' + item.id +
                '" class="btn refuse">拒绝</a><a href="" id = "' + item.id + '" class="btn adopt">通过</a></div>';
            html += '</div></div></div></li>';
        })
    } else {
        html +=
            '<li><div class="con"><div style="text-align: center;font-size: 20px;color:#dd524d;padding: 18px;">暂无工单审核信息</div></div></li>';
    }
    $("#handleList").html(html);
}
 
//工单审核
function workAudit() {
    console.log(JSON.stringify(data1.data),"work-aduit","工单审核")
    mui.ajax(url, {
        type: "POST",
        dataType: "json",
        crossDomain: true,
        contentType: "application/json;charset=utf-8",
        data: JSON.stringify(data1),
        success: function(result) {
            if (result.code == "0000") {
                workAuditData = result.data;
                // console.log(JSON.stringify(auditList))
            } else {
                mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
            }
        },
        error: function() {
            mui.alert('系统繁忙,请重新登录尝试!', '提示', ["确定"], function() {}, "div");
        }
    })
}
 
//拒绝
mui(".mui-scroll").on("tap", ".wp ul li .refuse", function() {
    var id = this.getAttribute("id");
    console.log(id)
    data1.data.id = id
    data1.data.status = '10'
    workAudit();
})
 
//通过
mui(".mui-scroll").on("tap", ".wp ul li .adopt", function() {
    var id = this.getAttribute("id");
    console.log(id)
    data1.data.id = id
    data1.data.status = '20'
    workAudit();
})
//查看申请内容
mui(".mui-scroll").on("tap", ".wp ul li .icon", function() {
    var info = this.getAttribute("info")
    // mui.alert(info, '工单内容', ["确定"], function() {}, "div");
    $("#textareaPop").val(info)
    $('#m-pop').css('display', 'flex');
    console.log("申请内容")
})
 
//关闭弹窗
function closePop() {
    $("#m-pop").css('display', 'none');
}
 
mui('.mui-scroll-wrapper').scroll({
    indicators: false, //是否显示滚动条
    deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
    bounce: false, //是否启用回弹
    deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
});