checkList.vue 14 KB

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