taskXQ.html 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  6. <meta name="format-detection" content="telephone=no" />
  7. <meta name="format-detection" content="email=no" />
  8. <title>mes</title>
  9. <link rel="stylesheet" href="../css/reset.css">
  10. <link rel="stylesheet" href="../css/style.css">
  11. <style>
  12. body {
  13. background-color: #f7f7f7;
  14. }
  15. .taskXQ {
  16. display: none;
  17. }
  18. .taskXQ div {
  19. margin-bottom: .3rem;
  20. background-color: #fff;
  21. padding: 1rem;
  22. }
  23. .taskXQ div h3 {
  24. font-size: 1.3rem;
  25. color: #212121;
  26. font-weight: normal;
  27. }
  28. .taskXQ pre {
  29. display: block;
  30. width: 100%;
  31. }
  32. .task_taskCon p {
  33. margin-bottom: .9rem;
  34. color: #212121;
  35. font-size: 1.3rem;
  36. }
  37. .task_taskCon p:nth-of-type(3),
  38. .task_taskCon p:nth-of-type(2) {
  39. margin-bottom: .3rem;
  40. }
  41. .task_name {
  42. font-size: 1.3rem;
  43. }
  44. .task_dbqk {
  45. font-size: 1.2rem;
  46. border-radius: .3rem;
  47. padding: 0 .4rem;
  48. margin-left: .8rem;
  49. }
  50. .task_dbqk1 {
  51. color: #f26522;
  52. border: 1px solid #f26522;
  53. }
  54. .task_dbqk2 {
  55. color: #6db495;
  56. border: 1px solid #6db495;
  57. }
  58. .task_dbqk3 {
  59. color: #bbbc5f;
  60. border: 1px solid #bbbc5f;
  61. }
  62. .task_dbqk4 {
  63. color: #bf8077;
  64. border: 1px solid #bf8077;
  65. }
  66. .task_dbqk5 {
  67. color: #cacbbb;
  68. border: 1px solid #cacbbb;
  69. }
  70. .task_dw,
  71. .task_people,
  72. .task_duty {
  73. color: #818181;
  74. }
  75. .task_pssj,
  76. .task_wcsj {
  77. display: inline-block;
  78. height: 1.5rem;
  79. line-height: 1.5rem;
  80. font-size: 1.3rem;
  81. color: #fff;
  82. padding: 0 .3rem;
  83. border-radius: .3rem;
  84. }
  85. .task_pssj {
  86. background-color: #bd8cbf;
  87. margin-bottom: .5rem;
  88. }
  89. .task_wcsj {
  90. background-color: #65ba8e;
  91. }
  92. .gz {
  93. display: inline-block;
  94. width: 2rem;
  95. height: 2rem;
  96. background-image: url("../image/gz.png");
  97. background-size: 100%;
  98. margin-left: 1.5rem;
  99. margin-bottom: -.3rem;
  100. }
  101. .gz-active {
  102. display: inline-block;
  103. width: 2rem;
  104. height: 2rem;
  105. background-image: url("../image/gz-active.png");
  106. background-size: 100%;
  107. margin-left: 1.5rem;
  108. margin-bottom: -.3rem;
  109. }
  110. .task_text {
  111. font-size: 1.3rem;
  112. color: #818181;
  113. }
  114. .gzjl>li {
  115. padding: .4rem 0 .2rem;
  116. /*border-bottom: 1px dotted #c0c0c0;*/
  117. position: relative;
  118. }
  119. .gzjl>li:last-of-type {
  120. border-bottom: none;
  121. }
  122. .gzjl>li p {
  123. color: #818181;
  124. font-size: 1rem;
  125. line-height: 1.9rem;
  126. }
  127. .gzjl>li p:last-of-type {
  128. color: #414141;
  129. font-size: 1.2rem;
  130. }
  131. .c_imgList {
  132. margin-bottom: .3rem;
  133. }
  134. .c_imgList li {
  135. float: left;
  136. margin-bottom: .3rem;
  137. }
  138. .c_fileList li p {
  139. font-size: 1.4rem;
  140. background-color: #f8f8f8;
  141. border-radius: .3rem;
  142. padding: .6rem;
  143. margin-bottom: .2rem;
  144. }
  145. .zzPopups {
  146. position: fixed;
  147. top: 0;
  148. right: 0;
  149. bottom: 0;
  150. left: 0;
  151. background-color: rgba(0, 0, 0, 0.8);
  152. z-index: 99;
  153. display: none;
  154. }
  155. .zzPopups div {
  156. height: 80%;
  157. position: absolute;
  158. top: 50%;
  159. left: 10%;
  160. right: 10%;
  161. -webkit-transform: translateY(-50%);
  162. }
  163. .zzPopups div img {
  164. background-color: #fff;
  165. width: 100%;
  166. height: auto;
  167. }
  168. .delBtn {
  169. display: inline-block;
  170. width: 3rem;
  171. height: 1.6rem;
  172. line-height: 1.6rem;
  173. text-align: center;
  174. font-size: 1.1rem;
  175. background-color: #f26522;
  176. color: #fff;
  177. border-radius: .3rem;
  178. margin-left: .4rem;
  179. /*position: absolute;*/
  180. /*right: 0;*/
  181. /*top: 0.2rem;*/
  182. }
  183. .onAudit:after {
  184. content: "(暂未审核)";
  185. display: inline-block;
  186. color: #ff2211;
  187. font-size: 1.1rem;
  188. margin-left: 1rem;
  189. }
  190. .offAudit:after {
  191. content: "(已审核)";
  192. display: inline-block;
  193. color: #00db00;
  194. font-size: 1.1rem;
  195. margin-left: 1rem;
  196. }
  197. #tomore {
  198. font-size: 1.1rem;
  199. }
  200. .taskFn{
  201. position: fixed;
  202. top: .5rem;
  203. right: .5rem;
  204. background-color: #fff;
  205. border: 1px solid #e0e0e0;
  206. border-radius: .2rem;
  207. }
  208. .taskFn:after{
  209. display: block;
  210. content: "";
  211. height: 0;
  212. border-style: solid;
  213. border-color: transparent transparent #e0e0e0 transparent;
  214. border-width: .6rem;
  215. position: absolute;
  216. right: 2rem;
  217. top: -1.2rem;
  218. }
  219. .taskFn:before{
  220. display: block;
  221. content: "";
  222. height: 0;
  223. border-style: solid;
  224. border-color: transparent transparent #fff transparent;
  225. border-width: .6rem;
  226. position: absolute;
  227. right: 2rem;
  228. top: -1.1rem;
  229. z-index: 1;
  230. }
  231. .taskFn li{
  232. padding: 1rem .6rem;
  233. border-bottom: 1px solid #e0e0e0;
  234. }
  235. .taskFn li:last-of-type{
  236. border-bottom: none;
  237. }
  238. .hid {
  239. display: none;
  240. }
  241. </style>
  242. </head>
  243. <body>
  244. <div class="taskXQ">
  245. <div class="task_taskCon flex-con">
  246. <p>
  247. <span class="task_name">{{name}}</span>
  248. <i class="{{gz}}" id="attention"></i>
  249. </p>
  250. <p>分管县领导:
  251. <span class="task_duty">{{duty}}</span>
  252. <span class="task_dbqk right {{class}}">办结情况:{{status}}</span>
  253. </p>
  254. <p class="hid">执行单位:
  255. <span class="task_dw">{{enterprise}}</span>
  256. </p>
  257. <p>执行单位:
  258. <span class="task_people">{{people}}</span>
  259. </p>
  260. <p>行业分类:
  261. <span class="task_hyfl">{{hyfl}}</span>
  262. </p>
  263. </div>
  264. <div>
  265. <p>
  266. <span class="task_pssj">批示时间:{{pssj}}</span>
  267. <br>
  268. <span class="task_wcsj">完成时限:{{wcsj}}</span>
  269. </p>
  270. </div>
  271. <div>
  272. <h3>工作内容:</h3>
  273. <div class="task_text">{{task_content}}</div>
  274. </div>
  275. <div>
  276. <h3>工作要求:</h3>
  277. <div class="task_text">{{list_content}}</div>
  278. </div>
  279. <div>
  280. <h3>备注:</h3>
  281. <div class="task_text">{{beizhu}}</div>
  282. </div>
  283. <div>
  284. <h3>最新进展:
  285. <span id="tomore" class="right">[查看更多]</span>
  286. </h3>
  287. <ul class="gzjl">
  288. {{task_jilu}}
  289. </ul>
  290. </div>
  291. <div>
  292. <h3>任务批示:
  293. <span id="toInstructionsList" class="right">[查看更多]</span>
  294. </h3>
  295. <ul class="gzjl">
  296. {{task_pishi}}
  297. </ul>
  298. </div>
  299. </div>
  300. <div class="taskFn hid">
  301. <ul>
  302. <li>任务反馈</li>
  303. <li>任务批示</li>
  304. </ul>
  305. </div>
  306. <!-- <div class="zzPopups">
  307. <div></div>
  308. </div> -->
  309. <script src="../script/publicData.js"></script>
  310. <script src="../script/jquery-3.1.0.min.js"></script>
  311. <script type="text/javascript" src="../script/api.js"></script>
  312. <script>
  313. var ii = 0;
  314. function showImg(that) {
  315. // if (ii != 0) {
  316. // api.toast({
  317. // msg: '正在加载图片,请稍等...',
  318. // duration: 2000,
  319. // location: 'bottom'
  320. // });
  321. // return;
  322. // }
  323. api.imageCache({
  324. url: that.getAttribute("src")
  325. }, function (ret, err) {
  326. if (ret.status) {
  327. var url = ret.url;
  328. // $(".zzPopups div").append("<img src='"+url+"'>");
  329. var imageBrowser = api.require('imageBrowser');
  330. imageBrowser.openImages({
  331. imageUrls: [url]
  332. });
  333. //$(".zzPopups").css("display", "block");
  334. ii++;
  335. } else {
  336. api.toast({
  337. msg: '加载图片失败',
  338. duration: 2000,
  339. location: 'bottom'
  340. });
  341. ii = 0;
  342. }
  343. });
  344. }
  345. apiready = function () {
  346. api.showProgress({
  347. title: '努力加载中...',
  348. text: '请稍等...',
  349. modal: false
  350. });
  351. var dialogBox = api.require('dialogBox');
  352. var ulModel = $(".taskXQ").html(), str = "";
  353. var task = $api.getStorage("taskXQ");
  354. var winWidth = api.winWidth / 3 - 10;
  355. var ad = ["1", "3", "4"];
  356. var postData = {
  357. task_id: task.taskID
  358. }
  359. $(".zzPopups").click(function () {
  360. // $(".zzPopups").css("display", "none");
  361. // $(".zzPopups div").html(" ");
  362. // ii = 0;
  363. })
  364. $.get(pageUrl + "renwudetail", postData, function (data) {
  365. console.log(JSON.stringify(data))
  366. var data = data.data, user = "", dep = "", dataImg = [], dataFile = [];
  367. switch (data['0']['task_status']) {
  368. case "0":
  369. str = ulModel.replace("{{status}}", "未开始").replace("{{class}}", "task_dbqk1");
  370. break;
  371. case "1":
  372. str = ulModel.replace("{{status}}", "进行中").replace("{{class}}", "task_dbqk2");
  373. break;
  374. case "5":
  375. str = ulModel.replace("{{status}}", "临期").replace("{{class}}", "task_dbqk3");
  376. break;
  377. case "7":
  378. str = ulModel.replace("{{status}}", "已逾期").replace("{{class}}", "task_dbqk4");
  379. break;
  380. case "3":
  381. str = ulModel.replace("{{status}}", "已完结").replace("{{class}}", "task_dbqk5");
  382. break;
  383. }
  384. str = str.replace("{{name}}", data[0]['task_title']).replace("{{duty}}", data[0]['fuzeren_name']).replace("{{hyfl}}", data[0]['tradeclass_name']).replace("{{pssj}}", getTime(data[0]['task_start_time'])).replace("{{wcsj}}", getTime(data['0']['task_end_time']))
  385. .replace("{{beizhu}}", data[0]['task_beizhu'] || "无").replace("{{people}}", data[0]['user_name'] || "无").replace("{{enterprise}}", data[0]['department_name'] || "无")
  386. .replace("{{task_content}}", data[0]['task_list_content'] ? toHtml(data[0]['task_list_content']) : "无").replace("{{list_content}}", data[0]['task_content'] ? toHtml(data[0]['task_content']) : "无").replace("{{gz}}", data[0]['task_look_status'] == "0" ? "gz" : "gz-active")
  387. var gzjlModel = "<li rel='{{mesid}}'><p><span class='depName'>{{task_beizhu_time}}</span></p><p class='fkName'>{{task_beizhu_dep}}<span class='{{task_beizhu_audit}}'></span></p> <p style='margin-bottom: .3rem;' class='task_content'>{{task_beizhu_content}}</p><ul class='c_imgList clearFix'>{{imglList}}</ul><ul class='c_fileList'>{{fileList}}</ul></li>", str2 = "", imgStr = "", fileStr = "", str3="",fkData=[],pishiData=[];
  388. if (data['task_dynamic_content']) {
  389. for(var dataNum in data['task_dynamic_content']){
  390. fkData.push(data['task_dynamic_content'][dataNum])
  391. }
  392. for(var pishiNum in data['task_dynamic_content_pishi']){
  393. pishiData.push(data['task_dynamic_content_pishi'][pishiNum])
  394. }
  395. if(fkData.length!=0&&fkData[0]['imgs']&&fkData[0]['imgs'].length!=0){
  396. for (var num in fkData[0]['imgs']) {
  397. if (fkData[0]['imgs'][num]['task_dynamic_upload_status'] == "2") {
  398. dataFile.push(fkData[0]['imgs'][num])
  399. } else {
  400. dataImg.push(fkData[0]['imgs'][num])
  401. }
  402. }
  403. }
  404. }
  405. if (fkData && fkData.length != 0) {
  406. str2 += gzjlModel.replace("{{mesid}}", fkData[0]["task_dynamic_id"]).replace("{{task_beizhu_audit}}", ad.indexOf($api.getStorage("user").user_group_id) == 8 ? (fkData[0]["task_dynamic_content_status"] == "1" ? "offAudit" : "onAudit") : "").replace("{{task_beizhu_time}}", ["22"].indexOf($api.getStorage("user").user_group_id) == -1 ? getTime(fkData[0]["task_dynamic_createtime"], true) : getTime(fkData[0]["task_dynamic_createtime"], true) + "<span class='delBtn'>删除</span>").replace("{{task_beizhu_dep}}",fkData[0]["user_name"])
  407. .replace("{{task_beizhu_content}}", fkData[0]["task_dynamic_content"] ? toHtml(fkData[0]["task_dynamic_content"]) : "")
  408. if (dataImg && dataImg.length) {
  409. for (var imgIndex in dataImg) {
  410. imgStr += "<li style='width:32%;height:" + winWidth + "px;margin-right: 1%'><img src='" + pageImg + "/" + dataImg[imgIndex]['task_dynamic_upload_photo'] + "' alt='' onclick='showImg(this)'></li>";
  411. }
  412. str2 = str2.replace("{{imglList}}", imgStr || "");
  413. } else {
  414. str2 = str2.replace("{{imglList}}", "");
  415. }
  416. imgStr = "";
  417. if (dataFile && dataFile.length) {
  418. for (var fileIndex in dataFile) {
  419. fileStr += "<li class='recodeLi'><p><a href='" + pageImg + "/" + dataFile[fileIndex]['task_dynamic_upload_photo'] + "' download='download'>" + dataFile[fileIndex]['task_dynamic_upload_photo'].replace("upload/" + dataFile[fileIndex]['task_dynamic_task_id'], "").slice(10) + "</a></p></li>";
  420. }
  421. str2 = str2.replace("{{fileList}}", fileStr || "");
  422. } else {
  423. str2 = str2.replace("{{fileList}}", "");
  424. }
  425. fileStr = "";
  426. dataFile = [];
  427. dataImg = [];
  428. } else {
  429. str2 += "暂无";
  430. }
  431. if (pishiData && pishiData.length != 0) {
  432. for (var j in pishiData) {
  433. if (pishiData[j]['imgs']&&pishiData[j]['imgs'].length) {
  434. for (var num in pishiData[j]['imgs']) {
  435. if (pishiData[j]['imgs'][num]['task_dynamic_upload_status'] == "2") {
  436. dataFile.push(pishiData[j]['imgs'][num])
  437. } else {
  438. dataImg.push(pishiData[j]['imgs'][num])
  439. }
  440. }
  441. }
  442. str3 += gzjlModel.replace("{{mesid}}", pishiData[j]["task_dynamic_id"]).replace("{{active}}", j == 0 ? "active" : "").replace("{{task_beizhu_audit}}", "").replace("{{task_beizhu_time}}", ad.indexOf($api.getStorage("user").user_group_id) == -1 ? getTime(pishiData[j]["task_dynamic_createtime"], true) : getTime(pishiData[j]["task_dynamic_createtime"], true)).replace("{{task_beizhu_dep}}", pishiData[j]["user_name"])
  443. .replace("{{task_beizhu_content}}",pishiData[j]["task_dynamic_content"] ? toHtml(pishiData[j]["task_dynamic_content"]) : "")
  444. if (dataImg && dataImg.length) {
  445. for (var imgIndex in dataImg) {
  446. imgStr += "<li style='width:32%;height:" + winWidth + "px;margin-right: 1%'><img src='" + pageImg + "/" + dataImg[imgIndex]['task_dynamic_upload_photo'] + "' alt='' onclick='showImg(this)'></li>";
  447. }
  448. str3 = str3.replace("{{imglList}}", imgStr || "");
  449. } else {
  450. str3 = str3.replace("{{imglList}}", "");
  451. }
  452. imgStr = "";
  453. if (dataFile && dataFile.length) {
  454. for (var fileIndex in dataFile) {
  455. fileStr += "<li class='recodeLi'><p><a href='" + pageImg + "/" + dataFile[fileIndex]['task_dynamic_upload_photo'] + "' download='download'>" + dataFile[fileIndex]['task_dynamic_upload_photo'].replace("upload/" + dataFile[fileIndex]['task_dynamic_task_id'], "").slice(10) + "</a></p></li>";
  456. }
  457. str3 = str3.replace("{{fileList}}", fileStr || "");
  458. } else {
  459. str3 = str3.replace("{{fileList}}", "");
  460. }
  461. fileStr = "";
  462. dataFile = [];
  463. dataImg = [];
  464. }
  465. } else {
  466. str3 += "暂无";
  467. }
  468. str = str.replace("{{task_jilu}}", str2).replace("{{task_pishi}}",str3);
  469. api.hideProgress();
  470. $(".taskXQ").html(str).css("display", "block");
  471. if ($api.getStorage("user").user_group_id != "5") {
  472. $("#attention").css("display", "none");
  473. }
  474. if (data['task_dynamic_content'].length == 0) {
  475. $("#tomore").css("display", "none");
  476. }
  477. // if (pishiData.length == 0) {
  478. $("#toInstructionsList").css("display", "none");
  479. // }
  480. $("#tomore").click(function () {
  481. api.openWin({
  482. name: 'morejl',
  483. url: './recordXQ.html'
  484. });
  485. })
  486. $("#toInstructionsList").click(function () {
  487. api.openWin({
  488. name: 'instructionsList',
  489. url: './instructionsList.html'
  490. });
  491. })
  492. $("#attention").click(function () {
  493. if ($(this).hasClass("gz")) {
  494. $.post(pageUrl + "lookstatus", { task_id: task.taskID - 0, task_look_status: "1" }, function (data) {
  495. // alert(JSON.stringify(data))
  496. })
  497. $(this).addClass("gz-active").removeClass("gz")
  498. api.toast({
  499. msg: "已关注此任务",
  500. duration: 2000,
  501. location: 'bottom'
  502. });
  503. } else {
  504. $.post(pageUrl + "lookstatus", { task_id: task.taskID - 0, task_look_status: "0" }, function (data) {
  505. // alert(JSON.stringify(data))
  506. })
  507. $(this).addClass("gz").removeClass("gz-active")
  508. api.toast({
  509. msg: "已取消关注",
  510. duration: 2000,
  511. location: 'bottom'
  512. });
  513. }
  514. })
  515. // if(ad.indexOf($api.getStorage("user").user_group_id)!=-1){
  516. // $(".gzjl li .fkName").click(function () {
  517. // $api.setStorage("fkid",$(this).parent().attr("rel"));
  518. // var toFK="toFrame(6)";
  519. // api.execScript({
  520. // script: toFK
  521. // });
  522. // })
  523. // }
  524. $(".task_dbqk").on("click", function () {
  525. if (ad.indexOf($api.getStorage("user").user_group_id) != -1) {
  526. api.actionSheet({
  527. title: '修改任务状态',
  528. cancelTitle: '取消',
  529. buttons: ['未开始', '进行中', '临期', '逾期', '已完结']
  530. }, function (ret, err) {
  531. var index = ret.buttonIndex;
  532. switch (index) {
  533. case 1:
  534. postData(0, '将任务修改为未开始吗?');
  535. break;
  536. case 2:
  537. postData(1, '将任务修改为进行中吗?');
  538. break;
  539. case 3:
  540. postData(5, '将任务修改为临期吗?');
  541. break;
  542. case 4:
  543. postData(7, '将任务修改为逾期吗?');
  544. break;
  545. case 5:
  546. postData(3, '将任务修改为已完结吗?');
  547. break;
  548. }
  549. function postData(type, val) {
  550. dialogBox.alert({
  551. texts: {
  552. title: '确认提示',
  553. content: val,
  554. leftBtnTitle: '取消',
  555. rightBtnTitle: '确认'
  556. },
  557. styles: {
  558. bg: '#fff',
  559. w: 300,
  560. title: {
  561. marginT: 20,
  562. icon: 'widget://res/gou.png',
  563. iconSize: 40,
  564. titleSize: 13,
  565. titleColor: '#000'
  566. },
  567. content: {
  568. color: '#000',
  569. size: 16
  570. },
  571. left: {
  572. marginB: 0,
  573. marginL: 0,
  574. w: 150,
  575. h: 60,
  576. corner: 2,
  577. bg: '#f9f9f9',
  578. color: '#818181',
  579. size: 12
  580. },
  581. right: {
  582. marginB: 0,
  583. marginL: 0,
  584. w: 150,
  585. h: 60,
  586. corner: 2,
  587. bg: '#51c4d4',
  588. color: '#fff',
  589. size: 12
  590. }
  591. }
  592. }, function (ret) {
  593. if (ret.eventType == 'right') {
  594. var taskData = {
  595. task_id: task.taskID - 0,
  596. task_status: type
  597. }
  598. $.post(pageUrl + "taskstatus", taskData, function (data) {
  599. if (data.status == "200") {
  600. $(".task_dbqk")[0].className = "task_dbqk right";
  601. var li = $api.getStorage("selectli");
  602. switch (type) {
  603. case 0:
  604. $(".task_dbqk").addClass("task_dbqk1").text("办结情况:未开始");
  605. api.sendEvent({
  606. name: 'addLi',
  607. extra: { html: li, type: "0" }
  608. });
  609. break;
  610. case 1:
  611. $(".task_dbqk").addClass("task_dbqk2").text("办结情况:进行中");
  612. api.sendEvent({
  613. name: 'addLi',
  614. extra: { html: li, type: "1" }
  615. });
  616. break;
  617. case 5:
  618. $(".task_dbqk").addClass("task_dbqk3").text("办结情况:临期");
  619. api.sendEvent({
  620. name: 'addLi',
  621. extra: { html: li, type: "2" }
  622. });
  623. break;
  624. case 7:
  625. $(".task_dbqk").addClass("task_dbqk4").text("办结情况:逾期");
  626. api.sendEvent({
  627. name: 'addLi',
  628. extra: { html: li, type: "3" }
  629. });
  630. break;
  631. case 3:
  632. $(".task_dbqk").addClass("task_dbqk5").text("办结情况:已完结");
  633. api.sendEvent({
  634. name: 'addLi',
  635. extra: { html: li, type: "4" }
  636. });
  637. break;
  638. }
  639. api.sendEvent({
  640. name: 'removeLi',
  641. extra: { type: task.taskStatus }
  642. });
  643. }
  644. api.toast({
  645. msg: data.message,
  646. duration: 2000,
  647. location: 'bottom'
  648. });
  649. });
  650. dialogBox.close({
  651. dialogName: 'alert'
  652. });
  653. } else if (ret.eventType == 'left') {
  654. dialogBox.close({
  655. dialogName: 'alert'
  656. });
  657. }
  658. })
  659. }
  660. });
  661. }
  662. /* if($api.getStorage("user").user_group_id!=4) {
  663. api.toast({
  664. msg: '无此权限',
  665. duration: 2000,
  666. location: 'bottom'
  667. });
  668. return;
  669. }
  670. switch (data['0']['task_status']){
  671. case "0":
  672. popupsBox('确认开始任务吗?',1);
  673. break;
  674. case "1":
  675. popupsBox('确认完成任务吗?',4);
  676. break;
  677. case "2":
  678. popupsBox('确认完成任务吗?',4);
  679. break;
  680. case "3":
  681. popupsBox('确认完成任务吗?',4);
  682. break;
  683. }*/
  684. })
  685. // $(".c_fileList span").click(function (e) {
  686. // e.stopPropagation();
  687. // var url=this.getAttribute("rel");
  688. // var thisFile=url.slice(url.lastIndexOf("/")+1).split(".");
  689. // api.download({
  690. // url: this.getAttribute("rel"),
  691. // cache: true,
  692. // savePath:"fs://"+thisFile[0].replace(task.taskID,"").slice(10)+"."+thisFile[1]
  693. // }, function (ret, err){
  694. // if(ret.state==1){
  695. //// alert(ret.savePath)
  696. //// var fs = api.require('fs');
  697. //// fs.open({
  698. //// path: ret.savePath,
  699. //// flags: 'read'
  700. //// }, function(ret, err) {
  701. //// if (ret.status) {
  702. //// alert(JSON.stringify(ret));
  703. //// } else {
  704. //// alert(JSON.stringify(err));
  705. //// }
  706. //// });
  707. // api.readFile({
  708. // path: ret.savePath
  709. // }, function (ret, err) {
  710. // api.openWin({
  711. // name: 'test',
  712. // url: './test.html',
  713. // pageParam: {content: ret.data},
  714. // delay:300
  715. // });
  716. // });
  717. // }else if(ret.state==2){
  718. // api.toast({
  719. // msg: '下载失败',
  720. // duration: 2000,
  721. // location: 'bottom'
  722. // });
  723. // }
  724. // });
  725. // })
  726. $(".delBtn").on('click', function (e) {
  727. e.stopPropagation();
  728. var mesID = $(this).parent().parent().parent().attr('rel');
  729. var that = $(this).parent().parent().parent();
  730. dialogBox.alert({
  731. texts: {
  732. title: '确认提示',
  733. content: "删除该条记录吗?",
  734. leftBtnTitle: '取消',
  735. rightBtnTitle: '确认'
  736. },
  737. styles: {
  738. bg: '#fff',
  739. w: 300,
  740. title: {
  741. marginT: 20,
  742. icon: 'widget://res/gou.png',
  743. iconSize: 40,
  744. titleSize: 13,
  745. titleColor: '#000'
  746. },
  747. content: {
  748. color: '#000',
  749. size: 16
  750. },
  751. left: {
  752. marginB: 0,
  753. marginL: 0,
  754. w: 150,
  755. h: 60,
  756. corner: 2,
  757. bg: '#f9f9f9',
  758. color: '#818181',
  759. size: 12
  760. },
  761. right: {
  762. marginB: 0,
  763. marginL: 0,
  764. w: 150,
  765. h: 60,
  766. corner: 2,
  767. bg: '#51c4d4',
  768. color: '#fff',
  769. size: 12
  770. }
  771. }
  772. }, function (ret) {
  773. if (ret.eventType == 'right') {
  774. var recordData = {
  775. recordid: mesID
  776. }
  777. $.post(pageUrl + "contentdel", recordData, function (data) {
  778. if (data.status == "200") {
  779. that.remove();
  780. // var upload = 'toFrame(5);';
  781. // setTimeout(function () {
  782. // api.execScript({
  783. // name: 'root',
  784. // script: upload
  785. // });
  786. // },500)
  787. }
  788. api.toast({
  789. msg: data.message,
  790. duration: 2000,
  791. location: 'bottom'
  792. });
  793. });
  794. dialogBox.close({
  795. dialogName: 'alert'
  796. });
  797. } else if (ret.eventType == 'left') {
  798. dialogBox.close({
  799. dialogName: 'alert'
  800. });
  801. }
  802. })
  803. })
  804. })
  805. api.addEventListener({
  806. name: 'showTaskFn'
  807. }, function (ret, err) {
  808. if(ret.value.state=="show"){
  809. $(".taskFn").removeClass("hid")
  810. }else {
  811. $(".taskFn").addClass("hid")
  812. }
  813. });
  814. $(".taskFn li:first-of-type").click(function () {
  815. $(".taskFn").addClass("hid");
  816. $api.setStorage("taskFnStatus",null)
  817. var toFK = "toFrame(6)";
  818. api.execScript({
  819. name: "root",
  820. script: toFK
  821. });
  822. })
  823. $(".taskFn li:last-of-type").click(function () {
  824. $(".taskFn").addClass("hid");
  825. $api.setStorage("taskFnStatus",null)
  826. var toFK = "toFrame(9)";
  827. api.execScript({
  828. name: "root",
  829. script: toFK
  830. });
  831. })
  832. function getTime(time, bl) {
  833. var oldTime = new Date(time * 1000), str = "";
  834. var year = oldTime.getFullYear();
  835. var month = oldTime.getMonth() + 1;
  836. var day = oldTime.getDate();
  837. var hours = oldTime.getHours();
  838. var minutes = oldTime.getMinutes();
  839. if (bl) {
  840. str = year + "/" + checkTime(month) + "/" + checkTime(day) + " " + checkTime(hours) + ":" + checkTime(minutes);
  841. } else {
  842. str = year + "/" + checkTime(month) + "/" + checkTime(day);
  843. }
  844. return str;
  845. }
  846. function checkTime(val) {
  847. var val = val;
  848. if ((val + "").length == 1) {
  849. val = "0" + val;
  850. }
  851. return val
  852. }
  853. function popupsBox(val, type) {
  854. dialogBox.alert({
  855. texts: {
  856. title: '确认提示',
  857. content: val,
  858. leftBtnTitle: '取消',
  859. rightBtnTitle: '确认'
  860. },
  861. styles: {
  862. bg: '#fff',
  863. w: 300,
  864. title: {
  865. marginT: 20,
  866. icon: 'widget://res/gou.png',
  867. iconSize: 40,
  868. titleSize: 13,
  869. titleColor: '#000'
  870. },
  871. content: {
  872. color: '#000',
  873. size: 16
  874. },
  875. left: {
  876. marginB: 0,
  877. marginL: 0,
  878. w: 150,
  879. h: 60,
  880. corner: 2,
  881. bg: '#f9f9f9',
  882. color: '#818181',
  883. size: 12
  884. },
  885. right: {
  886. marginB: 0,
  887. marginL: 0,
  888. w: 150,
  889. h: 60,
  890. corner: 2,
  891. bg: '#51c4d4',
  892. color: '#fff',
  893. size: 12
  894. }
  895. }
  896. }, function (ret) {
  897. if (ret.eventType == 'right') {
  898. var taskData = {
  899. task_id: task.taskID - 0,
  900. task_status: type
  901. }
  902. $.post(pageUrl + "taskstatus", taskData, function (data) {
  903. api.toast({
  904. msg: data.message,
  905. duration: 2000,
  906. location: 'bottom'
  907. });
  908. if (data.status == "200") {
  909. if (type == "1") {
  910. $(".task_dbqk").addClass("task_dbqk2").text("办结情况:进行中");
  911. var li = $api.getStorage("selectli");
  912. var task = $api.getStorage("taskXQ");
  913. api.sendEvent({
  914. name: 'addLi',
  915. extra: { html: li, type: "1" }
  916. });
  917. api.sendEvent({
  918. name: 'removeLi',
  919. extra: { type: task.taskStatus }
  920. });
  921. } else if (type == "4") {
  922. $(".task_dbqk").addClass("task_dbqk5").text("办结情况:已完结");
  923. var li = $api.getStorage("selectli");
  924. var task = $api.getStorage("taskXQ");
  925. api.sendEvent({
  926. name: 'addLi',
  927. extra: { html: li, type: "4" }
  928. });
  929. api.sendEvent({
  930. name: 'removeLi',
  931. extra: { type: task.taskStatus }
  932. });
  933. }
  934. $(".task_dbqk").off("click");
  935. }
  936. })
  937. dialogBox.close({
  938. dialogName: 'alert'
  939. });
  940. } else if (ret.eventType == 'left') {
  941. dialogBox.close({
  942. dialogName: 'alert'
  943. });
  944. }
  945. });
  946. }
  947. function toHtml(str) {
  948. var a = "&lt;", b = "&gt;", c = "&nbsp;", d = "&amp;nbsp;", text = str;
  949. if (text.match(a)) {
  950. toChange(a, "<")
  951. }
  952. if (text.match(b)) {
  953. toChange(b, ">")
  954. }
  955. if (text.match(c)) {
  956. toChange(c, " ")
  957. }
  958. if (text.match(d)) {
  959. toChange(d, " ")
  960. }
  961. function toChange(type, type1) {
  962. text = text.replace(type, type1);
  963. if (text.match(type)) {
  964. toChange(type, type1)
  965. }
  966. }
  967. return text;
  968. }
  969. }
  970. </script>
  971. </body>
  972. </html>