From ca73a173f008c8d7a9d700bad897ca24fe2d2203 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 16 十月 2023 09:29:57 +0800
Subject: [PATCH] 111
---
minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue | 157 ++++++++++++++++++++++++++++++----------------------
1 files changed, 90 insertions(+), 67 deletions(-)
diff --git a/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue b/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue
index d42f60f..fb83d85 100644
--- a/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue
+++ b/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue
@@ -2,7 +2,7 @@
<view class="box1">
<!-- 璁惧+鏃ユ湡 -->
<view class="box_list">
- <view class="box_list_item" @click="open">
+ <view class="box_list_item" @click="show = true">
<view class="box_list_item_left">
<text>妫�楠岃澶�</text><text>*</text>
</view>
@@ -50,9 +50,9 @@
<view class="box_list1_club_list_item" v-for="(item, index) in form.files" :key="index"
@click="seeBigFile(index)">
<image class="close" src="@/static/ic_delete@2x.png" @click.stop="dele(index)" />
- <image class="play" src="@/static/ic_play@2x.png" v-if="item.type === 1" />
+ <image class="play" src="@/static/ic_play@2x.png" v-if="item.typec === 1" />
<view class="type">
- <video :src="item.url" v-if="item.type === 1"></video>
+ <video :src="item.url" v-if="item.typec === 1"></video>
<image v-else class="type_img" :src="item.url" mode="widthFix" />
</view>
</view>
@@ -63,12 +63,15 @@
</view>
<view class="box_list2">
<view class="box_list2_label">澶囨敞</view>
- <textarea name="" id="" v-model="form.remarks" cols="20" rows="5" maxlength="300"
- placeholder="璇疯缁嗘弿杩板贰妫�鎯呭喌"></textarea>
+ <textarea v-model="form.remarks" cols="20" rows="5" maxlength="300" placeholder="璇疯缁嗘弿杩板贰妫�鎯呭喌"></textarea>
</view>
<view class="box_footer">
<button class="box_footer_submit" v-preventReClick @click="submit">鎻愪氦</button>
</view>
+ <!-- 鏌ョ湅澶у浘 -->
+ <Preview :list="form.files.map(item => item.url)" :current="current" @close="isOpen = false" v-if="isOpen" />
+ <!-- 閫夋嫨璁惧 -->
+ <ytyDataPicker :show="show" :dataList="columns" @select="handleSelect" @search="handleSearch" @close="show = false" />
<!-- 閫夋嫨鏃堕棿 -->
<u-datetime-picker :show="showTime" v-model="currentDate" @cancel="showTime = false" @confirm="queding" mode="datetime"></u-datetime-picker>
</view>
@@ -78,9 +81,11 @@
import { getBarcodeContent } from '@/util/api/WorkOrderAPI'
import { saveBean, getDeviceByCondition, getsbInfo } from '@/util/api/QualityAPI'
import { queryListByCode, uploadFiles } from '@/util/api/index'
- import { QRCodeType, baseUrl } from '@/common/config.js'
+ import { QRCodeType, baseUrl, fileType } from '@/common/config.js'
import { setTime, judgmentType } from '@/util/utils.js'
import { mapState } from 'vuex'
+ import ytyDataPicker from '@/components/yty-data-picker/yty-data-picker.vue'
+ import Preview from '@/components/Preview.vue'
export default {
data() {
@@ -97,9 +102,12 @@
}
],
columns: [],
+ isOpen: false,
path: '',
+ show: false,
showTime: false,
currentDate: new Date(),
+ current: 0,
form: {
equipmentId: '', // 璁惧id
equipmentName: '', //璁惧鍚嶇О
@@ -110,14 +118,38 @@
}
};
},
+ components:{
+ ytyDataPicker,
+ Preview
+ },
onLoad() {
this.form.time = setTime(new Date(), '-')
this.getqueryListByCode()
+ this.getSB('')
},
computed: {
...mapState(['session'])
},
methods: {
+ // 鏌ョ湅澶у浘/瑙嗛
+ seeBigFile(i) {
+ this.current = i
+ this.isOpen = true
+ },
+ // 鍒犻櫎鎸囧畾鏂囦欢
+ dele(i) {
+ this.form.files.splice(i, 1)
+ },
+ // 閫夋嫨璁惧
+ handleSelect(e) {
+ this.form.equipmentId = e.code
+ this.form.equipmentName = e.name
+ this.show = false
+ },
+ // 鎼滅储璁惧
+ handleSearch(e) {
+ this.getSB(e)
+ },
// 纭閫夋嫨鏃ユ湡
queding(val) {
this.form.time = uni.$u.timeFormat(val.value, 'yyyy-mm-dd hh:MM:ss')
@@ -125,6 +157,7 @@
},
// 鎵爜
openCode() {
+ var that = this
uni.scanCode({
onlyFromCamera: true,
success: function (result) {
@@ -136,8 +169,8 @@
getsbInfo(res.data.id)
.then(res1 => {
if (res1.code === 200) {
- this.form.equipmentId = res1.data.id
- this.form.equipmentName = res1.data.name
+ that.form.equipmentId = res1.data.id
+ that.form.equipmentName = res1.data.name
}
})
} else {
@@ -205,75 +238,58 @@
})
},
// 鑾峰彇褰撳墠鐢ㄦ埛涓嬫墍鏈夎澶�
- getSB() {
- getDeviceByCondition({})
+ getSB(name) {
+ getDeviceByCondition({ name })
.then(res => {
if (res.code === 200 && res.data && res.data.length > 0) {
- this.columns = []
+ let arr = []
res.data.forEach(item => {
- this.columns.push({ text: item.name, id: item.id })
+ arr.push({ name: item.name, code: item.id })
})
+ this.columns = arr
+ } else {
+ this.columns = []
}
})
},
- // 鑾峰彇鏂囦欢
- async upFile(e) {
- if (this.form.files.length + e.target.files.length > 9) {
- uni.showToast({
- title: '鏈�澶氬彧鑳戒笂浼�9涓浘鐗�/瑙嗛',
- icon: 'none',
- duration: 2000
- });
- return
- }
- for (let i = 0; i < e.target.files.length; i++) {
- let type = e.target.files[i].type
- let index = type.indexOf('/')
- let data = type.substring(index + 1, type.length)
- const format = new FormData()
- format.append('file', e.target.files[i])
- format.append('folder', this.path)
- let res = await uploadFiles(format)
- if (res.code === 200) {
- form.files.push({
- fileUrl: res.data.imgaddr,
- filename: res.data.imgname,
- filesize: e.target.files[i].size,
- type: judgmentType(data.toLowerCase()) ? 0 : 1,
- url: res.data.url
- })
- }
- }
- // upload.value.value = ''
- },
// 鐐瑰嚮涓婁紶
uploadFile() {
- uni.chooseImage({
+ var that = this
+ uni.chooseMedia({
+ mediaType: ['image', 'video'],
+ sourceType: ['album', 'camera'],
success: (chooseImageRes) => {
- const tempFilePaths = chooseImageRes.tempFilePaths;
- console.log(tempFilePaths)
- uni.uploadFile({
- url: baseUrl + '/ext/routeCardExt/upload',
- filePath: tempFilePaths[0],
- name: 'file',
- header: {
- 'Cookie': 'eva-auth-token=' + this.session
- },
- formData: {
- 'folder': this.path
- },
- success: (uploadFileRes) => {
- console.log(JSON.parse(uploadFileRes.data));
- let res = JSON.parse(uploadFileRes.data)
- this.form.files.push({
- fileUrl: res.data.imgaddr,
- filename: res.data.imgname,
- // filesize: e.target.files[i].size,
- type: judgmentType(tempFilePaths[0]) ? 0 : 1,
- url: res.data.url
- })
- }
- });
+ uni.showLoading({ title: '涓婁紶涓�' });
+ const tempFilePaths = chooseImageRes.tempFiles;
+ for (let i = 0; i < tempFilePaths.length; i++) {
+ uni.uploadFile({
+ url: baseUrl + '/ext/routeCardExt/upload',
+ filePath: tempFilePaths[i].tempFilePath,
+ name: 'file',
+ header: {
+ 'Cookie': 'eva-auth-token=' + that.session
+ },
+ formData: {
+ 'folder': that.path
+ },
+ success: (uploadFileRes) => {
+ let res = JSON.parse(uploadFileRes.data)
+ let typec = ''
+ for (let s = 0; s < fileType.length; s++) {
+ if (tempFilePaths[i].tempFilePath.indexOf(fileType[s].name) !== -1) {
+ typec = fileType[s].type
+ }
+ }
+ that.form.files.push({
+ fileUrl: res.data.imgaddr,
+ filename: res.data.imgname,
+ typec,
+ url: res.data.url
+ })
+ uni.hideLoading();
+ }
+ });
+ }
}
});
},
@@ -298,6 +314,13 @@
height: 100%;
position: absolute;
background: #F7F7F7;
+
+ .sb {
+ width: 100%;
+ height: 800rpx;
+ padding: 30rpx;
+ box-sizing: border-box;
+ }
.box_list {
padding: 0 30rpx 0 30rpx;
--
Gitblit v1.9.3