checkList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. <template>
  2. <view :class="[showModal?'check-map-list-page preventScroll':'check-map-list-page']">
  3. <tm-top-menu>
  4. <view class="top-menu" @click="showModalHandle(!showModal)">
  5. <text>{{createTitle}}</text>
  6. <image :src="`../../static/${showModal?'open':'close'}-icon.png`"></image>
  7. </view>
  8. </tm-top-menu>
  9. <view class="searchBar" v-if="depList.length>0">
  10. <view class="filter">
  11. <view class="selecter" @click="selecterHandle">
  12. <text>{{selectedStr}}</text>
  13. <image src="../../static/fillBlackArrow.png" mode=""></image>
  14. </view>
  15. <view class="searchBar">
  16. <image class="serachIcon" src="../../static/searchIcon.png" mode=""></image>
  17. <tm-input class="searchVal" :clear="ifclearSearch" @onChange="searchInputHandle"
  18. placeholder="请输入单位名称"></tm-input>
  19. <view class="searchBtn" @click="searchHandle">搜索</view>
  20. </view>
  21. </view>
  22. </view>
  23. <scroll-view scroll-y="true" class="check-map-list">
  24. <view class="item" v-for="(item, index) in copiedDepList" @click="gotoCheckMainPointsPage(item)"
  25. :key="index">
  26. <view class="title-wrap">
  27. <text>{{item.deptName}}</text>
  28. <view>
  29. <image src="../../static/icon-map.png"></image>
  30. <text>{{item.deptClassName}}</text>
  31. </view>
  32. <view class="scoreAndStatus">
  33. <text
  34. v-if="item.scoreInfo">{{item.scoreInfo&&((item.scoreInfo.split('/')).map(t=>Number(t).toFixed(1))).join('/')}}</text>
  35. <view :class="getStatus(item.completeDes)">{{item.completeDes}}</view>
  36. </view>
  37. </view>
  38. <view class="content">
  39. <text>{{item.decs}}</text>
  40. <text>
  41. 要点概览:{{item.checkPointNames}}
  42. </text>
  43. </view>
  44. <view class="footer">
  45. <text>查核人:{{item.empName}}</text>
  46. <text v-if="item.startDate && item.endDate">
  47. {{item.startDate}}~{{item.endDate}}
  48. </text>
  49. </view>
  50. <view class="icon-wrap" v-if="Number(item.completeStatus) === 2 || Number(item.completeStatus) === 3">
  51. <image :src="`../../static/${Number(item.completeStatus) === 2 ?'hight-bg':'top-img'}.png`"></image>
  52. <text>{{item.completeDes}}</text>
  53. </view>
  54. </view>
  55. </scroll-view>
  56. <tm-no-data v-if="depList.length === 0||copiedDepList.length==0" :textArr="['暂时没有内容可以展示哦', '请返回上一页面或尝试刷新页面']" />
  57. <tm-modal v-show="showModal" v-on:click="showModalHandle(false)">
  58. <scroll-view scroll-y="true" class="content-list">
  59. <view class="list-item" v-for="(item, index) in planList" :class="{active: checkId === item.id}"
  60. @click="checkItem($event, item.id)" :key="index">
  61. <view>
  62. <text>{{item.name}}({{item.startDate}} ~ {{item.endDate}})</text>
  63. <view class="item-icon" :class="{icon2: Number(item.status) === 2}"
  64. v-if="Number(item.status) !== 1">
  65. {{Number(item.status) === 2 ? '进行中' : '已完成'}}
  66. </view>
  67. </view>
  68. <image class="check-img" v-if="checkId === item.id" src="../../static/checkStatus.png"></image>
  69. </view>
  70. </scroll-view>
  71. </tm-modal>
  72. <tm-callback-listpage />
  73. <uni-popup ref="popup" type="bottom" :maskClick="true">
  74. <view class="selectableList">
  75. <scroll-view scroll-y="true" class="listWrap">
  76. <view :class="getClass(v.id)" v-for="(v,i) in selectables" @click="listClickHandle(v)">
  77. {{`${v.name}(${v.count})`}}
  78. </view>
  79. </scroll-view>
  80. <view class="btnGroup">
  81. <view class="cancelBtn btn" @click="btnGroupClickHandle(false)">取消</view>
  82. <view class="confirmBtn btn" @click="btnGroupClickHandle(true)">确定</view>
  83. </view>
  84. </view>
  85. </uni-popup>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. mapState
  91. } from 'vuex';
  92. import {
  93. _stopPropagation
  94. } from "../../utils/compatible.js";
  95. export default {
  96. data() {
  97. return {
  98. showModal: false,
  99. planList: [],
  100. checkId: '',
  101. depList: [],
  102. copiedDepList: [], //筛选后结果
  103. //筛选条件
  104. filter: {
  105. keyword: '',
  106. status: [{
  107. name: '全部',
  108. id: 0
  109. }]
  110. },
  111. ifSearchMod: false,
  112. ifclearSearch: false,
  113. selectables: [{
  114. id: 0,
  115. name: '全部',
  116. count: 0
  117. },
  118. {
  119. id: 1,
  120. name: '进行中',
  121. count: 0
  122. },
  123. {
  124. id: 2,
  125. name: '已完成',
  126. count: 0
  127. }
  128. ]
  129. };
  130. },
  131. computed: {
  132. ...mapState({
  133. ifReloadPageData: state => {
  134. return state.checkList.ifReloadPageData
  135. },
  136. }),
  137. createTitle: function() {
  138. let item = this.planList.find((item) => item.id === this.checkId);
  139. if (item) {
  140. let name = item.name;
  141. return name.slice(0, name.length - 3) + `/${this.planList.length}` + name.slice(-3);
  142. } else {
  143. return '';
  144. }
  145. },
  146. selectedStr() {
  147. const {
  148. status
  149. } = this.filter;
  150. return (status.map(t => t.name)).join(',')
  151. },
  152. },
  153. watch: {
  154. /**
  155. * @param {Boolen} newVal
  156. */
  157. ifReloadPageData: function(newVal) {
  158. if (newVal) {
  159. this.getPageList(this.checkId);
  160. }
  161. },
  162. filter(val, oldVal) {
  163. if (val.keyword.length == 0) {
  164. this.searchHandle();
  165. }
  166. }
  167. },
  168. onLoad: function({
  169. situationId,
  170. situationType
  171. }) {
  172. this.situationType = situationType;
  173. this.situationId = situationId;
  174. this.getPageList();
  175. },
  176. onHide() {
  177. this.$store.commit('checkList/comChangeState', {
  178. key: 'ifReloadPageData',
  179. data: false
  180. });
  181. },
  182. onUnload() {
  183. this.$store.commit('checkList/comChangeState', {
  184. key: 'ifReloadPageData',
  185. data: false
  186. });
  187. },
  188. methods: {
  189. getClass(id) {
  190. const ids = this.filter.status.map(item => item.id);
  191. if (ids.indexOf(id) != -1) {
  192. return "list on"
  193. }
  194. return "list"
  195. },
  196. /**
  197. * @param {boolean} flag true确定按钮点击,false取消按钮
  198. */
  199. btnGroupClickHandle(flag) {
  200. this.$refs.popup.close();
  201. //清空搜索
  202. this.filter = {
  203. ...this.filter,
  204. keyword: ''
  205. }
  206. },
  207. listClickHandle(item) {
  208. const _filter = this.filter;
  209. const {
  210. status
  211. } = _filter;
  212. const index = _filter.status.findIndex(t => t.id == item.id);
  213. if (item.id == 0) {
  214. //全部
  215. this.filter = {
  216. ...this.filter,
  217. status: [{
  218. name: '全部',
  219. id: 0
  220. }]
  221. };
  222. return;
  223. }
  224. //去除全部选项选中
  225. status.splice(_filter.status.findIndex(t => t.id == 0), 1);
  226. if (index != -1) {
  227. status.splice(index, 1)
  228. } else {
  229. status.push({
  230. name: item.name,
  231. id: item.id
  232. })
  233. }
  234. this.filter = _filter;
  235. },
  236. selecterHandle() {
  237. this.$refs.popup.open();
  238. },
  239. searchInputHandle(val) {
  240. this.filter = {
  241. ...this.filter,
  242. keyword: val
  243. };
  244. },
  245. searchHandle() {
  246. let tempArr = this.depList;
  247. if (this.filter.status[0].id == 2) {
  248. //进行中
  249. tempArr = this.depList.filter(item => item.completeDes == '进行中');
  250. }
  251. if (this.filter.status[0].id == 1) {
  252. //已完成
  253. tempArr = this.depList.filter(item => item.completeDes == '已完成');
  254. }
  255. this.copiedDepList = tempArr.filter(item => item.deptName.indexOf(this.filter.keyword) != -1);
  256. },
  257. getPageList: function(checkId) {
  258. this.dispatch('planList', {
  259. situationId: this.situationId
  260. }).then((data) => {
  261. if (data && data.length > 0) {
  262. this.planList = data;
  263. let checkArr = data.filter((item) => Number(item.status) === 2).sort((a, b) => a
  264. .createTime - b.createTime);
  265. if(!checkId){
  266. this.checkId = checkArr ? checkArr[checkArr.length - 1].id :
  267. data.length > 0 ? data[0].id : '';
  268. }
  269. this.getDepList();
  270. }
  271. });
  272. },
  273. /**
  274. * @str string [noStart,checking,completed]
  275. */
  276. getStatus: function(str) { //设置状态颜色
  277. switch (str) {
  278. case '未分配':
  279. return 'status noStart'
  280. break;
  281. case '进行中':
  282. return 'status checking'
  283. break;
  284. case '已完成':
  285. return 'status completed'
  286. break;
  287. }
  288. },
  289. checkItem: function(e, id) {
  290. _stopPropagation(e);
  291. if (this.checkId === id) return;
  292. this.checkId = id;
  293. this.getDepList();
  294. },
  295. getDepList: function() {
  296. this.dispatch('depList', {
  297. checkId: this.checkId,
  298. situationType: this.situationType
  299. }).then((data) => {
  300. if (data) {
  301. const list = data.sort((a, b) => {
  302. if (a.sort && b.sort) return a.sort - b.sort;
  303. });
  304. this.depList = list;
  305. this.copiedDepList = list;
  306. this.showModalHandle(false);
  307. let onloading = list.filter(item => item.completeDes == '进行中'); //进行中
  308. let completed = list.filter(item => item.completeDes == '已完成'); //已完成
  309. const arr = [{
  310. id: 0,
  311. name: '全部',
  312. count: list.length
  313. },
  314. {
  315. id: 1,
  316. name: '已完成',
  317. count: completed.length
  318. },
  319. {
  320. id: 2,
  321. name: '进行中',
  322. count: onloading.length
  323. }
  324. ];
  325. this.selectables = [...arr]
  326. }
  327. });
  328. },
  329. showModalHandle: function(showModal) {
  330. this.showModal = showModal;
  331. },
  332. gotoCheckMainPointsPage({
  333. checkId,
  334. deptId,
  335. finishedStatus,
  336. pageTemplateId,
  337. }) {
  338. //跳转到查核要点
  339. uni.navigateTo({
  340. url: `/pages/checkMainPoints/checkMainPoints?checkId=${checkId}&deptId=${deptId}&finishedStatus=${finishedStatus}&situationType=${this.situationType}&pageTemplateId=${pageTemplateId}`
  341. });
  342. },
  343. dispatch: function(key, data) {
  344. return this.$store.dispatch({
  345. type: 'checkList/commActions',
  346. key,
  347. data
  348. });
  349. },
  350. }
  351. }
  352. </script>
  353. <style lang="less" scoped>
  354. .check-map-list-page {
  355. position: relative;
  356. padding-top: 30rpx;
  357. .tm-top-menu {
  358. width: 93%;
  359. margin: 0 auto;
  360. }
  361. .top-menu {
  362. overflow: hidden;
  363. display: flex;
  364. flex-direction: row;
  365. justify-content: center;
  366. align-items: center;
  367. height: 50rpx;
  368. margin-bottom: 20rpx;
  369. image {
  370. margin-left: 9.37rpx;
  371. width: 12.5rpx;
  372. height: 12.5rpx;
  373. }
  374. }
  375. .selectableList {
  376. display: flex;
  377. width: 100%;
  378. flex-direction: column;
  379. height: 50vh;
  380. padding-top: 50rpx;
  381. box-sizing: border-box;
  382. border-radius: 25rpx 25rpx 0px 0px;
  383. background-color: #FFFFFF;
  384. .listWrap {
  385. height: calc(50vh - 75rpx);
  386. overflow-y: scroll;
  387. .list {
  388. height: 87.5rpx;
  389. line-height: 87.5rpx;
  390. text-align: center;
  391. font-size: 30rpx;
  392. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  393. font-weight: 400;
  394. color: #8A8F99;
  395. &.on {
  396. font-weight: 500;
  397. color: #3377FF;
  398. }
  399. }
  400. }
  401. .btnGroup {
  402. display: flex;
  403. width: 100%;
  404. flex-direction: row;
  405. justify-content: center;
  406. align-items: center;
  407. .btn {
  408. width: 50%;
  409. height: 75rpx;
  410. line-height: 75rpx;
  411. text-align: center;
  412. font-size: 22.5rpx;
  413. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  414. font-weight: 400;
  415. color: #3377FF;
  416. }
  417. .cancelBtn {
  418. border-top: 0.62rpx solid #DADEE6;
  419. }
  420. .confirmBtn {
  421. color: #FFFFFF;
  422. background: #3377FF;
  423. }
  424. }
  425. }
  426. .searchBar {
  427. width: 93%;
  428. margin: 0 auto;
  429. .filter {
  430. display: flex;
  431. flex-direction: row;
  432. justify-content: space-between;
  433. align-items: center;
  434. margin-bottom: 15rpx;
  435. padding: 0 25rpx;
  436. background: #FFFFFF;
  437. .selecter {
  438. display: flex;
  439. width: 25%;
  440. height: 70rpx;
  441. flex-direction: row;
  442. justify-content: space-between;
  443. align-items: center;
  444. padding-right: 25rpx;
  445. border-right: 0.62rpx solid #DADEE6;
  446. &>text {
  447. width: 112.5rpx;
  448. font-size: 25rpx;
  449. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  450. font-weight: 500;
  451. color: #292C33;
  452. text-overflow: ellipsis;
  453. overflow: hidden;
  454. white-space: nowrap;
  455. }
  456. &>image {
  457. width: 11.25rpx;
  458. height: 7.5rpx;
  459. }
  460. }
  461. .searchBar {
  462. display: flex;
  463. width: 75%;
  464. flex-direction: row;
  465. align-items: center;
  466. height: 70rpx;
  467. padding-left: 25rpx;
  468. .serachIcon {
  469. width: 25rpx;
  470. height: 25rpx;
  471. }
  472. .searchVal {
  473. width: 79%;
  474. padding-left: 25rpx;
  475. font-size: 25rpx;
  476. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  477. font-weight: 400;
  478. color: #292C33;
  479. }
  480. .searchBtn {
  481. padding-left: 25rpx;
  482. font-size: 25rpx;
  483. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  484. font-weight: 400;
  485. color: #3377FF;
  486. white-space: nowrap;
  487. border-left: 1rpx solid #DADEE6;
  488. }
  489. }
  490. }
  491. }
  492. &.preventScroll {
  493. position: fixed;
  494. }
  495. }
  496. .check-map-list {
  497. height: 100%;
  498. .item {
  499. position: relative;
  500. .title-wrap {
  501. .scoreAndStatus {
  502. position: absolute;
  503. right: 20rpx;
  504. .status {
  505. display: flex;
  506. justify-content: center;
  507. width: 150rpx;
  508. height: 35rpx;
  509. font-size: 17.5rpx;
  510. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  511. font-weight: 500;
  512. color: #FFFFFF;
  513. border-radius: 20rpx;
  514. &.noStart {
  515. background-color: #eee;
  516. }
  517. &.checking {
  518. background-color: #FFCC66;
  519. }
  520. &.completed {
  521. background-color: #29CC96;
  522. }
  523. }
  524. }
  525. }
  526. }
  527. .icon-wrap {
  528. position: absolute;
  529. top: 0;
  530. right: 0;
  531. width: 100rpx;
  532. height: 35rpx;
  533. image {
  534. width: 100%;
  535. height: 100%;
  536. }
  537. text {
  538. position: absolute;
  539. left: 28.75rpx;
  540. line-height: 35rpx;
  541. font-size: 17.5rpx;
  542. color: #fff;
  543. }
  544. }
  545. .footer {
  546. display: flex;
  547. flex-direction: row;
  548. justify-content: space-between;
  549. align-items: center;
  550. margin: 0 25rpx 16.87rpx;
  551. border-top: 1px solid #DADEE6;
  552. padding-top: 16.25rpx;
  553. font-size: 17.5rpx;
  554. line-height: 26.25rpx;
  555. color: #666E80;
  556. }
  557. }
  558. .content-list {
  559. padding-top: 50rpx;
  560. padding-bottom: 50rpx;
  561. width: 100%;
  562. height: 70vh;
  563. overflow-y: scroll;
  564. box-sizing: border-box;
  565. background-color: #fff;
  566. .list-item {
  567. display: flex;
  568. flex-direction: row;
  569. justify-content: space-between;
  570. align-items: center;
  571. border-bottom: 1px solid #DADEE6;
  572. padding: 0 25rpx;
  573. width: 100%;
  574. height: 87.5rpx;
  575. font-size: 22.5rpx;
  576. line-height: 33.75rpx;
  577. color: #292C33;
  578. .check-img {
  579. float: right;
  580. width: 19.37rpx;
  581. height: 14.37rpx;
  582. }
  583. >view {
  584. display: flex;
  585. flex-direction: row;
  586. .item-icon {
  587. border-radius: 5rpx;
  588. padding: 6.25rpx 11.25rpx;
  589. line-height: 26.25rpx;
  590. color: #29CC96;
  591. background-color: #e9f9f4;
  592. &.icon2 {
  593. color: #FFAA00;
  594. background-color: #fff9ef;
  595. }
  596. }
  597. }
  598. &.active {
  599. color: #3377FF;
  600. }
  601. }
  602. }
  603. </style>