checkMainPoints.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. <template>
  2. <view class="checkMainPoints">
  3. <tm-top-menu>
  4. <view class="top-search">
  5. <view class="search">
  6. <input confirm-type="search" @input="filterFromName" placeholder="搜索查核要点或查核项" />
  7. <image src="../../static/search.png"></image>
  8. </view>
  9. <view class="top-btn-wrap">
  10. <view class="btn-list" v-if="nowPermission == 3">
  11. <com-button v-for="(item, index) in btnArr" :btnText="item.label"
  12. :type="active === item.id ? 'pramary':'default'" v-on:btnClick="btnClick(item.id)" />
  13. </view>
  14. <view class="select-wrap" v-else-if="nowPermission == 2 || nowPermission == 1"
  15. @click="toggleModal(!showModal)">
  16. <text>{{getCheckPointName}}</text>
  17. <image :src="`../../static/${showModal?'open':'close'}-icon.png`"></image>
  18. </view>
  19. </view>
  20. </view>
  21. </tm-top-menu>
  22. <tm-modal v-show="showModal" v-on:click="toggleModal(false)">
  23. <view class="content-list">
  24. <view class="list-item" v-for="(item, index) in point"
  25. :class="{active: checkPointId === item.checkPointId}" @click="checkPointHandle(item.checkPointId)">
  26. <text>{{item.checkPointName}}</text>
  27. <image class="check-img" v-if="checkPointId === item.checkPointId"
  28. src="../../static/checkStatus.png"></image>
  29. </view>
  30. </view>
  31. </tm-modal>
  32. <scroll-view @scroll="scrollHandle" scroll-y="true" :class="(detailList.length>0&&active != 2&&finishedStatus != 1)?'scroll-Y':'scroll-Y noBtn'" >
  33. <view class="list" v-for="(item, index) in detailList" :key="index">
  34. <view class="title" v-if="item.responseList.length > 0">查核要点:{{item.checkPointName}}</view>
  35. <view class="item" v-for="(child, n) in item.responseList" @click="childClick(child,item.checkPointId)"
  36. :key="n">
  37. <view class="top-box">
  38. <view class="top-box-left">
  39. <view class="index-icon">{{n + 1}}</view>
  40. <text>{{child.checkItemName}}</text>
  41. <!-- <text>ICU病房查看危重病人的抢救全过程(访谈)ICU病房查看危重病人的抢救全过程(访谈)ICU病房查看危重病人的抢救全过程(访谈)的抢救全过程(访谈)</text> -->
  42. </view>
  43. <image src="../../static/tuli.png"
  44. @tap.stop="goLegendDetails($event ,child.checkItemId, item.checkPointId)"></image>
  45. </view>
  46. <view class="children">
  47. <view class="child">
  48. <text>{{child.deptName || '--'}}</text>
  49. <text>查核单位</text>
  50. </view>
  51. <view class="child">
  52. <text>{{child.checkModelName || '--'}}</text>
  53. <text>查核方式</text>
  54. </view>
  55. <view class="child">
  56. <text>{{child.lastResult || '--'}}</text>
  57. <text>上次结果</text>
  58. </view>
  59. <view class="child">
  60. <text>{{child.checkResult || '--'}}</text>
  61. <text>本次结果</text>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </scroll-view>
  67. <tm-callback-listpage />
  68. <view class="bottomBtnGroup">
  69. <view class="score">
  70. <view class="box">
  71. <text class="label">得分</text>
  72. <text class="currentScore">{{currentScore}}</text>
  73. </view>
  74. <view class="midLine"></view>
  75. <view class="box">
  76. <text class="label">总分</text>
  77. <text class="totalScore">{{totalScore}}</text>
  78. </view>
  79. </view>
  80. <view v-if="detailList.length>0&&active != 2&&finishedStatus != 1" @click="onkeyCheckHandle" class="botOneKeyCheck">完成</view>
  81. </view>
  82. <!-- <view v-if="detailList.length>0&&active != 2&&finishedStatus != 1" @click="onkeyCheckHandle" class="botOneKeyCheck">完成</view> -->
  83. </view>
  84. </template>
  85. <script>
  86. import {
  87. _stopPropagation
  88. } from "../../utils/compatible.js";
  89. export default {
  90. data() {
  91. return {
  92. btnArr: [{
  93. id: 0,
  94. label: '全部'
  95. },
  96. {
  97. id: 1,
  98. label: '未查核'
  99. },
  100. {
  101. id: 2,
  102. label: '已查核'
  103. },
  104. ],
  105. showModal: false,
  106. detailList: [],
  107. ifFromChildPage:false,
  108. copyDetailList: [],
  109. point: [{
  110. checkPointId: 'all',
  111. checkPointName: '全部要点'
  112. }],
  113. checkPointId: 'all',
  114. nowPermission: uni.getStorageSync('nowPermission'),
  115. active: 0,
  116. checkId: '',
  117. deptId: '',
  118. currentScrollHeight:0,
  119. finishedStatus:0,//所有计划里的查核项是否都以完成
  120. totalScore:0,
  121. currentScore:0,
  122. };
  123. },
  124. computed: {
  125. getCheckPointName() {
  126. let item = this.point.find((item) => item.checkPointId === this.checkPointId);
  127. return item ? item.checkPointName : '';
  128. },
  129. },
  130. onLoad: function({
  131. checkId,
  132. deptId,
  133. finishedStatus
  134. }) {
  135. this.deptId = deptId;
  136. this.checkId = checkId;
  137. this.finishedStatus = finishedStatus;
  138. this.checkTaskDetailList({
  139. deptId,
  140. checkId
  141. });
  142. },
  143. onShow: function() {
  144. const {checkMainPoints:{ifUpdate}} = this.$store.state;
  145. console.log({ifUpdate});
  146. if(ifUpdate){
  147. //页面重新拉取数据
  148. this.checkTaskDetailList({
  149. 'deptId':this.deptId,
  150. 'checkId':this.checkId
  151. });
  152. // uni.pageScrollTo({
  153. // scrollTop: this.currentScrollHeight,
  154. // duration: 300
  155. // });
  156. }
  157. },
  158. beforeDestroy(){
  159. this.ifFromChildPage=false;
  160. },
  161. methods: {
  162. //滚动监听事件,记录滚动高度
  163. scrollHandle(e){
  164. this.currentScrollHeight = e.detail.scrollTop;
  165. },
  166. //一键查核
  167. onkeyCheckHandle(){
  168. uni.showModal({
  169. title: '注意',
  170. content: '确定所有未填写查核结果项默认无缺失结果吗?',
  171. success:(res)=>{
  172. if (res.confirm) {
  173. console.log('用户点击确定');
  174. this.oneKeyCheckCommit();
  175. } else if (res.cancel) {
  176. console.log('用户点击取消');
  177. }
  178. }
  179. });
  180. },
  181. oneKeyCheckCommit(){
  182. let ids=[];
  183. console.log('this.detailList',this.detailList);
  184. this.detailList.forEach(item=>{
  185. // console.log(item.responseList);
  186. //筛选掉已查核项
  187. const temp = item.responseList.filter(v=>!v.checkResult);
  188. const arr = temp.map(v=>v.id);
  189. ids = ids.concat(arr);
  190. });
  191. this.$store.dispatch({
  192. type: 'checkMainPoints/commActions',
  193. key: 'oneKeyCheck',
  194. data: ids
  195. }).then(data=>{
  196. if(data){
  197. uni.showModal({
  198. title: '查核完成!',
  199. content: '',
  200. showCancel:false,
  201. success: function (res) {
  202. if (res.confirm) {
  203. console.log('用户点击确定');
  204. uni.navigateBack({
  205. delta: 1
  206. });
  207. }
  208. }
  209. });
  210. }
  211. });
  212. },
  213. btnClick(id) {
  214. // console.log({id});
  215. this.active = id;
  216. this.filterCompleteFlag(id);
  217. },
  218. checkTaskDetailList({
  219. checkId,
  220. deptId
  221. }) {
  222. this.dispatch('checkTaskDetailList', {
  223. checkId,
  224. deptId
  225. }).then((data) => {
  226. if (data) {
  227. console.log({data});
  228. const nowPermission = JSON.parse(uni.getStorageSync('nowPermission'));
  229. console.log({nowPermission});
  230. this.$store.commit('checkMainPoints/comChangeState',{key:'detailList',data:data.checkDetailMapResponses});
  231. if(!data.isBindResponsible&&data.checkDetailMapResponses.length>0&&nowPermission==3){
  232. //当未绑定当事人状态为false,可查核项大于0且当前角色是查核组员时
  233. uni.showModal({
  234. title: '提示',
  235. content: '目前未批量分配当事人,是否前往选择?',
  236. success:(res)=>{
  237. if (res.confirm) {
  238. uni.navigateTo({
  239. url: `/pages/responsibleList/responsibleList?deptId=${this.deptId}&isFromCheckMainPoints=true`,
  240. });
  241. } else if (res.cancel) {
  242. console.log('用户点击取消');
  243. }
  244. }
  245. });
  246. }
  247. this.detailList = data.checkDetailMapResponses;
  248. this.copyDetailList = data.checkDetailMapResponses;
  249. this.currentScore = data.getScore;
  250. this.totalScore = data.totalScore;
  251. data.checkDetailMapResponses.map(({
  252. checkPointId,
  253. checkPointName
  254. }) => {
  255. this.point.push({
  256. checkPointId,
  257. checkPointName
  258. });
  259. });
  260. }
  261. });
  262. },
  263. childClick(child, checkPointId) {
  264. // 查核者,管理员
  265. if (this.nowPermission == 1 || this.nowPermission == 3) {
  266. let str = '',
  267. that = this;
  268. if (child.checkResult&&!child.allowEdit) {
  269. // 当存在查核结果且不允许再修改时 跳转到查核项详情
  270. str = 'auditItemDetails/auditItemDetails';
  271. } else {
  272. if (this.nowPermission == 1) {
  273. uni.showModal({
  274. title: '提示',
  275. content: '请切换至查核者角色再进行查核操作!',
  276. showCancel: false
  277. });
  278. return;
  279. } else {
  280. // 跳转到查核结果提交
  281. str = 'mainPointsDetail/mainPointsDetail';
  282. }
  283. }
  284. uni.navigateTo({
  285. url: `/pages/${str}?id=${child.id}&checkPointId=${checkPointId}&checkItemId=${child.checkItemId}`,
  286. success: function(res) {
  287. const currentGroup = that.detailList.filter(item => item.checkPointId ==
  288. checkPointId);
  289. // 通过eventChannel向被打开页面传送数据
  290. res.eventChannel.emit('acceptDataFromOpenerPage', {
  291. data: currentGroup
  292. });
  293. }
  294. });
  295. }
  296. },
  297. toggleModal(flage) {
  298. this.showModal = flage;
  299. },
  300. checkPointHandle(id) {
  301. this.checkPointId = id;
  302. if (id === 'all') {
  303. this.detailList = [...this.copyDetailList];
  304. } else {
  305. this.detailList = this.copyDetailList
  306. .filter((item) => item.checkPointId === id);
  307. }
  308. },
  309. filterCompleteFlag(btnId) {
  310. if (btnId === 0) {
  311. this.detailList = [...this.copyDetailList];
  312. } else {
  313. let completeFlag = btnId === 1 ? false : true;
  314. this.detailList = this.copyDetailList.map((item) => {
  315. return {
  316. ...item,
  317. responseList: item.responseList
  318. .filter((child) => child.completeFlag === completeFlag)
  319. }
  320. });
  321. }
  322. },
  323. filterFromName(e) {
  324. const {
  325. value
  326. } = e.detail;
  327. if (value === '') {
  328. this.detailList = [...this.copyDetailList];
  329. } else {
  330. this.detailList = [];
  331. this.copyDetailList.map((item) => {
  332. let responseList = item.responseList
  333. .filter((child) => child.checkItemName.indexOf(value) >= 0);
  334. if (item.checkPointName.indexOf(value) >= 0) {
  335. this.detailList.push({
  336. ...item
  337. });
  338. } else if (responseList.length > 0) {
  339. this.detailList.push({
  340. ...item,
  341. responseList
  342. });
  343. }
  344. });
  345. }
  346. },
  347. goLegendDetails(e, checkItemId, checkPointId) {
  348. _stopPropagation(e);
  349. //跳转到图例详情
  350. uni.navigateTo({
  351. url: `/pages/legendDetails/legendDetails?checkItemId=${checkItemId}&checkPointId=${checkPointId}`
  352. });
  353. },
  354. dispatch(key, data) {
  355. return this.$store.dispatch({
  356. type: 'checkList/commActions',
  357. key,
  358. data
  359. });
  360. },
  361. }
  362. }
  363. </script>
  364. <style lang="less">
  365. .checkMainPoints {
  366. position: relative;
  367. padding-top: 105rpx;
  368. height: 100%;
  369. font-size: 22.5rpx;
  370. line-height: 33.75rpx;
  371. background-color: #F5F6FA;
  372. .botOneKeyCheck {
  373. text-align: center;
  374. height: 75rpx;
  375. width: 100%;
  376. line-height: 75rpx;
  377. font-size: 22.5rpx;
  378. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  379. font-weight: 400;
  380. color: #FFFFFF;
  381. background: #3377FF;
  382. }
  383. .bottomBtnGroup {
  384. position: fixed;
  385. width: 100%;
  386. left:0;
  387. bottom: 0;
  388. display: flex;
  389. flex-direction: row;
  390. border-top:1px solid #DADEE6;
  391. background-color: #fff;
  392. .score {
  393. display: flex;
  394. width: 50%;
  395. flex-direction: row;
  396. justify-content: center;
  397. align-items: center;
  398. height: 75rpx;
  399. .box {
  400. width: 50%;
  401. text-align: center;
  402. white-space: nowrap;
  403. vertical-align:bottom;
  404. .label {
  405. color: #666E80;
  406. font-size: 17.5rpx;
  407. margin-right: 10rpx;
  408. }
  409. .currentScore {
  410. font-size:30rpx;
  411. font-weight: bold;
  412. color: #3377FF;
  413. }
  414. .totalScore {
  415. font-size:30rpx;
  416. font-weight: bold;
  417. color: #292C33;
  418. }
  419. }
  420. .midLine {
  421. height:17.5rpx;
  422. border-left: 0.62rpx solid #DADEE6;
  423. }
  424. }
  425. .botOneKeyCheck {
  426. text-align: center;
  427. height: 75rpx;
  428. flex-grow: 1;
  429. line-height: 75rpx;
  430. font-size: 22.5rpx;
  431. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  432. font-weight: 400;
  433. color: #FFFFFF;
  434. background: #3377FF;
  435. }
  436. }
  437. .top-search {
  438. display: flex;
  439. flex-direction: row;
  440. align-items: center;
  441. padding: 25rpx;
  442. background-color: #fff;
  443. box-shadow: 0 3.75rpx 12.5rpx 0 rgba(0, 13, 51, 0.1);
  444. .search {
  445. position: relative;
  446. width: 100%;
  447. height: 55rpx;
  448. line-height: 55rpx;
  449. background-color: #F0F2F7;
  450. input {
  451. padding: 0 45rpx 0 15rpx;
  452. height: 55rpx;
  453. line-height: 55rpx;
  454. font-size: 22.5rpx;
  455. }
  456. image {
  457. position: absolute;
  458. top: 16.87rpx;
  459. right: 15rpx;
  460. width: 21.25rpx;
  461. height: 21.25rpx;
  462. }
  463. }
  464. .top-btn-wrap {
  465. padding-left: 25rpx;
  466. .btn-list {
  467. display: flex;
  468. flex-direction: row;
  469. .com-button {
  470. margin-left: 5rpx;
  471. &:first-child {
  472. margin-left: 0;
  473. }
  474. }
  475. }
  476. .select-wrap {
  477. display: flex;
  478. flex-direction: row;
  479. align-items: center;
  480. white-space: nowrap;
  481. image {
  482. margin-left: 9.37rpx;
  483. width: 12.5rpx;
  484. height: 12.5rpx;
  485. }
  486. }
  487. }
  488. }
  489. .content-list {
  490. padding-top: 105rpx;
  491. width: 100%;
  492. background-color: #fff;
  493. .list-item {
  494. display: flex;
  495. flex-direction: row;
  496. justify-content: space-between;
  497. align-items: center;
  498. border-bottom: 1px solid #DADEE6;
  499. padding: 0 25rpx;
  500. width: 100%;
  501. height: 87.5rpx;
  502. font-size: 22.5rpx;
  503. line-height: 33.75rpx;
  504. color: #292C33;
  505. .check-img {
  506. float: right;
  507. width: 19.37rpx;
  508. height: 14.37rpx;
  509. }
  510. &.active {
  511. color: #3377FF;
  512. }
  513. }
  514. }
  515. .scroll-Y {
  516. height: calc(100% - 75rpx);
  517. &.noBtn {
  518. height: 100%;
  519. }
  520. }
  521. .list {
  522. .title {
  523. padding-left: 25rpx;
  524. width: 100%;
  525. height: 62.5rpx;
  526. line-height: 62.5rpx;
  527. color: #666F80;
  528. }
  529. .item {
  530. margin-top: 15rpx;
  531. padding: 25rpx 0;
  532. min-height: 167.5rpx;
  533. background-color: #fff;
  534. &:nth-child(2) {
  535. margin-top: 0;
  536. }
  537. .top-box {
  538. display: flex;
  539. flex-direction: row;
  540. justify-content: space-between;
  541. align-items: center;
  542. .top-box-left {
  543. display: flex;
  544. flex-direction: row;
  545. width: calc(100% - 55rpx);
  546. .index-icon {
  547. margin-right: 15rpx;
  548. border-radius: 0 62.5rpx 62.5rpx 0;
  549. width: 50rpx;
  550. height: 35rpx;
  551. line-height: 35rpx;
  552. text-align: center;
  553. color: #fff;
  554. background-color: #66B2FE;
  555. }
  556. >text {
  557. display: -webkit-box;
  558. overflow: hidden;
  559. width: calc(100% - 65rpx);
  560. text-overflow: ellipsis;
  561. -webkit-line-clamp: 2;
  562. /*! autoprefixer: off */
  563. -webkit-box-orient: vertical;
  564. }
  565. }
  566. image {
  567. margin-right: 15rpx;
  568. width: 40rpx;
  569. height: 40rpx;
  570. }
  571. }
  572. .children {
  573. display: flex;
  574. flex-direction: row;
  575. align-items: center;
  576. margin-top: 18.75rpx;
  577. .child {
  578. display: flex;
  579. flex-direction: column;
  580. justify-content: center;
  581. align-items: center;
  582. flex: 1;
  583. border-right: 1px solid #DADEE6;
  584. text {
  585. font-weight: 500;
  586. &:last-child {
  587. font-size: 17.5rpx;
  588. line-height: 26.25rpx;
  589. color: #7A8599;
  590. font-weight: 400;
  591. }
  592. }
  593. &:last-child {
  594. border-right: 0;
  595. }
  596. }
  597. }
  598. }
  599. }
  600. }
  601. </style>