auditItemDetails.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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" v-if="ifShowBotBtn">
  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 class="bottomBtn" @click="goToPrevPage" v-if="ifImprover">{{bottomBtnText}}</view>
  63. </view>
  64. </template>
  65. <script>
  66. /**
  67. * 查核项详情
  68. */
  69. import {_goBackFresh} 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. onLoad: function ({id, checkPointId}) {
  91. const pages = getCurrentPages();
  92. const reversedPageList = pages.reverse();
  93. if(reversedPageList[1].route=='pages/checkMainPoints/checkMainPoints'){
  94. this.bottomBtnText = '返回查核任务列表'
  95. }
  96. const roleNum = uni.getStorageSync('nowPermission');
  97. if(roleNum==3)this.ifShowBotBtn = true;
  98. if(roleNum==3)this.ifImprover = false;
  99. this.checkPointId = checkPointId;
  100. this.itemId = id;
  101. this.loadItemDetail(id);
  102. //只有查核展示底部按钮
  103. if(roleNum==3){
  104. //接收来自上个页面所传过来的数据
  105. const eventChannel = this.getOpenerEventChannel();
  106. eventChannel.on('acceptDataFromOpenerPage', (data)=>{
  107. // console.log({data});
  108. this.itemBelongGroup =data.data[0].responseList.map((item,index)=>{
  109. return({
  110. index:index,
  111. id:item['id'],
  112. })
  113. });
  114. //重新导航进页面,删除缓存并设置最新数据
  115. uni.removeStorageSync('itemBelongGroup');
  116. uni.setStorageSync('itemBelongGroup',this.itemBelongGroup);
  117. });
  118. //手动刷新页面,获取本地缓存
  119. const itemBelongGroup = uni.getStorageSync('itemBelongGroup');
  120. this.itemBelongGroup = itemBelongGroup;
  121. }
  122. },
  123. methods: {
  124. getArr(value) {
  125. return value ? value.split(',') : [];
  126. },
  127. goLegendDetails(checkItemId) {
  128. //跳转到图例详情
  129. uni.navigateTo({
  130. url: `/pages/legendDetails/legendDetails?checkItemId=${checkItemId}&checkPointId=${this.checkPointId}`
  131. });
  132. },
  133. dispatch(key, data) {
  134. return this.$store.dispatch({type: 'checkList/commActions', key, data});
  135. },
  136. goToPrevPage(){
  137. _goBackFresh('pages/checkMainPoints/checkMainPoints');
  138. },
  139. loadItemDetail(id){
  140. this.dispatch('checkTaskDetail', {id}).then((data)=>{
  141. if(data) {
  142. this.detail = data;
  143. this.itemId = id;
  144. }
  145. });
  146. },
  147. switchItem(num){
  148. let current = this.itemBelongGroup.filter(item=>{
  149. return item.id == this.itemId;
  150. });
  151. if(num<0){
  152. if(current[0].index==0){
  153. uni.showToast({
  154. title: '已经没有上一项',
  155. duration: 2000,
  156. icon:'none'
  157. });
  158. return;
  159. }
  160. }
  161. if(num>0){
  162. if(current[0].index==this.itemBelongGroup.length-1){
  163. uni.showToast({
  164. title: '已经没有下一项',
  165. duration: 2000,
  166. icon:'none'
  167. });
  168. return;
  169. }
  170. }
  171. let needItemIndex = num>0?current[0].index+1:current[0].index-1;
  172. let needItemId = this.itemBelongGroup[needItemIndex].id;
  173. this.loadItemDetail(needItemId);
  174. }
  175. }
  176. }
  177. </script>
  178. <style lang="less">
  179. .auditItemDetails {
  180. .bottomBtn {
  181. position: fixed;
  182. bottom: 0;
  183. width: 100%;
  184. height: 75rpx;
  185. line-height: 75rpx;
  186. text-align: center;
  187. font-size: 22.5rpx;
  188. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  189. font-weight: 400;
  190. color: #FFFFFF;
  191. background: #3377FF;
  192. }
  193. .top-box {
  194. position: relative;
  195. margin-top: 15rpx;
  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. &:last-child {
  231. padding-top: 4.37rpx;
  232. font-size: 17.5rpx;
  233. line-height: 26.25rpx;
  234. color: #7A8599;
  235. }
  236. }
  237. }
  238. .children {
  239. display: flex;
  240. flex-direction: row;
  241. align-items: center;
  242. margin-top: 10.62rpx;
  243. .child {
  244. display: flex;
  245. flex-direction: column;
  246. justify-content: center;
  247. align-items: center;
  248. flex: 1;
  249. border-right: 1px solid #DADEE6;
  250. text {
  251. font-weight: 500;
  252. &:last-child {
  253. font-size: 17.5rpx;
  254. line-height: 26.25rpx;
  255. color: #7A8599;
  256. font-weight: 400;
  257. }
  258. }
  259. &:last-child {
  260. border-right: 0;
  261. }
  262. }
  263. }
  264. }
  265. .bottom-box {
  266. margin-top: 15rpx;
  267. padding: 0 25rpx;
  268. background-color: #fff;
  269. .box-item {
  270. display: flex;
  271. flex-direction: row;
  272. border-bottom: 0.62rpx solid #DADEE6;
  273. padding: 26.25rpx 0;
  274. &:last-child {
  275. border-bottom: 0;
  276. }
  277. >view {
  278. width: 100%;
  279. &:first-child {
  280. width: 175rpx;
  281. white-space: nowrap;
  282. color: #525866;
  283. }
  284. &.img-wrap {
  285. display: flex;
  286. flex-direction: row;
  287. flex-wrap: wrap;
  288. image {
  289. margin-bottom: 12.5rpx;
  290. width: calc(50% - 12.5rpx);
  291. &:nth-child(2n) {
  292. margin-left: 12.5rpx;
  293. }
  294. }
  295. }
  296. }
  297. }
  298. }
  299. .bottomMenuGroup {
  300. position: fixed;
  301. bottom: 0;
  302. width: 100%;
  303. height: 75rpx;
  304. display: flex;
  305. flex-direction: row;
  306. background: #FFFFFF;
  307. border-top:0.62rpx solid #DADEE6;
  308. .menuBtn {
  309. display: flex;
  310. width: 75rpx;
  311. height: 75rpx;
  312. justify-content: center;
  313. align-items: center;
  314. border-right: 0.62rpx solid #DADEE6;
  315. .threeLineMenuIcon {
  316. width: 26.25rpx;
  317. height: 21.25rpx;
  318. }
  319. }
  320. .prevBtn {
  321. border-right: 0.62rpx solid #DADEE6;
  322. }
  323. .prevBtn,.nextBtn {
  324. display: flex;
  325. flex: 1;
  326. justify-content: center;
  327. height:75rpx;
  328. line-height:75rpx;
  329. font-size: 22.5rpx;
  330. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  331. font-weight: 400;
  332. color: #3377FF;
  333. }
  334. }
  335. }
  336. </style>