¶Ô±ÈÐÂÎļþ |
| | |
| | | <route lang="json5"> |
| | | { |
| | | needLogin: true, |
| | | style: { |
| | | navigationBarTitleText: 'ç¹æ£è®°å½', |
| | | navigationStyle: 'custom', |
| | | navigationBarBackgroundColor: '#4D80F0', |
| | | }, |
| | | } |
| | | </route> |
| | | <template> |
| | | <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time> |
| | | <template #top> |
| | | <wd-navbar |
| | | title="ç¹æ£è®°å½" |
| | | left-arrow |
| | | @click-left="goBack" |
| | | right-text="æäº¤" |
| | | @click-right="handleClickRight" |
| | | custom-style="background: #4D80F0;" |
| | | safeAreaInsetTop |
| | | ></wd-navbar> |
| | | |
| | | <wd-card type="rectangle"> |
| | | <template #title> |
| | | <view class="flex justify-between"> |
| | | <view class="flex items-center menu-title-box"> |
| | | <view class="menu-indicator"></view> |
| | | <view class="ml-1 text-sm align-center">{{ inspSt.equName }}</view> |
| | | <view class="text-color-gray ml-2 text-mini">{{ inspSt.assetNo }}</view> |
| | | </view> |
| | | |
| | | <view class="flex items-center"> |
| | | <text class="text-color-gray text-mini">{{ inspSt.planTimeStr }}</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | <view class="flex h-[100rpx]" items-center> |
| | | <image class="slot-img text-center" src="/static/images/camera.png" /> |
| | | <view class="flex-1"> |
| | | <view class="text-color-gray text-xs mt-1 flex"> |
| | | <text class="mr-3">ç¹æ£æ»æ°: {{ dataCount }}</text> |
| | | | |
| | | <text class="mx-3">å·²ç¹æ£: {{ checkCount }}</text> |
| | | | |
| | | <text class="ml-3">æªç¹æ£: {{ dataCount - checkCount }}</text> |
| | | </view> |
| | | <view class="text-color-gray text-xs mt-2 flex"> |
| | | <text class="mr-3">æ£å¸¸: {{ normalNum }}</text> |
| | | | |
| | | <text class="mx-3">å¼å¸¸: {{ abNormalNum }}</text> |
| | | </view> |
| | | <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="34rpx"></wd-icon> |
| | | <text class="ml-1">已宿</text> |
| | | </template> |
| | | <template v-else> |
| | | <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon> |
| | | <text class="ml-1">è¿è¡ä¸</text> |
| | | </template> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </wd-card> |
| | | </template> |
| | | |
| | | <view class="bg-base"> |
| | | <view class="w-full h-[24rpx]"></view> |
| | | <wd-cell> |
| | | <template #title> |
| | | <text class="text-color-gray">ç¹æ£é¡¹</text> |
| | | </template> |
| | | <wd-button size="small" type="text" @click.stop="toggleCollapse"> |
| | | {{ isAllExpanded ? 'å
¨é¨æå ' : 'å
¨é¨å±å¼' }} |
| | | </wd-button> |
| | | </wd-cell> |
| | | <wd-collapse v-model="collSelects" title="ç¹æ£é¡¹" ref="collapseRef"> |
| | | <wd-collapse-item :name="item.id" v-for="(item, index) in dataList"> |
| | | <template #title="{ expanded, disabled, isFirst }"> |
| | | <view class="flex justify-between"> |
| | | <view class="flex justify-center items-center"> |
| | | <text class="text-sm">{{ item.inspName }}</text> |
| | | </view> |
| | | |
| | | <view class="flex items-center"> |
| | | <wd-radio-group |
| | | v-model="item.inspResult" |
| | | inline |
| | | shape="dot" |
| | | @change="inspResultClick(item)" |
| | | > |
| | | <wd-radio value="1">æ£å¸¸</wd-radio> |
| | | <wd-radio value="2">å¼å¸¸</wd-radio> |
| | | </wd-radio-group> |
| | | <wd-icon |
| | | v-if="expanded" |
| | | name="arrow-up" |
| | | size="30rpx" |
| | | class="icon-color-gray" |
| | | ></wd-icon> |
| | | <wd-icon v-else name="arrow-down" size="30rpx" class="icon-color-gray"></wd-icon> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | <view class="text-color-gray text-xs flex justify-between"> |
| | | <text class="mr-3">ç¹æ£äºº: {{ item.inspUserName }}</text> |
| | | <text class="mx-3">ç¹æ£æ¶é´: {{ item.inspTime }}</text> |
| | | </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> |
| | | |
| | | <script setup lang="ts"> |
| | | import { ref } from 'vue' |
| | | import { useUserStore, useAccessStore, useSystemConfigStore } from '@/store' |
| | | 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() |
| | | const toast = useToast() |
| | | |
| | | const collapseRef = ref<CollapseInstance>() |
| | | const isAllExpanded = ref(false) |
| | | |
| | | // å®ä¹æ¥å£ |
| | | interface QueryParams { |
| | | pageNum: number |
| | | pageSize: number |
| | | inspCode: string |
| | | status?: string |
| | | } |
| | | |
| | | interface InspSt { |
| | | id: string |
| | | inspCode: string |
| | | equName: string |
| | | assetNo: string |
| | | planTimeStr?: string |
| | | status: string |
| | | inspUser: number | string |
| | | specialNote: string |
| | | } |
| | | |
| | | const dataChange = ref(false) |
| | | |
| | | const userStore = useUserStore() |
| | | |
| | | const collSelects = ref<string[]>([]) |
| | | |
| | | // ç¹æ£æ±æ»æ°æ®(ä¸ä¸ªé¡µé¢ä¼ å¼) |
| | | const inspSt = reactive<InspSt>({ |
| | | id: '', |
| | | inspCode: '', |
| | | equName: '', |
| | | assetNo: '', |
| | | planTimeStr: '', |
| | | status: '', |
| | | inspUser: '', |
| | | specialNote: '', |
| | | }) |
| | | |
| | | const paging = ref(null) |
| | | const dataList = ref([]) |
| | | |
| | | const queryList = (pageNum?: number, pageSize?: number) => { |
| | | // è¿éçpageNoåpageSizeä¼èªå¨è®¡ç®å¥½ï¼ç´æ¥ä¼ ç»æå¡å¨å³å¯ |
| | | // è¿éç请æ±åªæ¯æ¼ç¤ºï¼è¯·æ¿æ¢æèªå·±ç项ç®çç½ç»è¯·æ±ï¼å¹¶å¨ç½ç»è¯·æ±åè°ä¸éè¿paging.value.complete(请æ±åæ¥çæ°ç»)å°è¯·æ±ç»æä¼ ç»z-paging |
| | | const params: QueryParams = { |
| | | pageNum, |
| | | pageSize, |
| | | inspCode: inspSt.inspCode, |
| | | } |
| | | |
| | | getInspStRecordList(params) |
| | | .then((res: any) => { |
| | | // 请å¿å¨ç½ç»è¯·æ±åè°ä¸ç»dataListèµå¼ï¼ï¼åªéè¦è°ç¨completeå°±å¯ä»¥äº |
| | | paging.value.complete(res.rows) |
| | | }) |
| | | .catch((res) => { |
| | | // å¦æè¯·æ±å¤±è´¥åpaging.value.complete(false)ï¼ä¼èªå¨å±ç¤ºéè¯¯é¡µé¢ |
| | | // 注æï¼æ¯æ¬¡é½éè¦å¨catchä¸åè¿å¥è¯å¾éº»ç¦ï¼z-pagingæä¾äºæ¹æ¡å¯ä»¥å
¨å±ç»ä¸å¤ç |
| | | // å¨åºå±çç½ç»è¯·æ±æåºå¼å¸¸æ¶ï¼åuni.$emit('z-paging-error-emit');å³å¯ |
| | | paging.value.complete(false) |
| | | }) |
| | | } |
| | | |
| | | function inspResultClick(item: any) { |
| | | // userStore?.userInfo?.userId |
| | | } |
| | | |
| | | const goBack = () => { |
| | | uni.navigateBack() |
| | | } |
| | | function handleClickRight() { |
| | | handleConfirm() |
| | | } |
| | | |
| | | const toggleCollapse = () => { |
| | | isAllExpanded.value = !isAllExpanded.value |
| | | collapseRef.value.toggleAll(isAllExpanded.value) |
| | | } |
| | | |
| | | function handleConfirm() { |
| | | if (!dataChange.value) { |
| | | message.alert('请æä½åæäº¤!') |
| | | return false |
| | | } |
| | | message |
| | | .confirm({ |
| | | msg: 'ç¡®å®æäº¤ï¼', |
| | | title: 'æç¤º', |
| | | beforeConfirm: ({ resolve }) => { |
| | | updateData(resolve) |
| | | }, |
| | | }) |
| | | .then(() => {}) |
| | | .catch((error) => { |
| | | console.log(error) |
| | | }) |
| | | } |
| | | |
| | | function updateData(resolve: any) { |
| | | 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) => { |
| | | console.error(res) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * ç¹æ£è®°å½æ¡ç®ç¹å»äºä»¶ |
| | | * @param item |
| | | */ |
| | | function itemClick(item: any) {} |
| | | |
| | | watch( |
| | | () => [...dataList.value], // ä½¿ç¨æ©å±è¿ç®ç¬¦åå»ºæ°æ°ç»ä»¥è§¦åçå¬ |
| | | (newVal, oldVal) => { |
| | | if (oldVal.length > 0) { |
| | | dataChange.value = true |
| | | } |
| | | }, |
| | | { 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) |
| | | const checkCount = computed(() => dataList.value.filter((item) => item.status === '1').length) |
| | | const normalNum = computed(() => dataList.value.filter((item) => item.inspResult === '1').length) |
| | | const abNormalNum = computed(() => dataList.value.filter((item) => item.inspResult === '2').length) |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .menu-title-box { |
| | | height: 30rpx; |
| | | line-height: 30rpx; |
| | | } |
| | | |
| | | .slot-img { |
| | | width: 72rpx; |
| | | height: 72rpx; |
| | | margin-right: 24rpx; |
| | | } |
| | | .text-mini { |
| | | font-size: 22rpx; |
| | | } |
| | | |
| | | .menu-indicator { |
| | | width: 6rpx; |
| | | height: 22rpx; |
| | | border-radius: 10rpx; |
| | | background-color: $uni-color-primary; |
| | | } |
| | | :deep(.wd-card__footer) { |
| | | padding: 10rpx !important; |
| | | } |
| | | |
| | | .col-title-box { |
| | | } |
| | | .bg-primary { |
| | | background: $uni-color-primary; |
| | | } |
| | | :deep(.wd-navbar__text) { |
| | | font-size: 26rpx; |
| | | color: white; |
| | | } |
| | | :deep(.wd-icon-arrow-left:before), |
| | | :deep(.wd-navbar__title) { |
| | | color: white; |
| | | font-weight: 0; |
| | | font-size: 32rpx; |
| | | } |
| | | </style> |