auditItemDetails.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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"
  9. @click="goLegendDetails(detail.checkItemId)"
  10. src="../../static/tuli.png"></image>
  11. <view class="title-wrap">
  12. <text>{{detail.checkItemName}}</text>
  13. <text>{{detail.checkPointName}}</text>
  14. </view>
  15. <view class="children">
  16. <view class="child">
  17. <text>{{detail.deptName || '--'}}</text>
  18. <text>查核单位</text>
  19. </view>
  20. <view class="child">
  21. <text>{{detail.checkModelName || '--'}}</text>
  22. <text>查核方式</text>
  23. </view>
  24. <view class="child">
  25. <text>{{detail.lastResult || '--'}}</text>
  26. <text>上次结果</text>
  27. </view>
  28. <view class="child">
  29. <text>{{detail.checkResult || '--'}}</text>
  30. <text>本次结果</text>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="bottom-box"
  35. v-for="(item, index) in detail.checkResultRequestList"
  36. :key="index">
  37. <view class="box-item">
  38. <view>查核结果</view>
  39. <view>{{item.checkResultDescribe}}</view>
  40. </view>
  41. <view class="box-item">
  42. <view>查核时间</view>
  43. <view>{{detail.completeTimeStr}}</view>
  44. </view>
  45. <view class="box-item">
  46. <view>图片展示</view>
  47. <view class="img-wrap">
  48. <image mode="widthFix"
  49. v-for="(img, i) in getArr(item.checkResultUrl)"
  50. :key="i"
  51. :src="img"></image>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="bottomMenuGroup">
  56. <view class="menuBtn" @click="goToPrevPage">
  57. <image class="threeLineMenuIcon" src="/static/threeLineMenu.png" ></image>
  58. </view>
  59. <view class="prevBtn" @click="switchItem(-1)">上一项</view>
  60. <view class="nextBtn" @click="switchItem(1)">下一项</view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. /**
  66. * 查核项详情
  67. */
  68. export default {
  69. data() {
  70. return {
  71. detail: {
  72. checkPointName: '',
  73. deptName: '',
  74. checkModelName: '',
  75. lastResult: '',
  76. checkResult: '',
  77. checkItemName: '',
  78. checkResultRequestList: [],
  79. checkPointId: ''
  80. },
  81. itemBelongGroup:[],
  82. itemId:''
  83. };
  84. },
  85. onLoad: function ({id, checkPointId}) {
  86. console.log('22');
  87. this.checkPointId = checkPointId;
  88. this.itemId = id;
  89. this.loadItemDetail(id);
  90. //接收来自上个页面所传过来的数据
  91. const eventChannel = this.getOpenerEventChannel();
  92. eventChannel.on('acceptDataFromOpenerPage', (data)=>{
  93. // console.log({data});
  94. this.itemBelongGroup =data.data[0].responseList.map((item,index)=>{
  95. return({
  96. index:index,
  97. id:item['id'],
  98. })
  99. });
  100. //重新导航进页面,删除缓存并设置最新数据
  101. uni.removeStorageSync('itemBelongGroup');
  102. uni.setStorageSync('itemBelongGroup',this.itemBelongGroup);
  103. });
  104. //手动刷新页面,获取本地缓存
  105. const itemBelongGroup = uni.getStorageSync('itemBelongGroup');
  106. this.itemBelongGroup = itemBelongGroup;
  107. },
  108. methods: {
  109. getArr(value) {
  110. return value ? value.split(',') : [];
  111. },
  112. goLegendDetails(checkItemId) {
  113. //跳转到图例详情
  114. uni.navigateTo({
  115. url: `/pages/legendDetails/legendDetails?checkItemId=${checkItemId}&checkPointId=${this.checkPointId}`
  116. });
  117. },
  118. dispatch(key, data) {
  119. return this.$store.dispatch({type: 'checkList/commActions', key, data});
  120. },
  121. goToPrevPage(){
  122. // uni.navigateBack({
  123. // delta: 1
  124. // });
  125. window.history.back();
  126. },
  127. loadItemDetail(id){
  128. this.dispatch('checkTaskDetail', {id}).then((data)=>{
  129. if(data) {
  130. this.detail = data;
  131. this.itemId = id;
  132. }
  133. });
  134. },
  135. switchItem(num){
  136. let current = this.itemBelongGroup.filter(item=>{
  137. return item.id == this.itemId;
  138. });
  139. if(num<0){
  140. if(current[0].index==0){
  141. uni.showToast({
  142. title: '已经没有上一项',
  143. duration: 2000,
  144. icon:'none'
  145. });
  146. return;
  147. }
  148. }
  149. if(num>0){
  150. if(current[0].index==this.itemBelongGroup.length-1){
  151. uni.showToast({
  152. title: '已经没有下一项',
  153. duration: 2000,
  154. icon:'none'
  155. });
  156. return;
  157. }
  158. }
  159. let needItemIndex = num>0?current[0].index+1:current[0].index-1;
  160. let needItemId = this.itemBelongGroup[needItemIndex].id;
  161. this.loadItemDetail(needItemId);
  162. }
  163. }
  164. }
  165. </script>
  166. <style lang="less">
  167. .auditItemDetails {
  168. .top-box {
  169. position: relative;
  170. margin-top: 15rpx;
  171. padding-bottom: 37.5rpx;
  172. background-color: #fff;
  173. .icon-wrap {
  174. position: relative;
  175. overflow: hidden;
  176. width: 125rpx;
  177. height: 37.5rpx;
  178. image {
  179. width: 100%;
  180. height: 100%;
  181. }
  182. text {
  183. position: absolute;
  184. top: 0;
  185. left: 25rpx;
  186. font-size: 20rpx;
  187. line-height: 37.5rpx;
  188. color: #fff;
  189. }
  190. }
  191. .img-tuli {
  192. position: absolute;
  193. top: 25rpx;
  194. right: 25rpx;
  195. width: 40rpx;
  196. height: 40rpx;
  197. }
  198. .title-wrap {
  199. display: flex;
  200. flex-direction: column;
  201. padding: 25rpx 31.25rpx;
  202. text {
  203. font-size: 25rpx;
  204. line-height: 37.5rpx;
  205. &:last-child {
  206. padding-top: 4.37rpx;
  207. font-size: 17.5rpx;
  208. line-height: 26.25rpx;
  209. color: #7A8599;
  210. }
  211. }
  212. }
  213. .children {
  214. display: flex;
  215. flex-direction: row;
  216. align-items: center;
  217. margin-top: 10.62rpx;
  218. .child {
  219. display: flex;
  220. flex-direction: column;
  221. justify-content: center;
  222. align-items: center;
  223. flex: 1;
  224. border-right: 1px solid #DADEE6;
  225. text {
  226. font-weight: 500;
  227. &:last-child {
  228. font-size: 17.5rpx;
  229. line-height: 26.25rpx;
  230. color: #7A8599;
  231. font-weight: 400;
  232. }
  233. }
  234. &:last-child {
  235. border-right: 0;
  236. }
  237. }
  238. }
  239. }
  240. .bottom-box {
  241. margin-top: 15rpx;
  242. padding: 0 25rpx;
  243. background-color: #fff;
  244. .box-item {
  245. display: flex;
  246. flex-direction: row;
  247. border-bottom: 0.62rpx solid #DADEE6;
  248. padding: 26.25rpx 0;
  249. &:last-child {
  250. border-bottom: 0;
  251. }
  252. >view {
  253. width: 100%;
  254. &:first-child {
  255. width: 175rpx;
  256. white-space: nowrap;
  257. color: #525866;
  258. }
  259. &.img-wrap {
  260. display: flex;
  261. flex-direction: row;
  262. flex-wrap: wrap;
  263. image {
  264. margin-bottom: 12.5rpx;
  265. width: calc(50% - 12.5rpx);
  266. &:nth-child(2n) {
  267. margin-left: 12.5rpx;
  268. }
  269. }
  270. }
  271. }
  272. }
  273. }
  274. .bottomMenuGroup {
  275. position: fixed;
  276. bottom: 0;
  277. width: 100%;
  278. height: 75rpx;
  279. display: flex;
  280. flex-direction: row;
  281. background: #FFFFFF;
  282. border-top:0.62rpx solid #DADEE6;
  283. .menuBtn {
  284. display: flex;
  285. width: 75rpx;
  286. height: 75rpx;
  287. justify-content: center;
  288. align-items: center;
  289. border-right: 0.62rpx solid #DADEE6;
  290. .threeLineMenuIcon {
  291. width: 26.25rpx;
  292. height: 21.25rpx;
  293. }
  294. }
  295. .prevBtn {
  296. border-right: 0.62rpx solid #DADEE6;
  297. }
  298. .prevBtn,.nextBtn {
  299. display: flex;
  300. flex: 1;
  301. justify-content: center;
  302. height:75rpx;
  303. line-height:75rpx;
  304. font-size: 22.5rpx;
  305. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  306. font-weight: 400;
  307. color: #3377FF;
  308. }
  309. }
  310. }
  311. </style>