createTask.html 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="format-detection" content="email=no" />
  6. <meta name="format-detection" content="telephone=no" />
  7. <title>新建任务</title>
  8. <link rel="stylesheet" href="../css/reset.css">
  9. <link rel="stylesheet" href="../css/style.css">
  10. <script src="../script/flexible.js"></script>
  11. <style>
  12. html,body{
  13. height: 100%;
  14. }
  15. .flex-wrap{
  16. display: -webkit-box;
  17. display: -webkit-flex;
  18. display: flex;
  19. }
  20. .flex-con{
  21. -webkit-box-flex: 1;
  22. -webkit-flex: 1;
  23. flex: 1;
  24. }
  25. body{
  26. display: -webkit-box;
  27. display: -webkit-flex;
  28. display: flex;
  29. -webkit-box-orient: vertical;
  30. -webkit-flex-flow: column;
  31. flex-flow: column;
  32. background-color: #fff;
  33. }
  34. #header {
  35. min-height: 1.4rem;
  36. line-height: 1.4rem;
  37. background-color: #fff;
  38. color: #0b0b0b;
  39. position: relative;
  40. /*box-sizing: content-box;*/
  41. }
  42. #backBtn {
  43. width: 1.2rem;
  44. height: 1.4rem;
  45. line-height: 1rem;
  46. text-align: center;
  47. font-size: 1.3rem;
  48. position: absolute;
  49. left: 0;
  50. bottom: 0;
  51. }
  52. #backBtn img{
  53. display: inline-block;
  54. width: 50%;
  55. height: 40%;
  56. }
  57. .headTit {
  58. text-align: center;
  59. line-height: 1.4rem;
  60. font-size: .5rem;
  61. font-weight: normal;
  62. }
  63. .headGN {
  64. position: absolute;
  65. right: 0;
  66. bottom: 0;
  67. }
  68. .headGN li {
  69. display: none;
  70. width: 2.3rem;
  71. line-height: 1.4rem;
  72. font-size: .42rem;
  73. text-align: right;
  74. padding-right: .2rem;
  75. }
  76. .headGN li.active {
  77. display: block;
  78. }
  79. ::-webkit-input-placeholder{
  80. color: #b4b4b4;
  81. }
  82. main{
  83. overflow-x: hidden;
  84. overflow-y: auto;
  85. }
  86. .hr{
  87. width: 100%;
  88. height: .23rem;
  89. background-color: #fafafa;
  90. }
  91. .taskXQ{
  92. padding: .3rem;
  93. }
  94. .taskXQ>div{
  95. margin-bottom: .3rem;
  96. }
  97. .taskXQ>div h3{
  98. font-size: .42rem;
  99. color: #818181;
  100. font-weight: normal;
  101. margin-bottom: .1rem;
  102. }
  103. .task_taskCon p {
  104. margin-bottom: .2rem;
  105. color: #818181;
  106. font-size: .42rem;
  107. }
  108. .selectDiv>label,.selectTaskDiv>label{
  109. width: 100%;
  110. position: relative;
  111. }
  112. .selectDiv input,.selectTaskDiv input{
  113. display: inline-block;
  114. width: 100%;
  115. font-size: .42rem;
  116. padding: .2rem;
  117. color: #818181;
  118. background-color: #fafafa;
  119. border: 1px solid #f0f0f0;
  120. }
  121. .xcms,.time1,.time2,.shyy{
  122. background-color: #fafafa;
  123. border: 1px solid #f0f0f0;
  124. padding: .2rem;
  125. }
  126. .type_icon{
  127. color: #818181;
  128. font-size: .42rem;
  129. position: absolute;
  130. right: 0.18rem;
  131. top: 0;
  132. }
  133. .task_text{
  134. width: 100%;
  135. height: 2.6rem;
  136. max-height: 2.6em;
  137. font-size: .42rem;
  138. color: #818181;
  139. background-color: #fafafa;
  140. resize: none;
  141. border: none;
  142. overflow-y: auto;
  143. }
  144. .shren,.xzren,.jxren,.xcren{
  145. background-color: #fafafa;
  146. border: 1px solid #f0f0f0;
  147. padding: .2rem;
  148. }
  149. .task_text1{
  150. width: 100%;
  151. font-size: .42rem;
  152. color: #818181;
  153. background-color: #fafafa;
  154. resize: none;
  155. border: none;
  156. overflow-x: auto;
  157. }
  158. .task_text2{
  159. width: 100%;
  160. height: .66rem;
  161. line-height: .66rem;
  162. max-height: .66rem;
  163. font-size: .42rem;
  164. color: #818181;
  165. background-color: #fafafa;
  166. resize: none;
  167. border: none;
  168. overflow-x: auto;
  169. }
  170. .task_time{
  171. width: 60%;
  172. font-size: .42rem;
  173. color: #818181;
  174. background-color: #fafafa;
  175. border: none;
  176. outline: none;
  177. overflow-x: auto;
  178. }
  179. .year,.times{
  180. width: 0;
  181. overflow: hidden;
  182. opacity: 0;
  183. margin: 0;
  184. padding: 0;
  185. }
  186. input[type=button]{
  187. background-color: #6dcff6;
  188. color: #fff;
  189. font-size: .3rem;
  190. padding: .1rem;
  191. border: none;
  192. border-radius: .06rem;
  193. outline: none;
  194. }
  195. .startBtn{
  196. width: 100%;
  197. height: 1.3rem;
  198. line-height: 1.3rem;
  199. font-size: .5rem;
  200. text-align: center;
  201. color: #fff;
  202. background-color: #22ad38;
  203. border-radius: .1rem;
  204. margin-top: .3rem;
  205. }
  206. .newBDG{
  207. background-color: #f0f0f0;
  208. padding: .1rem;
  209. }
  210. .hid{
  211. display: none;
  212. }
  213. .hidden{
  214. display: none;
  215. }
  216. </style>
  217. </head>
  218. <body>
  219. <header>
  220. <div id="header">
  221. <i id="backBtn"><img src="../image/backBtn.png" alt=""></i>
  222. <h3 class="headTit">发起任务</h3>
  223. <ul class="headGN">
  224. <!--<li>批量发起</li>-->
  225. </ul>
  226. </div>
  227. </header>
  228. <main class="flex-con">
  229. <div class="hr"></div>
  230. <div class="taskXQ">
  231. <div class="task_taskCon flex-con">
  232. <p class="oldBDG">电站名称:<span class="task_name"></span></p>
  233. </div>
  234. <div class="selectTaskDiv">
  235. <label><input type="text" value="检查任务" id="taskType" readonly="readonly"><span class="type_icon">▼</span></label>
  236. </div>
  237. <div class="xcms jxname">
  238. <h3>检修名称:</h3>
  239. <textarea id="name" class="task_text2"></textarea>
  240. </div>
  241. <div class="shyy hid">
  242. <h3>重审原因:</h3>
  243. <textarea id="shyy" class="task_text2"></textarea>
  244. </div>
  245. <div class="selectDiv">
  246. <label><input type="text" value="常规" id="type" readonly="readonly"><span class="type_icon">▼</span></label>
  247. </div>
  248. <div class="shren hid" rel="main">
  249. <h3>审核人:</h3>
  250. <input id="shren" class="task_text1" readonly="readonly">
  251. </div>
  252. <div class="jxren hid" rel="main">
  253. <h3>检修人:</h3>
  254. <input id="jxren" class="task_text1" readonly="readonly">
  255. </div>
  256. <div class="xcren hid hidden" rel="main">
  257. <h3>巡查人:</h3>
  258. <input id="xcren" class="task_text1" readonly="readonly">
  259. </div>
  260. <div class="xzren" rel="main">
  261. <h3>协助人:</h3>
  262. <input id="xzren" class="task_text1" readonly="readonly">
  263. </div>
  264. <div class="time1">
  265. <h3>计划开始时间:</h3>
  266. <input id="jhks" class="task_time" readonly="readonly">
  267. <input class=" year" id="jhks_date" type="date"><input class="times" id="jhks_time" type="time"><input
  268. type="button" value="选择日期" id="selDate1">&nbsp;&nbsp;&nbsp;<input type="button" value="选择时间"id="selTime1">
  269. </div>
  270. <div class="time2">
  271. <h3>计划结束时间:</h3>
  272. <input id="jhjs" class="task_time" readonly="readonly">
  273. <input class=" year" id="jhjs_date" type="date"><input class="times" id="jhjs_time" type="time"><input
  274. type="button" value="选择日期" id="selDate2">&nbsp;&nbsp;&nbsp;<input type="button" value="选择时间" id="selTime2">
  275. </div>
  276. <div class="xcms jxcontent">
  277. <h3>检修内容:</h3>
  278. <textarea id="text"class="task_text"></textarea>
  279. </div>
  280. <div>
  281. <div class="startBtn">发起检修</div>
  282. </div>
  283. </div>
  284. </main>
  285. <script src="../script/jqueryMin.js"></script>
  286. <script src="../script/createTime.js"></script>
  287. <script src="../script/publicData.js"></script>
  288. <script src="../script/api.js"></script>
  289. <script>
  290. apiready=function () {
  291. var isSend=false,listArr=$api.getStorage("allBDG"),allB=[],shren=[],xzren=[],jxren=[],userList=$api.getStorage("userList"),headmanList=$api.getStorage("headmanList");
  292. var md="",startTime=0,endTime=0,tasktype=2,startTxt1="请选择日期",endTxt1="请选择日期",startTxt2="请选择时间",endTxt2="请选择时间";
  293. var tasks=$api.getStorage("CTasks");
  294. var tasksTit=$api.getStorage("tasksTit");
  295. var user=$api.getStorage("user");
  296. if(listArr.length) $(".headGN li").addClass("active");
  297. var UIMultiSelector = api.require('UIMultiSelector');
  298. $(".task_name").text(api.pageParam.name);
  299. var arr=["常规","紧急"],arr2=["检修任务","巡查任务"];
  300. if(tasks&&tasks!=""){
  301. for(var i in tasks){
  302. $(".task_taskCon").append("<P class='newBDG' rel='"+tasks[i]+"'>"+tasksTit[i]+"</p>");
  303. allB.push(tasks[i])
  304. }
  305. }
  306. if(api.pageParam.taskID){
  307. $(".shyy").removeClass("hid");
  308. }
  309. if(user.user_module_id=="326"){
  310. $(".shren").removeClass("hid");
  311. jxren.push(user.id)
  312. }else {
  313. $(".jxren").removeClass("hid");
  314. $(".xcren").removeClass("hid");
  315. // shren.push(user.id)
  316. }
  317. $(".selectDiv label").click(function () {
  318. api.actionSheet({
  319. title: '选择任务状态',
  320. buttons: arr
  321. }, function (ret, err) {
  322. if(ret.buttonIndex>arr.length) return;
  323. $("#type").val(arr[ret.buttonIndex-1])
  324. });
  325. })
  326. $(".selectTaskDiv label").click(function () {
  327. api.actionSheet({
  328. title: '选择任务类型',
  329. buttons: arr2
  330. }, function (ret, err) {
  331. if(ret.buttonIndex>arr2.length) return;
  332. $("#taskType").val(arr2[ret.buttonIndex-1])
  333. if(ret.buttonIndex==1){
  334. $(".xcren").addClass("hidden");
  335. $(".jxren").removeClass("hidden");
  336. $(".jxname h3").text("检修名称:");
  337. $(".jxcontent h3").text("检修内容:");
  338. $(".startBtn").text("发起检修");
  339. tasktype=2
  340. }else if(ret.buttonIndex==2){
  341. $(".jxren").addClass("hidden");
  342. $(".xcren").removeClass("hidden");
  343. $(".jxname h3").text("巡查名称:");
  344. $(".jxcontent h3").text("巡查内容:");
  345. $(".startBtn").text("发起巡查");
  346. tasktype=1
  347. }
  348. });
  349. })
  350. $("#selDate1").click(function () {
  351. $("#jhks_date")[0].click();
  352. })
  353. $("#selDate2").click(function () {
  354. $("#jhjs_date")[0].click();
  355. })
  356. $("#selTime1").click(function () {
  357. $("#jhks_time")[0].click();
  358. })
  359. $("#selTime2").click(function () {
  360. $("#jhjs_time")[0].click();
  361. })
  362. $("#jhks_date").change(function () {
  363. startTxt1=$(this).val();
  364. setval($(this),startTxt1+" "+startTxt2)
  365. })
  366. $("#jhjs_date").change(function () {
  367. endTxt1=$(this).val();
  368. setval($(this),endTxt1+" "+endTxt2)
  369. })
  370. $("#jhks_time").change(function () {
  371. startTxt2=$(this).val();
  372. setval($(this),startTxt1+" "+startTxt2)
  373. })
  374. $("#jhjs_time").change(function () {
  375. endTxt2=$(this).val();
  376. setval($(this),endTxt1+" "+endTxt2)
  377. })
  378. function setval(that,val) {
  379. that.parent().find(".task_time").val(val)
  380. }
  381. $(".headGN").click(function () {
  382. allB=[];
  383. showBox($(".task_taskCon"),listArr,false);
  384. })
  385. $(".shren").click(function () {
  386. showBox($(this),headmanList,true);
  387. })
  388. $(".xzren").click(function () {
  389. showBox($(this),userList,false);
  390. })
  391. $(".jxren").click(function () {
  392. showBox($(this),userList,true);
  393. })
  394. $(".xcren").click(function () {
  395. showBox($(this),userList,true);
  396. })
  397. $(".startBtn").click(function () {
  398. if(isSend){
  399. return;
  400. }
  401. if($("#name").val()==""){
  402. api.toast({
  403. msg: '检修名称不能为空',
  404. duration: 2000,
  405. location: 'bottom'
  406. });
  407. return;
  408. }
  409. if($("#text").val()==""){
  410. api.toast({
  411. msg: '检修内容不能为空',
  412. duration: 2000,
  413. location: 'bottom'
  414. });
  415. return;
  416. }
  417. if(isNaN(new Date(startTxt1+" "+startTxt2).getTime())){
  418. api.toast({
  419. msg: '时间不正确',
  420. duration: 2000,
  421. location: 'bottom'
  422. });
  423. return;
  424. }
  425. if(isNaN(new Date(endTxt1+" "+endTxt2).getTime())){
  426. api.toast({
  427. msg: '时间不正确',
  428. duration: 2000,
  429. location: 'bottom'
  430. });
  431. return;
  432. }
  433. if(new Date(startTxt1+" "+startTxt2).getTime()<new Date().getTime()){
  434. api.toast({
  435. msg: '开始时间无效',
  436. duration: 2000,
  437. location: 'bottom'
  438. });
  439. return;
  440. }
  441. if(new Date(endTxt1+" "+endTxt2).getTime()<new Date(startTxt1+" "+startTxt2).getTime()){
  442. api.toast({
  443. msg: '结束时间无效',
  444. duration: 2000,
  445. location: 'bottom'
  446. });
  447. return;
  448. }
  449. if(allB.length&& !api.pageParam.taskID){
  450. var postData={
  451. type:tasktype,
  452. user_id:$api.getStorage("user").id,
  453. bdg_id:allB,
  454. title:$("#name").val(),
  455. helper_id:xzren,
  456. aduit_id:shren,
  457. jxuser_id:jxren[0],
  458. created_at:startTxt1+" "+startTxt2,
  459. end_time:endTxt1+" "+endTxt2,
  460. remark:$("#text").val(),
  461. task_type:arr.indexOf($("#type").val())
  462. }
  463. isSend=true;
  464. $(".startBtn").text("正在提交中...");
  465. api.ajax({
  466. url: pageUrl+"/index/task/moretask",
  467. method: 'post',
  468. timeout: 30,
  469. dataType: 'text',
  470. returnAll: false,
  471. data: {
  472. values: postData
  473. }
  474. }, function (data, err) {
  475. var data=JSON.parse(data);
  476. // alert(JSON.stringify(data))
  477. if(data.status=="1"){
  478. $("#text").val("");
  479. $("#jhks").val("");
  480. $("#jhjs").val("");
  481. startTxt1=endTxt1="请选择日期";
  482. startTxt2=endTxt2="请选择时间";
  483. api.toast({
  484. msg: "发起检修成功",
  485. duration: 2000,
  486. location: 'bottom'
  487. });
  488. api.execScript({
  489. name: 'root',
  490. frameName:"home",
  491. script: 'setData();'
  492. });
  493. api.sendEvent({
  494. name: 'refeshCheck',
  495. extra: {key1: 'value'}
  496. });
  497. setTimeout(function () {
  498. api.closeToWin({
  499. name: 'root'
  500. });
  501. },300)
  502. }else {
  503. api.toast({
  504. msg: "发起检修失败",
  505. duration: 2000,
  506. location: 'bottom'
  507. });
  508. }
  509. setTimeout(function () {
  510. $(".startBtn").text("发起检修");
  511. },300)
  512. isSend=false;
  513. api.execScript({
  514. name: 'root',
  515. script: 'totalTime(0);'
  516. });
  517. });
  518. }else if(!allB.length&& !api.pageParam.taskID){
  519. var postData={
  520. type:tasktype,
  521. user_id:$api.getStorage("user").id,
  522. bdg_id:api.pageParam.id,
  523. title:$("#name").val(),
  524. helper_id:xzren,
  525. aduit_id:shren,
  526. jxuser_id:jxren[0],
  527. created_at:startTxt1+" "+startTxt2,
  528. end_time:endTxt1+" "+endTxt2,
  529. remark:$("#text").val(),
  530. task_type:arr.indexOf($("#type").val())
  531. }
  532. isSend=true;
  533. $(".startBtn").text("正在提交中...");
  534. api.ajax({
  535. url: pageUrl+"/index/task/taskdata",
  536. method: 'post',
  537. timeout: 30,
  538. dataType: 'text',
  539. returnAll: false,
  540. data: {
  541. values: postData
  542. }
  543. }, function (data, err) {
  544. var data=JSON.parse(data)
  545. // alert(JSON.stringify(data))
  546. if(data.status=="1"){
  547. $("#text").val(" ");
  548. $(".task_time").val("");
  549. startTxt1=endTxt1="请选择日期";
  550. startTxt2=endTxt2="请选择时间";
  551. api.toast({
  552. msg: "发起检修成功",
  553. duration: 2000,
  554. location: 'bottom'
  555. });
  556. api.execScript({
  557. name: 'root',
  558. frameName:"home",
  559. script: 'setData();'
  560. });
  561. api.sendEvent({
  562. name: 'refeshCheck',
  563. extra: {key1: 'value'}
  564. });
  565. setTimeout(function () {
  566. api.closeToWin({
  567. name: 'root'
  568. });
  569. },300)
  570. }else {
  571. api.toast({
  572. msg: "发起检修失败",
  573. duration: 2000,
  574. location: 'bottom'
  575. });
  576. }
  577. setTimeout(function () {
  578. $(".startBtn").text("发起检修");
  579. },300)
  580. isSend=false;
  581. api.execScript({
  582. name: 'root',
  583. script: 'totalTime(0);'
  584. });
  585. });
  586. }else if(!allB.length&&api.pageParam.taskID){
  587. var postData={
  588. type:tasktype,
  589. user_id:$api.getStorage("user").id,
  590. bdg_id:api.pageParam.id,
  591. task_id:api.pageParam.taskID,
  592. title:$("#name").val(),
  593. remark_reason:$("#shyy").val(),
  594. helper_id:xzren,
  595. aduit_id:shren,
  596. jxuser_id:jxren[0],
  597. created_at:startTxt1+" "+startTxt2,
  598. end_time:endTxt1+" "+endTxt2,
  599. remark:$("#text").val(),
  600. task_type:arr.indexOf($("#type").val())
  601. }
  602. isSend=true;
  603. $(".startBtn").text("正在提交中...");
  604. api.ajax({
  605. url: pageUrl+"/index/task/change-taskdata",
  606. method: 'get',
  607. timeout: 30,
  608. dataType: 'text',
  609. returnAll: false,
  610. data: {
  611. values: postData
  612. }
  613. }, function (data, err) {
  614. var data=JSON.parse(data)
  615. if(data.status=="1"){
  616. $("#text").val(" ");
  617. $(".task_time").val("");
  618. startTxt1=endTxt1="请选择日期";
  619. startTxt2=endTxt2="请选择时间";
  620. api.toast({
  621. msg: "发起检修成功",
  622. duration: 2000,
  623. location: 'bottom'
  624. });
  625. api.execScript({
  626. name: 'root',
  627. frameName:'checkTask',
  628. script: 'getData()'
  629. });
  630. setTimeout(function () {
  631. api.execScript({
  632. name: 'root',
  633. script: 'toFrame(13)'
  634. });
  635. },300)
  636. api.sendEvent({
  637. name: 'refeshCheckXQ',
  638. extra: {key1: 'value'}
  639. });
  640. setTimeout(function () {
  641. api.closeToWin({
  642. name: 'root'
  643. });
  644. },300)
  645. }else {
  646. api.toast({
  647. msg: "发起检修失败",
  648. duration: 2000,
  649. location: 'bottom'
  650. });
  651. }
  652. setTimeout(function () {
  653. $(".startBtn").text("发起检修");
  654. },300)
  655. isSend=false;
  656. api.execScript({
  657. name: 'root',
  658. script: 'totalTime(0);'
  659. });
  660. });
  661. }
  662. })
  663. $("#backBtn").click(function () {
  664. $api.rmStorage("CTasks");
  665. $api.rmStorage("tasksTit");
  666. api.closeWin();
  667. })
  668. $(".task_taskCon").on('click','.newBDG',function () {
  669. if($(".task_taskCon p").length==2){
  670. api.toast({
  671. msg: '无法再删除了',
  672. duration: 2000,
  673. location: 'bottom'
  674. });
  675. return;
  676. }
  677. var arr=[];
  678. for(var i=0;i<allB.length;i++){
  679. if($(this).attr("rel")!=allB[i]){
  680. arr.push(allB[i])
  681. }
  682. }
  683. allB=arr;
  684. $(this).remove();
  685. })
  686. function showBox(that,data,bl) {
  687. if(data.length==0) {
  688. api.toast({
  689. msg: '服务器开小差了,请稍等',
  690. duration: 2000,
  691. location: 'bottom'
  692. });
  693. return;
  694. }
  695. var user=$api.getStorage("user");
  696. UIMultiSelector.open({
  697. rect: {
  698. h: 244
  699. },
  700. text: {
  701. title: '',
  702. leftBtn: '',
  703. rightBtn: '',
  704. selectAll: '全选'
  705. },
  706. max: 0,
  707. singleSelection:bl,
  708. styles: {
  709. mask: 'rgba(0,0,0,0.2)',
  710. title: {
  711. bg: '#efefef',
  712. h: 44
  713. },
  714. leftButton: {
  715. w: 60,
  716. h: 30,
  717. marginT: 5,
  718. marginL: 8,
  719. bg:"widget://image/cancel.png"
  720. },
  721. rightButton: {
  722. w: 60,
  723. h: 30,
  724. marginT: 5,
  725. marginR: 8,
  726. bg:"widget://image/finish.png"
  727. },
  728. item: {
  729. h: 40,
  730. bg: '#fff',
  731. bgActive: '#fff',
  732. bgHighlight: '#fff',
  733. color: '#818181',
  734. active: '#818181',
  735. highlight: '#818181',
  736. size: 14,
  737. lineColor: '#efefef',
  738. textAlign: 'left',
  739. marginR:5
  740. },
  741. icon: {
  742. w: 20,
  743. h: 20,
  744. marginT: 11,
  745. marginH: 8,
  746. bg: 'widget://image/select.png',
  747. bgActive: 'widget://image/selected.png',
  748. align: 'left'
  749. }
  750. },
  751. animation: true,
  752. items: data
  753. }, function(ret, err) {
  754. if (ret) {
  755. if(ret.eventType=="clickRight"){
  756. var nameStr="",arr=[],arr2=[];
  757. if(ret.items.length!=0&&that.hasClass("task_taskCon")) {
  758. that.html(" ");
  759. }else {
  760. if(allB.length==0&&that.hasClass("task_taskCon")){
  761. that.html('<p class="oldBDG">电站名称:<span class="task_name">'+api.pageParam.name+'</span></p>');
  762. }
  763. }
  764. try{
  765. for(var i in ret.items){
  766. arr[i]={
  767. type:ret.items[i].id,
  768. name:ret.items[i].text
  769. }
  770. arr2.push(ret.items[i].id);
  771. if(i==ret.items.length-1||ret.items.length==1){
  772. nameStr+=ret.items[i].text;
  773. }else {
  774. nameStr+=ret.items[i].text+"、";
  775. }
  776. if(that.hasClass("task_taskCon")){
  777. that.append("<P class='newBDG' rel='"+ret.items[i].id+"'>电站名称:"+ret.items[i].text+"</p>");
  778. allB=arr2;
  779. }else if(that.hasClass("shren")){
  780. shren=arr2;
  781. that.find("input").val(nameStr);
  782. }else if(that.hasClass("xzren")){
  783. if(arr2.indexOf(jxren[0])!=-1){
  784. api.toast({
  785. msg: '不能重复选择',
  786. duration: 2000,
  787. location: 'bottom'
  788. });
  789. return;
  790. }
  791. xzren=arr2;
  792. that.find("input").val(nameStr);
  793. }else if(that.hasClass("jxren")){
  794. if(xzren.indexOf(arr2[0])!=-1){
  795. api.toast({
  796. msg: '不能重复选择',
  797. duration: 2000,
  798. location: 'bottom'
  799. });
  800. return;
  801. }
  802. jxren=arr2;
  803. that.find("input").val(nameStr);
  804. }else if(that.hasClass("xcren")){
  805. if(xzren.indexOf(arr2[0])!=-1){
  806. api.toast({
  807. msg: '不能重复选择',
  808. duration: 2000,
  809. location: 'bottom'
  810. });
  811. return;
  812. }
  813. jxren=arr2;
  814. that.find("input").val(nameStr);
  815. }
  816. }
  817. }catch (e){
  818. nameStr="";
  819. }
  820. UIMultiSelector.close();
  821. }else if(ret.eventType=="clickLeft"){
  822. UIMultiSelector.close();
  823. }
  824. } else {
  825. // alert(JSON.stringify(err));
  826. }
  827. });
  828. }
  829. }
  830. </script>
  831. </body>
  832. </html>