checkMainPoints.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="checkMainPoints">
  3. <tm-top-menu>
  4. <view class="top-search">
  5. <view class="search">
  6. <input confirm-type="search"
  7. @input="filterFromName"
  8. placeholder="搜索查核要点或查核项" />
  9. <image src="../../static/search.png"></image>
  10. </view>
  11. <view class="top-btn-wrap">
  12. <view class="btn-list" v-if="nowPermission == 3">
  13. <com-button v-for="(item, index) in btnArr"
  14. :btnText="item.label"
  15. :type="active === item.id ? 'pramary':'default'"
  16. v-on:btnClick="btnClick(item.id)"/>
  17. </view>
  18. <view class="select-wrap"
  19. v-else-if="nowPermission == 2 || nowPermission == 1"
  20. @click="toggleModal(!showModal)">
  21. <text>{{getCheckPointName}}</text>
  22. <image :src="`../../static/${showModal?'open':'close'}-icon.png`"></image>
  23. </view>
  24. </view>
  25. </view>
  26. </tm-top-menu>
  27. <tm-modal v-show="showModal" v-on:click="toggleModal(false)">
  28. <view class="content-list">
  29. <view class="list-item"
  30. v-for="(item, index) in point"
  31. :class="{active: checkPointId === item.checkPointId}"
  32. @click="checkPointHandle(item.checkPointId)">
  33. <text>{{item.checkPointName}}</text>
  34. <image class="check-img"
  35. v-if="checkPointId === item.checkPointId"
  36. src="../../static/checkStatus.png"></image>
  37. </view>
  38. </view>
  39. </tm-modal>
  40. <view class="list" v-for="(item, index) in detailList" :key="index">
  41. <view class="title">查核要点一:{{item.checkPointName}}</view>
  42. <view class="item"
  43. v-for="(child, n) in item.responseList"
  44. @click="childClick(child)"
  45. :key="n">
  46. <view class="top-box">
  47. <view class="top-box-left">
  48. <view class="index-icon">{{n + 1}}</view>
  49. <text>{{child.checkItemName}}</text>
  50. </view>
  51. <image src="../../static/tuli.png"
  52. @click="goLegendDetails($event ,child.checkItemId)"></image>
  53. </view>
  54. <view class="children">
  55. <view class="child">
  56. <text>{{child.deptName || '--'}}</text>
  57. <text>查核单位</text>
  58. </view>
  59. <view class="child">
  60. <text>{{child.checkModelName || '--'}}</text>
  61. <text>查核方式</text>
  62. </view>
  63. <view class="child">
  64. <text>{{child.lastResult || '--'}}</text>
  65. <text>上次结果</text>
  66. </view>
  67. <view class="child">
  68. <text>{{child.checkResult || '--'}}</text>
  69. <text>本次结果</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import {_stopPropagation} from "../../utils/compatible.js";
  78. export default {
  79. data() {
  80. return {
  81. btnArr: [
  82. {id: 0, label: '全部'},
  83. {id: 1, label: '未查核'},
  84. {id: 2, label: '已查核'},
  85. ],
  86. showModal: false,
  87. detailList: [],
  88. copyDetailList: [],
  89. point: [{checkPointId: 'all', checkPointName: '全部要点'}],
  90. checkPointId: 'all',
  91. nowPermission: uni.getStorageSync('nowPermission'),
  92. active: 0
  93. };
  94. },
  95. computed: {
  96. getCheckPointName() {
  97. let item=this.point.find((item)=> item.checkPointId === this.checkPointId);
  98. return item ? item.checkPointName : '';
  99. },
  100. },
  101. onLoad: function ({checkId,deptId}) {
  102. this.dispatch('checkTaskDetailList', {checkId,deptId}).then((data)=>{
  103. if(data) {
  104. this.detailList = data;
  105. this.copyDetailList = data;
  106. data.map(({checkPointId,checkPointName})=>{
  107. this.point.push({checkPointId, checkPointName});
  108. });
  109. }
  110. });
  111. },
  112. methods: {
  113. btnClick(id) {
  114. this.active = id;
  115. this.filterCompleteFlag(id);
  116. },
  117. childClick(child) {
  118. // 查核者,管理员
  119. if(this.nowPermission == 1 || this.nowPermission == 3) {
  120. let str = '';
  121. if(child.checkResult) {
  122. // 跳转到查核项详情
  123. str = 'auditItemDetails/auditItemDetails';
  124. } else {
  125. // 跳转到查核结果提交
  126. str = 'mainPointsDetail/mainPointsDetail';
  127. }
  128. uni.navigateTo({
  129. url: `/pages/${str}?id=${child.id}`
  130. });
  131. }
  132. },
  133. toggleModal(flage) {
  134. this.showModal = flage;
  135. },
  136. checkPointHandle(id) {
  137. this.checkPointId = id;
  138. if(id === 'all') {
  139. this.detailList = [...this.copyDetailList];
  140. } else {
  141. this.detailList = this.copyDetailList
  142. .filter((item)=> item.checkPointId === id);
  143. }
  144. },
  145. filterCompleteFlag(btnId) {
  146. if(btnId === 0) {
  147. this.detailList = [...this.copyDetailList];
  148. } else {
  149. let completeFlag = btnId === 1 ? false : true;
  150. this.detailList = this.copyDetailList.map((item)=>{
  151. return {
  152. ...item,
  153. responseList: item.responseList
  154. .filter((child)=> child.completeFlag === completeFlag)
  155. }
  156. });
  157. }
  158. },
  159. filterFromName(e) {
  160. const {value} = e.detail;
  161. if(value === '') {
  162. this.detailList = [...this.copyDetailList];
  163. } else {
  164. this.detailList = [];
  165. this.copyDetailList.map((item)=>{
  166. let responseList = item.responseList
  167. .filter((child)=> child.checkItemName.indexOf(value) >= 0);
  168. if(item.checkPointName.indexOf(value) >= 0) {
  169. this.detailList.push({...item});
  170. } else if(responseList.length > 0) {
  171. this.detailList.push({...item, responseList});
  172. }
  173. });
  174. }
  175. },
  176. goLegendDetails(e, checkItemId) {
  177. _stopPropagation(e);
  178. //跳转到图例详情
  179. uni.navigateTo({
  180. url: `/pages/legendDetails/legendDetails?checkItemId=${checkItemId}`
  181. });
  182. },
  183. dispatch(key, data) {
  184. return this.$store.dispatch({type: 'checkList/commActions', key, data});
  185. },
  186. }
  187. }
  188. </script>
  189. <style lang="less">
  190. .checkMainPoints {
  191. padding-top: 105rpx;
  192. font-size: 22.5rpx;
  193. line-height: 33.75rpx;
  194. background-color: #F5F6FA;
  195. .top-search {
  196. display: flex;
  197. flex-direction: row;
  198. align-items: center;
  199. padding: 25rpx;
  200. background-color: #fff;
  201. box-shadow: 0 3.75rpx 12.5rpx 0 rgba(0, 13, 51, 0.1);
  202. .search {
  203. position: relative;
  204. width: 100%;
  205. height: 55rpx;
  206. line-height: 55rpx;
  207. background-color: #F0F2F7;
  208. input {
  209. padding: 0 45rpx 0 15rpx;
  210. height: 55rpx;
  211. line-height: 55rpx;
  212. font-size: 22.5rpx;
  213. }
  214. image {
  215. position: absolute;
  216. top: 16.87rpx;
  217. right: 15rpx;
  218. width: 21.25rpx;
  219. height: 21.25rpx;
  220. }
  221. }
  222. .top-btn-wrap {
  223. padding-left: 25rpx;
  224. .btn-list {
  225. display: flex;
  226. flex-direction: row;
  227. .com-button {
  228. margin-left: 5rpx;
  229. &:first-child {
  230. margin-left: 0;
  231. }
  232. }
  233. }
  234. .select-wrap {
  235. display: flex;
  236. flex-direction: row;
  237. align-items: center;
  238. white-space: nowrap;
  239. image {
  240. margin-left: 9.37rpx;
  241. width: 12.5rpx;
  242. height: 12.5rpx;
  243. }
  244. }
  245. }
  246. }
  247. .content-list {
  248. padding-top: 105rpx;
  249. width: 100%;
  250. background-color: #fff;
  251. .list-item {
  252. display: flex;
  253. flex-direction: row;
  254. justify-content: space-between;
  255. align-items: center;
  256. border-bottom: 1px solid #DADEE6;
  257. padding: 0 25rpx;
  258. width: 100%;
  259. height: 87.5rpx;
  260. font-size: 22.5rpx;
  261. line-height: 33.75rpx;
  262. color: #292C33;
  263. .check-img {
  264. float: right;
  265. width: 19.37rpx;
  266. height: 14.37rpx;
  267. }
  268. &.active {
  269. color: #3377FF;
  270. }
  271. }
  272. }
  273. .list {
  274. .title {
  275. padding-left: 25rpx;
  276. width: 100%;
  277. height: 62.5rpx;
  278. line-height: 62.5rpx;
  279. color: #666F80;
  280. }
  281. .item {
  282. margin-top: 15rpx;
  283. padding: 25rpx 0;
  284. height: 167.5rpx;
  285. background-color: #fff;
  286. &:nth-child(2) {
  287. margin-top: 0;
  288. }
  289. .top-box {
  290. display: flex;
  291. flex-direction: row;
  292. justify-content: space-between;
  293. align-items: center;
  294. .top-box-left {
  295. display: flex;
  296. flex-direction: row;
  297. .index-icon {
  298. margin-right: 15rpx;
  299. border-radius: 0 62.5rpx 62.5rpx 0;
  300. width: 50rpx;
  301. height: 35rpx;
  302. line-height: 35rpx;
  303. text-align: center;
  304. color: #fff;
  305. background-color: #66B2FE;
  306. }
  307. }
  308. image {
  309. margin-right: 15rpx;
  310. width: 40rpx;
  311. height: 40rpx;
  312. }
  313. }
  314. .children {
  315. display: flex;
  316. flex-direction: row;
  317. align-items: center;
  318. margin-top: 18.75rpx;
  319. .child {
  320. display: flex;
  321. flex-direction: column;
  322. justify-content: center;
  323. align-items: center;
  324. flex: 1;
  325. border-right: 1px solid #DADEE6;
  326. text {
  327. font-weight: 500;
  328. &:last-child {
  329. font-size: 17.5rpx;
  330. line-height: 26.25rpx;
  331. color: #7A8599;
  332. font-weight: 400;
  333. }
  334. }
  335. &:last-child {
  336. border-right: 0;
  337. }
  338. }
  339. }
  340. }
  341. }
  342. }
  343. </style>