srmDone.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <div class="todo-list">
  3. <Header />
  4. <div class="content-wrapper mt-15 max-w-[1200px] mx-auto">
  5. <div
  6. class="flex gap-5 items-center mb-4 bg-[#091126] py-2 pl-4 rounded-sm"
  7. >
  8. <p class="flex items-center text-white">
  9. <Icon
  10. icon="mynaui:arrow-up-down"
  11. class="icon pr-1 h-8 w-8"
  12. color="#014099"
  13. />SRM已办任务列表
  14. </p>
  15. <el-button
  16. type="primary"
  17. round
  18. size="small"
  19. color="#02409b"
  20. @click="router.back()"
  21. ><Icon
  22. icon="mynaui:corner-up-left"
  23. class="icon pr-1"
  24. width="20"
  25. height="20"
  26. />&#36820;&#22238;</el-button
  27. >
  28. </div>
  29. <div v-loading="loading" class="table-wrapper">
  30. <el-table
  31. v-loading="loading"
  32. :data="oaTasks"
  33. style="width: 100%"
  34. stripe
  35. height="70vh"
  36. element-loading-text="加载中..."
  37. :empty-text="loading ? '' : '暂无数据'"
  38. :header-cell-style="{
  39. backgroundColor: '#091126',
  40. color: '#b8bfd0',
  41. fontWeight: '400',
  42. }"
  43. :cell-style="{
  44. color: 'black',
  45. }"
  46. >
  47. <el-table-column
  48. type="index"
  49. label="&#24207;&#21495;"
  50. width="80"
  51. fixed="left"
  52. align="center"
  53. :index="getIndex"
  54. />
  55. <el-table-column
  56. prop="title"
  57. label="请求标题"
  58. min-width="250"
  59. fixed="left"
  60. align="center"
  61. />
  62. <el-table-column
  63. prop="creatorName"
  64. label="创建人"
  65. width="140"
  66. align="center"
  67. />
  68. <el-table-column label="创建日期" width="140" align="center">
  69. <template #default="scope">
  70. {{ scope.row.createdDate.substring(0, 10) }}
  71. </template>
  72. </el-table-column>
  73. <el-table-column
  74. label="操作"
  75. width="120"
  76. fixed="right"
  77. align="center"
  78. >
  79. <template #default="scope">
  80. <span
  81. class="text-[#1e90ff] cursor-pointer text-[13px]"
  82. @click="goBackPage(scope.row)"
  83. >&#22788;&#29702;</span
  84. >
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. </div>
  89. <div class="pagination-container">
  90. <el-pagination
  91. v-model:current-page="pagination.pageNum"
  92. v-model:page-size="pagination.pageSize"
  93. :total="pagination.total"
  94. :page-sizes="[10, 20, 50, 100]"
  95. layout="total, sizes, prev, pager, next"
  96. background
  97. @current-change="handleCurrentChange"
  98. @size-change="handleSizeChange"
  99. />
  100. </div>
  101. </div>
  102. <Footer />
  103. </div>
  104. </template>
  105. <script setup>
  106. import Header from "@components/home/header.vue";
  107. import * as dd from "dingtalk-jsapi";
  108. import { ref, onMounted } from "vue";
  109. import { getSRMTasks, srmLogin } from "@/api/user";
  110. import { useUserStore } from "@/stores/useUserStore";
  111. import { Icon } from "@iconify/vue";
  112. import router from "@/router";
  113. const userStore = useUserStore();
  114. import { ElLoading, ElMessage } from "element-plus";
  115. const oaTasks = ref([]);
  116. const loading = ref(false);
  117. const pagination = ref({
  118. pageNum: 1,
  119. pageSize: 10,
  120. total: 0,
  121. });
  122. const goBackPage = async (row) => {
  123. const res = await srmLogin({
  124. username: userStore.getUser.username,
  125. });
  126. if (JSON.parse(res).msg === "账号未授权") {
  127. dialogVisible.value = true;
  128. return;
  129. }
  130. if (res) {
  131. const ua = window.navigator.userAgent.toLowerCase();
  132. if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
  133. dd.biz.util.openLink({
  134. url: `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
  135. onSuccess: () => {
  136. setTimeout(() => {
  137. dd.biz.util.openLink({
  138. url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
  139. });
  140. }, 100);
  141. },
  142. });
  143. } else {
  144. const loading = ElLoading.service({
  145. lock: true,
  146. text: "正在跳转,请稍候...",
  147. background: "rgba(0, 0, 0, 0.7)",
  148. });
  149. const newTab = window.open("", "_blank");
  150. newTab.location.href = `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`;
  151. setTimeout(function () {
  152. newTab.location.href = `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`;
  153. setTimeout(() => {
  154. loading.close();
  155. }, 500);
  156. }, 500);
  157. }
  158. }
  159. };
  160. const handleCurrentChange = async (page) => {
  161. pagination.value.pageNum = page;
  162. try {
  163. const res = await getSRMTasks({
  164. id: userStore.getUser.username,
  165. pageNum: pagination.value.pageNum,
  166. pageSize: pagination.value.pageSize,
  167. });
  168. oaTasks.value = res.doneList;
  169. pagination.value.total = Number(res.doneCount);
  170. } finally {
  171. loading.value = false;
  172. }
  173. };
  174. const handleSizeChange = async (size) => {
  175. pagination.value.pageSize = size;
  176. pagination.value.pageNum = 1;
  177. try {
  178. const res = await getSRMTasks({
  179. id: userStore.getUser.username,
  180. pageNum: pagination.value.pageNum,
  181. pageSize: pagination.value.pageSize,
  182. });
  183. oaTasks.value = res.doneList;
  184. pagination.value.total = Number(res.doneCount);
  185. } finally {
  186. loading.value = false;
  187. }
  188. };
  189. onMounted(async () => {
  190. if (userStore.getUser.username) {
  191. loading.value = true;
  192. try {
  193. const res = await getSRMTasks({
  194. id: userStore.getUser.username,
  195. pageNum: pagination.value.pageNum,
  196. pageSize: pagination.value.pageSize,
  197. });
  198. oaTasks.value = res.doneList;
  199. pagination.value.total = Number(res.doneCount);
  200. } finally {
  201. loading.value = false;
  202. }
  203. }
  204. });
  205. </script>
  206. <style scoped>
  207. .todo-list {
  208. min-height: 100vh;
  209. display: flex;
  210. flex-direction: column;
  211. /* background-color: #f5f7fa; */
  212. }
  213. .content {
  214. padding: 16px 20px;
  215. margin-top: 100px;
  216. }
  217. .pagination-wrap {
  218. display: flex;
  219. justify-content: flex-end;
  220. margin-top: 16px;
  221. }
  222. .news-container {
  223. min-height: 100vh;
  224. display: flex;
  225. flex-direction: column;
  226. background-color: #f5f7fa;
  227. }
  228. .content-wrapper {
  229. flex: 1;
  230. max-width: 1200px;
  231. /* margin: 0 auto; */
  232. padding: 20px;
  233. width: 100%;
  234. box-sizing: border-box;
  235. }
  236. .page-title {
  237. margin-bottom: 20px;
  238. color: #303133;
  239. border-left: 5px solid #409eff;
  240. padding-left: 10px;
  241. }
  242. .table-wrapper {
  243. min-height: 400px;
  244. background: #fff;
  245. padding: 20px;
  246. border-radius: 4px;
  247. }
  248. .table-title {
  249. font-weight: 500;
  250. color: #303133;
  251. }
  252. .table-summary {
  253. color: #606266;
  254. font-size: 13px;
  255. }
  256. .pagination-container {
  257. display: flex;
  258. justify-content: center;
  259. margin-top: 0px;
  260. padding: 20px 0;
  261. }
  262. :deep(.el-table) {
  263. background-color: #091126 !important;
  264. color: white !important;
  265. }
  266. :deep(.table-wrapper) {
  267. background: #091126 !important;
  268. }
  269. :deep(.el-table__header-wrapper thead) {
  270. background: #091126 !important;
  271. color: white !important;
  272. }
  273. :deep(.el-table__header-wrapper .el-table__header) {
  274. border-bottom: none;
  275. }
  276. :deep(.el-table__inner-wrapper) {
  277. background: #091126 !important;
  278. color: white !important;
  279. }
  280. :deep(.el-table__body-wrapper .el-table__row) {
  281. background: #091126;
  282. color: white !important;
  283. }
  284. :deep(.el-table__body-wrapper .el-table__row .hover-row) {
  285. background: #091126 !important;
  286. color: white !important;
  287. }
  288. :deep(.el-table__body-wrapper .el-table__row .el-table__cell) {
  289. background: #091126 !important;
  290. color: white !important;
  291. border-bottom: 1px solid #313849;
  292. }
  293. :deep(.el-loading-mask) {
  294. background-color: rgba(9, 17, 38, 0.8) !important; /* 半透明深色遮罩 */
  295. }
  296. :deep(.el-table__body-wrapper .el-table__row .el-table__cell) {
  297. border-bottom: 1px solid #313849;
  298. }
  299. :deep(.el-pagination is-background) {
  300. background: #091126 !important;
  301. }
  302. :deep(.el-pagination .el-pager li) {
  303. background: #091126 !important;
  304. color: white !important;
  305. }
  306. :deep(.el-pagination .el-pager li.active) {
  307. background: #2d8cf0 !important;
  308. }
  309. :deep(.el-select .el-select__wrapper) {
  310. background: #091126 !important;
  311. border: 1px solid #313849 !important;
  312. outline: none !important;
  313. }
  314. :deep(.el-input) {
  315. border: 1px solid #313849 !important;
  316. outline: none !important;
  317. }
  318. :deep(.btn-next) {
  319. background: #091126 !important;
  320. color: white !important;
  321. }
  322. :deep(.btn-prev) {
  323. background: #091126 !important;
  324. color: white !important;
  325. }
  326. /* 下拉菜单弹出层的背景 */
  327. :deep(.el-select-dropdown) {
  328. background-color: #091126 !important;
  329. border: 1px solid #313849 !important;
  330. }
  331. /* 下拉菜单项 */
  332. :deep(.el-select-dropdown__item) {
  333. color: #fff !important;
  334. }
  335. :deep(.el-select-dropdown__item.hover),
  336. :deep(.el-select-dropdown__item:hover) {
  337. background-color: #111a35 !important; /* 悬停深色背景 */
  338. }
  339. /* 关键:修复下拉选择框 (PageSize) 的白色边框/背景 */
  340. :deep(.el-pagination .el-select .el-select__wrapper) {
  341. background-color: #091126 !important;
  342. box-shadow: none !important; /* 去掉可能的阴影 */
  343. border: 1px solid #313849 !important; /* 统一边框颜色 */
  344. }
  345. /* 去掉聚焦时的白色/蓝色轮廓 */
  346. :deep(.el-pagination .el-select .el-select__wrapper.is-focused),
  347. :deep(.el-pagination .el-select .el-select__wrapper:hover) {
  348. box-shadow: none !important;
  349. border-color: #409eff !important; /* 聚焦时变为主题蓝,或者保持 #313849 */
  350. }
  351. /* 通用输入框边框修复 (如果其他地方也有) */
  352. :deep(.el-input__wrapper) {
  353. background-color: #091126 !important;
  354. box-shadow: none !important; /* 去掉默认的白色/灰色阴影边框 */
  355. border: 1px solid #313849 !important;
  356. }
  357. :deep(.el-input__inner) {
  358. color: #fff !important;
  359. }
  360. </style>