diff --git a/index.html b/index.html
index f8a54cb..0fd9429 100644
--- a/index.html
+++ b/index.html
@@ -13,6 +13,15 @@
+
diff --git a/src/pages.json b/src/pages.json
index bcbd209..74db6c5 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -137,6 +137,12 @@
"navigationBarTitleText": "申请详情"
}
},
+ {
+ "path": "pages/consumables/temp-request-edit",
+ "style": {
+ "navigationBarTitleText": "编辑申请"
+ }
+ },
{
"path": "pages/consumables/temp-approve",
"style": {
@@ -160,6 +166,13 @@
"style": {
"navigationBarTitleText": "扫码查看信息"
}
+ },
+ {
+ "path": "pages/fixed-assets/lent-management",
+ "style": {
+ "navigationBarTitleText": "出借资产管理",
+ "enablePullDownRefresh": false
+ }
}
],
"globalStyle": {
diff --git a/src/pages/api/consumable-temp.ts b/src/pages/api/consumable-temp.ts
index e196184..2434f74 100644
--- a/src/pages/api/consumable-temp.ts
+++ b/src/pages/api/consumable-temp.ts
@@ -1,6 +1,6 @@
import { formatTime, formatDate, formatDateTime, getHeaders } from './index';
-const BASE_URL = 'http://localhost:3000' // 替换为你的实际后端地址
+const BASE_URL = 'http://localhost:8090' // 替换为你的实际后端地址
// 请求封装
const request = (url: string, options: any = {}) => {
const token = uni.getStorageSync('token')
diff --git a/src/pages/api/fixedAssets.js b/src/pages/api/fixedAssets.js
index 7a607dc..1f58ad2 100644
--- a/src/pages/api/fixedAssets.js
+++ b/src/pages/api/fixedAssets.js
@@ -178,6 +178,8 @@ export function borrowAssetById(addDTO) {
//作用:前端 “个人借用记录页” 加载数据时调用(如显示当前用户借了哪些资产)。
export function borrowInfo(borrowerId) {
return new Promise((resolve, reject) => {
+ console.log(1);
+
uni.request({
url: `${BASE_URL}/api/asset/borrow/list`,// 接口路径:个人借用记录列表
method: 'POST',
@@ -222,6 +224,30 @@ export function returnAsset(id) {
});
}
+
+//查询所有借出资产列表
+//作用:前端"出借资产管理"页面加载数据时调用(管理员查看所有借出的资产,包括已归还和未归还)。
+export function fetchBorrowList() {
+ return new Promise((resolve, reject) => {
+ uni.request({
+ url: `${BASE_URL}/api/asset/borrow/list`, // 接口路径:借出资产列表接口
+ method: 'POST', // 请求方法:POST
+ header: getHeaders(),
+ data: {}, // 请求体:空(获取所有借出记录,不过滤条件)
+ success: (res) => {
+ if (res.statusCode === 200) {
+ resolve(res.data); // 返回借出资产列表数据
+ } else {
+ reject(res);
+ }
+ },
+ fail: (err) => {
+ reject(err);
+ }
+ });
+ });
+}
+
//————————————————————————————————————————————————业务接口函数(易耗品相关)——————————————————————————————————————————
//易耗品领用
diff --git a/src/pages/consumables/temp-approve-detail.vue b/src/pages/consumables/temp-approve-detail.vue
index 726aa2a..a3cd0b3 100644
--- a/src/pages/consumables/temp-approve-detail.vue
+++ b/src/pages/consumables/temp-approve-detail.vue
@@ -60,7 +60,7 @@
需要时间:
- {{ detail.neededAt || '-' }}
+ {{ detail.neededAt ? new Date(detail.neededAt).toLocaleDateString() : '-' }}
审批人ID:
@@ -459,47 +459,51 @@ onMounted(() => {
}
.status-card {
- background: #3a5ddd;
+ background: #fff;
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 24rpx;
display: flex;
- flex-direction: column;
+ justify-content: space-between;
align-items: center;
- gap: 16rpx;
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
}
.status-badge {
- padding: 12rpx 32rpx;
- border-radius: 24rpx;
- font-size: 32rpx;
- font-weight: 600;
- background: rgba(255, 255, 255, 0.9);
+ padding: 8rpx 24rpx;
+ border-radius: 8rpx;
+ font-size: 28rpx;
+ font-weight: 500;
}
.status-pending {
+ background: #fff3e0;
color: #f57c00;
}
.status-approved {
+ background: #e8f5e9;
color: #2e7d32;
}
.status-rejected {
+ background: #ffebee;
color: #c62828;
}
.status-cancelled {
+ background: #f5f5f5;
color: #757575;
}
.status-completed {
+ background: #e3f2fd;
color: #1976d2;
}
.status-time {
font-size: 26rpx;
- color: rgba(255, 255, 255, 0.9);
+ color: #999;
}
.section {
@@ -527,16 +531,17 @@ onMounted(() => {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
- background: #3a5ddd;
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
+ border: 4rpx solid #f0f0f0;
}
.avatar-text {
- font-size: 40rpx;
- font-weight: 600;
+ font-size: 36rpx;
+ font-weight: 500;
color: #fff;
}
@@ -680,25 +685,26 @@ onMounted(() => {
}
.total-card {
- background: #f9a825;
+ background: #fff;
border-radius: 20rpx;
padding: 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
- box-shadow: 0 8rpx 24rpx rgba(249, 168, 37, 0.2);
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
+ border-left: 6rpx solid #ff9800;
}
.total-label {
font-size: 32rpx;
- font-weight: 600;
- color: #fff;
+ font-weight: 500;
+ color: #666;
}
.total-value {
font-size: 40rpx;
font-weight: 700;
- color: #fff;
+ color: #ff6b00;
}
.footer-actions {
@@ -726,12 +732,13 @@ onMounted(() => {
}
.btn-reject {
- background: #ef5350;
- color: #fff;
+ background: #fff;
+ color: #f44336;
+ border: 2rpx solid #f44336;
}
.btn-approve {
- background: #3a5ddd;
+ background: #007aff;
color: #fff;
}
@@ -837,12 +844,12 @@ onMounted(() => {
}
.btn-confirm {
- background: #3a5ddd;
+ background: #007aff;
color: #fff;
}
.btn-confirm.btn-danger {
- background: #ef5350;
+ background: #f44336;
}
.btn-confirm[disabled] {
diff --git a/src/pages/consumables/temp-approve.vue b/src/pages/consumables/temp-approve.vue
index d6525bd..1f73e30 100644
--- a/src/pages/consumables/temp-approve.vue
+++ b/src/pages/consumables/temp-approve.vue
@@ -177,7 +177,7 @@ async function loadList(reset = false) {
// 根据开关过滤数据:默认不显示 COMPLETED
if (!showCompleted.value) {
- newData = newData.filter((item: ConsumableRequest) => item.status !== 'COMPLETED')
+ newData = newData.filter((item: ConsumableRequest) => item.status !== 'COMPLETED' && item.status !== 'REJECTED')
}
list.value = reset ? newData : [...list.value, ...newData]
diff --git a/src/pages/consumables/temp-request-detail.vue b/src/pages/consumables/temp-request-detail.vue
index 8137689..d352327 100644
--- a/src/pages/consumables/temp-request-detail.vue
+++ b/src/pages/consumables/temp-request-detail.vue
@@ -247,47 +247,51 @@ onMounted(() => {
}
.status-card {
- background: #3a5ddd;
+ background: #fff;
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 24rpx;
display: flex;
- flex-direction: column;
+ justify-content: space-between;
align-items: center;
- gap: 16rpx;
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
}
.status-badge {
- padding: 12rpx 32rpx;
- border-radius: 24rpx;
- font-size: 32rpx;
- font-weight: 600;
- background: rgba(255, 255, 255, 0.9);
+ padding: 8rpx 24rpx;
+ border-radius: 8rpx;
+ font-size: 28rpx;
+ font-weight: 500;
}
.status-pending {
+ background: #fff3e0;
color: #f57c00;
}
.status-approved {
+ background: #e8f5e9;
color: #2e7d32;
}
.status-rejected {
+ background: #ffebee;
color: #c62828;
}
.status-cancelled {
+ background: #f5f5f5;
color: #757575;
}
.status-completed {
+ background: #e3f2fd;
color: #1976d2;
}
.status-time {
font-size: 26rpx;
- color: rgba(255, 255, 255, 0.9);
+ color: #999;
}
.section {
@@ -400,25 +404,26 @@ onMounted(() => {
}
.total-card {
- background: #f9a825;
+ background: #fff;
border-radius: 20rpx;
padding: 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
- box-shadow: 0 8rpx 24rpx rgba(249, 168, 37, 0.2);
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
+ border-left: 6rpx solid #ff9800;
}
.total-label {
font-size: 32rpx;
- font-weight: 600;
- color: #fff;
+ font-weight: 500;
+ color: #666;
}
.total-value {
font-size: 40rpx;
font-weight: 700;
- color: #fff;
+ color: #ff6b00;
}
.footer-actions {
@@ -445,12 +450,13 @@ onMounted(() => {
}
.btn-danger {
- background: #ef5350;
- color: #fff;
+ background: #fff;
+ color: #f44336;
+ border: 2rpx solid #f44336;
}
.btn-primary {
- background: #3a5ddd;
+ background: #007aff;
color: #fff;
}
diff --git a/src/pages/consumables/temp-request-edit.vue b/src/pages/consumables/temp-request-edit.vue
new file mode 100644
index 0000000..403b6cc
--- /dev/null
+++ b/src/pages/consumables/temp-request-edit.vue
@@ -0,0 +1,672 @@
+
+
+
+
+
+
+ 基本信息
+
+
+
+ 申请人姓名
+
+
+
+ 联系电话
+
+
+
+ 部门
+
+
+
+ 申请原因
+
+
+
+ 需要时间
+
+
+ {{ formData.neededAt || '请选择需要时间' }}
+
+
+
+
+
+
+
+
+
+ 物料明细
+
+
+
+
+ 暂无物料,请点击上方按钮添加
+
+
+
+
+
+
+ 物料名称
+
+
+
+
+
+
+
+ 规格
+
+
+
+
+
+ 数量
+
+
+
+ 单位
+
+
+
+
+
+ 预估单价
+
+
+
+
+ 备注
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ catalog.name }}
+
+ {{ catalog.spec }}
+ {{ catalog.unit }}
+
+
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/consumables/temp-request.vue b/src/pages/consumables/temp-request.vue
index 7f8c552..a2d5e29 100644
--- a/src/pages/consumables/temp-request.vue
+++ b/src/pages/consumables/temp-request.vue
@@ -241,7 +241,7 @@ onUnload(() => {
}
.btn-outline {
- padding: 12rpx 24rpx;
+ padding: 0rpx 24rpx;
background: #fff;
color: #4b7aff;
border: 2rpx solid #4b7aff;
diff --git a/src/pages/fixed-assets/index.vue b/src/pages/fixed-assets/index.vue
index 2de9c13..ca2b977 100644
--- a/src/pages/fixed-assets/index.vue
+++ b/src/pages/fixed-assets/index.vue
@@ -1,107 +1,183 @@
-
-
-
-
-
+
+
+
+
+
+
+ 🔍
+
+ ✕
+
+
-
- 加载中...
- 没有更多数据了
-
-
-
-
-
- {{ item.assetName }}
- 采购日期:{{ item.purchaseDate }}
- 采购价格:{{ item.purchasePrice }}
- 采购数量:{{ item.purchaseQuantity }}
- 设备状态:
- 使用中
- 报废
- 闲置
- 维修中
- 外借
- 未知
-
-
-
-
-
-
-
-
-
-
-
-
- 加载中...
- 没有更多数据了
-
-
-
-
-
-
-
- 设备名称:{{ selectedAsset?.assetName
- }}
-
- 借用人电话:
-
-
-
- {{ u.userName }} ({{ u.userMobile }}) (id: {{ u.id }})
-
-
-
-
-
- 借用日期:
-
- {{ borrowForm.borrowDate || '请选择借用日期' }}
-
-
-
- 预计归还日期:
-
- {{ borrowForm.returnDate || '请选择归还日期' }}
-
-
-
- 备注:
-
-
-
-
-
+
+
+
+
+ 全部
+
+
+ 使用中
+
+
+ 闲置
+
+
+ 维修中
+
+
+ 外借
+
+
+
+
+
+
+ 加载中...
+
+
+
+ 📦
+ 暂无资产数据
+
+
+
+
+
+
+
+
+
+
+ 采购日期:
+ {{ item.purchaseDate || '-' }}
+
+
+ 采购价格:
+ {{ item.purchasePrice ?
+ `¥${item.purchasePrice}` : '-' }}
+
+
+ 采购数量:
+ {{ item.purchaseQuantity || '-' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 加载中...
+ 没有更多数据了
+
+
+
+
+
+
+
+
+
+
+ 资产名称
+ {{ selectedAsset?.assetName }}
+
+
+
+ 借用人手机号 *
+
+
+
+ {{ u.userName }}
+ {{ u.userMobile }}
+
+
+
+
+
+ 借用日期 *
+
+
+ {{ borrowForm.borrowDate || '请选择借用日期' }}
+
+
+
+
+
+ 预计归还日期 *
+
+
+ {{ borrowForm.returnDate || '请选择归还日期' }}
+
+
+
+
+
+ 备注
+
+
+
+
+
+
+
+
diff --git a/src/pages/fixed-assets/inventory-plan.vue b/src/pages/fixed-assets/inventory-plan.vue
index cba3063..b1fb783 100644
--- a/src/pages/fixed-assets/inventory-plan.vue
+++ b/src/pages/fixed-assets/inventory-plan.vue
@@ -237,7 +237,7 @@ function previewImage(imageBase64: string) {
.meta-value {
color: #333;
- font-size: 28rpx;
+ font-size: 24rpx;
}
.detail {
diff --git a/src/pages/fixed-assets/lent-management.vue b/src/pages/fixed-assets/lent-management.vue
new file mode 100644
index 0000000..8a62229
--- /dev/null
+++ b/src/pages/fixed-assets/lent-management.vue
@@ -0,0 +1,547 @@
+
+
+
+
+
+
+
+ {{ totalCount }}
+ 借出总数
+
+
+ {{ unreturned }}
+ 未归还
+
+
+ {{ returned }}
+ 已归还
+
+
+
+
+
+
+
+ 全部
+
+
+ 未归还
+
+
+ 已归还
+
+
+
+
+ 🔍
+
+ ✕
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+ 📦
+ 暂无借出记录
+
+
+
+
+
+
+
+
+
+
+ 借用人:
+ {{ item.borrowerName || '-' }}
+
+
+ 联系方式:
+ {{ item.borrowerMobile || '-' }}
+
+
+ 借用日期:
+ {{ item.borrowDate || '-' }}
+
+
+ 应还日期:
+ {{ item.returnDate || '-' }}
+
+
+ 实际归还:
+ {{ item.actualReturnDate }}
+
+
+ 备注:
+ {{ item.note }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/pages/fixed-assets/my-borrows.vue b/src/pages/fixed-assets/my-borrows.vue
index c40a5b6..e227e67 100644
--- a/src/pages/fixed-assets/my-borrows.vue
+++ b/src/pages/fixed-assets/my-borrows.vue
@@ -1,133 +1,394 @@
-
-
-
-
-
- 借用日期:{{ item.borrowDate }}
- 预计归还日期:{{ item.returnDate }}
- 借用人:{{ item.borrowerName }}({{ item.borrowerMobile }})
- 出借人:{{ item.lenderName }}({{ item.lenderMobile }})
- 备注:{{ item.note || '无' }}
-
-
- 暂无更多数据
+
+
+
+
+ {{ totalCount }}
+ 借用总数
+
+
+
+ {{ borrowingCount }}
+ 借用中
+
+
+
+ {{ returnedCount }}
+ 已归还
+
+
+
+
+
+
+ 全部
+
+
+ 借用中
+
+
+ 已归还
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+ 📦
+ 暂无借用记录
+
+
+
+
+
+
+
+
+
+
+ 借用日期:
+ {{ item.borrowDate || '-' }}
+
+
+ 应还日期:
+ {{ item.returnDate || '-' }}
+
+
+ 实际归还:
+ {{ item.actualReturnDate }}
+
+
+ 出借人:
+ {{ item.lenderName || '-' }}
+
+
+ 联系方式:
+ {{ item.lenderMobile }}
+
+
+ 备注:
+ {{ item.note }}
+
+
+
+
+
+
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index a7f80ed..c343fde 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -83,6 +83,8 @@ import config, { AssetRole } from '@/config'
import * as staffRole from '@/constant/staffRole.js'
// @ts-ignore JS模块无类型声明
import util from '@/utils/util.js'
+import { onShow } from '@dcloudio/uni-app'
+import { fetchPendingCount } from '@/utils/messageManager'
// 资产管理展开状态
const assetOpen = ref(true)
@@ -90,15 +92,15 @@ const assetOpen = ref(true)
const assetItems = computed(() => {
const role = assetsRole.value || 0
return [
- { key: 'fixed', text: '固定资产', icon: '/static/icons/fixed-assets.png' },
- { key: 'mine', text: '我的借用', icon: '/static/icons/my-loans.png' },
- { key: 'scan', text: '扫码查看信息', icon: '/static/icons/scan-to-view-info.png' },
- { key: 'inventory', text: '资产盘点', icon: '/static/icons/asset-inventory.png' },
- { key: 'plan', text: '易耗品领用计划', icon: '/static/icons/consumables-plan.png' },
- { key: 'consumable', text: '易耗品盘点', icon: '/static/icons/consumables-inventory.png' },
- { key: 'lent', text: '出借资产管理', icon: '/static/icons/lent-assets-management.png', show: !!(role & AssetRole.TEAM_LEAD) },
- { key: 'request', text: '临时易耗品申请', icon: '/static/icons/consumables-temp-request.png', show: !!(role & AssetRole.TEAM_LEAD) },
- { key: 'approve', text: '临时易耗品申请审批', icon: '/static/icons/consumables-temp-approve.png', show: !!(role & AssetRole.CONSUMABLES_MANAGER) },
+ { key: 'fixed', text: '固定资产', icon: '/static/icons/fixed-assets.png', url: '/pages/fixed-assets/index' },
+ { key: 'mine', text: '我的借用', icon: '/static/icons/my-loans.png', url: '/pages/fixed-assets/my-borrows' },
+ { key: 'scan', text: '扫码查看信息', icon: '/static/icons/scan-to-view-info.png', url: '/pages/fixed-assets/scan' },
+ { key: 'inventory', text: '资产盘点', icon: '/static/icons/asset-inventory.png', url: '/pages/fixed-assets/inventory-plan' },
+ { key: 'plan', text: '易耗品领用计划', icon: '/static/icons/consumables-plan.png', url: '/pages/consumables/plan' },
+ { key: 'consumable', text: '易耗品盘点', icon: '/static/icons/consumables-inventory.png', url: '/pages/consumables/inventory-plan' },
+ { key: 'lent', text: '出借资产管理', icon: '/static/icons/lent-assets-management.png', url: '/pages/fixed-assets/lent-management', show: !!(role & AssetRole.DEVICE_MANAGER) },
+ { key: 'request', text: '临时易耗品申请', icon: '/static/icons/consumables-temp-request.png', url: '/pages/consumables/temp-request', show: !!(role & AssetRole.TEAM_LEAD) },
+ { key: 'approve', text: '临时易耗品申请审批', icon: '/static/icons/consumables-temp-approve.png', url: '/pages/consumables/temp-approve', show: !!(role & AssetRole.CONSUMABLES_MANAGER) },
].filter(item => item.show !== false)
})
@@ -146,6 +148,10 @@ onMounted(() => {
syncLoginState()
})
+onShow(() => {
+ syncLoginState()
+})
+
// 登录与角色态
const isLoggedIn = ref(false)
const staff = ref(null)
@@ -158,7 +164,7 @@ const isRider = ref(false)
function syncLoginState() {
staff.value = uni.getStorageSync('staff') || null
assetsRole.value = uni.getStorageSync('assetsRole') || null // 资产系统用户信息
- isLoggedIn.value = !!staff.value
+ isLoggedIn.value = (!!staff.value) || typeof assetsRole.value === 'number'
// 平台
// @ts-ignore
isWeixin.value = process?.env?.VUE_APP_PLATFORM === 'mp-weixin'
@@ -182,6 +188,8 @@ function goLogin() {
function logout() {
uni.setStorageSync('staff', null)
uni.setStorageSync('token', null)
+ uni.setStorageSync('assetsRole', null)
+ fetchPendingCount()
isLoggedIn.value = false
staff.value = null
isRider.value = false
@@ -203,44 +211,12 @@ function toggleAsset() {
function handleAsset(key: string) {
const item = assetItems.value.find((i: any) => i.key === key)
if (!item) return
- if (key === 'fixed') {
- uni.navigateTo({ url: '/pages/fixed-assets/index' })
- return
- }
- if (key === 'mine') {
- uni.navigateTo({ url: '/pages/fixed-assets/my-borrows' })
- return
- }
- if (key === 'inventory') {
- uni.navigateTo({ url: '/pages/fixed-assets/inventory-plan' })
- return
- }
- if (key === 'plan') {
- uni.navigateTo({ url: '/pages/consumables/plan' })
- return
- }
- if (key === 'consumable') {
- uni.navigateTo({ url: '/pages/consumables/inventory-plan' })
- return
- }
- if (key === 'scan') {
- uni.navigateTo({ url: '/pages/fixed-assets/scan' })
- return
- }
- if (key === 'lent') {
+ if (item.url) {
+ uni.navigateTo({ url: item.url })
+ } else {
+ // 其他入口可在此对接具体页面
uni.showToast({ title: `打开:${item.text}`, icon: 'none' })
- return
}
- if (key === 'request') {
- uni.navigateTo({ url: '/pages/consumables/temp-request' })
- return
- }
- if (key === 'approve') {
- uni.navigateTo({ url: '/pages/consumables/temp-approve' })
- return
- }
- // 其他入口可在此对接具体页面
- uni.showToast({ title: `打开:${item.text}`, icon: 'none' })
}
function previewCharge() {
uni.previewImage({
@@ -251,7 +227,6 @@ function previewCharge() {