checkMainPoints.vue 8.3 KB

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