车间能级提升-智能设备管理系统
baoshiwei
2025-06-27 88e10f5656a0ad5530a9e37892fb327153d9dc8a
eims-ui-mobile/src/pages/inspect/insp-record.vue
@@ -11,6 +11,7 @@
    v-model="dataList"
    :auto="false"
    @query="queryList"
    refresher-only
    show-refresher-update-time
  >
    <template #top>
@@ -124,7 +125,7 @@
            </view>
          </template>
          <view v-if="item.showDesc" class="mt-2">
          <view v-if="item.inspResult === '2'" class="mt-2">
            <wd-input
              v-model="item.inspDesc"
              placeholder="请输入异常描述"
@@ -176,9 +177,9 @@
        size="large"
      />
      <!-- 新增提交按钮 -->
      <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 class="flex justify-around">
        <wd-button type="primary" style="margin: 20px" block  v-if="inspSt.status === '0' || inspSt.status === '1'" @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>
@@ -186,7 +187,7 @@
<script setup lang="ts">
import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store'
import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils'
import { isLeader, isLineOrRepair } from '@/utils/RoleUtils'
import {
  getInspStRecordList,
  getInspSt,
@@ -244,26 +245,24 @@
  status: '',
  inspUser: '',
  specialNote: '',
  runTimes: 0,
  faultTimes: 0,
  runTimes: undefined,
  faultTimes: undefined,
})
const paging = ref(null)
const dataList = ref([])
const queryList = (pageNum?: number, pageSize?: number) => {
const queryList = () => {
  // 这里的pageNo和pageSize会自动计算好,直接传给服务器即可
  // 这里的请求只是演示,请替换成自己的项目的网络请求,并在网络请求回调中通过paging.value.complete(请求回来的数组)将请求结果传给z-paging
  const params: QueryParams = {
    pageNum,
    pageSize,
    inspCode: inspSt.inspCode,
  }
  getInspStRecordList(params)
    .then((res: any) => {
      // 请勿在网络请求回调中给dataList赋值!!只需要调用complete就可以了
      paging.value.completeByTotal(res.rows, res.total)
      paging.value.complete(res.rows, res.total)
    })
    .catch((res) => {
      // 如果请求失败写paging.value.complete(false),会自动展示错误页面
@@ -280,13 +279,6 @@
  // 修改时间格式为 YYYY-MM-DD HH:mm:ss
  const now = new Date()
  item.inspTime = `${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')}`
  if (item.inspResult === '2') {
    item.showDesc = true
  } else {
    item.showDesc = false
    item.inspDesc = ''
  }
}
const goBack = () => {
@@ -294,8 +286,11 @@
}
function handleClickRight() {
  if (isOperatorOrRepair()) {
  if (inspSt.status === '0') {
    handleConfirm()
  } else if (inspSt.status === '1') {
    handleComplete()
  }
}
@@ -368,6 +363,7 @@
  } else {
    inspSt.status = '0'
  }
  updateInspectSt(inspSt)
    .then((res: any) => {
      toast.success('操作成功')
@@ -385,15 +381,18 @@
 * 确认完成按钮点击事件
 */
function handleComplete() {
  if (!isLeader()) {
    toast.info('无权限操作');
    return;
  console.log('handleComplete', inspSt)
  if (!inspSt.runTimes || !inspSt.faultTimes) {
    message.alert('请填写运行次数和故障次数!')
    return false
  }
  const now = new Date();
  const data: any = Object.assign(
    {},
    {
      id: inspSt.id,
      runTimes: inspSt.runTimes,
      faultTimes: inspSt.faultTimes,
      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')}`