article.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title></title>
  6. <!--<link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />-->
  7. <link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
  8. <link rel="stylesheet" type="text/css" href="../../../css/cross.ui.css" />
  9. <link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
  10. <link href="../../../plugins/toastr/toastr.min.css" rel="stylesheet">
  11. <link rel="stylesheet" type="text/css" href="../css/article.css"/>
  12. </head>
  13. <body>
  14. <div id="app">
  15. <div class="sel-tap sel-article">
  16. <div class="p10 pt60 c-h80">
  17. <ul class="select-tit c-border-b clearfix h34 lh34">
  18. <li v-for="(tit, index) in selectArr" :key="index" class="fl mr10 c-border-r c-border-l c-border-t b-r-5500 bgc-f5f5fa c-666 cur-pit" :class="{'active': index == judgeIndex}" @click="selectTit(index)">{{tit}}</li>
  19. </ul>
  20. <div class="set-article-content plr10" id="setCon">
  21. <div class="set-search ptb20 lh30 clearfix">
  22. <div class="c-position-r fl mb0">
  23. 一级分类:<span class="list-tit set-bg cur-pit c-999" @click="judgeLevel(1)">{{levelTit1}}</span>
  24. <ul class="pull-list c-border-l c-border-r c-border-b" v-if="isShowLevel1">
  25. <li class="cur-pit c-999" v-for="(level1, index) in levelArr1" :key="index" @click="selectLi(1, level1)">{{level1.categoryname}}</li>
  26. </ul>
  27. </div>
  28. <div class="c-position-r fl mb0">
  29. 二级分类:<span class="list-tit set-bg cur-pit c-999" @click="judgeLevel(2)">{{levelTit2}}</span>
  30. <ul class="pull-list c-border-l c-border-r c-border-b" v-if="isShowLevel2">
  31. <li class="cur-pit c-999" v-for="(level2, index) in levelArr2" :key="index" @click="selectLi(2, level2)">{{level2.categoryname}}</li>
  32. </ul>
  33. </div>
  34. <div class="fl mb0">
  35. <input class="list-tit w150" type="text" placeholder="输入文字标题" v-model="articleTitle">
  36. </div>
  37. <div class="fl mb0">
  38. <span class="list-tit w80 b-r-3 c-t-center c-fff bgc-12b7f5 cur-pit btn" @click="search()">搜索</span>
  39. </div>
  40. </div>
  41. <!--<ul class="article-list c-border">
  42. <li class="bgc-f5f5fa c-f999 clearfix">
  43. <span class="fl c-w35 c-border-r c-t-center">文章标题</span>
  44. <span class="fl c-w22 c-border-r c-t-center">分类</span>
  45. <span class="fl c-w30 c-border-r c-t-center">来源</span>
  46. <span class="fl c-w13 c-t-center">操作</span>
  47. </li>
  48. <li class="c-border-t c-f666 clearfix" v-for="(list, index) in articleList" :key="index">
  49. <p class="fl c-w35 plr5 c-border-r text-ellipsis">{{list.articletitle || list.attachedTitle}}</p>
  50. <p class="fl c-w22 c-border-r text-ellipsis">{{list.firstlevelcategoryname || list.level1TypeName ? list.firstlevelcategoryname || list.level1TypeName : ''}}<span v-if="(list.firstlevelcategoryname || list.level1TypeName) && (list.secondlevelcategoryname || list.level1TypeName)">、</span>{{list.secondlevelcategoryname || list.level2TypeName ? list.secondlevelcategoryname || list.level2TypeName : ''}}</p>
  51. <span class="fl c-w30 c-border-r text-ellipsis">{{list.articlesource || list.articleSource}}</span>
  52. <p class="fl c-w13 c-t-center c-12b7f5">
  53. <span class="cur-pit operate" v-if="judgeIndex == 2 || list.isauthentication == 1" @click="send(list)">发送</span>
  54. <span class="c-999" v-if="judgeIndex != 2 && list.isauthentication == 0">未认证</span>
  55. <span class="c-999" v-if="judgeIndex != 2 && list.isauthentication == 2">认证未通过</span>
  56. </p>
  57. </li>
  58. </ul>-->
  59. <table class="article-table" width="100%">
  60. <thead>
  61. <tr>
  62. <th class="c-w35">文章标题</th>
  63. <th class="c-w22">分类</th>
  64. <th>来源</th>
  65. <th>操作</th>
  66. </tr>
  67. </thead>
  68. <tbody>
  69. <tr v-for="(list, index) in articleList" :key="index">
  70. <td class="text-ellipsis">{{list.articletitle || list.attachedTitle}}</td>
  71. <td class="text-ellipsis">{{list.firstlevelcategoryname || list.level1TypeName ? list.firstlevelcategoryname || list.level1TypeName : ''}}<span v-if="(list.firstlevelcategoryname || list.level1TypeName) && (list.secondlevelcategoryname || list.level1TypeName)">、</span>{{list.secondlevelcategoryname || list.level2TypeName ? list.secondlevelcategoryname || list.level2TypeName : ''}}</td>
  72. <td>{{list.articlesource || list.articleSource}}</td>
  73. <td>
  74. <a class="operate" v-if="judgeIndex == 2 || list.isauthentication == 1" @click="send(list)">发送</a>
  75. <span class="c-999 ml10" v-if="judgeIndex != 2 && list.isauthentication == 0">未认证</span>
  76. <span class="c-999 ml10" v-if="judgeIndex != 2 && list.isauthentication == 2">认证未通过</span>
  77. </td>
  78. </tr>
  79. </tbody>
  80. </table>
  81. <div class="mt20 lh24 pr30 txt-center clearfix" v-show="articleList.length">
  82. <div class="fr ml10 clearfix">
  83. <span class="fl c-border w40 m0">
  84. <input class="fl w40 c-f999" v-model="editPage" />
  85. </span>
  86. <span class="fr bgc-12b7f5 c-fff c-f12 btn sure-btn" @click="setPage(editPage)">跳转</span>
  87. </div>
  88. <span class="fr btn page-btn ml10" @click="setPage(page + 2)" v-if="page == 1 && (page + 2) <= allPage">{{page + 2}}</span>
  89. <span class="fr btn page-btn ml10" @click="setPage(page + 1)" v-if="(page + 1) <= allPage">{{page + 1}}</span>
  90. <span class="fr btn page-btn ml10 btn-active">{{page}}</span>
  91. <span class="fr btn page-btn ml10" @click="setPage(page - 1)" v-if="page != 1">{{page - 1}}</span>
  92. <span class="fr btn page-btn ml10" @click="setPage(page - 2)" v-if="page > 2 && page == allPage">{{page - 2}}</span>
  93. <span class="fr">当前第{{page}}页,共{{allPage}}页,{{allRecords}}条数据</span>
  94. </div>
  95. <p class="pt60 c-t-center c-999 c-f24" v-show="!articleList.length">无数据</p>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <script src="../../../js/vue.js" type="text/javascript" charset="utf-8"></script>
  101. <script src="../../../js/jquery-2.2.4.js"></script>
  102. <script src="../../../js/es6-promise.js" type="text/javascript" charset="utf-8"></script>
  103. <script src="../../../js/util.js" type="text/javascript" charset="utf-8"></script>
  104. <script src="../../../api/http-request.js" type="text/javascript" charset="utf-8"></script>
  105. <script type="text/javascript" src="../../../api/jbsc-api.js" ></script>
  106. <script type="application/javascript" src="../../../api/rehabilitation-api.js"></script>
  107. <script src="../../../js/underscore.js" type="text/javascript" charset="utf-8"></script>
  108. <script src="../../../plugins/toastr/toastr.min.js"></script>
  109. <!--<script src="../../../plugins/layer/layer.min.js"></script>-->
  110. <script type="text/javascript">
  111. var httpData=GetRequest();
  112. var loginDoctor = JSON.parse(window.localStorage.getItem('wlyyAgent') || window.localStorage.getItem('userRole') || window.localStorage.getItem('severDocInfo') || window.localStorage.getItem('wlyyAgent'));
  113. // currentUserRole = window.localStorage.getItem('userRose'),
  114. var userRole = (loginDoctor && loginDoctor.hospital) || (loginDoctor && loginDoctor.userRole && loginDoctor.userRole),
  115. // currentUserRoleLevel = loginDoctor.currentUserRole.level,
  116. // roleType = Number(loginDoctor.currentUserRole.isManage) ? 2 : 1
  117. currentUserRoleLevel = 4,
  118. roleType = 1;
  119. var currentUserRole=userRole
  120. if(typeof userRole === "object"){
  121. var currentDoc = _.find((userRole||[]),function(o) {
  122. return o.level =="4";
  123. }) || {};
  124. currentUserRole=currentDoc.code || currentDoc[0] && currentDoc[0].code
  125. }
  126. new Vue({
  127. el: "#app",
  128. data:{
  129. selectArr: ['文章库', '我的文章', '已推送文章'],
  130. judgeIndex: 0,
  131. levelArr1: [],
  132. levelTit1: '请选择',
  133. isShowLevel1: false,
  134. levelArr2: [],
  135. levelTit2: '请选择',
  136. isShowLevel2: false,
  137. resultCode:httpData['resultCode'],
  138. isReha:httpData['isReha'],
  139. planId:httpData['planId'],
  140. selectObj: {
  141. firstLevelCategoryId: null, // 文章一级分类
  142. secondLevelCategoryId: null, // 文章二级分类
  143. insertTimeStart: null, // 新增文章开始时间
  144. insertTimeEnd: null, // 新增文章结束时间
  145. articlelevel: null, // 文章级别
  146. articleTitle: null, // 文章标题关键字
  147. currentUserRole: currentUserRole, // 当前登录的角色
  148. currentUserRoleLevel: currentUserRoleLevel, // 当前登录的角色级别
  149. isAuthentication: 1, // 是否认证
  150. isMyArticle: false, // 是否过滤我的文章(默认)
  151. iDisplayStart: 0, // 当前页
  152. iDisplayLength: 10, // pagesize
  153. sEcho: 1, // 插件自带
  154. roleType: roleType, // 1、普通医生,2、管理员
  155. // patient: httpData['code'] // 居民CODE
  156. },
  157. pushObj: {
  158. firstLevelCategoryId: null, // 文章一级分类
  159. secondLevelCategoryId: null, // 文章二级分类
  160. sendTimeStart: null, // 发送开始时间
  161. sendTimeEnd: null, // 发送结束时间
  162. articleTitle: null, // 文章标题关键字
  163. currentRoleCode: currentUserRole, // 当前登录的角色
  164. currentRoleLevel: currentUserRoleLevel, // 当前登录的角色级别
  165. isMyArticle: null, // 是否过滤我的文章(默认)
  166. iDisplayStart: 0, // 当前页
  167. iDisplayLength: 10, // pagesize
  168. sendType: roleType // 1、普通医生,2、管理员
  169. },
  170. firstLevelCategoryId: null, // 选择文章一级分类
  171. secondLevelCategoryId: null, // 选择文章二级分类
  172. articleTitle: null, // 输入文章标题关键字
  173. articleList: [],
  174. editPage: null,
  175. page: 1,
  176. allPage: null,
  177. allRecords: null
  178. },
  179. mounted: function(){
  180. this.getJkEduArticleLevel(1)
  181. this.getJkEduArticleLevel(2)
  182. this.queryArticlePcList(this.selectObj)
  183. },
  184. methods: {
  185. getJkEduArticleLevel:function(num, firstlevelId) {
  186. var vm=this;
  187. var data={
  188. categoryLevel: num,
  189. firstlevelId: firstlevelId || null,
  190. secondLevelId: null
  191. }
  192. // vm.levelArr1=[];
  193. var loadding = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  194. jbscAPI.getCategoryList(data).then(function(res){
  195. top.layer.close(loadding);
  196. if (res.status == 200) {
  197. if (num == 1) {
  198. vm.levelArr1 = res.data
  199. console.log(vm.levelArr1)
  200. } else {
  201. vm.levelArr2 = res.data
  202. }
  203. }
  204. })
  205. },
  206. queryArticlePcList:function(obj) {
  207. var vm=this;
  208. vm.articleList=[];
  209. var loadding = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  210. jbscAPI.queryArticlePcList(obj).then(function(res){
  211. top.layer.close(loadding);
  212. if (res.status === 200) {
  213. console.log(res)
  214. vm.articleList = res.data.aaData
  215. vm.allRecords = res.data.iTotalRecords
  216. vm.allPage = Math.ceil(res.data.iTotalRecords / 10)
  217. }
  218. })
  219. },
  220. pushArticleList:function(obj) {
  221. var vm=this;
  222. var loadding = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  223. jbscAPI.pushArticleList(obj).then(function(res){
  224. top.layer.close(loadding);
  225. if (res.status === 200) {
  226. vm.articleList = res.data.aaData
  227. vm.allRecords = res.data.iTotalRecords
  228. vm.allPage = Math.ceil(res.data.iTotalRecords / 10)
  229. }
  230. })
  231. },
  232. selectTit:function(index) {
  233. this.judgeIndex = index
  234. // 数据初始化
  235. document.getElementById('setCon').scrollTop = 0
  236. this.page = 1
  237. this.selectObj.iDisplayStart = 0
  238. this.firstLevelCategoryId = null
  239. this.secondLevelCategoryId = null
  240. this.articleTitle = null
  241. this.levelTit1 = '请选择'
  242. this.levelTit2 = '请选择'
  243. if (index === 0) {
  244. this.selectObj.isAuthentication = 1
  245. this.selectObj.isMyArticle = false
  246. } else if (index === 1) {
  247. this.selectObj.isAuthentication = null
  248. this.selectObj.isMyArticle = true
  249. }
  250. this.search()
  251. },
  252. judgeLevel:function(num) {
  253. if (num === 1) {
  254. this.isShowLevel1 = !this.isShowLevel1
  255. } else {
  256. this.isShowLevel2 = !this.isShowLevel2
  257. }
  258. },
  259. selectLi:function(num, data) {
  260. if (num === 1) {
  261. this.isShowLevel1 = false
  262. this.levelTit1 = data.categoryname
  263. this.firstLevelCategoryId = data.categoryid
  264. this.levelTit2 = '请选择'
  265. this.secondLevelCategoryId = null
  266. this.getJkEduArticleLevel(2, data.categoryid)
  267. } else {
  268. this.isShowLevel2 = false
  269. this.levelTit2 = data.categoryname
  270. this.secondLevelCategoryId = data.categoryid
  271. }
  272. },
  273. search:function() {
  274. var vm = this
  275. if (this.judgeIndex === 2) {
  276. this.pushObj.firstLevelCategoryId = this.firstLevelCategoryId
  277. this.pushObj.secondLevelCategoryId = this.secondLevelCategoryId
  278. this.pushObj.articleTitle = this.articleTitle
  279. this.pushArticleList(vm.pushObj)
  280. } else {
  281. this.selectObj.firstLevelCategoryId = this.firstLevelCategoryId
  282. this.selectObj.secondLevelCategoryId = this.secondLevelCategoryId
  283. this.selectObj.articleTitle = this.articleTitle
  284. this.queryArticlePcList(vm.selectObj)
  285. }
  286. },
  287. setPage: function(key) {
  288. var vm = this
  289. if (+key && +key > 0 && +key <= this.allPage) {
  290. this.page = +key
  291. if (this.judgeIndex === 2) {
  292. this.pushObj.iDisplayStart = (this.page - 1) * 10
  293. this.pushArticleList(vm.pushObj)
  294. } else {
  295. this.selectObj.iDisplayStart = (this.page - 1) * 10
  296. this.queryArticlePcList(vm.selectObj)
  297. }
  298. } else {
  299. console.log('无效的页数跳转!')
  300. }
  301. },
  302. send:function(data) {
  303. var sendData = {
  304. articleId: data.articleid || data.articleId,
  305. patient: httpData['code'],
  306. leaveWords: '',
  307. currentUserRole: currentUserRole,
  308. currentUserRoleLevel: currentUserRoleLevel,
  309. sendType: roleType
  310. }
  311. this.doctorSendArticleToPatients(sendData)
  312. },
  313. doctorSendArticleToPatients:function(obj) {
  314. var vm=this
  315. var loadding = top.layer.load(0, {shade: false}); //0代表加载的风格,支持0-2
  316. jbscAPI.doctorSendArticleToPatients(obj).then(function(res){
  317. top.layer.close(loadding);
  318. if(res.status==10000){
  319. console.log(vm.isReha)
  320. if(vm.isReha){
  321. vm.saveRehabilitationOperateRecord(obj.articleId);
  322. }else{
  323. vm.updataHeathStatus();
  324. }
  325. }else{
  326. top.layer.msg(res.message, {icon: 1});
  327. }
  328. })
  329. },
  330. saveRehabilitationOperateRecord:function(id){
  331. var vm=this;
  332. var userInfo = JSON.parse(window.localStorage.getItem(httpRequest.agentName));
  333. var params={
  334. rehabilitationDetailId:vm.planId,
  335. node:null,
  336. patientCode:httpData['code'],
  337. doctorCode:userInfo.uid,
  338. relationRecordType:3,
  339. relationRecordCode:id,
  340. relationRecordImg:null,
  341. status:0
  342. }
  343. rehaAPI.saveRehabilitationOperateRecord({dataJson:JSON.stringify(params)}).then(function(res){
  344. var icon=5;
  345. if(res.status==200){//更新父窗体的状态
  346. icon=1;
  347. var index = parent.layer && parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
  348. parent.layer && parent.layer.close(index)
  349. }
  350. top.layer.msg(res.msg, {icon: icon});
  351. })
  352. },
  353. updataHeathStatus:function(){
  354. var obj={
  355. code:this.resultCode.toString()
  356. };
  357. jbscAPI.updateAfterEducate(obj).then(function(res){
  358. var icon=5;
  359. var msg=''
  360. if(res.status==200){
  361. msg='发送成功';
  362. icon=1;
  363. }
  364. top.layer.msg(msg || res.msg, {icon: icon});
  365. })
  366. }
  367. }
  368. })
  369. </script>
  370. </body>
  371. </html>