auditItemDetails.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <view class="auditItemDetails">
  3. <view class="top-box">
  4. <view class="icon-wrap">
  5. <image src="../../static/chahexiang-bg.png"></image>
  6. <text>查核项</text>
  7. </view>
  8. <image class="img-tuli" @click="goLegendDetails(detail.checkItemId)" src="../../static/tuli.png"></image>
  9. <view class="title-wrap">
  10. <text>{{detail.checkItemName}}</text>
  11. <text>{{detail.checkPointName}}</text>
  12. </view>
  13. <view class="children">
  14. <view class="child">
  15. <text>{{detail.deptName || '--'}}</text>
  16. <text>查核单位</text>
  17. </view>
  18. <view class="child">
  19. <text>{{detail.checkModelName || '--'}}</text>
  20. <text>查核方式</text>
  21. </view>
  22. <view class="child">
  23. <text>{{detail.lastResult || '--'}}</text>
  24. <text>上次结果</text>
  25. </view>
  26. <view class="child">
  27. <text>{{situationsCenter.currentSelectedSituation.systemSituationType == 2 ? detail.checkResultName :detail.checkResult || '--'}}</text>
  28. <text>本次结果</text>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="bottom-box" v-for="(item, index) in detail.checkResultRequestList" :key="index">
  33. <view class="box-item">
  34. <view>查核结果</view>
  35. <view>{{item.checkResultDescribe}}</view>
  36. </view>
  37. <view class="box-item">
  38. <view>查核时间</view>
  39. <view>{{detail.completeTimeStr}}</view>
  40. </view>
  41. <view class="box-item">
  42. <view>图片展示</view>
  43. <view class="img-wrap">
  44. <image @click="previewHandle(i,item.checkResultUrl)" mode="widthFix" v-for="(img, i) in getArr(item.checkResultUrl)" :key="i" :src="img"></image>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="bottomMenuGroup" v-if="ifShowBotBtn">
  49. <view class="menuBtn" @click="goToPrevPage">
  50. <image class="threeLineMenuIcon" src="/static/threeLineMenu.png"></image>
  51. </view>
  52. <view class="prevBtn" @click="switchItem(-1)">上一项</view>
  53. <view class="nextBtn" @click="switchItem(1)">下一项</view>
  54. </view>
  55. <view class="bottomBtn" @click="goToPrevPage" v-if="ifImprover">{{bottomBtnText}}</view>
  56. </view>
  57. </template>
  58. <script>
  59. /**
  60. * 查核项详情
  61. */
  62. // #ifdef APP
  63. const pictureModule = uni.requireNativePlugin("Wlake-PictureView")
  64. const modal = uni.requireNativePlugin('modal');
  65. // #endif
  66. import { mapState } from "vuex";
  67. import {
  68. _goBackFresh
  69. } from '../../utils/compatible.js';
  70. export default {
  71. data() {
  72. return {
  73. detail: {
  74. checkPointName: '',
  75. deptName: '',
  76. checkModelName: '',
  77. lastResult: '',
  78. checkResult: '',
  79. checkItemName: '',
  80. checkResultRequestList: [],
  81. checkPointId: ''
  82. },
  83. ifShowBotBtn: false,
  84. itemBelongGroup: [],
  85. itemId: '',
  86. ifImprover: true,
  87. bottomBtnText: '返回改善任务详情',
  88. };
  89. },
  90. computed: {
  91. ...mapState({
  92. situationsCenter: state => state.situationsCenter
  93. }),
  94. },
  95. onLoad: function({
  96. id,
  97. checkPointId,
  98. isZichaDucha,
  99. improveType
  100. }) {
  101. const pages = getCurrentPages();
  102. const reversedPageList = pages.reverse();
  103. if (reversedPageList && reversedPageList[1].route == 'pages/checkMainPoints/checkMainPoints') {
  104. this.bottomBtnText = '返回查核任务列表'
  105. }
  106. const roleNum = uni.getStorageSync('nowPermission');
  107. if (roleNum == 3) this.ifShowBotBtn = true;
  108. if (roleNum == 3) this.ifImprover = false;
  109. this.checkPointId = checkPointId;
  110. this.itemId = id;
  111. this.isZichaDucha = isZichaDucha;
  112. this.improveType = improveType;
  113. this.loadItemDetail(id);
  114. if (improveType == 0) {
  115. this.situationsCenter.currentSelectedSituation.systemSituationType=1;
  116. }
  117. else{
  118. this.situationsCenter.currentSelectedSituation.systemSituationType=2;
  119. }
  120. //只有查核展示底部按钮
  121. if (roleNum == 3) {
  122. //接收来自上个页面所传过来的数据
  123. const eventChannel = this.getOpenerEventChannel();
  124. eventChannel.on('acceptDataFromOpenerPage', (data) => {
  125. this.itemBelongGroup = data.data[0].responseList.map((item, index) => {
  126. return ({
  127. index: index,
  128. id: item['id'],
  129. })
  130. });
  131. //重新导航进页面,删除缓存并设置最新数据
  132. uni.removeStorageSync('itemBelongGroup');
  133. uni.setStorageSync('itemBelongGroup', this.itemBelongGroup);
  134. });
  135. //手动刷新页面,获取本地缓存
  136. const itemBelongGroup = uni.getStorageSync('itemBelongGroup');
  137. this.itemBelongGroup = itemBelongGroup;
  138. }
  139. },
  140. methods: {
  141. /**
  142. * @param {number} index
  143. * @param {string} imgUrls
  144. */
  145. previewHandle(index,imgUrls) {
  146. const picList = imgUrls ? imgUrls.split(',') : [] ;
  147. // #ifdef APP
  148. pictureModule.PictureViewerMain({
  149. 'listPic': picList,
  150. 'position':index, // 0 开始算 最大值为 listPic 数组数量 减一
  151. },
  152. (ret) => {
  153. // modal.toast({
  154. // message: ret,
  155. // duration: 1.5
  156. // });
  157. });
  158. // #endif
  159. },
  160. getArr(value) {
  161. return value ? value.split(',') : [];
  162. },
  163. goLegendDetails(checkItemId) {
  164. //跳转到图例详情
  165. uni.navigateTo({
  166. url: `/pages/legendDetails/legendDetails?checkItemId=${checkItemId}&checkPointId=${this.checkPointId}`
  167. });
  168. },
  169. dispatch(key, data) {
  170. return this.$store.dispatch({
  171. type: 'checkList/commActions',
  172. key,
  173. data
  174. });
  175. },
  176. goToPrevPage() {
  177. // _goBackFresh('pages/checkMainPoints/checkMainPoints');
  178. uni.navigateBack({
  179. delta: 1
  180. });
  181. },
  182. loadItemDetail(id) {
  183. if(this.isZichaDucha){
  184. //自查督查
  185. this.$store.dispatch({
  186. type: 'mainPointsDetail/commActions',
  187. payload:{
  188. key:'zichaduchaCheckTaskDetail',
  189. data:{
  190. id: id,
  191. improveType:this.improveType
  192. }
  193. }
  194. }).then((data)=>{
  195. if(data){
  196. this.detail = data;
  197. this.itemId = id;
  198. }
  199. })
  200. }else{
  201. this.dispatch('checkTaskDetail', {
  202. id,
  203. improveType:this.improveType
  204. }).then((data) => {
  205. if (data) {
  206. this.detail = data;
  207. this.itemId = id;
  208. }
  209. });
  210. }
  211. },
  212. switchItem(num) {
  213. let currentIndex = this.detail.checkDetailIds.findIndex(t => t == this.itemId);
  214. if (currentIndex - 1 == -1 && num < 0) {
  215. //当前项为第一个时且操作是点击上一项
  216. uni.showToast({
  217. title: '已经没有上一项',
  218. duration: 2000,
  219. icon: 'none'
  220. });
  221. return;
  222. }
  223. if (currentIndex + 1 > this.detail.checkDetailIds.length - 1 && num > 0) {
  224. //当前项为第一个时且操作是点击下一项
  225. uni.showToast({
  226. title: '已经没有下一项',
  227. duration: 2000,
  228. icon: 'none'
  229. });
  230. return;
  231. }
  232. let needItemId = num > 0 ? this.detail.checkDetailIds[currentIndex + 1] : this.detail.checkDetailIds[
  233. currentIndex - 1];
  234. if (needItemId) {
  235. this.loadItemDetail(needItemId);
  236. }
  237. }
  238. }
  239. }
  240. </script>
  241. <style lang="less" scoped>
  242. .auditItemDetails {
  243. .bottomBtn {
  244. position: fixed;
  245. bottom: 0;
  246. width: 100%;
  247. height: 75rpx;
  248. line-height: 75rpx;
  249. text-align: center;
  250. font-size: 22.5rpx;
  251. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  252. font-weight: 400;
  253. color: #FFFFFF;
  254. background: #3377FF;
  255. }
  256. .top-box {
  257. position: relative;
  258. padding-bottom: 37.5rpx;
  259. background-color: #fff;
  260. .icon-wrap {
  261. position: relative;
  262. overflow: hidden;
  263. width: 125rpx;
  264. height: 37.5rpx;
  265. image {
  266. width: 100%;
  267. height: 100%;
  268. }
  269. text {
  270. position: absolute;
  271. top: 0;
  272. left: 25rpx;
  273. font-size: 20rpx;
  274. line-height: 37.5rpx;
  275. color: #fff;
  276. }
  277. }
  278. .img-tuli {
  279. position: absolute;
  280. top: 25rpx;
  281. right: 25rpx;
  282. width: 40rpx;
  283. height: 40rpx;
  284. }
  285. .title-wrap {
  286. display: flex;
  287. flex-direction: column;
  288. padding: 25rpx 31.25rpx;
  289. text {
  290. font-size: 25rpx;
  291. line-height: 37.5rpx;
  292. white-space: nowrap;
  293. text-overflow: ellipsis;
  294. overflow: hidden;
  295. &:last-child {
  296. padding-top: 4.37rpx;
  297. font-size: 17.5rpx;
  298. line-height: 26.25rpx;
  299. color: #7A8599;
  300. }
  301. }
  302. }
  303. .children {
  304. display: flex;
  305. flex-direction: row;
  306. align-items: center;
  307. margin-top: 10.62rpx;
  308. .child {
  309. display: flex;
  310. flex-direction: column;
  311. justify-content: center;
  312. align-items: center;
  313. flex: 1;
  314. width: 25%;
  315. border-right: 1px solid #DADEE6;
  316. text {
  317. width: 100%;
  318. text-align: center;
  319. font-weight: 500;
  320. white-space: nowrap;
  321. overflow: hidden;
  322. text-overflow: ellipsis;
  323. &:last-child {
  324. font-size: 17.5rpx;
  325. line-height: 26.25rpx;
  326. color: #7A8599;
  327. font-weight: 400;
  328. }
  329. }
  330. &:last-child {
  331. border-right: 0;
  332. }
  333. }
  334. }
  335. }
  336. .bottom-box {
  337. margin-top: 15rpx;
  338. padding: 0 25rpx;
  339. background-color: #fff;
  340. .box-item {
  341. display: flex;
  342. flex-direction: row;
  343. border-bottom: 0.62rpx solid #DADEE6;
  344. padding: 26.25rpx 0;
  345. &:last-child {
  346. border-bottom: 0;
  347. }
  348. >view {
  349. width: 100%;
  350. &:first-child {
  351. width: 175rpx;
  352. white-space: nowrap;
  353. color: #525866;
  354. }
  355. &.img-wrap {
  356. display: flex;
  357. flex-direction: row;
  358. flex-wrap: wrap;
  359. image {
  360. margin-bottom: 12.5rpx;
  361. width:160rpx;
  362. &:nth-child(2n) {
  363. margin-left: 12.5rpx;
  364. }
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .bottomMenuGroup {
  371. position: fixed;
  372. bottom: 0;
  373. width: 100%;
  374. height: 75rpx;
  375. display: flex;
  376. flex-direction: row;
  377. background: #FFFFFF;
  378. border-top: 0.62rpx solid #DADEE6;
  379. .menuBtn {
  380. display: flex;
  381. width: 75rpx;
  382. height: 75rpx;
  383. justify-content: center;
  384. align-items: center;
  385. border-right: 0.62rpx solid #DADEE6;
  386. .threeLineMenuIcon {
  387. width: 26.25rpx;
  388. height: 21.25rpx;
  389. }
  390. }
  391. .prevBtn {
  392. border-right: 0.62rpx solid #DADEE6;
  393. }
  394. .prevBtn,
  395. .nextBtn {
  396. display: flex;
  397. flex: 1;
  398. justify-content: center;
  399. height: 75rpx;
  400. line-height: 75rpx;
  401. font-size: 22.5rpx;
  402. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  403. font-weight: 400;
  404. color: #3377FF;
  405. }
  406. }
  407. }
  408. </style>