From bab490d2da009c1a23b352b3b964e0c2dd06a0b3 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期四, 12 六月 2025 17:32:42 +0800 Subject: [PATCH] 移动端功能优化 --- eims-ui-mobile/src/pages/repair/res-detail.vue | 153 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 140 insertions(+), 13 deletions(-) diff --git a/eims-ui-mobile/src/pages/repair/res-detail.vue b/eims-ui-mobile/src/pages/repair/res-detail.vue index 77b739b..ddd618f 100644 --- a/eims-ui-mobile/src/pages/repair/res-detail.vue +++ b/eims-ui-mobile/src/pages/repair/res-detail.vue @@ -30,7 +30,15 @@ <wd-cell title="鏁呴殰绫诲瀷" title-width="200rpx" is-link> <text>{{ reqType?.dictLabel }}</text> </wd-cell> - <wd-cell title="鎶ヤ慨鎻忚堪" :label="repairRes?.reqDesc" is-link /> + + <wd-textarea + label="鎶ヤ慨鎻忚堪" + label-width="200rpx" + type="textarea" + v-model="repairRes.reqDesc" + auto-height + readonly + /> </wd-cell-group> <wd-cell-group @@ -64,6 +72,11 @@ </wd-cell-group> <wd-cell-group custom-class="mt-2" title="缁翠慨淇℃伅" use-slot border> + <wd-cell title="鏁呴殰绫诲埆" title-width="200rpx" prop="faultType"> + <wd-radio-group v-model="repairRes.faultType" inline shape="dot"> > + <wd-radio v-for="item in faultList" :value="item.dictValue">{{item.dictLabel}}</wd-radio> + </wd-radio-group> + </wd-cell> <wd-textarea label="鍘熷洜鍒嗘瀽" label-width="200rpx" @@ -112,28 +125,90 @@ clearable /> </wd-cell-group> + <wd-cell-group custom-class="mt-2" title="澶囦欢淇℃伅" use-slot border> + <!-- 澶囦欢淇℃伅褰曞叆鍖哄煙 --> + <view v-if="repairRes.spareParts && repairRes.spareParts.length > 0" class="mt-2"> + <view + v-for="(part, partIndex) in repairRes.spareParts" + :key="partIndex" + class="flex justify-between mt-1" + > + <wd-input + v-model="part.name" + label="鍚嶇О锛�" + label-width="100rpx" + placeholder="澶囦欢鍚嶇О" + + + /> + <wd-input + v-model="part.quantity" + label="鏁伴噺锛�" + label-width="100rpx" + placeholder="鏁伴噺" type="number" :maxlength="5" /> + </view> + </view> + <!-- 缁翠慨璇存槑鍖哄煙 --> + <view class="mt-2 flex justify-end"> + <wd-button type="success" style="margin: 20px" @click.stop="addSparePart()"> + 娣诲姞澶囦欢 + </wd-button> + </view> <view class="h-[2px] w-full bg-base"></view> + </wd-cell-group> </wd-form> +<!-- <wd-button style="margin: 20px" block @click="handleClickRight">鎻愪氦</wd-button>--> + <view class="h-[20px] w-full bg-base"></view> </view> + + <!-- 澶囦欢閫夋嫨寮瑰嚭灞� --> + <wd-popup v-model="showSparePopup" position="bottom" height="33.33vh"> + <view class="flex justify-between p-2 bg-white"> + <wd-button type="text" @click="closeSparePopup">鍙栨秷</wd-button> + <wd-button type="text" @click="addOtherSparePart">鍏朵粬</wd-button> + + </view> + <wd-input + v-model="searchKeyword" + placeholder="璇疯緭鍏ュ浠跺悕绉版垨鍨嬪彿" + clearable + @input="filterSpareParts" + /> + <view class="p-2"> + <view + v-for="(part, index) in sparePartsList" + :key="index" + class="flex justify-between items-center p-2 border-b" + @click="selectFilteredSparePart(part)" + > + <text>{{ part.name }} ({{ part.code }})</text> + <text>鍓╀綑: {{ part.actualStock }}</text> + </view> + </view> + </wd-popup> </template> <script setup lang="ts"> import { getRepairRes, updateRepairRes } from '@/service/repair' import { RepairResVO } from '@/service/repair.d' -import { reactive, onMounted, ref } from 'vue' import { FormRules } from 'wot-design-uni/components/wd-form/types' import { useToast, useMessage } from 'wot-design-uni' -import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils' -import { DICT_REPAIR_REQ_TYPE, getDictInfo } from '@/service/dict' +import { isEquAdmin, isLeader, isLineOrRepair, isRepair } from "@/utils/RoleUtils"; +import { DICT_REPAIR_FAULT_TYPE, DICT_REPAIR_REQ_TYPE, getDictInfo } from "@/service/dict"; import { formatDate } from '@/utils/DateUtils' const toast = useToast() const message = useMessage() - +const showSparePopup = ref(false) +import { getSpareList } from '@/service/spare' +import { ref } from "vue"; const fileList = ref<[]>() - +const selectedPartIndex = ref(-1) +const sparePartsList = ref([]) +const searchKeyword = ref('') // 鎶ヤ慨鍗曠被鍨� const reqTypeList = ref<any>([]) - +// 鏁呴殰绫诲埆 +const faultList = ref<any>([]) const repairRes = reactive<RepairResVO>({ id: '', resCode: '', @@ -158,6 +233,59 @@ ], } +function filterSpareParts() { + if (!searchKeyword.value) { + loadSpareParts() + } else { + loadSpareParts(searchKeyword.value) + } +} +// 澶囦欢閫夋嫨鐩稿叧閫昏緫 +function addSparePart() { + // if (!item.spareParts) { + // item.spareParts = [] + // } + repairRes.spareParts.value = [] + + selectSparePart() +} + +function selectSparePart(item: any) { + showSparePopup.value = true + + loadSpareParts() +} + +function loadSpareParts(value?: string) { + getSpareList({ name: value, pageNum: 1, pageSize: 10 }).then((res: any) => { + sparePartsList.value = res.rows + + }) +} + +function selectFilteredSparePart(part: any) { + repairRes.spareParts.value.push({ + id: part.id, + name: part.name, + quantity: '', + }) + closeSparePopup() +} +function addOtherSparePart() { + repairRes.spareParts.value.push({ + id: '', + name: '', + quantity: '', + }) + closeSparePopup(); +} + +function closeSparePopup() { + showSparePopup.value = false + selectedPartIndex.value = -1 + searchKeyword.value = '' +} + function handleFileChange({ fileList }) {} function initRepairRes(id: any) { @@ -172,6 +300,8 @@ initRepairRes(options.id) const reqList = await getDictInfo(DICT_REPAIR_REQ_TYPE) reqTypeList.value = reqList + const fList = await getDictInfo(DICT_REPAIR_FAULT_TYPE) + faultList.value = fList } function hanldeUpdateRepairRes(data: any, resolve: any) { @@ -180,6 +310,7 @@ resolve(true) toastSucces() uni.$emit('res-list-refresh') + uni.navigateBack() }) .catch((res) => { console.error(res) @@ -207,9 +338,7 @@ onNavigationBarButtonTap((e) => { if (e.index === 0) { // 绠$悊鍛樿鑹� - if (isLeader()) { - toast.warning('褰撳墠鐧诲綍瑙掕壊涓嶅彲鎿嶄綔') - } else if (isOperatorOrRepair()) { + if (isRepair() || isEquAdmin()) { switch (repairRes.status) { // 宸叉帴鍗� case '1': @@ -232,9 +361,7 @@ } } } else if (e.index === 1) { - if (isLeader()) { - toast.warning('褰撳墠鐧诲綍瑙掕壊涓嶅彲鎿嶄綔') - } else if (isOperatorOrRepair()) { + if (isRepair() || isEquAdmin()) { switch (repairRes.status) { // 宸叉帴鍗� case '1': -- Gitblit v1.9.3