checkMainPoints.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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-y="true" class="scroll-Y" >
  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 v-if="detailList.length>0&&active != 2&&finishedStatus != 1" @click="onkeyCheckHandle" class="botOneKeyCheck">完成</view>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. _stopPropagation
  74. } from "../../utils/compatible.js";
  75. export default {
  76. data() {
  77. return {
  78. btnArr: [{
  79. id: 0,
  80. label: '全部'
  81. },
  82. {
  83. id: 1,
  84. label: '未查核'
  85. },
  86. {
  87. id: 2,
  88. label: '已查核'
  89. },
  90. ],
  91. showModal: false,
  92. detailList: [],
  93. ifFromChildPage:false,
  94. copyDetailList: [],
  95. point: [{
  96. checkPointId: 'all',
  97. checkPointName: '全部要点'
  98. }],
  99. checkPointId: 'all',
  100. nowPermission: uni.getStorageSync('nowPermission'),
  101. active: 0,
  102. checkId: '',
  103. deptId: '',
  104. finishedStatus:0,//所有计划里的查核项是否都以完成
  105. };
  106. },
  107. computed: {
  108. getCheckPointName() {
  109. let item = this.point.find((item) => item.checkPointId === this.checkPointId);
  110. return item ? item.checkPointName : '';
  111. },
  112. },
  113. onLoad: function({
  114. checkId,
  115. deptId,
  116. finishedStatus
  117. }) {
  118. this.deptId = deptId;
  119. this.checkId = checkId;
  120. this.finishedStatus = finishedStatus;
  121. this.checkTaskDetailList({
  122. deptId,
  123. checkId
  124. });
  125. },
  126. onShow: function() {
  127. if(this.ifFromChildPage){
  128. //页面重新拉取数据
  129. this.checkTaskDetailList({
  130. 'deptId':this.deptId,
  131. 'checkId':this.checkId
  132. });
  133. }
  134. },
  135. beforeDestroy(){
  136. this.ifFromChildPage=false;
  137. },
  138. methods: {
  139. //一键查核
  140. onkeyCheckHandle(){
  141. uni.showModal({
  142. title: '注意',
  143. content: '确定所有未填写查核结果项默认无缺失结果吗?',
  144. success:(res)=>{
  145. if (res.confirm) {
  146. console.log('用户点击确定');
  147. this.oneKeyCheckCommit();
  148. } else if (res.cancel) {
  149. console.log('用户点击取消');
  150. }
  151. }
  152. });
  153. },
  154. oneKeyCheckCommit(){
  155. let ids=[];
  156. console.log('this.detailList',this.detailList);
  157. this.detailList.forEach(item=>{
  158. // console.log(item.responseList);
  159. //筛选掉已查核项
  160. const temp = item.responseList.filter(v=>!v.checkResult);
  161. const arr = temp.map(v=>v.id);
  162. ids = ids.concat(arr);
  163. });
  164. this.$store.dispatch({
  165. type: 'checkMainPoints/commActions',
  166. key: 'oneKeyCheck',
  167. data: ids
  168. }).then(data=>{
  169. if(data){
  170. uni.showModal({
  171. title: '查核完成!',
  172. content: '',
  173. showCancel:false,
  174. success: function (res) {
  175. if (res.confirm) {
  176. console.log('用户点击确定');
  177. uni.navigateBack({
  178. delta: 1
  179. });
  180. }
  181. }
  182. });
  183. }
  184. });
  185. },
  186. btnClick(id) {
  187. // console.log({id});
  188. this.active = id;
  189. this.filterCompleteFlag(id);
  190. },
  191. checkTaskDetailList({
  192. checkId,
  193. deptId
  194. }) {
  195. this.dispatch('checkTaskDetailList', {
  196. checkId,
  197. deptId
  198. }).then((data) => {
  199. if (data) {
  200. // console.log({data});
  201. this.detailList = data;
  202. this.copyDetailList = data;
  203. data.map(({
  204. checkPointId,
  205. checkPointName
  206. }) => {
  207. this.point.push({
  208. checkPointId,
  209. checkPointName
  210. });
  211. });
  212. }
  213. });
  214. },
  215. childClick(child, checkPointId) {
  216. // 查核者,管理员
  217. if (this.nowPermission == 1 || this.nowPermission == 3) {
  218. let str = '',
  219. that = this;
  220. if (child.checkResult) {
  221. // 跳转到查核项详情
  222. str = 'auditItemDetails/auditItemDetails';
  223. } else {
  224. if (this.nowPermission == 1) {
  225. uni.showModal({
  226. title: '提示',
  227. content: '请切换至查核者角色再进行查核操作!',
  228. showCancel: false
  229. });
  230. return;
  231. } else {
  232. // 跳转到查核结果提交
  233. str = 'mainPointsDetail/mainPointsDetail';
  234. }
  235. }
  236. uni.navigateTo({
  237. url: `/pages/${str}?id=${child.id}&checkPointId=${checkPointId}&checkItemId=${child.checkItemId}`,
  238. success: function(res) {
  239. const currentGroup = that.detailList.filter(item => item.checkPointId ==
  240. checkPointId);
  241. // 通过eventChannel向被打开页面传送数据
  242. res.eventChannel.emit('acceptDataFromOpenerPage', {
  243. data: currentGroup
  244. });
  245. }
  246. });
  247. }
  248. },
  249. toggleModal(flage) {
  250. this.showModal = flage;
  251. },
  252. checkPointHandle(id) {
  253. this.checkPointId = id;
  254. if (id === 'all') {
  255. this.detailList = [...this.copyDetailList];
  256. } else {
  257. this.detailList = this.copyDetailList
  258. .filter((item) => item.checkPointId === id);
  259. }
  260. },
  261. filterCompleteFlag(btnId) {
  262. if (btnId === 0) {
  263. this.detailList = [...this.copyDetailList];
  264. } else {
  265. let completeFlag = btnId === 1 ? false : true;
  266. this.detailList = this.copyDetailList.map((item) => {
  267. return {
  268. ...item,
  269. responseList: item.responseList
  270. .filter((child) => child.completeFlag === completeFlag)
  271. }
  272. });
  273. }
  274. },
  275. filterFromName(e) {
  276. const {
  277. value
  278. } = e.detail;
  279. if (value === '') {
  280. this.detailList = [...this.copyDetailList];
  281. } else {
  282. this.detailList = [];
  283. this.copyDetailList.map((item) => {
  284. let responseList = item.responseList
  285. .filter((child) => child.checkItemName.indexOf(value) >= 0);
  286. if (item.checkPointName.indexOf(value) >= 0) {
  287. this.detailList.push({
  288. ...item
  289. });
  290. } else if (responseList.length > 0) {
  291. this.detailList.push({
  292. ...item,
  293. responseList
  294. });
  295. }
  296. });
  297. }
  298. },
  299. goLegendDetails(e, checkItemId, checkPointId) {
  300. _stopPropagation(e);
  301. //跳转到图例详情
  302. uni.navigateTo({
  303. url: `/pages/legendDetails/legendDetails?checkItemId=${checkItemId}&checkPointId=${checkPointId}`
  304. });
  305. },
  306. dispatch(key, data) {
  307. return this.$store.dispatch({
  308. type: 'checkList/commActions',
  309. key,
  310. data
  311. });
  312. },
  313. }
  314. }
  315. </script>
  316. <style lang="less">
  317. .checkMainPoints {
  318. position: relative;
  319. padding-top: 105rpx;
  320. height: 100%;
  321. font-size: 22.5rpx;
  322. line-height: 33.75rpx;
  323. background-color: #F5F6FA;
  324. .botOneKeyCheck {
  325. text-align: center;
  326. height: 75rpx;
  327. line-height: 75rpx;
  328. font-size: 22.5rpx;
  329. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  330. font-weight: 400;
  331. color: #FFFFFF;
  332. background: #3377FF;
  333. }
  334. .top-search {
  335. display: flex;
  336. flex-direction: row;
  337. align-items: center;
  338. padding: 25rpx;
  339. background-color: #fff;
  340. box-shadow: 0 3.75rpx 12.5rpx 0 rgba(0, 13, 51, 0.1);
  341. .search {
  342. position: relative;
  343. width: 100%;
  344. height: 55rpx;
  345. line-height: 55rpx;
  346. background-color: #F0F2F7;
  347. input {
  348. padding: 0 45rpx 0 15rpx;
  349. height: 55rpx;
  350. line-height: 55rpx;
  351. font-size: 22.5rpx;
  352. }
  353. image {
  354. position: absolute;
  355. top: 16.87rpx;
  356. right: 15rpx;
  357. width: 21.25rpx;
  358. height: 21.25rpx;
  359. }
  360. }
  361. .top-btn-wrap {
  362. padding-left: 25rpx;
  363. .btn-list {
  364. display: flex;
  365. flex-direction: row;
  366. .com-button {
  367. margin-left: 5rpx;
  368. &:first-child {
  369. margin-left: 0;
  370. }
  371. }
  372. }
  373. .select-wrap {
  374. display: flex;
  375. flex-direction: row;
  376. align-items: center;
  377. white-space: nowrap;
  378. image {
  379. margin-left: 9.37rpx;
  380. width: 12.5rpx;
  381. height: 12.5rpx;
  382. }
  383. }
  384. }
  385. }
  386. .content-list {
  387. padding-top: 105rpx;
  388. width: 100%;
  389. background-color: #fff;
  390. .list-item {
  391. display: flex;
  392. flex-direction: row;
  393. justify-content: space-between;
  394. align-items: center;
  395. border-bottom: 1px solid #DADEE6;
  396. padding: 0 25rpx;
  397. width: 100%;
  398. height: 87.5rpx;
  399. font-size: 22.5rpx;
  400. line-height: 33.75rpx;
  401. color: #292C33;
  402. .check-img {
  403. float: right;
  404. width: 19.37rpx;
  405. height: 14.37rpx;
  406. }
  407. &.active {
  408. color: #3377FF;
  409. }
  410. }
  411. }
  412. .scroll-Y {
  413. height: calc(100% - 75rpx);
  414. }
  415. .list {
  416. .title {
  417. padding-left: 25rpx;
  418. width: 100%;
  419. height: 62.5rpx;
  420. line-height: 62.5rpx;
  421. color: #666F80;
  422. }
  423. .item {
  424. margin-top: 15rpx;
  425. padding: 25rpx 0;
  426. min-height: 167.5rpx;
  427. background-color: #fff;
  428. &:nth-child(2) {
  429. margin-top: 0;
  430. }
  431. .top-box {
  432. display: flex;
  433. flex-direction: row;
  434. justify-content: space-between;
  435. align-items: center;
  436. .top-box-left {
  437. display: flex;
  438. flex-direction: row;
  439. width: calc(100% - 55rpx);
  440. .index-icon {
  441. margin-right: 15rpx;
  442. border-radius: 0 62.5rpx 62.5rpx 0;
  443. width: 50rpx;
  444. height: 35rpx;
  445. line-height: 35rpx;
  446. text-align: center;
  447. color: #fff;
  448. background-color: #66B2FE;
  449. }
  450. >text {
  451. display: -webkit-box;
  452. overflow: hidden;
  453. width: calc(100% - 65rpx);
  454. text-overflow: ellipsis;
  455. -webkit-line-clamp: 2;
  456. /*! autoprefixer: off */
  457. -webkit-box-orient: vertical;
  458. }
  459. }
  460. image {
  461. margin-right: 15rpx;
  462. width: 40rpx;
  463. height: 40rpx;
  464. }
  465. }
  466. .children {
  467. display: flex;
  468. flex-direction: row;
  469. align-items: center;
  470. margin-top: 18.75rpx;
  471. .child {
  472. display: flex;
  473. flex-direction: column;
  474. justify-content: center;
  475. align-items: center;
  476. flex: 1;
  477. border-right: 1px solid #DADEE6;
  478. text {
  479. font-weight: 500;
  480. &:last-child {
  481. font-size: 17.5rpx;
  482. line-height: 26.25rpx;
  483. color: #7A8599;
  484. font-weight: 400;
  485. }
  486. }
  487. &:last-child {
  488. border-right: 0;
  489. }
  490. }
  491. }
  492. }
  493. }
  494. }
  495. </style>