From b2e8e233d59d107615a8336dce9da36f1f8bcde0 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期二, 03 十二月 2024 16:46:47 +0800 Subject: [PATCH] ll --- h5/pages/workOrder/edit.vue | 183 +++++++++++++++++++++++++++++++-------------- 1 files changed, 127 insertions(+), 56 deletions(-) diff --git a/h5/pages/workOrder/edit.vue b/h5/pages/workOrder/edit.vue index 2fde8da..f51e237 100644 --- a/h5/pages/workOrder/edit.vue +++ b/h5/pages/workOrder/edit.vue @@ -12,14 +12,25 @@ <view class="item"> <view class="la"><text class="red">*</text>閫夋嫨鍖哄煙</view> <view class="line sel_wrap" @click="showModal1 = true"> - <view class="left" :class="param.projectName ? '' : 'placeholder9'">{{ param.projectName ? `${param.projectName} ${param.buildingName || ''} ${param.areaType == 0 ? param.roomName || '' : param.floorName || ''}` : '璇烽�夋嫨' }}</view> + <view class="left" :class="param.projectName ? '' : 'placeholder9'"> + {{ param.projectName ? `${param.projectName} ${param.buildingName || ''} ${param.areaType == 0 ? param.roomNum || '' : param.floorName || ''}` : '璇烽�夋嫨' }} + </view> + <u-icon name="arrow-right" color="#999999" size="15"></u-icon> + </view> + </view> + <view class="item"> + <view class="la"><text class="red">*</text>宸ュ崟鍒嗙被</view> + <view class="line sel_wrap" @click="showCate1 = true"> + <view class="left" :class="param.cateName ? '' : 'placeholder9'"> + {{ param.cateName ? param.cateName : '璇烽�夋嫨' }}</view> <u-icon name="arrow-right" color="#999999" size="15"></u-icon> </view> </view> <view class="item"> <view class="la">涓婇棬鏃堕棿</view> <view class="line sel_wrap" @click="showTime = true"> - <view class="left" :class="param.getDate ? '' : 'placeholder9'">{{ param.getDate ? param.getDate : '璇烽�夋嫨' }}</view> + <view class="left" :class="param.getDate ? '' : 'placeholder9'">{{ param.getDate ? param.getDate : '璇烽�夋嫨' }} + </view> <u-icon name="arrow-right" color="#999999" size="15"></u-icon> </view> </view> @@ -63,11 +74,14 @@ :columns="buildingList"></u-picker> <u-picker :show="showModal3" keyName="name" @cancel="showModal3 = false" @confirm='confirm3' :columns="floorList"></u-picker> - <u-picker :show="showModal4" keyName="name" @cancel="showModal4 = false" @confirm='confirm4' + <u-picker :show="showModal4" keyName="roomNum" @cancel="showModal4 = false" @confirm='confirm4' :columns="roomList"></u-picker> <!-- --> - <u-datetime-picker :minDate="new Date().getTime()" :show="showTime" @confirm="confirmDate" + <u-datetime-picker :minDate="new Date().getTime()" :show="showTime" @confirm="confirmDate" @cancel="showTime = false" mode="datetime"></u-datetime-picker> + + <u-picker :show="showCate1" keyName="name" ref="uPicker" @change="changeHandler" @cancel="showCate1 = false" + @confirm='confirmCate1' :columns="cateList1"></u-picker> </view> </template> @@ -77,14 +91,18 @@ ywProjectPost, ywBuildingPost, ywFloorPost, - ywRoomPost, - ywWorkorderCreate + ywRoomPost, + ywWorkorderCreate, + getCategoryPost } from '@/api' import dayjs from 'dayjs'; export default { data() { return { - param: {}, + param: { + areaName: '瀹ゅ唴瑁呬慨', + areaType: 0 + }, showUpload: false, fileList: [], @@ -92,8 +110,10 @@ showModal1: false, showModal2: false, showModal3: false, - showModal4: false, + showModal4: false, showTime: false, + showCate1: false, + showCate2: false, areaType: [ [{ name: '瀹ゅ唴瑁呬慨', @@ -105,6 +125,8 @@ } ] ], + cateList1: [], + cateList2: [], projectList: [], buildingList: [], floorList: [], @@ -113,29 +135,59 @@ }, onLoad() { this.getProject() + this.getCate() }, - methods: { - onSubmit() { - const { param, fileList } = this - ywWorkorderCreate({ - ...param, - // roomId: '', - fileList - }).then(res => { - this.showToast('鎻愪氦鎴愬姛') - uni.redirectTo({ - url: '/pages/workOrder/list' - }) - }) + methods: { + onSubmit() { + const { + param, + fileList + } = this + ywWorkorderCreate({ + ...param, + // roomId: '', + fileList + }).then(res => { + this.showToast('鎻愪氦鎴愬姛') + uni.redirectTo({ + url: '/pages/workOrder/list' + }) + }) }, - confirm0(e) { + changeHandler(e) { + const { + columnIndex, + value, + values, // values涓哄綋鍓嶅彉鍖栧垪鐨勬暟缁勫唴瀹� + index, + // 寰俊灏忕▼搴忔棤娉曞皢picker瀹炰緥浼犲嚭鏉ワ紝鍙兘閫氳繃ref鎿嶄綔 + picker = this.$refs.uPicker + } = e + // 褰撶涓�鍒楀�煎彂鐢熷彉鍖栨椂锛屽彉鍖栫浜屽垪(鍚庝竴鍒�)瀵瑰簲鐨勯�夐」 + console.log(index); + console.log(index); + if (columnIndex === 0) { + // picker涓洪�夋嫨鍣╰his瀹炰緥锛屽彉鍖栫浜屽垪瀵瑰簲鐨勯�夐」 + picker.setColumnValues(1, this.cateList1[0][index].childCategoryList) + } + }, + confirmCate1(e) { + console.log(e.value[1]); + if(e.value.length == 2){ + this.$set(this.param, 'cateId', e.value[1].id) + this.$set(this.param, 'cateName', e.value[1].name) + this.showCate1 = false + } + + }, + confirm0(e) { const item = e.value[0] this.$set(this.param, 'areaType', item.id) this.$set(this.param, 'areaName', item.name) - this.showModal0 = false - this.param = { - areaType: item.id, - areaName: item.name, + this.showModal0 = false + this.param = { + areaType: item.id, + areaName: item.name, } }, confirm1(e) { @@ -151,29 +203,47 @@ this.showModal2 = false this.$set(this.param, 'buildingName', item.name) this.$set(this.param, 'buildingId', item.id) - if (this.areaType == 0) { - this.getRoom(item.id) + if (this.param.areaType == 0) { + this.getRoom(item.id) this.showModal4 = true } else { - this.getFloor(item.id) + this.getFloor(item.id) this.showModal3 = true } - }, - confirm3(e) { - const item = e.value[0] - this.showModal3 = false - this.$set(this.param, 'floorName', item.name) - this.$set(this.param, 'floorId', item.id) - }, - confirm4(e) { - const item = e.value[0] - this.showModal4 = false - this.$set(this.param, 'roomName', item.name) - this.$set(this.param, 'roomId', item.id) - }, - confirmDate(e) { - this.$set(this.param, 'getDate', dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')); - this.showTime = false + }, + confirm3(e) { + const item = e.value[0] + this.showModal3 = false + this.$set(this.param, 'floorName', item.name) + this.$set(this.param, 'floorId', item.id) + }, + confirm4(e) { + const item = e.value[0] + this.showModal4 = false + this.$set(this.param, 'roomNum', item.roomNum) + this.$set(this.param, 'roomId', item.id) + }, + confirmDate(e) { + this.$set(this.param, 'getDate', dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')); + this.showTime = false + }, + getCate() { + getCategoryPost({ + capacity: 9999, + page: 1, + model: { + type: 3 + } + }).then(res => { + + let temp = res.data.records || [] + if (temp && temp.length > 0) { + this.cateList1 = [temp, temp[0].childCategoryList || []] + } else { + this.cateList1 = [temp, []] + } + console.log(this.cateList1); + }) }, getProject() { ywProjectPost().then(res => { @@ -389,16 +459,17 @@ font-weight: 500; font-size: 32rpx; color: #FFFFFF; - } - .sel_upload_wrap { - width: 100%; - border-top: 1px solid #666666; - box-shadow: 0 1 1 #333333; - - .btn { - height: 90rpx; - line-height: 90rpx; - text-align: center; - } + } + + .sel_upload_wrap { + width: 100%; + border-top: 1px solid #666666; + box-shadow: 0 1 1 #333333; + + .btn { + height: 90rpx; + line-height: 90rpx; + text-align: center; + } } </style> \ No newline at end of file -- Gitblit v1.9.3