auditItemDetails.vue 8.5 KB

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