situationsCenter.vue 16 KB

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