zentaomax.ui.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. $(document).off('click', '.importlib-btn').on('click', '.importlib-btn', function()
  2. {
  3. const $this = $(this);
  4. const dtable = zui.DTable.query($('#storyList'));
  5. const checkedList = dtable.$.getChecks();
  6. if(!checkedList.length) return;
  7. const postData = new FormData();
  8. checkedList.forEach((id) => postData.append('storyIdList[]', id));
  9. if($this.data('page') == 'batch')
  10. {
  11. postAndLoadPage($this.data('formaction'), postData);
  12. }
  13. else
  14. {
  15. $.ajaxSubmit({"url": $this.data('formaction'), "data": postData});
  16. }
  17. });
  18. window.renderCell = function(result, info)
  19. {
  20. if(info.col.name == 'title' && result)
  21. {
  22. const story = info.row.data;
  23. let html = '';
  24. let gradeLabel = '';
  25. if(showGrade || story.grade >= 2) gradeLabel = gradeGroup[story.type][story.grade]?.name;
  26. if(gradeLabel) html += "<span class='label gray-pale rounded-xl clip'>" + gradeLabel + "</span> ";
  27. if(story.color) result[0].props.style = 'color: ' + story.color;
  28. if(html) result.unshift({html});
  29. }
  30. return result;
  31. };
  32. window.changeLib = function(e)
  33. {
  34. const libID = $(e.target).val();
  35. const link = $.createLink('projectstory', 'importFromLib', 'projectID=' + projectID + '&productID=' + productID + '&libID=' + libID + '&storyType=' + storyType);
  36. loadPage(link);
  37. }