index.vue 9.7 KB

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