From f956955c38a67f968977b7d784ff016ab5b17223 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期六, 30 十一月 2024 16:12:26 +0800
Subject: [PATCH] ll
---
h5/pages/operation/device.vue | 74 +++++++++++++++++++++++++++----------
1 files changed, 54 insertions(+), 20 deletions(-)
diff --git a/h5/pages/operation/device.vue b/h5/pages/operation/device.vue
index 125001a..02c6b7d 100644
--- a/h5/pages/operation/device.vue
+++ b/h5/pages/operation/device.vue
@@ -5,7 +5,7 @@
<view class="la"><text class="red">*</text>閫夋嫨璁惧</view>
<view class="line">
<view class="sel_wrap" @click="showModal = true">
- <view class="left" :class="param.name ? '' : 'placeholder9'">{{ param.name ? param.name : '璇烽�夋嫨璁惧' }}</view>
+ <view class="left" :class="param.deviceName ? '' : 'placeholder9'">{{ param.deviceName ? param.deviceName : '璇烽�夋嫨璁惧' }}</view>
<u-icon name="arrow-right" color="#999999" size="17"></u-icon>
</view>
<image class="icon" src="@/static/side/scan.png" mode=""></image>
@@ -28,9 +28,9 @@
<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>
</view>
@@ -39,13 +39,11 @@
<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>
- <view class="sub_btn">
- 鎻愪氦
- </view>
+ <view class="sub_btn" @click="onSubmit">鎻愪氦</view>
<!-- -->
<u-popup :show="showUpload" @close="showUpload = false" closeOnClickOverlay>
<view class="sel_upload_wrap">
@@ -62,14 +60,12 @@
<input v-model="searchValue" @confirm="getDevice()" type="text" placeholder="鎼滅储璁惧鍚嶇О/缂栧彿" placeholder-class="placeholder9" />
</view>
<view class="modal_list">
- <view class="item">
- <view class="name">璁惧name</view>
- <image src="@/static/radioed.png" mode=""></image>
+ <view class="item" v-for="item,i in deviceList" @click="deviceClick(item)">
+ <view class="name">{{ item.name }}</view>
+ <image v-if="activeDevice.id == item.id" src="@/static/radioed.png" mode=""></image>
</view>
</view>
- <view class="sub_btn">
- 纭畾閫夋嫨
- </view>
+ <view class="sub_btn" @click="handleDevice">纭畾閫夋嫨</view>
</view>
</u-popup>
</view>
@@ -77,7 +73,9 @@
<script>
import {
- uploadUrl
+ uploadUrl,
+ ywDevicePost,
+ ywDeviceCreate
} from '@/api'
import dayjs from 'dayjs';
export default {
@@ -86,16 +84,52 @@
param: {status: 0},
showUpload: false,
showModal: false,
- dealFileList: [],
+ fileList: [],
searchValue: '',
deviceList: [],
activeDevice: {}
};
},
+ onLoad() {
+ this.getDevice()
+ },
methods: {
- getDevice(){
+ onSubmit() {
+ const { param, fileList } = this
+ if(!param.deviceId) return this.showToast('璇峰厛閫夋嫨瑕佺淮鎶ょ殑璁惧')
+ ywDeviceCreate({
+ ...param,
+ userId: uni.getStorageSync('userInfo').id,
+ dealDate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
+ multifileList: fileList
+ }).then(res => {
+ this.showToast('鎻愪氦鎴愬姛')
+ // uni.navigateBack()
+ })
+ },
+ getDevice(){
+ ywDevicePost({
+ capacity: 9999,
+ page: 1,
+ model: {
+ name: this.searchValue
+ }
+ }).then(res => {
+ this.deviceList = res.data.records || []
+ })
+ },
+ handleDevice() {
+ const { activeDevice } = this
+ if(!activeDevice.id) return this.showToast('璇峰厛閫夋嫨璁惧')
+ this.$set(this.param, 'deviceId', activeDevice.id)
+ this.$set(this.param, 'deviceName', activeDevice.name)
+ this.showModal = false
+ },
+ deviceClick(item) {
+ this.activeDevice = item
+ this.$forceUpdate()
},
statusChange(val){
this.param.status = val
@@ -125,7 +159,7 @@
files: imgs,
name: 'file',
formData: {
- folder: 'HIDDEN_DANGER_FILE'
+ folder: 'YW_DEVICE'
},
header: {
Dm_user_token: token
@@ -137,7 +171,7 @@
i.type = 0;
i.fileurl = i.imgaddr;
i.fileurlFull = i.url;
- this.submitFileList.push(i);
+ this.fileList.push(i);
});
}
},
@@ -171,7 +205,7 @@
},
name: 'file',
formData: {
- folder: 'HIDDEN_DANGER_FILE'
+ folder: 'YW_DEVICE'
},
success: uploadFileRes => {
let res = JSON.parse(uploadFileRes.data);
@@ -180,7 +214,7 @@
i.type = 1;
i.fileurl = i.imgaddr;
i.fileurlFull = i.url;
- this.submitFileList.push(i);
+ this.fileList.push(i);
});
}
},
--
Gitblit v1.9.3