123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <!DOCTYPE html>
- <html lang="zh-cn">
- <head>
- <meta charset="UTF-8">
- <meta name="format-detection" content="telephone=no" />
- <meta name="format-detection" content="email=no" />
- <title>mes</title>
- <link rel="stylesheet" href="../css/reset.css">
- <link rel="stylesheet" href="../css/style.css">
- <script src="../script/flexible.js"></script>
- <style>
- html,body{
- height:100%;
- }
- .task_con {
- overflow: auto;
- padding-top: 0.23rem;
- }
- .task_con ul{
- display: none;
- }
- .task_con li {
- height: 2.83rem;
- margin-bottom: .2rem;
- background-color: #fff;
- position: relative;
- overflow: hidden;
- }
- .task_con li>div {
- display: inline-block;
- }
- .task_status {
- width: .6rem;
- height: 100%;
- font-size: .34rem;
- text-align: center;
- white-space: pre-wrap;
- color: #fff;
- position: relative;
- }
- .task_status_1{
- background-color: #ff6e6e;
- }
- .task_status_2{
- background-color: #22ac38;
- }
- .task_status_3{
- background-color: #a0a0a0;
- }
- .task_status_4{
- background-color: #f39700;
- }
- .task_status span {
- display: inline-block;
- width: .36rem;
- position: absolute;
- top: 50%;
- left: calc(50% - .18rem);
- -webkit-transform: translateY(-50%);
- transform: translateY(-50%);
- }
- .task_taskCon {
- max-width: calc(100% - 1.1rem);
- padding: .2rem 0 0 .2rem ;
- }
- .task_taskCon p {
- margin-bottom: .1rem;
- height: .5rem;
- color: #3d3d3d;
- font-size: .38rem;
- white-space: nowrap;
- }
- .task_name{
- display: inline-block;
- max-width: 6.1rem;
- font-size: .48rem;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- vertical-align: middle;
- }
- .task_taskCon p:first-of-type{
- height: .6rem;
- position: relative;
- }
- .task_taskCon p:nth-of-type(n+2){
- width: 8rem;
- color: #898989;
- overflow-x: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .icon_1{
- width: .3rem;
- height: .3rem;
- background: url("../image/task_icon_1.png") no-repeat 100% 110%/100%;
- margin-right: .1rem;
- }
- .icon_2{
- width: .3rem;
- height: .3rem;
- background: url("../image/task_icon_2.png") no-repeat 50% 140%/80%;
- margin-right: .1rem;
- }
- .task_taskCon p:last-of-type{
- width: 100%;
- overflow: visible;
- }
- .task_taskCon p:nth-of-type(3) {
- margin-bottom: .11rem;
- }
- .task_dbqk {
- display: inline-block;
- font-size: .3rem;
- padding: 0 .1rem;
- border-radius: .03rem;
- color: #fff;
- margin-left: .26rem;
- white-space: nowrap;
- }
- .task_dbqk1{
- background-color: #f39700;
- }
- .task_dbqk2{
- background-color: #ff0000;
- }
- .task_dbqk3{
- background-color: #bbbc5f;
- }
- .task_dbqk4{
- background-color: #e60012;
- }
- .task_dbqk5{
- background-color: #cacbbb;
- }
- .task_pssj,
- .task_wcsj {
- display: inline-block;
- height: .4rem;
- line-height: .4rem;
- font-size: .3rem;
- padding: 0 .18rem;
- border-radius: .03rem;
- }
- .task_pssj {
- border: 1px solid #3aca74;
- color: #3aca74;
- margin-right: .2rem;
- }
- .task_wcsj {
- border: 1px solid #fd9b53;
- color: #fd9b53;
- }
- .task_jt {
- position: absolute;
- top:0;
- right: 0;
- height: 100%;
- line-height: 2.6rem;
- font-size: .5rem;
- color: #b5b5b5;
- padding: 0 .18rem;
- }
- .nomore_tit{
- width: 60%;
- border-top: 1px solid #e0e0e0;
- margin: .2rem auto;
- }
- .nomore_txt{
- font-size: .4rem;
- color: #b0b0b0;
- text-align: center;
- padding: 0 .1rem;
- }
- .hid{
- display: none;
- }
- </style>
- </head>
- <body>
- <div class="flex-con task_con">
- <ul>
- <li class="flex-wrap" data-taskid="{{taskID}}" data-lon="{{lon}}" data-lat="{{lat}}">
- <div class="task_status {{taskstatus}}" data-taskstatus="0"><span>{{status}}</span></div>
- <div class="task_taskCon flex-con">
- <p><span class="task_name">{{name}}</span><span class="task_dbqk {{statusclass}}">{{type}}</span></p>
- <p><i class="icon_1"></i>检修内容:<span class="task_duty">{{duty}}</span></p>
- <p><i class="icon_2"></i>地址:<span class="task_dw">{{enterprise}}</span></p>
- <p><span class="task_pssj">申请日期:{{pssj}}</span><span class="task_wcsj">计划开始:{{jhks}}</span></p>
- </div>
- <div class="task_jt">〉</div>
- </li>
- </ul>
- </div>
- <div class="nomore hid">
- <fieldset class="nomore_tit">
- <legend align="center" class="nomore_txt">已经没有更多了</legend>
- </fieldset>
- </div>
- <script src="../script/publicData.js"></script>
- <script src="../script/jqueryMin.js"></script>
- <script type="text/javascript" src="../script/api.js"></script>
- <script>
- apiready = function() {
- if(api.systemType=="ios"){
- $(".task_taskCon p").css("margin-bottom",".1rem")
- }
- if(!$api.getStorage("task_frame1Data")){
- api.showProgress({
- title: '努力加载中...',
- text: '请稍等...',
- modal: false
- });
- }
- var duty,page=1;
- var ulModel=$(".task_con ul").html();
- var isreload=false;
- getData();
- api.addEventListener({
- name:'scrolltobottom',
- extra:{
- threshold:0 //设置距离底部多少距离时触发,默认值为0,数字类型
- }
- }, function(ret, err){
- if(!$(".nomore").hasClass("hid")||isreload){
- return;
- }else {
- if($api.getStorage("taskpage")<=1) return;
- api.toast({
- msg: '正在加载更多',
- duration: 2000,
- location: 'bottom'
- });
- }
- var postData={
- user_id:$api.getStorage("user").id,
- page:page,
- status:0
- };
- isreload=true;
- api.ajax({
- url: pageUrl+"/index/task/index",
- method: 'get',
- timeout: 30,
- dataType: 'text',
- returnAll: false,
- data: {
- values: {user_id:$api.getStorage("user").id, page:page, status:0,type:2}
- }
- }, function (data, err) {
- data=JSON.parse(data)
- // alert(JSON.stringify(data))
- var data=data.data,str="";
- var dataNames1=[];
- if(!data.length){
- str="<p style='padding-top: 5.3rem;font-size: .5rem;text-align: center;color: #818181'>暂无任务</p>"
- }else {
- for(var i in data){
- str+=ulModel.replace("{{taskID}}",data[i]['id']).replace("{{name}}",data[i]['title']).replace("{{duty}}",data[i]['remark']).replace("{{enterprise}}",data[i]['address']).replace("{{type}}",data[i]['task_type']==1?"紧急":"常规").replace("{{statusclass}}",data[i]['task_type']==0?"task_dbqk1":"task_dbqk2")
- .replace("{{pssj}}",data[i]['start_time']?data[i]['start_time'].slice(0,16):"").replace("{{jhks}}",data[i]['created_at']?data[i]['created_at'].slice(0,16):"未设定").replace("{{lon}}",data[i]['lon']).replace("{{lat}}",data[i]['lat'])
- switch (data[i]['status']+""){
- case "0":str=str.replace("{{status}}","未开始").replace("{{taskstatus}}","task_status_1");break;
- case "1":str=str.replace("{{status}}","进行中").replace("{{taskstatus}}","task_status_2");break;
- case "2":str=str.replace("{{status}}","暂停中").replace("{{taskstatus}}","task_status_4");break;
- case "3":str=str.replace("{{status}}","已完成").replace("{{taskstatus}}","task_status_3");break;
- }
- dataNames1.push(data[i]['title'])
- }
- }
- api.refreshHeaderLoadDone();
- if(page>=$api.getStorage("taskpage")&&$api.getStorage("taskpage")!=0){
- $(".nomore").removeClass("hid")
- }else {
- page++;
- }
- $(".task_con ul")[0].insertAdjacentHTML("beforeend",str);
- searchFn1(dataNames1)
- isreload=false;
- api.execScript({
- name: 'root',
- script: 'totalTime(0);'
- });
- });
- });
- api.addEventListener({
- name: 'refresh'
- }, function (ret, err) {
- var type=ret.value.task_type;
- var index=$api.getStorage("selectli");
- switch (type){
- case 0:$(".task_con li:eq("+index+")").find(".task_status")[0].className="task_status task_status_1";$(".task_con li:eq("+index+") .task_status span").text("未开始");break;
- case 1:$(".task_con li:eq("+index+")").find(".task_status")[0].className="task_status task_status_2";$(".task_con li:eq("+index+") .task_status span").text("进行中");break;
- case 2:$(".task_con li:eq("+index+")").find(".task_status")[0].className="task_status task_status_4";$(".task_con li:eq("+index+") .task_status span").text("暂停中");break;
- case 3:$(".task_con li:eq("+index+")").remove();break;
- }
- });
- function getData() {
- var postData={
- user_id:$api.getStorage("user").id,
- page:1,
- status:0
- };
- api.ajax({
- url: pageUrl+"/index/task/index",
- method: 'get',
- timeout: 30,
- dataType: 'text',
- returnAll: false,
- data: {
- values: {user_id:$api.getStorage("user").id, page:1, status:0,type:2}
- }
- }, function (data, err) {
- data=JSON.parse(data)
- // alert(JSON.stringify(data))
- $api.setStorage("taskpage",data["last_page"]);
- var data=data.data,str="";
- var dataNames1=[];
- if(!data.length){
- str="<p style='padding-top: 5.3rem;font-size: .5rem;text-align: center;color: #818181'>暂无任务</p>"
- }else {
- for(var i in data){
- str+=ulModel.replace("{{taskID}}",data[i]['id']).replace("{{name}}",data[i]['title']).replace("{{duty}}",data[i]['remark']).replace("{{enterprise}}",data[i]['address']).replace("{{type}}",data[i]['task_type']==1?"紧急":"常规").replace("{{statusclass}}",data[i]['task_type']==0?"task_dbqk1":"task_dbqk2")
- .replace("{{pssj}}",data[i]['start_time']?data[i]['start_time'].slice(0,16):"").replace("{{jhks}}",data[i]['created_at']?data[i]['created_at'].slice(0,16):"未设定").replace("{{lon}}",data[i]['lon']).replace("{{lat}}",data[i]['lat'])
- switch (data[i]['status']+""){
- case "0":str=str.replace("{{status}}","未开始").replace("{{taskstatus}}","task_status_1");break;
- case "1":str=str.replace("{{status}}","进行中").replace("{{taskstatus}}","task_status_2");break;
- case "2":str=str.replace("{{status}}","暂停中").replace("{{taskstatus}}","task_status_4");break;
- case "3":str=str.replace("{{status}}","已完成").replace("{{taskstatus}}","task_status_3");break;
- }
- dataNames1.push(data[i]['title'])
- }
- }
- api.refreshHeaderLoadDone();
- api.hideProgress();
- if(page>=$api.getStorage("taskpage")&&$api.getStorage("taskpage")!=0){
- $(".nomore").removeClass("hid")
- }else {
- page++;
- }
- $(".task_con ul").html(str).css("display","block");
- searchFn1(dataNames1)
- api.execScript({
- name: 'root',
- script: 'totalTime(0);'
- });
- });
- }
- function getTime(time) {
- var time=new Date(time*1000),str="";
- var year=time.getFullYear();
- var month=time.getMonth()+1;
- var day=time.getDate();
- var hours=time.getHours();
- var minutes=time.getMinutes();
- var str=year+"-"+checkTime(month)+"-"+checkTime(day)+" "+checkTime(hours)+":"+checkTime(minutes);
- return str;
- }
- function checkTime(val) {
- var val=val;
- if((val+"").length==1){
- val="0"+val;
- }
- return val
- }
- $(".task_con ul").on('click','li',function () {
- //在名为winName的window中执行jsfun脚本
- var jsfun1 = 'toFrame(6);',that=$(this).index();
- $api.setStorage("taskXQ",{taskID:this.dataset.taskid,lon:this.dataset.lon,lat:this.dataset.lat,tohome:false,taskType:"service"});
- api.execScript({
- script: jsfun1
- });
- })
- function searchFn1(dataNames) {
- api.addEventListener({name:"searchVal"},function (ret) {
- var re=new RegExp("("+ret.value.val+")"),liArr=[];
- for(var i=0;i<dataNames.length;i++){
- if(re.test(dataNames[i])){
- liArr.push($(".task_con ul li").get(i));
- }
- }
- if(!liArr.length){
- api.toast({
- msg: '没有搜索到该任务',
- duration: 2000,
- location: 'bottom'
- });
- }else {
- $(".task_con ul").html(" ");
- for(var j=0;j<liArr.length;j++){
- $(".task_con ul").append(liArr[j]);
- }
- }
- })
- }
- $("body").click(function () {
- api.sendEvent({
- name: 'clInput'
- });
- })
- api.addEventListener({
- name: 'refeshCheck'
- }, function (ret, err) {
- $(".nomore").addClass("hid");
- page=1;
- getData();
- });
- api.setRefreshHeaderInfo({
- loadingImg: 'widget://image/refresh.png',
- bgColor: '#fff',
- textColor: '#818181',
- textDown: '下拉刷新...',
- textUp: '松开刷新...'
- }, function(ret, err) {
- //在这里从服务器加载数据,加载完成后调用api.refreshHeaderLoadDone()方法恢复组件到默认状态
- $(".nomore").addClass("hid");
- page=1;
- getData();
- });
- api.addEventListener({
- name: 'reloadPage'
- }, function (ret, err) {
- api.closeFrame({
- name: 'task'
- });
- });
- }
- </script>
- </body>
- </html>
|