<template>
|
<view class="bg-base">
|
|
<z-paging ref="paging" v-model="dataList" @query="queryList" class="bg-base">
|
<template #top>
|
<wd-search v-model="searchValue" placeholder="设备名称/资产编号" @search="reloadData" />
|
<wd-tabs v-model="activeTab" @change="handleTabChange">
|
<wd-tab title="待确认"></wd-tab>
|
<wd-tab title="已同意"></wd-tab>
|
<wd-tab title="已驳回"></wd-tab>
|
</wd-tabs>
|
</template>
|
<view v-for="item in dataList" :key="item.equStatuId" class="mb-2" >
|
<wd-card type="rectangle">
|
<template #title>
|
<view class="flex justify-between items-center menu-title-box">
|
<view class="flex items-center">
|
<view class="menu-indicator"></view>
|
<text class="ml-1 text-sm">{{ item.equName || '-' }}</text>
|
<text class="ml-2 text-color-gray text-mini">{{ item.assetNo || '-' }}</text>
|
</view>
|
<wd-tag v-if="item.orderStatus === '0'" type="warning">待确认</wd-tag>
|
<wd-tag v-else-if="item.orderStatus === '1'" type="success">已同意</wd-tag>
|
<wd-tag v-else type="error">已驳回</wd-tag>
|
</view>
|
</template>
|
<view class="flex h-[200rpx] items-center">
|
<image class="slot-img text-center" src="/static/images/camera.png" />
|
<view class="flex-1">
|
<view class="text-color-base mt-1">变更前:{{ statusText(item.beforeChange) }} → 变更后:{{ statusText(item.afterChange) }}</view>
|
<view class="text-color-gray text-sm mt-1">变更原因:{{ item.changeDesc }}</view>
|
<view class="text-color-gray text-sm mt-1">变更时间:{{ item.changeDate || '-' }}</view>
|
<view class="text-color-gray text-sm mt-1">变更人:{{ item.changeUserName || '-' }}</view>
|
<view v-if="item.orderStatus === '2' && item.remark" class="text-color-error text-sm mt-1">驳回理由:{{ item.remark }}</view>
|
</view>
|
<view v-if="item.orderStatus === '0' && isEquAdmin()" class="flex flex-col gap-2 ml-2">
|
<wd-button size="small" type="success" @click="handleAgree(item)">同意</wd-button>
|
<wd-button size="small" type="error" @click="openReject(item)">驳回</wd-button>
|
</view>
|
</view>
|
</wd-card>
|
</view>
|
</z-paging>
|
<wd-popup v-model="showReject" position="center" round :close-on-click-modal="false">
|
<view class="popup-container">
|
<view class="popup-title">填写驳回理由</view>
|
<wd-textarea v-model="rejectReason" placeholder="请输入驳回理由" :maxlength="100" show-word-limit required />
|
<view class="popup-actions">
|
<wd-button block @click="showReject = false">取消</wd-button>
|
<wd-button type="error" block class="ml-2" @click="handleRejectConfirm">确定</wd-button>
|
</view>
|
</view>
|
</wd-popup>
|
</view>
|
</template>
|
<script setup lang="ts">
|
import { ref } from 'vue'
|
import { getEquStatuList, updateEquStatu } from '@/service/equ_status'
|
import { useToast } from 'wot-design-uni'
|
import { isEquAdmin } from "@/utils/RoleUtils";
|
const toast = useToast()
|
const searchValue = ref('')
|
const activeTab = ref(0)
|
const dataList = ref<any[]>([])
|
const paging = ref()
|
const showReject = ref(false)
|
const rejectReason = ref('')
|
const rejectItem = ref<any>(null)
|
|
const statusMap = [
|
{ label: '试用', value: '0' },
|
{ label: '使用', value: '1' },
|
{ label: '停用', value: '2' },
|
{ label: '报废', value: '3' },
|
{ label: '闲置', value: '4' },
|
{ label: '新增', value: '5' },
|
]
|
function statusText(val: string) {
|
return statusMap.find((s) => s.value === val)?.label || '-'
|
}
|
function handleTabChange({ index }) {
|
activeTab.value = index
|
reloadData()
|
}
|
function reloadData() {
|
paging.value.reload()
|
}
|
function queryList(pageNum?: number, pageSize?: number) {
|
const params: any = {
|
pageNum,
|
pageSize,
|
params: {
|
searchValue: searchValue.value,
|
},
|
orderStatus: String(activeTab.value),
|
}
|
getEquStatuList(params).then((res: any) => {
|
paging.value.completeByTotal(res.rows, res.total)
|
}).catch(() => {
|
paging.value.complete(false)
|
})
|
}
|
function handleAgree(item: any) {
|
updateEquStatu({
|
equStatuId: item.equStatuId,
|
orderStatus: '1',
|
remark: '',
|
}).then(() => {
|
toast.success('操作成功')
|
reloadData()
|
})
|
}
|
function openReject(item: any) {
|
rejectItem.value = item
|
rejectReason.value = ''
|
showReject.value = true
|
}
|
function handleRejectConfirm() {
|
if (!rejectReason.value.trim()) {
|
toast.info('请填写驳回理由')
|
return
|
}
|
updateEquStatu({
|
equStatuId: rejectItem.value.equStatuId,
|
orderStatus: '2',
|
remark: rejectReason.value,
|
}).then(() => {
|
toast.success('已驳回')
|
showReject.value = false
|
reloadData()
|
})
|
}
|
</script>
|
<style scoped lang="scss">
|
.menu-title-box {
|
}
|
.slot-img {
|
width: 72rpx;
|
height: 72rpx;
|
margin-right: 24rpx;
|
}
|
.text-mini {
|
font-size: 24rpx;
|
}
|
.menu-indicator {
|
width: 6rpx;
|
height: 26rpx;
|
border-radius: 10rpx;
|
background-color: $uni-color-primary;
|
}
|
:deep(.wd-card__footer) {
|
padding: 10rpx !important;
|
}
|
:deep(.wd-card__title-content) {
|
padding: 24rpx 0 !important;
|
}
|
.popup-container {
|
width: 600rpx;
|
background: #fff;
|
border-radius: 16rpx;
|
padding: 32rpx 24rpx 24rpx 24rpx;
|
}
|
.popup-title {
|
font-size: 32rpx;
|
font-weight: bold;
|
text-align: center;
|
margin-bottom: 24rpx;
|
}
|
.popup-actions {
|
display: flex;
|
margin-top: 24rpx;
|
gap: 16rpx;
|
}
|
</style>
|