|
@@ -9,7 +9,8 @@
|
|
|
icon="mynaui:arrow-up-down"
|
|
icon="mynaui:arrow-up-down"
|
|
|
class="icon pr-1 h-8 w-8"
|
|
class="icon pr-1 h-8 w-8"
|
|
|
color="#014099"
|
|
color="#014099"
|
|
|
- />SRM待办任务列表
|
|
|
|
|
|
|
+ />
|
|
|
|
|
+ SRM待办任务列表
|
|
|
</p>
|
|
</p>
|
|
|
|
|
|
|
|
<el-button
|
|
<el-button
|
|
@@ -18,13 +19,15 @@
|
|
|
size="small"
|
|
size="small"
|
|
|
color="#02409b"
|
|
color="#02409b"
|
|
|
@click="router.back()"
|
|
@click="router.back()"
|
|
|
- ><Icon
|
|
|
|
|
|
|
+ >
|
|
|
|
|
+ <Icon
|
|
|
icon="mynaui:corner-up-left"
|
|
icon="mynaui:corner-up-left"
|
|
|
class="icon pr-1"
|
|
class="icon pr-1"
|
|
|
width="20"
|
|
width="20"
|
|
|
height="20"
|
|
height="20"
|
|
|
- />返回</el-button
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ />
|
|
|
|
|
+ 返回
|
|
|
|
|
+ </el-button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div v-loading="loading && oaTasks.length === 0" class="table-wrapper">
|
|
<div v-loading="loading && oaTasks.length === 0" class="table-wrapper">
|
|
@@ -40,9 +43,7 @@
|
|
|
>
|
|
>
|
|
|
<div class="task-card__header">
|
|
<div class="task-card__header">
|
|
|
<span class="task-card__index">{{ index + 1 }}</span>
|
|
<span class="task-card__index">{{ index + 1 }}</span>
|
|
|
- <span class="task-card__status">{{
|
|
|
|
|
- item.status || "待处理"
|
|
|
|
|
- }}</span>
|
|
|
|
|
|
|
+ <span class="task-card__status">{{ item.status || "待处理" }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="task-card__title">
|
|
<div class="task-card__title">
|
|
@@ -53,42 +54,30 @@
|
|
|
<div class="task-card__row task-card__row--two">
|
|
<div class="task-card__row task-card__row--two">
|
|
|
<div class="task-card__field">
|
|
<div class="task-card__field">
|
|
|
<span class="task-card__label">创建人</span>
|
|
<span class="task-card__label">创建人</span>
|
|
|
- <span class="task-card__value">{{
|
|
|
|
|
- item.creatorName || "--"
|
|
|
|
|
- }}</span>
|
|
|
|
|
|
|
+ <span class="task-card__value">{{ item.creatorName || "--" }}</span>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="task-card__field">
|
|
<div class="task-card__field">
|
|
|
<span class="task-card__label">创建日期</span>
|
|
<span class="task-card__label">创建日期</span>
|
|
|
<span class="task-card__value">{{
|
|
<span class="task-card__value">{{
|
|
|
- item.createdDate.substring(0, 10)
|
|
|
|
|
|
|
+ item.createdDate ? item.createdDate.substring(0, 10) : "--"
|
|
|
}}</span>
|
|
}}</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="task-card__footer">
|
|
<div class="task-card__footer">
|
|
|
- <span class="task-card__action" @click="goBackPage(item)"
|
|
|
|
|
- >处理</span
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <span class="task-card__action" @click="goBackPage(item)">处理</span>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <InfiniteLoading
|
|
|
|
|
- :identifier="infiniteId"
|
|
|
|
|
- spinner="spiral"
|
|
|
|
|
- @infinite="loadMore"
|
|
|
|
|
- >
|
|
|
|
|
- <template #no-more>
|
|
|
|
|
- <div class="infinite-status">没有更多数据了</div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #no-results>
|
|
|
|
|
- <div class="infinite-status">没有更多数据了</div>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #error>
|
|
|
|
|
- <div class="infinite-status">加载失败,请稍后重试</div>
|
|
|
|
|
- </template>
|
|
|
|
|
- </InfiniteLoading>
|
|
|
|
|
|
|
+ <div v-if="isFetchingMore" class="infinite-status">加载中...</div>
|
|
|
|
|
+ <div v-else-if="!hasMore && oaTasks.length > 0" class="infinite-status">
|
|
|
|
|
+ 没有更多数据了
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else-if="!loading && oaTasks.length === 0" class="infinite-status">
|
|
|
|
|
+ 暂无数据
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -100,20 +89,18 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import Header from "@components/home/header.vue";
|
|
import Header from "@components/home/header.vue";
|
|
|
import * as dd from "dingtalk-jsapi";
|
|
import * as dd from "dingtalk-jsapi";
|
|
|
-import { onMounted, ref } from "vue";
|
|
|
|
|
-// import { getOATasks, ssoLogin } from "@/api/user";
|
|
|
|
|
|
|
+import { onMounted, onUnmounted, ref } from "vue";
|
|
|
import { getSRMTasks, srmLogin } from "@/api/user";
|
|
import { getSRMTasks, srmLogin } from "@/api/user";
|
|
|
import { useUserStore } from "@/stores/useUserStore";
|
|
import { useUserStore } from "@/stores/useUserStore";
|
|
|
import { Icon } from "@iconify/vue";
|
|
import { Icon } from "@iconify/vue";
|
|
|
import router from "@/router";
|
|
import router from "@/router";
|
|
|
-import { ElLoading } from "element-plus";
|
|
|
|
|
-import InfiniteLoading from "vue-infinite-loading";
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
|
|
|
|
|
|
const oaTasks = ref([]);
|
|
const oaTasks = ref([]);
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
-const infiniteId = ref(Date.now());
|
|
|
|
|
|
|
+const isFetchingMore = ref(false);
|
|
|
|
|
+const hasMore = ref(true);
|
|
|
|
|
|
|
|
const pagination = ref({
|
|
const pagination = ref({
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
@@ -125,32 +112,28 @@ const goBackPage = async (row) => {
|
|
|
const res = await srmLogin({
|
|
const res = await srmLogin({
|
|
|
username: userStore.getUser.username,
|
|
username: userStore.getUser.username,
|
|
|
});
|
|
});
|
|
|
- if (JSON.parse(res).msg === "账号未授权") {
|
|
|
|
|
- dialogVisible.value = true;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
if (res) {
|
|
if (res) {
|
|
|
|
|
+ const token = JSON.parse(res).msg;
|
|
|
const ua = window.navigator.userAgent.toLowerCase();
|
|
const ua = window.navigator.userAgent.toLowerCase();
|
|
|
|
|
+
|
|
|
if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
|
|
if (ua.includes("dingtalk") || ua.includes("dingtalkwork")) {
|
|
|
dd.biz.util.openLink({
|
|
dd.biz.util.openLink({
|
|
|
- url: `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`,
|
|
|
|
|
|
|
+ url: `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${token}`,
|
|
|
onSuccess: () => {
|
|
onSuccess: () => {
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
dd.biz.util.openLink({
|
|
dd.biz.util.openLink({
|
|
|
url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
|
|
url: `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`,
|
|
|
});
|
|
});
|
|
|
- }, SRM_LOGIN_DELAY);
|
|
|
|
|
|
|
+ }, 300);
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
const newTab = window.open("", "_blank");
|
|
const newTab = window.open("", "_blank");
|
|
|
- newTab.location.href = `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${JSON.parse(res).msg}`;
|
|
|
|
|
- setTimeout(function () {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- // loading.close();
|
|
|
|
|
- }, 500);
|
|
|
|
|
|
|
+ newTab.location.href = `https://srm.deepoil.cc/#/mixed-page/view/MXP00048?Authorization=${token}`;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
newTab.location.href = `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`;
|
|
newTab.location.href = `https://srm.deepoil.cc/#/workflow-process/request-${row.requestId}`;
|
|
|
- }, SRM_LOGIN_DELAY);
|
|
|
|
|
|
|
+ }, 300);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -170,48 +153,79 @@ const resetList = () => {
|
|
|
oaTasks.value = [];
|
|
oaTasks.value = [];
|
|
|
pagination.value.pageNum = 1;
|
|
pagination.value.pageNum = 1;
|
|
|
pagination.value.total = 0;
|
|
pagination.value.total = 0;
|
|
|
- infiniteId.value = Date.now();
|
|
|
|
|
|
|
+ hasMore.value = true;
|
|
|
|
|
+ isFetchingMore.value = false;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const loadMore = async ($state) => {
|
|
|
|
|
- if (!userStore.getUser.username) {
|
|
|
|
|
- $state.complete();
|
|
|
|
|
|
|
+const loadMore = async () => {
|
|
|
|
|
+ if (
|
|
|
|
|
+ !userStore.getUser.username ||
|
|
|
|
|
+ loading.value ||
|
|
|
|
|
+ isFetchingMore.value ||
|
|
|
|
|
+ !hasMore.value
|
|
|
|
|
+ ) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- loading.value = pagination.value.pageNum === 1;
|
|
|
|
|
|
|
+ const isFirstPage = pagination.value.pageNum === 1;
|
|
|
|
|
+ loading.value = isFirstPage;
|
|
|
|
|
+ isFetchingMore.value = !isFirstPage;
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
const list = await loadTaskPage();
|
|
const list = await loadTaskPage();
|
|
|
|
|
|
|
|
- if (pagination.value.pageNum === 1) {
|
|
|
|
|
|
|
+ if (isFirstPage) {
|
|
|
oaTasks.value = list;
|
|
oaTasks.value = list;
|
|
|
} else {
|
|
} else {
|
|
|
oaTasks.value = [...oaTasks.value, ...list];
|
|
oaTasks.value = [...oaTasks.value, ...list];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const loadedCount = oaTasks.value.length;
|
|
const loadedCount = oaTasks.value.length;
|
|
|
- const hasMore =
|
|
|
|
|
|
|
+ const moreAvailable =
|
|
|
list.length === pagination.value.pageSize &&
|
|
list.length === pagination.value.pageSize &&
|
|
|
loadedCount < pagination.value.total;
|
|
loadedCount < pagination.value.total;
|
|
|
|
|
|
|
|
- if (hasMore) {
|
|
|
|
|
|
|
+ if (moreAvailable) {
|
|
|
pagination.value.pageNum += 1;
|
|
pagination.value.pageNum += 1;
|
|
|
- $state.loaded();
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- $state.complete();
|
|
|
|
|
|
|
+ hasMore.value = false;
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- $state.error();
|
|
|
|
|
|
|
+ hasMore.value = false;
|
|
|
} finally {
|
|
} finally {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
|
|
+ isFetchingMore.value = false;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const handleWindowScroll = () => {
|
|
|
|
|
+ if (loading.value || isFetchingMore.value || !hasMore.value) return;
|
|
|
|
|
+
|
|
|
|
|
+ const scrollTop =
|
|
|
|
|
+ window.pageYOffset ||
|
|
|
|
|
+ document.documentElement.scrollTop ||
|
|
|
|
|
+ document.body.scrollTop ||
|
|
|
|
|
+ 0;
|
|
|
|
|
+ const viewportHeight =
|
|
|
|
|
+ window.innerHeight || document.documentElement.clientHeight || 0;
|
|
|
|
|
+ const fullHeight =
|
|
|
|
|
+ document.documentElement.scrollHeight || document.body.scrollHeight || 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (scrollTop + viewportHeight >= fullHeight - 80) {
|
|
|
|
|
+ loadMore();
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
if (userStore.getUser.username) {
|
|
if (userStore.getUser.username) {
|
|
|
resetList();
|
|
resetList();
|
|
|
|
|
+ loadMore();
|
|
|
}
|
|
}
|
|
|
|
|
+ window.addEventListener("scroll", handleWindowScroll, { passive: true });
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+onUnmounted(() => {
|
|
|
|
|
+ window.removeEventListener("scroll", handleWindowScroll);
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|