index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <view class="page_notice" :style="{paddingTop: statusBarHeight + 430 + 'rpx', paddingBottom: safeAreaBottom + 160 + 'rpx' }">
  3. <noticeHeader
  4. title="审核材料"
  5. mode="material"
  6. tabMode="index"
  7. :showSearch="true"
  8. :showFilter="true"
  9. :showStageBtn="true"
  10. :showTabs="true"
  11. :showCreateBtn="true"
  12. :tabs="tabs"
  13. :activeTab="activeTab"
  14. :academicYearOptions="academicYearOptions"
  15. :academicYearIds="academicYearIds"
  16. :categoryData="categoryData"
  17. @tabChange="handleTabChange"
  18. @academicYearChange="handleAcademicYearChange"
  19. @categoryChange="handleCategoryChange"
  20. @materialTypeChange="handleMaterialTypeChange"
  21. @searchChange="handleSearchChange"
  22. @stageChange="handleStageChange"
  23. @create="handleCreate">
  24. </noticeHeader>
  25. <view class="notice_content">
  26. <view class="notice_list">
  27. <scroll-view scroll-y v-for="item in taskList" :key="item.id" class="notice_item">
  28. <!-- 任务内容 -->
  29. <view class="item_content">
  30. <view class="notice_title_row">
  31. <image class="notice_icon" src="/static/image/materialCollection/docIcon.png" mode="aspectFit"></image>
  32. <text class="notice_title">{{ item.taskName }}</text>
  33. </view>
  34. <view class="notice_meta">
  35. <view class="status_tag" :class="statusClassMap[item.taskStatus] || ''">
  36. <text>{{ taskStatusMap[item.taskStatus] }}</text>
  37. </view>
  38. <text class="meta_text ">{{ truncateText(item.departmentName, 5) }}</text>
  39. <text class="meta_text ">{{ truncateText(item.materialCategoryName, 5) }}</text>
  40. <text class="meta_text">{{ truncateText(item.createdBy, 5) }}</text>
  41. </view>
  42. </view>
  43. <!-- 任务底部 -->
  44. <view class="item_bottom">
  45. <view class="notice_stats">
  46. <view class="status_tag" :class="tabStatusClassMap[activeTab] || ''">
  47. <text>{{ tabs[activeTab] }}: {{ item.taskTargetVos.length }}</text>
  48. </view>
  49. <text class="stats_text">剩余时间: {{remainingDays(item.endTime) }}天</text>
  50. </view>
  51. <view class="notice_actions">
  52. <view class="action_btn edit" >
  53. <text>查看</text>
  54. </view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. <noData v-if="taskList.length === 0" centered text="暂无审核材料" />
  59. </view>
  60. </view>
  61. <common-tabbar></common-tabbar>
  62. </view>
  63. </template>
  64. <script setup>
  65. import { ref, onMounted } from 'vue';
  66. import NoticeHeader from '@/components/noticeHeader.vue';
  67. import CommonTabbar from '@/components/commonTabbar.vue';
  68. import NoData from '@/components/noData.vue';
  69. import { useSafeArea } from '@/common/safeArea';
  70. import notification from '@/reqApi/notification.js';
  71. import {truncateText, remainingDays } from '@/common/common.js';
  72. const { statusBarHeight, safeAreaBottom, initSafeArea } = useSafeArea();
  73. const tabs = ['待提交', '审核中', '已驳回', '已提交'];
  74. const activeTab = ref(0);
  75. const stageIndex = ref(0);
  76. const academicYearIndex = ref(0);
  77. const academicYearOptions = ref(['']);
  78. const academicYearIds = ref(['']);
  79. const academicYearCodes = ref(['']);
  80. const currentSchoolYearId = ref('');
  81. const currentSchoolYearCode = ref('');
  82. const categoryIndex = ref(0);
  83. const categoryId = ref('');
  84. const materialTypeIndex = ref(0);
  85. const materialTypeId = ref('');
  86. const categoryData = ref([]);
  87. const word = ref('');
  88. const taskList = ref([]);
  89. const statusMap = {
  90. 0: '待开始',
  91. 1: '进行中',
  92. 2: '已结束'
  93. };
  94. const statusClassMap = {
  95. 0: 'status_pending',
  96. 1: 'status_published',
  97. 2: 'status_closed'
  98. };
  99. const taskStatusMap = {
  100. 0: '待开始',
  101. 1: '进行中',
  102. 2: '已结束'
  103. }
  104. const tabStatusClassMap = {
  105. 0: 'tab_not_submit', // 待提交
  106. 1: 'tab_reviewing', // 审核中
  107. 2: 'tab_rejected', // 已驳回
  108. 3: 'tab_submitted' // 已提交
  109. };
  110. const fetchTaskList = async () => {
  111. taskList.value = [];
  112. try {
  113. // stageIndex: 0-进行中(taskStatus=1), 1-已结束(taskStatus=2)
  114. const taskStatusMap = { 0: 1, 1: 2 };
  115. const params = {
  116. schoolYearCode: currentSchoolYearCode.value || null,
  117. schoolYearId: currentSchoolYearId.value || null,
  118. departmentId: categoryId.value || null,
  119. materialCategory: materialTypeId.value || null,
  120. taskName: word.value || '',
  121. taskStatus: taskStatusMap[stageIndex.value] || null,
  122. pageNum: 1,
  123. pageSize: 9999
  124. };
  125. const res = await notification.find_teacher_task_target_list(params);
  126. if (res.data) {
  127. // 根据当前选中的标签返回不同数组数据
  128. const listMap = {
  129. 0: 'notSubmitList', // 待提交
  130. 1: 'notReviewList', // 审核中
  131. 2: 'reviewReasonList', // 已驳回
  132. 3: 'reviewList' // 已提交
  133. };
  134. const listKey = listMap[activeTab.value] || 'notSubmitList';
  135. taskList.value = res.data[listKey] || [];
  136. } else {
  137. taskList.value = [];
  138. }
  139. } catch (error) {
  140. console.error('获取任务列表失败:', error);
  141. taskList.value = [];
  142. }
  143. };
  144. const fetchSchoolYearList = async () => {
  145. try {
  146. const res = await notification.getSchoolYearList();
  147. if (res.data && Array.isArray(res.data)) {
  148. const names = res.data.map(item => item.schoolYearName);
  149. const ids = res.data.map(item => item.id);
  150. const codes = res.data.map(item => item.schoolYearCode);
  151. academicYearOptions.value = [...names];
  152. academicYearIds.value = [...ids];
  153. academicYearCodes.value = [...codes];
  154. // 默认选中第一个学年学期
  155. if (res.data.length > 0) {
  156. academicYearIndex.value = 0;
  157. currentSchoolYearId.value = res.data[0].id;
  158. currentSchoolYearCode.value = res.data[0].schoolYearCode;
  159. }
  160. }
  161. } catch (error) {
  162. console.error('获取学年学期列表失败:', error);
  163. }
  164. };
  165. const fetchCategoryList = async () => {
  166. try {
  167. const res = await notification.getCategoryList();
  168. if (res.data && Array.isArray(res.data)) {
  169. categoryData.value = res.data;
  170. }
  171. } catch (error) {
  172. console.error('获取分类列表失败:', error);
  173. }
  174. };
  175. onMounted(async () => {
  176. initSafeArea();
  177. await fetchSchoolYearList();
  178. fetchCategoryList();
  179. fetchTaskList();
  180. });
  181. const handleTabChange = (status) => {
  182. activeTab.value = status;
  183. fetchTaskList();
  184. };
  185. const handleStageChange = (index) => {
  186. stageIndex.value = index;
  187. // stageIndex: 0-进行中, 1-已结束
  188. // 后续可以根据阶段筛选任务列表
  189. fetchTaskList();
  190. };
  191. const handleAcademicYearChange = (index, id) => {
  192. academicYearIndex.value = index;
  193. currentSchoolYearId.value = id || '';
  194. currentSchoolYearCode.value = academicYearCodes.value[index] || '';
  195. fetchTaskList();
  196. };
  197. // 分类选择
  198. const handleCategoryChange = (index, id) => {
  199. categoryIndex.value = index;
  200. categoryId.value = id;
  201. // 清空类目选择
  202. materialTypeIndex.value = 0;
  203. materialTypeId.value = null;
  204. fetchTaskList();
  205. };
  206. // 类目选择
  207. const handleMaterialTypeChange = (index, id) => {
  208. materialTypeIndex.value = index;
  209. materialTypeId.value = id;
  210. fetchTaskList();
  211. };
  212. const handleSearchChange = (keyword) => {
  213. word.value = keyword;
  214. fetchTaskList();
  215. };
  216. const handleCreate = () => {
  217. uni.navigateTo({
  218. url: '/pages/materialCollection/submitMaterial/index'
  219. });
  220. };
  221. const handleDetail = (id) => {
  222. uni.navigateTo({
  223. url: `/pages/materialCollection/submitMaterial/index?id=${id}`
  224. });
  225. };
  226. </script>
  227. <style lang="scss">
  228. .page_notice {
  229. min-height: 100vh;
  230. display: flex;
  231. flex-direction: column;
  232. background-color: #FFFFFF;
  233. box-sizing: border-box;
  234. }
  235. .notice_content {
  236. flex: 1;
  237. display: flex;
  238. flex-direction: column;
  239. overflow: hidden;
  240. padding-left: 0rpx;
  241. padding-right: 0rpx;
  242. }
  243. .notice_list {
  244. flex: 1;
  245. overflow-y: auto;
  246. overflow-x: hidden;
  247. padding: 0 24rpx;
  248. display: flex;
  249. flex-direction: column;
  250. }
  251. .notice_item {
  252. background-color: #F9FAFF;
  253. border-radius: 20rpx;
  254. margin-bottom: 24rpx;
  255. border: 2rpx solid #E4E7ED;
  256. .item_content {
  257. padding: 24rpx;
  258. .notice_title_row {
  259. display: flex;
  260. align-items: center;
  261. margin-bottom: 16rpx;
  262. .notice_icon {
  263. width: 32rpx;
  264. height: 32rpx;
  265. margin-right: 16rpx;
  266. }
  267. .notice_title {
  268. flex: 1;
  269. font-weight: 500;
  270. font-size: 28rpx;
  271. color: #333333;
  272. overflow: hidden;
  273. text-overflow: ellipsis;
  274. white-space: nowrap;
  275. }
  276. }
  277. .notice_meta {
  278. display: flex;
  279. align-items: center;
  280. flex-wrap: wrap;
  281. gap: 16rpx;
  282. .status_tag {
  283. font-size: 24rpx;
  284. height: 48rpx;
  285. width: 96rpx;
  286. text-align: center;
  287. line-height: 48rpx;
  288. border-radius: 4rpx;
  289. font-weight: 400;
  290. border-radius: 8rpx;
  291. &.status_pending {
  292. background: rgba(46, 100, 250, 0.1);
  293. color: #2E64FA;
  294. }
  295. &.status_published {
  296. background: rgba(82, 196, 26, 0.1);
  297. color: #2BC644;
  298. }
  299. &.status_closed {
  300. background: #6666661a;
  301. color: #666666;
  302. }
  303. }
  304. .need_shenhe {
  305. width: 48rpx;
  306. height: 48rpx;
  307. background: rgba(245,108,108,0.1);
  308. border-radius: 8rpx 8rpx 8rpx 8rpx;
  309. font-size: 24rpx;
  310. color: #F56C6C;
  311. text-align: center;
  312. line-height: 48rpx;
  313. }
  314. .meta_text {
  315. font-size: 24rpx;
  316. color: #999999;
  317. line-height: 48rpx;
  318. }
  319. .textLength {
  320. max-width: 160rpx;
  321. overflow: hidden;
  322. text-overflow: ellipsis;
  323. white-space: nowrap;
  324. }
  325. }
  326. }
  327. .item_bottom {
  328. border-top: 2rpx solid #E4E7ED;
  329. display: flex;
  330. flex-direction: row;
  331. justify-content: space-between;
  332. align-items: center;
  333. padding: 24rpx 16rpx;
  334. .notice_stats {
  335. display: flex;
  336. align-items: center;
  337. gap: 16rpx;
  338. .stats_text {
  339. font-size: 24rpx;
  340. color: #999999;
  341. &:first-child {
  342. margin-right: 32rpx;
  343. }
  344. }
  345. .status_tag{
  346. font-size: 24rpx;
  347. text-align: center;
  348. padding: 8rpx 12rpx;
  349. // height: 48rpx;
  350. // line-height: 48rpx;
  351. font-weight: 400;
  352. border-radius: 8rpx;
  353. &.tab_not_submit {
  354. background: rgba(46,100,250,0.1);
  355. color: #2E64FA;
  356. }
  357. &.tab_reviewing {
  358. background: rgba(251,159,52,0.1);
  359. color: #FB9F34;
  360. }
  361. &.tab_rejected {
  362. background: rgba(245,108,108,0.1);
  363. color: #F56C6C;
  364. }
  365. &.tab_submitted {
  366. background: rgba(43,198,68,0.1);
  367. color: #2BC644;
  368. }
  369. }
  370. }
  371. .notice_actions {
  372. display: flex;
  373. justify-content: flex-end;
  374. gap: 16rpx;
  375. .action_btn {
  376. font-size: 24rpx;
  377. padding: 12rpx 24rpx;
  378. border-radius: 8rpx;
  379. border: 2rpx solid transparent;
  380. &.delete {
  381. border-color: #F56C6C;
  382. color: #F56C6C;
  383. background-color: #FFFFFF;
  384. &.disabled {
  385. border-color: #C0C4CC;
  386. color: #C0C4CC;
  387. background-color: #FFFFFF;
  388. }
  389. }
  390. &.edit {
  391. border-color: #2E64FA;
  392. color: #2E64FA;
  393. background-color: #FFFFFF;
  394. &.disabled {
  395. border-color: #C0C4CC;
  396. color: #C0C4CC;
  397. background-color: #FFFFFF;
  398. }
  399. }
  400. &.disable {
  401. color: #C0C4CC !important;
  402. cursor: not-allowed;
  403. border-color: #C0C4CC !important;
  404. }
  405. &.disableLock{
  406. color: #C0C4CC !important;
  407. cursor: not-allowed;
  408. background-color: #F3F3F3 !important;
  409. border-color: #F3F3F3 !important;
  410. }
  411. }
  412. }
  413. }
  414. &:last-child {
  415. margin-bottom: 0;
  416. }
  417. }
  418. </style>