auditItemDetails.vue 8.6 KB

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