index.php 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221
  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: #0e8e54;
  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. .margin-right4 {
  241. margin-right: 4px;
  242. }
  243. </style>
  244. <script type="text/javascript">
  245. function in_array(search, array) {
  246. for (var i in array) {
  247. if (array[i] == search) {
  248. return true;
  249. }
  250. }
  251. return false;
  252. }
  253. testFlag = "<?php echo $this->testFlag;?>";
  254. customTplsIds = new Array();
  255. var i = 0;
  256. <?php foreach(Yii::app()->params["custom_tpls_ids"] as $tplId){?>
  257. customTplsIds[i] = "<?php echo $tplId;?>";
  258. i++;
  259. <?php }?>
  260. jQuery(document).ready(function () {
  261. // 根据年级筛选班级
  262. jQuery("#grade").change(function () {
  263. var grade = $(this).val();
  264. if (!grade) return false;
  265. jQuery.post(
  266. '<?php echo $this->createUrl("print/getGradeClass");?>', {"grade": grade}, function (data) {
  267. data = JSON.parse(data);
  268. if (data.success == 1) {
  269. var classObj = $("#class");
  270. var html = "<option value=''>全部班级</option>";
  271. classObj.empty();
  272. $.each(data.message, function (i, n) {
  273. html += "<option value='" + n.class_id + "'>" + n.class_name + "</option>";
  274. });
  275. classObj.append(html);
  276. }
  277. }
  278. );
  279. });
  280. });
  281. </script>
  282. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  283. <div class="main-content-inner">
  284. <!-- 导航栏开始-->
  285. <?php include(Yii::app()->basePath . '/views/layouts/view_production_navigation.php'); ?>
  286. <!-- 导航栏结束-->
  287. <div class="page-content">
  288. <div class="row" style="margin:0px;">
  289. <div class="col-xs-12">
  290. <!-- PAGE CONTENT BEGINS -->
  291. <div id="dynamic-table_wrapper" class="dataTables_wrapper form-inline no-footer">
  292. <div class="row" style="position: relative;">
  293. <form method="get" id="form1" action="<?php echo $this->createUrl("magic/index"); ?>">
  294. <div class="col-xs-12">
  295. <div class="dataTables_length margin-zy clearfix">
  296. <select class="form-control" id="grade" name="grade">
  297. <option value="">年级</option>
  298. <option value="1" <?php if ($grade == 1) echo "selected"; ?>>高一</option>
  299. <option value="2" <?php if ($grade == 2) echo "selected"; ?>>高二</option>
  300. <option value="3" <?php if ($grade == 3) echo "selected"; ?>>高三</option>
  301. </select>
  302. <select class="form-control" id="class" name="classId">
  303. <option value="">全部班级</option>
  304. <?php foreach ($classes as $class) { ?>
  305. <option <?php if ((string)$classId === (string)$class["class_id"]) echo "selected=selected"; ?>
  306. value="<?php echo $class["class_id"]; ?>"><?php echo $class["class_name"]; ?></option>
  307. <?php } ?>
  308. </select>
  309. <input type="text" class="form-control input-sm" placeholder="请输入打印任务名称" name="name"
  310. value="<?php echo $printName; ?>">
  311. <button class="label-primary-s bth-s" id="search" style="padding:4px 12px;">搜索
  312. </button>
  313. <span class="fr">
  314. <span class="magic-tips">
  315. <li>* 上传进度中,词汇宝只上传答题图片,无需参考原卷图片上传进度。</li>
  316. <li>* 只有本周和上周生成的检测卡支持扫描和自动批改。</li>
  317. <li>* 同一批次的检测卡,可以从任意班级的扫描入口上传。</li>
  318. <li>* 点击任务名称,可批量重置词汇宝内容。</li>
  319. </span>
  320. <span class="tip-icon"><img width="35" height="35" src="/images/tongzhi.png"></span>
  321. <span style="font-size:13px;padding-left:2px;color:red;margin-right: 10px;">温馨提示</span>
  322. <?php if ($isTrial): ?>
  323. <a href="<?php echo $this->createUrl("magic/setting", array('type' => 2)); ?>" class="btn-garder">生成词汇宝(新)</a>
  324. <?php endif; ?>
  325. <a href="<?php echo $this->createUrl("magic/setting"); ?>" class="btn-garder">生成词汇宝</a>
  326. <a id="selectPrint" href="javascript:void(0);" class="btn-garder">发送云印任务</a>
  327. <a id="batchPrint" href="javascript:void(0);" class="btn-garder">批量下载</a>
  328. <a id="batchPrintToolsChb" href="javascript:void(0);" class="btn-garder">批量打印</a>
  329. </span>
  330. </div>
  331. </div>
  332. </form>
  333. </div>
  334. <table id="dynamic-table"
  335. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
  336. style="font-size:12px">
  337. <thead>
  338. <tr>
  339. <th class="center">
  340. <input type="checkbox" class="ace selectAll"/>
  341. </th>
  342. <th>名称</th>
  343. <th>班级</th>
  344. <th>已生成/总数</th>
  345. <th>已批改/总数</th>
  346. <th>创建时间</th>
  347. <th>是否下载/打印</th>
  348. <th>下载/打印时间</th>
  349. <th>操作</th>
  350. </tr>
  351. </thead>
  352. <tbody>
  353. <?php if (!empty($printList)):foreach ($printList as $cl): ?>
  354. <tr>
  355. <td>
  356. <?php if (Yii::app()->cache->getValue("cloud_print_task_task_magic_word" . $cl['mw_id']) != 1) { ?>
  357. <input type="checkbox" class="ace myselect"
  358. value="<?php echo $cl['mw_id']; ?>">
  359. <?php } ?>
  360. </td>
  361. <?php $mwName = '词汇宝' . $cl['name'] . '第' . $cl['week_no'] . '次'; ?>
  362. <td>
  363. <a href="<?php echo $this->createUrl("magic/classes", array("mw_group_id" => $cl['mw_group_id'], "mw_name" => $mwName)); ?>"><?php echo $mwName; ?></a>
  364. </td>
  365. <td style="max-width:100px"><?php echo $cl['class_name']; ?></td>
  366. <td><?php echo $cl['pdfCount'] . '/' . $cl['totalCount']; ?></td>
  367. <td><?php echo $cl['markCount'] . '/' . $cl['totalCount']; ?></td>
  368. <td><?php echo date("Y-m-d H:i:s", $cl['create_time']); ?></td>
  369. <td><?php if ($cl['isDown']) {
  370. echo '已下载/打印';
  371. } else {
  372. echo '未下载/打印';
  373. } ?></td>
  374. <td><?php echo $cl['downTime']; ?></td>
  375. <td style="width:350px;">
  376. <span class="iconfont click-sc addbx printToolsChb" mwid="<?php echo (string)$cl['mw_id']; ?>" aria-hidden="true" title="打印词汇宝">&#xe6bb;</span>
  377. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载词汇宝"
  378. onclick="printWeek('<?php echo (string)$cl['mw_id']; ?>')"><img src="/images/download.png" style="margin-bottom:-4px;"></span>
  379. <span class="iconfont click-sc addbx" aria-hidden="true" title="选择学生下载词汇宝"
  380. onclick="javascript:location.href='<?php echo $this->createUrl('magic/stu', array('mw_id' => (string)$cl['mw_id'])); ?>'">&#xe668;</span>
  381. <span class="iconfont click-sc addbx margin-right4" <?php if (Yii::app()->cache->getValue("cloud_print_task_magic_word" . $cl['mw_id']) == 1) echo 'style="background-color:gray"'; ?>
  382. aria-hidden="true"
  383. title="<?php if (Yii::app()->cache->getValue("cloud_print_task_magic_word" . $cl['mw_id']) == 1) {
  384. echo '24小时内不可重复发送';
  385. } else {
  386. echo '发送云印任务';
  387. } ?>"
  388. onclick="sendCloudTask('<?php echo $cl['mw_id']; ?>',<?php echo Yii::app()->cache->getValue("cloud_print_task_magic_word" . $cl['mw_id']) == 1 ? 1 : 0; ?>)">云
  389. </span>
  390. <!-- 下载教师版按钮 -->
  391. <?php if ($cl['practice_type'] == 1): ?>
  392. <span class="fa fa-file-pdf-o click-sc addbx" style="padding:0.5px 8px"
  393. aria-hidden="true" title="下载词汇宝教师版"
  394. onclick="downPdfCHBTeacherPrint('<?php echo (string)$cl['mw_id']; ?>')"></span>
  395. <?php endif; ?>
  396. <!-- 扫描答题卡按钮 -->
  397. <?php if ($cl['marking_status'] == 0): ?>
  398. <span class="iconfont click-sc addbx" aria-hidden="true" title="扫描在线答题卡"
  399. onclick="createTemplateScanOnline('<?php echo $cl['mw_group_id']; ?>',this,'词汇宝',<?php echo $cl['scan_type']; ?>)">扫</span>
  400. <?php else: ?>
  401. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  402. title="扫描在线答题卡">扫</span>
  403. <?php endif; ?>
  404. <!-- 确认上传按钮 -->
  405. <?php if ($cl['marking_status'] == 0 && $cl['markCount'] > 0): ?>
  406. <span class="iconfont click-sc addbx" aria-hidden="true" title="确认全部批改完成"
  407. onclick="confirmUpload('<?php echo (string)$cl['mw_id']; ?>','<?php echo (string)$cl['mw_group_id']; ?>')">&#xe667;</span>
  408. <?php else: ?>
  409. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  410. title="确认全部批改完成">&#xe667;</span>
  411. <?php endif; ?>
  412. <!-- 恢复上传按钮 -->
  413. <?php if ($cl['marking_status'] == 1): ?>
  414. <span class="iconfont click-sc addbx" aria-hidden="true" title="恢复答题卡上传"
  415. onclick="resumeUpload('<?php echo (string)$cl['mw_id']; ?>')"><i
  416. class="fa fa-reply"></i></span>
  417. <?php else: ?>
  418. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  419. title="恢复答题卡上传"><i class="fa fa-reply"></i></span>
  420. <?php endif; ?>
  421. <!-- 下载批改后答题卡按钮 -->
  422. <?php if ($cl['marking_status'] == 1 && $cl['is_marking_all_html'] == 1 && $cl['is_card_complete']): ?>
  423. <span mwid="<?php echo (string)$cl['mw_id']; ?>" class="iconfont click-sc addbx printToolsCorrect" aria-hidden="true" title="下载批改后答题卡"
  424. >&#xe665;</span>
  425. <?php else: ?>
  426. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  427. title="下载批改后答题卡">&#xe665;</span>
  428. <?php endif; ?>
  429. <!-- 下载批改后统计excel -->
  430. <?php if ($cl['marking_status'] == 1 && $cl['is_marking_all_html'] == 1): ?>
  431. <span class="iconfont click-sc addbx" aria-hidden="true" title="下载批改后统计excel"
  432. onclick="downExcel('<?php echo (string)$cl['mw_id']; ?>','<?php echo (string)$cl['class_id']; ?>')"><img
  433. width="18" height="25" src="/images/magic_word/tongji.svg"></span>
  434. <?php else: ?>
  435. <span class="iconfont click-sc addbx disable-btn" aria-hidden="true"
  436. title="下载批改后统计excel"><img width="18" height="25"
  437. src="/images/magic_word/tongji.svg"></span>
  438. <?php endif; ?>
  439. </td>
  440. </tr>
  441. <?php endforeach; else: ?>
  442. <tr>
  443. <td colspan="8">暂无数据!</td>
  444. </tr>
  445. <?php endif; ?>
  446. </tbody>
  447. </table>
  448. <?php if (!empty($page_total)): ?>
  449. <div class="row">
  450. <div class="col-xs-6">
  451. &nbsp;
  452. </div>
  453. <div class="col-xs-6">
  454. <div class="dataTables_paginate paging_simple_numbers">
  455. <?php
  456. $this->widget('CLinkPager', array(
  457. 'header' => '',
  458. 'firstPageLabel' => '首页',
  459. 'lastPageLabel' => '末页',
  460. 'prevPageLabel' => '上一页',
  461. 'nextPageLabel' => '下一页',
  462. 'pages' => $pages,
  463. 'maxButtonCount' => 5,
  464. ));
  465. echo '共:' . $page_total . '条';
  466. ?>
  467. <?php if ($pages->pagesCount > 1): ?>
  468. <span><input class="input-page-no" name="toPageNo" type="text" placeholder="页码"></span>
  469. <span class="page-go">Go</span>
  470. <?php endif; ?>
  471. </div>
  472. </div>
  473. </div>
  474. <?php endif; ?>
  475. </div>
  476. <!--上传模板弹窗-->
  477. <!--发送云印任务弹窗-->
  478. <div class="confirmbox-mask" id="classModal-1" style="display: none;">
  479. <div class="class-modal-1">
  480. <i class="icon icon-close-1" style="color: white">X</i>
  481. <div class="class-modal-head-1">发送云印任务</div>
  482. <div class="class-modal-body-1">
  483. <div>
  484. <span>亲爱的学管:您正在发起云印任务,请核对以下云印任务数据!</span>
  485. <span style="float: right;">共<i id="task_count">0</i>条任务,<i id="total_print_num">0</i>份云印任务</span>
  486. </div>
  487. <table style="margin-top: 15px;"
  488. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable">
  489. <thead>
  490. <tr>
  491. <th>序号</th>
  492. <th>任务名称</th>
  493. <th>班级</th>
  494. <th>已生成/已开通/可下载</th>
  495. <th>已下载</th>
  496. <th>云印份数</th>
  497. <th>备注</th>
  498. </tr>
  499. </thead>
  500. <tbody id="taskList">
  501. </tbody>
  502. </table>
  503. <div style="margin-top: 40px;">
  504. <span><img width="20px" height="20px" src="/images/icon-tip.svg">发送后,请至学管端【IMS-云印任务】模块查看任务进程,请等待云印中心打印后,寄回给学校!</span>
  505. <span style="margin-left:15px;float: right;"><input id="filter-uploaded"
  506. checked="checked" type="checkbox">过滤【已下载】的学生</span>
  507. </div>
  508. <div class="btn_area" style="text-align: center;">
  509. <input type="hidden" id="sendJson" name="sendJson" value="">
  510. <button id="sendCloudPrint" class="download">发送</button>
  511. <button class="cancel">取消</button>
  512. </div>
  513. </div>
  514. </div>
  515. </div>
  516. <!-- PAGE CONTENT ENDS -->
  517. </div>
  518. </div>
  519. </div>
  520. </div>
  521. <?php include(Yii::app()->basePath.'/views/print/_print.php');?>
  522. <script src="/js/jquery.ajaxfileupload.js"></script>
  523. <script type="text/javascript">
  524. $(document).ready(function () {
  525. });
  526. function downpdf(weekId) {
  527. layer.msg('生成中,请稍后...', {time: 0, shade: 0.4})
  528. location.href = "<?php echo $this->createUrl("magic/teacherWeek")?>?mwId=" + weekId;
  529. layer.closeAll();
  530. }
  531. function objToJson(obj) {
  532. var json = "{ ";
  533. for (var item in obj) {
  534. json += "'" + item + "':'" + obj[item] + "',";
  535. }
  536. json += " }";
  537. return json;
  538. }
  539. function ccc() {
  540. layer.msg('敬请期待!', {
  541. time: 0,
  542. btn: ['确定', '取消'],
  543. yes: function (index) {
  544. layer.close(index);
  545. return false;
  546. }
  547. });
  548. }
  549. // 搜索事件
  550. $("#search").click(function () {
  551. $("#form1").submit();
  552. });
  553. function printWeek(weekId) {
  554. if (!weekId) {
  555. layer.msg("打印参数有误");
  556. return;
  557. }
  558. var message = "您确定要下载该班级词汇宝吗?";
  559. var divTitle = '下载词汇宝';
  560. var objUrl = '';
  561. html = "" +
  562. '<div style="padding:20px 30px 0px 30px">' +
  563. '<div style="padding:8px 0;">请复制下方链接下载词汇宝。</div>' +
  564. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>' +
  565. '<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>' +
  566. '</div>' +
  567. '</div>' +
  568. "";
  569. layer.msg(message, {
  570. time: 0,
  571. btn: ['确定', '取消'],
  572. yes: function (index) {
  573. layer.close(index);
  574. $.ajax({
  575. url: "<?php echo $this->createUrl('productdownload/getMagicWordFile');?>",
  576. type: "GET",
  577. dataType: "json",
  578. title: divTitle,
  579. data: {"mw_id": weekId},
  580. timeout: <?php echo Yii::app()->params["product_download_time_limit"];?>,
  581. beforeSend: function () {
  582. layer.msg("下载中请稍后...", {"time": <?php echo Yii::app()->params["product_download_time_limit"];?>});
  583. },
  584. error: function (jqXHR, textStatus, errorThrown) {
  585. layer.closeAll();
  586. if (textStatus == "timeout") {
  587. $.ajax({
  588. type: 'GET',
  589. url: "<?php echo $this->createUrl("productdownload/addMagicWordTask");?>",
  590. data: {"mw_id": weekId},
  591. dataType: "json",
  592. success: function (data) {
  593. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  594. icon: 1,
  595. yes: function () {
  596. layer.closeAll();
  597. }
  598. });
  599. }
  600. })
  601. } else {
  602. layer.msg('返回失败!', {
  603. icon: 5
  604. }, function () {
  605. layer.closeAll();
  606. });
  607. }
  608. },
  609. success: function (data) {
  610. layer.closeAll();
  611. if (data.success == 1 || data.success == 2) {
  612. layer.open({
  613. type: 1,
  614. area: ['550px', '220px'],
  615. title: divTitle,
  616. content: html,
  617. success: function (index, layerObj) {
  618. 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>');
  619. jQuery("#confirm, #cancel").on("click", function () {
  620. layer.close(layerObj);
  621. });
  622. jQuery("#copy").on("click", function () {
  623. jQuery("#url").select();
  624. });
  625. },
  626. end: function () {
  627. }
  628. });
  629. } else if (data.success == 3) {
  630. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  631. icon: 1,
  632. yes: function () {
  633. layer.closeAll();
  634. }
  635. });
  636. } else if (data.success == 0) {
  637. layer.msg(data.message, {"time": 3000});
  638. }
  639. },
  640. });
  641. }
  642. });
  643. }
  644. //发送云印任务
  645. function sendCloudTask(weekId, isDisable) {
  646. if (isDisable === 1) {
  647. return false;
  648. }
  649. //$('.confirmbox-mask').show();return false;
  650. if (!weekId) {
  651. layer.msg("参数有误");
  652. return;
  653. }
  654. var saveDataAry = [];
  655. var data1 = {"mw_id": weekId};
  656. saveDataAry.push(data1);
  657. $.ajax({
  658. type: "POST",
  659. url: "<?php echo $this->createUrl("printCloud/generateMagicWord");?>",
  660. dataType: "json",
  661. contentType: "application/json",
  662. data: JSON.stringify(saveDataAry),
  663. beforeSend: function () {
  664. layer.load(1, {
  665. shade: [0.1, '#fff'] //0.1透明度的白色背景
  666. });
  667. },
  668. success: function (data) {
  669. var index = layer.load();
  670. layer.close(index);
  671. if (data.status == 1) {
  672. $('#sendJson').attr('value', JSON.stringify(data));
  673. var con = '';
  674. var task_count = 0;
  675. var totalCount = 0;
  676. $.each(data.data, function (index, item) {
  677. var one_count = item.enable_download_count - item.download_count;
  678. totalCount += (one_count > 0 ? one_count : 0);
  679. if ((item.enable_download_count - item.download_count) > 0) {
  680. task_count += 1;
  681. }
  682. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  683. + 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>'
  684. + item.download_count + '</td><td>' + (one_count > 0 ? one_count : 0) + '</td><td>' + (one_count > 0 ? '可发送' : '不可发送')
  685. + '</td></tr>'
  686. });
  687. $('#task_count').html(task_count);
  688. $('#total_print_num').html(totalCount);
  689. $('#taskList').html(con);
  690. $('#filter-uploaded').prop("checked", true)
  691. $('.confirmbox-mask').show();
  692. } else if (data.status == 0) {
  693. layer.msg(data.message);
  694. }
  695. }
  696. }
  697. );
  698. }
  699. $(document).on('click', '.is-card', function (e) {
  700. var is_card = $(this).is(':checked') ? 1 : 0;
  701. var index = parseInt($(this).attr('data-index'));
  702. var sendJson = $('#sendJson').attr('value');
  703. var sendData = JSON.parse(sendJson);
  704. for (var i = 0; i < sendData.data.length; i++) {
  705. if (i == index) {
  706. sendData.data[i].is_card = is_card;
  707. }
  708. }
  709. $('#sendJson').attr('value', JSON.stringify(sendData));
  710. })
  711. //批量发送云印任务
  712. $("#selectPrint").click(function () {
  713. // 判断是否有选中
  714. if (!$("input[class='ace myselect']").is(':checked')) {
  715. layer.msg('至少选择一个目标!');
  716. return false;
  717. }
  718. var result = [];
  719. $(".myselect").each(function (m, n) {
  720. if ($(this).prop('checked')) {
  721. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  722. result.push($(this).val());
  723. }
  724. }
  725. });
  726. var saveDataAry = [];
  727. var data1 = [];
  728. for (i = 0; i < result.length; i++) {
  729. var weekId = result[i];
  730. data1 = {"mw_id": weekId};
  731. saveDataAry.push(data1);
  732. }
  733. $.ajax({
  734. type: "POST",
  735. url: "<?php echo $this->createUrl("printCloud/generateMagicWord");?>",
  736. dataType: "json",
  737. contentType: "application/json",
  738. data: JSON.stringify(saveDataAry),
  739. beforeSend: function () {
  740. layer.load(1, {
  741. shade: [0.1, '#fff'] //0.1透明度的白色背景
  742. });
  743. },
  744. success: function (data) {
  745. var index = layer.load();
  746. layer.close(index);
  747. if (data.status == 1) {
  748. $('#sendJson').attr('value', JSON.stringify(data));
  749. var con = '';
  750. var task_count = 0;
  751. var totalCount = 0;
  752. $.each(data.data, function (index, item) {
  753. var one_count = item.enable_download_count - item.download_count;
  754. totalCount += (one_count > 0 ? one_count : 0);
  755. if ((item.enable_download_count - item.download_count) > 0) {
  756. task_count += 1;
  757. }
  758. con += '<tr><td>' + (index + 1) + '</td><td>' + item.taskName + '</td><td>' + item.clazzName + '</td><td>'
  759. + 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>'
  760. + item.download_count + '</td><td>' + (one_count > 0 ? one_count : 0) + '</td><td>' + (one_count > 0 ? '可发送' : '不可发送')
  761. + '</td></tr>'
  762. });
  763. $('#task_count').html(task_count);
  764. $('#total_print_num').html(totalCount);
  765. $('#taskList').html(con);
  766. $('#filter-uploaded').prop("checked", true);
  767. $('.confirmbox-mask').show();
  768. } else if (data.status == 0) {
  769. layer.msg(data.message);
  770. }
  771. }
  772. }
  773. );
  774. });
  775. // 全选\反选
  776. $(".selectAll").click(function () {
  777. if ($(this).prop("checked")) {
  778. var s_obj = $(".myselect");
  779. var s_len = s_obj.length;
  780. for (var i = 0; i < s_len; i++) {
  781. if (!s_obj[i].disabled) {
  782. s_obj[i].checked = true;
  783. }
  784. }
  785. } else {
  786. $(".myselect").prop("checked", false);
  787. }
  788. });
  789. //过滤已下载学生
  790. $('#filter-uploaded').click(function () {
  791. if ($(this).is(':checked')) {
  792. var totalCount = 0;
  793. var task_count = 0;
  794. $('#taskList tr').each(function () {
  795. var enable_count = parseInt($(this).children("td:eq(3)").children('i').html());
  796. var dowanload_count = parseInt($(this).children("td:eq(4)").html());
  797. $(this).children("td:eq(5)").html((enable_count - dowanload_count) > 0 ? (enable_count - dowanload_count) : 0);
  798. totalCount += ((enable_count - dowanload_count) > 0 ? (enable_count - dowanload_count) : 0);
  799. if ((enable_count - dowanload_count) == 0) {
  800. $(this).children("td:eq(6)").html('不可发送');
  801. } else {
  802. $(this).children("td:eq(6)").html('可发送');
  803. task_count += 1;
  804. }
  805. });
  806. $('#task_count').html(task_count);
  807. $('#total_print_num').html(totalCount)
  808. } else {
  809. var totalCount = 0;
  810. var task_count = 0;
  811. $('#taskList tr').each(function () {
  812. var enable_count = $(this).children("td:eq(3)").children('i').html();
  813. $(this).children("td:eq(5)").html(enable_count);
  814. totalCount += parseInt(enable_count);
  815. if (enable_count == 0) {
  816. $(this).children("td:eq(6)").html('不可发送');
  817. } else {
  818. $(this).children("td:eq(6)").html('可发送');
  819. task_count += 1;
  820. }
  821. });
  822. $('#task_count').html(task_count);
  823. $('#total_print_num').html(totalCount);
  824. $('#filter-uploaded').attr('isFilter', 0)
  825. }
  826. });
  827. //发送云印任务(真正发送)
  828. $('#sendCloudPrint').click(function () {
  829. var task_count = parseInt($('#task_count').html());
  830. if (task_count === 0) {
  831. layer.msg('没有可发送的任务');
  832. return false;
  833. }
  834. var json_data = $('#sendJson').val();
  835. var is_filter = $('#filter-uploaded').is(':checked') ? 1 : 0;
  836. $.post({
  837. url: "<?php echo $this->createUrl("printCloud/sendMagicWordTask");?>",
  838. data: {
  839. 'json_data': json_data,
  840. 'is_filter': is_filter,
  841. },
  842. dataType: "json",
  843. beforeSend: function () {
  844. layer.load(1, {
  845. shade: [0.1, '#fff'] //0.1透明度的白色背景
  846. });
  847. },
  848. success: function (data) {
  849. var index = layer.load();
  850. layer.close(index);
  851. if (data.status == 1) {
  852. layer.msg('操作成功,请耐心等待后台打包');
  853. $('.confirmbox-mask').hide();
  854. location.reload();
  855. } else if (data.status == 0) {
  856. layer.msg(data.message);
  857. }
  858. }
  859. });
  860. });
  861. $('.confirmbox-mask .icon-close-1').click(function () {
  862. $('.confirmbox-mask').hide();
  863. });
  864. $('.confirmbox-mask .cancel').click(function () {
  865. $('.confirmbox-mask').hide();
  866. });
  867. //批量下载
  868. $("#batchPrint").click(function () {
  869. var message = "您确定要批量下载该产品吗?";
  870. // 判断是否有选中
  871. if (!$("input[class='ace myselect']").is(':checked')) {
  872. layer.msg('至少选择一个目标!');
  873. return false;
  874. }
  875. var result = [];
  876. $(".myselect").each(function (m, n) {
  877. if ($(this).prop('checked')) {
  878. if ($(this).val() /*&& $(this).attr("stnm")*/) {
  879. result.push($(this).val());
  880. }
  881. }
  882. });
  883. var saveDataAry = [];
  884. var data1 = [];
  885. for (i = 0; i < result.length; i++) {
  886. var weekId = result[i];
  887. data1 = {"mw_id": weekId};
  888. saveDataAry.push(data1);
  889. }
  890. layer.msg(message, {
  891. time: 0,
  892. btn: ['确定', '取消'],
  893. yes: function (index) {
  894. layer.close(index);
  895. $.ajax({
  896. type: "POST",
  897. url: "<?php echo $this->createUrl('productdownload/batchMagicWord');?>",
  898. dataType: "json",
  899. contentType: "application/json",
  900. data: JSON.stringify(saveDataAry),
  901. success: function (data) {
  902. layer.closeAll();
  903. if (data.success == 1) {
  904. layer.alert('文件正在打包,请去右上角“下载”窗口获取下载链接!', {
  905. icon: 1,
  906. yes: function () {
  907. layer.closeAll();
  908. }
  909. });
  910. } else {
  911. layer.msg(data.message);
  912. }
  913. },
  914. });
  915. }
  916. });
  917. });
  918. //扫描在线答题卡
  919. function createTemplateScanOnline(exam_group_id, obj, exam_name, scan_type) {
  920. if ($(obj).hasClass('disabled')) {
  921. return false;
  922. }
  923. if (!exam_group_id) {
  924. layer.msg('未找到词汇宝组ID');
  925. }
  926. var flag = scan_type == 1 ? 0 : '002';
  927. evaluationClient.NewScan(exam_group_id + "," + exam_name + "," + flag);
  928. return false;
  929. }
  930. //确认上传
  931. function confirmUpload(weekId, mwGroupId) {
  932. if (!weekId || !mwGroupId) {
  933. layer.msg("参数有误");
  934. return;
  935. }
  936. var message = "请先在【右上角>上传】页面内,确认学生上传(自动批阅)完毕。<br><br>确定答题卡完成上传吗?一旦确定后,后台开始生成已上传学生批改后的答题卡,且无法再进行扫描上传操作!";
  937. layer.msg(message, {
  938. time: 0,
  939. area: ["480px", "160px"],
  940. btn: ['确定', '取消'],
  941. yes: function (index) {
  942. layer.close(index);
  943. $.ajax({
  944. url: "<?php echo $this->createUrl('magic/confirmUpload');?>",
  945. type: "GET",
  946. dataType: "json",
  947. data: {"mw_id": weekId, mw_group_id: mwGroupId},
  948. success: function (data) {
  949. layer.closeAll();
  950. if (data.status == 1) {
  951. layer.msg('操作成功')
  952. location.reload();
  953. } else {
  954. layer.msg(data.message, {"time": 3000});
  955. }
  956. },
  957. });
  958. }
  959. });
  960. }
  961. //确认上传
  962. function resumeUpload(weekId) {
  963. if (!weekId) {
  964. layer.msg("参数有误");
  965. return;
  966. }
  967. var message = "确定恢复答题卡上传吗?";
  968. layer.msg(message, {
  969. time: 0,
  970. btn: ['确定', '取消'],
  971. yes: function (index) {
  972. layer.close(index);
  973. $.ajax({
  974. url: "<?php echo $this->createUrl('magic/resumeUpload');?>",
  975. type: "GET",
  976. dataType: "json",
  977. data: {"mw_id": weekId},
  978. success: function (data) {
  979. layer.closeAll();
  980. if (data.status == 1) {
  981. layer.msg('操作成功')
  982. location.reload();
  983. } else {
  984. layer.msg(data.message, {"time": 3000});
  985. }
  986. },
  987. });
  988. }
  989. });
  990. }
  991. function downloadCard(mwId) {
  992. if (!mwId) {
  993. layer.msg("打印参数有误");
  994. return;
  995. }
  996. var message = "您确定要下载该班级检测卡吗?";
  997. html = "" +
  998. '<div style="padding:20px 30px 0px 30px">' +
  999. '<div style="padding:8px 0;">请复制下方链接下载词汇宝检测卡。</div>' +
  1000. '<div id="downloadUrl" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:455px;"></div>' +
  1001. '<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>' +
  1002. '</div>' +
  1003. '</div>' +
  1004. "";
  1005. layer.msg(message, {
  1006. time: 0,
  1007. btn: ['确定', '取消'],
  1008. yes: function (index) {
  1009. layer.close(index);
  1010. msgIndex = layer.msg("下载中请稍后...", {"time": 3600000});
  1011. startTime = (new Date()).getTime();
  1012. showTip = true;
  1013. tipShowed = false;
  1014. toPromptTime = 3000;
  1015. window.interval = setInterval(function () {
  1016. execTime = (new Date()).getTime() - startTime;
  1017. if (execTime > toPromptTime && showTip && !tipShowed) {
  1018. msgIndex = layer.msg("该文件较大,请耐心等待...", {"time": 3600000});
  1019. tipShowed = true;
  1020. }
  1021. }, 1000);
  1022. jQuery.get(
  1023. "<?php echo $this->createUrl("productdownload/getMagicWordCard");?>",
  1024. {"mw_id": mwId},
  1025. function (data) {
  1026. data = JSON.parse(data);
  1027. if (data.success == 1 || data.success == 2) {
  1028. layer.open({
  1029. type: 1,
  1030. area: ['550px', '220px'],
  1031. title: "下载检测卡",
  1032. content: html,
  1033. success: function (index, layerObj) {
  1034. clearInterval(window.interval);
  1035. msgIndex = layer.msg(data.limitinfo, {"time": 3000});
  1036. clearInterval(window.interval);
  1037. layer.close(msgIndex);
  1038. 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>');
  1039. jQuery("#confirm, #cancel").on("click", function () {
  1040. layer.close(layerObj);
  1041. });
  1042. jQuery("#copy").on("click", function () {
  1043. jQuery("#url").select();
  1044. });
  1045. },
  1046. end: function () {
  1047. }
  1048. });
  1049. }
  1050. else if (data.success == 0) {
  1051. clearInterval(window.interval);
  1052. msgIndex = layer.msg(data.message, {"time": 3000});
  1053. }
  1054. }
  1055. );
  1056. }
  1057. });
  1058. }
  1059. function downExcel(mwId, classId) {
  1060. layer.msg('生成中,请稍后...', {time: 0, shade: 0.4})
  1061. location.href = "<?php echo $this->createUrl("magic/downExcel")?>?mwId=" + mwId + "&classId=" + classId;
  1062. layer.closeAll();
  1063. }
  1064. $(".page-go").click(function () {
  1065. var page = $("input[name='toPageNo']").val();
  1066. if (!isPositiveInteger(page)) {
  1067. layer.msg("请输入正确的页码");
  1068. return;
  1069. }
  1070. <?php
  1071. $urlParams = array();
  1072. if ($grade) $urlParams['grade'] = $grade;
  1073. if ($classId) $urlParams['classId'] = $grade;
  1074. if ($printName) $urlParams['name'] = $printName;
  1075. ?>
  1076. location.href = "<?php echo $this->createUrl('magic/index', $urlParams) . '/page/';?>" + page;
  1077. });
  1078. function isPositiveInteger(s) {//是否为正整数
  1079. var reg = /^[1-9]\d*$/;
  1080. return reg.test(s)
  1081. }
  1082. $('.tip-icon').mouseover(function () {
  1083. $('.magic-tips').show()
  1084. })
  1085. $('.tip-icon').mouseleave(function () {
  1086. $('.magic-tips').hide()
  1087. })
  1088. </script>