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.situationID:id,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. console.log({id, systemSituationType, item});
  242. this.$store.commit({
  243. type: 'situationsCenter/comChangeState',
  244. key: 'currentSelectedSituation',
  245. data: item
  246. });
  247. uni.navigateTo({
  248. url: `/pages/situationDetail/situationDetail?situationId=${id}&systemSituationType=${systemSituationType}`,
  249. });
  250. },
  251. getSituationList(data, callback) {
  252. this.$store
  253. .dispatch({
  254. type: "situationsCenter/commActions",
  255. payload: {
  256. data,
  257. key: "situationList",
  258. },
  259. })
  260. .then((data) => {
  261. if (data) callback(data);
  262. });
  263. },
  264. searchByKeywords(keywords) {
  265. let data = {
  266. pageNum: 1,
  267. pageSize: 300,
  268. keyword: keywords,
  269. };
  270. this.getSituationList(data, (data) => {
  271. this.situationList = [];
  272. this.createSituationList(data.list);
  273. });
  274. },
  275. createSituationList(list = []) {
  276. list.map((item, index) => {
  277. this.situationList.push({
  278. name: item.name,
  279. checkStatus: item.checkStatus,
  280. nextCheckTime: item.nextCheckTime,
  281. systemSituationType: item.systemSituationType,
  282. //systemSituationType == 0 普通 1 自查督查
  283. checkGroupName: item.systemSituationType != 2 ? item.checkGroupName : (item
  284. .department.map(v => v.deptClassName)).join(','),
  285. topic: item.topic == 0 ? true : false,
  286. situationStatus: item.situationStatus,
  287. situationID: item.id,
  288. toDistributeCount: item.toDistributeCount,
  289. });
  290. });
  291. },
  292. toLower() {
  293. uni.showToast({
  294. title: "加载中....",
  295. icon: "loading",
  296. duration: 2000,
  297. });
  298. let count = this.situationList.length;
  299. if (this.totalCount != count) {
  300. this.page++;
  301. let data = {
  302. pageNum: this.page,
  303. pageSize: 300,
  304. };
  305. // this.getSituationList(data, (data) => {
  306. // this.createSituationList(data.list);
  307. // let hiId = uni.getStorageSync("hiId");
  308. // let user = uni.getStorageSync("id");
  309. // let permission = uni.getStorageSync("nowPermission");
  310. // this.initParams = {
  311. // hiId,
  312. // user,
  313. // permission
  314. // };
  315. // this.isInitWs && this.initWebsocket(hiId, user, permission);
  316. // });
  317. } else {
  318. uni.showToast({
  319. title: "没有更多数据了",
  320. icon: "none",
  321. duration: 1000,
  322. });
  323. }
  324. },
  325. // toMessagePage() {
  326. // // this.messageType = false;
  327. // uni.navigateTo({
  328. // url: `/pages/messages/messages`,
  329. // });
  330. // },
  331. init(isInitWs) {
  332. this.isInitWs = isInitWs;
  333. this.initSituationList();
  334. },
  335. initWebsocket(hiId, user, permission) {
  336. websocket.url = wsURL(hiId, user, permission);
  337. websocket.createWebSocket(this.resolverWsData.bind(this));
  338. },
  339. // 解析websocket返回数据
  340. resolverWsData(type) {
  341. let types = JSON.parse(type);
  342. switch (types.type) {
  343. case "TO_READ":
  344. this.messageType = true;
  345. break;
  346. default:
  347. this.messageType = false;
  348. break;
  349. }
  350. },
  351. initSituationList() {
  352. let data = {
  353. pageNum: 1,
  354. pageSize: 300,
  355. };
  356. this.getSituationList(data, (data) => {
  357. this.totalCount = data.totalCount;
  358. this.createSituationList(data.list);
  359. this.copied_situationList = data.list;
  360. let hiId = uni.getStorageSync("hiId");
  361. let user = uni.getStorageSync("id");
  362. let permission = uni.getStorageSync("nowPermission");
  363. this.initParams = {
  364. hiId,
  365. user,
  366. permission
  367. };
  368. this.isInitWs && this.initWebsocket(hiId, user, permission);
  369. });
  370. },
  371. // messStatus(){
  372. // let num = 1;
  373. // let timer = setInterval(()=>{
  374. // this.$store.dispatch({
  375. // type: "calendar/commActions",
  376. // payload: {
  377. // key: "messagesList",
  378. // data: {
  379. // pageNum: num,
  380. // pageSize: 100,
  381. // },
  382. // },
  383. // }).then((res)=>{
  384. // if(res && res.list.length == 0){
  385. // clearInterval(timer)
  386. // }else if(res && res.list.length != 0){
  387. // res.list.map((item)=>{
  388. // if(!item.readStatus){
  389. // this.messageType = true;
  390. // return;
  391. // }
  392. // })
  393. // }
  394. // })
  395. // num++;
  396. // },200)
  397. // }
  398. },
  399. };
  400. </script>
  401. <style lang="less">
  402. .situationsCenter-page {
  403. height: 100%;
  404. .navbar {
  405. background-color: #ffffff;
  406. }
  407. .calender-remind {
  408. width: 62.5rpx;
  409. height: 62.5rpx;
  410. position: fixed;
  411. top: 20rpx;
  412. right: 25rpx;
  413. background: rgba(255, 255, 255, 0.95);
  414. border-radius: 50%;
  415. z-index: 2;
  416. image {
  417. margin-left: 17.5rpx;
  418. margin-top: 16.87rpx;
  419. width: 27.5rpx;
  420. height: 28.75rpx;
  421. }
  422. }
  423. .search-box {
  424. position: fixed;
  425. top: 20rpx;
  426. left: 25rpx;
  427. z-index: 2;
  428. .search-model {
  429. height: 62.5rpx;
  430. width: 62.5rpx;
  431. background-color: #ffffff;
  432. text-align: center;
  433. border-radius: 50%;
  434. box-shadow: 0px 10px 10px 0px rgba(217, 221, 228, 0.5);
  435. border: 1px solid #e6eaf2;
  436. opacity: 0.85;
  437. .search-pic {
  438. width: 27.5rpx;
  439. height: 27.5rpx;
  440. margin-top: 17.5rpx;
  441. }
  442. }
  443. .search-bar {
  444. background-color: #ffffff;
  445. width: 700rpx;
  446. height: 62.5rpx;
  447. top: 0rpx;
  448. position: absolute;
  449. z-index: 2;
  450. .search-item {
  451. background-color: #ffffff;
  452. width: 593.75rpx;
  453. height: 62.5rpx;
  454. float: left;
  455. border-radius: 6.25rpx;
  456. border-right: 1.25rpx solid #f0f2f7;
  457. ;
  458. .search-pic {
  459. width: 21.87rpx;
  460. height: 21.87rpx;
  461. margin-left: 12.5rpx;
  462. margin-top: 20.62rpx;
  463. float: left;
  464. }
  465. .searh-input {
  466. background-color: #ffffff;
  467. width: 525rpx;
  468. height: 55rpx;
  469. font-size: 22.5rpx;
  470. float: right;
  471. margin-top: 3.75rpx;
  472. margin-left: 3.12rpx;
  473. }
  474. .text-clear {
  475. width: 21.87rpx;
  476. height: 21.87rpx;
  477. float: right;
  478. margin-top: 20.62rpx;
  479. margin-right: 6.25rpx;
  480. }
  481. }
  482. .cancel-text {
  483. font-size: 22.5rpx;
  484. line-height: 62.5rpx;
  485. color: #a1a7b3;
  486. margin-right: 31.25rpx;
  487. float: right;
  488. }
  489. }
  490. }
  491. .situation-list {
  492. position: relative;
  493. height: 100%;
  494. .scroll-box {
  495. width: 100%;
  496. height: calc(100% - 87.5rpx);
  497. .content {
  498. display: flex;
  499. flex-flow: row wrap;
  500. padding-bottom: 100rpx;
  501. .situation {
  502. position: relative;
  503. height: 187.5rpx;
  504. width: 337.5rpx;
  505. background: #ffffff;
  506. box-shadow: 0px 6px 20px 0px rgba(0, 13, 51, 0.1);
  507. border-radius: 8px;
  508. margin-left: 25rpx;
  509. margin-top: 25rpx;
  510. // overflow: hidden;
  511. .Mark {
  512. position: absolute;
  513. top: 0;
  514. right: 0;
  515. font-size: 15rpx;
  516. padding-left: 20rpx;
  517. padding-right: 10rpx;
  518. color: #ffffff;
  519. border-radius: 0px 8rpx 0px 25rpx;
  520. background: rgba(255, 51, 85, 1);
  521. &.case {
  522. background: rgba(0, 204, 170, 1);
  523. }
  524. &.system {
  525. background: rgba(61, 121, 242, 1);
  526. }
  527. }
  528. .topMark {
  529. position: absolute;
  530. top: 0;
  531. right: 0;
  532. padding: 3.75rpx 12.5rpx;
  533. font-size: 13.75rpx;
  534. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  535. font-weight: 500;
  536. color: #FFFFFF;
  537. background: #FF6680;
  538. border-radius: 0px 5rpx 0px 20rpx;
  539. &.doing {
  540. background-color: rgba(255, 204, 102, 1);
  541. }
  542. &.wait {
  543. background-color: rgba(102, 179, 255, 1);
  544. }
  545. &.complete {
  546. background-color: rgba(173, 184, 204, 1);
  547. }
  548. }
  549. .situation-topic {
  550. width: 62.5rpx;
  551. height: 25rpx;
  552. float: right;
  553. }
  554. .title {
  555. height: 22.5rpx;
  556. margin-left: 20rpx;
  557. margin-top: 25rpx;
  558. display: flex;
  559. align-items: center;
  560. .title-name {
  561. width: 300rpx;
  562. font-size: 22.5rpx;
  563. font-family: SourceHanSansCN-Bold, SourceHanSansCN;
  564. font-weight: bold;
  565. color: #292c33;
  566. overflow: hidden; //超出的文本隐藏
  567. text-overflow: ellipsis; //溢出用省略号显示
  568. white-space: nowrap; //溢出不换行
  569. }
  570. }
  571. .check-group {
  572. margin-left: 20rpx;
  573. margin-top: 15rpx;
  574. margin-bottom: 25rpx;
  575. height: 17.5rpx;
  576. display: flex;
  577. align-items: center;
  578. .group-text {
  579. font-size: 17.5rpx;
  580. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  581. font-weight: 400;
  582. color: #666e80;
  583. }
  584. }
  585. .row {
  586. margin-left: 20rpx;
  587. margin-bottom: 17.5rpx;
  588. display: flex;
  589. align-items: center;
  590. height: 20rpx;
  591. .situation-check {
  592. width: 20rpx;
  593. height: 20rpx;
  594. }
  595. .situation-time {
  596. width: 20rpx;
  597. height: 20rpx;
  598. }
  599. .text {
  600. font-size: 20rpx;
  601. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  602. font-weight: 400;
  603. color: #292c33;
  604. margin-left: 11.25rpx;
  605. }
  606. }
  607. }
  608. }
  609. }
  610. }
  611. .situaions-add {
  612. position: fixed;
  613. right: 25rpx;
  614. bottom: 130rpx;
  615. .add-pic {
  616. width: 75rpx;
  617. height: 75rpx;
  618. }
  619. }
  620. }
  621. </style>