Commit 269631f3 authored by 王文琼's avatar 王文琼

代码优化,规范

parent 3a082d23
*{
* {
list-style: none;
padding: 0;
margin: 0;
border: 0;
}
html,body{
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
}
[v-cloak] {
display: none !important;
display: none !important;
}
.redColor{
.redColor {
color: red;
display: inline-block;
}
.blueColor{
.blueColor {
color: royalblue;
display: inline-block;
}
.altrowstable {
border-width: 1px;
/*padding: 2px;*/
......@@ -40,114 +45,161 @@ html,body{
z-index: 998;
background-color: rgba(0, 0, 0, .3);
}
#app{
#app {
width: 100%;
height: 100%;
}
.mui-content{
.mui-content {
height: 100%;
width: 100%;
}
.left{
.left {
float: left;
width: 30%;
height: 100%;
display: block;
}
.left-1{
.left-1 {
position: fixed;
top: 2px;
width: 30%;
}
.left-1 a{
.left-1 a {
width: 30px;
}
.left-1 label{
.left-1 label {
text-align: center;
display: block;
line-height: 30px;
}
.left-2{
.left-2 {
padding-top: 35px;
}
.mui-search input[type=search]{
border-radius:0 ;
.mui-search input[type=search] {
border-radius: 0;
}
.Text{
.Text {
border: 1px solid rgb(218, 230, 239);
height: 460px;
background: #fff;
height: 460px;
background: #fff;
position: relative;
/* display: none; */
margin-top: -18px;
overflow-y: scroll;
}
.Text1{
.Text1 {
border: 1px solid rgb(218, 230, 239);
height: 460px;
background: #fff;
height: 460px;
background: #fff;
position: relative;
margin-top: -18px;
}
.maeginTop{
.maeginTop {
margin-top: 10px;
height: 481px;
}
.mui-scroll{
.mui-scroll {
overflow-y: scroll;
}
.complet-detail{
.complet-detail {
padding: 5px 0;
height: 93px;
border-bottom: 1px solid #dadada;
box-sizing: border-box;
overflow: hidden;
}
.complet-detail li{
float: left;
width: 50%;
.complet-detail li {
width: 100%;
font-size: 12px;
line-height:20px;
line-height: 20px;
height: 20px;
text-align: left;
}
.complet-detail li p {
width: 50%;
float: left;
color: #000000;
margin: 0;
}
.complet-detail li span{
.complet-detail li span {
padding-left: 3px;
box-sizing: border-box;
display: block;
font-size: 12px;
float: left;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.complet-detail li span:nth-of-type(2){
.complet-detail li span:nth-of-type(2) {
padding-left: 1px !important;
}
.complet-detail li:nth-of-type(1) span:nth-of-type(2){
width:90px;
white-space:nowrap;
.complet-detail li:nth-of-type(1) span:nth-of-type(2) {
width: 70px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.complet-detail li:nth-of-type(2) span:nth-of-type(2) {
width: 90px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.complet-detail li:nth-of-type(3) span:nth-of-type(2){
width:100px;
white-space:nowrap;
}
.complet-detail li:nth-of-type(3) p {
width: 100%;
}
.complet-detail li:nth-of-type(3) span:nth-of-type(2) {
width: 100px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.active{
}
.active {
background: #efeff4;
}
.left-submit {
display: inline-block;
width: 17%;
position: relative;
top: -25px;
}
/**左侧底部按钮**/
.btn_bottom{
.btn_bottom {
position: fixed;
bottom: 1px;
width: 30%;
......@@ -155,60 +207,128 @@ html,body{
z-index: 10;
left: 1px;
height: 40px;
line-height: 40px;
}
.btn_bottom #n1,.btn_bottom #n2{
.btn_bottom #n1,
.btn_bottom #n2 {
display: block;
float: left;
text-align: center;
width: 50%;
}
/**右侧***/
.right{
.right {
float: right;
width: 70%;
height: 100%;
box-sizing: border-box;
display: block;
}
#right-2 .right-2-top {
border: solid #DAE6EF 1px;
display: inline-block;
width: 80%;
}
#right-2 .right-2-top p {
float: left;
color: #060606;
}
#right-2 .right-2-top p:nth-of-type(1) {
width: 16%;
}
#right-2 .right-2-top p:nth-of-type(2) {
width: 40%;
}
#right-2 .right-2-top p:nth-of-type(3) {
width: 12%;
}
#right-2 .right-2-top p:nth-of-type(4) {
width: 32%;
}
.detail-header{
float: left;
width: 60%;
.detail-header {
float: left;
width: 60%;
position: relative;
}
.mui-table tr th{
.mui-table tr th {
height: 50px;
}
.item_table{
border: #DAE6EF solid 1px;
display: inline-block;
.item_table {
border: #DAE6EF solid 1px;
display: inline-block;
height: 376px;
background: white;
top:60px;
background: white;
top: 60px;
box-sizing: border-box;
margin-top:-9px ;
}
.sDetail td{
margin-top: -9px;
}
.sDetail td {
height: 62px;
}
.Rbtn button {
width: 120px;
height: 70px;
display: inline-block;
}
.Rcomputed {
width: 255px;
}
.Rcomputed input {
border: 1px solid #DDDDDD;
width: 170px;
height: 70px;
margin-right: -6px;
margin-bottom: -1px;
text-align: center;
color: red;
background: #C8C7CC;
font-size: 25px
}
.Rcomputed button {
width: 85px;
height: 70px;
margin-bottom: -1px;
font-size: 25px;
margin-right: -5px;
}
.Rcomputed .mui-btn-blue {
width: 170px;
}
.Rbtn button{
width: 120px; height: 70px; display: inline-block;
#right-4 {
margin-top: -20px;
}
.Rcomputed button{
width: 85px;height: 70px;margin-bottom: -1px;font-size: 25px
#right-4 thead.mui-table-view th {
font-size: 16px;
font-weight: normal;
background-color: #E2E2E9;
}
/*********/
#pullrefresh{
#pullrefresh {
width: 100%;
}
}
......@@ -13,6 +13,14 @@ html,body,#app{
[v-cloak] {
display: none !important;
}
.redColor{
color: red !important;
display: inline-block;
}
.blueColor{
color: royalblue !important;
display: inline-block;
}
.need-left{
width: 40%;
float: left;
......@@ -55,11 +63,81 @@ html,body,#app{
#item1 div{
/* padding-bottom: 10px; */
}
.needLeftList{
padding: 5px 10px;
height: 93px;
border-bottom: 1px solid #dadada;
box-sizing: border-box;
overflow: hidden;
}
.needLeftList li{
width: 100%;
font-size: 12px;
line-height:20px;
height: 20px;
}
.needLeftList li p{
width: 50%;
float: left;
color: #000000;
margin: 0;
}
.needLeftList li span{
padding-left: 3px;
box-sizing: border-box;
display: block;
font-size: 12px;
float: left;
white-space:nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.needLeftList li span:nth-of-type(2){
padding-left: 1px !important;
}
.needLeftList li:nth-of-type(1) span:nth-of-type(2){
width:100px;
white-space:nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.needLeftList li:nth-of-type(2) span:nth-of-type(2){
width:100px;
white-space:nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.needLeftList li:nth-of-type(3) p{
width: 100%;
}
.needLeftList li:nth-of-type(3) span:nth-of-type(2){
width:100px;
white-space:nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#item2{
/* top: 32px; */
}
#item2 ul{
height: 93px;
border-bottom: 1px solid #dadada;
box-sizing: border-box;
}
#item2 ul li{
margin: 0
}
#item2 ul li p{
text-align: left;
}
.leftState{
position: fixed;bottom: 1px;left: 1px;z-index: 10;width: 40%;background: #fff;
......@@ -83,7 +161,22 @@ width: 100%;
#right-2 button{
width: 200px; height: 70px;"
}
#right-1 ul li p{
float: left;color: #060606;
white-space:nowrap;text-overflow: ellipsis;overflow: hidden;
}
#right-1 .mui-table-view-cell p:nth-of-type(1){
width: 16%;
}
#right-1 .mui-table-view-cell p:nth-of-type(2){
width: 40%;
}
#right-1 .mui-table-view-cell p:nth-of-type(3){
width: 12%;
}
#right-1 .mui-table-view-cell p:nth-of-type(4){
width: 32%;
}
......
mui.plusReady(function() {
initPage();
});
function initPage() {
// plus.screen.lockOrientation("landscape-secondary") //横屏
plus.screen.lockOrientation("landscape-primary") //横屏
app.init();
}
var app = new Vue({
el: '#app',
data: {
displayModel: 1,
IndexID: 0,
itemsLeft: [],
itemsLeft2: [], //已交接
itemsDetail: {},
submitModel: 0,
submitText: "确认接收",
nextDetail: {},
searchText: '', //搜索文本
completeState: true, ////切换已交接和未交接状态
paramUnDo: { //未交接
ReportType: 1, //针车
pageIndex: 2,
State: 0, //未交接
pageSize: 10
},
paramDone: { //已交接
ReportType: 1, //针车
pageIndex: 2,
State: 1, //已交接
pageSize: 10
},
cur: '0'
},
computed: {
display_: function() {
if (this.displayModel == 1) {
return "display: none "
}
},
sty1: function() {
if (this.IndexID == 0) {
return "disabled"
} else {
return null
}
}
},
methods: {
init: function() {
mui.init({
pullRefresh: {
container: '#pullrefresh',
up: {
height: 100,
contentrefresh: '正在加载...',
contentnomore: '没有更多数据了',
callback: function() {
var reUnfinished = document.getElementById("item1").getAttribute("state");
var reFinished = document.getElementById("item2").getAttribute("state");
//console.log("未交接" + reUnfinished);
//console.log("已交接" + reFinished);
var needUrl = '/api/vMES/Handover/List';
var searchUrl = '/api/vMES/Handover/Search';
var UnneedData = app.itemsLeft;
var needData = app.itemsLeft2;
if (reUnfinished) {
if (app.searchText != "") {
searchPull(searchUrl, UnneedData, app.paramUnDo);
}
pullupRefresh(needUrl, UnneedData, app.paramUnDo);
} else if (reFinished) {
pullupRefresh(needUrl, needData, app.paramDone);
}
}
},
}
});
function pullupRefresh(url, arr, params) {
//console.log("加载前1" + arr);
setTimeout(function() {
var para = {
PageSize: params.pageSize,
PageIndex: params.pageIndex,
ReportType: params.ReportType,
State: params.State
};
//console.log("canshu:" + JSON.stringify(para));
//console.log("之前的数据:" + arr);
Api.post(url, para, function(e) {
if (e.success) {
//console.log("111:" + JSON.stringify(e.items));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
//console.log("之后的arr" + arr);
}
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //参数为true代表没有更多数据了。
mui('#pullrefresh').pullRefresh().refresh(true);
//mui('#pullrefresh').pullRefresh().disablePullupToRefresh();
}, 1000);
}
function searchPull(url, arr, params) {
setTimeout(function() {
var para = {
SearchText: app.searchText,
PageSize: params.pageSize,
PageIndex: params.pageIndex,
ReportType: params.ReportType
};
Api.post(url, para, function(e) {
console.log("canshu:" + JSON.stringify(para));
if (e.success) {
//console.log("搜索到的111:" + JSON.stringify(e));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
//console.log("canshuqq:" + JSON.stringify(para));
}
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
mui('#pullrefresh').pullRefresh().refresh(true);
}, 1000);
}
mui('.mui-scroll-wrapper').scroll({
bounce: false,
indicators: true, //是否显示滚动条
});
this.getData(0);
mui(".mui-icon-clear")[0].addEventListener('tap', function() {
document.activeElement.blur(); //收起虚拟键盘
app.searchText = '';
app.getData(0);
});
},
getData: function(n) {
var that = this;
var para = {
ReportType: 1,
State: n,
PageSize: 20,
PageIndex: 1
}
//console.log(JSON.stringify(para))
that.searchText = ''
Api.post('/api/vMES/Handover/List', para, function(e) {
//console.log("List::" + JSON.stringify(e))
if (n == 0) {
if(e.items.length>0){
that.itemsLeft = e.items;
that.itemsDetail = e.items[0];
}else{
that.itemsLeft =[]
that.itemsDetail =[];
}
that.cur = 0;
} else {
//console.log("已交接::"+ JSON.stringify(e.items));
that.cur = 0;
if(e.items.length>0){
that.itemsLeft2 = e.items;
that.itemsDetail = e.items[0];
}else{
that.itemsLeft2 = [];
that.itemsDetail = [];
}
}
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
})
},
selectPerson: function() {
var that = this;
mui.openWindow({
url: 'NeedlecarPBB.html',
id: 'NeedlecarPBB.html',
extras: {
nextDetail: that.nextDetail
}
});
},
selectLeft: function(obj, n) {
//this.selectLeftBack(obj.IndexID);
this.IndexID = obj.IndexID;
this.nextDetail = obj;
this.cur = n;
var that = this;
var para = {
ReportType: 1,
IndexID: this.IndexID,
}
Api.post('/api/vMES/Handover/Index', para, function(e) {
//console.log("Indexddddd111::" + e.data)
if (e.success) {
that.itemsDetail = e.data;
}
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
})
},
goSearch: function(event) {
var that = this;
var para = {
ReportType: 1,
SearchText: that.searchText,
PageSize: 10,
PageIndex: 1
};
//console.log("搜索文本:" + JSON.stringify(para));
if (event.keyCode == "13") {
document.activeElement.blur(); //收起虚拟键盘
if (that.searchText == '') return;
Api.post('/api/vMES/Handover/Search', para, function(e) {
//console.log("eee::" + JSON.stringify(e))
if (e.success) {
var data = e.items.length;
//console.log("搜索到的内容::" + e.items.length)
if (data > 0) {
that.itemsLeft = e.items;
that.itemsDetail = e.items[0];
that.cur = 0;
} else {
that.itemsLeft = [];
that.itemsDetail = [];
that.cur = 0;
}
}
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
event.preventDefault(); // 阻止默认事件---阻止页面刷新
//that.searchText = '';
}
},
selectDisplay: function(n) {
var opt = document.getElementById("item1");
var opt2 = document.getElementById("item2");
var n1 = document.getElementById("n1");
var n2 = document.getElementById("n2");
if (n == 1) {
this.completeState = true;
n1.style.background = "royalblue"
n1.style.color = "white"
n2.style.background = "white"
n2.style.color = "royalblue"
opt.style.display = "inline-block";
opt2.style.display = "none"
this.submitModel = 0;
this.submitText = "确认接收";
this.getData(0)
}
if (n == 2) {
this.completeState = false;
// this.getDataDetail2(2)
n1.style.background = "white"
n1.style.color = "royalblue"
n2.style.background = "royalblue"
n2.style.color = "white"
opt.style.display = "none";
opt2.style.display = "inline-block"
this.submitModel = 1;
this.submitText = "撤回接收";
this.getData(1)
}
},
submit: function() {
var that = this;
var para = {
IndexID: this.IndexID,
}
//console.log(JSON.stringify(para))
var html ='';
if (this.submitModel == 1) {
html = '/api/vMES/Handover/UnReceive';
}else{
html= '/api/vMES/Handover/Receive'
}
Api.post(html, para, function(e) {
if (e.success) {
playVoice("cg.mp3");
mui.toast("操作成功");
//that.selectLeftBack(0);
that.IndexID = 0;
that.nextDetail = {};
that.itemsDetail = [];
//that.getData(0);
//that.getData(1);
//console.log("nnnn:");
if(html == '/api/vMES/Handover/Receive'){
var ReceiveArr = that.itemsLeft;
refresh(ReceiveArr);
}else{
var UnReceiveArr = that.itemsLeft2;
refresh(UnReceiveArr);
}
function refresh(leftArr){
var delIndexNoIndx = -1;
for(var i=0; i< leftArr.length;i++){
if(leftArr[i].IndexID == para.IndexID)
delIndexNoIndx = i;
}
leftArr.splice(delIndexNoIndx, 1);
if(leftArr.length - 1 >= delIndexNoIndx) {
that.cur=delIndexNoIndx;
that.itemsDetail = leftArr[delIndexNoIndx];
}
else{
that.cur = leftArr.length;
that.itemsDetail = leftArr[delIndexNoIndx-1];
}
}
} else {
playVoice("sb.mp3");
mui.toast("操作失败: " + e.message);
}
}, function(xhr, type, res) {
playVoice("sb.mp3");
mui.toast("操作失败" + JSON.stringify(res.message))
})
},
back: function() {
mui.back();
},
changePosition: function() {
var btn1 = document.getElementById("changePosition");
var btn2 = document.getElementById("right-2");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height);
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height1);
if (Height > Height1) {
btn1.style.display = "none";
btn2.style.display = "none";
} else {
btn1.style.display = "block";
btn2.style.display = "block";
}
}
},
changePosition1: function() {
var btn1 = document.getElementById("changePosition");
var btn2 = document.getElementById("right-2");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
if (Height < Height1) {
btn1.style.display = "block";
btn2.style.display = "block";
} else {
btn1.style.display = "none";
btn2.style.display = "none";
}
}
}
},
})
\ No newline at end of file
mui.plusReady(function() {
mui.plusReady(function() {
// plus.nativeUI.closeWaiting();
plus.nativeUI.showWaiting()
// mui.currentWebview.show();
......@@ -9,10 +10,8 @@ mui.plusReady(function() {
plus.screen.lockOrientation("landscape-primary") //横屏
app.init();
}
var app = new Vue({
el: '#app',
data: {
number: 0,
qty: 0,
......@@ -21,29 +20,37 @@ mui.plusReady(function() {
today: "",
link: "",
itemsDetail: [], //订单明细
itemsDetail1: [],
itemsDetail2: [],
itemsHead: [],
itemsDetail1: [], //
itemsDetail2: [], //
paramUnDo: {
pageIndex: 2,
pageSize: 10
},
paramDone: {
pageIndex: 2,
pageSize: 10
},
itemsHead: [], //未完成和搜索左侧数组
itemsLeft: [],
itemsLeft2: [],
itemsLeft2: [], //已完成左侧数组
itemsSize: [],
SizeQty: [],
ReportType: 0,
IndexID: 0,
rightInfor: [], //右侧详情
cur: 0,
completeState: true,
searchText: '',
searchDatail: [],
state: true,
// disable_save_button: 'disabled',
cur: 0, //点击选中当前状态
completeState: true, //切换已完成和未完成状态
searchText: '', //搜索框输入的内容
datalen: 20, //默认取数据数量
reDatalen: 10, //每次加载的数据数量
disable_reportDelete: 'disabled',
disable_qq: 'disabled',
ReportID: 0,
Report_IndexID: 0,
Model: 0,
CompleteRatio: 0, //完成进度
pagenum: 1,
unPagenum: 1, //未完成页数
pagenum: 1, //已完成页数
displayModel: 1,
zhezhao: 1, //
mask_: mui.createMask(function(e) {
......@@ -70,148 +77,133 @@ mui.plusReady(function() {
if (this.displayModel == 1) {
return "display: none "
}
},
SOP__: function() {
if (this.IndexID == 0) {
return "disabled"
} else {
return null
}
},
},
methods: {
init: function() { //初始化
mui.init({
pullRefresh: {
container: '#pullrefresh',
up: {
height: 100,
contentrefresh: '正在加载...',
contentnomore: '没有更多数据了',
callback: function() {
var pangjia = document.getElementById("theOne").getAttribute("state");
var pangjia1 = document.getElementById("theTow").getAttribute("state");
console.log("pangjia:" + pangjia);
console.log("pangjia1:" + pangjia1);
if (pangjia) {
console.log("pangjia:" + pangjia);
pullupRefresh();
console.log(11)
} else if (pangjia1) {
console.log("pangjsxzsdddddzia1:" + pangjia1);
pullupRefresh1();
} else {
pullupRefresh1();
}
}
},
}
});
var reUnfinished = document.getElementById("theOne").getAttribute("state");
var reFinished = document.getElementById("theTow").getAttribute("state");
var UnfinishedUrl = '/api/vMES/CutOffProductionReport/ToDo';
var FinishedUrl = '/api/vMES/CutOffProductionReport/Done';
var searchUrl = '/api/vMES/CutOffProductionReport/Search';
//console.log("未完成" + reUnfinished)
//console.log("已完成" + reFinished)
function getMoreInfor() {
var that = this;
setTimeout(function() {
var para = {
PageSize: 10,
PageIndex: this.pagenum++
var UnfinishedData = app.itemsHead;
};
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
var data = e.items;
var FinishedUrlData = app.itemsLeft2;
console.log("原来的" + app.itemsHead);
for (var i = 0; i < data.length; i++) {
//console.log("data[i]"+JSON.stringify(data[i])) ;
app.itemsHead.push(data[i]);
}
console.log("加载后" + app.itemsHead);
//var rightInfor = app.rightInfor;
if (reUnfinished) {
if (app.searchText != "") {
searchPull(searchUrl, UnfinishedData, app.paramUnDo);
}
pullupRefresh(UnfinishedUrl, UnfinishedData, app.paramUnDo);
})
mui('#item1').pullRefresh().endPullupToRefresh((para.PageIndex > 10));
} else if (reFinished) {
pullupRefresh(FinishedUrl, FinishedUrlData, app.paramDone);
}, 1000);
}
var count = 0;
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
var para = {
PageSize: 10,
PageIndex: this.pagenum++
};
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
var data = e.items;
}
console.log("原来的" + app.itemsHead);
for (var i = 0; i < data.length; i++) {
//console.log("data[i]"+JSON.stringify(data[i])) ;
app.itemsHead.push(data[i]);
}
});
console.log("加载后" + app.itemsHead);
}, 1000);
}
},
}
});
function pullupRefresh1() {
console.log(12235);
function pullupRefresh(url, arr, params) {
//console.log("加载前1" + arr);
setTimeout(function() {
var para = {
PageSize: 10,
PageIndex: app.pagenum++
PageSize: params.pageSize,
PageIndex: params.pageIndex
};
Api.post('/api/vMES/CutOffProductionReport/Done', para, function(e) { //加判断 1.网络异常 提示 2.没数据 提示 但是可以一直发请求只不过传回来是空
var data = e.items;
console.log("canshu:" + JSON.stringify(para));
//console.log("已完成原来的"+app.itemsLeft2) ;
for (var i = 0; i < data.length; i++) {
app.itemsLeft2.push(data[i]);
//console.log("canshu:" + JSON.stringify(para));
//console.log("之前的数据:" + arr);
Api.post(url, para, function(e) { //2.没数据 提示 但是可以一直发请求只不过传回来是空
if (e.success) {
//console.log("111:" + JSON.stringify(e.items));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
//console.log("data"+data);
//console.log("之后的arr"+arr);
//console.log("页数:"+params.pageIndex);
//console.log("canshuqq:" + JSON.stringify(para));
}
console.log("已12515的" + app.itemsLeft2);
})
mui('#pullrefresh').pullRefresh().endPullupToRefresh((para.PageIndex > 10));
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //参数为true代表没有更多数据了。
mui('#pullrefresh').pullRefresh().refresh(true);
//mui('#pullrefresh').pullRefresh().disablePullupToRefresh();
}, 1000);
}
function getMoreInfor1() { //已完成
function searchPull(url, arr, params) {
setTimeout(function() {
var para = {
PageSize: 10,
PageIndex: this.pagenum++
searchText: app.searchText,
PageSize: params.pageSize,
PageIndex: params.pageIndex
};
Api.post('/api/vMES/CutOffProductionReport/Done', para, function(e) {
var data = e.items;
console.log("已完成原来的" + JSON.stringify(app.itemsLeft2));
for (var i = 0; i < data.length; i++) {
//console.log("data[i]"+JSON.stringify(data[i])) ;
app.itemsLeft2.push(data[i]);
//console.log("canshu:" + JSON.stringify(para));
Api.post(url, para, function(e) {
if (e.success) {
//console.log("111:" + JSON.stringify(e.items));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
//console.log("canshuqq:" + JSON.stringify(para));
}
console.log("已完成" + app.itemsLeft2);
})
mui('#item1').pullRefresh().endPullupToRefresh((para.PageIndex > 10));
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
mui('#pullrefresh').pullRefresh().refresh(true);
}, 1000);
}
window.addEventListener('back', function(e) {
var that = this;
app.getDataDetail1();
});
mui(".mui-icon-clear")[0].addEventListener('tap', function() {
document.activeElement.blur(); //收起虚拟键盘
app.searchText = '';
app.getData();
//console.log('1111');
});
setTimeout(function() {
plus.nativeUI.closeWaiting();
var ap = document.getElementById("app");
......@@ -226,41 +218,24 @@ mui.plusReady(function() {
this.getData();
},
playVoice: function(filename) {
if (plus.audio == undefined) {
} else {
// 播放操作
var p = plus.audio.createPlayer("_www/dest/voice/" + filename);
p.play(function() {
//alert( "Audio play success!" );
}, function(e) {
//alert( "Audio play failed: " + e.message );
});
}
},
getData: function() {
var that = this;
var tempdate = this.dateTime + " 00:00:00";
this.createZhezhao(-1)
var para = {
PageSize: 10,
PageIndex: that.pagenum
PageSize: that.datalen,
PageIndex: that.unPagenum
};
//console.log("lalla" + JSON.stringify(para));
that.cur = 0;
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
//console.log("one :::;" +JSON.stringify(e.items))
that.itemsHead = e.items;
that.rightInfor = e.items[0];
//console.log("one :::;" +JSON.stringify(e.items.length))
//console.log("右侧详情" + JSON.stringify(e.items))
//console.log("点击之前"+JSON.stringify(that.rightInfor))
if (e.items.length > 0) {
that.itemsDetail = e.items[0];
that.itemsHead = e.items;
that.rightInfor = e.items[0];
//that.itemsDetail = e.items[0];
that.IndexID = e.items[0].IndexID;
that.getDataDetail1();
that.getDataDetail2(1);
......@@ -268,7 +243,9 @@ mui.plusReady(function() {
that.qty = 0;
that.disable_reportDelete = 'disabled';
} else {
that.itemsDetail = [];
that.itemsHead = [];
that.rightInfor = [];
//that.itemsDetail = [];
that.IndexID = 0;
that.itemsDetail1 = [];
that.itemsSize = [];
......@@ -280,61 +257,64 @@ mui.plusReady(function() {
that.getDataDetail2(1);
that.getTatolNum();
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
//console.log(bbb);
mui.toast(JSON.stringify(res.message))
});
},
getDetailInfor: function(idInfor, index) { //获取实报详细 未完成,已完成的的尺码明细信息
this.IndexID = idInfor;
var that = this;
that.cur = index;
//console.log("指令号"+idInfor);
//console.log("指令号"+idInfor);
that.searchText = '';
var para = {
"IndexID": idInfor
};
Api.post('/api/vMES/CutOffProductionReport/Detail', para, function(e) {
//console.log("详情" + JSON.stringify(e));
if (e.success) {
that.rightInfor = e.data;
//console.log("点击之后"+JSON.stringify(that.rightInfor))
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
},
ChangeState: function(n, state) { //改变状态,切换已完成和未完成
ChangeState: function(n) { //改变状态,切换已完成和未完成
//n= 1 未完成 n=2 已完成
var that = this;
var para = {
PageSize: 10,
PageIndex: 1
};
// console.log(JSON.stringify(para))
if (n == 1) {
var para = {
PageSize: that.datalen,
PageIndex: that.unPagenum
};
//console.log("do para " + JSON.stringify(para))
that.searchText = '';
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
that.cur = 0;
//console.log("未完成1" + JSON.stringify(e.items))
that.itemsHead = e.items;
that.rightInfor = e.items[0];
//console.log("未完成2" + JSON.stringify(that.itemsLeft))
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
if (e.items.length > 0) {
that.itemsHead = e.items;
that.rightInfor = e.items[0];
} else {
that.itemsHead = [];
that.rightInfor = [];
}
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
} else if (n == 2) {
//console.log("getDataDetail2:::: " + n + this.IndexID)
var para = {
PageSize: that.datalen,
PageIndex: that.pagenum
};
//console.log("do para " + JSON.stringify(para))
Api.post('/api/vMES/CutOffProductionReport/Done', para, function(e) {
//console.log("right" + JSON.stringify(e.items))
var data = JSON.stringify(e.items).length;
//console.log("已完成" + JSON.stringify(e.items))
var data = e.items.length;
if (data > 0) {
that.itemsLeft2 = e.items;
that.rightInfor = e.items[0];
......@@ -344,41 +324,41 @@ mui.plusReady(function() {
that.itemsLeft2 = [];
that.cur = 0;
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
}
},
goSearch: function() {
goSearch: function(event) {
var that = this;
var para = {
SearchText: that.searchText,
PageSize: 200,
PageIndex: 1,
PageIndex: that.pagenum,
};
//document.getElementById("search").value("");
if (that.searchText == '') return;
Api.post('/api/vMES/CutOffProductionReport/Search', para, function(e) {
//console.log("itemsHead被fore" + JSON.stringify(that.itemsHead))
console.log("输入的内容+" + para.SearchText)
console.log("search" + JSON.stringify(e.items))
//that.searchDatail = e.items;
that.itemsHead = e.items;
//console.log("itemsHead被huhbe" + JSON.stringify(that.itemsHead))
that.rightInfor = e.items[0];
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
//that.searchText='';
if (event.keyCode == "13") {
document.activeElement.blur(); //收起虚拟键盘
if (that.searchText == '') return;
Api.post('/api/vMES/CutOffProductionReport/Search', para, function(e) {
var data = e.items.length;
if (data > 0) {
that.itemsHead = e.items;
that.rightInfor = e.items[0];
that.cur = 0;
} else {
that.itemsHead = [];
that.rightInfor = [];
that.cur = 0;
}
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
event.preventDefault(); // 阻止默认事件---阻止页面刷新
//that.searchText = '';
}
},
getDataDetail1: function() {
var that = this;
......@@ -389,28 +369,21 @@ mui.plusReady(function() {
return;
}
Api.post('/api/vMES/ProductionReport/ProductIndexNoDetail', para, function(e) {
if (e.success) {
that.itemsDetail = e.data;
that.itemsDetail1 = e.data.ReportDetail;
that.itemsSize = e.data.SizeName;
//console.log("右侧信息"+JSON.stringify(that.itemsDetail).length)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
},
getDataDetail2: function(n) {
//n= 1 未完成 n=2 已完成
var that = this;
var para = {
ReportType: this.ReportType,
IndexID: n == 1 ? 0 : this.IndexID,
PageSize: 200,
PageIndex: 1,
......@@ -420,29 +393,27 @@ mui.plusReady(function() {
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
that.itemsLeft = e.items;
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
} else if (n == 2) {
console.log("getDataDetail2:::: " + n + this.IndexID)
//console.log("getDataDetail2:::: " + n + this.IndexID)
Api.post('/api/vMES/CutOffProductionReport/Done', para, function(e) {
console.log("itemsLeft2" + JSON.stringify(e.items))
that.itemsLeft2 = e.items;
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
}
},
getTatolNum: function() {
getTatolNum: function() { //今日产量
var that = this;
var para = {
ReportType: this.ReportType,
......@@ -454,24 +425,20 @@ mui.plusReady(function() {
that.number = e.data;
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
},
//完成进度
getCompleteRatio: function(n) {
var that = this;
var para = {
IndexID: n
};
if (n == 0) {
return;
}
// console.log(JSON.stringify(para))
Api.post('/api/vMES/ProductionReport/IndexNoCompleteRatio', para, function(e) {
that.CompleteRatio = e.data;
// console.log(JSON.stringify(e))
......@@ -481,11 +448,9 @@ mui.plusReady(function() {
// console.log(that.CompleteRatio);
}
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
},
reportDelete: function() {
var that = this;
......@@ -517,8 +482,8 @@ mui.plusReady(function() {
} else {
mui.toast("撤回失败" + e.message)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
......@@ -528,26 +493,20 @@ mui.plusReady(function() {
var para = {
ReportID: this.ReportID,
};
Api.post('/api/vMES/ProductionReport/ReportIndexNoDetail', para, function(e) {
if (e.success) {
that.itemsDetail = e.data;
that.itemsSize = e.data.SizeName;
that.itemsDetail1 = e.data.ReportDetail;
that.size = e.data.ReportSizeName;
that.qty = e.data.ReportQty;
that.selectSize(e.data.ReportSizeName);
} else {
mui.toast("获取明细失败:" + e.message)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
},
......@@ -580,9 +539,8 @@ mui.plusReady(function() {
} else {
mui.toast("获取sop地址失败: " + e.message)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
mui.toast(JSON.stringify(res.message))
});
},
......@@ -599,7 +557,7 @@ mui.plusReady(function() {
},
submit: function() {
if (!this.checkValue()) {
this.playVoice("sb.mp3");
playVoice("sb.mp3");
return;
}
var para = {
......@@ -620,22 +578,21 @@ mui.plusReady(function() {
that.getDataDetail2(1); //获取左边列表明细 今日实报
that.getDataDetail2(2); //获取左边列表明细 单款实报
that.getCompleteRatio(that.IndexID) //订单进度
that.playVoice("cg.mp3");
playVoice("cg.mp3");
that.getDetailInfor(that.IndexID, that.cur)
mui.toast("提交成功");
} else {
mui.toast("提交失败: " + e.message);
}
}, function(b, bb, bbb) {
that.playVoice("sb.mp3");
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
playVoice("sb.mp3");
mui.toast(JSON.stringify(res.message))
});
},
submitZD: function() {
var btnArray = ['否', '是'];
var that = this;
mui.confirm('请确认是否整单完工?', '提示', btnArray, function(e) {
if (e.index == 1) {
var para = {
......@@ -644,7 +601,7 @@ mui.plusReady(function() {
}
// console.log(JSON.stringify(para));
console.log(JSON.stringify(that.rightInfor));
// console.log(JSON.stringify(para));
Api.post('/api/vMES/ProductionReport/SingleComplete', para, function(e) {
......@@ -658,16 +615,32 @@ mui.plusReady(function() {
that.getTatolNum(); //获取今日完成数量
that.getDataDetail2(1); //获取左边列表明细
that.getCompleteRatio(that.IndexID) //订单进度
that.playVoice("cg.mp3");
mui.toast("提交成功");
playVoice("cg.mp3");
//that.getData();
//if(para.IndexID==)
mui.toast("提交成功");
var todoIndexArr = that.itemsHead;
//console.log(todoIndexArr.length);
var delIndexNoIndx = -1;
for(var i=0; i< todoIndexArr.length;i++){
if(todoIndexArr[i].IndexID == para.IndexID)
delIndexNoIndx = i;
}
todoIndexArr.splice(delIndexNoIndx, 1);
if(todoIndexArr.length - 1 >= delIndexNoIndx) {
that.cur=delIndexNoIndx;
that.rightInfor = todoIndexArr[delIndexNoIndx];
}
else{
that.cur = todoIndexArr.length;
that.rightInfor = todoIndexArr[delIndexNoIndx-1];
}
} else {
mui.toast("提交失败: " + e.message);
}
}, function(b, bb, bbb) {
that.playVoice("sb.mp3");
mui.toast(JSON.stringify(bbb.message))
}, function(xhr, type, res) {
playVoice("sb.mp3");
mui.toast(JSON.stringify(res.message))
});
......@@ -822,14 +795,10 @@ mui.plusReady(function() {
},
selectDisplay: function(n, completeState) {
console.log("selectDisplay:" + n)
//var opt = document.getElementById("item1")
//var opt2 = document.getElementById("item2")
selectDisplay: function(n) {
//console.log("selectDisplay:" + n)
var n1 = document.getElementById("n1")
var n2 = document.getElementById("n2")
if (n == 1) {
this.completeState = true;
this.ChangeState(1);
......@@ -837,12 +806,11 @@ mui.plusReady(function() {
n1.style.color = "white"
n2.style.background = "white"
n2.style.color = "royalblue"
//opt.style.display = "inline-block";
// opt2.style.display = "none";
}
if (n == 2) {
} else if (n == 2) {
this.completeState = false;
//this.searchState=false;
this.ChangeState(2);
n1.style.background = "white"
n1.style.color = "royalblue"
......@@ -1031,8 +999,42 @@ mui.plusReady(function() {
console.log("back")
mui.back()
// plus.screen.lockOrientation("portrait-primary") //横屏
},
changePosition: function() {
var btn1 = document.getElementById("changePosition");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height);
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height1);
if (Height > Height1) {
btn1.style.display = "none";
} else {
btn1.style.display = "block";
}
}
},
changePosition1: function() {
var btn1 = document.getElementById("changePosition");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
if (Height < Height1) {
btn1.style.display = "block";
} else {
btn1.style.display = "none";
}
}
}
}
})
\ No newline at end of file
function playVoice(filename) {
if (plus.audio == undefined) {
} else {
// 播放操作
var p = plus.audio.createPlayer("_www/dest/voice/" + filename);
p.play(function() {
//alert( "Audio play success!" );
}, function(e) {
//alert( "Audio play failed: " + e.message );
});
}
}
\ No newline at end of file
var Context={__context:null,getContext:function(){if(this.__context!=null){return this.__context}var state=JSON.parse(localStorage.getItem("$state"))||{};var token=state.token||'';var URL=state.host||'';this.__context={token:token,host:URL,image_url:state.image_url||''};return this.__context},getImageUrl:function(md5,width,height,rate){var url=Context.getContext().image_url+'?md5='+md5;if(width&&width>0){url+='&width='+width}if(height&&height>0){url+='&height='+height}if(rate&&rate>0){url+='&rate='+rate}return url},isLogin:function(){var context=Context.getContext();return context.token!=''}};var Dom={getById:function(id){return document.getElementById(id)},clickAOpen:function(el,url,extras){mui(el).on('tap','a',function(){mui.openWindow({url:url,id:url,extras:extras})})},open(url,extras){mui.openWindow({url:url,id:url,extras:extras})}};var Api={post:function(url,data,success,error){var context=Context.getContext();var host=context.host;data=data||{};data.token=context.token;error=error||this.__defaultErrorHandlder;Log.log("web request:"+host+url+' data:'+JSON.stringify(data));mui.ajax(host+url,{type:'POST',data:data,dataType:'json',timeout:5000,headers:{'Content-Type':'application/json'},crossDomain:true,success:function(res,type,xhr){if(res.success){success(res)}else{error(xhr,type,res)}},error:error})},postAndWaiting:function(url,data,success,error){var waitingObj=null;function showWaiting(){if(waitingObj){waitingObj.close();waitingObj=null}waitingObj=plus.nativeUI.showWaiting("加载数据中...")}function closeWaiting(){if(waitingObj){waitingObj.close();waitingObj=null}}showWaiting();var context=Context.getContext();var host=context.host;data=data||{};data.token=context.token;error=error||this.__defaultErrorHandlder;Log.log("web request:"+host+url+' data:'+JSON.stringify(data));mui.ajax(host+url,{type:'POST',data:data,dataType:'json',timeout:10000,headers:{'Content-Type':'application/json'},success:function(res,type,xhr){closeWaiting();if(res.success){success(res)}else{error(xhr,type,res)}},error:function(xhr,type,e){closeWaiting();error(xhr,type,e)}})},__defaultErrorHandlder:function(xhr,status,e){console.log(xhr.responseText);console.log(xhr.responseXML);console.log('status'+xhr.status);console.log(xhr.statusText);var msg='';if(e&&e.hasOwnProperty('code')){var code=e.code;switch(code){case 2:msg="用户名或者密码错误";break;case 3:msg="登录已过期";break;case 4:msg="未知的服务器错误";break;case 5:msg="公司不可用";break;case 6:msg="未知错误";break;case 7:msg="公司不存在";break;case 8:msg="请求参数有问题";break;default:case 0:msg="未指定的错误";break}mui.toast(msg);console.log(msg)}else{var error_msg='';if(status=='abort'){error_msg='网络错误,请检查设备的网络连接.'}else{error_msg='发生了一个错误'}mui.toast(error_msg);console.log(error_msg);console.log(e)}}};var ArrayUtil={addField:function(items,fieldName,defaultValue){for(var i=0;i<items.length;i+=1){items[i][fieldName]=defaultValue}},setField:function(items,fieldName,value){for(var i=0;i<items.length;i+=1){items[i][fieldName]=value}}};var __PRINT_LOG=true;var Log={printStack:function(){if(__PRINT_LOG){try{throw new Error("print Statck")}catch(ex){console.log(ex.stack)}}},log:function(val){if(__PRINT_LOG){console.log(val)}}};var Sys={isIos:function(){var osname=plus.os.name.toLowerCase();return osname=='ios'},isAndroid:function(){var osname=plus.os.name.toLowerCase();return osname=='android'}};
\ No newline at end of file
var Context = {
__context: null,
getContext: function() {
if (this.__context != null) {
return this.__context
}
var state = JSON.parse(localStorage.getItem("$state")) || {};
var token = state.token || '';
var URL = state.host || '';
this.__context = {
token: token,
host: URL,
image_url: state.image_url || ''
};
return this.__context
},
getImageUrl: function(md5, width, height, rate) {
var url = Context.getContext().image_url + '?md5=' + md5;
if (width && width > 0) {
url += '&width=' + width
}
if (height && height > 0) {
url += '&height=' + height
}
if (rate && rate > 0) {
url += '&rate=' + rate
}
return url
},
isLogin: function() {
var context = Context.getContext();
return context.token != ''
}
};
var Dom = {
getById: function(id) {
return document.getElementById(id)
},
clickAOpen: function(el, url, extras) {
mui(el).on('tap', 'a', function() {
mui.openWindow({
url: url,
id: url,
extras: extras
})
})
},
open(url, extras) {
mui.openWindow({
url: url,
id: url,
extras: extras
})
}
};
var Api = {
post: function(url, data, success, error) {
var context = Context.getContext();
var host = context.host;
data = data || {};
data.token = context.token;
error = error || this.__defaultErrorHandlder;
Log.log("web request:" + host + url + ' data:' + JSON.stringify(data));
mui.ajax(host + url, {
type: 'POST',
data: data,
dataType: 'json',
timeout: 5000,
headers: {
'Content-Type': 'application/json'
},
crossDomain: true,
success: function(res, type, xhr) {
if (res.success) {
success(res)
} else {
error(xhr, type, res)
}
},
error: error
})
},
postAndWaiting: function(url, data, success, error) {
var waitingObj = null;
function showWaiting() {
if (waitingObj) {
waitingObj.close();
waitingObj = null
}
waitingObj = plus.nativeUI.showWaiting("加载数据中...")
}
function closeWaiting() {
if (waitingObj) {
waitingObj.close();
waitingObj = null
}
}
showWaiting();
var context = Context.getContext();
var host = context.host;
data = data || {};
data.token = context.token;
error = error || this.__defaultErrorHandlder;
Log.log("web request:" + host + url + ' data:' + JSON.stringify(data));
mui.ajax(host + url, {
type: 'POST',
data: data,
dataType: 'json',
timeout: 10000,
headers: {
'Content-Type': 'application/json'
},
success: function(res, type, xhr) {
closeWaiting();
if (res.success) {
success(res)
} else {
error(xhr, type, res)
}
},
error: function(xhr, type, e) {
closeWaiting();
error(xhr, type, e)
}
})
},
__defaultErrorHandlder: function(xhr, status, e) {
console.log(xhr.responseText);
console.log(xhr.responseXML);
console.log('status' + xhr.status);
console.log(xhr.statusText);
var msg = '';
if (e && e.hasOwnProperty('code')) {
var code = e.code;
switch (code) {
case 2:
msg = "用户名或者密码错误";
break;
case 3:
msg = "登录已过期";
break;
case 4:
msg = "未知的服务器错误";
break;
case 5:
msg = "公司不可用";
break;
case 6:
msg = "未知错误";
break;
case 7:
msg = "公司不存在";
break;
case 8:
msg = "请求参数有问题";
break;
default:
case 0:
msg = "未指定的错误";
break
}
mui.toast(msg);
console.log(msg)
} else {
var error_msg = '';
if (status == 'abort') {
error_msg = '网络错误,请检查设备的网络连接.'
} else {
error_msg = '发生了一个错误'
}
mui.toast(error_msg);
console.log(error_msg);
console.log(e)
}
}
};
var ArrayUtil = {
addField: function(items, fieldName, defaultValue) {
for (var i = 0; i < items.length; i += 1) {
items[i][fieldName] = defaultValue
}
},
setField: function(items, fieldName, value) {
for (var i = 0; i < items.length; i += 1) {
items[i][fieldName] = value
}
}
};
var __PRINT_LOG = true;
var Log = {
printStack: function() {
if (__PRINT_LOG) {
try {
throw new Error("print Statck")
} catch (ex) {
console.log(ex.stack)
}
}
},
log: function(val) {
if (__PRINT_LOG) {
console.log(val)
}
}
};
var Sys = {
isIos: function() {
var osname = plus.os.name.toLowerCase();
return osname == 'ios'
},
isAndroid: function() {
var osname = plus.os.name.toLowerCase();
return osname == 'android'
}
};
......@@ -34,28 +34,42 @@
<div class="mui-table-view mui-table-view-chevron">
<ul class="complet-detail" :class="{active:cur==index}" v-for="(list,index) in itemsHead" :key="list.IndexID"
@click="getDetailInfor(list.IndexID,index)">
<li><span>指令号:</span><span>{{list.IndexNo}}</span></li>
<li><span>小组:</span><span>{{list.WorkTeam}}</span></li>
<li><span>货号:</span><span class="blueColor">{{list.StyleCode}}</span></li>
<li><span>数量:</span><span class="redColor">{{list.Qty}}</span></li>
<li><span>计划时间:</span><span>{{list.PlanDate}}</span></li>
<li><span>预计交期:</span><span>{{list.OrderDeliveryTime}}</span></li>
<li><span>计划人:</span><span>{{list.PlanMan}}</span></li>
<!-- <li class="mui-progressbar mui-progressbar-in" data-progress="30"><span></span></li> -->
<li>
<p><span>指令号:</span><span>{{list.IndexNo}}</span></p>
<p><span>小组:</span><span>{{list.WorkTeam}}</span></p>
</li>
<li>
<p><span>货号:</span><span class="blueColor">{{list.StyleCode}}</span></p>
<p><span>数量:</span><span class="redColor">{{list.Qty}}</span></p>
</li>
<li>
<p><span>计划时间:</span><span>{{list.PlanDate}}</span></p>
</li>
<li>
<p><span>预计交期:</span><span>{{list.OrderDeliveryTime}}</span></p>
<p><span>计划人:</span><span>{{list.PlanMan}}</span></p>
</li>
</ul>
</div>
</div>
<div id="theTow" :state="!completeState" v-show="!completeState">
<div class="mui-table-view1 mui-table-view-chevron">
<ul class="complet-detail" v-for="(list,index) in itemsLeft2" :class="{active:cur==index}" @click="getDetailInfor(list.IndexID,index)">
<li><span>指令号:</span><span>{{list.IndexNo}}</span></li>
<li><span>小组:</span><span>{{list.WorkTeam}}</span></li>
<li><span>货号:</span><span class="blueColor">{{list.StyleCode}}</span></li>
<li><span>数量:</span><span class="redColor">{{list.Qty}}</span></li>
<li><span>计划时间:</span><span>{{list.PlanDate}}</span></li>
<li><span>预计交期:</span><span>{{list.OrderDeliveryTime}}</span></li>
<li><span>计划人:</span><span>{{list.PlanMan}}</span></li>
<li>
<p><span>指令号:</span><span>{{list.IndexNo}}</span></p>
<p><span>小组:</span><span>{{list.WorkTeam}}</span></p>
</li>
<li>
<p><span>货号:</span><span class="blueColor">{{list.StyleCode}}</span></p>
<p><span>数量:</span><span class="redColor">{{list.Qty}}</span></p>
</li>
<li>
<p><span>计划时间:</span><span>{{list.PlanDate}}</span></p>
</li>
<li>
<p><span>预计交期:</span><span>{{list.OrderDeliveryTime}}</span></p>
<p><span>计划人:</span><span>{{list.PlanMan}}</span></p>
</li>
</ul>
</div>
</div>
......@@ -64,8 +78,6 @@
</div>
</div>
</div>
<!----时报按钮----->
<div id="changePosition" class="mui-segmented-control btn_bottom">
......@@ -74,54 +86,47 @@
</div>
</div>
<div id="right" class="right">
<div id="right-2">
<div style="border: solid #DAE6EF 1px ; display: inline-block; width: 80%;">
<div class="right-2-top">
<ul class="mui-table-view">
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 指令号: </p>
<p style="float: left;width: 40%; color: #060606;">&nbsp;{{rightInfor.IndexNo}} </p>
<p style="float: left;width: 12%; color: #060606;">日期: </p>
<p style="float: left;width: 32%; color: #060606;">{{rightInfor.OrderDeliveryTime}} </p>
<p> 指令号: </p>
<p>&nbsp;{{rightInfor.IndexNo}} </p>
<p>日期: </p>
<p>{{rightInfor.OrderDeliveryTime}} </p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 货号: </p>
<p style="float: left;width: 40%;color: #1B83FE;">&nbsp;{{rightInfor.StyleCode}} </p>
<p style="float: left;width: 12%; color: #060606;">颜色: </p>
<p style="float: left;width: 32%; color: #060606;">{{rightInfor.ColorName}} </p>
<p> 货号: </p>
<p style="color: #1B83FE;">&nbsp;{{rightInfor.StyleCode}} </p>
<p>颜色: </p>
<p>{{rightInfor.ColorName}} </p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 完工数: </p>
<p style="float: left;width: 40%; color: red;">&nbsp;{{rightInfor.ReportQty}} </p>
<p style="float: left;width: 12%; color: #060606;">班组: </p>
<p style="float: left;width: 32%; color: #060606;">{{rightInfor.WorkTeam}} </p>
<p> 完工数: </p>
<p style="color: red;">&nbsp;{{rightInfor.ReportQty}} </p>
<p>班组: </p>
<p>{{rightInfor.WorkTeam}} </p>
</li>
</ul>
</div>
<div style=" display: inline-block; width: 17%; position: relative;top: -25px;">
<div class="left-submit">
<button type="button" class="mui-btn mui-btn-blue mui-btn-block" :disabled="disable_reportDelete" @click="reportDelete()">撤回实报</button>
<button type="button" class="mui-btn mui-btn-blue mui-btn-block" :disabled="disable_qq_" @click="nextPage(1,0)">品质问题</button>
</div>
</div>
<div id="right-4" style=" margin-top: -20px ;">
<div id="right-4">
<div class="detail-header">
<table class="mui-table ">
<thead class="mui-table-view">
<tr>
<th style="font-size: 16px;font-weight: normal;background-color: #E2E2E9;">尺码</th>
<th style="font-size: 16px;font-weight: normal;background-color: #E2E2E9;">数量</th>
<th style="font-size: 16px;font-weight: normal;background-color: #E2E2E9;">完工数</th>
<th style="font-size: 16px;font-weight: normal;background-color: #E2E2E9;">不合格数</th>
<th>尺码</th>
<th>数量</th>
<th>完工数</th>
<th>不合格数</th>
</tr>
</thead>
</table>
<div class="mui-scroll-wrapper scroll4 item_table ">
<div class="mui-scroll">
......@@ -132,9 +137,7 @@
<td class="altrowstable" align="center">{{itemdetail.Qty}}</td>
<td class="altrowstable" align="center">{{itemdetail.QualifiedQty}}</td>
<td class="altrowstable" @click="nextPage(2,itemdetail.SizeName)" align="center">{{itemdetail.UnQualifiedQty}}</td>
</tr>
</tbody>
</table>
</div>
......@@ -146,30 +149,20 @@
<button type="button" class="mui-btn mui-btn-blue mui-btn-block" :disabled="disable_qq_" @click="submitZD">整单完工</button>
</div>
<div class="Rcomputed">
<input readonly="readonly" style="border: 1px solid #DDDDDD; width: 170px ;height: 70px;margin-right: -6px;margin-bottom: -1px; text-align: center;color: red;background: #C8C7CC;font-size: 25px "
onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" v-model="qty" :value="qty" :onchange="changeValue()" />
<input readonly="readonly" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" v-model="qty" :value="qty"
:onchange="changeValue()" />
<button @click="backNumber(1)"> ←</button>
<button style=" margin-right: -6px;margin-bottom: -1px;" @click="selectNumber(1)">
1</button>
<button style="margin-right: -5px;margin-bottom: -1px;" @click="selectNumber(2)">
2</button>
<button style="margin-bottom: -1px;" @click="selectNumber(3)">
3</button>
<button style="margin-right: -6px ;margin-bottom: -1px;" @click="selectNumber(4)">
4</button>
<button style="margin-right: -5px;margin-bottom: -1px;" @click="selectNumber(5)">
5</button>
<button style=" margin-bottom: -1px;" @click="selectNumber(6)"> 6</button>
<button style=" margin-bottom: -1px; margin-right: -6px;" @click="selectNumber(7)">
7</button>
<button style="margin-bottom: -1px;; margin-right: -5px;" @click="selectNumber(8)">
8</button>
<button style="margin-bottom: -1px;" @click="selectNumber(9)"> 9</button>
<button style="margin-right: -6px;" @click="selectNumber(0)"> 0</button>
<button class="mui-btn-blue" style=" width: 170px;" @click="submit" :disabled="disable_save_button_C">
提交</button>
<button @click="selectNumber(1)">1</button>
<button @click="selectNumber(2)">2</button>
<button @click="selectNumber(3)">3</button>
<button @click="selectNumber(4)">4</button>
<button @click="selectNumber(5)">5</button>
<button @click="selectNumber(6)">6</button>
<button @click="selectNumber(7)">7</button>
<button @click="selectNumber(8)">8</button>
<button @click="selectNumber(9)"> 9</button>
<button @click="selectNumber(0)"> 0</button>
<button class="mui-btn-blue" @click="submit" :disabled="disable_save_button_C">提交</button>
</div>
</div>
......@@ -178,9 +171,6 @@
</div>
</div>
</div>
<script src="../dest/js/mui.min.js"></script>
<script src="../dest/js/mui.picker.min.js"></script>
<script src="../dest/js/createView.min.js"></script>
......@@ -188,1050 +178,9 @@
<script src="../dest/js/vue.min.js"> </script>
<script src="../dest/js/moment.js"></script>
<script src="../js/mui.pullToRefresh.js"></script>
<!-- <script src="../dest/js/mes/cutting.js"></script> -->
<script type="text/javascript">
mui.plusReady(function() {
// plus.nativeUI.closeWaiting();
plus.nativeUI.showWaiting()
// mui.currentWebview.show();
initPage();
});
function initPage() {
plus.screen.lockOrientation("landscape-primary") //横屏
app.init();
}
var app = new Vue({
el: '#app',
data: {
number: 0,
qty: 0,
size: 0,
dateTime: "",
today: "",
link: "",
itemsDetail: [], //订单明细
itemsDetail1: [], //
itemsDetail2: [], //
paramUnDo: {
pageIndex: 2,
pageSize: 10
},
paramDone: {
pageIndex: 2,
pageSize: 10
},
itemsHead: [], //未完成和搜索左侧数组
itemsLeft: [],
itemsLeft2: [], //已完成左侧数组
itemsSize: [],
SizeQty: [],
ReportType: 0,
IndexID: 0,
rightInfor: [], //右侧详情
cur: 0, //点击选中当前状态
completeState: true, //切换已完成和未完成状态
searchText: '', //搜索框输入的内容
datalen: 20, //默认取数据数量
reDatalen: 10, //每次加载的数据数量
disable_reportDelete: 'disabled',
disable_qq: 'disabled',
ReportID: 0,
Report_IndexID: 0,
Model: 0,
CompleteRatio: 0, //完成进度
unPagenum: 1, //未完成页数
pagenum: 1, //已完成页数
displayModel: 1,
zhezhao: 1, //
mask_: mui.createMask(function(e) {
return false;
}),
appdis: 0,
},
computed: {
disable_save_button_C: function() {
if (this.size != 0 && this.qty != 0 && this.IndexID != 0 && this.Model == 0) {
return null;
} else {
return 'disabled';
}
},
disable_qq_: function() {
if (this.IndexID != 0 && this.Model == 0) {
return null;
} else {
return 'disabled';
}
},
display_: function() {
if (this.displayModel == 1) {
return "display: none "
}
},
SOP__: function() {
if (this.IndexID == 0) {
return "disabled"
} else {
return null
}
},
},
methods: {
init: function() { //初始化
mui.init({
pullRefresh: {
container: '#pullrefresh',
up: {
height: 100,
contentrefresh: '正在加载...',
contentnomore: '没有更多数据了',
callback: function() {
var reUnfinished = document.getElementById("theOne").getAttribute("state");
var reFinished = document.getElementById("theTow").getAttribute("state");
var UnfinishedUrl = '/api/vMES/CutOffProductionReport/ToDo';
var FinishedUrl = '/api/vMES/CutOffProductionReport/Done';
var searchUrl = '/api/vMES/CutOffProductionReport/Search';
//console.log("未完成" + reUnfinished)
//console.log("已完成" + reFinished)
var UnfinishedData = app.itemsHead;
var FinishedUrlData = app.itemsLeft2;
//var rightInfor = app.rightInfor;
if (reUnfinished) {
if (app.searchText != "") {
searchPull(searchUrl, UnfinishedData, app.paramUnDo);
}
pullupRefresh(UnfinishedUrl, UnfinishedData, app.paramUnDo);
} else if (reFinished) {
pullupRefresh(FinishedUrl, FinishedUrlData, app.paramDone);
}
}
},
}
});
function pullupRefresh(url, arr, params) {
//console.log("加载前1" + arr);
setTimeout(function() {
var para = {
PageSize: params.pageSize,
PageIndex: params.pageIndex
};
console.log("canshu:" + JSON.stringify(para));
//console.log("之前的数据:" + arr);
Api.post(url, para, function(e) { //2.没数据 提示 但是可以一直发请求只不过传回来是空
if (e.success) {
console.log("111:" + JSON.stringify(e.items));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
//console.log("data"+data);
//console.log("之后的arr"+arr);
//console.log("页数:"+params.pageIndex);
console.log("canshuqq:" + JSON.stringify(para));
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //参数为true代表没有更多数据了。
mui('#pullrefresh').pullRefresh().refresh(true);
//mui('#pullrefresh').pullRefresh().disablePullupToRefresh();
}, 1000);
}
function searchPull(url, arr, params) {
setTimeout(function() {
var para = {
searchText: app.searchText,
PageSize: params.pageSize,
PageIndex: params.pageIndex
};
//console.log("canshu:" + JSON.stringify(para));
Api.post(url, para, function(e) {
if (e.success) {
//console.log("111:" + JSON.stringify(e.items));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
//console.log("canshuqq:" + JSON.stringify(para));
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
mui('#pullrefresh').pullRefresh().refresh(true);
}, 1000);
}
window.addEventListener('back', function(e) {
var that = this;
app.getDataDetail1();
});
mui(".mui-icon-clear")[0].addEventListener('tap', function() {
document.activeElement.blur(); //收起虚拟键盘
app.searchText = '';
app.getData();
//console.log('1111');
});
setTimeout(function() {
plus.nativeUI.closeWaiting();
var ap = document.getElementById("app");
ap.style = " display: inline-block";
}, 200)
mui('.mui-scroll-wrapper').scroll({
bounce: false,
indicators: true, //是否显示滚动条
});
this.dateTime = moment().format().substring(0, 10)
this.today = this.dateTime;
this.getData();
},
playVoice: function(filename) {
if (plus.audio == undefined) {
} else {
// 播放操作
var p = plus.audio.createPlayer("_www/dest/voice/" + filename);
p.play(function() {
//alert( "Audio play success!" );
}, function(e) {
//alert( "Audio play failed: " + e.message );
});
}
},
getData: function() {
var that = this;
this.createZhezhao(-1)
var para = {
PageSize: that.datalen,
PageIndex: that.unPagenum
};
console.log("lalla" + JSON.stringify(para));
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
//console.log("one :::;" +JSON.stringify(e.items.length))
//console.log("右侧详情" + JSON.stringify(e.items))
//console.log("点击之前"+JSON.stringify(that.rightInfor))
if (e.items.length > 0) {
that.itemsHead = e.items;
that.rightInfor = e.items[0];
//that.itemsDetail = e.items[0];
that.IndexID = e.items[0].IndexID;
that.getDataDetail1();
that.getDataDetail2(1);
that.getTatolNum();
that.qty = 0;
that.disable_reportDelete = 'disabled';
} else {
that.itemsHead = [];
that.rightInfor = [];
//that.itemsDetail = [];
that.IndexID = 0;
that.itemsDetail1 = [];
that.itemsSize = [];
that.size = 0;
that.itemsLeft = [];
that.number = 0;
that.qty = 0;
that.disable_reportDelete = 'disabled'
that.getDataDetail2(1);
that.getTatolNum();
}
}, function(b, bb, bbb) {
console.log(bbb);
mui.toast(JSON.stringify(bbb.message))
});
},
getDetailInfor: function(idInfor, index) { //获取实报详细 未完成,已完成的的尺码明细信息
this.IndexID = idInfor;
var that = this;
that.cur = index;
that.searchText = '';
var para = {
"IndexID": idInfor
};
Api.post('/api/vMES/CutOffProductionReport/Detail', para, function(e) {
//console.log("详情" + JSON.stringify(e));
if (e.success) {
that.rightInfor = e.data;
//console.log("点击之后"+JSON.stringify(that.rightInfor))
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
},
ChangeState: function(n) { //改变状态,切换已完成和未完成
//n= 1 未完成 n=2 已完成
var that = this;
// console.log(JSON.stringify(para))
if (n == 1) {
var para = {
PageSize: that.datalen,
PageIndex: that.unPagenum
};
//console.log("do para " + JSON.stringify(para))
that.searchText = '';
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
that.cur = 0;
if(e.items.length>0){
that.itemsHead = e.items;
that.rightInfor = e.items[0];
}else{
that.itemsHead = [];
that.rightInfor = [];
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
} else if (n == 2) {
var para = {
PageSize: that.datalen,
PageIndex: that.pagenum
};
console.log("do para " + JSON.stringify(para))
Api.post('/api/vMES/CutOffProductionReport/Done', para, function(e) {
console.log("已完成" + JSON.stringify(e.items))
var data = e.items.length;
if (data > 0) {
that.itemsLeft2 = e.items;
that.rightInfor = e.items[0];
that.cur = 0;
} else {
that.rightInfor = [];
that.itemsLeft2 = [];
that.cur = 0;
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
}
},
goSearch: function(event) {
var that = this;
var para = {
SearchText: that.searchText,
PageSize: 200,
PageIndex: that.pagenum,
};
if (event.keyCode == "13") {
document.activeElement.blur(); //收起虚拟键盘
if (that.searchText == '') return;
Api.post('/api/vMES/CutOffProductionReport/Search', para, function(e) {
var data = e.items.length;
if (data > 0) {
that.itemsHead = e.items;
that.rightInfor = e.items[0];
that.cur = 0;
} else {
that.itemsHead = [];
that.rightInfor = [];
that.cur = 0;
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
event.preventDefault(); // 阻止默认事件---阻止页面刷新
//that.searchText = '';
}
},
getDataDetail1: function() {
var that = this;
var para = {
IndexID: this.IndexID,
};
if (this.IndexID == 0) {
return;
}
Api.post('/api/vMES/ProductionReport/ProductIndexNoDetail', para, function(e) {
if (e.success) {
that.itemsDetail = e.data;
that.itemsDetail1 = e.data.ReportDetail;
that.itemsSize = e.data.SizeName;
//console.log("右侧信息"+JSON.stringify(that.itemsDetail).length)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
},
getDataDetail2: function(n) {
//n= 1 未完成 n=2 已完成
var that = this;
var para = {
ReportType: this.ReportType,
IndexID: n == 1 ? 0 : this.IndexID,
PageSize: 200,
PageIndex: 1,
};
// console.log(JSON.stringify(para))
if (n == 1) {
Api.post('/api/vMES/CutOffProductionReport/ToDo', para, function(e) {
that.itemsLeft = e.items;
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
} else if (n == 2) {
console.log("getDataDetail2:::: " + n + this.IndexID)
Api.post('/api/vMES/CutOffProductionReport/Done', para, function(e) {
console.log("itemsLeft2" + JSON.stringify(e.items))
that.itemsLeft2 = e.items;
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
}
},
getTatolNum: function() { //今日产量
var that = this;
var para = {
ReportType: this.ReportType,
Date: this.dateTime + " 00:00:00",
};
Api.post('/api/vMES/ProductionReport/TotalQty', para, function(e) {
if (e.success) {
that.number = e.data;
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
},
//完成进度
getCompleteRatio: function(n) {
var that = this;
var para = {
IndexID: n
};
if (n == 0) {
return;
}
// console.log(JSON.stringify(para))
Api.post('/api/vMES/ProductionReport/IndexNoCompleteRatio', para, function(e) {
that.CompleteRatio = e.data;
// console.log(JSON.stringify(e))
for (var i = 0; i < that.itemsHead.length; i++) {
if (that.itemsHead[i].IndexID == n) {
that.itemsHead[i].CompleteRatio = that.CompleteRatio;
// console.log(that.CompleteRatio);
}
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
},
reportDelete: function() {
var that = this;
var para = {
ReportID: this.ReportID,
};
Api.post('/api/vMES/ProductionReport/Delete', para, function(e) {
if (e.success) {
that.createZhezhao(-1)
that.disable_reportDelete = 'disabled'
that.size = 0;
that.qty = 0;
that.getCompleteRatio(that.Report_IndexID); //订单进度
that.selectSize(0);
that.selectReport(0);
that.selectReport2(0);
that.getDataDetail1(); //获取列表尺码对应数量
that.getTatolNum(); //获取今日完成数量
that.getDataDetail2(1); //获取左边列表明细
that.getDataDetail2(2);
that.Model = 0;
if (that.IndexID != 0) {
var Index = document.getElementById("Index_" + that.IndexID)
Index.style.background = "#02C1ED";
}
mui.toast("撤回成功")
} else {
mui.toast("撤回失败" + e.message)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
},
getDataByReportID: function() {
var that = this;
var para = {
ReportID: this.ReportID,
};
Api.post('/api/vMES/ProductionReport/ReportIndexNoDetail', para, function(e) {
if (e.success) {
that.itemsDetail = e.data;
that.itemsSize = e.data.SizeName;
that.itemsDetail1 = e.data.ReportDetail;
that.size = e.data.ReportSizeName;
that.qty = e.data.ReportQty;
that.selectSize(e.data.ReportSizeName);
} else {
mui.toast("获取明细失败:" + e.message)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
},
getLink: function() {
var that = this;
var para = {
ReportType: this.ReportType,
StyleCode: this.itemsDetail.StyleCode
}
// console.log( JSON.stringify(para))
Api.post('/api/vMES/Sop/StyleSop', para, function(e) {
if (e.success) {
// console.log( JSON.stringify(e))
that.link = e.data.Url;
var url_ = "sop.html";
var id_ = "sop.html";
mui.openWindow({
url: url_,
id: id_,
extras: {
style: that.itemsDetail.StyleCode,
ReportType: that.ReportType,
link: that.link,
parentPage: "Cutting.html"
},
});
} else {
mui.toast("获取sop地址失败: " + e.message)
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
},
SizeQtyA: function() {
for (var i = 0; i < this.itemsSize.length; i++) {
var tempa = {
size: this.itemsSize[i],
qty: 0
}
this.SizeQty.push(tempa);
}
},
submit: function() {
if (!this.checkValue()) {
this.playVoice("sb.mp3");
return;
}
var para = {
IndexID: this.IndexID,
SizeName: this.size,
Qty: this.qty,
}
var that = this;
Api.post('/api/vMES/ProductionReport/Save', para, function(e) {
if (e.success) {
// that.disable_save_button = 'disabled'
that.size = 0;
that.qty = 0;
that.selectSize(0);
that.getDataDetail1(); //获取列表尺码对应数量
that.getTatolNum(); //获取今日完成数量
that.getDataDetail2(1); //获取左边列表明细 今日实报
that.getDataDetail2(2); //获取左边列表明细 单款实报
that.getCompleteRatio(that.IndexID) //订单进度
that.playVoice("cg.mp3");
that.getDetailInfor(that.IndexID, that.cur)
mui.toast("提交成功");
} else {
mui.toast("提交失败: " + e.message);
}
}, function(b, bb, bbb) {
that.playVoice("sb.mp3");
mui.toast(JSON.stringify(bbb.message))
});
},
submitZD: function() {
var btnArray = ['否', '是'];
var that = this;
mui.confirm('请确认是否整单完工?', '提示', btnArray, function(e) {
if (e.index == 1) {
var para = {
ReportType: this.ReportType,
IndexID: that.IndexID,
}
// console.log(JSON.stringify(para));
// console.log(JSON.stringify(para));
Api.post('/api/vMES/ProductionReport/SingleComplete', para, function(e) {
if (e.success) {
// that.disable_save_button = 'disabled'
that.size = 0;
that.qty = 0;
that.selectSize(0);
that.getDataDetail1(); //获取列表尺码对应数量
that.getTatolNum(); //获取今日完成数量
that.getDataDetail2(1); //获取左边列表明细
that.getCompleteRatio(that.IndexID) //订单进度
that.playVoice("cg.mp3");
mui.toast("提交成功");
} else {
mui.toast("提交失败: " + e.message);
}
}, function(b, bb, bbb) {
that.playVoice("sb.mp3");
mui.toast(JSON.stringify(bbb.message))
});
} else {
return;
}
})
},
selectIndex: function(idx) {
this.createZhezhao(-1) //关闭遮罩
var indxx = document.getElementsByClassName("Index");
var indx = document.getElementById("Index_" + idx)
for (var i = 0; i < indxx.length; i++) {
indxx[i].style.background = "";
}
indx.style.background = "#02C1ED";
this.IndexID = idx
this.Model = 0
if (this.IndexID != 0) {
this.getDataDetail1();
this.getDataDetail2(1);
this.getDataDetail2(2);
this.getTatolNum();
this.selectSize(0);
this.selectReport(0);
this.qty = 0;
this.size = 0;
this.disable_reportDelete = 'disabled';
} else {
this.itemsDetail = [];
this.IndexID = 0;
this.itemsDetail1 = [];
this.itemsSize = [];
this.size = 0;
this.itemsLeft = [];
this.number = 0;
this.qty = 0;
this.disable_reportDelete = 'disabled'
}
mui('.scroll1').scroll().scrollTo(0, 0, 100);
mui('.scroll2').scroll().scrollTo(0, 0, 100);
// mui('.scroll3').scroll().scrollTo(0,0,100);
mui('.scroll4').scroll().scrollTo(0, 0, 100);
},
createZhezhao: function(n) {
// console.log(n)
if (n == -1) {
// var mask = mui.createMask();//callback为用户点击蒙版时自动执行的回调;
// this.mask_.close();
this.mask_._remove()
this.zhezhao = 1;
} else {
if (this.zhezhao == 1) {
// var mask = mui.createMask(function(e){
// return false;
//
// });//callback为用户点击蒙版时自动执行的回调;
this.mask_.show(); //显示遮罩
this.zhezhao = 2
// mask.close();//关闭遮罩
}
}
},
selectReport: function(obj) {
var op = document.getElementById("ReportID_" + obj)
this.ReportID = obj;
if (obj == 0) {
this.Report_IndexID = 0
} else {
this.createZhezhao(1)
for (var i = 0; i < this.itemsLeft.length; i++) {
if (this.itemsLeft[i].ReportID == obj) {
this.Report_IndexID = this.itemsLeft[i].IndexID
}
}
}
if (this.ReportID != 0) {
this.disable_reportDelete = null;
}
var reportele = document.getElementsByClassName("Report");
for (var i = 0; i < reportele.length; i++) {
reportele[i].style.background = ""
}
if (obj != 0) {
if (this.IndexID != 0) {
var Index = document.getElementById("Index_" + this.IndexID)
Index.style.background = "";
}
op.style.background = "#02C1ED";
this.Model = 1;
this.getDataByReportID();
}
},
selectReport2: function(obj) {
var op = document.getElementById("ReportID2_" + obj)
this.ReportID = obj;
if (obj == 0) {
this.Report_IndexID = 0
} else {
this.createZhezhao(1)
for (var i = 0; i < this.itemsLeft2.length; i++) {
if (this.itemsLeft2[i].ReportID == obj) {
this.Report_IndexID = this.itemsLeft2[i].IndexID
}
}
}
if (this.ReportID != 0) {
this.disable_reportDelete = null;
}
var reportele = document.getElementsByClassName("Report");
for (var i = 0; i < reportele.length; i++) {
reportele[i].style.background = ""
}
if (obj != 0) {
if (this.IndexID != 0) {
var Index = document.getElementById("Index_" + this.IndexID)
Index.style.background = "";
}
op.style.background = "#02C1ED";
this.Model = 1;
this.getDataByReportID();
}
},
selectDisplay: function(n) {
console.log("selectDisplay:" + n)
var n1 = document.getElementById("n1")
var n2 = document.getElementById("n2")
if (n == 1) {
this.completeState = true;
this.ChangeState(1);
n1.style.background = "royalblue"
n1.style.color = "white"
n2.style.background = "white"
n2.style.color = "royalblue"
} else if (n == 2) {
this.completeState = false;
//this.searchState=false;
this.ChangeState(2);
n1.style.background = "white"
n1.style.color = "royalblue"
n2.style.background = "royalblue"
n2.style.color = "white"
//opt.style.display = "none";
// opt2.style.display = "inline-block"
}
},
changeValue: function() {
if (isNaN(parseInt(this.qty))) {
this.qty = 0;
// this.disable_save_button = 'disabled';
}
if (parseInt(this.qty) > 0) {
this.qty = parseInt(this.qty);
// this.disable_save_button = null;
}
},
checkValue: function() {
//数量不正确
if (isNaN(parseInt(this.qty)) || parseInt(this.qty) <= 0) {
mui.toast("数量不正确")
return false;
}
//尺码不正确
else if (this.size == 0) {
mui.toast("尺码不正确")
return false;
} else if (this.IndexID == 0) {
mui.toast("订单号不正确")
return false;
} else {
return true;
}
},
backNumber: function() {
if (this.Model == 1) {
return;
}
var str = this.qty.toString();
this.qty = str.substring(0, str.length - 1);
},
selectNumber: function(n) {
if (this.Model == 1) {
return;
}
this.qty = this.qty.toString() + n.toString();
// this.qty = isNaN(parseInt(this.qty)) ? 0 + parseInt(n) : parseInt(this.qty) + parseInt(n);
},
selectSize: function(n) {
var bg = document.getElementsByClassName("bg");
for (var i = 0; i < bg.length; i++) {
bg[i].style.background = ""
if (bg[i].innerHTML == n) {
bg[i].style.background = "#02C1ED"
}
}
if (n != 0) {
this.size = n;
// bg[0].style.background = "#02C1ED"
}
},
nextday: function(n) {
this.createZhezhao(-1)
var d = new Date(this.dateTime);
d.setTime(d.getTime() + 24 * 60 * 60 * 1000 * n);
if (d.getDate().toString().length == 1) {
this.dateTime = d.getFullYear() + "-" + (d.getMonth() + 1) + "-0" + d.getDate();
} else {
this.dateTime = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
}
this.getData();
mui('.scroll1').scroll().scrollTo(0, 0, 100);
mui('.scroll2').scroll().scrollTo(0, 0, 100);
mui('.scroll3').scroll().scrollTo(0, 0, 100);
mui('.scroll4').scroll().scrollTo(0, 0, 100);
},
stylebg: function(n) {
if (n == 0) {
return {
"background": "#02C1ED"
}
}
},
nextPage: function(n, k) {
var url_;
var id_;
url_ = "CuttingQuality.html";
id_ = "CuttingQuality.html";
mui.openWindow({
url: url_,
id: id_,
extras: {
IndexID: this.IndexID,
dateTime: this.dateTime,
itemsDetail: this.itemsDetail,
itemsSize: this.itemsSize,
type: n, // n =2 点击不合格进去 ,
parentSize: k,
sizeNum: this.itemsDetail1 //尺码和数量
},
});
},
sop: function() {
this.getLink();
},
selecttime: function() {
var that = this;
var _self = document.getElementById("selectdate")
if (_self.picker) {
_self.picker.show(function(rs) {
_self.innerText = rs.text
_self.picker.dispose();
_self.picker = null;
});
} else {
var optionsJson = _self.getAttribute('data-options') || '{}';
var options = JSON.parse(optionsJson);
var id = _self.getAttribute('id');
/*
* 首次显示时实例化组件
* 示例为了简洁,将 options 放在了按钮的 dom 上
* 也可以直接通过代码声明 optinos 用于实例化 DtPicker
*/
_self.picker = new mui.DtPicker(options);
_self.picker.show(function(rs) {
/*
* rs.value 拼合后的 value
* rs.text 拼合后的 text
* rs.y 年,可以通过 rs.y.vaue 和 rs.y.text 获取值和文本
* rs.m 月,用法同年
* rs.d 日,用法同年
* rs.h 时,用法同年
* rs.i 分(minutes 的第二个字母),用法同年
*/
_self.innerText = rs.text;
that.dateTime = rs.text;
that.getData();
/*
* 返回 false 可以阻止选择框的关闭
* return false;
*/
/*
* 释放组件资源,释放后将将不能再操作组件
* 通常情况下,不需要示放组件,new DtPicker(options) 后,可以一直使用。
* 当前示例,因为内容较多,如不进行资原释放,在某些设备上会较慢。
* 所以每次用完便立即调用 dispose 进行释放,下次用时再创建新实例。
*/
_self.picker.dispose();
_self.picker = null;
});
}
mui('.scroll1').scroll().scrollTo(0, 0, 100);
mui('.scroll2').scroll().scrollTo(0, 0, 100);
mui('.scroll3').scroll().scrollTo(0, 0, 100);
mui('.scroll4').scroll().scrollTo(0, 0, 100);
}, //selecttime
back: function() {
console.log("back")
mui.back()
// plus.screen.lockOrientation("portrait-primary") //横屏
},
changePosition: function() {
var btn1 = document.getElementById("changePosition");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height);
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height1);
if (Height > Height1) {
btn1.style.display = "none";
} else {
btn1.style.display = "block";
}
}
},
changePosition1: function() {
var btn1 = document.getElementById("changePosition");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
if (Height < Height1) {
btn1.style.display = "block";
} else {
btn1.style.display = "none";
}
}
}
}
<script src="../dest/js/mes/playVoice.js"></script>
<script src="../dest/js/mes/cutting.js"></script>
})
</script>
</body>
</html>
......@@ -26,67 +26,48 @@
<div class="mui-scroll">
<div id="item1" :state="completeState" class="scroll1 leftList maeginTop">
<div class="mui-table-view mui-table-view-chevron">
<ul :id="items.IndexID" :class="{active:cur==n}" class="mui-table-view bg" v-for=" items,n in itemsLeft"
<ul :id="items.IndexID" :class="{active:cur==n}" class="mui-table-view bg needLeftList" v-for=" items,n in itemsLeft"
@click="selectLeft(items,n)">
<li style=" padding: 0px 15px 0px 15px; margin: 0">
<p style="float: left;width: 16%; color: #060606;padding: 0; margin: 0;"> 指令号: </p>
<p style="float: left;width: 39%; color: #060606;padding: 0; margin: 0;white-space:nowrap;text-overflow: ellipsis;overflow: hidden;">&nbsp;{{items.IndexNo}}
</p>
<p style="float: left;width: 12%; color: #060606;padding: 0; margin: 0;">班组: </p>
<p style="float: left;width: 32%; color: #060606;padding: 0; margin: 0;">{{items.WorkTeam}} </p>
<li>
<p><span>指令号:</span><span>{{items.IndexNo}}</span></p>
<p><span>班组:</span><span>{{items.WorkTeam}}</span></p>
</li>
<li style=" padding: 0px 15px 0px 15px; margin: 0;">
<p style="float: left;width: 16%; color: #060606;padding: 0; margin: 0;"> 货号: </p>
<p style="float: left;width: 39%;color: #1B83FE;padding: 0; margin: 0;white-space:nowrap;text-overflow: ellipsis;overflow: hidden;">&nbsp;{{items.StyleCode}}
</p>
<p style="float: left;width: 12%; color: #060606;padding: 0; margin: 0;">数量: </p>
<p style="float: left;width: 32%; color: red;padding: 0; margin: 0;">{{items.Qty}} </p>
<li>
<p><span>货号:</span><span class="blueColor">{{items.StyleCode}}</span></p>
<p><span>数量:</span><span class="redColor">{{items.Qty}}</span></p>
</li>
<li style=" padding: 0px 15px 0px 15px; margin: 0">
<p style="float: left;width: 20%; color: #060606; padding: 0; margin: 0;"> 计划时间: </p>
<p style="float: left;width: 80%; color: #060606;padding: 0; margin: 0;">&nbsp;{{items.PlanDate}} </p>
<li>
<p><span>计划时间:</span><span>{{items.PlanDate}}</span></p>
</li>
<li style=" padding: 0px 11px 2px 11px;position: relative; overflow: hidden;">
<p style="float: left;width: 20%; color: #060606;padding: 0; margin: 0;"> 实报时间: </p>
<p style="float: left;width: 35%; color: #060606;padding: 0; margin: 0;">&nbsp;{{items.ReportDate}} </p>
<p style="float: left;width: 16%; color: #060606;padding: 0; margin: 0;">实报人: </p>
<p style="float: left;width: 28%; color: #060606;padding: 0; margin: 0;">{{items.ReportUser}} </p>
<li>
<p><span>实报时间:</span><span>{{items.ReportDate}}</span></p>
<p><span>实报人:</span><span>{{items.ReportUser}}</span></p>
</li>
</ul>
</div>
</div>
<div id="item2" :state="!completeState" class="scroll2 leftList" :style="display_">
<div class="mui-table-view mui-table-view-chevron">
<ul :id="items.IndexID" :class="{active:cur==n}" class="mui-table-view bg" v-for=" items,n in itemsLeft2"
@click="selectLeft(items,n )">
<li style=" padding: 2px 15px 0px 15px; margin: 0">
<p style="float: left;width: 16%; color: #060606;padding: 0; margin: 0;white-space:nowrap;text-overflow: ellipsis;overflow: hidden;">
指令号: </p>
<p style="float: left;width: 40%; color: #060606;padding: 0; margin: 0;">&nbsp;{{items.IndexNo}} </p>
<p style="float: left;width: 12%; color: #060606;padding: 0; margin: 0;">班组: </p>
<p style="float: left;width: 32%; color: #060606;padding: 0; margin: 0;">{{items.WorkTeam}} </p>
<div id="item2" :state="!completeState" class="scroll2 leftList " :style="display_">
<div class="mui-table-view mui-table-view-chevron">
<ul :id="items.IndexID" :class="{active:cur==n}" class="mui-table-view bg needLeftList" v-for=" items,n in itemsLeft2"
@click="selectLeft(items,n )">
<li>
<p><span>指令号:</span><span>{{items.IndexNo}}</span></p>
<p><span>班组:</span><span>{{items.WorkTeam}}</span></p>
</li>
<li style=" padding: 0px 15px 0px 15px; margin: 0">
<p style="float: left;width: 16%; color: #060606;padding: 0; margin: 0;white-space:nowrap;text-overflow: ellipsis;overflow: hidden;">
货号: </p>
<p style="float: left;width: 40%;color: #1B83FE;padding: 0; margin: 0;">&nbsp;{{items.StyleCode}} </p>
<p style="float: left;width: 12%; color: #060606;padding: 0; margin: 0;">数量: </p>
<p style="float: left;width: 32%; color: red;padding: 0; margin: 0;">{{items.Qty}} </p>
<li>
<p><span>货号:</span><span class="blueColor">{{items.StyleCode}}</span></p>
<p><span>数量:</span><span class="redColor">{{items.Qty}}</span></p>
</li>
<li style=" padding: 0px 15px 0px 15px; margin: 0">
<p style="float: left;width: 20%; color: #060606;padding: 0; margin: 0;"> 计划时间: </p>
<p style="float: left;width: 80%; color: #060606;padding: 0; margin: 0;">&nbsp;{{items.PlanDate}} </p>
<li>
<p><span>计划时间:</span><span>{{items.PlanDate}}</span></p>
</li>
<li style=" padding: 0px 11px 2px 11px;position: relative; overflow: hidden;">
<p style="float: left;width: 20%; color: #060606;padding: 0; margin: 0;">实报时间: </p>
<p style="float: left;width: 35%; color: #060606;padding: 0; margin: 0;">&nbsp;{{items.ReportDate}} </p>
<p style="float: left;width: 16%; color: #060606;padding: 0; margin: 0;">实报人: </p>
<p style="float: left;width: 28%; color: #060606;padding: 0; margin: 0;">{{items.ReportUser}} </p>
<li>
<p><span>实报时间:</span><span>{{items.ReportDate}}</span></p>
<p><span>实报人:</span><span>{{items.ReportUser}}</span></p>
</li>
</ul>
</div>
</div>
......@@ -104,58 +85,49 @@
<div id="right-1">
<ul class="mui-table-view">
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 指令号: </p>
<p style=""> 指令号: </p>
<p style="float: left;width: 40%; color: #060606;white-space:nowrap;text-overflow: ellipsis;overflow: hidden;">&nbsp;{{itemsDetail.IndexNo}}
</p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 货号: </p>
<p style="float: left;width: 40%;color: #1B83FE;white-space:nowrap;text-overflow: ellipsis;overflow: hidden;">&nbsp;{{itemsDetail.StyleCode}}
</p>
<p style="float: left;width: 12%; color: #060606;">颜色: </p>
<p style="float: left;width: 32%; color: #060606;">{{itemsDetail.ColorName}} </p>
<p> 货号: </p>
<p class="blueColor">&nbsp;{{itemsDetail.StyleCode}}</p>
<p>颜色: </p>
<p>{{itemsDetail.ColorName}} </p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 数量: </p>
<p style="float: left;width: 40%; color: red;">&nbsp;{{itemsDetail.FinishQty}} </p>
<p> 数量: </p>
<p class="redColor">&nbsp;{{itemsDetail.FinishQty}} </p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 不合格数: </p>
<p style="float: left;width: 40%; color: red;">&nbsp;{{itemsDetail.UnQualifiedQty}} </p>
<p style="float: left;width: 12%; color: #060606;">报废数: </p>
<p style="float: left;width: 32%; color: red;">{{itemsDetail.ScrapQty}} </p>
<p> 不合格数: </p>
<p class="redColor">&nbsp;{{itemsDetail.UnQualifiedQty}} </p>
<p>报废数: </p>
<p class="redColor">{{itemsDetail.ScrapQty}} </p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 发包: </p>
<p style="float: left;width: 40%; color: #060606;">&nbsp;{{itemsDetail.WorkTeam}} </p>
<p style="float: left;width: 12%; color: #060606;">收包: </p>
<p style="float: left;width: 32%; color: #060606;">{{itemsDetail.ToWorkTeam}} </p>
<p> 发包: </p>
<p>&nbsp;{{itemsDetail.WorkTeam}} </p>
<p>收包: </p>
<p>{{itemsDetail.ToWorkTeam}} </p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 计划时间: </p>
<p style="float: left;width: 40%; color: #060606;">&nbsp;{{itemsDetail.PlanDate}} </p>
<p style="float: left;width: 12%; color: 060606;">实报时间: </p>
<p style="float: left;width: 32%; color: 060606;">{{itemsDetail.ReportDate}} </p>
<p> 计划时间: </p>
<p>&nbsp;{{itemsDetail.PlanDate}} </p>
<p>实报时间: </p>
<p>{{itemsDetail.ReportDate}} </p>
</li>
<li class="mui-table-view-cell">
<p style="float: left;width: 16%; color: #060606;"> 实报人: </p>
<p style="float: left;width: 40%; color: #060606;">&nbsp;{{itemsDetail.ReportUser}} </p>
<p> 实报人: </p>
<p>&nbsp;{{itemsDetail.ReportUser}} </p>
</li>
</ul>
</div>
</div>
<div id="right-2">
<button type="button" class="mui-btn mui-btn-blue " :disabled="sty1" @click="selectPerson">人员排班</button>
<button type="button" class="mui-btn mui-btn-blue " :disabled="sty1" @click="submit">{{submitText}}</button>
</div>
</div>
......@@ -164,407 +136,10 @@
<script src="../dest/js/mui.min.js"></script>
<script src="../dest/js/vue.min.js"></script>
<script src="../dest/js/public.min.js"></script>
<script type="text/javascript">
mui.plusReady(function() {
initPage();
});
function initPage() {
// plus.screen.lockOrientation("landscape-secondary") //横屏
plus.screen.lockOrientation("landscape-primary") //横屏
app.init();
}
var app = new Vue({
el: '#app',
data: {
displayModel: 1,
IndexID: 0,
itemsLeft: [],
itemsLeft2: [], //已交接
itemsDetail: {},
submitModel: 0,
submitText: "确认接收",
nextDetail: {},
searchText: '', //搜索文本
completeState: true, ////切换已交接和未交接状态
paramUnDo: { //未交接
ReportType: 1, //针车
pageIndex: 2,
State: 0, //未交接
pageSize: 10
},
paramDone: { //已交接
ReportType: 1, //针车
pageIndex: 2,
State: 1, //已交接
pageSize: 10
},
cur: '0'
},
computed: {
display_: function() {
if (this.displayModel == 1) {
return "display: none "
}
},
sty1: function() {
if (this.IndexID == 0) {
return "disabled"
} else {
return null
}
}
},
methods: {
init: function() {
mui.init({
pullRefresh: {
container: '#pullrefresh',
up: {
height: 100,
contentrefresh: '正在加载...',
contentnomore: '没有更多数据了',
callback: function() {
var reUnfinished = document.getElementById("item1").getAttribute("state");
var reFinished = document.getElementById("item2").getAttribute("state");
console.log("未交接" + reUnfinished);
console.log("已交接" + reFinished);
var needUrl = '/api/vMES/Handover/List';
var searchUrl = '/api/vMES/Handover/Search';
var UnneedData = app.itemsLeft;
var needData = app.itemsLeft2;
if (reUnfinished) {
if (app.searchText != "") {
searchPull(searchUrl, UnneedData, app.paramUnDo);
}
pullupRefresh(needUrl, UnneedData, app.paramUnDo);
} else if (reFinished) {
pullupRefresh(needUrl, needData, app.paramDone);
}
}
},
}
});
function pullupRefresh(url, arr, params) {
//console.log("加载前1" + arr);
setTimeout(function() {
var para = {
PageSize: params.pageSize,
PageIndex: params.pageIndex,
ReportType: params.ReportType,
State: params.State
};
//console.log("canshu:" + JSON.stringify(para));
//console.log("之前的数据:" + arr);
Api.post(url, para, function(e) {
if (e.success) {
//console.log("111:" + JSON.stringify(e.items));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
console.log("之后的arr" + arr);
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //参数为true代表没有更多数据了。
mui('#pullrefresh').pullRefresh().refresh(true);
//mui('#pullrefresh').pullRefresh().disablePullupToRefresh();
}, 1000);
}
function searchPull(url, arr, params) {
setTimeout(function() {
var para = {
SearchText: app.searchText,
PageSize: params.pageSize,
PageIndex: params.pageIndex,
ReportType: params.ReportType
};
Api.post(url, para, function(e) {
console.log("canshu:" + JSON.stringify(para));
if (e.success) {
console.log("搜索到的111:" + JSON.stringify(e));
var data = e.items;
if (e.items.length > 0) {
params.pageIndex++;
}
for (var i = 0; i < data.length; i++) {
arr.push(data[i]);
}
//console.log("canshuqq:" + JSON.stringify(para));
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
mui('#pullrefresh').pullRefresh().endPullupToRefresh();
mui('#pullrefresh').pullRefresh().refresh(true);
}, 1000);
}
mui('.mui-scroll-wrapper').scroll({
bounce: false,
indicators: true, //是否显示滚动条
});
this.getData(0);
mui(".mui-icon-clear")[0].addEventListener('tap', function() {
document.activeElement.blur(); //收起虚拟键盘
app.searchText = '';
app.getData(0);
});
},
getData: function(n) {
var that = this;
var para = {
ReportType: 1,
State: n,
PageSize: 20,
PageIndex: 1
}
//console.log(JSON.stringify(para))
that.searchText = ''
Api.post('/api/vMES/Handover/List', para, function(e) {
//console.log("List::" + JSON.stringify(e))
if (n == 0) {
if(e.items.length>0){
that.itemsLeft = e.items;
that.itemsDetail = e.items[0];
}else{
that.itemsLeft =[]
that.itemsDetail =[];
}
that.cur = 0;
} else {
that.cur = 0;
if(e.items.length>0){
that.itemsLeft2 = e.items;
that.itemsDetail = e.items[0];
}else{
that.itemsLeft2 = [];
that.itemsDetail = [];
}
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
})
},
selectPerson: function() {
var that = this;
mui.openWindow({
url: 'NeedlecarPBB.html',
id: 'NeedlecarPBB.html',
extras: {
nextDetail: that.nextDetail
}
});
},
selectLeft: function(obj, n) {
//this.selectLeftBack(obj.IndexID);
this.IndexID = obj.IndexID;
this.nextDetail = obj;
this.cur = n;
var that = this;
var para = {
ReportType: 1,
IndexID: this.IndexID,
}
Api.post('/api/vMES/Handover/Index', para, function(e) {
//console.log("Indexddddd111::" + e.data)
if (e.success) {
that.itemsDetail = e.data;
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
})
},
goSearch: function(event) {
var that = this;
var para = {
ReportType: 1,
SearchText: that.searchText,
PageSize: 10,
PageIndex: 1
};
//console.log("搜索文本:" + JSON.stringify(para));
if (event.keyCode == "13") {
document.activeElement.blur(); //收起虚拟键盘
if (that.searchText == '') return;
Api.post('/api/vMES/Handover/Search', para, function(e) {
//console.log("eee::" + JSON.stringify(e))
if (e.success) {
var data = e.items.length;
//console.log("搜索到的内容::" + e.items.length)
if (data > 0) {
that.itemsLeft = e.items;
that.itemsDetail = e.items[0];
that.cur = 0;
} else {
that.itemsLeft = [];
that.itemsDetail = [];
that.cur = 0;
}
}
}, function(b, bb, bbb) {
mui.toast(JSON.stringify(bbb.message))
});
event.preventDefault(); // 阻止默认事件---阻止页面刷新
//that.searchText = '';
}
},
selectDisplay: function(n) {
var opt = document.getElementById("item1");
var opt2 = document.getElementById("item2");
var n1 = document.getElementById("n1");
var n2 = document.getElementById("n2");
if (n == 1) {
this.completeState = true;
n1.style.background = "royalblue"
n1.style.color = "white"
n2.style.background = "white"
n2.style.color = "royalblue"
opt.style.display = "inline-block";
opt2.style.display = "none"
this.submitModel = 0;
this.submitText = "确认接收";
this.getData(0)
}
if (n == 2) {
this.completeState = false;
// this.getDataDetail2(2)
n1.style.background = "white"
n1.style.color = "royalblue"
n2.style.background = "royalblue"
n2.style.color = "white"
opt.style.display = "none";
opt2.style.display = "inline-block"
this.submitModel = 1;
this.submitText = "撤回接收";
this.getData(1)
}
},
submit: function() {
var that = this;
var para = {
IndexID: this.IndexID,
}
console.log(JSON.stringify(para))
var html = '/api/vMES/Handover/Receive';
if (this.submitModel == 1) {
html = '/api/vMES/Handover/UnReceive';
}
Api.post(html, para, function(e) {
if (e.success) {
that.playVoice("cg.mp3");
mui.toast("操作成功");
//that.selectLeftBack(0);
that.IndexID = 0;
that.nextDetail = {};
that.itemsDetail = [];
that.getData(0);
that.getData(1);
} else {
that.playVoice("sb.mp3");
mui.toast("操作失败: " + e.message);
}
}, function(b, bb, bbb) {
that.playVoice("sb.mp3");
mui.toast("操作失败" + JSON.stringify(bbb.message))
})
},
playVoice: function(filename) {
if (plus.audio == undefined) {
} else {
// 播放操作
var p = plus.audio.createPlayer("_www/dest/voice/" + filename);
p.play(function() {
//alert( "Audio play success!" );
}, function(e) {
//alert( "Audio play failed: " + e.message );
});
}
},
back: function() {
mui.back();
},
changePosition: function() {
var btn1 = document.getElementById("changePosition");
var btn2 = document.getElementById("right-2");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height);
<script src="../dest/js/mes/playVoice.js"></script>
<script src="../dest/js/mes/NeedlecarHandover.js"></script>
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
//console.log("得到焦点。。。。" + Height1);
if (Height > Height1) {
btn1.style.display = "none";
btn2.style.display = "none";
} else {
btn1.style.display = "block";
btn2.style.display = "block";
}
}
},
changePosition1: function() {
var btn1 = document.getElementById("changePosition");
var btn2 = document.getElementById("right-2");
var Height = document.documentElement.clientHeight || document.body.clientHeight;
window.onresize = function() {
var Height1 = document.documentElement.clientHeight || document.body.clientHeight;
if (Height < Height1) {
btn1.style.display = "block";
btn2.style.display = "block";
} else {
btn1.style.display = "none";
btn2.style.display = "none";
}
}
}
},
})
</script>
</body>
</html>
......@@ -152,12 +152,12 @@
function onGetDataSuccess(e){
console.log("GetModuleList::" + JSON.stringify(e))
//console.log("GetModuleList::" + JSON.stringify(e))
var isSuccess = e.success;
if(isSuccess) {
var items = e.items;
console.log(JSON.stringify(items) )
//console.log(JSON.stringify(items) )
//手动在结尾添加了一个设置项目
items.push({
Code: "设置"
......@@ -204,7 +204,7 @@
}
console.log("GetModuleList::begin" )
//console.log("GetModuleList::begin" )
Api.post('/api/User/GetModuleList',{},onGetDataSuccess,onGetDataFailure);
......
......@@ -3,7 +3,7 @@
"id" : "H544710A8", /*应用的标识,创建应用时自动生成,勿手动修改*/
"name" : "飞天兔MES", /*应用名称,程序桌面图标名称*/
"version" : {
"name" : "1.0.0.31", /*应用版本名称*/
"name" : "1.0.0.39", /*应用版本名称*/
"code" : "338"
},
"description" : "飞天兔MES平板版", /*应用描述信息*/
......
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