|
|
@@ -110,7 +110,7 @@
|
|
|
<view class="item-container">
|
|
|
<view class="item-header">
|
|
|
<text class="item-title">{{ getPropertyValue(item, 'workOrderProjectNo') }}-风机编号{{ getPropertyValue(item, 'pcsDeviceName') }}的{{ getWorkOrderTypeText(getPropertyValue(item, 'orderType')) }}</text>
|
|
|
- <text class="info-value">{{ getOrderStatusText(getPropertyValue(item, 'workOrderStatus')) }}</text>
|
|
|
+ <text class="info-value">{{ getWorkOrderStatus(item) }}</text>
|
|
|
</view>
|
|
|
<view class="info-row">
|
|
|
<view class="info-label">
|
|
|
@@ -158,6 +158,8 @@
|
|
|
<script setup lang="uts">
|
|
|
import { ref, computed, onMounted } from 'vue'
|
|
|
import { listOrderHours, getOrderHourStatistics } from '@/api/worktime/index'
|
|
|
+import { getDictDataByType } from '@/api/dict/index'
|
|
|
+import type { SysDictData } from '@/types/dict'
|
|
|
|
|
|
// 数据状态
|
|
|
const searchKeyword = ref<string>('')
|
|
|
@@ -180,6 +182,10 @@ const showDatePickerPopup = ref<boolean>(false)
|
|
|
const startDate = ref<string>('')
|
|
|
const endDate = ref<string>('')
|
|
|
|
|
|
+// 工单状态字典列表
|
|
|
+const statusDictList = ref<SysDictData[]>([])
|
|
|
+const dictLoaded = ref<boolean>(false)
|
|
|
+
|
|
|
// 计算属性
|
|
|
const timeRangeTitle = computed(() => {
|
|
|
switch (timeRange.value) {
|
|
|
@@ -194,6 +200,47 @@ const timeRangeTitle = computed(() => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+// 获取工单状态字典列表
|
|
|
+const loadStatusDictList = async (): Promise<void> => {
|
|
|
+ try {
|
|
|
+ const result = await getDictDataByType('gxt_work_order_status')
|
|
|
+ const resultObj = result as UTSJSONObject
|
|
|
+
|
|
|
+ if (resultObj['code'] == 200) {
|
|
|
+ const data = resultObj['data'] as any[]
|
|
|
+ const dictData: SysDictData[] = []
|
|
|
+
|
|
|
+ if (data != null && data.length > 0) {
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ const item = data[i] as UTSJSONObject
|
|
|
+ // 只提取需要的字段
|
|
|
+ const dictItem: SysDictData = {
|
|
|
+ dictValue: item['dictValue'] as string | null,
|
|
|
+ dictLabel: item['dictLabel'] as string | null,
|
|
|
+ dictCode: null,
|
|
|
+ dictSort: null,
|
|
|
+ dictType: null,
|
|
|
+ cssClass: null,
|
|
|
+ listClass: null,
|
|
|
+ isDefault: null,
|
|
|
+ status: null,
|
|
|
+ default: null,
|
|
|
+ createTime: null,
|
|
|
+ remark: null
|
|
|
+ }
|
|
|
+ dictData.push(dictItem)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ statusDictList.value = dictData
|
|
|
+ dictLoaded.value = true
|
|
|
+ }
|
|
|
+ } catch (e: any) {
|
|
|
+ console.error('获取工单状态字典失败:', e.message)
|
|
|
+ dictLoaded.value = true
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// Helper function to safely extract properties from item
|
|
|
function getPropertyValue(item: any | null, propertyName: string): string {
|
|
|
if (item == null) return ''
|
|
|
@@ -214,6 +261,23 @@ function getWorkOrderTypeText(orderType: string | null): string {
|
|
|
return ""
|
|
|
}
|
|
|
|
|
|
+// 获取工单状态文本
|
|
|
+function getWorkOrderStatus(item: any | null): string | null {
|
|
|
+ if (item == null) return ''
|
|
|
+ const rawStatus = getPropertyValue(item, 'workOrderStatus')
|
|
|
+
|
|
|
+ if (rawStatus == null || rawStatus == '') return ''
|
|
|
+
|
|
|
+ // 如果字典尚未加载,返回原始值
|
|
|
+ if (!dictLoaded.value) {
|
|
|
+ return rawStatus
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查找字典中对应的标签
|
|
|
+ const dictItem = statusDictList.value.find(dict => dict.dictValue == rawStatus)
|
|
|
+ return dictItem != null ? dictItem.dictLabel : rawStatus
|
|
|
+}
|
|
|
+
|
|
|
// 获取统计数据
|
|
|
function getStatistics() {
|
|
|
const params: UTSJSONObject = {
|
|
|
@@ -394,6 +458,7 @@ function formatNumber(value: number | null) {
|
|
|
|
|
|
// 生命周期
|
|
|
onMounted(() => {
|
|
|
+ loadStatusDictList()
|
|
|
loadData(false)
|
|
|
getStatistics()
|
|
|
})
|