(0)
+
console.log(refreshing)
// 获取状态显示
const getStatusDisplay = (status?: number) => {
@@ -37,19 +42,22 @@ const List: React.FC = () => {
}
const reload = async (showLoading = true) => {
+ setLimit(10)
try {
if (showLoading) setLoading(true)
setRefreshing(true)
- const where = {
+ const where: any = {
keywords: keywords.trim(),
+ page,
+ limit,
}
const roleCode = Taro.getStorageSync('RoleCode');
if(roleCode == 'kuaidi'){
- if(Taro.getStorageSync('OrganizationId') == Taro.getStorageSync('OrganizationParentId')){
+ if(Taro.getStorageSync('OrganizationParentId') == 0){
// @ts-ignore
- where.organizationParentId = Taro.getStorageSync('OrganizationParentId');
+ where.organizationParentId = Taro.getStorageSync('OrganizationId');
}else {
// @ts-ignore
where.organizationId = Taro.getStorageSync('OrganizationId');
@@ -58,6 +66,7 @@ const List: React.FC = () => {
const res = await pageHjmViolation(where)
setList(res?.list || [])
+ setTotal(res?.count || 0)
} catch (error) {
console.error('获取报险记录失败:', error)
Taro.showToast({
@@ -86,7 +95,11 @@ const List: React.FC = () => {
useEffect(() => {
reload().then()
- }, [])
+ }, [page, limit])
+
+ const onPageChange = (current: number) => {
+ setPage(current)
+ }
return (
<>
@@ -149,9 +162,6 @@ const List: React.FC = () => {
) : list.length === 0 ? (
-
) : (
@@ -275,6 +285,23 @@ const List: React.FC = () => {
)
}
+
+ {/* 分页 */}
+ {list.length > 0 && (
+
+ )}
>
)
}
diff --git a/src/pages/index/Header.tsx b/src/pages/index/Header.tsx
index 5d59507..a0e20c0 100644
--- a/src/pages/index/Header.tsx
+++ b/src/pages/index/Header.tsx
@@ -29,7 +29,7 @@ const Header = (props: any) => {
setStatusBarHeight(res.statusBarHeight)
},
})
- getUserInfo().then((data) => {
+ getUserInfo().then( async (data) => {
if (data) {
console.log(data.organizationName,'0000')
setIsLogin(true);
@@ -38,7 +38,7 @@ const Header = (props: any) => {
// 机构ID
Taro.setStorageSync('OrganizationId',data.organizationId)
// 父级机构ID
- getOrganization(Number(data.organizationId)).then(res => {
+ await getOrganization(Number(data.organizationId)).then(res => {
Taro.setStorageSync('OrganizationParentId',res.parentId)
})
// 所属站点名称
diff --git a/src/pages/user/components/UserCell.tsx b/src/pages/user/components/UserCell.tsx
index 270d580..ab3bfdd 100644
--- a/src/pages/user/components/UserCell.tsx
+++ b/src/pages/user/components/UserCell.tsx
@@ -75,6 +75,22 @@ const UserCell = () => {
}}
/>
+
+
+
+ 违章记录
+
+ }
+ align="center"
+ extra={}
+ onClick={() => {
+ navTo('/hjm/violation/list', true)
+ }}
+ />
+ |
>
)
}
@@ -137,48 +153,6 @@ const UserCell = () => {
)
}
- {
- roleName === 'youzheng' && (
-
-
-
- 违章记录
-
- }
- align="center"
- extra={}
- onClick={() => {
- navTo('/hjm/violation/list', true)
- }}
- />
- |
- )
- }
-
- {
- roleName === 'kuaidi' && (
-
-
-
- 违章记录
-
- }
- align="center"
- extra={}
- onClick={() => {
- navTo('/hjm/violation/list', true)
- }}
- />
- |
- )
- }
-
{/**/}
{/* 管理*/}
diff --git a/src/user/userVerify/admin.tsx b/src/user/userVerify/admin.tsx
index ebfed90..a99dc87 100644
--- a/src/user/userVerify/admin.tsx
+++ b/src/user/userVerify/admin.tsx
@@ -11,7 +11,7 @@ import {Search, Calendar, Truck, File} from '@nutui/icons-react-taro'
import Taro from '@tarojs/taro'
import {UserVerify} from "@/api/system/userVerify/model";
import {pageUserVerify, updateUserVerify} from "@/api/system/userVerify";
-import {listUserRole, updateUserRole} from "@/api/system/userRole";
+import {addUserRole, listUserRole, updateUserRole} from "@/api/system/userRole";
/**
@@ -82,19 +82,23 @@ const List: React.FC = () => {
const onPass = async (item: UserVerify) => {
const role = await listUserRole({roleId: 1701,userId: item.userId})
const userRole = role[0];
- userRole.roleId = 1738;
- updateUserRole(userRole).then(() => {
- updateUserVerify({
- ...item,
- status: 1
- }).then(() => {
- Taro.showToast({
- title: '操作成功',
- icon: 'success'
+ // 审核通过
+ updateUserVerify({
+ ...item,
+ status: 1
+ }).then(() => {
+ if(userRole){
+ updateUserRole({
+ ...userRole,
+ roleId: 1738
+ })
+ }
+ Taro.showToast({
+ title: '操作成功',
+ icon: 'success'
+ })
+ reload().then()
})
- reload().then()
- })
- })
}
const onReject = async (item: UserVerify) => {
diff --git a/src/utils/request.ts b/src/utils/request.ts
index 78d155c..7bbba37 100644
--- a/src/utils/request.ts
+++ b/src/utils/request.ts
@@ -4,7 +4,7 @@ import {BaseUrl, TenantId} from "@/utils/config";
let baseUrl = BaseUrl
if(process.env.NODE_ENV === 'development'){
- baseUrl = 'http://localhost:9000/api'
+ // baseUrl = 'http://localhost:9000/api'
}
export function request(options:any) {
const token = Taro.getStorageSync('access_token');
diff --git a/src/utils/time.ts b/src/utils/time.ts
index 50687a8..e255130 100644
--- a/src/utils/time.ts
+++ b/src/utils/time.ts
@@ -16,7 +16,7 @@ export function formatCurrentDate() {
/**
* 获取当前时分秒
*/
-export function formatHhmmss(){
+export function formatHhmmss() {
// 创建一个Date对象,表示当前日期和时间
const now = new Date();
// 获取当前的小时
@@ -37,3 +37,41 @@ export function getCurrentHour() {
const hour = String(now.getHours()).padStart(2, '0');
return `${String(Number(hour) - 8).padStart(2, '0')}`;
}
+
+/**
+ * 获取当前日期 格式为 yyyy-mm-dd HH:mm:ss
+ */
+export function getCurrentDate() {
+// 创建一个Date对象,自动设置为当前日期和时间
+ const currentDate = new Date();
+
+// 获取年份
+ const year = currentDate.getFullYear();
+
+// 获取月份(注意月份是从0开始计数的)
+ let month = currentDate.getMonth() + 1;
+
+// 获取日期
+ let day = currentDate.getDate();
+
+// 添加前导零(如果月份或日期是一位数,则添加前导零)
+ // @ts-ignore
+ month = (month < 10 ? '0' : '') + month;
+ // @ts-ignore
+ day = (day < 10 ? '0' : '') + day;
+
+ // 获取当前小时
+ const hour = currentDate.getHours();
+ // 获取当前分钟
+ const minute = currentDate.getMinutes();
+ // 获取当前秒数
+ const second = currentDate.getSeconds();
+
+// 构建日期字符串
+ var formattedDate = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
+
+// 输出格式化的日期
+ console.log(formattedDate);
+ return formattedDate;
+}
+