index.php 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206
  1. <style>
  2. .nav-btns {
  3. margin: 10px 20px;
  4. }
  5. .nav-btns > a {
  6. display: inline-block;
  7. width: 120px;
  8. border: 1px solid #40c180;
  9. text-align: center;
  10. line-height: 30px;
  11. }
  12. .active {
  13. color: #fff;
  14. background-color: #40c180;
  15. }
  16. .btn-garder {
  17. margin-right: 10px;
  18. display: inline-block;
  19. width: 100px;
  20. border: none;
  21. text-align: center;
  22. line-height: 30px;
  23. color: #fff;
  24. background-color: #2977ff;
  25. }
  26. .confirmbox {
  27. background: #fff;
  28. border: 1px solid #cccccc;
  29. border-radius: 3px;
  30. padding: 40px 40px 30px;
  31. text-align: center;
  32. position: fixed;
  33. left: 50%;
  34. top: 50%;
  35. transform: translate(-50%, -50%);
  36. z-index: 99;
  37. }
  38. .confirmbox-mask {
  39. background: rgba(0, 0, 0, .7);
  40. left: 0;
  41. right: 0;
  42. top: 0;
  43. bottom: 0;
  44. z-index: 99;
  45. position: fixed;
  46. }
  47. .btn_area button {
  48. border: none;
  49. background: #009965;
  50. width: 111px;
  51. height: 36px;
  52. border-radius: 3px;
  53. font-size: 14px;
  54. color: #fff;
  55. outline: none;
  56. cursor: pointer;
  57. }
  58. .btn_area button.save {
  59. display: block;
  60. margin: 40px auto;
  61. }
  62. .confirmbox .confirmbox-btns {
  63. margin-top: 40px;
  64. }
  65. .class-modal-body .classes {
  66. margin-bottom: 10px;
  67. }
  68. .class-modal-body .classes > div {
  69. display: inline-block;
  70. max-width: 640px;
  71. vertical-align: top;
  72. }
  73. .class-modal-body .classes a {
  74. text-decoration: none;
  75. display: inline-block;
  76. margin: 0 5px 5px;
  77. color: #136bfb;
  78. font-size: 14px;
  79. }
  80. .class-modal-body .classes a.active {
  81. color: #fc091b
  82. }
  83. .class-modal .icon-close {
  84. position: absolute;
  85. right: 20px;
  86. top: 20px;
  87. }
  88. .class-modal-1 {
  89. width: auto;
  90. background: #fff;
  91. border-radius: 5px;
  92. position: absolute;
  93. top: 50%;
  94. left: 50%;
  95. transform: translate(-50%, -50%);
  96. }
  97. .class-modal-head-1 {
  98. font-size: 14px;
  99. text-align: left;
  100. color: #fff;
  101. line-height: 30px;
  102. background: #2977ff;
  103. padding-left: 15px;
  104. }
  105. .class-modal-body-1 {
  106. padding: 15px;
  107. }
  108. .class-modal-body-1 h2, .class-modal-body-1 h3 {
  109. font-size: 14px;
  110. font-weight: normal;
  111. margin-top: 10px;
  112. }
  113. .class-modal-body-1 h3 span {
  114. font-size: 10px;
  115. color: #ccc;
  116. }
  117. .class-modal-body-1 label {
  118. display: inline-block;
  119. font-weight: normal;
  120. margin-right: 15px;
  121. height: 30px;
  122. position: relative;
  123. }
  124. .class-modal-1 .icon-close-1 {
  125. position: absolute;
  126. right: 10px;
  127. top: 5px;
  128. }
  129. .class-modal-1 .class_area {
  130. height: 115px;
  131. border: 1px solid #ccc;
  132. padding: 5px;
  133. overflow-y: auto;
  134. margin-bottom: 15px;
  135. }
  136. .class-modal-1 .checkAll {
  137. position: absolute;
  138. right: 5px;
  139. top: 115px;
  140. }
  141. .class-modal-1 .subsection {
  142. }
  143. .class-modal-1 .btn p {
  144. color: #000;
  145. }
  146. .class-modal-1 .btn_area {
  147. padding: 10px;
  148. border-top: 1px solid #aab6aa;
  149. margin-top: 10px;
  150. }
  151. .class-modal-1 .btn_area p {
  152. display: inline-block;
  153. }
  154. .class-modal-1 .btn_area button {
  155. margin-left: 5px;
  156. }
  157. .class-modal-1 .btn_area .cancel {
  158. background: #fff;
  159. color: #000;
  160. border: 1px solid #666;
  161. }
  162. .c-red-1 {
  163. color: #CC3300;
  164. font-size: 10px;
  165. display: inline-block;
  166. position: absolute;
  167. left: 15px;
  168. top: 18px;
  169. }
  170. .vtm {
  171. vertical-align: middle;
  172. }
  173. .pointer {
  174. cursor: pointer;
  175. }
  176. .dib {
  177. display: inline-block;
  178. }
  179. .pdp-con .pop-opt-con {
  180. border-top: 1px solid #ddd;
  181. padding-top: 20px;
  182. }
  183. .tit-sub-intro {
  184. color: #666;
  185. }
  186. .tit-sub-intro span {
  187. font-size: 12px;
  188. }
  189. .subsection {
  190. width: 44px;
  191. height: 24px;
  192. border: 1px solid #ddd;
  193. text-align: center;
  194. font-size: 12px;
  195. }
  196. .reduce-btn, .add-btn {
  197. width: 16px;
  198. height: 16px;
  199. line-height: 16px;
  200. text-align: center;
  201. color: #16AE68;
  202. border: 1px solid #16AE68;
  203. border-radius: 3px;
  204. font-size: 16px;
  205. font-weight: bold;
  206. margin-right: 6px;
  207. }
  208. .reduce-btn.forbidden, .add-btn.forbidden {
  209. color: #bbb;
  210. border: 1px solid #bbb;
  211. cursor: no-drop;
  212. }
  213. .disable-btn, .disable-btn:hover {
  214. background: gray;
  215. }
  216. .input-page-no {
  217. width: 40px;
  218. }
  219. .page-go {
  220. background-color: #2977ff;
  221. padding: 5px;
  222. color: white;
  223. cursor: pointer;
  224. }
  225. .magic-tips {
  226. padding: 5px;
  227. position: absolute;
  228. z-index: 100;
  229. right: 450px;
  230. background: #15ae68;
  231. color: white;
  232. display: none;
  233. }
  234. .magic-tips li {
  235. list-style: none;
  236. }
  237. .tip-icon {
  238. cursor: pointer;
  239. }
  240. </style>
  241. <script type="text/javascript">
  242. function in_array(search, array) {
  243. for (var i in array) {
  244. if (array[i] == search) {
  245. return true;
  246. }
  247. }
  248. return false;
  249. }
  250. testFlag = "<?php echo $this->testFlag;?>";
  251. customTplsIds = new Array();
  252. var i = 0;
  253. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  254. customTplsIds[i] = "<?php echo $tplId;?>";
  255. i++;
  256. <?php }?>
  257. jQuery(document).ready(function () {
  258. // 根据年级筛选班级
  259. jQuery("#grade").change(function () {
  260. var grade = $(this).val();
  261. if (!grade) return false;
  262. jQuery.post(
  263. '<?php echo $this->createUrl("print/getGradeClass");?>', {"grade": grade}, function (data) {
  264. data = JSON.parse(data);
  265. if (data.success == 1) {
  266. var classObj = $("#class");
  267. var html = "<option value=''>全部班级</option>";
  268. classObj.empty();
  269. $.each(data.message, function (i, n) {
  270. html += "<option value='" + n.class_id + "'>" + n.class_name + "</option>";
  271. });
  272. classObj.append(html);
  273. }
  274. }
  275. );
  276. });
  277. });
  278. </script>
  279. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  280. <div class="main-content-inner">
  281. <!-- 导航栏开始-->
  282. <?php include(Yii::app()->basePath . '/views/layouts/view_production_navigation.php'); ?>
  283. <!-- 导航栏结束-->
  284. <div class="page-content">
  285. <div class="row" style="margin:0px;">
  286. <div class="col-xs-12">
  287. <!-- PAGE CONTENT BEGINS -->
  288. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  289. <div class="row" style="position: relative;">
  290. <form method="get" id="form1" action="<?php echo $this->createUrl("writing/index"); ?>">
  291. <div class="col-xs-12">
  292. <div class="dataTables_length margin-zy clearfix">
  293. <select class="form-control" id="grade" name="grade">
  294. <option value="">年级</option>
  295. <option value="1" <?php if ($grade == 1) echo "selected"; ?>>高一</option>
  296. <option value="2" <?php if ($grade == 2) echo "selected"; ?>>高二</option>
  297. <option value="3" <?php if ($grade == 3) echo "selected"; ?>>高三</option>
  298. </select>
  299. <select class="form-control" id="class" name="classId">
  300. <option value="">全部班级</option>
  301. <?php foreach ($classes as $class) { ?>
  302. <option <?php if ((string)$classId === (string)$class["class_id"]) echo "selected=selected"; ?>
  303. value="<?php echo $class["class_id"]; ?>"><?php echo $class["class_name"]; ?></option>
  304. <?php } ?>
  305. </select>
  306. <input type="text" class="form-control input-sm" placeholder="请输入打印任务名称" name="name"
  307. value="<?php echo $printName; ?>">
  308. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索
  309. </button>
  310. <span class="fr">
  311. <span class="magic-tips">
  312. <li>* 请确认扫描时题目编号和写作卡题目编号完全对应。</li>
  313. <li>* 请勿反复点击恢复按钮,反复点击会导致批改后写作卡生成时间延长。</li>
  314. <li>* 生成写作宝并打印后,请务必同时分发对应班级的写作卡。</li>
  315. </span>
  316. <span class="tip-icon"><img width="35" height="35" src="/images/tongzhi.png"></span>
  317. <span style="font-size:13px;padding-left:2px;color:red;margin-right: 10px;">
  318. 温馨提示
  319. </span>
  320. <a href="<?php echo $this->createUrl("writing/setting"); ?>" class="btn-garder">生成写作宝</a>
  321. <a id="selectPrint" href="javascript:void(0);" class="btn-garder">发送云印任务</a>
  322. <a id="batchPrint" href="javascript:void(0);" class="btn-garder">批量下载</a>
  323. <a id="batchPrintToolsXzb" href="javascript:void(0);" class="btn-garder">批量打印</a>
  324. </span>
  325. </div>
  326. </div>
  327. </form>
  328. </div>
  329. <table id="dynamic-table"
  330. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
  331. style="font-size:12px">
  332. <thead>
  333. <tr>
  334. <th class="center">
  335. <input type="checkbox" class="ace selectAll"/>
  336. </th>
  337. <th>名称</th>
  338. <th>班级</th>
  339. <th>已生成/总数</th>
  340. <th>已批改/批改PDF</th>
  341. <th>创建时间</th>
  342. <th>是否下载/打印</th>
  343. <th>下载/打印时间</th>
  344. <th>题目编号</th>
  345. <th>操作</th>
  346. </tr>
  347. </thead>
  348. <tbody>
  349. <?php if (!empty($printList)):foreach ($printList as $cl): ?>
  350. <tr>
  351. <td>
  352. <?php if (Yii::app()->cache->getValue("cloud_print_task:english_writing" . $cl['ew_id']) != 1) { ?>
  353. <input type="checkbox" class="ace myselect"
  354. value="<?php echo $cl['ew_id']; ?>">
  355. <?php } ?>
  356. </td>
  357. <?php $mwName = '写作宝' . $cl['name'] . '第' . $cl['week_no'] . '次'; ?>
  358. <td>
  359. <a href="<?php echo $this->createUrl("writing/classes", array("ew_group_id" => $cl['ew_group_id'], "ew_name" => $mwName)); ?>"><?php echo $mwName; ?></a>
  360. </td>
  361. <td style="max-width:100px"><?php echo $cl['class_name']; ?></td>
  362. <td><?php echo $cl['pdfCount'] . '/' . $cl['totalCount']; ?></td>
  363. <td><?php echo $cl['markCount'] . '/' . $cl['cardCount']; ?></td>
  364. <td><?php echo date("Y-m-d H:i:s", $cl['create_time']); ?></td>
  365. <td><?php if ($cl['isDown']) {
  366. echo '已下载/打印';
  367. } else {
  368. echo '未下载/打印';
  369. } ?></td>
  370. <td><?php echo $cl['downTime']; ?></td>
  371. <td><?php echo !empty($cl['is_write']) ? $cl['topic_no'] : '无'; ?></td>
  372. <td style="width:360px;">
  373. <!-- 班级下载 -->
  374. <span class="iconfont click-sc addbx printToolsXzb" aria-hidden="true"
  375. ewid="<?php echo (string)$cl['ew_id']; ?>" title="打印写作宝"
  376. >&#xe6bb;</span>
  377. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载写作宝"
  378. onclick="printWeek('<?php echo (string)$cl['ew_id']; ?>')"><img
  379. src="/images/download.png" style="margin-bottom:-2px;"></span>
  380. <!-- 按学生下载 -->
  381. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载写作宝"
  382. onclick="javascript:location.href='<?php echo $this->createUrl('writing/stu', array('ew_id' => (string)$cl['ew_id'])); ?>'">&#xe668;</span>
  383. <!-- 云印任务 -->
  384. <span class="iconfont click-sc addbx" <?php if (Yii::app()->cache->getValue("cloud_print_task:english_writing:" . $cl['ew_id']) == 1) echo 'style="background-color:gray"'; ?>
  385. aria-hidden="true"
  386. title="<?php if (Yii::app()->cache->getValue("cloud_print_task:english_writing:" . $cl['ew_id']) == 1) {
  387. echo '24小时内不可重复发送';
  388. } else {
  389. echo '发送云印任务';
  390. } ?>"
  391. onclick="sendCloudTask('<?php echo $cl['ew_id']; ?>',<?php echo Yii::app()->cache->getValue("cloud_print_task:english_writing:" . $cl['ew_id']) == 1 ? 1 : 0; ?>)">云
  392. </span>
  393. <!-- 下载教师版按钮 -->
  394. <span class="iconfont click-sc addbx" style="margin-left: 3px;" aria-hidden="true"
  395. title="下载写作宝教师版" onclick="downPdfXZBTeacherPrint('<?php echo (string)$cl['ew_id']; ?>')"><img
  396. width="18" height="25" src="/images/magic_word/u114.svg"></span>
  397. <!-- 扫描答题卡按钮 -->
  398. <?php if ($cl['marking_status'] == 0 && !empty($cl['is_write'])): ?>
  399. <span class="iconfont click-sc addbx" aria-hidden="true" title="扫描在线答题卡"
  400. onclick="createTemplateScanOnline('<?php echo $cl['ew_group_id']; ?>',this,'词汇宝','<?php echo $cl['ew_id']; ?>')">扫</span>
  401. <?php else: ?>
  402. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  403. title="扫描在线答题卡">扫</span>
  404. <?php endif; ?>
  405. <!-- 确认上传按钮 -->
  406. <?php if($cl['marking_status']==0 && $cl['markCount']>0):?>
  407. <span class="iconfont click-sc addbx" aria-hidden="true" title="确认全部批改完成" onclick="confirmUpload('<?php echo (string)$cl['ew_id']; ?>')">&#xe667;</span>
  408. <?php else:?>
  409. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true" title="确认全部批改完成">&#xe667;</span>
  410. <?php endif;?>
  411. <!-- 恢复上传按钮 -->
  412. <?php if ($cl['marking_status'] == 1): ?>
  413. <span class="iconfont click-sc addbx" aria-hidden="true" title="恢复答题卡上传"
  414. onclick="resumeUpload('<?php echo (string)$cl['ew_id']; ?>')"><i
  415. class="fa fa-reply"></i></span>
  416. <?php else: ?>
  417. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  418. title="恢复答题卡上传"><i class="fa fa-reply"></i></span>
  419. <?php endif; ?>
  420. <!-- 下载批改后答题卡按钮 -->
  421. <?php if ($cl['marking_status'] == 1): ?>
  422. <span class="iconfont click-sc addbx printToolsCorrectXzb" ewid="<?php echo (string)$cl['ew_id']; ?>" aria-hidden="true" title="下载批改后答题卡"
  423. ><img
  424. width="18" height="25" src="/images/magic_word/u120.svg"></span>
  425. <?php else: ?>
  426. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  427. title="下载批改后答题卡"><img width="18" height="25"
  428. src="/images/magic_word/u120.svg"></span>
  429. <?php endif; ?>
  430. <!-- 下载批改后统计excel -->
  431. <?php if ($cl['marking_status'] == 1): ?>
  432. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载批改后统计excel"
  433. onclick="downExcel('<?php echo (string)$cl['ew_id']; ?>','<?php echo (string)$cl['class_id']; ?>')"><img
  434. width="18" height="25" src="/images/magic_word/tongji.svg"></span>
  435. <?php else: ?>
  436. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  437. title="下载批改后统计excel"><img width="18" height="25"
  438. src="/images/magic_word/tongji.svg"></span>
  439. <?php endif; ?>
  440. </td>
  441. </tr>
  442. <?php endforeach; else: ?>
  443. <tr>
  444. <td colspan="8">暂无数据!</td>
  445. </tr>
  446. <?php endif; ?>
  447. </tbody>
  448. </table>
  449. <?php if (!empty($page_total)): ?>
  450. <div class="row">
  451. <div class="col-xs-6">
  452. &nbsp;
  453. </div>
  454. <div class="col-xs-6">
  455. <div class="dataTables_paginate paging_simple_numbers">
  456. <?php
  457. $this->widget('CLinkPager', array(
  458. 'header' => '',
  459. 'firstPageLabel' => '首页',
  460. 'lastPageLabel' => '末页',
  461. 'prevPageLabel' => '上一页',
  462. 'nextPageLabel' => '下一页',
  463. 'pages' => $pages,
  464. 'maxButtonCount' => 5,
  465. ));
  466. echo '共:' . $page_total . '条';
  467. ?>
  468. <?php if ($pages->pagesCount > 1): ?>
  469. <span><input class="input-page-no" name="toPageNo" type="text" placeholder="页码"></span>
  470. <span class="page-go">Go</span>
  471. <?php endif; ?>
  472. </div>
  473. </div>
  474. </div>
  475. <?php endif; ?>
  476. </div>
  477. <!--上传模板弹窗-->
  478. <!--发送云印任务弹窗-->
  479. <div class="confirmbox-mask" id="classModal-1" style="display: none;">
  480. <div class="class-modal-1">
  481. <i class="icon icon-close-1" style="color: white">X</i>
  482. <div class="class-modal-head-1">发送云印任务</div>
  483. <div class="class-modal-body-1">
  484. <div>
  485. <span>亲爱的学管:您正在发起云印任务,请核对以下云印任务数据!</span>
  486. <span style="float: right;">共<i id="task_count">0</i>条任务,<i id="total_print_num">0</i>份云印任务</span>
  487. </div>
  488. <table style="margin-top: 15px;"
  489. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  490. <thead>
  491. <tr>
  492. <th>序号</th>
  493. <th>任务名称</th>
  494. <th>班级</th>
  495. <th>已生成/已开通/可下载</th>
  496. <th>已下载/打印</th>
  497. <th>云印份数</th>
  498. <th>备注</th>
  499. </tr>
  500. </thead>
  501. <tbody id="taskList">
  502. </tbody>
  503. </table>
  504. <div style="margin-top: 40px;">
  505. <span><img width="20px" height="20px" src="/images/icon-tip.svg">发送后,请至学管端【IMS-云印任务】模块查看任务进程,请等待云印中心打印后,寄回给学校!</span>
  506. <span style="margin-left:15px;float: right;"><input id="filter-uploaded"
  507. checked="checked" type="checkbox">过滤【已下载】的学生</span>
  508. </div>
  509. <div class="btn_area" style="text-align: center;">
  510. <input type="hidden" id="sendJson" name="sendJson" value="">
  511. <button id="sendCloudPrint" class="download">发送</button>
  512. <button class="cancel">取消</button>
  513. </div>
  514. </div>
  515. </div>
  516. </div>
  517. <!-- PAGE CONTENT ENDS -->
  518. </div>
  519. </div>
  520. </div>
  521. </div>
  522. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  523. <script src="/js/jquery.ajaxfileupload.js"></script>
  524. <script type="text/javascript">
  525. $(document).ready(function () {
  526. });
  527. function downpdf(weekId) {
  528. layer.msg('生成中,请稍后...', {time: 0, shade: 0.4})
  529. location.href = "<?php echo $this->createUrl("writing/teacherWeek")?>?mwId=" + weekId;
  530. layer.closeAll();
  531. }
  532. function objToJson(obj) {
  533. var json = "{ ";
  534. for (var item in obj) {
  535. json += "'" + item + "':'" + obj[item] + "',";
  536. }
  537. json += " }";
  538. return json;
  539. }
  540. function ccc() {
  541. layer.msg('敬请期待!', {
  542. time: 0,
  543. btn: ['确定', '取消'],
  544. yes: function (index) {
  545. layer.close(index);
  546. return false;
  547. }
  548. });
  549. }
  550. // 搜索事件
  551. $("#search").click(function () {
  552. $("#form1").submit();
  553. });
  554. function printWeek(weekId) {
  555. if (!weekId) {
  556. layer.msg("打印参数有误");
  557. return;
  558. }
  559. var message = "您确定要下载该班级写作宝吗?";
  560. var divTitle = '下载词汇宝';
  561. var objUrl = '';
  562. html = "" +
  563. '<div style="padding:20px 30px 0px 30px">' +
  564. '<div style="padding:8px 0;">请复制下方链接下载写作宝。</div>' +
  565. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>' +
  566. '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>' +
  567. '</div>' +
  568. '</div>' +
  569. "";
  570. layer.msg(message, {
  571. time: 0,
  572. btn: ['确定', '取消'],
  573. yes: function (index) {
  574. layer.close(index);
  575. $.ajax({
  576. url: "<?php echo $this->createUrl('productdownload/getWritingFile');?>",
  577. type: "GET",
  578. dataType: "json",
  579. title: divTitle,
  580. data: {"ew_id": weekId},
  581. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  582. beforeSend: function () {
  583. layer.msg("下载中请稍后...", {"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  584. },
  585. error: function (jqXHR, textStatus, errorThrown) {
  586. layer.closeAll();
  587. if (textStatus == "timeout") {
  588. $.ajax({
  589. type: 'GET',
  590. url: "<?php echo $this->createUrl("productdownload/addWritingTask");?>",
  591. data: {"ew_id": weekId},
  592. dataType: "json",
  593. success: function (data) {
  594. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  595. icon: 1,
  596. yes: function () {
  597. layer.closeAll();
  598. }
  599. });
  600. }
  601. })
  602. } else {
  603. layer.msg('返回失败!', {
  604. icon: 5
  605. }, function () {
  606. layer.closeAll();
  607. });
  608. }
  609. },
  610. success: function (data) {
  611. layer.closeAll();
  612. if (data.success == 1 || data.success == 2) {
  613. layer.open({
  614. type: 1,
  615. area: ['550px', '220px'],
  616. title: divTitle,
  617. content: html,
  618. success: function (index, layerObj) {
  619. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="' + data.downloadPath + '" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  620. jQuery("#confirm, #cancel").on("click", function () {
  621. layer.close(layerObj);
  622. });
  623. jQuery("#copy").on("click", function () {
  624. jQuery("#url").select();
  625. });
  626. },
  627. end: function () {
  628. }
  629. });
  630. } else if (data.success == 3) {
  631. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  632. icon: 1,
  633. yes: function () {
  634. layer.closeAll();
  635. }
  636. });
  637. } else if (data.success == 0) {
  638. layer.msg(data.message, {"time": 3000});
  639. }
  640. },
  641. });
  642. }
  643. });
  644. }
  645. //发送云印任务
  646. function sendCloudTask(weekId, isDisable) {
  647. if (isDisable === 1) {
  648. return false;
  649. }
  650. //$('.confirmbox-mask').show();return false;
  651. if (!weekId) {
  652. layer.msg("参数有误");
  653. return;
  654. }
  655. var saveDataAry = [];
  656. var data1 = {"ew_id": weekId};
  657. saveDataAry.push(data1);
  658. $.ajax({
  659. type: "POST",
  660. url: "<?php echo $this->createUrl("printCloud/generateWriting");?>",
  661. dataType: "json",
  662. contentType: "application/json",
  663. data: JSON.stringify(saveDataAry),
  664. beforeSend: function () {
  665. layer.load(1, {
  666. shade: [0.1, '#fff'] //0.1透明度的白色背景
  667. });
  668. },
  669. success: function (data) {
  670. var index = layer.load();
  671. layer.close(index);
  672. if (data.status == 1) {
  673. $('#sendJson').attr('value', JSON.stringify(data));
  674. var con = '';
  675. var task_count = 0;
  676. var totalCount = 0;
  677. $.each(data.data, function (index, item) {
  678. var one_count = item.enable_download_count - item.download_count;
  679. totalCount += (one_count > 0 ? one_count : 0);
  680. if ((item.enable_download_count - item.download_count) > 0) {
  681. task_count += 1;
  682. }
  683. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  684. + item.generate_count + '/' + item.dredge_count + '/' + '<i style="color: green">' + item.enable_download_count + '</i><input type="hidden" name="drege_count" value="' + item.enable_download_count + '"></td><td>'
  685. + item.download_count + '</td><td>' + (one_count > 0 ? one_count : 0) + '</td><td>' + (one_count > 0 ? '可发送' : '不可发送')
  686. + '</td></tr>'
  687. });
  688. $('#task_count').html(task_count);
  689. $('#total_print_num').html(totalCount);
  690. $('#taskList').html(con);
  691. $('#filter-uploaded').prop("checked", true)
  692. $('.confirmbox-mask').show();
  693. } else if (data.status == 0) {
  694. layer.msg(data.message);
  695. }
  696. }
  697. }
  698. );
  699. }
  700. //批量发送云印任务
  701. $("#selectPrint").click(function () {
  702. // 判断是否有选中
  703. if (!$("input[class='ace myselect']").is(':checked')) {
  704. layer.msg('至少选择一个目标!');
  705. return false;
  706. }
  707. var result = [];
  708. $(".myselect").each(function (m, n) {
  709. if ($(this).prop('checked')) {
  710. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  711. result.push($(this).val());
  712. }
  713. }
  714. });
  715. var saveDataAry = [];
  716. var data1 = [];
  717. for (i = 0; i < result.length; i++) {
  718. var weekId = result[i];
  719. data1 = {"ew_id": weekId};
  720. saveDataAry.push(data1);
  721. }
  722. $.ajax({
  723. type: "POST",
  724. url: "<?php echo $this->createUrl("printCloud/generateWriting");?>",
  725. dataType: "json",
  726. contentType: "application/json",
  727. data: JSON.stringify(saveDataAry),
  728. beforeSend: function () {
  729. layer.load(1, {
  730. shade: [0.1, '#fff'] //0.1透明度的白色背景
  731. });
  732. },
  733. success: function (data) {
  734. var index = layer.load();
  735. layer.close(index);
  736. if (data.status == 1) {
  737. $('#sendJson').attr('value', JSON.stringify(data));
  738. var con = '';
  739. var task_count = 0;
  740. var totalCount = 0;
  741. $.each(data.data, function (index, item) {
  742. var one_count = item.enable_download_count - item.download_count;
  743. totalCount += (one_count > 0 ? one_count : 0);
  744. if ((item.enable_download_count - item.download_count) > 0) {
  745. task_count += 1;
  746. }
  747. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  748. + item.generate_count + '/' + item.dredge_count + '/' + '<i style="color: green">' + item.enable_download_count + '</i><input type="hidden" name="drege_count" value="' + item.enable_download_count + '"></td><td>'
  749. + item.download_count + '</td><td>' + (one_count > 0 ? one_count : 0) + '</td><td>' + (one_count > 0 ? '可发送' : '不可发送')
  750. + '</td></tr>'
  751. });
  752. $('#task_count').html(task_count);
  753. $('#total_print_num').html(totalCount);
  754. $('#taskList').html(con);
  755. $('#filter-uploaded').prop("checked", true);
  756. $('.confirmbox-mask').show();
  757. } else if (data.status == 0) {
  758. layer.msg(data.message);
  759. }
  760. }
  761. }
  762. );
  763. });
  764. // 全选\反选
  765. $(".selectAll").click(function () {
  766. if ($(this).prop("checked")) {
  767. var s_obj = $(".myselect");
  768. var s_len = s_obj.length;
  769. for (var i = 0; i < s_len; i++) {
  770. if (!s_obj[i].disabled) {
  771. s_obj[i].checked = true;
  772. }
  773. }
  774. } else {
  775. $(".myselect").prop("checked", false);
  776. }
  777. });
  778. //过滤已下载学生
  779. $('#filter-uploaded').click(function () {
  780. if ($(this).is(':checked')) {
  781. var totalCount = 0;
  782. var task_count = 0;
  783. $('#taskList tr').each(function () {
  784. var enable_count = parseInt($(this).children("td:eq(3)").children('i').html());
  785. var dowanload_count = parseInt($(this).children("td:eq(4)").html());
  786. $(this).children("td:eq(5)").html((enable_count - dowanload_count) > 0 ? (enable_count - dowanload_count) : 0);
  787. totalCount += ((enable_count - dowanload_count) > 0 ? (enable_count - dowanload_count) : 0);
  788. if ((enable_count - dowanload_count) == 0) {
  789. $(this).children("td:eq(6)").html('不可发送');
  790. } else {
  791. $(this).children("td:eq(6)").html('可发送');
  792. task_count += 1;
  793. }
  794. });
  795. $('#task_count').html(task_count);
  796. $('#total_print_num').html(totalCount)
  797. } else {
  798. var totalCount = 0;
  799. var task_count = 0;
  800. $('#taskList tr').each(function () {
  801. var enable_count = $(this).children("td:eq(3)").children('i').html();
  802. $(this).children("td:eq(5)").html(enable_count);
  803. totalCount += parseInt(enable_count);
  804. if (enable_count == 0) {
  805. $(this).children("td:eq(6)").html('不可发送');
  806. } else {
  807. $(this).children("td:eq(6)").html('可发送');
  808. task_count += 1;
  809. }
  810. });
  811. $('#task_count').html(task_count);
  812. $('#total_print_num').html(totalCount);
  813. $('#filter-uploaded').attr('isFilter', 0)
  814. }
  815. });
  816. //发送云印任务(真正发送)
  817. $('#sendCloudPrint').click(function () {
  818. var task_count = parseInt($('#task_count').html());
  819. if (task_count === 0) {
  820. layer.msg('没有可发送的任务');
  821. return false;
  822. }
  823. var json_data = $('#sendJson').val();
  824. var is_filter = $('#filter-uploaded').is(':checked') ? 1 : 0;
  825. $.post({
  826. url: "<?php echo $this->createUrl("printCloud/sendWritingTask");?>",
  827. data: {
  828. 'json_data': json_data,
  829. 'is_filter': is_filter,
  830. },
  831. dataType: "json",
  832. beforeSend: function () {
  833. layer.load(1, {
  834. shade: [0.1, '#fff'] //0.1透明度的白色背景
  835. });
  836. },
  837. success: function (data) {
  838. var index = layer.load();
  839. layer.close(index);
  840. if (data.status == 1) {
  841. layer.msg('操作成功,请耐心等待后台打包');
  842. $('.confirmbox-mask').hide();
  843. location.reload();
  844. } else if (data.status == 0) {
  845. layer.msg(data.message);
  846. }
  847. }
  848. });
  849. });
  850. $('.confirmbox-mask .icon-close-1').click(function () {
  851. $('.confirmbox-mask').hide();
  852. });
  853. $('.confirmbox-mask .cancel').click(function () {
  854. $('.confirmbox-mask').hide();
  855. });
  856. //批量下载
  857. $("#batchPrint").click(function () {
  858. var message = "您确定要批量下载该产品吗?";
  859. // 判断是否有选中
  860. if (!$("input[class='ace myselect']").is(':checked')) {
  861. layer.msg('至少选择一个目标!');
  862. return false;
  863. }
  864. var result = [];
  865. $(".myselect").each(function (m, n) {
  866. if ($(this).prop('checked')) {
  867. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  868. result.push($(this).val());
  869. }
  870. }
  871. });
  872. var saveDataAry = [];
  873. var data1 = [];
  874. for (i = 0; i < result.length; i++) {
  875. var weekId = result[i];
  876. data1 = {"ew_id": weekId};
  877. saveDataAry.push(data1);
  878. }
  879. layer.msg(message, {
  880. time: 0,
  881. btn: ['确定', '取消'],
  882. yes: function (index) {
  883. layer.close(index);
  884. $.ajax({
  885. type: "POST",
  886. url: "<?php echo $this->createUrl('productdownload/batchWriting');?>",
  887. dataType: "json",
  888. contentType: "application/json",
  889. data: JSON.stringify(saveDataAry),
  890. success: function (data) {
  891. layer.closeAll();
  892. if (data.success == 1) {
  893. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  894. icon: 1,
  895. yes: function () {
  896. layer.closeAll();
  897. }
  898. });
  899. } else {
  900. layer.msg(data.message);
  901. }
  902. },
  903. });
  904. }
  905. });
  906. });
  907. //扫描在线答题卡
  908. function createTemplateScanOnline(exam_group_id, obj, exam_name, exam_id) {
  909. if ($(obj).hasClass('disabled')) {
  910. return false;
  911. }
  912. if (!exam_group_id) {
  913. layer.msg('未找到词汇宝组ID');
  914. }
  915. evaluationClient.NewScan(exam_group_id + "," + exam_name + "," + "001" + "," + exam_id);//TODO 考试id (ew_id)
  916. return false;
  917. }
  918. //确认上传
  919. function confirmUpload(weekId) {
  920. if (!weekId) {
  921. layer.msg("参数有误");
  922. return;
  923. }
  924. var message = "请先在【右上角>上传】页面内,确认学生上传(自动批阅)完毕。<br><br>确定答题卡完成上传吗?一旦确定后,后台开始生成已上传学生批改后的答题卡,且无法再进行扫描上传操作!";
  925. layer.msg(message, {
  926. time: 0,
  927. area: ["480px", "160px"],
  928. btn: ['确定', '取消'],
  929. yes: function (index) {
  930. layer.close(index);
  931. $.ajax({
  932. url: "<?php echo $this->createUrl('writing/confirmUpload');?>",
  933. type: "GET",
  934. dataType: "json",
  935. data: {"ew_id": weekId},
  936. success: function (data) {
  937. layer.closeAll();
  938. if (data.status == 1) {
  939. layer.msg('操作成功')
  940. location.reload();
  941. } else {
  942. layer.msg(data.message, {"time": 3000});
  943. }
  944. },
  945. });
  946. }
  947. });
  948. }
  949. //确认上传
  950. function resumeUpload(weekId) {
  951. if (!weekId) {
  952. layer.msg("参数有误");
  953. return;
  954. }
  955. var message = "确定恢复答题卡上传吗?";
  956. layer.msg(message, {
  957. time: 0,
  958. btn: ['确定', '取消'],
  959. yes: function (index) {
  960. layer.close(index);
  961. $.ajax({
  962. url: "<?php echo $this->createUrl('writing/resumeUpload');?>",
  963. type: "GET",
  964. dataType: "json",
  965. data: {"ew_id": weekId},
  966. success: function (data) {
  967. layer.closeAll();
  968. if (data.status == 1) {
  969. layer.msg('操作成功')
  970. location.reload();
  971. } else {
  972. layer.msg(data.message, {"time": 3000});
  973. }
  974. },
  975. });
  976. }
  977. });
  978. }
  979. function downloadCard(mwId) {
  980. if (!mwId) {
  981. layer.msg("打印参数有误");
  982. return;
  983. }
  984. var message = "您确定要下载该班级写作卡吗?";
  985. html = "" +
  986. '<div style="padding:20px 30px 0px 30px">' +
  987. '<div style="padding:8px 0;">请复制下方链接下载写作卡。</div>' +
  988. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>' +
  989. '<div class="row" style="margin:30px auto 0px auto;text-align:center"><button id="confirm" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;background:gray;border-color:gray;">关闭</button>' +
  990. '</div>' +
  991. '</div>' +
  992. "";
  993. layer.msg(message, {
  994. time: 0,
  995. btn: ['确定', '取消'],
  996. yes: function (index) {
  997. layer.close(index);
  998. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  999. startTime = (new Date()).getTime();
  1000. showTip = true;
  1001. tipShowed = false;
  1002. toPromptTime = 3000;
  1003. window.interval = setInterval(function () {
  1004. execTime = (new Date()).getTime() - startTime;
  1005. if (execTime > toPromptTime && showTip && !tipShowed) {
  1006. msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  1007. tipShowed = true;
  1008. }
  1009. }, 1000);
  1010. jQuery.get(
  1011. "<?php echo $this->createUrl("productdownload/getWritingCard");?>",
  1012. {"ew_id": mwId},
  1013. function (data) {
  1014. data = JSON.parse(data);
  1015. if (data.success == 1 || data.success == 2) {
  1016. layer.open({
  1017. type: 1,
  1018. area: ['550px', '220px'],
  1019. title: "下载写作卡",
  1020. content: html,
  1021. success: function (index, layerObj) {
  1022. clearInterval(window.interval);
  1023. msgIndex = layer.msg(data.limitinfo, {"time": 3000});
  1024. clearInterval(window.interval);
  1025. layer.close(msgIndex);
  1026. jQuery("#downloadUrl").html('下载地址:<span style=""><input id="url" type="text" size="40" readonly value="' + data.downloadPath + '" /></span><button id="copy" class="label-primary-s bth-s" style="padding:4px 12px;margin:5px 0 10px 15px;">全选</button>');
  1027. jQuery("#confirm, #cancel").on("click", function () {
  1028. layer.close(layerObj);
  1029. });
  1030. jQuery("#copy").on("click", function () {
  1031. jQuery("#url").select();
  1032. });
  1033. },
  1034. end: function () {
  1035. }
  1036. });
  1037. }
  1038. else if (data.success == 0) {
  1039. clearInterval(window.interval);
  1040. msgIndex = layer.msg(data.message, {"time": 3000});
  1041. }
  1042. }
  1043. );
  1044. }
  1045. });
  1046. }
  1047. function downExcel(ewId, classId) {
  1048. layer.msg('生成中,请稍后...', {time: 0, shade: 0.4})
  1049. location.href = "<?php echo $this->createUrl("writing/downExcel")?>?ewId=" + ewId + "&classId=" + classId;
  1050. layer.closeAll();
  1051. }
  1052. $(".page-go").click(function () {
  1053. var page = $("input[name='toPageNo']").val();
  1054. if (!isPositiveInteger(page)) {
  1055. layer.msg("请输入正确的页码");
  1056. return;
  1057. }
  1058. <?php
  1059. $urlParams = array();
  1060. if ($grade) $urlParams['grade'] = $grade;
  1061. if ($classId) $urlParams['classId'] = $grade;
  1062. if ($printName) $urlParams['name'] = $printName;
  1063. ?>
  1064. location.href = "<?php echo $this->createUrl('writing/index', $urlParams) . '/page/';?>" + page;
  1065. });
  1066. function isPositiveInteger(s) {//是否为正整数
  1067. var reg = /^[1-9]\d*$/;
  1068. return reg.test(s)
  1069. }
  1070. $('.tip-icon').mouseover(function () {
  1071. $('.magic-tips').show()
  1072. })
  1073. $('.tip-icon').mouseleave(function () {
  1074. $('.magic-tips').hide()
  1075. })
  1076. </script>