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/repair-add.vue | 133 +++++++++++++++++++++++++++++-------------- 1 files changed, 89 insertions(+), 44 deletions(-) diff --git a/eims-ui-mobile/src/pages/repair/repair-add.vue b/eims-ui-mobile/src/pages/repair/repair-add.vue index 12a7620..1a05452 100644 --- a/eims-ui-mobile/src/pages/repair/repair-add.vue +++ b/eims-ui-mobile/src/pages/repair/repair-add.vue @@ -1,30 +1,22 @@ <route lang="json5" type="page"> { layout: 'default', - style: { - navigationBarTitleText: '娣诲姞鎶ヤ慨', - 'app-plus': { - titleNView: { - buttons: [ - { - text: '鎻愪氦', - fontSize: '14px', - color: '#FFFFFF', - }, - { - text: '', - fontSize: '24px', - color: '#FFFFFF', - }, - ], - }, - }, - }, + needLogin: true, + style: { navigationBarTitleText: '娣诲姞鎶ヤ慨', navigationStyle: 'custom' }, } </route> <template> <view class="bg-base"> + <wd-navbar + title="娣诲姞鎶ヤ慨" + left-arrow + @click-left="goBack" + right-text="鎻愪氦" + @click-right="handleSubmit" + custom-style="background: #4D80F0;" + safeAreaInsetTop + ></wd-navbar> <wd-form ref="form" :model="model"> <wd-cell-group custom-class="group" title="绫诲瀷淇℃伅" border> <wd-picker @@ -35,6 +27,7 @@ label="鏁呴殰绫诲瀷" v-model="model.reqType" @confirm="handleConfirmReqType" + :disabled="reqTypeDis" /> </wd-cell-group> @@ -122,10 +115,9 @@ /> <wd-cell title="鎶ヤ慨鍥剧墖" title-width="200rpx" prop="fileList"> <wd-upload - :auto-upload="false" - :file-list="model.fileList" + v-model:file-list="model.fileList" :action="VITE_UPLOAD_BASEURL" - @change="handleFileChange" + @success="handleUploadSuccess" ></wd-upload> </wd-cell> @@ -138,9 +130,26 @@ @open="openOccTime" @confirm="handleOccTimeConfirm" /> + <!-- <wd-picker + :columns="urgencyList" + label-key="dictLabel" + value-key="dictValue" + label="绱ф�ョ▼搴�" + v-model="model.urgencyLevel" + @confirm="handleConfirmUrgencyLevel" + /> --> + <wd-cell title="绱ф�ョ▼搴�" title-width="200rpx" prop="urgencyLevel"> + <wd-radio-group v-model="model.urgencyLevel" inline shape="dot"> @change="handleConfirmUrgencyLevel"> + <wd-radio v-for="item in urgencyList" :value="item.dictValue">{{item.dictLabel}}</wd-radio> + </wd-radio-group> + </wd-cell> + </wd-cell-group> - <wd-cell-group custom-class="mt-2" title="鍏朵粬淇℃伅" border> + + <wd-button style="margin: 20px" block @click="handleSubmit">鎻愪氦</wd-button> + + <!-- <wd-cell-group custom-class="mt-2" title="鍏朵粬淇℃伅" border> <wd-picker :columns="faultList" label-key="dictLabel" @@ -157,7 +166,7 @@ v-model="model.urgencyLevel" @confirm="handleConfirmUrgencyLevel" /> - </wd-cell-group> + </wd-cell-group> --> </wd-form> </view> </template> @@ -181,6 +190,25 @@ const toast = useToast() const userStore = useUserStore() +/** + * 鍏朵粬椤甸潰浼犺繃鏉ョ殑鏁版嵁 + * assetNo: 璧勪骇缂栧彿 + * from: 鏄惁鏄壂鐮佽繘鏉ョ殑锛屽鏋滄槸鎵爜杩涙潵锛屽彧鑳芥煡璇㈠浐瀹氳澶囩殑鏁版嵁 + */ +interface PageParams { + equId?: string + equName?: string + from?: string +} + +// 椤甸潰鍙傛暟锛屼笂涓〉闈紶閫掕繃鏉ョ殑鍙傛暟 +const option = reactive<PageParams>({ + equId: '', + equName: '', + from: '', +}) + +const reqTypeDis = ref(false) // 鎶ヤ慨绫诲瀷 const reqList = ref<any>([]) // 鏁呴殰绫诲埆 @@ -223,11 +251,16 @@ fixtureName: '', fileList: [], }) - +const goBack = () => { + uni.navigateBack() +} /** * 閫夋嫨璁惧 */ function handleSelectEqu() { + if (reqTypeDis.value) { + return false + } uni.navigateTo({ url: '/pages/equ/equ-list', events: { @@ -294,10 +327,14 @@ function handleAddRepairReq() { // 琛ュ厖蹇呰瀛楁 - model.status = '0' + model.status = '0' // 鎶ヤ慨鍚庨粯璁ょ姸鎬佷负寰呮帴鍗� model.reqTime = formatDate(new Date()) model.reqDept = userStore?.userInfo?.deptId model.reqUser = userStore?.userInfo?.userId + console.log('model', model) + const map = model.fileList?.map((file) => file.url) + console.log('map', map) + model.faultPicture = map.join(',') addRepairReq(model) .then((res: any) => { if (res?.code === 200) { @@ -309,16 +346,21 @@ } }) .catch((res) => { + console.error('娣诲姞鎶ヤ慨澶辫触:', res) toast.error(res?.data?.msg || '璇锋眰澶辫触') }) } -/** - * 涓婁紶鐐规鍥剧墖 - * @param fileList - */ -function handleFileChange({ fileList }) { - model.fileList = fileList + +function handleUploadSuccess({ file, fileList }) { + console.log('handleUploadSuccess', file) + // 鍒ゆ柇 file.response鏄笉鏄� 瀵硅薄锛屼笉鏄璞″皢json瀛楃涓茶浆鎹负瀵硅薄 + if (typeof file.response === 'string') { + file.response = JSON.parse(file.response) + console.log('file.response', file.response) + file.ossId = file.response.data.ossId + file.url = file.response.data.url + } } function checkData() { @@ -353,31 +395,31 @@ */ function openOccTime() { occTime.value = Date.now() + console.log('openOccTime', occTime) + model.occTime = formatDate(new Date(occTime.value)) } /** * 纭閫夋嫨鍙戠敓鏃堕棿 */ function handleOccTimeConfirm({ value }) { + console.log('handleOccTimeConfirm', value) model.occTime = formatDate(new Date(value)) } /** * 閫夋嫨鎶ヤ慨绫诲瀷 */ -function handleConfirmReqType({ value }) { -} +function handleConfirmReqType({ value }) {} /** * 閫夋嫨鏁呴殰绫诲埆 */ -function handleConfirmFaultType({ value }) { -} +function handleConfirmFaultType({ value }) {} /** * 閫夋嫨绱ф�ョ▼搴� */ -function handleConfirmUrgencyLevel({ value }) { -} +function handleConfirmUrgencyLevel({ value }) {} async function initData() { const reqTypeList = await getDictInfo(DICT_REPAIR_REQ_TYPE) @@ -390,13 +432,16 @@ urgencyList.value = uList } -onNavigationBarButtonTap((e) => { - if (e.index === 0) { - handleSubmit() - } -}) - onLoad((options) => { + Object.assign(option, options) + // 鎵爜椤甸潰杩涘叆鐨勪竴浜涘垵濮嬪寲 + if (option.from === 'scan') { + model.equId = option?.equId + model.equName = option?.equName + // 璁剧疆绫诲瀷涓鸿澶囩被鍨� + model.reqType = '1' + reqTypeDis.value = true + } initData() }) </script> -- Gitblit v1.9.3