123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653 |
- const $ = require('jquery');
- require("../css/abnormal.less");
- require('./modal.js');
- const {api} = require('./api.js')
- const {post,getCookie,getLocal,emptyBox,initScroll} = require('./utils.js')
- require('./../resource/jquery-ui/jquery-ui.min.js');
- require('./../resource/jquery-ui/jquery-ui.min.css');
- const iconCheck= require("./../images/icon_check.png")
- const iconUnCheck = require("./../images/icon_unchecked.png")
- const iconCalenBlue= require("./../images/icon_calen_blue.png")
- const iconCalenGrey= require("./../images/icon_calen_grey.png")
- const iconDown= require("./../images/arrow_down.png")
- const iconUp = require("./../images/arrow_up.png")
- const loadingImg = require("./../images/loading.gif")
- const arrowLeft= require("./../images/arrow_left.png")
- const arrowRight = require("./../images/arrow_right.png")
- $(".selectLevel").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
- $(".selectDept").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
- let tabList = [], name = "", behospitalCode="", behosDateStart="", level="",behosDateEnd="", scoreSum = 0,statisticsType=2,
- nameTemp = "", behospitalCodeTemp="",levelTemp="", deptId="",deptIdTemp="", doctorName="", doctorNum="",doctorNameTemp="",doctorNumTemp="",
- data_desc=[],data_asc=[];
- $('.datapickerBox').append(`<img class="iconCalen" src=${iconCalenGrey} />`)
- $('.iconCalen').on("mouseenter", function(e){
- $(this).attr("src", iconCalenBlue)
- })
- $('.iconCalen').on("mouseleave", function(e){
- $(this).attr("src", iconCalenGrey)
- })
- $('.iconCalen').on("click", function(e){
- $(this).parent().find("input").focus()
- })
- $('.recordScoreBtn').css("opacity",hasData('FUNC000017')?'1':'0.5')
- dateChange()
- //所有数据切换日期筛选
- function dateChange(){
- $(".monthYear .mon").click(function(){
- $(this).css({
- backgroundColor:'#00A1FF',
- color:'#fff'
- }).siblings().css({
- color:'#00A1FF',
- backgroundColor:'#fff'
- })
- statisticsType = 1
- getTabData(1)
- })
- $(".monthYear .year").click(function(){
- $(this).css({
- backgroundColor:'#00A1FF',
- color:'#fff'
- }).siblings().css({
- color:'#00A1FF',
- backgroundColor:'#fff'
- })
- statisticsType = 2
- getTabData(1)
- })
- }
- $(".abnormalClear").click(function(){
- behospitalCode = behospitalCodeTemp=""
- deptId = deptIdTemp = ""
- level = levelTemp = ""
- $(".patientNumInp").val("")
- $(".selectDept").html("全部").attr({
- "data-id":"",
- "title":"全部"
- }).append(`<img class="arrow" src=${iconDown} alt="下拉">`)
- $(".selectLevel").html("全部").attr({
- "data-id":"",
- "title":"全部"
- }).append(`<img class="arrow" src=${iconDown} alt="下拉">`)
- getTabData(1)
- })
- //YH-YCSJJK
- $(".menu .page", parent.document).removeClass("active")
- $(parent.document).find(".menu .page[code=YH-YCSJJK]").addClass("active")
- //判断有无某一权限
- function hasData(data){
- let trdObj = JSON.parse(getLocal("trdObj"))
- let lis = trdObj['YH-BLZK-ZKPF']
- if(!lis){
- return false
- }
- if(lis.indexOf(data)>-1){//有权限
- return true
- }
- return false;
- }
- function getTabData(activePage){
- const param = {
- current:activePage,
- size: 15,
- behospitalCode: behospitalCode||"",//病历号
- type: deptId||"",//(1:数据模块 2:质控类型 3:XML结构)
- status: level||"",//(0:未处理,1:已处理)
- statisticsType: statisticsType||2, //1-本月,2-本年
- }
- $('.pagination').html("")
- $('.tbody').html(emptyBox('努力加载中...','',1))
- post(api.getQcAnnormal,param).then(res =>{
- if(res.data.code == '0'){
- const data = res.data.data;
- tabList = data.records;
- const totalPage = data.pages;
- const totalNum = data.total;
- renderTab(tabList,data.hospitalId,activePage);
- renderPagination(totalPage,Number(activePage),totalNum)
- if(totalPage > 1){
- renderPagination(totalPage,Number(activePage),totalNum)
- } else{
- $('.pagination').html("")
- }
- }else{
- $.alerModal({"message":res.data.msg,type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
- }
- }).catch((e) =>{
-
- })
- }
- getTabData(1)
- $(".filter").on("click", function(e){
- name = nameTemp
- behospitalCode = behospitalCodeTemp
- level = levelTemp
- deptId = deptIdTemp
- getTabData(1)
- })
- function renderTab(data,hisId,activePage){
- let str = ``
- for(let i = 0; i < data.length; i++){
- const item = data[i]
- str += `
- <tr data-index=${i}>
- <td class="textCenter">${(activePage-1)*15 + i+1}</td>
- <td>${item.gmtCreate || "-"}</td>
- <td>${item.behospitalCode || "-"}</td>
- <td >${item.typeName || "-"}</td>
- <td>${item.description || "-"}</td>
- <td>${item.statusName || "-"}</td>
- <td style="width: 200px;">${item.remark || "-"}</td>
- <td class="textCenter">
- <span data-index="${i}" style="opacity:${item.type==1&&item.description==''?'0.4':'1'};cursor:${item.type==1&&item.description==''?'no-drop':'pointer'};" data-type="1" data-des="${item.description}" data-mol="${item.type}" class="patientNameSpan">修改</span>
- <span data-index="${i}" data-type="2" class="patientNameSpan patientNameSpans">删除</span>
- </td>
- </tr>
- `
- }
- $('.tbody').html(str?str:emptyBox())
- bindScoreDetail(hisId)
- // initScroll("abnormal","YX",1)
- }
- function getQcAnnormalMode(item,type,mol,des){
- console.log(type)
- post(api.getQcAnnormalMode,{'description':des}).then(res =>{
- if(res.data.code == '0'){
- const data = res.data.data;
- let tmpName=data.modeMame||'暂无'
- let tmpid=data.modeId||''
- let str = '',stic=`<li data-id="" title="" class="ellipsis">暂无</li>`;
- for(let i = 0;i < data.qcModeDatas.length;i++){
- let tmp = data.qcModeDatas[i]
- str += `<li data-id="${tmp.id}" title="${tmp.name}" class="ellipsis">${tmp.name}</li>`
- }
- midifyMsgBox(item,type,mol,des,stic+str,tmpName,tmpid)
- }else{
- console.log(res)
- }
- }).catch((err) =>{
- console.log(err,11111)
- })
- }
- function scoreDetail(id,age,hid,code){
- window.open(`./qcScore.html?id=${id}&age=${age}&hid=${hid}&code=${code}`)
- }
- function bindScoreDetail(hisId){
- $('.patientNameSpan').on('click',function(e){
- const index = $(this).attr("data-index")
- const type = $(this).attr("data-type")
- const mol = $(this).attr("data-mol")
- const des = $(this).attr("data-des")||''
- const item = tabList[index]
- console.log(item.type,item.description)
- if(type==1&&item.type==1&&item.description==''){
- return
- }
- if(mol&&mol == 1&&des){
- getQcAnnormalMode(item,type,mol,des)
- }else{
- midifyMsgBox(item,type,mol,des)
- }
- })
- }
- function midifyMsgBox(item,type,mol,des,str,name,id){
- const itemCopy = JSON.parse(JSON.stringify(item))
- let msgBox = ''
- if(type == 1){//修改(数据模块/其他)
- if(mol&&mol==1){
- msgBox = `<div class="midifyMsgBox">
- <div class="mask"></div>
- <div class="midifyMsgContent abnormal remidifyMsgContent clearfix">
- <p class="midifyMsgTitle">修改 <img class="iconClose" src=${require('./../images/icon_close_default.png')} alt="关闭" /></p>
- <div class="itemMsgInfoBox disL">
- <span class="itemMsgLab abnormalLeft">文书名称:</span>
- <span class="abnormalAlls">${des}</span>
- </div>
- <img class="fl neck" src="${require('../images/neck.png')}">
- <div class="itemMsgInfoBox disR">
- <span class="itemMsgLab abnormalLeft">数据模块:</span>
- <span class="abnormalAll" data-id="${id}" title="${name}">${name}<img class="arrow" src=${iconDown} alt="下拉"></span>
- <ul class="abnormalStatusLis">
- ${str}
- </ul>
- </div>
- <div style="clear:both"></div>
- <div class="itemMsgInfoBox disT">
- <span class="itemMsgLab abnormalLeft abnormalMark abnormalMarkL">备注:</span>
- <div class="itemInfoRight">
- <textarea class="abnormalTxt abnormalTxtS" placeholder="请输入内容" >${itemCopy.remark}</textarea>
- </div>
- </div>
- <div class="itemMsgInfoTips">支持≥0的数字输入,最多保留小数点后1位~</div>
- <div class="midifyMsgBtn abnormalBtn">
- <span class="midifyEdit">保存</span>
- </div>
- </div>
- </div>`
- }else{
- msgBox = `<div class="midifyMsgBox">
- <div class="mask"></div>
- <div class="midifyMsgContent abnormal">
- <p class="midifyMsgTitle">修改 <img class="iconClose" src=${require('./../images/icon_close_default.png')} alt="关闭" /></p>
- <div class="itemMsgInfoBox">
- <span class="itemMsgLab abnormalLeft">状态:</span>
- <span class="abnormalAll" data-status="${itemCopy.status}">${itemCopy.status == 0?"未处理":"已处理"}<img class="arrow" src=${iconDown} alt="下拉"></span>
- <ul class="abnormalStatusLis">
- <li data-status="0">未处理</li>
- <li data-status="1">已处理</li>
- </ul>
- </div>
- <div class="itemMsgInfoBox">
- <span class="itemMsgLab abnormalLeft abnormalMark">备注:</span>
- <span class="itemInfoRight">
- <textarea class="abnormalTxt" placeholder="请输入内容" >${itemCopy.remark}</textarea>
- </span>
- </div>
- <div class="itemMsgInfoTips">支持≥0的数字输入,最多保留小数点后1位~</div>
- <div class="midifyMsgBtn abnormalBtn">
- <span class="midifyEdit">保存</span>
- </div>
- </div>
- </div>`
- }
- }else{//删除
- msgBox = `<div class="midifyMsgBox">
- <div class="mask"></div>
- <div class="midifyMsgContent midifyMsgContentDel">
- <p class="midifyMsgTitle">删除记录<img class="iconClose" src=${require('./../images/icon_close_default.png')} alt="关闭" /></p>
- <p class="delTips">确认要删除该条异常记录?</p>
- <div class="midifyMsgBtn midifyMsgBtnDel">
- <span class="midifyEdit midifyEditDel">删除</span>
- <span class="midifyEdit midifyEditQuite">取消</span>
- </div>
- </div>
- </div>`
- }
- $("#mainBox", parent.document).append(msgBox)
- $(".midifyEditDel", parent.document).on("click",function(){
- delModifyOne(itemCopy)
- })
- $(".midifyEditQuite", parent.document).on("click",function(){
- $("#mainBox .midifyMsgBox", parent.document).remove()
- })
- $(".abnormalAll", parent.document).on("click",function(){
- $(".abnormalStatusLis", parent.document).slideToggle()
- })
- $(".abnormalStatusLis li", parent.document).on("click",function(){
- let status = $(this).attr("data-status")
- let id = $(this).attr("data-id")
- let title = $(this).attr("title")
- let str = $(this).html()
- $(".abnormalAll", parent.document).attr({
- "data-status":status,
- "data-id":id,
- "title":title
- }).html(str+`<img class="arrow" src=${iconDown} alt="下拉"></img>`)
- $(".abnormalStatusLis", parent.document).slideToggle()
- })
- $("#mainBox .midifyMsgBox .iconClose", parent.document).on("click", function(e){
- $("#mainBox .midifyMsgBox", parent.document).remove()
- })
- $("#mainBox .midifyMsgBox .itemScore", parent.document).on("keypress", function(event){
- return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))
- })
- $("#mainBox .midifyMsgBox .itemScore", parent.document).on("input", function(e){
- const val = $(this).val()
- itemCopy.score = val
- })
- $("#mainBox .midifyMsgBox .midifyEdit", parent.document).on("click", function(e){
- if(itemCopy.type==1){
- saveModifyTwo(itemCopy,des)
- }else{
- saveModifyOne(itemCopy)
- }
- })
- }
- //保存修改
- function delModifyOne(itemCopy){
- let param = {
- "id": itemCopy.id
- }
- post(api.delQcAnnormal,param).then(res =>{
- if(res.data.code == '0'){
- const data = res.data.data;
- getTabData(1)
- $("#mainBox .midifyMsgBox", parent.document).remove()
- $.alerModal({"message":'删除成功',type:"tip",time:'1000',win:true,isFather: true, fatherWrapper: $("#mainBox", parent.document)});
- }else{
- $.alerModal({"message":'删除失败,请重试~',type:"tip",time:'1000',win:'default',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
-
- }
- }).catch((e) =>{
- $.alerModal({"message":'删除失败,请重试~',type:"tip",time:'1000',win:'default',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
-
- })
- }
- //保存修改
- function saveModifyOne(itemCopy){
- let txt = $(".abnormalTxt", parent.document).val()
- let status = $(".abnormalAll", parent.document).attr("data-status")
- let param = {
- "id": itemCopy.id,
- "remark": txt,
- "status": status
- }
- post(api.saveQcAnnormal,param).then(res =>{
- if(res.data.code == '0'){
- const data = res.data.data;
- getTabData(1)
- $("#mainBox .midifyMsgBox", parent.document).remove()
- $.alerModal({"message":'修改成功',type:"tip",time:'1000',isFather: true,win: true, fatherWrapper: $("#mainBox", parent.document)});
- }else{
- $.alerModal({"message":'修改失败,请重试~',type:"tip",time:'1000',isFather: true,win: 'default', fatherWrapper: $("#mainBox", parent.document)});
- }
- }).catch((e) =>{
- $.alerModal({"message":'修改失败,请重试~',type:"tip",time:'1000',isFather: true,win: 'default', fatherWrapper: $("#mainBox", parent.document)});
- })
- }
- //保存修改,数据模块
- function saveModifyTwo(itemCopy,des){
- let txt = $(".abnormalTxt", parent.document).val()
- let id = $(".abnormalAll", parent.document).attr("data-id")
- let name = $(".abnormalAll", parent.document).attr("title")
- let param = {
- "hospitalId": getCookie("hospitalid"),
- "hospitalModelName": des,
- "qcAbnormalName": {
- "description": des,
- "remark": txt,
- "status": 1,
- "id":itemCopy.id
- },
- "standModelId": id||'',
- "standModelName": name?(name=="暂无"?'':name):''
- }
- post(api.saveAndupdataModel,param).then(res =>{
- if(res.data.code == '0'){
- const data = res.data.data;
- getTabData(1)
- $("#mainBox .midifyMsgBox", parent.document).remove()
- $.alerModal({"message":'修改成功',type:"tip",time:'1000',isFather: true,win: true, fatherWrapper: $("#mainBox", parent.document)});
- }else{
- $.alerModal({"message":'修改失败,请重试~',type:"tip",time:'1000',isFather: true,win: 'default', fatherWrapper: $("#mainBox", parent.document)});
- }
- }).catch((e) =>{
- $.alerModal({"message":'修改失败,请重试~',type:"tip",time:'1000',isFather: true,win: 'default', fatherWrapper: $("#mainBox", parent.document)});
- })
- }
- //选择病历等级
- $('.selectLevel').on("click", function(e){
- e.stopPropagation()
- $(".deptList ").css("display", "none")
- $(".selectDept .arrow").attr("src",iconDown)
- const showList = $(".levelList ").css("display")
- if(showList == "none" ||!showList){
- $(".levelList ").css("display","block")
- $(".selectLevel .arrow").attr("src",iconUp)
- }else{
- $(".levelList ").css("display", "none")
- $(".selectLevel .arrow").attr("src",iconDown)
- }
- })
- bindLeveldSelect()
- //是否启用选择
- function bindLeveldSelect(){
- $('.levelItem').on("click",function(){
- const levelItemName = $(this).attr("data-name")
- const levelItemItemId = $(this).attr("data-id")
- levelTemp =levelItemItemId
- $('.selectLevel').html(levelItemName)
- $(".levelList").css("display", "none")
- $(".selectLevel").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
- })
- }
- //全选绑定
- $('.selectDept').on("click", function(e){
- e.stopPropagation()
- $(".levelList ").css("display","none")
- $(".selectLevel .arrow").attr("src",iconDown)
- const showList = $(".deptList ").css("display")
- if(showList == "none" ||!showList){
- $(".deptList ").css("display","block")
- $(".selectDept .arrow").attr("src",iconUp)
- }else{
- $(".deptList ").css("display", "none")
- $(".selectDept .arrow").attr("src",iconDown)
- }
- })
- function rendeDeptList(deptList){
- let str = `<li class="deptItem " data-id=" " data-name="全部">全部</li>`
- for(let i = 0; i < deptList.length; i++){
- str += `<li class="deptItem ellipsis" title=${deptList[i].deptName} data-id=${deptList[i].deptId} data-name=${deptList[i].deptName}> ${deptList[i].deptName}</li>`
- }
- $('.deptList').html(str)
- }
- bindDeptSelect()
- //科室选择
- function bindDeptSelect(){
- $('.deptItem').on("click",function(){
- const deptItemName = $(this).attr("data-name")
- const deptItemId = $(this).attr("data-id")
- deptIdTemp =deptItemId
- if(deptItemName.length > 10){
- $('.selectDept').html(deptItemName.substring(0,8)+'...')
- }else{
- $('.selectDept').html(deptItemName)
- }
- $('.selectDept ').attr('title',deptItemName)
- $(".selectDept").append(`<img class="arrow" src=${iconDown} alt="下拉">`)
- $(".deptList").css("display", "none")
- })
- }
- function loading(){
- const str = `
- <div class="loadingBox">
- <div class="mask"></div>
- <img class="loadingImg" src=${loadingImg} alt="loading" />
- </div>
- `
- $("#mainBox", parent.document).append(str)
- }
- function hideLoading(){
- $("#mainBox .loadingBox", parent.document).remove()
- }
- $('.recordScoreBtn').on("click",function(e){
- if(!hasData('FUNC000017')){
- return
- }
- let scoreList = []
- for(let i = 0; i <tabList.length; i++){
- if(tabList[i].hasSelect){
- scoreList.push(tabList[i].behospitalCode)
- }
- }
- if(scoreList.length === 0){
- $.alerModal({"message":'请选择要评分的项!',type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
- return
- } else{
- loading()
- for(let j = 0; j < scoreList.length; j++){
- recordScore(scoreList[j],scoreList.length)
- }
- }
- })
- $("th[code]").on("click",function(e){
- const code=$(this).attr("code");
- if(data_asc[0]===code){
- data_desc=[code];
- data_asc=[];
- $("th[code]").removeClass("asc desc");
- $(this).addClass("desc");
- }else{
- data_desc=[];
- data_asc=[code];
- $("th[code]").removeClass("asc desc");
- $(this).addClass("asc");
- }
- getTabData(1);
- });
- function recordScore(behospitalCode,totalNum){
- const param = {
- behospitalCode: behospitalCode
- }
- post(api.recordScore,param).then(res =>{
- if(res.data.code == '0'){
- scoreSum++
- if(scoreSum === totalNum){
- hideLoading()
- scoreSum = 0
- const activePage = $(".activePage").attr('data-page') || 1
- getTabData(activePage)
- }
-
- }else{}
- }).catch((e) =>{
-
- })
- }
- $(".patientNumInp").on("input", function(e){
- const val = $(this).val().trim()
- behospitalCodeTemp = val
- })
- $(".patientNameInp").on("input", function(e){
- const val = $(this).val().trim()
- nameTemp = val
- })
- $(".doctorInp").on("input", function(e){
- const val = $(this).val().trim()
- doctorNameTemp = val
- })
- $(".doctorNumInp").on("input", function(e){
- const val = $(this).val().trim();
- doctorNumTemp = val
- })
- $(function() {
- $.datepicker.regional['zh-CN'] = {
- clearText: '清除',
- clearStatus: '清除已选e799bee5baa6e59b9ee7ad9431333361303131日期',
- closeText: '关闭',
- closeStatus: '不改变当前选择',
- prevText: '<上月',
- prevStatus: '显示上月',
- prevBigText: '<<',
- prevBigStatus: '显示上一年',
- nextText: '下月>',
- nextStatus: '显示下月',
- nextBigText: '>>',
- nextBigStatus: '显示下一年',
- currentText: '今天',
- currentStatus: '显示本月',
- monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
- monthNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
- yearNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
- monthStatus: '选择月份',
- yearStatus: '选择年份',
- weekHeader: '周',
- weekStatus: '年内周次',
- dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
- dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
- dayNamesMin: ['日','一','二','三','四','五','六'],
- dayStatus: '设置 DD 为一周起始',
- dateStatus: '选择 m月 d日, DD',
- dateFormat: 'yy-mm-dd',
- firstDay: 1,
- initStatus: '请选择日期',
- isRTL: false};
- $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
- $( "#datepicker" ).datepicker({
- changeMonth: true,
- changeYear: true,
- dateFormat:"yy/mm/dd"
- });
- $( "#datepicker2" ).datepicker({
- changeMonth: true,
- changeYear: true,
- dateFormat:"yy/mm/dd"
- });
- });
- //分页渲染
- function renderPagination(totalPage,activePage,totalNum){
- let str = `<span class="totalSum">共${totalPage}页/${totalNum}条数据</span><span class="prePage"><img class="arrowPage" src=${arrowLeft} /></span>`
- if(totalPage <= 6){
- for(let i = 1; i <= totalPage; i++){
-
- str += `<span class="pageNum ${'page'+i}" data-page=${i}>${i}</span>`
- }
- }else{
- if(activePage <= 3){ //选中页数小于4
- for(let i = 1; i <= 4; i++){
- str += `<span class="pageNum ${'page'+i}" data-page=${i}>${i}</span>`
- }
- str += `<span class="more" >...</span>`
- str += `<span class="pageNum ${'page'+totalPage}" data-page=${totalPage}>${totalPage}</span>`
- } else if(activePage > totalPage -3){
- str += `<span class="pageNum page1" data-page=1>1</span>`
- str += `<span class="more" >...</span>`
- str += `<span class="pageNum ${'page'+(totalPage-3)}" data-page=${totalPage -3}>${totalPage -3}</span>`
- str += `<span class="pageNum ${'page'+(totalPage-2)}" data-page=${totalPage -2}>${totalPage -2}</span>`
- str += `<span class="pageNum ${'page'+(totalPage-1)}" data-page=${totalPage -1}>${totalPage -1}</span>`
- str += `<span class="pageNum ${'page'+totalPage}" data-page=${totalPage}>${totalPage}</span>`
- } else {
- str += `<span class="pageNum page1" data-page=1>1</span>`
- str += `<span class="more" >...</span>`
- str += `<span class="pageNum ${'page'+(activePage -1)}" data-page=${activePage -1}>${activePage -1}</span>`
- str += `<span class="pageNum ${'page'+activePage}" data-page=${activePage}>${activePage}</span>`
- str += `<span class="pageNum ${'page'+(activePage +1)}" data-page=${activePage +1}>${activePage +1}</span>`
- str += `<span class="more" >...</span>`
- str += `<span class="pageNum ${'page'+totalPage}" data-page=${totalPage}>${totalPage}</span>`
- }
-
- }
- str += `<span class="nextPage"><img class="arrowPage" src=${arrowRight} /></span>`
- $('.pagination').html(str)
- $('.page' + activePage).addClass('activePage')
- $(".pageNum").on("click", function(e){
- const activePageNow = Number($(this).attr('data-page'))
- getTabData(activePageNow)
- // renderPagination(totalPage,activePageNow,totalNum)
- })
- $(".prePage").on("click", function(e){
- let activePageNow = Number($(".activePage").attr('data-page'))
- if(activePageNow > 1){
- activePageNow--
- getTabData(activePageNow)
- // renderPagination(totalPage,activePageNow,totalNum)
- }
- })
- $(".nextPage").on("click", function(e){
- let activePageNow = Number($(".activePage").attr('data-page'))
- if(activePageNow < totalPage){
- activePageNow++
- getTabData(activePageNow)
- // renderPagination(totalPage,activePageNow,totalNum)
- }
- })
-
- }
- $(document).on("click", function(){
- $(".levelList ").css("display", "none")
- $(".deptList").css("display", "none")
- $(".selectLevel .arrow").attr("src",iconDown)
- $(".selectDept .arrow").attr("src",iconDown)
- })
- $((function($){
- })($));
|