checkList.vue 7.9 KB

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