From 83206a4017aa82e1658208cb55b78833e35deac7 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期一, 11 九月 2023 18:15:51 +0800
Subject: [PATCH] 小程序
---
h5_standard/src/views/tabPage/my.vue | 3
minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue | 106 ++++++++++++--------
minipro_standard/util/api/QualityAPI.js | 2
minipro_standard/common/config.js | 9 +
minipro_standard/components/yty-data-picker/yty-data-picker.vue | 117 +++++++++++++++++++++++
minipro_standard/package.json | 19 +++
h5_standard/src/views/personal/personalInformation.vue | 3
minipro_standard/components/Preview.vue | 34 ++++++
minipro_standard/components/static/yty-data-picker/yty-data-picker.png | 0
9 files changed, 242 insertions(+), 51 deletions(-)
diff --git a/h5_standard/src/views/personal/personalInformation.vue b/h5_standard/src/views/personal/personalInformation.vue
index b0407fd..0b22f97 100644
--- a/h5_standard/src/views/personal/personalInformation.vue
+++ b/h5_standard/src/views/personal/personalInformation.vue
@@ -1,7 +1,8 @@
<template>
<div class="info">
<div class="info_portrait">
- <img :src="store.state.userInfo.avatar ? store.state.userInfo.avatar : avatar" alt="" />
+ <!-- store.state.userInfo.avatar ? store.state.userInfo.avatar : -->
+ <img :src="avatar" alt="" />
<span>{{store.state.userInfo.companyUser.name}}</span>
</div>
<div class="info_list">
diff --git a/h5_standard/src/views/tabPage/my.vue b/h5_standard/src/views/tabPage/my.vue
index 5df450e..5ce37f4 100644
--- a/h5_standard/src/views/tabPage/my.vue
+++ b/h5_standard/src/views/tabPage/my.vue
@@ -1,7 +1,8 @@
<template>
<div class="box">
<div class="box_info">
- <img :src="store.state.userInfo.avatar ? store.state.userInfo.avatar : avatar" alt="" />
+ <!-- store.state.userInfo.avatar ? store.state.userInfo.avatar : -->
+ <img :src="avatar" alt="" />
<div class="box_info_box">
<span>{{store.state.userInfo.companyUser ? store.state.userInfo.companyUser.name : ''}}</span>
<div class="box_info_box_x" @click="switchOrganization">
diff --git a/minipro_standard/common/config.js b/minipro_standard/common/config.js
index 529495d..c1b5459 100644
--- a/minipro_standard/common/config.js
+++ b/minipro_standard/common/config.js
@@ -9,6 +9,15 @@
decimal: /^0$|^[1-9]\d{0,15}$|^[1-9]\d{0,15}\.{1}\d{1,4}$|^0\.{1}\d{1,4}$/g,
positiveIntegerDecimal: /^([1-9][0-9]*|0)(\.[0-9]?[1-9][1-9][1-9])?$/,
number: /^\d+(?:\.\d{1,4})?$/,
+ fileType: [
+ { name: '.png', type: 2 },
+ { name: '.PNG', type: 2 },
+ { name: '.jpg', type: 2 },
+ { name: '.JPG', type: 2 },
+ { name: '.jpeg', type: 2 },
+ { name: '.JPEG', type: 2 },
+ { name: '.mp4', type: 1 }
+ ],
Attribute: {
HH: 'APPLIANCE_MIX',
HG: 'APPLIANCE_ONTEST',
diff --git a/minipro_standard/components/Preview.vue b/minipro_standard/components/Preview.vue
new file mode 100644
index 0000000..a6c4844
--- /dev/null
+++ b/minipro_standard/components/Preview.vue
@@ -0,0 +1,34 @@
+<template>
+ <div class="preview">
+ <div class="preview_close" @click="closes">
+ <u-icon name="close" size="20"></u-icon>
+ </div>
+ <div class="preview_content">
+ <u-swiper :list="list" :current="current"></u-swiper>
+ </div>
+ </div>
+</template>
+
+<script>
+ export default {
+ props: {
+ list: {
+ type: Array,
+ default: []
+ },
+ current: {
+ type: Number,
+ default: 0
+ }
+ },
+ methods: {
+ closes() {
+ this.$emit('close')
+ }
+ }
+ }
+</script>
+
+<style lang="scss" scoped>
+
+</style>
diff --git a/minipro_standard/components/static/yty-data-picker/yty-data-picker.png b/minipro_standard/components/static/yty-data-picker/yty-data-picker.png
new file mode 100644
index 0000000..d9b72d2
--- /dev/null
+++ b/minipro_standard/components/static/yty-data-picker/yty-data-picker.png
Binary files differ
diff --git a/minipro_standard/components/yty-data-picker/yty-data-picker.vue b/minipro_standard/components/yty-data-picker/yty-data-picker.vue
new file mode 100644
index 0000000..a01378c
--- /dev/null
+++ b/minipro_standard/components/yty-data-picker/yty-data-picker.vue
@@ -0,0 +1,117 @@
+<template>
+ <view>
+ <view class="mask_area" @click="handleMaskClick" v-if="show">
+ <view class="content_area" @click.stop>
+ <view class="search_area">
+ <input class="" inputmode="search" type="text" placeholder="璇疯緭鍏ュ叧閿瓧" @confirm="handleSearch" />
+ </view>
+ <scroll-view class="list_area" scroll-y="true">
+ <view>
+ <view class="list_item" v-for="item,index in dataList" :key="index" @click="handleSelect(item)">
+ {{item.name}}
+ </view>
+ </view>
+ </scroll-view>
+ </view>
+ </view>
+ </view>
+</template>
+
+<script>
+ export default {
+ props: {
+ show: {
+ type: Boolean,
+ default: false,
+ },
+ dataList: {
+ type: Array,
+ default: function() {
+ return []
+ }
+ }
+ },
+ name: "yty-data-picker",
+ data() {
+ return {
+
+ };
+ },
+ methods: {
+ handleMaskClick() {
+ this.$emit('close')
+ },
+ handleSelect(item) {
+ this.$emit('select', item)
+ },
+ handleSearch(event) {
+ this.$emit('search', event.detail.value)
+ }
+ }
+ }
+</script>
+
+<style scoped>
+ .mask_area {
+ position: fixed;
+ top: 0;
+ left: 0;
+ z-index: 999;
+ width: 100%;
+ height: 100vh;
+ background: rgba(0, 0, 0, 0.6);
+ }
+
+ .content_area {
+ position: fixed;
+ bottom: 0;
+ left: 0;
+ z-index: 1000;
+ width: 100%;
+ height: 60vh;
+ background: #fff;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ animation: dialog-fade-in 0.3s;
+ }
+
+ .search_area {
+ display: flex;
+ align-items: center;
+ width: 100%;
+ height: 80rpx;
+ background-color: #f9f9f9;
+ border-radius: 40rpx;
+ margin-top: 20rpx;
+ padding: 0 30rpx;
+ box-sizing: border-box;
+ }
+
+ .search_icon {
+ width: 40rpx;
+ height: 40rpx;
+ margin: 0 15rpx 0 10rpx;
+ }
+
+ .list_area {
+ width: 95%;
+ height: 80%;
+ margin-top: 20rpx;
+ }
+
+ .list_item {
+ padding: 20rpx;
+ border-bottom: 1px solid #f5f5f5
+ }
+
+ @keyframes dialog-fade-in {
+ 0% {
+ transform: translate3d(0, 100%, 0);
+ }
+
+ 100% {
+ transform: translate3d(0, 0, 0);
+ }
+ }
+</style>
\ No newline at end of file
diff --git a/minipro_standard/package.json b/minipro_standard/package.json
index add0140..74b8ece 100644
--- a/minipro_standard/package.json
+++ b/minipro_standard/package.json
@@ -1,5 +1,16 @@
{
- "dependencies": {
- "vant": "^4.6.6"
- }
-}
+ "id": "yty-data-picker",
+ "name": "鍔ㄦ�佸姞杞芥暟鎹�夋嫨鍣�(鍗曢�夈�佹悳绱€�佸姞杞芥洿澶氥�佸垎椤靛姞杞�)",
+ "displayName": "鍔ㄦ�佸姞杞芥暟鎹�夋嫨鍣�(鍗曢�夈�佹悳绱€�佸姞杞芥洿澶氥�佸垎椤靛姞杞�)",
+ "version": "1.0.0",
+ "description": "鍔ㄦ�佸姞杞芥暟鎹�夋嫨鍣�(鏀寔鍗曢�夈�佹帴鍙f悳绱€�佹帴鍙e垎椤靛姞杞�)",
+ "keywords": [
+ "鍗曢�夈�佺瓫閫夈�佸姩鎬佸姞杞姐�佸脊鍑烘銆佸垎椤靛姞杞�"
+ ],
+ "dcloudext": {
+ "category": [
+ "鍓嶇缁勪欢",
+ "閫氱敤缁勪欢"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue b/minipro_standard/pages_inspect/pages/equipmentInspection/equipmentInspection.vue
index d42f60f..a730917 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>
@@ -69,6 +69,10 @@
<view class="box_footer">
<button class="box_footer_submit" v-preventReClick @click="submit">鎻愪氦</button>
</view>
+ <!-- 鏌ョ湅澶у浘 -->
+ <Preview :list="form.files" :current="current" 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,13 +82,20 @@
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/Preview.vue'
export default {
data() {
return {
+ list1: [
+ 'https://cloudfactory.oss-cn-hangzhou.aliyuncs.com/deviceCheck/20230911/e228a809-0a6b-443c-9a2c-78d5c1b1b633.mp4',
+ 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
+ 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
+ ],
status: [{
name: '姝e父',
active: true,
@@ -98,8 +109,10 @@
],
columns: [],
path: '',
+ show: false,
showTime: false,
currentDate: new Date(),
+ current: 0,
form: {
equipmentId: '', // 璁惧id
equipmentName: '', //璁惧鍚嶇О
@@ -110,14 +123,33 @@
}
};
},
+ components:{
+ ytyDataPicker,
+ Preview
+ },
onLoad() {
this.form.time = setTime(new Date(), '-')
this.getqueryListByCode()
+ this.getSB('')
},
computed: {
...mapState(['session'])
},
methods: {
+ // 鍒犻櫎鎸囧畾鏂囦欢
+ 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,49 +238,23 @@
})
},
// 鑾峰彇褰撳墠鐢ㄦ埛涓嬫墍鏈夎澶�
- 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() {
+ var that = this
uni.chooseImage({
success: (chooseImageRes) => {
const tempFilePaths = chooseImageRes.tempFilePaths;
@@ -257,19 +264,23 @@
filePath: tempFilePaths[0],
name: 'file',
header: {
- 'Cookie': 'eva-auth-token=' + this.session
+ 'Cookie': 'eva-auth-token=' + that.session
},
formData: {
- 'folder': this.path
+ 'folder': that.path
},
success: (uploadFileRes) => {
- console.log(JSON.parse(uploadFileRes.data));
let res = JSON.parse(uploadFileRes.data)
- this.form.files.push({
+ let type = ''
+ for (let i = 0; i < fileType.length; i++) {
+ if (tempFilePaths[0].indexOf(fileType[i].name) !== -1) {
+ type = fileType[i].type
+ }
+ }
+ that.form.files.push({
fileUrl: res.data.imgaddr,
filename: res.data.imgname,
- // filesize: e.target.files[i].size,
- type: judgmentType(tempFilePaths[0]) ? 0 : 1,
+ type,
url: res.data.url
})
}
@@ -298,6 +309,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;
diff --git a/minipro_standard/util/api/QualityAPI.js b/minipro_standard/util/api/QualityAPI.js
index a360e00..ad8ea93 100644
--- a/minipro_standard/util/api/QualityAPI.js
+++ b/minipro_standard/util/api/QualityAPI.js
@@ -108,7 +108,7 @@
// 鏍规嵁ID鏌ヨ璁惧
export function getsbInfo (id) {
- return request.post(`/ext/deviceExt/${id}`)
+ return request.get(`/ext/deviceExt/${id}`)
}
// export function getsbInfo (id: any): Promise<any> {
// return httpRequest({
--
Gitblit v1.9.3