From 89a5fedfe041ebacb2d81ecae1023b206cd3f353 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期四, 24 四月 2025 09:10:37 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/main' --- eims-ui-mobile/src/pages/inspect/insp-record.vue | 336 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 336 insertions(+), 0 deletions(-) diff --git a/eims-ui-mobile/src/pages/inspect/insp-record.vue b/eims-ui-mobile/src/pages/inspect/insp-record.vue new file mode 100644 index 0000000..620f323 --- /dev/null +++ b/eims-ui-mobile/src/pages/inspect/insp-record.vue @@ -0,0 +1,336 @@ +<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">姝e父: {{ 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">姝e父</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) => { + // 杩欓噷鐨刾ageNo鍜宲ageSize浼氳嚜鍔ㄨ绠楀ソ锛岀洿鎺ヤ紶缁欐湇鍔″櫒鍗冲彲 + // 杩欓噷鐨勮姹傚彧鏄紨绀猴紝璇锋浛鎹㈡垚鑷繁鐨勯」鐩殑缃戠粶璇锋眰锛屽苟鍦ㄧ綉缁滆姹傚洖璋冧腑閫氳繃paging.value.complete(璇锋眰鍥炴潵鐨勬暟缁�)灏嗚姹傜粨鏋滀紶缁檢-paging + const params: QueryParams = { + pageNum, + pageSize, + inspCode: inspSt.inspCode, + } + + getInspStRecordList(params) + .then((res: any) => { + // 璇峰嬁鍦ㄧ綉缁滆姹傚洖璋冧腑缁檇ataList璧嬪�硷紒锛佸彧闇�瑕佽皟鐢╟omplete灏卞彲浠ヤ簡 + paging.value.complete(res.rows) + }) + .catch((res) => { + // 濡傛灉璇锋眰澶辫触鍐檖aging.value.complete(false)锛屼細鑷姩灞曠ず閿欒椤甸潰 + // 娉ㄦ剰锛屾瘡娆¢兘闇�瑕佸湪catch涓啓杩欏彞璇濆緢楹荤儲锛寊-paging鎻愪緵浜嗘柟妗堝彲浠ュ叏灞�缁熶竴澶勭悊 + // 鍦ㄥ簳灞傜殑缃戠粶璇锋眰鎶涘嚭寮傚父鏃讹紝鍐檜ni.$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> -- Gitblit v1.9.3