dailyApprovalList.vue 8.0 KB

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