situationDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <view class="detail-page">
  3. <tm-top-menu v-if="isAdmin">
  4. <button class="copy-btn" @click="editSituation('POST')">复制创建</button>
  5. </tm-top-menu>
  6. <view class="content-info">
  7. <view class="top-box">
  8. <view class="subscript">
  9. <!-- <image class="sub-pic" src="../../static/sDetail-subscript.png"></image> -->
  10. <text class="sub-text">{{topic}}</text>
  11. </view>
  12. <text class="name-text">{{name}}</text>
  13. <text class="time-text">| 情境起止时间:{{startDate}}~{{endDate}}</text>
  14. <text class="nextTime-text">| 下次查核时间:{{nextCheckTime}}</text>
  15. <text class="startEndTime-text" v-show="isStartEndTimeShow">| {{startEndTime}}</text>
  16. <text class="team-text">{{checkGroupName}}</text>
  17. </view>
  18. <view class="list-box">
  19. <view class="check-list" v-show="isCheckImproveShow" @click="gotoCheckPage">
  20. <image class="check-pic" src="../../static/check-list.png"></image>
  21. <text class="list-title">查核列表</text>
  22. <text class="list-info">{{checkStatus}}</text>
  23. </view>
  24. <view class="improve-list" v-show="isCheckImproveShow" @click="gotoImprovePage">
  25. <image class="improve-pic" src="../../static/improve-list.png"></image>
  26. <text class="list-title">改善列表</text>
  27. <text class="list-info">查看改善记录</text>
  28. </view>
  29. <view class="plan-list" v-show="isCheckLeader" @click="gotoPlanPage">
  30. <image class="check-pic" src="../../static/check-list.png"></image>
  31. <text class="list-title">计划列表</text>
  32. <text class="list-info">共{{planCount}}次查核计划,剩余{{toDistribute}}个待分配</text>
  33. </view>
  34. </view>
  35. <view class="info-box">
  36. <view class="text-box">
  37. <text class="info-text">{{description}}</text>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="button-box">
  42. <view class="btn-left btn-item" @click="delSituation" v-show="isAdmin">
  43. <text class="left-text">作废</text>
  44. </view>
  45. <view class="btn-right btn-item" @click="editSituation('PUT')" v-show="canEdit">
  46. <text class="right-text">编辑</text>
  47. </view>
  48. <view class="btn-center btn-item" v-show="isChecker" @click="startUnplanned">
  49. <text class="center-text">开始一次计划外查核</text>
  50. </view>
  51. <view class="btn-left btn-item" v-show="isUnplanned" @click="createCheck">
  52. <text class="left-text">新建一个计划外查核</text>
  53. </view>
  54. <view class="btn-right btn-item" v-show="isUnplanned" @click="startCheck">
  55. <text class="right-text">提前开始一个计划内查核</text>
  56. </view>
  57. </view>
  58. <popup ref="popup" :situationID="situationID"></popup>
  59. </view>
  60. </template>
  61. <script>
  62. import popup from './components/bottom-popup.vue';
  63. import {dateHandle} from "../../utils/dateHandle.js";
  64. export default {
  65. data() {
  66. return {
  67. nowPermission:'',//用户当前权限
  68. situationID:'',//情境id
  69. checkGroupName:'',//查核组名
  70. checkStatus:'',//查核状态
  71. name:'',//查核名
  72. description:'',//描述
  73. startDate:'',//查核开始时间
  74. endDate:'',//查核结束时间
  75. nextCheckTime:'',//下次查核时间
  76. topic:'',//个案或系统
  77. startEndTime:'',//距离情境开始或结束时间
  78. planCount:'',//总查核计划数
  79. toDistribute:'',//待分配计划数
  80. firstCheckTime:'',//首次查核时间
  81. isCheckImproveShow:false,//查核改善列表是否显示
  82. isStartEndTimeShow:false,//距离情境开始或结束时间是否显示
  83. isAdmin:false,//是否为管理员
  84. isCheckLeader:false,//是否为查核组长
  85. isChecker:false,//是否为查核者
  86. isUnplanned:false,//是否计划外查核
  87. checkFlag:'',//计划查核标志,是新建还是提前开始
  88. checkID:'',//新建查核计划时,计划列表中的前一个计划 id
  89. checkItemList:[],//时间区间包含当前时间的item
  90. checkGroupId: 0, // 查核组id
  91. }
  92. },
  93. computed: {
  94. canEdit: function() {
  95. return this.compareTime(this.firstCheckTime) && this.isAdmin;
  96. }
  97. },
  98. onLoad({ situationId }){ // situationId:情景id
  99. this.situationID=situationId;
  100. },
  101. created: function() {
  102. this.nowPermission=uni.getStorageSync('nowPermission');
  103. this.isAdmin=this.nowPermission==1?true:false;
  104. this.isCheckLeader=this.nowPermission==2?true:false;
  105. this.isChecker=this.nowPermission==3?true:false;
  106. this.isStartEndTimeShow=this.nowPermission==2||this.nowPermission==3?true:false;
  107. this.isCheckImproveShow=this.nowPermission==1||this.nowPermission==4||this.nowPermission==3?true:false;
  108. this.$store.dispatch({
  109. type: 'situationDetail/commActions',
  110. payload: {
  111. key: 'situationDetail',
  112. data:{
  113. id: this.situationID
  114. }
  115. }
  116. }).then((data) => {
  117. if (data) {
  118. this.name=data.name;
  119. this.description=data.description;
  120. this.startDate=data.startDate;
  121. this.endDate=data.endDate;
  122. this.nextCheckTime=data.nextCheckTime;
  123. this.checkGroupName=data.checkGroupName;
  124. this.topic=data.topic==0?'个案':'系统';
  125. this.checkStatus=data.checkStatus;
  126. this.startEndTime=data.startEndTime;
  127. this.planCount=data.planCount;
  128. this.toDistribute=data.toDistribute;
  129. this.firstCheckTime=data.firstCheckTime;
  130. this.checkGroupId = data.checkGroupId;
  131. }
  132. });
  133. },
  134. methods: {
  135. delSituation(){
  136. uni.showModal({
  137. title:'提示',
  138. content:'请确认是否作废此情境,作废的情境无法被还原',
  139. success: (res) => {
  140. if(res.confirm){
  141. this.$store.dispatch({
  142. type: 'situationDetail/commActions',
  143. payload: {
  144. key: 'situationDelete',
  145. data:{
  146. id:this.situationID
  147. }
  148. }
  149. }).then((data) => {
  150. if (data) {
  151. uni.showModal({
  152. title:'提示',
  153. content:'作废成功',
  154. showCancel: false,
  155. success: (res) => {
  156. uni.navigateTo({url: `/pages/situationsCenter/situationsCenter`});
  157. }
  158. });
  159. }
  160. });
  161. }
  162. }
  163. })
  164. },
  165. editSituation(type){
  166. let url=`/pages/creatingSituations/creatingSituations?id=${this.situationID}&type=${type}`;
  167. if(type === 'PUT') {
  168. let editEnable=this.compareTime(this.firstCheckTime);
  169. if(editEnable){
  170. uni.navigateTo({url});
  171. } else{
  172. uni.showModal({
  173. title:'提示',
  174. content:'已进行过一次查核,不可编辑',
  175. showCancel:false
  176. })
  177. }
  178. } else {
  179. uni.navigateTo({url});
  180. }
  181. },
  182. compareTime(time){
  183. let myDate=dateHandle.todayDate().replace(/-/g,"/");
  184. let firstCheckTime=time.replace(/-/g,"/");
  185. firstCheckTime=Date.parse(firstCheckTime);
  186. myDate=Date.parse(myDate);
  187. if(myDate>firstCheckTime){
  188. return false;
  189. }else{
  190. return true;
  191. }
  192. },
  193. gotoCheckPage(){
  194. //跳转到查核列表
  195. uni.navigateTo({
  196. url: `/pages/checkList/checkList?situationId=${this.situationID}`
  197. });
  198. },
  199. gotoImprovePage(){
  200. //跳转到改善列表
  201. uni.navigateTo({
  202. url: `/pages/improve-mission-list/improve-mission-list?situationId=${this.situationID}`
  203. });
  204. },
  205. gotoPlanPage(){
  206. //跳转到计划列表
  207. uni.navigateTo({
  208. url: `/pages/planList/planList?situationId=${this.situationID}&checkGroupId=${this.checkGroupId}`
  209. });
  210. },
  211. startUnplanned(){
  212. this.isUnplanned=true;
  213. this.isChecker=false;
  214. },
  215. startCheck(){
  216. this.$refs.popup.show();
  217. },
  218. createCheck(){
  219. this.$store.dispatch({
  220. type: 'situationDetail/commActions',
  221. payload: {
  222. key: 'planList',
  223. data:{
  224. situationId:this.situationID
  225. }
  226. }
  227. }).then((data) => {
  228. if (data) {
  229. data.map((item,index)=>{
  230. if(this.compareTime(item.startDate)==false||this.compareTime(item.endDate)){
  231. this.checkItemList.push(item);
  232. }
  233. else{
  234. return;
  235. }
  236. });
  237. this.$store.dispatch({
  238. type: 'situationDetail/commActions',
  239. payload: {
  240. key: 'createCheck',
  241. data:{
  242. checkId:this.checkItemList[0].id
  243. }
  244. }
  245. }).then((data) => {
  246. if(data){
  247. this.gotoCheckPage();
  248. }
  249. });
  250. }
  251. });
  252. }
  253. },
  254. components: {
  255. popup,
  256. }
  257. }
  258. </script>
  259. <style lang="less">
  260. .detail-page{
  261. margin-top: 50rpx;
  262. .copy-btn {
  263. border: 0;
  264. height: 50rpx;
  265. &::after {
  266. border: 0;
  267. }
  268. }
  269. .content-info{
  270. background-color: #FFFFFF;
  271. .top-box{
  272. width: 750rpx;
  273. height: 300rpx;
  274. background: linear-gradient(270deg, #3071F2 0%, #4C95FC 100%);
  275. .subscript{
  276. width: 84.37rpx;
  277. height: 35rpx;
  278. float: right;
  279. margin-top: 15rpx;
  280. text-align: center;
  281. background-image: url(../../static/sDetail-subscript.png);
  282. .sub-text{
  283. font-size: 17.5rpx;
  284. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  285. font-weight: 500;
  286. color: #2E6CE6;
  287. line-height: 35rpx;
  288. }
  289. }
  290. .name-text{
  291. font-size: 40rpx;
  292. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  293. font-weight: 400;
  294. color: #FFFFFF;
  295. float: left;
  296. margin-left: 50rpx;
  297. margin-top: 50rpx;
  298. margin-bottom: 31.25rpx;
  299. }
  300. .time-text{
  301. overflow: hidden;
  302. position: absolute;
  303. top: 115rpx;
  304. left: 55rpx;
  305. width: 70%;
  306. white-space: nowrap;
  307. font-size: 20rpx;
  308. font-weight: 400;
  309. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  310. text-overflow: ellipsis;
  311. color: #FFFFFF;
  312. }
  313. .nextTime-text{
  314. font-size: 20rpx;
  315. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  316. font-weight: 400;
  317. color: #FFFFFF;
  318. position: absolute;
  319. left: 55rpx;
  320. top: 155rpx;
  321. }
  322. .startEndTime-text{
  323. font-size: 20rpx;
  324. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  325. font-weight: 400;
  326. color: #FFFFFF;
  327. position: absolute;
  328. left: 55rpx;
  329. top: 195rpx;
  330. }
  331. .team-text{
  332. font-size: 20rpx;
  333. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  334. font-weight: 400;
  335. color: #FFFFFF;
  336. position: absolute;
  337. top: 115rpx;
  338. right: 50rpx;
  339. }
  340. }
  341. .list-box{
  342. width: 687.5rpx;
  343. height: 137.5rpx;
  344. background: #FFFFFF;
  345. box-shadow: 0px 10px 30px 0px rgba(0, 13, 51, 0.1);
  346. border-radius: 16px;
  347. position: absolute;
  348. left: 31.25rpx;
  349. top: 250rpx;
  350. .check-list{
  351. width: 225rpx;
  352. height: 97.5rpx;
  353. float: left;
  354. margin-top: 40rpx;
  355. margin-left: 81.25rpx;
  356. .check-pic{
  357. width: 38.75rpx;
  358. height: 41.87rpx;
  359. margin-top: 8.12rpx;
  360. }
  361. .list-title{
  362. font-size: 25rpx;
  363. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  364. font-weight: 400;
  365. color: #292C33;
  366. position: absolute;
  367. left: 145rpx;
  368. top: 40rpx;
  369. }
  370. .list-info{
  371. font-size: 17.5rpx;
  372. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  373. font-weight: 400;
  374. color: #666F80;
  375. position: absolute;
  376. left: 145rpx;
  377. top: 80rpx;
  378. }
  379. }
  380. .improve-list{
  381. width: 225rpx;
  382. height:97.5rpx;
  383. float: right;
  384. margin-top: 40rpx;
  385. margin-right: 81.25rpx;
  386. .improve-pic{
  387. width: 40rpx;
  388. height: 40rpx;
  389. margin-top: 8.12rpx;
  390. }
  391. .list-title{
  392. font-size: 25rpx;
  393. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  394. font-weight: 400;
  395. color: #292C33;
  396. position: absolute;
  397. top: 40rpx;
  398. left: 458.75rpx;
  399. }
  400. .list-info{
  401. font-size: 17.5rpx;
  402. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  403. font-weight: 400;
  404. color: #666F80;
  405. position: absolute;
  406. top: 80rpx;
  407. left: 458.75rpx;
  408. }
  409. }
  410. .plan-list{
  411. width: 225rpx;
  412. height: 97.5rpx;
  413. float: left;
  414. margin-top: 40rpx;
  415. margin-left: 81.25rpx;
  416. .check-pic{
  417. width: 38.75rpx;
  418. height: 41.87rpx;
  419. margin-top: 8.12rpx;
  420. }
  421. .list-title{
  422. font-size: 25rpx;
  423. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  424. font-weight: 400;
  425. color: #292C33;
  426. position: absolute;
  427. left: 145rpx;
  428. top: 40rpx;
  429. }
  430. .list-info{
  431. font-size: 17.5rpx;
  432. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  433. font-weight: 400;
  434. color: #666F80;
  435. position: absolute;
  436. left: 145rpx;
  437. top: 80rpx;
  438. }
  439. }
  440. }
  441. .info-box{
  442. height: 823.12rpx;
  443. .text-box{
  444. width: 687.5rpx;
  445. margin-top: 116.87rpx;
  446. margin-left: 31.25rpx;
  447. .info-text{
  448. font-size: 22.5rpx;
  449. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  450. font-weight: 400;
  451. color: #292C33;
  452. }
  453. }
  454. }
  455. }
  456. .button-box{
  457. display: flex;
  458. flex-direction: row;
  459. width: 750rpx;
  460. height: 75rpx;
  461. position: fixed;
  462. bottom: 0;
  463. .btn-item {
  464. flex: 1;
  465. }
  466. .btn-center{
  467. background: #3377FF;
  468. text-align: center;
  469. .center-text{
  470. font-size: 22.5rpx;
  471. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  472. font-weight: 400;
  473. color: #FFFFFF;
  474. line-height: 75rpx;
  475. }
  476. }
  477. .btn-left{
  478. // width: 375rpx;
  479. // height: 75rpx;
  480. background: #FFFFFF;
  481. // float: left;
  482. text-align: center;
  483. border: 0.62rpx solid #DADEE6;
  484. .left-text{
  485. font-size: 22.5rpx;
  486. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  487. font-weight: 400;
  488. color: #3377FF;
  489. line-height: 75rpx;
  490. }
  491. }
  492. .btn-right{
  493. // width: 375rpx;
  494. // height: 75rpx;
  495. background: #3377FF;
  496. // float: right;
  497. text-align: center;
  498. .right-text{
  499. font-size: 22.5rpx;
  500. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  501. font-weight: 400;
  502. color: #FFFFFF;
  503. line-height: 75rpx;
  504. }
  505. }
  506. }
  507. }
  508. </style>