dailyApprovalList.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <div class="bgcolor">
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar class="navBar" title="汇报审批" left-arrow @click-left="onClickLeft" />
  6. <van-tabs v-model="type" color="#0057ba" @change="tabChange">
  7. <van-tab title="待审批" name="approvalPending" :disabled="disabled"></van-tab>
  8. <van-tab title="已审批" name="approvalSuccess" :disabled="disabled"></van-tab>
  9. </van-tabs>
  10. </div>
  11. <div class="container">
  12. <div class="lineGrey"></div>
  13. <div class="lineGrey"></div>
  14. <div class="lineGrey"></div>
  15. <div class="lineGrey"></div>
  16. <div class="lineGrey"></div>
  17. <div class="lineGrey"></div>
  18. <div class="lineGrey"></div>
  19. <div class="lineGrey"></div>
  20. <div class="lineGrey"></div>
  21. <van-list
  22. v-model="loading"
  23. :finished="finished"
  24. finished-text="--已经到底了--"
  25. @load="onLoad">
  26. <div class="cellcontent brud weekList" v-for="(item, index) in list" :key="index">
  27. <van-cell @click="approveFn(item)">
  28. <div class="cardContent">
  29. <div class="title" v-if="type == 'approvalPending'">
  30. <!-- reportType: 1日报;2周报;3半月报 -->
  31. <!-- <p class="textLeft" v-if="item.reportType == 1">
  32. {{ item.nickName }}的{{ item.reportTypeStr }}
  33. </p>
  34. <p class="textLeft" v-if="item.reportType == 2">
  35. {{ item.deptName }}的{{ item.reportTypeStr }}
  36. </p>
  37. <p class="textLeft" v-if="item.reportType == 3">
  38. {{ item.dqName }}的{{ item.reportTypeStr }}
  39. </p> -->
  40. <p class="textLeft">{{ filterName(item) }}的{{ item.reportTypeStr }}</p>
  41. <p class="textRight">审批</p>
  42. </div>
  43. <div class="title" v-if="type == 'approvalSuccess'">
  44. <p class="textLeft" v-if="item.reportType == 1">
  45. {{ item.nickName }}的{{ item.reportTypeStr }}
  46. </p>
  47. <p class="textLeft" v-if="item.reportType == 2">
  48. {{ item.deptName }}的{{ item.reportTypeStr }}
  49. </p>
  50. <p class="textLeft" v-if="item.reportType == 3">
  51. {{ item.dqName }}的{{ item.reportTypeStr }}
  52. </p>
  53. <p class="textRight">
  54. <van-rate
  55. v-model="item.number"
  56. :size="18"
  57. color="#ffd21e"
  58. void-icon="star"
  59. void-color="#eee"
  60. readonly />
  61. </p>
  62. </div>
  63. <div class="info" v-if="type == 'approvalPending'">
  64. 提交时间:{{ item.commitTime }}
  65. </div>
  66. <div class="info" v-if="type == 'approvalSuccess'">
  67. 审批时间:{{ item.approvalTime }}
  68. </div>
  69. </div>
  70. </van-cell>
  71. </div>
  72. <van-empty description="" v-if="list.length == 0" />
  73. </van-list>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import { approveList } from '@/api/index';
  79. export default {
  80. name: 'MyHistoricalWeekly',
  81. data() {
  82. return {
  83. type: 'approvalPending',
  84. disabled: false,
  85. pageNum: 1,
  86. pageSize: 10,
  87. loading: false,
  88. finished: false,
  89. list: [],
  90. };
  91. },
  92. created() {
  93. // this.approveList()
  94. },
  95. watch: {
  96. $route(to, from) {
  97. this.powerGrade = localStorage.getItem('powerGrade');
  98. this.pageNum = 1;
  99. if (to.path == '/dailyApprovalList' && from.path == '/home') {
  100. this.approveList();
  101. }
  102. if (to.path == '/dailyApprovalList' && from.path == '/daily') {
  103. this.pageNum = 1;
  104. this.approveList();
  105. }
  106. if (to.path == '/dailyApprovalList' && from.path == '/dailyApproval') {
  107. this.pageNum = 1;
  108. this.approveList();
  109. }
  110. if (to.path == '/dailyApprovalList' && from.path == '/weeklyApproval') {
  111. this.pageNum = 1;
  112. this.approveList();
  113. }
  114. if (to.path == '/dailyApprovalList' && from.path == '/doubleWeeklyApproval') {
  115. this.pageNum = 1;
  116. this.approveList();
  117. }
  118. if (to.path == '/dailyApprovalList' && from.path == '/dailyDetails') {
  119. this.pageNum = 1;
  120. this.approveList();
  121. }
  122. if (to.path == '/dailyApprovalList' && from.path == '/weeklyApprovalDetils') {
  123. this.pageNum = 1;
  124. this.approveList();
  125. }
  126. if (to.path == '/dailyApprovalList' && from.path == '/doubleWeeklyDetils') {
  127. this.pageNum = 1;
  128. this.approveList();
  129. }
  130. },
  131. },
  132. methods: {
  133. filterName(item) {
  134. // <!-- reportType: 1日报;2周报;3半月报 -->
  135. let name = '';
  136. // 应用服务平台
  137. if (item.postType == 'DIY') {
  138. if (item.reportType == 1) {
  139. name = item.nickName;
  140. } else if (item.reportType == 2) {
  141. name = item.deptName;
  142. } else if (item.reportType == 3) {
  143. name = item.dqName;
  144. }
  145. } else {
  146. name = item.nickName;
  147. }
  148. return name;
  149. },
  150. onLoad() {
  151. this.approveList();
  152. },
  153. approveFn(row) {
  154. this.list = [];
  155. if (this.type == 'approvalPending') {
  156. if (row.reportType == '1') {
  157. this.$router.push({
  158. path: '/dailyApproval',
  159. query: { reportId: row.id },
  160. });
  161. } else if (row.reportType == '2') {
  162. this.$router.push({
  163. path: '/weeklyApproval',
  164. query: { reportId: row.id },
  165. });
  166. } else {
  167. this.$router.push({
  168. path: '/doubleWeeklyApproval',
  169. query: { reportId: row.id },
  170. });
  171. }
  172. } else {
  173. if (row.reportType == '1') {
  174. this.$router.push({
  175. path: '/dailyDetails',
  176. query: { reportId: row.id },
  177. });
  178. } else if (row.reportType == '2') {
  179. this.$router.push({
  180. path: '/weeklyApprovalDetils',
  181. query: { reportId: row.id },
  182. });
  183. } else {
  184. this.$router.push({
  185. path: '/doubleWeeklyDetils',
  186. query: { reportId: row.id },
  187. });
  188. }
  189. }
  190. },
  191. tabChange() {
  192. this.disabled = true;
  193. this.list = [];
  194. this.pageNum = 1;
  195. this.approveList();
  196. },
  197. approveList() {
  198. let loading1 = this.$toast.loading({
  199. duration: 0,
  200. message: '数据加载中...',
  201. forbidClick: true,
  202. });
  203. if (this.refreshing) {
  204. this.list = [];
  205. this.refreshing = false;
  206. }
  207. approveList({ type: this.type, pageNum: this.pageNum, pageSize: this.pageSize }).then(
  208. (res) => {
  209. loading1.clear();
  210. this.disabled = false;
  211. this.loading = false;
  212. if (this.pageNum == 1) {
  213. this.list = [];
  214. this.refreshing = false;
  215. }
  216. this.list = this.list.concat(res.data);
  217. if (this.list.length >= res.total) {
  218. this.finished = true;
  219. } else {
  220. this.finished = false;
  221. }
  222. this.pageNum = this.pageNum + 1;
  223. }
  224. );
  225. },
  226. onClickLeft() {
  227. this.$router.push('/home');
  228. },
  229. },
  230. };
  231. </script>
  232. <style>
  233. .bgcolor {
  234. background-color: #f5f5f5;
  235. }
  236. .cardContent {
  237. box-sizing: border-box;
  238. }
  239. .cardContent .title {
  240. font-size: 14px;
  241. font-weight: bold;
  242. color: #333;
  243. line-height: 14px;
  244. }
  245. .cardContent .info {
  246. font-size: 14px;
  247. color: #999;
  248. line-height: 26px;
  249. }
  250. .cardContent .title p {
  251. padding: 0;
  252. margin: 0;
  253. }
  254. .cardContent .title .textLeft {
  255. display: inline-block;
  256. padding-bottom: 10px;
  257. }
  258. .cardContent .title .textRight {
  259. float: right;
  260. color: #0057ba;
  261. }
  262. .van-tab--active {
  263. color: #0057ba;
  264. }
  265. .brud {
  266. margin: 16px;
  267. border-radius: 8px;
  268. overflow: hidden;
  269. }
  270. .weekList {
  271. border-radius: 0;
  272. }
  273. .weekList .van-cell {
  274. border-radius: 6px;
  275. overflow: hidden;
  276. }
  277. .weekList .cardContent .title {
  278. line-height: 32px;
  279. }
  280. </style>