situationsCenter.vue 16 KB

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