| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="box1"> |
| | | <!-- 设å¤+æ¥æ --> |
| | | <view class="box_list"> |
| | | <view class="box_list_item" @click="show = true"> |
| | | <view class="box_list_item_left"> |
| | | <text>æ£éªè®¾å¤</text><text>*</text> |
| | | </view> |
| | | <view class="box_list_item_right"> |
| | | <text :style="form.equipmentName ? 'color: #000' : ''">{{ form.equipmentName ? form.equipmentName : 'ç¹å»éæ©å·¡æ£è®¾å¤' }}</text> |
| | | <u-icon name="arrow-right" color="#999999" size="18"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="box_list_code" @click.stop="openCode"> |
| | | <view class="boxs"> |
| | | <image src="@/static/jianyan_ic_saoma@2x.png" alt="" /> |
| | | <text>æ«æè®¾å¤</text> |
| | | </view> |
| | | </view> |
| | | <view class="box_list_item" @click="showTime = true"> |
| | | <view class="box_list_item_left"> |
| | | <text>å·¡æ£æ¶é´</text><text>*</text> |
| | | </view> |
| | | <view class="box_list_item_right"> |
| | | <text class="black">{{form.time}}</text> |
| | | <u-icon name="arrow-right" color="#999999" size="18"></u-icon> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- ç¶æ+å¾ç/è§é¢ --> |
| | | <view class="box_list1"> |
| | | <view class="box_list1_item"> |
| | | <view class="box_list1_item_left"> |
| | | <text>设å¤ç¶æ</text><text>*</text> |
| | | </view> |
| | | <view class="box_list1_item_right"> |
| | | <view class="box_list1_item_right_item" :class="{'active': item.active}" |
| | | v-for="(item, index) in status" :key="index" @click="changeItem(index, item.id)">{{item.name}} |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="box_list1_club"> |
| | | <view class="box_list1_club_label">å·¡æ£ç°åºç
§ç<text v-show="form.status == '1'">*</text></view> |
| | | <view class="box_list1_club_list"> |
| | | <view class="box_list1_club_list_item" @click="uploadFile"> |
| | | <view class="type"> |
| | | <image class="type_img" src="@/static/btn_upload@2x.png" alt="" /> |
| | | </view> |
| | | </view> |
| | | <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" /> |
| | | <view class="type"> |
| | | <video :src="item.url" v-if="item.type === 1"></video> |
| | | <image v-else class="type_img" :src="item.url" mode="widthFix" /> |
| | | </view> |
| | | </view> |
| | | <view class="box_list1_club_list_item1"></view> |
| | | <view class="box_list1_club_list_item1"></view> |
| | | </view> |
| | | </view> |
| | | </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> |
| | | </view> |
| | | <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> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getBarcodeContent } from '@/util/api/WorkOrderAPI' |
| | | import { saveBean, getDeviceByCondition, getsbInfo } from '@/util/api/QualityAPI' |
| | | import { queryListByCode, uploadFiles } from '@/util/api/index' |
| | | 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: 'æ£å¸¸', |
| | | active: true, |
| | | id: '0' |
| | | }, |
| | | { |
| | | name: 'å¼å¸¸', |
| | | active: false, |
| | | id: '1' |
| | | } |
| | | ], |
| | | columns: [], |
| | | path: '', |
| | | show: false, |
| | | showTime: false, |
| | | currentDate: new Date(), |
| | | current: 0, |
| | | form: { |
| | | equipmentId: '', // 设å¤id |
| | | equipmentName: '', //设å¤åç§° |
| | | time: '', // å·¡æ£æ¶é´ |
| | | status: '0', // 设å¤ç¶æ |
| | | files: [], // å·¡æ£å¾ç/è§é¢ |
| | | remarks: '' // 夿³¨ |
| | | } |
| | | }; |
| | | }, |
| | | 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') |
| | | this.showTime = false |
| | | }, |
| | | // æ«ç |
| | | openCode() { |
| | | var that = this |
| | | uni.scanCode({ |
| | | onlyFromCamera: true, |
| | | success: function (result) { |
| | | getBarcodeContent({ |
| | | barcode: result.result |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | if (res.data.barcodeType === QRCodeType.SB) { |
| | | getsbInfo(res.data.id) |
| | | .then(res1 => { |
| | | if (res1.code === 200) { |
| | | that.form.equipmentId = res1.data.id |
| | | that.form.equipmentName = res1.data.name |
| | | } |
| | | }) |
| | | } else { |
| | | uni.showToast({ |
| | | title: 'è¯·æ«ææ£ç¡®ç设å¤ç ', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | // æ¹åç¶æ |
| | | changeItem(i, id) { |
| | | this.status.forEach((item, index) => { |
| | | item.active = index === i; |
| | | }) |
| | | this.form.status = id |
| | | }, |
| | | submit() { |
| | | if (!this.form.equipmentId) return uni.showToast({ |
| | | title: '设å¤ä¸è½ä¸ºç©º', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | if (!this.form.time) return uni.showToast({ |
| | | title: 'æ¶é´ä¸è½ä¸ºç©º', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | if (!this.form.status) return uni.showToast({ |
| | | title: 'ç¶æä¸è½ä¸ºç©º', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | if (this.form.status == '1') { |
| | | if (this.form.files.length === 0) return uni.showToast({ |
| | | title: 'ç°åºç
§çä¸è½ä¸ºç©º', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | saveBean({ |
| | | checkDate: this.form.time, |
| | | content: this.form.remarks, |
| | | deviceId: this.form.equipmentId, |
| | | status: this.form.status, |
| | | multiFilesSaveBeans: this.form.files |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | uni.showToast({ |
| | | title: 'æäº¤æå', |
| | | icon: 'success', |
| | | duration: 2000, |
| | | mask: true |
| | | }); |
| | | setTimeout(() => { |
| | | uni.navigateBack({ |
| | | delta: 1 |
| | | }); |
| | | }, 2000) |
| | | } |
| | | }) |
| | | }, |
| | | // è·åå½åç¨æ·ä¸ææè®¾å¤ |
| | | getSB(name) { |
| | | getDeviceByCondition({ name }) |
| | | .then(res => { |
| | | if (res.code === 200 && res.data && res.data.length > 0) { |
| | | let arr = [] |
| | | res.data.forEach(item => { |
| | | arr.push({ name: item.name, code: item.id }) |
| | | }) |
| | | this.columns = arr |
| | | } else { |
| | | this.columns = [] |
| | | } |
| | | }) |
| | | }, |
| | | // ç¹å»ä¸ä¼ |
| | | uploadFile() { |
| | | var that = this |
| | | uni.chooseImage({ |
| | | 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=' + that.session |
| | | }, |
| | | formData: { |
| | | 'folder': that.path |
| | | }, |
| | | success: (uploadFileRes) => { |
| | | let res = JSON.parse(uploadFileRes.data) |
| | | 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, |
| | | type, |
| | | url: res.data.url |
| | | }) |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | // è·ååå
¸çº¸ |
| | | getqueryListByCode() { |
| | | queryListByCode({ |
| | | dicCode: 'FOLDER', |
| | | label: 'DEVICE_CHECK' |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.path = res.data[0].code |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .box1 { |
| | | width: 100%; |
| | | height: 100%; |
| | | position: absolute; |
| | | background: #F7F7F7; |
| | | |
| | | .sb { |
| | | width: 100%; |
| | | height: 800rpx; |
| | | padding: 30rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .box_list { |
| | | padding: 0 30rpx 0 30rpx; |
| | | background: white; |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | .box_list_code { |
| | | margin: 20rpx 0; |
| | | |
| | | .boxs { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: flex-end; |
| | | |
| | | image { |
| | | width: 28rpx; |
| | | height: 28rpx; |
| | | margin-right: 12rpx; |
| | | } |
| | | |
| | | text { |
| | | font-size: 28rpx; |
| | | font-weight: 400; |
| | | color: $nav-color; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .box_list_item { |
| | | height: 98rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | border-bottom: 1rpx solid #E5E5E5; |
| | | |
| | | &:last-child { |
| | | border: none; |
| | | } |
| | | |
| | | .box_list_item_left { |
| | | text { |
| | | font-size: 30rpx; |
| | | font-weight: 400; |
| | | |
| | | &:first-child { |
| | | color: #222222; |
| | | } |
| | | |
| | | &:last-child { |
| | | color: #DE5243; |
| | | margin-left: 8rpx; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .box_list_item_right { |
| | | display: flex; |
| | | align-items: center; |
| | | .black { |
| | | color: black; |
| | | } |
| | | |
| | | text { |
| | | font-size: 28rpx; |
| | | font-weight: 400; |
| | | color: #999999; |
| | | margin-right: 10rpx; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .box_list1 { |
| | | padding: 30rpx; |
| | | background: white; |
| | | margin-top: 20rpx; |
| | | |
| | | .box_list1_item { |
| | | height: 98rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | border-bottom: 1rpx solid #E5E5E5; |
| | | |
| | | &:last-child { |
| | | border: none; |
| | | } |
| | | |
| | | .box_list1_item_left { |
| | | text { |
| | | font-size: 30rpx; |
| | | font-weight: 400; |
| | | color: #222222; |
| | | |
| | | &:last-child { |
| | | font-size: 30rpx; |
| | | font-weight: 400; |
| | | color: #DE5243; |
| | | margin-left: 4rpx; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .box_list1_item_right { |
| | | display: flex; |
| | | align-items: center; |
| | | |
| | | .active { |
| | | color: white !important; |
| | | background: $nav-color !important; |
| | | } |
| | | |
| | | .box_list1_item_right_item { |
| | | padding: 18rpx 32rpx; |
| | | background: #F2F2F2; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | font-size: 26rpx; |
| | | font-weight: 400; |
| | | color: #333333; |
| | | margin-left: 20rpx; |
| | | border-radius: 8rpx; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .box_list1_club { |
| | | display: flex; |
| | | flex-direction: column; |
| | | margin-top: 36rpx; |
| | | |
| | | .box_list1_club_label { |
| | | font-size: 30rpx; |
| | | font-weight: 400; |
| | | color: #222222; |
| | | margin-bottom: 32rpx; |
| | | |
| | | text { |
| | | font-size: 30rpx; |
| | | font-weight: 400; |
| | | color: #DE5243; |
| | | margin-left: 4rpx; |
| | | } |
| | | } |
| | | |
| | | .box_list1_club_list { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | flex-wrap: wrap; |
| | | |
| | | .box_list1_club_list_item1 { |
| | | width: 170rpx; |
| | | height: 0; |
| | | } |
| | | |
| | | .box_list1_club_list_item { |
| | | width: 150rpx; |
| | | height: 150rpx; |
| | | border-radius: 8rpx; |
| | | position: relative; |
| | | margin-right: 22rpx; |
| | | margin-bottom: 22rpx; |
| | | |
| | | .type { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | overflow: hidden; |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | |
| | | .type_img { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | video { |
| | | height: 100%; |
| | | z-index: 1; |
| | | } |
| | | } |
| | | |
| | | .play { |
| | | position: absolute; |
| | | left: 50%; |
| | | top: 50%; |
| | | width: 56rpx; |
| | | height: 56rpx; |
| | | z-index: 9; |
| | | transform: translate(-50%, -50%); |
| | | } |
| | | |
| | | .close { |
| | | position: absolute; |
| | | right: -16rpx; |
| | | top: -16rpx; |
| | | width: 32rpx; |
| | | height: 32rpx; |
| | | z-index: 9; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .box_list2 { |
| | | padding: 30rpx; |
| | | background: white; |
| | | margin-top: 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | |
| | | .box_list2_label { |
| | | font-size: 30rpx; |
| | | font-weight: 400; |
| | | color: #222222; |
| | | margin-bottom: 32rpx; |
| | | } |
| | | |
| | | textarea { |
| | | border: none; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | textarea::-webkit-input-placeholder { |
| | | font-size: 28rpx; |
| | | font-weight: 400; |
| | | color: #B2B2B2; |
| | | } |
| | | } |
| | | |
| | | .box_footer { |
| | | width: 100%; |
| | | padding: 0 30rpx 68rpx 30rpx; |
| | | box-sizing: border-box; |
| | | position: fixed; |
| | | bottom: 0; |
| | | left: 0; |
| | | background: #F7F7F7; |
| | | |
| | | .box_footer_submit { |
| | | width: 100%; |
| | | height: 88rpx; |
| | | background: #4275FC; |
| | | box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.0800); |
| | | border-radius: 8rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | font-size: 30rpx; |
| | | font-weight: 500; |
| | | color: #FFFFFF; |
| | | border: none; |
| | | } |
| | | } |
| | | } |
| | | </style> |