auditItemDetails.vue 7.7 KB

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