车间能级提升-智能设备管理系统
zhuguifei
2025-04-23 1dc84e14accf77681279e63fbba188770bfc8b40
eims-ui-mobile/src/pages/inspect/insp-record.vue
@@ -1,5 +1,6 @@
<route lang="json5">
{
  needLogin: true,
  style: {
    navigationBarTitleText: '点检记录',
    navigationStyle: 'custom',
@@ -52,7 +53,7 @@
            <view class="text-color-gray text-xs mt-2 flex">
              <text>状态:</text>
              <template v-if="dataCount > 0 && dataCount === checkCount">
                <wd-icon class="icon-color-success" name="check-outline" size="40rpx"></wd-icon>
                <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已完成</text>
              </template>
              <template v-else>
@@ -109,6 +110,18 @@
          </view>
        </wd-collapse-item>
      </wd-collapse>
      <view class="w-full h-[1rpx] bg-base"></view>
      <wd-textarea
        label="特记事项"
        label-width="200rpx"
        type="textarea"
        v-model="inspSt.specialNote"
        auto-height
        :maxlength="200"
        show-word-limit
        placeholder="请输入特记事项"
        clearable
      />
    </view>
  </z-paging>
</template>
@@ -116,7 +129,7 @@
<script setup lang="ts">
import { ref } from 'vue'
import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store'
import { getInspStRecordList, updateInspRecord, updateInspRecordBatch } from '@/service/inspect'
import { getInspStRecordList, updateInspectSt, updateInspRecordBatch } from '@/service/inspect'
import { useToast, useMessage } from 'wot-design-uni'
import type { CollapseInstance } from 'wot-design-uni/components/wd-collapse/types'
const message = useMessage()
@@ -134,10 +147,14 @@
}
interface InspSt {
  id: string
  inspCode: string
  equName: string
  assetNo: string
  planTimeStr?: string
  status: string
  inspUser: number | string
  specialNote: string
}
const dataChange = ref(false)
@@ -148,10 +165,14 @@
// 点检汇总数据(上个页面传值)
const inspSt = reactive<InspSt>({
  id: '',
  inspCode: '',
  equName: '',
  assetNo: '',
  planTimeStr: '',
  status: '',
  inspUser: '',
  specialNote: '',
})
const paging = ref(null)
@@ -180,7 +201,7 @@
}
function inspResultClick(item: any) {
  // userStore?.userInfo?.realName
  // userStore?.userInfo?.userId
}
const goBack = () => {
@@ -191,7 +212,7 @@
}
const toggleCollapse = () => {
  isAllExpanded.value = !isAllExpanded.value
  isAllExpanded.value = !isAllExpanded.value
  collapseRef.value.toggleAll(isAllExpanded.value)
}
@@ -218,9 +239,22 @@
  const params = {
    inspRecordList: dataList.value,
  }
  // 更新点检记录
  updateInspRecordBatch(params)
    .then((res: any) => {
      updateInspSt(resolve)
    })
    .catch((res) => {
      console.error(res)
    })
}
function updateInspSt(resolve: any) {
  // 更新点检汇总
  inspSt.status = '1'
  updateInspectSt(inspSt)
    .then((res: any) => {
      paging.value.reload()
      uni.$emit('insp-st-refresh')
      resolve(true)
    })
    .catch((res) => {
@@ -244,10 +278,13 @@
  { deep: true },
)
onLoad((options) => {
  inspSt.id = options.id
  inspSt.inspCode = options.inspCode
  inspSt.equName = options.equName
  inspSt.assetNo = options.assetNo
  inspSt.planTimeStr = options.planTimeStr
  inspSt.specialNote = options?.specialNote
  inspSt.inspUser = userStore?.userInfo?.userId
})
const dataCount = computed(() => dataList.value.length)
@@ -294,5 +331,6 @@
:deep(.wd-navbar__title) {
  color: white;
  font-weight: 0;
  font-size: 32rpx;
}
</style>