车间能级提升-智能设备管理系统
baoshiwei
2025-06-09 2ab727eb8a56077d9ad52112a9c8e97010b84b6d
eims-ui-mobile/src/pages/inspect/insp-record.vue
@@ -24,7 +24,7 @@
        safeAreaInsetTop
      >
        <template #right>
          <text v-if="isOperatorOrRepair()" class="text-white">提交</text>
          <text v-if="inspSt.status === '0'" class="text-white">提交</text>
        </template>
      </wd-navbar>
      <wd-card type="rectangle">
@@ -61,9 +61,13 @@
            </view>
            <view class="text-color-gray text-sm mt-2 flex">
              <text>状态:</text>
              <template v-if="dataCount > 0 && dataCount === checkCount">
              <template v-if="inspSt.status === '1'">
                <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已完成</text>
              </template>
              <template v-else-if="inspSt.status === '2'">
                <wd-icon class="icon-color-warning" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已确认</text>
              </template>
              <template v-else>
                <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon>
@@ -172,8 +176,9 @@
        size="large"
      />
      <!-- 新增提交按钮 -->
      <view class="flex justify-center mt-4">
        <wd-button type="primary" block size="large" @click="handleClickRight">提交</wd-button>
      <view class="flex justify-around mt-4">
        <wd-button type="primary" block size="large" v-if="inspSt.status === '0'" @click="handleClickRight">提交</wd-button>
        <wd-button type="success" block size="large" v-if="isLeader() && inspSt.status === '1'" @click="handleComplete">确认完成</wd-button>
      </view>
    </view>
  </z-paging>
@@ -217,6 +222,8 @@
  specialNote: string
  runTimes: number
  faultTimes: number
  verifyUser?: number | string
  verifyTime?: string
}
const dataChange = ref(false)
@@ -356,7 +363,11 @@
}
function updateInspSt(resolve: any) {
  // 更新点检汇总
  inspSt.status = '1'
  if (dataCount.value === selectedItems.value.length) {
    inspSt.status = '1'
  } else {
    inspSt.status = '0'
  }
  updateInspectSt(inspSt)
    .then((res: any) => {
      toast.success('操作成功')
@@ -371,6 +382,38 @@
}
/**
 * 确认完成按钮点击事件
 */
function handleComplete() {
  if (!isLeader()) {
    toast.info('无权限操作');
    return;
  }
  const now = new Date();
  const data: any = Object.assign(
    {},
    {
      id: inspSt.id,
      status: '2',
      verifyUser: userStore?.userInfo?.userId,
      verifyTime: `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')} ${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(now.getSeconds()).padStart(2, '0')}`
    },
  )
  updateInspectSt(data)
    .then((res: any) => {
      if (res?.code === 200) {
        uni.$emit('insp-st-refresh')
        goBack()
        toast.success('操作成功')
      }
    })
    .catch((res) => {
      console.error(res)
      toast.error('操作失败')
    })
}
/**
 * 点检记录条目点击事件
 * @param item
 */