123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493 |
- <!DOCTYPE html>
- <html lang="zh-cn">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
- <meta name="format-detection" content="email=no" />
- <meta name="format-detection" content="telephone=no" />
- <title>新建任务</title>
- <link rel="stylesheet" href="../css/reset.css">
- <link rel="stylesheet" href="../css/style.css">
- <style>
- html{font-size:10px}
- html,body{
- height: 100%;
- overflow: hidden;
- }
- .flex-wrap{
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- }
- .flex-con{
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- }
- body{
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-flex-flow: column;
- flex-flow: column;
- background-color: #fff;
- }
- #header {
- min-height: 4.4rem;
- line-height: 4.4rem;
- background-color: #51c4d4;
- color: #fff;
- position: relative;
- /*box-sizing: content-box;*/
- }
- #backBtn {
- width: 3.6rem;
- height: 4.1rem;
- line-height: 3rem;
- text-align: center;
- font-size: 3.9rem;
- position: absolute;
- left: 0;
- bottom: 0;
- }
- #backBtn img{
- display: inline-block;
- width: 50%;
- height: 40%;
- }
- .headTit {
- text-align: center;
- line-height: 4.4rem;
- font-size: 1.7rem;
- font-weight: normal;
- }
- .headGN {
- position: absolute;
- right: 0;
- bottom: 0;
- }
- .headGN li {
- display: none;
- width: 3.5rem;
- line-height: 4.2rem;
- font-size: 1.4rem;
- }
- .headGN li.active {
- display: block;
- }
- .inputDiv,.text{
- color: #212121;
- padding-left:1.1rem;
- position: relative;
- background-color: #fff;
- }
- .inputDiv{
- padding-top: .3rem;
- border-bottom: .3rem solid #f7f7f7;
- }
- .inputDiv label,.text label{
- display: block;
- height: 3.8rem;
- line-height: 3.8rem;
- font-size: 1.4rem;
- white-space: nowrap;
- border-bottom: 1px solid #dfdfdf;
- margin-bottom: .3rem;
- padding-left: 1rem;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- }
- .inputDiv label:last-of-type{
- border-bottom: none;
- }
- label>input{
- width: 90%;
- height: 100%;
- background-color: rgba(0,0,0,0);
- border: none;
- outline: none;
- font-size: 1.3rem;
- padding-left: 2.6rem;
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- }
- label:nth-of-type(2)>input{
- padding-left: 3.9rem;
- }
- label:nth-of-type(4)>input{
- padding-left: 3.9rem;
- }
- label:nth-of-type(5)>input{
- padding-left: 2.6rem;
- }
- label:nth-of-type(9)>input{
- padding-left: 2.6rem;
- }
- .text label:last-of-type>input{
- padding-left: 3.6rem;
- }
- .jt{
- color: #b5b5b5;
- padding: 0 1rem;
- }
- ::-webkit-input-placeholder{
- color: #b4b4b4;
- }
- </style>
- </head>
- <body>
- <header>
- <div id="header">
- <i id="backBtn"><img src="../image/backBtn.png" alt=""></i>
- <h3 class="headTit">新建任务</h3>
- <ul class="headGN">
- <li class="active" id="save">保存</li>
- </ul>
- </div>
- </header>
- <main class="flex-con">
- <div class="inputDiv">
- <form action="#">
- <label>任务名称<input type="text" id="name" placeholder="请输入任务名称"></label>
- <label id="xj">分管县领导<input type="text" id="fxz" disabled="disabled"><span class="jt">〉</span></label>
- <label id="zrdw">执行单位<input type="text" id="dw" disabled="disabled"><span class="jt">〉</span></label>
- <label id="zrr">执行人<input type="text" id="ren" disabled="disabled"><span class="jt">〉</span></label>
- <label id="hyfl">行业分类<input type="text" id="fl" disabled="disabled"><span class="jt">〉</span></label>
- <label id="kssj">计划开始时间<input type="text" disabled="disabled"><span class="jt">〉</span></label>
- <label id="jssj">计划结束时间<input type="text" disabled="disabled"><span class="jt">〉</span></label>
- </form>
- </div>
- <div class="text">
- <label id="work_nr">工作内容</label>
- <label id="work_yq">工作要求<input type="text" id="yq" disabled="disabled"><span class="jt">〉</span></label>
- <label id="work_bz">备注<input type="text" id="bz" disabled="disabled"><span class="jt">〉</span></label>
- </div>
- </main>
- <script src="../script/jquery-3.1.0.min.js"></script>
- <script src="../script/createTime.js"></script>
- <script src="../script/publicData.js"></script>
- <script src="../script/api.js"></script>
- <script>
- apiready=function () {
- var timedata={
- start:"",
- end:""
- }
- var userdata=[];
- var department=[];
- var fxzdata=[];
- var fldata=[];
- var flArr=[];
- var duty=[];
- var depArr=[];
- var depUserArr=[];
- var UIActionSelector = api.require('UIActionSelector');
- var UIMultiSelector = api.require('UIMultiSelector');
- $.get(pageUrl+"danwei",function (data) {
- var data=data.data;
- for(var i in data['fuxianzhang']){
- duty[i]={
- id:data['fuxianzhang'][i]['user_id'],
- text: data['fuxianzhang'][i]['user_name'],
- status: 'normal'
- }
- }
- for(var n in data['department']){
- depArr[n]={
- id:data['department'][n]['department_id'],
- text: data['department'][n]['department_name'],
- status: 'normal'
- }
- }
- for(var n in data['tradeclass']){
- flArr[n]={
- id:data['tradeclass'][n]['tradeclass_id'],
- text: data['tradeclass'][n]['tradeclass_name'],
- status: 'normal'
- }
- }
- $("#hyfl").click(function () {
- showBox($(this),flArr,true);
- })
- $("#xj").click(function () {
- showBox($(this),duty,true);
- })
- })
- $(".text").on('click','label',function () {
- api.openWin({
- name: 'textWin',
- url: './textWin.html',
- bgColor:'rgba(0,0,0,0.2)',
- animation: {
- type: 'movein',
- subType: 'from_bottom',
- duration: 500
- },
- pageParam:{
- this:$(this)[0].id
- },
- delay:300
- });
- })
- $("#save").click(function () {
- var conData={};
- conData.user_department_id=[];
- conData.user_name=[];
- conData.task_title=$("#name").val();
- conData.fxz_id=fxzdata[0];
- conData.user_id=userdata;
- conData.tradeclass_id=fldata;
- conData.user_department_id=department;
- conData.task_start_time=timedata.start;
- conData.task_end_time=timedata.end;
- conData.task_content=$api.getStorage("work_nr");
- conData.task_list_content=$api.getStorage("work_yq");
- conData.task_beizhu=$api.getStorage("work_bz");
- $.post(pageUrl+"newTask",conData,function (data) {
- if(data.status=="200"){
- api.toast({
- msg: '新建成功',
- duration: 2000,
- location: 'bottom'
- });
- var reload = 'toFrame(1);';
- api.execScript({
- name: 'root',
- script: reload
- });
- $("input").val("");
- $api.rmStorage("work_nr");
- $api.rmStorage("work_yq");
- $api.rmStorage("work_bz");
- }else {
- api.toast({
- msg: data.message,
- duration: 2000,
- location: 'bottom'
- });
- }
- })
- })
- $("#kssj,#jssj").click(function () {
- showTime($(this));
- })
- $("#backBtn").click(function () {
- $api.rmStorage("work_nr");
- $api.rmStorage("work_yq");
- $api.rmStorage("work_bz");
- api.closeToWin({
- name: 'root',
- animation: {
- type: 'push',
- subType: 'from_left',
- duration: 300
- },
- delay:300
- });
- })
- function showBox(that,data,bl) {
- if(data.length==0) {
- api.toast({
- msg: '服务器开小差了,请稍等',
- duration: 2000,
- location: 'bottom'
- });
- return;
- }
- var user=$api.getStorage("user");
- UIMultiSelector.open({
- rect: {
- h: api.winHeight
- },
- text: {
- title: '',
- leftBtn: '',
- rightBtn: '',
- selectAll: '全选'
- },
- max: 0,
- singleSelection:bl,
- styles: {
- mask: 'rgba(0,0,0,0.2)',
- title: {
- bg: '#efefef',
- h: 44
- },
- leftButton: {
- w: 60,
- h: 30,
- marginT: 5,
- marginL: 8,
- bg:"widget://image/cancel.png"
- },
- rightButton: {
- w: 60,
- h: 30,
- marginT: 5,
- marginR: 8,
- bg:"widget://image/finish.png"
- },
- item: {
- h: 40,
- bg: '#fff',
- bgActive: '#fff',
- bgHighlight: '#fff',
- color: '#818181',
- active: '#818181',
- highlight: '#818181',
- size: 14,
- lineColor: '#efefef',
- textAlign: 'left',
- marginR:5
- },
- icon: {
- w: 20,
- h: 20,
- marginT: 11,
- marginH: 8,
- bg: 'widget://image/select.png',
- bgActive: 'widget://image/selected.png',
- align: 'left'
- }
- },
- animation: true,
- items: data
- }, function(ret, err) {
- if (ret) {
- if(ret.eventType=="clickRight"){
- var nameStr="",arr=[],arr2=[];
- try{
- for(var i in ret.items){
- arr[i]={
- type:ret.items[i].id,
- name:ret.items[i].text
- }
- arr2.push(ret.items[i].id)
- if(i==ret.items.length-1||ret.items.length==1){
- nameStr+=ret.items[i].text;
- }else {
- nameStr+=ret.items[i].text+"、";
- }
- }
- }catch (e){
- nameStr="";
- }
- if(that.find("input")[0].id=="dw"){
- department= arr2;
- $.post(pageUrl+"danwei",{department_id:arr2},function (data) {
- var data=data.data;
- depUserArr=[];
- for(var i in data){
- depUserArr[i]={
- id:data[i]['user_id'],
- text: data[i]['user_name']+"("+data[i]['department_name']+")",
- status: 'normal'
- }
- }
- $("#zrr").click(function () {
- showBox($(this),depUserArr,false);
- })
- })
- }else if(that.find("input")[0].id=="ren"){
- userdata=arr2;
- }else if(that.find("input")[0].id=="fxz"){
- fxzdata=arr2;
- $("#zrdw").click(function () {
- showBox($(this),depArr,false);
- })
- }else if(that.find("input")[0].id=="fl"){
- fldata=arr2;
- }
- that.find("input").val(nameStr);
- UIMultiSelector.close();
- }else if(ret.eventType=="clickLeft"){
- UIMultiSelector.close();
- }
- } else {
- alert(JSON.stringify(err));
- }
- });
- }
- function showTime(that) {
- UIActionSelector.open({
- datas: timeJson,
- layout: {
- row: 5,
- col: 3,
- height: 30,
- size: 12,
- sizeActive: 14,
- rowSpacing: 5,
- colSpacing: 10,
- maskBg: 'rgba(0,0,0,0.2)',
- bg: '#fff',
- color: '#e0e0e0',
- colorActive: '#838383',
- colorSelected: '#838383'
- },
- animation: true,
- cancel: {
- text:"",
- w: 60,
- h: 30,
- bg: 'widget://image/cancel.png',
- bgActive: 'widget://image/cancel.png'
- },
- ok: {
- text:"",
- w: 60,
- h: 30,
- bg: 'widget://image/finish.png',
- bgActive: 'widget://image/finish.png'
- },
- title: {
- text:"",
- h: 44,
- bg: '#efefef'
- }
- }, function(ret, err) {
- if (ret) {
- if(ret.eventType=="ok"){
- var val=ret.level1+"年"+ret.level2+"月"+ret.level3+"日";
- var time=ret.level1+"/"+ret.level2+"/"+ret.level3;
- that.find("input").val(val);
- if(that[0].id=="kssj"){
- timedata.start=new Date(time).getTime()/1000;
- }else {
- timedata.end=new Date(time).getTime()/1000;
- }
- }
- } else {
- api.toast({
- msg: '选择失败',
- duration: 2000,
- location: 'bottom'
- });
- }
- });
- }
- }
- function getVal(val,that) {
- if($("#"+that)[0].id=="work_nr"){
- $api.setStorage("work_nr",val)
- }else if($("#"+that)[0].id=="work_yq"){
- $("#"+that).find('input').val(val);
- $api.setStorage("work_yq",val)
- }else if($("#"+that)[0].id=="work_bz"){
- $('#'+that).find('input').val(val);
- $api.setStorage("work_bz",val)
- }
- }
- </script>
- </body>
- </html>
|