index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <!--
  2. * @Author: wanglj wanglijie@dashoo.cn
  3. * @Date: 2025-03-11 18:02:10
  4. * @LastEditors: wanglj wanglijie@dashoo.cn
  5. * @LastEditTime: 2025-03-19 11:51:27
  6. * @FilePath: \vant-demo-master\vant\vue3-ts\src\view\login\index.vue
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. -->
  9. <template>
  10. <div class="app-container">
  11. <!-- <header>
  12. <div class="search">
  13. <input v-model="state.form.keyWord" type="text" placeholder="输入关键词进行搜索" />
  14. <button @click="onSearch">搜索</button>
  15. </div>
  16. <ul>
  17. <li>仪器设备</li>
  18. <li>技术平台</li>
  19. <li>技术服务</li>
  20. <li>审批流程</li>
  21. </ul>
  22. </header> -->
  23. <div class="card">
  24. <h4>常用功能</h4>
  25. <ul class="nav">
  26. <li>
  27. <img src="../../assets/img/home-equip.png" alt="" />
  28. <p>仪器预约</p>
  29. </li>
  30. <li>
  31. <img src="../../assets/img/home-in.png" alt="" />
  32. <p>入室申请</p>
  33. </li>
  34. <li>
  35. <img src="../../assets/img/home-appoint.png" alt="" />
  36. <p>入室预约</p>
  37. </li>
  38. <li>
  39. <img src="../../assets/img/home-tech.png" alt="" />
  40. <p>技术委托</p>
  41. </li>
  42. <li @click="onRouterPush('/training')">
  43. <img src="../../assets/img/home-training.png" alt="" />
  44. <p>培训报名</p>
  45. </li>
  46. <li @click="onRouterPush('/exam-cover')">
  47. <img src="../../assets/img/home-animal.png" alt="" />
  48. <p>动物笼位</p>
  49. </li>
  50. <li>
  51. <img src="../../assets/img/home-file.png" alt="" />
  52. <p>资料下载</p>
  53. </li>
  54. <li>
  55. <img src="../../assets/img/home-fund.png" alt="" />
  56. <p>财务中心</p>
  57. </li>
  58. </ul>
  59. </div>
  60. <div class="card">
  61. <h4>
  62. 审批流程
  63. <span class="link" @click="onRouterPush('/todo', { type: 'approval' })">全部审批>></span>
  64. </h4>
  65. <ul class="approval">
  66. <li v-for="item in approvalList" :key="item.id">
  67. <div class="flex justify-between">
  68. <van-text-ellipsis :content="`${item.instTitle}`" />
  69. <span class="time">{{ formatDate(new Date(item.createdTime), 'YYYY-mm-dd') }}</span>
  70. </div>
  71. <div class="flex justify-between">
  72. <van-text-ellipsis :content="`您提交的${item.defName}正在审核`" />
  73. <a href="javascript:void(0);" @click="onRouterPush('/todo/approval-detail', { id: item.id })">查看详情</a>
  74. </div>
  75. </li>
  76. </ul>
  77. </div>
  78. <div class="card">
  79. <h4>
  80. 通知公告
  81. <span class="link" @click="onRouterPush('/todo', { type: 'notice' })">全部通知>></span>
  82. </h4>
  83. <ul class="approval">
  84. <li v-for="item in noticeList" :key="item.id" @click="onRouterPush('/todo/notice-detail', { id: item.id })">
  85. <div class="flex justify-between">
  86. <van-text-ellipsis :content="`【${item.noticeType === '10' ? '公告' : '通知'}】${item.noticeTitle}`" />
  87. <span class="time">{{ formatDate(new Date(item.noticeTime), 'YYYY-mm-dd') }}</span>
  88. </div>
  89. </li>
  90. </ul>
  91. </div>
  92. <div class="card mb20">
  93. <h4>
  94. 培训通知
  95. <span class="link" @click="onRouterPush('/training')">全部培训>></span>
  96. </h4>
  97. <ul class="approval">
  98. <li v-for="item in trainingList" :key="item.id" @click="onRouterPush('/training/enroll', { state: item.id })">
  99. <div class="flex justify-between">
  100. <van-text-ellipsis :content="`${item.title}`" />
  101. <span class="time">{{ formatDate(new Date(item.startTime), 'YYYY-mm-dd') }}</span>
  102. </div>
  103. </li>
  104. </ul>
  105. </div>
  106. </div>
  107. </template>
  108. <script name="home" lang="ts" setup>
  109. import to from 'await-to-js'
  110. import { formatDate } from '/@/utils/formatTime'
  111. import { onMounted, reactive, ref } from 'vue'
  112. import { useDictApi } from '/@/api/system/dict'
  113. import { useProApi } from '/@/api/project'
  114. import { useDeptApi } from '/@/api/system/dept'
  115. import { useExecutionApi } from '/@/api/execution'
  116. import { useNewsApi } from '/@/api/system/news'
  117. import { useTrainingApi } from '/@/api/training'
  118. import { useRouter } from 'vue-router'
  119. const newsApi = useNewsApi()
  120. const dictApi = useDictApi()
  121. const proApi = useProApi()
  122. const deptApi = useDeptApi()
  123. const executionApi = useExecutionApi()
  124. const trainingApi = useTrainingApi()
  125. const approvalList = ref<any[]>([])
  126. const noticeList = ref<any[]>([])
  127. const trainingList = ref<any[]>([])
  128. const userTypeList = ref(<RowDicDataType[]>[])
  129. const userSexList = ref(<RowDicDataType[]>[])
  130. const userCertList = ref(<RowDicDataType[]>[])
  131. const deptData = ref(<any[]>[])
  132. const pjtList = ref(<any[]>[])
  133. const pjtTypeList = ref(<any[]>[])
  134. const router = useRouter()
  135. const state = reactive({
  136. form: {
  137. keyWord: ''
  138. }
  139. })
  140. const getDicts = () => {
  141. Promise.all([
  142. dictApi.getDictDataByType('sys_user_type'),
  143. dictApi.getDictDataByType('sys_com_sex'),
  144. dictApi.getDictDataByType('sys_user_certificate'),
  145. deptApi.getDeptTree(),
  146. proApi.getProjectGroupList({ noPage: true }),
  147. dictApi.getDictDataByType('sci_pjt_level')
  148. ]).then(([type, sex, cert, dept, pjt, pjtType]) => {
  149. userTypeList.value = type.data.values || []
  150. userSexList.value = sex.data.values || []
  151. userCertList.value = cert.data.values || []
  152. deptData.value = dept.data || []
  153. pjtList.value = pjt.data.list || []
  154. pjtTypeList.value = pjtType.data.values || []
  155. })
  156. }
  157. const getApprovalList = async () => {
  158. const [err, res]: ToResponse = await to(executionApi.getOwApproveList({ platformId: 1000103, noPage: true }))
  159. if (err) return
  160. approvalList.value = res?.data?.list || []
  161. }
  162. const getNotice = async () => {
  163. const [err, res]: ToResponse = await to(newsApi.getNoticeList())
  164. if (err) return
  165. noticeList.value = res?.data?.list || []
  166. }
  167. const getTrainingList = async () => {
  168. const [err, res]: ToResponse = await to(trainingApi.getList({ noPage: true }))
  169. if (err) return
  170. trainingList.value = res?.data?.list || []
  171. }
  172. const onSearch = () => {}
  173. const onRouterPush = (val: string, params?: any) => {
  174. router.push({
  175. path: val,
  176. query: { ...params }
  177. })
  178. }
  179. onMounted(() => {
  180. getDicts()
  181. getApprovalList()
  182. getNotice()
  183. getTrainingList()
  184. })
  185. </script>
  186. <style lang="scss" scoped>
  187. .app-container {
  188. header {
  189. padding: 12px;
  190. border-radius: 8px;
  191. background-color: #1c9bfd;
  192. margin-top: 10px;
  193. .search {
  194. display: flex;
  195. border-radius: 4px;
  196. overflow: hidden;
  197. height: 28px;
  198. input {
  199. flex: 1;
  200. outline: none;
  201. border: none;
  202. padding: 0 10px;
  203. line-height: 28px;
  204. }
  205. button {
  206. border: none;
  207. border-left: 1px solid #d7d7d7;
  208. background-color: #fff;
  209. color: #3c78e5;
  210. padding: 0 20px;
  211. font-weight: bold;
  212. }
  213. }
  214. ul {
  215. display: flex;
  216. justify-content: space-between;
  217. margin-top: 10px;
  218. li {
  219. color: #fff;
  220. height: 14px;
  221. line-height: 14px;
  222. &::before {
  223. display: inline-block;
  224. content: '';
  225. height: 14px;
  226. width: 14px;
  227. border-radius: 9px;
  228. background-color: #ffff;
  229. vertical-align: top;
  230. margin-right: 2px;
  231. }
  232. }
  233. }
  234. }
  235. .card {
  236. margin-top: 10px;
  237. border-radius: 4px;
  238. background-color: #fff;
  239. padding: 10px;
  240. box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.12);
  241. h4 {
  242. height: 18px;
  243. line-height: 18px;
  244. display: flex;
  245. span {
  246. font-weight: normal;
  247. margin-left: auto;
  248. }
  249. &::before {
  250. display: inline-block;
  251. content: '';
  252. width: 3px;
  253. height: 18px;
  254. background-color: #1c9bfd;
  255. margin-right: 4px;
  256. vertical-align: middle;
  257. }
  258. }
  259. .time {
  260. color: #f69a4d;
  261. }
  262. .nav {
  263. display: flex;
  264. margin: 10px 0;
  265. flex-wrap: wrap;
  266. li {
  267. flex: 0 0 25%;
  268. display: flex;
  269. flex-direction: column;
  270. align-items: center;
  271. justify-content: center;
  272. &:nth-child(n + 5) {
  273. margin-top: 10px;
  274. }
  275. img {
  276. padding: 12px;
  277. height: 24px;
  278. width: 24px;
  279. background-color: #1c9bfd;
  280. border-radius: 50%;
  281. overflow: visible;
  282. margin-bottom: 4px;
  283. }
  284. &:nth-child(2) img {
  285. background-color: #ff751b;
  286. }
  287. &:nth-child(3) img {
  288. background-color: #0dda83;
  289. }
  290. &:nth-child(4) img {
  291. background-color: #595cac;
  292. }
  293. &:nth-child(5) img {
  294. background-color: #0dda83;
  295. }
  296. &:nth-child(6) img {
  297. background-color: #595cac;
  298. }
  299. &:nth-child(8) img {
  300. background-color: #ff751b;
  301. }
  302. }
  303. }
  304. .approval {
  305. li {
  306. padding: 10px;
  307. background-color: #f9ffff;
  308. margin-top: 8px;
  309. border-bottom: 1px solid #ecf5fa;
  310. a {
  311. color: #3c78e3;
  312. }
  313. }
  314. }
  315. }
  316. }
  317. </style>