|
|
@@ -5,7 +5,8 @@
|
|
|
<view class="search-bar">
|
|
|
<view class="search-box">
|
|
|
<image class="search-icon" src="/static/images/workbench/list/1.png" mode="aspectFit"></image>
|
|
|
- <input class="search-input" type="text" placeholder="请输入关键字查询" v-model="keyword" @confirm="handleSearch" />
|
|
|
+ <input class="search-input" type="text" placeholder="搜索工单编号、风机编号" v-model="keyword" @confirm="handleSearch" />
|
|
|
+ <text v-if="keyword && keyword.length > 0" class="clear-icon" @click="clearSearch">✕</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -32,22 +33,48 @@
|
|
|
<view class="list-item">
|
|
|
<view class="item-container">
|
|
|
<view class="item-header">
|
|
|
- <image class="location-icon" src="/static/images/workbench/list/2.png" mode="aspectFit"></image>
|
|
|
+ <!-- <image class="location-icon" src="/static/images/workbench/list/2.png" mode="aspectFit"></image>
|
|
|
<text class="item-title">{{ getOrderType(item) }}</text>
|
|
|
- <text class="detail-link">类型 ›</text>
|
|
|
+ <text class="detail-link">类型 ›</text> -->
|
|
|
+ <text class="item-title">{{ getWorkOrderProjectNo(item) }}-{{ getPcsDeviceName(item) }}{{ getOrderType(item) }}</text>
|
|
|
+ <text class="info-value">{{ getWorkOrderStatus(item) }}</text>
|
|
|
</view>
|
|
|
- <text class="item-address">{{ getWorkOrderProjectNo(item) }}</text>
|
|
|
- <view class="item-info">
|
|
|
+ <view class="info-row"></view>
|
|
|
+ <view class="flex justify-between items-center">
|
|
|
+ <!-- <view class="item-info">
|
|
|
+ <view class="info-row">
|
|
|
+ <view class="info-item"> -->
|
|
|
+ <text class="text-xs text-gray-500">{{ getDisplayTime(item) }}</text>
|
|
|
+ <!-- </view>
|
|
|
+ <view class="info-item">-->
|
|
|
+ <button
|
|
|
+ v-if="currentStatus === 'assigned'"
|
|
|
+ class="btn-primary text-xs py-1 px-3"
|
|
|
+ @click="acceptOrder(item)">
|
|
|
+ 接单
|
|
|
+ </button>
|
|
|
+ <button
|
|
|
+ v-else-if="currentStatus === 'to_approve'"
|
|
|
+ class="btn-primary text-xs py-1 px-3"
|
|
|
+ @click="approveOrder(item)">
|
|
|
+ 审批
|
|
|
+ </button>
|
|
|
+ <!-- </view>
|
|
|
+ </view>
|
|
|
+ </view> -->
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- <view class="item-info">
|
|
|
<view class="info-row">
|
|
|
<view class="info-item">
|
|
|
<text class="info-label">工单状态</text>
|
|
|
<text class="info-value">{{ getWorkOrderStatus(item) }}</text>
|
|
|
</view>
|
|
|
- <view class="info-item">
|
|
|
- <text class="info-label">场站</text>
|
|
|
- <text class="info-value">{{ getPcsStationName(item) }}</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
+ <view class="info-item">
|
|
|
+ <text class="info-label">场站</text>
|
|
|
+ <text class="info-value">{{ getPcsStationName(item) }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="info-row">
|
|
|
<view class="info-item">
|
|
|
<text class="info-label">设备名</text>
|
|
|
@@ -58,7 +85,7 @@
|
|
|
<text class="info-value">{{ getAssignTime(item) }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -68,9 +95,11 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="uts">
|
|
|
- import { ref, computed, onBeforeUnmount } from 'vue'
|
|
|
+ import { ref, computed, onBeforeUnmount, onMounted } from 'vue'
|
|
|
import type { orderInfo, orderListResponse } from '../../types/order'
|
|
|
+ import type { SysDictData } from '../../types/dict'
|
|
|
import { getOrderList } from '../../api/order/list'
|
|
|
+ import { getDictDataByType } from '../../api/dict/index'
|
|
|
|
|
|
// 列表数据
|
|
|
const dataList = ref<orderInfo[]>([])
|
|
|
@@ -82,6 +111,7 @@
|
|
|
const refreshing = ref<boolean>(false)
|
|
|
const total = ref<number>(0)
|
|
|
const currentStatus = ref<string>('') // 添加状态管理
|
|
|
+ const statusDictList = ref<SysDictData[]>([]) // 工单状态字典列表
|
|
|
|
|
|
// 辅助函数:从 any 类型提取属性
|
|
|
const getOrderType = (item: any | null): string => {
|
|
|
@@ -99,7 +129,13 @@
|
|
|
const getWorkOrderStatus = (item: any | null): string | null => {
|
|
|
if (item == null) return ''
|
|
|
const orderInfoItem = item as orderInfo
|
|
|
- return orderInfoItem.workOrderStatus
|
|
|
+ const rawStatus = orderInfoItem.workOrderStatus
|
|
|
+
|
|
|
+ if (!rawStatus) return ''
|
|
|
+
|
|
|
+ // 查找字典中对应的标签
|
|
|
+ const dictItem = statusDictList.value.find(dict => dict.dictValue === rawStatus)
|
|
|
+ return dictItem ? dictItem.dictLabel : rawStatus
|
|
|
}
|
|
|
|
|
|
const getPcsStationName = (item: any | null): string | null=> {
|
|
|
@@ -119,6 +155,35 @@
|
|
|
const orderInfoItem = item as orderInfo
|
|
|
return orderInfoItem.assignTime
|
|
|
}
|
|
|
+
|
|
|
+ const getAcceptTime = (item: any | null): string|null => {
|
|
|
+ if (item == null) return null
|
|
|
+ const orderInfoItem = item as orderInfo
|
|
|
+ return orderInfoItem.acceptTime
|
|
|
+ }
|
|
|
+
|
|
|
+ const getCreateTime = (item: any | null): string|null => {
|
|
|
+ if (item == null) return null
|
|
|
+ const orderInfoItem = item as orderInfo
|
|
|
+ return orderInfoItem.createTime
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 根据状态显示不同的时间
|
|
|
+ const getDisplayTime = (item: any | null): string|null => {
|
|
|
+ if (item == null) return null
|
|
|
+ const orderInfoItem = item as orderInfo
|
|
|
+
|
|
|
+ // 如果是"待接单"状态,显示派单时间
|
|
|
+ if (currentStatus.value === 'assigned') {
|
|
|
+ return getAssignTime(item)
|
|
|
+ } else if(currentStatus.value === 'to_finish') {
|
|
|
+ return getAcceptTime(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 默认显示创建时间
|
|
|
+ return getCreateTime(item)
|
|
|
+ }
|
|
|
|
|
|
// 切换状态
|
|
|
const switchStatus = (status: string): void => {
|
|
|
@@ -127,6 +192,18 @@
|
|
|
loadData(true)
|
|
|
}
|
|
|
|
|
|
+ // 获取工单状态字典列表
|
|
|
+ const loadStatusDictList = async (): Promise<void> => {
|
|
|
+ try {
|
|
|
+ const result = await getDictDataByType('gxt_work_order_status')
|
|
|
+ if (result.code === 200) {
|
|
|
+ statusDictList.value = result.data
|
|
|
+ }
|
|
|
+ } catch (e: any) {
|
|
|
+ console.error('获取工单状态字典失败:', e.message)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 加载列表数据
|
|
|
const loadData = async (isRefresh: boolean | null): Promise<void> => {
|
|
|
if (loading.value) {
|
|
|
@@ -145,7 +222,7 @@
|
|
|
page.value = 1
|
|
|
}
|
|
|
|
|
|
- // 调用 API,传递状态参数
|
|
|
+ // 调用 API,传递关键字参数
|
|
|
const searchKeyword = keyword.value.length > 0 ? keyword.value : null
|
|
|
const result = await getOrderList(page.value, pageSize, searchKeyword, currentStatus.value || null)
|
|
|
|
|
|
@@ -178,7 +255,8 @@
|
|
|
pcsDeviceId: item['pcsDeviceId'] as Number | 0,
|
|
|
pcsDeviceName: item['pcsDeviceName'] as string | null,
|
|
|
brand: item['brand'] as string | null,
|
|
|
- model: item['model'] as string | null
|
|
|
+ model: item['model'] as string | null,
|
|
|
+ createTime: item['createTime'] as string | null
|
|
|
}
|
|
|
newData.push(orderItem)
|
|
|
}
|
|
|
@@ -255,7 +333,46 @@
|
|
|
url: `/pages/workbench/detail/index?id=${orderItem.id}`
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ // 接单操作
|
|
|
+ const acceptOrder = (item: any | null): void => {
|
|
|
+ if (item == null) return
|
|
|
+ const orderItem = item as orderInfo
|
|
|
+ console.log('接单操作:', orderItem.id)
|
|
|
+ // 这里可以添加实际的接单逻辑
|
|
|
+ uni.showToast({
|
|
|
+ title: '接单成功',
|
|
|
+ icon: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 审批操作
|
|
|
+ const approveOrder = (item: any | null): void => {
|
|
|
+ if (item == null) return
|
|
|
+ const orderItem = item as orderInfo
|
|
|
+ console.log('审批操作:', orderItem.id)
|
|
|
+ // 这里可以添加实际的审批逻辑
|
|
|
+ uni.showToast({
|
|
|
+ title: '审批成功',
|
|
|
+ icon: 'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查看工单详情
|
|
|
+ const showWorkOrderDetail = (item: any | null): void => {
|
|
|
+ if (item == null) return
|
|
|
+ const orderItem = item as orderInfo
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/workbench/detail/index?id=${orderItem.id}`
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清空搜索
|
|
|
+ const clearSearch = (): void => {
|
|
|
+ keyword.value = ""
|
|
|
+ page.value = 1
|
|
|
+ loadData(true)
|
|
|
+ }
|
|
|
// 组件卸载前清理
|
|
|
onBeforeUnmount(() => {
|
|
|
refreshing.value = false
|
|
|
@@ -263,7 +380,10 @@
|
|
|
})
|
|
|
|
|
|
// 初始化
|
|
|
- loadData(true as boolean | null)
|
|
|
+ onMounted(() => {
|
|
|
+ loadStatusDictList()
|
|
|
+ loadData(true as boolean | null)
|
|
|
+ })
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|
|
|
@@ -296,6 +416,12 @@
|
|
|
font-size: 28rpx;
|
|
|
color: #333333;
|
|
|
}
|
|
|
+
|
|
|
+ .clear-icon {
|
|
|
+ margin-left: 12rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ color: #999999;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.status-bar{
|