车间能级提升-智能设备管理系统
baoshiwei
2025-06-10 0f63c9e381eeefa2f7aceb7ed8d043ddd165afd5
eims-ui-mobile/src/pages/maint/maint-order.vue
@@ -54,15 +54,17 @@
            <view class="text-color-gray text-sm mt-1 flex">
              <text class="mr-3">工单总数: {{ maintSt.orderCount }}</text>
              |
              <text class="mx-3">已完成: {{ maintSt.wcCount }}</text>
            </view>
            <view class="text-color-gray text-sm mt-2 flex">
              <text class="mr-3">待保养: {{ maintSt.dbyCount }}</text>
              <text class="mx-3">已完成: {{ maintSt.dyzCount }}</text>
              |
              <text class="mx-3">保养中: {{ maintSt.byCount }}</text>
<!--              |-->
<!--              <text class="ml-3">待验证: {{ maintSt.dyzCount }}</text>-->
              <text class="mx-3">待保养: {{ maintSt.dbyCount }}</text>
            </view>
<!--            <view class="text-color-gray text-sm mt-2 flex">-->
<!--              <text class="mr-3">待保养: {{ maintSt.dbyCount }}</text>-->
<!--              |-->
<!--              <text class="mx-3">保养中: {{ maintSt.byCount }}</text>-->
<!--&lt;!&ndash;              |&ndash;&gt;-->
<!--&lt;!&ndash;              <text class="ml-3">待验证: {{ maintSt.dyzCount }}</text>&ndash;&gt;-->
<!--            </view>-->
            <view class="text-color-gray text-sm mt-2 flex">
              <text>状态:</text>
              <template v-if="maintSt.status === '1'">
@@ -140,6 +142,9 @@
        <!-- 正文区域 -->
        <view v-else class="mt-2">
          <wd-upload v-model:file-list="item.fileList" :action="VITE_UPLOAD_BASEURL" @success="handleUploadSuccess" >
            <wd-button>上传图片</wd-button>
          </wd-upload>
          <!-- 保养说明区域 -->
          <view v-if="item.maintFun === '1'" class="mt-2">
            <wd-input
@@ -259,7 +264,8 @@
import { formatDate } from '@/utils/DateUtils'
import { useUserStore } from "@/store";
import { getSpareList } from '@/service/spare'
import { getEnvBaseUploadUrl } from "@/utils";
const VITE_UPLOAD_BASEURL = `${getEnvBaseUploadUrl()}`
const message = useMessage()
const toast = useToast()
const userStore = useUserStore()
@@ -300,10 +306,19 @@
  }
  getMaintStOrderList(params)
    .then((res: any) => {
      // 将每一项的picture转换为fileList数组
      res.rows.forEach((item: any) => {
        item.fileList = item.picture?.split(',').map((url: string) => {
          return {
            url: url,
          }
        })
      })
      // 请勿在网络请求回调中给dataList赋值!!只需要调用complete就可以了
      paging.value.completeByTotal(res.rows, res.total)
    })
    .catch((res) => {
      console.error(res)
      // 如果请求失败写paging.value.complete(false),会自动展示错误页面
      // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
      // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
@@ -381,6 +396,7 @@
function confirmSpareSelection() {
  closeSparePopup()
}
function addOtherSparePart() {
  dataList.value[selectedPartIndex.value].spareParts.push({
@@ -482,6 +498,15 @@
    toast.info('请填写维修说明!')
    return false
  }
  // 将submitList中每一项的fileList转换为以逗号分割的字符串
  submitList.forEach((item) => {
    console.log('item.fileList', item.fileList)
    const map = item.fileList?.map((file) => file.url)
    console.log('map', map)
    item.picture = map?.join(',')
  })
  const data: any = Object.assign(
@@ -643,7 +668,16 @@
    .catch((res) => {
      console.error(res)
    })
}
function handleUploadSuccess({ file, fileList }) {
  console.log('handleUploadSuccess', file)
  // 判断 file.response是不是 对象,不是对象将json字符串转换为对象
  if (typeof file.response === 'string') {
    file.response = JSON.parse(file.response)
    console.log('file.response', file.response)
    file.ossId = file.response.data.ossId
    file.url = file.response.data.url
  }
}
// 新增方法:获取状态文本