checkList.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. <scroll-view scroll-y="true" class="check-map-list">
  10. <view class="item" v-for="(item, index) in depList" @click="gotoCheckMainPointsPage(item)" :key="index">
  11. <view class="title-wrap">
  12. <text>{{item.deptName}}</text>
  13. <view>
  14. <image src="../../static/icon-map.png"></image>
  15. <text>{{item.deptClassName}}</text>
  16. </view>
  17. <view class="scoreAndStatus">
  18. <text v-if="item.scoreInfo">{{item.scoreInfo&&((item.scoreInfo.split('/')).map(t=>Number(t).toFixed(1))).join('/')}}</text>
  19. <view :class="getStatus(item.completeDes)">{{item.completeDes}}</view>
  20. </view>
  21. </view>
  22. <view class="content">
  23. <text>{{item.decs}}</text>
  24. <text>
  25. 要点概览:{{item.checkPointNames}}
  26. </text>
  27. </view>
  28. <view class="footer">
  29. <text>查核人:{{item.empName}}</text>
  30. <text v-if="item.startDate && item.endDate">
  31. {{item.startDate}}~{{item.endDate}}
  32. </text>
  33. </view>
  34. <view class="icon-wrap" v-if="Number(item.completeStatus) === 2 || Number(item.completeStatus) === 3">
  35. <image :src="`../../static/${Number(item.completeStatus) === 2 ?'hight-bg':'top-img'}.png`"></image>
  36. <text>{{item.completeDes}}</text>
  37. </view>
  38. </view>
  39. </scroll-view>
  40. <tm-no-data v-if="depList.length === 0" :textArr="['暂时没有内容可以展示哦', '请返回上一页面或尝试刷新页面']" />
  41. <tm-modal v-show="showModal" v-on:click="showModalHandle(false)">
  42. <scroll-view scroll-y="true" class="content-list">
  43. <view class="list-item" v-for="(item, index) in planList" :class="{active: checkId === item.id}"
  44. @click="checkItem($event, item.id)" :key="index">
  45. <view>
  46. <text>{{item.name}}({{item.startDate}} ~ {{item.endDate}})</text>
  47. <view class="item-icon" :class="{icon2: Number(item.status) === 2}"
  48. v-if="Number(item.status) !== 1">
  49. {{Number(item.status) === 2 ? '进行中' : '已完成'}}
  50. </view>
  51. </view>
  52. <image class="check-img" v-if="checkId === item.id" src="../../static/checkStatus.png"></image>
  53. </view>
  54. </scroll-view>
  55. </tm-modal>
  56. <tm-callback-listpage />
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. mapState
  62. } from 'vuex';
  63. import {
  64. _stopPropagation
  65. } from "../../utils/compatible.js";
  66. export default {
  67. data() {
  68. return {
  69. showModal: false,
  70. planList: [],
  71. checkId: '',
  72. depList: [],
  73. searchKey:'',
  74. ifSearchMod:false
  75. };
  76. },
  77. computed: {
  78. ...mapState({
  79. ifReloadPageData:state=>{
  80. return state.checkList.ifReloadPageData
  81. },
  82. }),
  83. createTitle: function() {
  84. let item = this.planList.find((item) => item.id === this.checkId);
  85. if (item) {
  86. let name = item.name;
  87. return name.slice(0, name.length - 3) + `/${this.planList.length}` + name.slice(-3);
  88. } else {
  89. return '';
  90. }
  91. }
  92. },
  93. watch:{
  94. /**
  95. * @param {Boolen} newVal
  96. */
  97. ifReloadPageData:function(newVal){
  98. if(newVal){
  99. this.getPageList();
  100. }
  101. }
  102. },
  103. onLoad: function({
  104. situationId,
  105. situationType
  106. }) {
  107. this.situationType = situationType;
  108. this.situationId = situationId;
  109. this.getPageList();
  110. },
  111. onHide(){
  112. this.$store.commit('checkList/comChangeState', {
  113. key: 'ifReloadPageData',
  114. data: false
  115. });
  116. },
  117. onUnload() {
  118. this.$store.commit('checkList/comChangeState', {
  119. key: 'ifReloadPageData',
  120. data: false
  121. });
  122. },
  123. methods: {
  124. getPageList:function(){
  125. this.dispatch('planList', {
  126. situationId:this.situationId
  127. }).then((data) => {
  128. if (data && data.length > 0) {
  129. this.planList = data;
  130. let checkArr = data.filter((item) => Number(item.status) === 2).sort((a, b) => a
  131. .createTime - b.createTime);
  132. this.checkId = checkArr ? checkArr[checkArr.length - 1].id :
  133. data.length > 0 ? data[0].id : '';
  134. this.getDepList();
  135. }
  136. });
  137. },
  138. /**
  139. * @str string [noStart,checking,completed]
  140. */
  141. getStatus:function(str){ //设置状态颜色
  142. switch(str){
  143. case '未分配':
  144. return 'status noStart'
  145. break;
  146. case '进行中':
  147. return 'status checking'
  148. break;
  149. case '已完成':
  150. return 'status completed'
  151. break;
  152. }
  153. },
  154. checkItem: function(e, id) {
  155. _stopPropagation(e);
  156. if (this.checkId === id) return;
  157. this.checkId = id;
  158. this.getDepList();
  159. },
  160. getDepList: function() {
  161. this.dispatch('depList', {
  162. checkId: this.checkId,
  163. situationType: this.situationType
  164. }).then((data) => {
  165. if (data) {
  166. this.depList = data.sort((a, b) => {
  167. if (a.sort && b.sort) return a.sort - b.sort;
  168. });
  169. this.showModalHandle(false);
  170. }
  171. });
  172. },
  173. showModalHandle: function(showModal) {
  174. this.showModal = showModal;
  175. },
  176. gotoCheckMainPointsPage({
  177. checkId,
  178. deptId,
  179. finishedStatus,
  180. pageTemplateId,
  181. }) {
  182. //跳转到查核要点
  183. uni.navigateTo({
  184. url: `/pages/checkMainPoints/checkMainPoints?checkId=${checkId}&deptId=${deptId}&finishedStatus=${finishedStatus}&situationType=${this.situationType}&pageTemplateId=${pageTemplateId}`
  185. });
  186. },
  187. dispatch: function(key, data) {
  188. return this.$store.dispatch({
  189. type: 'checkList/commActions',
  190. key,
  191. data
  192. });
  193. },
  194. }
  195. }
  196. </script>
  197. <style lang="less" scoped>
  198. .check-map-list-page {
  199. position: relative;
  200. padding-top: 30rpx;
  201. .tm-top-menu {
  202. width: 93%;
  203. margin:0 auto;
  204. }
  205. .top-menu {
  206. overflow: hidden;
  207. display: flex;
  208. flex-direction: row;
  209. justify-content: center;
  210. align-items: center;
  211. height: 50rpx;
  212. margin-bottom: 20rpx;
  213. image {
  214. margin-left: 9.37rpx;
  215. width: 12.5rpx;
  216. height: 12.5rpx;
  217. }
  218. }
  219. &.preventScroll {
  220. position: fixed;
  221. }
  222. }
  223. .check-map-list {
  224. height: 100%;
  225. .item {
  226. position: relative;
  227. .title-wrap {
  228. .scoreAndStatus {
  229. position: absolute;
  230. right:20rpx;
  231. .status {
  232. display: flex;
  233. justify-content: center;
  234. width: 150rpx;
  235. height: 35rpx;
  236. font-size: 17.5rpx;
  237. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  238. font-weight: 500;
  239. color: #FFFFFF;
  240. border-radius: 20rpx;
  241. &.noStart {
  242. background-color:#eee;
  243. }
  244. &.checking {
  245. background-color:#FFCC66;
  246. }
  247. &.completed {
  248. background-color:#29CC96;
  249. }
  250. }
  251. }
  252. }
  253. }
  254. .icon-wrap {
  255. position: absolute;
  256. top: 0;
  257. right: 0;
  258. width: 100rpx;
  259. height: 35rpx;
  260. image {
  261. width: 100%;
  262. height: 100%;
  263. }
  264. text {
  265. position: absolute;
  266. left: 28.75rpx;
  267. line-height: 35rpx;
  268. font-size: 17.5rpx;
  269. color: #fff;
  270. }
  271. }
  272. .footer {
  273. display: flex;
  274. flex-direction: row;
  275. justify-content: space-between;
  276. align-items: center;
  277. margin: 0 25rpx 16.87rpx;
  278. border-top: 1px solid #DADEE6;
  279. padding-top: 16.25rpx;
  280. font-size: 17.5rpx;
  281. line-height: 26.25rpx;
  282. color: #666E80;
  283. }
  284. }
  285. .content-list {
  286. padding-top: 50rpx;
  287. padding-bottom: 50rpx;
  288. width: 100%;
  289. height: 70vh;
  290. overflow-y: scroll;
  291. box-sizing: border-box;
  292. background-color: #fff;
  293. .list-item {
  294. display: flex;
  295. flex-direction: row;
  296. justify-content: space-between;
  297. align-items: center;
  298. border-bottom: 1px solid #DADEE6;
  299. padding: 0 25rpx;
  300. width: 100%;
  301. height: 87.5rpx;
  302. font-size: 22.5rpx;
  303. line-height: 33.75rpx;
  304. color: #292C33;
  305. .check-img {
  306. float: right;
  307. width: 19.37rpx;
  308. height: 14.37rpx;
  309. }
  310. >view {
  311. display: flex;
  312. flex-direction: row;
  313. .item-icon {
  314. border-radius: 5rpx;
  315. padding: 6.25rpx 11.25rpx;
  316. line-height: 26.25rpx;
  317. color: #29CC96;
  318. background-color: #e9f9f4;
  319. &.icon2 {
  320. color: #FFAA00;
  321. background-color: #fff9ef;
  322. }
  323. }
  324. }
  325. &.active {
  326. color: #3377FF;
  327. }
  328. }
  329. }
  330. </style>