From a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 06 六月 2025 19:19:34 +0800
Subject: [PATCH] 开发更新
---
h5/pages/workOrder/edit.vue | 493 ++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 361 insertions(+), 132 deletions(-)
diff --git a/h5/pages/workOrder/edit.vue b/h5/pages/workOrder/edit.vue
index 2116212..653c56c 100644
--- a/h5/pages/workOrder/edit.vue
+++ b/h5/pages/workOrder/edit.vue
@@ -3,29 +3,42 @@
<view class="list">
<view class="item">
<view class="la"><text class="red">*</text>浣嶇疆绫诲瀷</view>
- <view class="line sel_wrap">
- <view class="left" :class="param.name ? '' : 'placeholder9'">{{ param.name ? param.name : '璇烽�夋嫨' }}</view>
+ <view class="line sel_wrap" @click="showModal0 = true">
+ <view class="left" :class="param.areaName ? '' : 'placeholder9'">{{ param.areaName ? param.areaName : '璇烽�夋嫨' }}
+ </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">
- <view class="left" :class="param.name ? '' : 'placeholder9'">{{ param.name ? param.name : '璇烽�夋嫨' }}</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.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" v-if="param.areaType == 0">
<view class="la">涓婇棬鏃堕棿</view>
- <view class="line sel_wrap">
- <view class="left" :class="param.name ? '' : 'placeholder9'">{{ param.name ? param.name : '璇烽�夋嫨' }}</view>
+ <view class="line sel_wrap" @click="showTime = true">
+ <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>
<view class="item">
<view class="la">鎻忚堪</view>
<view class="line">
- <textarea v-model="param.checkInfo" placeholder="璇疯緭鍏�" placeholder-class="placeholder9" />
+ <textarea v-model="param.content" placeholder="璇疯緭鍏�" placeholder-class="placeholder9" />
</view>
</view>
<view class="item">
@@ -35,16 +48,17 @@
<u-icon name="plus" color="rgb(153, 153, 153)" size="28"></u-icon>
<view class="mt6">鍥剧墖/瑙嗛</view>
</view>
- <view class="upload_file" v-for="(item, i) in dealFileList" :key="i">
+ <view class="upload_file" v-for="(item, i) in fileList" :key="i">
<u-icon class="close" size="20" name="close-circle-fill" color="red"
- @click="fileDel('dealBeforeFileList', i)"></u-icon>
+ @click="fileDel('fileList', i)"></u-icon>
<image v-if="item.type == 0" :src="item.fileurlFull" mode="widthFix"></image>
- <video v-if="item.type == 1" :src="item.fileurlFull" :controls="false"></video>
+ <video v-if="item.type == 1" :show-center-play-btn="false" :src="item.fileurlFull"
+ :controls="false"></video>
</view>
</view>
- </view>
- </view>
- <view class="sub_btn">鎻愪氦</view>
+ </view>
+ </view>
+ <view class="sub_btn" @click="onSubmit">鎻愪氦</view>
<!-- -->
<u-popup :show="showUpload" @close="showUpload = false" closeOnClickOverlay>
<view class="sel_upload_wrap">
@@ -52,121 +66,317 @@
<view class="btn" @click="uploadVideo">閫夋嫨瑙嗛</view>
</view>
</u-popup>
+ <!-- -->
+ <u-picker :show="showModal0" keyName="name" @cancel="showModal0 = false" @confirm='confirm0'
+ :columns="areaType"></u-picker>
+ <!-- -->
+ <u-picker :show="showModal1" keyName="name" @cancel="showModal1 = false" @confirm='confirm1'
+ :columns="projectList"></u-picker>
+ <u-picker :show="showModal2" keyName="name" @cancel="showModal2 = false" @confirm='confirm2'
+ :columns="buildingList"></u-picker>
+ <u-picker :show="showModal3" keyName="name" @cancel="showModal3 = false" @confirm='confirm3'
+ :columns="floorList"></u-picker>
+ <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"
+ @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>
-<script>
- import {
- uploadUrl
- } from '@/api'
+<script>
+ import {
+ uploadUrl,
+ ywProjectPost,
+ ywBuildingPost,
+ ywFloorPost,
+ ywRoomPost,
+ ywWorkorderCreate,
+ getCategoryPost
+ } from '@/api'
import dayjs from 'dayjs';
export default {
data() {
return {
- param: {},
+ param: {
+ areaName: '瀹ゅ唴瑁呬慨',
+ areaType: 0
+ },
showUpload: false,
- dealFileList: [],
+ fileList: [],
+
+ showModal0: false,
+ showModal1: false,
+ showModal2: false,
+ showModal3: false,
+ showModal4: false,
+ showTime: false,
+ showCate1: false,
+ showCate2: false,
+ areaType: [
+ [{
+ name: '瀹ゅ唴缁翠慨',
+ id: 0
+ },
+ {
+ name: '鍏叡缁翠慨',
+ id: 1
+ }
+ ]
+ ],
+ cateList1: [],
+ cateList2: [],
+ projectList: [],
+ buildingList: [],
+ floorList: [],
+ roomList: [],
};
- },
- methods: {
- fileDel(str, i) {
- this[str].splice(i, 1);
- },
- uploadImage() {
- this.showUpload = false;
- let token = uni.getStorageSync('token') || '';
- uni.chooseImage({
- count: 4,
- success: chooseImageRes => {
- uni.showLoading({
- title: '涓婁紶涓�',
- mask: true
- });
- const tempFilePaths = chooseImageRes.tempFilePaths;
- let imgs = tempFilePaths.map((value, index) => {
- return {
- name: 'file',
- uri: value
- };
- });
- uni.uploadFile({
- url: `${uploadUrl}`,
- files: imgs,
- name: 'file',
- formData: {
- folder: 'HIDDEN_DANGER_FILE'
- },
- header: {
- Dm_user_token: token
- },
- success: uploadFileRes => {
- let res = JSON.parse(uploadFileRes.data);
- if (res.data && res.data.length > 0) {
- res.data.forEach(i => {
- i.type = 0;
- i.fileurl = i.imgaddr;
- i.fileurlFull = i.url;
- this.submitFileList.push(i);
- });
- }
- },
- fail(err) {
- console.log('err', err);
- },
- complete() {
- uni.hideLoading();
- // if (i === chooseImageRes.tempFilePaths.length - 1) {
- // uni.hideLoading()
- // }
- }
- });
- }
- });
- },
- uploadVideo() {
- this.showUpload = false;
- let token = uni.getStorageSync('token') || '';
- uni.chooseVideo({
- success: chooseImageRes => {
- uni.showLoading({
- title: '涓婁紶涓�',
- mask: true
- });
- uni.uploadFile({
- url: `${uploadUrl}`,
- filePath: chooseImageRes.tempFilePath,
- header: {
- Dm_user_token: token
- },
- name: 'file',
- formData: {
- folder: 'HIDDEN_DANGER_FILE'
- },
- success: uploadFileRes => {
- let res = JSON.parse(uploadFileRes.data);
- if (res.data && res.data.length > 0) {
- res.data.forEach(i => {
- i.type = 1;
- i.fileurl = i.imgaddr;
- i.fileurlFull = i.url;
- this.submitFileList.push(i);
- });
- }
- },
- complete() {
- uni.hideLoading();
- }
- });
- }
- });
- }
+ },
+ onLoad() {
+ this.getProject()
+ this.getCate()
+ },
+ methods: {
+ onSubmit() {
+ const {
+ param,
+ fileList
+ } = this
+ if (!param.projectId) return this.showToast('璇烽�夋嫨瀹屾暣鐨勫尯鍩�')
+ if (!param.buildingId) return this.showToast('璇烽�夋嫨瀹屾暣鐨勫尯鍩�')
+ if (!param.floorName && !param.roomNum) return this.showToast('璇烽�夋嫨瀹屾暣鐨勫尯鍩�')
+ if (!param.cateName) return this.showToast('璇烽�夋嫨宸ュ崟鍒嗙被')
+ ywWorkorderCreate({
+ ...param,
+ // roomId: '',
+ fileList
+ }).then(res => {
+ if (res && res.code == 200) {
+ this.showToast('鎻愪氦鎴愬姛')
+ uni.redirectTo({
+ url: '/pages/workOrder/list'
+ })
+ }
+ })
+ },
+ 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,
+ }
+ },
+ confirm1(e) {
+ const item = e.value[0]
+ this.showModal1 = false
+ this.$set(this.param, 'projectName', item.name)
+ this.$set(this.param, 'projectId', item.id)
+ this.getBuilding(item.id)
+ this.showModal2 = true
+ },
+ confirm2(e) {
+ const item = e.value[0]
+ this.showModal2 = false
+ this.$set(this.param, 'buildingName', item.name)
+ this.$set(this.param, 'buildingId', item.id)
+ if (this.param.areaType == 0) {
+ this.getRoom(item.id)
+ this.showModal4 = true
+ } else {
+ 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, '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 => {
+ this.projectList = [res.data || []]
+ })
+ },
+ getBuilding(projectId) {
+ ywBuildingPost({
+ projectId
+ }).then(res => {
+ this.buildingList = [res.data || []]
+ })
+ },
+ getFloor(buildingId) {
+ ywFloorPost({
+ buildingId
+ }).then(res => {
+ this.floorList = [res.data || []]
+ })
+ },
+ getRoom(buildingId) {
+ ywRoomPost({
+ buildingId
+ }).then(res => {
+ this.roomList = [res.data || []]
+ })
+ },
+ fileDel(str, i) {
+ this[str].splice(i, 1);
+ },
+ uploadImage() {
+ this.showUpload = false;
+ let token = uni.getStorageSync('token') || '';
+ uni.chooseImage({
+ count: 6,
+ success: chooseImageRes => {
+ uni.showLoading({
+ title: '涓婁紶涓�',
+ mask: true
+ });
+ const tempFilePaths = chooseImageRes.tempFilePaths;
+ let imgs = tempFilePaths.map((value, index) => {
+ return {
+ name: 'file',
+ uri: value
+ };
+ });
+ uni.uploadFile({
+ url: `${uploadUrl}`,
+ files: imgs,
+ name: 'file',
+ formData: {
+ folder: 'YW_WORKORDER_FILE'
+ },
+ header: {
+ Dm_user_token: token
+ },
+ success: uploadFileRes => {
+ let res = JSON.parse(uploadFileRes.data);
+ if (res.data && res.data.length > 0) {
+ res.data.forEach(i => {
+ i.type = 0;
+ i.fileurl = i.imgaddr;
+ i.fileurlFull = i.url;
+ this.fileList.push(i);
+ });
+ }
+ },
+ fail(err) {
+ console.log('err', err);
+ },
+ complete() {
+ uni.hideLoading();
+ // if (i === chooseImageRes.tempFilePaths.length - 1) {
+ // uni.hideLoading()
+ // }
+ }
+ });
+ }
+ });
+ },
+ uploadVideo() {
+ this.showUpload = false;
+ let token = uni.getStorageSync('token') || '';
+ uni.chooseVideo({
+ success: chooseImageRes => {
+ uni.showLoading({
+ title: '涓婁紶涓�',
+ mask: true
+ });
+ uni.uploadFile({
+ url: `${uploadUrl}`,
+ filePath: chooseImageRes.tempFilePath,
+ header: {
+ Dm_user_token: token
+ },
+ name: 'file',
+ formData: {
+ folder: 'YW_WORKORDER_FILE'
+ },
+ success: uploadFileRes => {
+ let res = JSON.parse(uploadFileRes.data);
+ if (res.data && res.data.length > 0) {
+ res.data.forEach(i => {
+ i.type = 1;
+ i.fileurl = i.imgaddr;
+ i.fileurlFull = i.url;
+ this.fileList.push(i);
+ });
+ }
+ },
+ complete() {
+ uni.hideLoading();
+ }
+ });
+ }
+ });
+ }
}
}
</script>
<style lang="scss" scoped>
- .list {
-
+ .list {
+
.item {
.la {
margin-top: 30rpx;
@@ -216,14 +426,19 @@
align-items: center;
justify-content: center;
position: relative;
- &:nth-of-type(4n){
- margin-right: 0;
+
+ &:nth-of-type(4n) {
+ margin-right: 0;
}
+
.close {
position: absolute;
right: -20rpx;
top: -20rpx;
z-index: 9999;
+ background-color: #fff;
+ border-radius: 50%;
+ overflow: hidden;
}
image {
@@ -238,21 +453,35 @@
}
}
- }
- .sub_btn{
- position: fixed;
- bottom: 68rpx;
- left: 40rpx;
- width: 670rpx;
- height: 88rpx;
- background: $primaryColor;
- box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0,104,255,0.3);
- border-radius: 44rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-weight: 500;
- font-size: 32rpx;
- color: #FFFFFF;
+ }
+
+ .sub_btn {
+ // position: fixed;
+ // bottom: 68rpx;
+ // left: 40rpx;
+ width: 670rpx;
+ height: 88rpx;
+ margin-top: 80rpx;
+ background: $primaryColor;
+ box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 104, 255, 0.3);
+ border-radius: 44rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ 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;
+ }
}
</style>
\ No newline at end of file
--
Gitblit v1.9.3