Commit 7483bfcf by chenweisong

添加带token的post方法

parent e6395235
...@@ -57,6 +57,27 @@ ...@@ -57,6 +57,27 @@
} }
}); });
}, },
getHttpResultByPOSTWithToken: function (url, param, token, successCallback, async) {
$.showIndicator();
$.ajax({
type: "POST",
url: url,
headers: {'Access-Token': token},
contentType: 'application/x-www-form-urlencoded',
data: param,
async: async, // 默认为true, 即是异步请求函数
beforeSend: function (XMLHttpRequest) {
},
success: function (data) {
successCallback(data);
$.hideIndicator();
},
error: function (data) {
$.hideIndicator();
$.toast("请求出错");
}
});
},
//获取QueryString的数组 //获取QueryString的数组
getQueryString: function () { getQueryString: function () {
var result = location.search.match(new RegExp("[\?\&][^\?\&]+=[^\?\&]+", "g")); var result = location.search.match(new RegExp("[\?\&][^\?\&]+=[^\?\&]+", "g"));
......
...@@ -53,15 +53,13 @@ $(function () { ...@@ -53,15 +53,13 @@ $(function () {
}); });
// getMissionWorkOrder(); // getMissionWorkOrder();
function getMissionWorkOrder() { function getMissionWorkOrder() {
requestin = true; requestin = true;
Utils.getHttpResultByPOST(context + '/mobile/workordermgr/missionWorkOrder', { Utils.getHttpResultByPOSTWithToken(context + '/mobile/workordermgr/missionWorkOrder', {
'pageNumber': pageNumber 'pageNumber': pageNumber
}, function (res) { }, token, function (res) {
requestin = false; requestin = false;
res = JSON.parse(res) res = JSON.parse(res)
if (res.type === '200') { if (res.type === '200') {
...@@ -362,7 +360,13 @@ $(function () { ...@@ -362,7 +360,13 @@ $(function () {
</header>', </header>',
onChange: function (e) { onChange: function (e) {
var val = e.value; var val = e.value;
var newTime = moment().set({ 'year': val[0], 'month': parseInt(val[1]), 'date': parseInt(val[2]), 'hour': parseInt(val[3]), 'minute': parseInt(val[4]) }); var newTime = moment().set({
'year': val[0],
'month': parseInt(val[1]),
'date': parseInt(val[2]),
'hour': parseInt(val[3]),
'minute': parseInt(val[4])
});
if (!newTime.isAfter(value, "minute")) { if (!newTime.isAfter(value, "minute")) {
pickerDom.picker("setValue", arr); pickerDom.picker("setValue", arr);
} }
...@@ -388,7 +392,6 @@ $(function () { ...@@ -388,7 +392,6 @@ $(function () {
}); });
// 对口人按钮 // 对口人按钮
$("#xperson1").parent().off("click"); $("#xperson1").parent().off("click");
$("#xperson1").parent().on("click", function () { $("#xperson1").parent().on("click", function () {
...@@ -1015,8 +1018,7 @@ $(function () { ...@@ -1015,8 +1018,7 @@ $(function () {
$(".counterpart-item").on("click", function () { $(".counterpart-item").on("click", function () {
$(".person-list-block").html(""); $(".person-list-block").html("");
// 获取厂商对口人员信息 // 获取厂商对口人员信息
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', { Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {}, function (res) {
}, function (res) {
res = JSON.parse(res) res = JSON.parse(res)
if (res.type === '200') { if (res.type === '200') {
var list = res.data; var list = res.data;
...@@ -1098,8 +1100,7 @@ $(function () { ...@@ -1098,8 +1100,7 @@ $(function () {
$(".counterpart-item").on("click", function () { $(".counterpart-item").on("click", function () {
$(".person-list-block").html(""); $(".person-list-block").html("");
// 获取厂商对口人员信息 // 获取厂商对口人员信息
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', { Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {}, function (res) {
}, function (res) {
res = JSON.parse(res) res = JSON.parse(res)
if (res.type === '200') { if (res.type === '200') {
var list = res.data; var list = res.data;
...@@ -1286,8 +1287,7 @@ $(function () { ...@@ -1286,8 +1287,7 @@ $(function () {
$(".person-list-block").html(""); $(".person-list-block").html("");
pid = 0; pid = 0;
// 获取厂商需求处理人 // 获取厂商需求处理人
Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', { Utils.getHttpResultByPOST(context + '/hnyd/workordermgr/getCompanyPerson', {}, function (res) {
}, function (res) {
res = JSON.parse(res) res = JSON.parse(res)
if (res.type === '200') { if (res.type === '200') {
var list = res.data; var list = res.data;
...@@ -1360,7 +1360,6 @@ $(function () { ...@@ -1360,7 +1360,6 @@ $(function () {
} }
// 报表数要从1开始 // 报表数要从1开始
function colsFactory(type) { function colsFactory(type) {
if (type === "report") { if (type === "report") {
...@@ -1533,8 +1532,8 @@ $(function () { ...@@ -1533,8 +1532,8 @@ $(function () {
}); });
/** /**
* 排列 * 排列
*/ */
function sortIndicatorList() { function sortIndicatorList() {
var SortList = $('.sort_list'); var SortList = $('.sort_list');
var SortBox = $('.sort_box'); var SortBox = $('.sort_box');
...@@ -1743,8 +1742,8 @@ $(function () { ...@@ -1743,8 +1742,8 @@ $(function () {
if (pageId == "orderorder") { if (pageId == "orderorder") {
} else if (pageId == "create") { } else if (pageId == "create") {
/** /**
* 新建工单js * 新建工单js
*/ */
console.log("create") console.log("create")
$(".to-order").off("click"); $(".to-order").off("click");
$(".to-order").on("click", function (e) { $(".to-order").on("click", function (e) {
...@@ -1799,7 +1798,13 @@ $(function () { ...@@ -1799,7 +1798,13 @@ $(function () {
</header>', </header>',
onChange: function (e) { onChange: function (e) {
var val = e.value; var val = e.value;
var newTime = moment().set({ 'year': val[0], 'month': parseInt(val[1]), 'date': parseInt(val[2]), 'hour': parseInt(val[3]), 'minute': parseInt(val[4]) }); var newTime = moment().set({
'year': val[0],
'month': parseInt(val[1]),
'date': parseInt(val[2]),
'hour': parseInt(val[3]),
'minute': parseInt(val[4])
});
if (!newTime.isAfter(xvalue, "minute")) { if (!newTime.isAfter(xvalue, "minute")) {
xpickerDom.picker("setValue", xvalueArr); xpickerDom.picker("setValue", xvalueArr);
} }
...@@ -1939,6 +1944,7 @@ $(function () { ...@@ -1939,6 +1944,7 @@ $(function () {
} }
return flag; return flag;
} }
$(".create-submit-btn").html("提交"); $(".create-submit-btn").html("提交");
$(".create-submit-btn").off("click") $(".create-submit-btn").off("click")
$(".create-submit-btn").on("click", function () { $(".create-submit-btn").on("click", function () {
...@@ -1989,7 +1995,6 @@ $(function () { ...@@ -1989,7 +1995,6 @@ $(function () {
$.init(); $.init();
function getToken() { function getToken() {
if (!code) { if (!code) {
$.toast("缺少code值"); $.toast("缺少code值");
......
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