auditItemDetails.vue 9.4 KB

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