checkList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  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. //addy by yfb 20230522 回退刷新
  344. ReloadPageData: function(newVal) {
  345. //console.log('newval',newVal);
  346. if (newVal) {
  347. this.getPageList();
  348. }
  349. },
  350. dispatch: function(key, data) {
  351. return this.$store.dispatch({
  352. type: 'checkList/commActions',
  353. key,
  354. data
  355. });
  356. },
  357. }
  358. }
  359. </script>
  360. <style lang="less" scoped>
  361. .check-map-list-page {
  362. position: relative;
  363. padding-top: 30rpx;
  364. .tm-top-menu {
  365. width: 93%;
  366. margin: 0 auto;
  367. }
  368. .top-menu {
  369. overflow: hidden;
  370. display: flex;
  371. flex-direction: row;
  372. justify-content: center;
  373. align-items: center;
  374. height: 50rpx;
  375. margin-bottom: 20rpx;
  376. image {
  377. margin-left: 9.37rpx;
  378. width: 12.5rpx;
  379. height: 12.5rpx;
  380. }
  381. }
  382. .selectableList {
  383. display: flex;
  384. width: 100%;
  385. flex-direction: column;
  386. height: 50vh;
  387. padding-top: 50rpx;
  388. box-sizing: border-box;
  389. border-radius: 25rpx 25rpx 0px 0px;
  390. background-color: #FFFFFF;
  391. .listWrap {
  392. height: calc(50vh - 75rpx);
  393. overflow-y: scroll;
  394. .list {
  395. height: 87.5rpx;
  396. line-height: 87.5rpx;
  397. text-align: center;
  398. font-size: 30rpx;
  399. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  400. font-weight: 400;
  401. color: #8A8F99;
  402. &.on {
  403. font-weight: 500;
  404. color: #3377FF;
  405. }
  406. }
  407. }
  408. .btnGroup {
  409. display: flex;
  410. width: 100%;
  411. flex-direction: row;
  412. justify-content: center;
  413. align-items: center;
  414. .btn {
  415. width: 50%;
  416. height: 75rpx;
  417. line-height: 75rpx;
  418. text-align: center;
  419. font-size: 22.5rpx;
  420. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  421. font-weight: 400;
  422. color: #3377FF;
  423. }
  424. .cancelBtn {
  425. border-top: 0.62rpx solid #DADEE6;
  426. }
  427. .confirmBtn {
  428. color: #FFFFFF;
  429. background: #3377FF;
  430. }
  431. }
  432. }
  433. .searchBar {
  434. width: 93%;
  435. margin: 0 auto;
  436. .filter {
  437. display: flex;
  438. flex-direction: row;
  439. justify-content: space-between;
  440. align-items: center;
  441. margin-bottom: 15rpx;
  442. padding: 0 25rpx;
  443. background: #FFFFFF;
  444. .selecter {
  445. display: flex;
  446. width: 25%;
  447. height: 70rpx;
  448. flex-direction: row;
  449. justify-content: space-between;
  450. align-items: center;
  451. padding-right: 25rpx;
  452. border-right: 0.62rpx solid #DADEE6;
  453. &>text {
  454. width: 112.5rpx;
  455. font-size: 25rpx;
  456. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  457. font-weight: 500;
  458. color: #292C33;
  459. text-overflow: ellipsis;
  460. overflow: hidden;
  461. white-space: nowrap;
  462. }
  463. &>image {
  464. width: 11.25rpx;
  465. height: 7.5rpx;
  466. }
  467. }
  468. .searchBar {
  469. display: flex;
  470. width: 75%;
  471. flex-direction: row;
  472. align-items: center;
  473. height: 70rpx;
  474. padding-left: 25rpx;
  475. .serachIcon {
  476. width: 25rpx;
  477. height: 25rpx;
  478. }
  479. .searchVal {
  480. width: 79%;
  481. padding-left: 25rpx;
  482. font-size: 25rpx;
  483. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  484. font-weight: 400;
  485. color: #292C33;
  486. }
  487. .searchBtn {
  488. padding-left: 25rpx;
  489. font-size: 25rpx;
  490. font-family: SourceHanSansCN-Normal, SourceHanSansCN;
  491. font-weight: 400;
  492. color: #3377FF;
  493. white-space: nowrap;
  494. border-left: 1rpx solid #DADEE6;
  495. }
  496. }
  497. }
  498. }
  499. &.preventScroll {
  500. position: fixed;
  501. }
  502. }
  503. .check-map-list {
  504. height: 100%;
  505. .item {
  506. position: relative;
  507. .title-wrap {
  508. .scoreAndStatus {
  509. position: absolute;
  510. right: 20rpx;
  511. .status {
  512. display: flex;
  513. justify-content: center;
  514. width: 150rpx;
  515. height: 35rpx;
  516. font-size: 17.5rpx;
  517. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  518. font-weight: 500;
  519. color: #FFFFFF;
  520. border-radius: 20rpx;
  521. &.noStart {
  522. background-color: #eee;
  523. }
  524. &.checking {
  525. background-color: #FFCC66;
  526. }
  527. &.completed {
  528. background-color: #29CC96;
  529. }
  530. }
  531. }
  532. }
  533. }
  534. .icon-wrap {
  535. position: absolute;
  536. top: 0;
  537. right: 0;
  538. width: 100rpx;
  539. height: 35rpx;
  540. image {
  541. width: 100%;
  542. height: 100%;
  543. }
  544. text {
  545. position: absolute;
  546. left: 28.75rpx;
  547. line-height: 35rpx;
  548. font-size: 17.5rpx;
  549. color: #fff;
  550. }
  551. }
  552. .footer {
  553. display: flex;
  554. flex-direction: row;
  555. justify-content: space-between;
  556. align-items: center;
  557. margin: 0 25rpx 16.87rpx;
  558. border-top: 1px solid #DADEE6;
  559. padding-top: 16.25rpx;
  560. font-size: 17.5rpx;
  561. line-height: 26.25rpx;
  562. color: #666E80;
  563. }
  564. }
  565. .content-list {
  566. padding-top: 50rpx;
  567. padding-bottom: 50rpx;
  568. width: 100%;
  569. height: 70vh;
  570. overflow-y: scroll;
  571. box-sizing: border-box;
  572. background-color: #fff;
  573. .list-item {
  574. display: flex;
  575. flex-direction: row;
  576. justify-content: space-between;
  577. align-items: center;
  578. border-bottom: 1px solid #DADEE6;
  579. padding: 0 25rpx;
  580. width: 100%;
  581. height: 87.5rpx;
  582. font-size: 22.5rpx;
  583. line-height: 33.75rpx;
  584. color: #292C33;
  585. .check-img {
  586. float: right;
  587. width: 19.37rpx;
  588. height: 14.37rpx;
  589. }
  590. >view {
  591. display: flex;
  592. flex-direction: row;
  593. .item-icon {
  594. border-radius: 5rpx;
  595. padding: 6.25rpx 11.25rpx;
  596. line-height: 26.25rpx;
  597. color: #29CC96;
  598. background-color: #e9f9f4;
  599. &.icon2 {
  600. color: #FFAA00;
  601. background-color: #fff9ef;
  602. }
  603. }
  604. }
  605. &.active {
  606. color: #3377FF;
  607. }
  608. }
  609. }
  610. </style>