situationsCenter.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. <template>
  2. <view class="situationsCenter-page">
  3. <tmNavbar @onsearchChange="onsearchChangehandle" :is-back="false" @checkMessage="checkMessageHandle"
  4. :titleMod="nowPermission == 6||nowPermission == 4||nowPermission ==7||nowPermission == 8?'Filter':'Normal'"
  5. :filterKeys="filterKeys" :isShowFilter="true" :messageStatus="true" :isShowSearch="true"
  6. @filterClick="filterClickHandle" :title="pageTitle" title-color="#292C33"></tmNavbar>
  7. <view class="situation-list">
  8. <scroll-view class="scroll-box" scroll-y="true" @scrolltolower="toLower" lower-threshold="5">
  9. <view class="content" :style="[situationList.length === 0 ?{height:'100%'}:{}]">
  10. <view class="situation" v-for="(item, index) in situationList" :key="item.id"
  11. @click="gotoDetail(item.situationID,item.systemSituationType,item)">
  12. <!-- <image v-if="item.systemSituationType != 2" class="situation-topic" :src="`/static/${
  13. item.topic ? 'situation-case' : 'situation-system'
  14. }.png`"></image> -->
  15. <view v-if="item.systemSituationType == 2&&nowPermission !=1 " :class="getClass(item)">
  16. {{situationStatusName(item)}}</view>
  17. <view :class="situationTypeName(item,0)"
  18. v-if="nowPermission !=4&&nowPermission !=7&&nowPermission !=8&&nowPermission !=6 ">
  19. {{situationTypeName(item,1)}}</view>
  20. <view class="title">
  21. <text class="title-name">{{ item.name }}</text>
  22. </view>
  23. <view class="check-group">
  24. <text class="group-text">
  25. {{
  26. nowPermission == 2
  27. ? "剩余" + (item.toDistributeCount || 0) + "个待分配"
  28. : item.checkGroupName
  29. }}</text>
  30. </view>
  31. <view class="row">
  32. <image class="situation-check" src="/static/situation-check.png"></image>
  33. <text class="text">{{ item.checkStatus }}</text>
  34. </view>
  35. <view class="row">
  36. <image class="situation-time" src="/static/situation-time.png"></image>
  37. <text class="text">{{ item.nextCheckTime }}</text>
  38. </view>
  39. </view>
  40. <tm-no-data v-if="situationList.length === 0" :textArr="['还没有情境', '快点击右下方按钮新建一个吧']" />
  41. </view>
  42. </scroll-view>
  43. </view>
  44. <view v-if="nowPermission == 1" class="situaions-add" @click="gotoCreate">
  45. <image class="add-pic" src="/static/situation-add.png"></image>
  46. </view>
  47. <tm-tabbar :permission="nowPermission" />
  48. </view>
  49. </template>
  50. /**
  51. * 情境中心
  52. */
  53. <script>
  54. import websocket from "../../utils/ws.js"; //引入websocket
  55. import tmNavbar from "@/components/tm-navbar/tm-navbar.vue";
  56. import {
  57. wsURL
  58. } from "../../utils/requestUrl.js";
  59. // import appUpdate from "@/components/app-update/app-update.vue"
  60. export default {
  61. components: {
  62. tmNavbar
  63. },
  64. data() {
  65. return {
  66. page: 1, //页数
  67. inputValue: "",
  68. nowPermission: "",
  69. isSearchBarShow: false, //搜索栏是否可见
  70. isSearchBoxShow: true, //搜索图标是否可见
  71. situationList: [], //情境卡片列表
  72. copied_situationList: [], //复制情境卡片列表 用于筛选
  73. totalCount: "", //返回数据的总条数
  74. refTimer: null,
  75. isInitWs: null,
  76. messageType: null,
  77. num: 1,
  78. pageTitle: '情境中心',
  79. // showUpdatePop:false,
  80. timer: null,
  81. // ws接口参数
  82. initParams: {},
  83. };
  84. },
  85. // components:{appUpdate},
  86. created: function() {
  87. this.nowPermission = uni.getStorageSync("nowPermission");
  88. this.init(true);
  89. this.refTimer = setInterval(() => {
  90. this.isInitWs = websocket.ws ? false : true;
  91. const {
  92. hiId,
  93. user,
  94. permission
  95. } = this.initParams;
  96. this.isInitWs && this.initWebsocket(hiId, user, permission);
  97. }, 3 * 60 * 1000);
  98. // this.messStatus();
  99. },
  100. beforeDestroy() {
  101. // 关闭ws连接
  102. websocket.close();
  103. clearInterval(this.refTimer);
  104. clearTimeout(this.timer);
  105. },
  106. computed: {
  107. statusBarHeight() {
  108. const {
  109. statusBarHeight
  110. } = uni.getSystemInfoSync();
  111. return statusBarHeight;
  112. },
  113. filterKeys() {
  114. const list = [{
  115. text: '全部',
  116. checked: true,
  117. key: '0'
  118. },
  119. {
  120. text: '已完成',
  121. checked: false,
  122. key: '6'
  123. },
  124. {
  125. text: '进行中',
  126. checked: false,
  127. key: '2'
  128. },
  129. {
  130. text: '待分配',
  131. checked: false,
  132. key: '4'
  133. }
  134. ];
  135. return list;
  136. // const modify = (key) => {
  137. // const _list = list.map(a => {
  138. // if (a.key == key) {
  139. // return {
  140. // ...a,
  141. // checked: true
  142. // }
  143. // } else {
  144. // return {
  145. // ...a,
  146. // checked: false
  147. // }
  148. // }
  149. // });
  150. // return _list;
  151. // }
  152. // if (this.nowPermission == 6) {
  153. // //职能科室负责人
  154. // return modify(1);
  155. // }
  156. // if (this.nowPermission == 6) {
  157. // //职能科室负责人
  158. // return modify(4);
  159. // }
  160. }
  161. },
  162. mounted() {
  163. },
  164. methods: {
  165. filterClickHandle(filterData) {
  166. if (filterData.key != 0) {
  167. const _situationList = this.copied_situationList.filter(item => item.situationStatus == Number(
  168. filterData.key));
  169. this.situationList = _situationList;
  170. }else{
  171. this.situationList = this.copied_situationList
  172. }
  173. },
  174. situationStatusName(item) {
  175. if (item.situationStatus == 2) {
  176. return '进行中'
  177. }
  178. if (item.situationStatus == 6) {
  179. return '全部完成'
  180. }
  181. if (item.situationStatus == 4) {
  182. return '待分配'
  183. }
  184. if (item.situationStatus == 5) {
  185. return '已完成'
  186. }
  187. return null
  188. },
  189. situationTypeName(item, type) {
  190. if (item.systemSituationType == 0) {
  191. return type == 1 ? '个案' : 'Mark case'
  192. }
  193. if (item.systemSituationType == 1) {
  194. return type == 1 ? '系统' : 'Mark system'
  195. }
  196. if (item.systemSituationType == 2) {
  197. return type == 1 ? '自查督查' : 'Mark zichaducha'
  198. }
  199. },
  200. getClass(item) {
  201. if (item.situationStatus == 2) {
  202. return 'topMark doing'
  203. }
  204. if (item.situationStatus == 6) {
  205. return 'topMark complete'
  206. }
  207. if (item.situationStatus == 4) {
  208. return 'topMark wait'
  209. }
  210. if (item.situationStatus == 5) {
  211. return 'topMark complete'
  212. }
  213. return 'topMark'
  214. },
  215. onsearchChangehandle(keywords) {
  216. this.searchByKeywords(keywords);
  217. },
  218. openSearchBar() {
  219. this.isSearchBarShow = true;
  220. this.isSearchBoxShow = false;
  221. },
  222. checkMessageHandle() {
  223. //查看消息
  224. uni.navigateTo({
  225. url: `/pages/messages/messages`,
  226. });
  227. },
  228. closeSearchBar() {
  229. this.isSearchBarShow = false;
  230. this.isSearchBoxShow = true;
  231. },
  232. valueEmpty() {
  233. this.inputValue = "";
  234. },
  235. gotoCreate() {
  236. uni.navigateTo({
  237. url: "/pages/creatingSituations/creatingSituations",
  238. });
  239. },
  240. gotoDetail(id, systemSituationType, item) {
  241. this.$store.commit({
  242. type: 'situationsCenter/comChangeState',
  243. key: 'currentSelectedSituation',
  244. data: item
  245. });
  246. uni.navigateTo({
  247. url: `/pages/situationDetail/situationDetail?situationId=${id}&systemSituationType=${systemSituationType}`,
  248. });
  249. },
  250. getSituationList(data, callback) {
  251. this.$store
  252. .dispatch({
  253. type: "situationsCenter/commActions",
  254. payload: {
  255. data,
  256. key: "situationList",
  257. },
  258. })
  259. .then((data) => {
  260. if (data) callback(data);
  261. });
  262. },
  263. searchByKeywords(keywords) {
  264. let data = {
  265. pageNum: 1,
  266. pageSize: 300,
  267. keyword: keywords,
  268. };
  269. this.getSituationList(data, (data) => {
  270. this.situationList = [];
  271. this.createSituationList(data.list);
  272. });
  273. },
  274. createSituationList(list = []) {
  275. list.map((item, index) => {
  276. this.situationList.push({
  277. name: item.name,
  278. checkStatus: item.checkStatus,
  279. nextCheckTime: item.nextCheckTime,
  280. systemSituationType: item.systemSituationType,
  281. //systemSituationType == 0 普通 1 自查督查
  282. checkGroupName: item.systemSituationType != 2 ? item.checkGroupName : (item
  283. .department.map(v => v.deptClassName)).join(','),
  284. topic: item.topic == 0 ? true : false,
  285. situationStatus: item.situationStatus,
  286. situationID: item.id,
  287. toDistributeCount: item.toDistributeCount,
  288. });
  289. });
  290. },
  291. toLower() {
  292. uni.showToast({
  293. title: "加载中....",
  294. icon: "loading",
  295. duration: 2000,
  296. });
  297. let count = this.situationList.length;
  298. if (this.totalCount != count) {
  299. this.page++;
  300. let data = {
  301. pageNum: this.page,
  302. pageSize: 300,
  303. };
  304. // this.getSituationList(data, (data) => {
  305. // this.createSituationList(data.list);
  306. // let hiId = uni.getStorageSync("hiId");
  307. // let user = uni.getStorageSync("id");
  308. // let permission = uni.getStorageSync("nowPermission");
  309. // this.initParams = {
  310. // hiId,
  311. // user,
  312. // permission
  313. // };
  314. // this.isInitWs && this.initWebsocket(hiId, user, permission);
  315. // });
  316. } else {
  317. uni.showToast({
  318. title: "没有更多数据了",
  319. icon: "none",
  320. duration: 1000,
  321. });
  322. }
  323. },
  324. // toMessagePage() {
  325. // // this.messageType = false;
  326. // uni.navigateTo({
  327. // url: `/pages/messages/messages`,
  328. // });
  329. // },
  330. init(isInitWs) {
  331. this.isInitWs = isInitWs;
  332. this.initSituationList();
  333. },
  334. initWebsocket(hiId, user, permission) {
  335. websocket.url = wsURL(hiId, user, permission);
  336. websocket.createWebSocket(this.resolverWsData.bind(this));
  337. },
  338. // 解析websocket返回数据
  339. resolverWsData(type) {
  340. let types = JSON.parse(type);
  341. switch (types.type) {
  342. case "TO_READ":
  343. this.messageType = true;
  344. break;
  345. default:
  346. this.messageType = false;
  347. break;
  348. }
  349. },
  350. initSituationList() {
  351. let data = {
  352. pageNum: 1,
  353. pageSize: 300,
  354. };
  355. this.getSituationList(data, (data) => {
  356. this.totalCount = data.totalCount;
  357. this.createSituationList(data.list);
  358. this.copied_situationList = data.list;
  359. let hiId = uni.getStorageSync("hiId");
  360. let user = uni.getStorageSync("id");
  361. let permission = uni.getStorageSync("nowPermission");
  362. this.initParams = {
  363. hiId,
  364. user,
  365. permission
  366. };
  367. this.isInitWs && this.initWebsocket(hiId, user, permission);
  368. });
  369. },
  370. // messStatus(){
  371. // let num = 1;
  372. // let timer = setInterval(()=>{
  373. // this.$store.dispatch({
  374. // type: "calendar/commActions",
  375. // payload: {
  376. // key: "messagesList",
  377. // data: {
  378. // pageNum: num,
  379. // pageSize: 100,
  380. // },
  381. // },
  382. // }).then((res)=>{
  383. // if(res && res.list.length == 0){
  384. // clearInterval(timer)
  385. // }else if(res && res.list.length != 0){
  386. // res.list.map((item)=>{
  387. // if(!item.readStatus){
  388. // this.messageType = true;
  389. // return;
  390. // }
  391. // })
  392. // }
  393. // })
  394. // num++;
  395. // },200)
  396. // }
  397. },
  398. };
  399. </script>
  400. <style lang="less">
  401. .situationsCenter-page {
  402. height: 100%;
  403. .navbar {
  404. background-color: #ffffff;
  405. }
  406. .calender-remind {
  407. width: 62.5rpx;
  408. height: 62.5rpx;
  409. position: fixed;
  410. top: 20rpx;
  411. right: 25rpx;
  412. background: rgba(255, 255, 255, 0.95);
  413. border-radius: 50%;
  414. z-index: 2;
  415. image {
  416. margin-left: 17.5rpx;
  417. margin-top: 16.87rpx;
  418. width: 27.5rpx;
  419. height: 28.75rpx;
  420. }
  421. }
  422. .search-box {
  423. position: fixed;
  424. top: 20rpx;
  425. left: 25rpx;
  426. z-index: 2;
  427. .search-model {
  428. height: 62.5rpx;
  429. width: 62.5rpx;
  430. background-color: #ffffff;
  431. text-align: center;
  432. border-radius: 50%;
  433. box-shadow: 0px 10px 10px 0px rgba(217, 221, 228, 0.5);
  434. border: 1px solid #e6eaf2;
  435. opacity: 0.85;
  436. .search-pic {
  437. width: 27.5rpx;
  438. height: 27.5rpx;
  439. margin-top: 17.5rpx;
  440. }
  441. }
  442. .search-bar {
  443. background-color: #ffffff;
  444. width: 700rpx;
  445. height: 62.5rpx;
  446. top: 0rpx;
  447. position: absolute;
  448. z-index: 2;
  449. .search-item {
  450. background-color: #ffffff;
  451. width: 593.75rpx;
  452. height: 62.5rpx;
  453. float: left;
  454. border-radius: 6.25rpx;
  455. border-right: 1.25rpx solid #f0f2f7;
  456. ;
  457. .search-pic {
  458. width: 21.87rpx;
  459. height: 21.87rpx;
  460. margin-left: 12.5rpx;
  461. margin-top: 20.62rpx;
  462. float: left;
  463. }
  464. .searh-input {
  465. background-color: #ffffff;
  466. width: 525rpx;
  467. height: 55rpx;
  468. font-size: 22.5rpx;
  469. float: right;
  470. margin-top: 3.75rpx;
  471. margin-left: 3.12rpx;
  472. }
  473. .text-clear {
  474. width: 21.87rpx;
  475. height: 21.87rpx;
  476. float: right;
  477. margin-top: 20.62rpx;
  478. margin-right: 6.25rpx;
  479. }
  480. }
  481. .cancel-text {
  482. font-size: 22.5rpx;
  483. line-height: 62.5rpx;
  484. color: #a1a7b3;
  485. margin-right: 31.25rpx;
  486. float: right;
  487. }
  488. }
  489. }
  490. .situation-list {
  491. position: relative;
  492. height: 100%;
  493. .scroll-box {
  494. width: 100%;
  495. height: calc(100% - 87.5rpx);
  496. .content {
  497. display: flex;
  498. flex-flow: row wrap;
  499. padding-bottom: 100rpx;
  500. .situation {
  501. position: relative;
  502. height: 187.5rpx;
  503. width: 337.5rpx;
  504. background: #ffffff;
  505. box-shadow: 0px 6px 20px 0px rgba(0, 13, 51, 0.1);
  506. border-radius: 8px;
  507. margin-left: 25rpx;
  508. margin-top: 25rpx;
  509. // overflow: hidden;
  510. .Mark {
  511. position: absolute;
  512. top: 0;
  513. right: 0;
  514. font-size: 15rpx;
  515. padding-left: 20rpx;
  516. padding-right: 10rpx;
  517. color: #ffffff;
  518. border-radius: 0px 8rpx 0px 25rpx;
  519. background: rgba(255, 51, 85, 1);
  520. &.case {
  521. background: rgba(0, 204, 170, 1);
  522. }
  523. &.system {
  524. background: rgba(61, 121, 242, 1);
  525. }
  526. }
  527. .topMark {
  528. position: absolute;
  529. top: 0;
  530. right: 0;
  531. padding: 3.75rpx 12.5rpx;
  532. font-size: 13.75rpx;
  533. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  534. font-weight: 500;
  535. color: #FFFFFF;
  536. background: #FF6680;
  537. border-radius: 0px 5rpx 0px 20rpx;
  538. &.doing {
  539. background-color: rgba(255, 204, 102, 1);
  540. }
  541. &.wait {
  542. background-color: rgba(102, 179, 255, 1);
  543. }
  544. &.complete {
  545. background-color: rgba(173, 184, 204, 1);
  546. }
  547. }
  548. .situation-topic {
  549. width: 62.5rpx;
  550. height: 25rpx;
  551. float: right;
  552. }
  553. .title {
  554. height: 22.5rpx;
  555. margin-left: 20rpx;
  556. margin-top: 25rpx;
  557. display: flex;
  558. align-items: center;
  559. .title-name {
  560. width: 300rpx;
  561. font-size: 22.5rpx;
  562. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  563. font-weight: bold;
  564. color: #292c33;
  565. overflow: hidden; //超出的文本隐藏
  566. text-overflow: ellipsis; //溢出用省略号显示
  567. white-space: nowrap; //溢出不换行
  568. }
  569. }
  570. .check-group {
  571. margin-left: 20rpx;
  572. margin-top: 15rpx;
  573. margin-bottom: 25rpx;
  574. height: 17.5rpx;
  575. display: flex;
  576. align-items: center;
  577. .group-text {
  578. font-size: 17.5rpx;
  579. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  580. font-weight: 400;
  581. color: #666e80;
  582. }
  583. }
  584. .row {
  585. margin-left: 20rpx;
  586. margin-bottom: 17.5rpx;
  587. display: flex;
  588. align-items: center;
  589. height: 20rpx;
  590. .situation-check {
  591. width: 20rpx;
  592. height: 20rpx;
  593. }
  594. .situation-time {
  595. width: 20rpx;
  596. height: 20rpx;
  597. }
  598. .text {
  599. font-size: 20rpx;
  600. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  601. font-weight: 400;
  602. color: #292c33;
  603. margin-left: 11.25rpx;
  604. }
  605. }
  606. }
  607. }
  608. }
  609. }
  610. .situaions-add {
  611. position: fixed;
  612. right: 25rpx;
  613. bottom: 130rpx;
  614. .add-pic {
  615. width: 75rpx;
  616. height: 75rpx;
  617. }
  618. }
  619. }
  620. </style>