auditItemDetails.vue 8.7 KB

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