auditItemDetails.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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. //只有查核展示底部按钮
  115. if (roleNum == 3) {
  116. //接收来自上个页面所传过来的数据
  117. const eventChannel = this.getOpenerEventChannel();
  118. eventChannel.on('acceptDataFromOpenerPage', (data) => {
  119. this.itemBelongGroup = data.data[0].responseList.map((item, index) => {
  120. return ({
  121. index: index,
  122. id: item['id'],
  123. })
  124. });
  125. //重新导航进页面,删除缓存并设置最新数据
  126. uni.removeStorageSync('itemBelongGroup');
  127. uni.setStorageSync('itemBelongGroup', this.itemBelongGroup);
  128. });
  129. //手动刷新页面,获取本地缓存
  130. const itemBelongGroup = uni.getStorageSync('itemBelongGroup');
  131. this.itemBelongGroup = itemBelongGroup;
  132. }
  133. },
  134. methods: {
  135. /**
  136. * @param {number} index
  137. * @param {string} imgUrls
  138. */
  139. previewHandle(index,imgUrls) {
  140. const picList = imgUrls ? imgUrls.split(',') : [] ;
  141. // #ifdef APP
  142. pictureModule.PictureViewerMain({
  143. 'listPic': picList,
  144. 'position':index, // 0 开始算 最大值为 listPic 数组数量 减一
  145. },
  146. (ret) => {
  147. // modal.toast({
  148. // message: ret,
  149. // duration: 1.5
  150. // });
  151. });
  152. // #endif
  153. },
  154. getArr(value) {
  155. return value ? value.split(',') : [];
  156. },
  157. goLegendDetails(checkItemId) {
  158. //跳转到图例详情
  159. uni.navigateTo({
  160. url: `/pages/legendDetails/legendDetails?checkItemId=${checkItemId}&checkPointId=${this.checkPointId}`
  161. });
  162. },
  163. dispatch(key, data) {
  164. return this.$store.dispatch({
  165. type: 'checkList/commActions',
  166. key,
  167. data
  168. });
  169. },
  170. goToPrevPage() {
  171. // _goBackFresh('pages/checkMainPoints/checkMainPoints');
  172. uni.navigateBack({
  173. delta: 1
  174. });
  175. },
  176. loadItemDetail(id) {
  177. if(this.isZichaDucha){
  178. //自查督查
  179. this.$store.dispatch({
  180. type: 'mainPointsDetail/commActions',
  181. payload:{
  182. key:'zichaduchaCheckTaskDetail',
  183. data:{
  184. id: id,
  185. improveType:this.improveType
  186. }
  187. }
  188. }).then((data)=>{
  189. if(data){
  190. this.detail = data;
  191. this.itemId = id;
  192. }
  193. })
  194. }else{
  195. this.dispatch('checkTaskDetail', {
  196. id,
  197. improveType:this.improveType
  198. }).then((data) => {
  199. if (data) {
  200. this.detail = data;
  201. this.itemId = id;
  202. }
  203. });
  204. }
  205. },
  206. switchItem(num) {
  207. let currentIndex = this.detail.checkDetailIds.findIndex(t => t == this.itemId);
  208. if (currentIndex - 1 == -1 && num < 0) {
  209. //当前项为第一个时且操作是点击上一项
  210. uni.showToast({
  211. title: '已经没有上一项',
  212. duration: 2000,
  213. icon: 'none'
  214. });
  215. return;
  216. }
  217. if (currentIndex + 1 > this.detail.checkDetailIds.length - 1 && num > 0) {
  218. //当前项为第一个时且操作是点击下一项
  219. uni.showToast({
  220. title: '已经没有下一项',
  221. duration: 2000,
  222. icon: 'none'
  223. });
  224. return;
  225. }
  226. let needItemId = num > 0 ? this.detail.checkDetailIds[currentIndex + 1] : this.detail.checkDetailIds[
  227. currentIndex - 1];
  228. if (needItemId) {
  229. this.loadItemDetail(needItemId);
  230. }
  231. }
  232. }
  233. }
  234. </script>
  235. <style lang="less" scoped>
  236. .auditItemDetails {
  237. .bottomBtn {
  238. position: fixed;
  239. bottom: 0;
  240. width: 100%;
  241. height: 75rpx;
  242. line-height: 75rpx;
  243. text-align: center;
  244. font-size: 22.5rpx;
  245. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  246. font-weight: 400;
  247. color: #FFFFFF;
  248. background: #3377FF;
  249. }
  250. .top-box {
  251. position: relative;
  252. padding-bottom: 37.5rpx;
  253. background-color: #fff;
  254. .icon-wrap {
  255. position: relative;
  256. overflow: hidden;
  257. width: 125rpx;
  258. height: 37.5rpx;
  259. image {
  260. width: 100%;
  261. height: 100%;
  262. }
  263. text {
  264. position: absolute;
  265. top: 0;
  266. left: 25rpx;
  267. font-size: 20rpx;
  268. line-height: 37.5rpx;
  269. color: #fff;
  270. }
  271. }
  272. .img-tuli {
  273. position: absolute;
  274. top: 25rpx;
  275. right: 25rpx;
  276. width: 40rpx;
  277. height: 40rpx;
  278. }
  279. .title-wrap {
  280. display: flex;
  281. flex-direction: column;
  282. padding: 25rpx 31.25rpx;
  283. text {
  284. font-size: 25rpx;
  285. line-height: 37.5rpx;
  286. white-space: nowrap;
  287. text-overflow: ellipsis;
  288. overflow: hidden;
  289. &:last-child {
  290. padding-top: 4.37rpx;
  291. font-size: 17.5rpx;
  292. line-height: 26.25rpx;
  293. color: #7A8599;
  294. }
  295. }
  296. }
  297. .children {
  298. display: flex;
  299. flex-direction: row;
  300. align-items: center;
  301. margin-top: 10.62rpx;
  302. .child {
  303. display: flex;
  304. flex-direction: column;
  305. justify-content: center;
  306. align-items: center;
  307. flex: 1;
  308. width: 25%;
  309. border-right: 1px solid #DADEE6;
  310. text {
  311. width: 100%;
  312. text-align: center;
  313. font-weight: 500;
  314. white-space: nowrap;
  315. overflow: hidden;
  316. text-overflow: ellipsis;
  317. &:last-child {
  318. font-size: 17.5rpx;
  319. line-height: 26.25rpx;
  320. color: #7A8599;
  321. font-weight: 400;
  322. }
  323. }
  324. &:last-child {
  325. border-right: 0;
  326. }
  327. }
  328. }
  329. }
  330. .bottom-box {
  331. margin-top: 15rpx;
  332. padding: 0 25rpx;
  333. background-color: #fff;
  334. .box-item {
  335. display: flex;
  336. flex-direction: row;
  337. border-bottom: 0.62rpx solid #DADEE6;
  338. padding: 26.25rpx 0;
  339. &:last-child {
  340. border-bottom: 0;
  341. }
  342. >view {
  343. width: 100%;
  344. &:first-child {
  345. width: 175rpx;
  346. white-space: nowrap;
  347. color: #525866;
  348. }
  349. &.img-wrap {
  350. display: flex;
  351. flex-direction: row;
  352. flex-wrap: wrap;
  353. image {
  354. margin-bottom: 12.5rpx;
  355. width:160rpx;
  356. &:nth-child(2n) {
  357. margin-left: 12.5rpx;
  358. }
  359. }
  360. }
  361. }
  362. }
  363. }
  364. .bottomMenuGroup {
  365. position: fixed;
  366. bottom: 0;
  367. width: 100%;
  368. height: 75rpx;
  369. display: flex;
  370. flex-direction: row;
  371. background: #FFFFFF;
  372. border-top: 0.62rpx solid #DADEE6;
  373. .menuBtn {
  374. display: flex;
  375. width: 75rpx;
  376. height: 75rpx;
  377. justify-content: center;
  378. align-items: center;
  379. border-right: 0.62rpx solid #DADEE6;
  380. .threeLineMenuIcon {
  381. width: 26.25rpx;
  382. height: 21.25rpx;
  383. }
  384. }
  385. .prevBtn {
  386. border-right: 0.62rpx solid #DADEE6;
  387. }
  388. .prevBtn,
  389. .nextBtn {
  390. display: flex;
  391. flex: 1;
  392. justify-content: center;
  393. height: 75rpx;
  394. line-height: 75rpx;
  395. font-size: 22.5rpx;
  396. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  397. font-weight: 400;
  398. color: #3377FF;
  399. }
  400. }
  401. }
  402. </style>