From f16c4fed5e34e5514a564266c500ff382644630a Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 17 五月 2024 12:37:11 +0800
Subject: [PATCH] 1.设备维修提交2.维修验证提交
---
pages/sbgl/sbwx.vue | 272 ++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 193 insertions(+), 79 deletions(-)
diff --git a/pages/sbgl/sbwx.vue b/pages/sbgl/sbwx.vue
index 41b59b8..6591f2c 100644
--- a/pages/sbgl/sbwx.vue
+++ b/pages/sbgl/sbwx.vue
@@ -12,7 +12,7 @@
<view v-show="topContent.length!==0">
- <view class="mainContent" :style="{maxHeight:'1000rpx',overflow: 'scroll'}">
+ <view class="mainContent" :style="{maxHeight:'1360rpx',overflow: 'scroll'}">
<view>
<u-gap height="10" bgColor="#eff0f1"></u-gap>
@@ -26,7 +26,7 @@
</view>
<view class="marginRight20">
- <u-icon name="scan" @click="topScanClick" color="red" size="56"></u-icon>
+ <u-icon name="scan" @click="topScanClick" color="red" size="28"></u-icon>
</view>
</view>
@@ -61,7 +61,7 @@
</view>
</view>
</view>
- <u-radio size='40' style='position: absolute;top: 45%;right: 0;'
+ <u-radio size='20' style='position: absolute;top: 45%;right: 0;'
:key="item.docu_code" :name="item.docu_code"
@change="groupChange(item.docu_code)" activeColor="red"></u-radio>
@@ -70,7 +70,7 @@
</view>
</view>
- <u-gap height="20" bgColor="#eff0f1"></u-gap>
+ <u-gap height="10" bgColor="#eff0f1"></u-gap>
<view class="head" style="padding-bottom: 10rpx;">
<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
@@ -82,7 +82,7 @@
</view>
</view>
<view class='inputClass contentFont' style="margin: 0 20rpx; width: 95%;">
- <u--textarea placeholder="璇疯緭鍏�" confirm-type="send" border="surround" height='100'
+ <u--textarea placeholder="璇疯緭鍏�" confirm-type="send" border="surround" height='80'
v-model="descMessage">
</u--textarea>
</view>
@@ -90,9 +90,9 @@
<view style="display: flex;">
<view v-for="(pic,index) in fileList" :key="pic.name">
<view style="margin: 20rpx 0rpx 20rpx 20rpx;position: relative;">
- <u-icon name="close" color="#fff" size="26"
+ <u-icon name="close" color="#fff" size="13"
style="position: absolute;z-index: 10;right: 0;background-color: black;border-radius:50%;"
- @click="deletePic(pic)"></u-icon>
+ @click="deletePic(pic,'G')"></u-icon>
<image :src="pic.uri" @click="imgPreview(pic)" class="upLoadImg"></image>
</view>
@@ -104,7 +104,7 @@
</view>
- <u-gap height="20" bgColor="#eff0f1"></u-gap>
+ <u-gap height="10" bgColor="#eff0f1"></u-gap>
<view class="head" style="padding-bottom: 10rpx;">
<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
@@ -115,16 +115,18 @@
</view>
</view>
- <view class="marginRight20" style="width: 200rpx;display: flex;">
- <u-button type="primary" :plain="isStop!=='Y'" text="鏄�" @click="isStopClick('Y')">
+ <view class="marginRight20" style="width: 200rpx;display: flex;align-items: center;">
+ <u-button type="primary" :plain="isStop!=='Y'" style="height: 60rpx;" text="鏄�"
+ @click="isStopClick('Y')">
</u-button>
- <u-button type="warning" :plain="isStop!=='N'" text="鍚�" @click="isStopClick('N')">
+ <u-button type="warning" :plain="isStop!=='N'" style="height: 60rpx;margin: 0 5rpx;"
+ text="鍚�" @click="isStopClick('N')">
</u-button>
</view>
</view>
</view>
- <u-gap height="20" bgColor="#eff0f1"></u-gap>
+ <u-gap height="10" bgColor="#eff0f1"></u-gap>
<view v-show="isStop==='N'" class="head" style="padding-bottom: 10rpx;padding-bottom: 20rpx;">
<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
@@ -136,14 +138,14 @@
</view>
</view>
<view class='inputClass contentFont' style="margin: 0 20rpx; width: 95%;">
- <u--textarea placeholder="璇疯緭鍏�" confirm-type="send" border="surround" height='100'
+ <u--textarea placeholder="璇疯緭鍏�" confirm-type="send" border="surround" height='80'
v-model="descMessage2">
</u--textarea>
</view>
</view>
- <u-gap height="20" bgColor="#eff0f1"></u-gap>
+ <u-gap height="10" bgColor="#eff0f1"></u-gap>
<!-- margin-bottom: 110rpx; -->
<view v-show="isStop==='N'" class="head" style="padding-bottom: 10rpx;">
<view class="head_block" style="margin-bottom: 10rpx;margin-top:20rpx;">
@@ -155,7 +157,7 @@
</view>
</view>
<view class='inputClass contentFont' style="margin: 0 20rpx; width: 95%;">
- <u--textarea placeholder="璇疯緭鍏�" confirm-type="send" border="surround" height='100'
+ <u--textarea placeholder="璇疯緭鍏�" confirm-type="send" border="surround" height='80'
v-model="descMessage3">
</u--textarea>
</view>
@@ -163,9 +165,9 @@
<view style="display: flex;">
<view v-for="(pic,index) in fileList2" :key="pic.name">
<view style="margin: 20rpx 0rpx 20rpx 20rpx;position: relative;">
- <u-icon name="close" color="#fff" size="26"
+ <u-icon name="close" color="#fff" size="13"
style="position: absolute;z-index: 10;right: 0;background-color: black;border-radius:50%;"
- @click="deletePic(pic)"></u-icon>
+ @click="deletePic(pic,'B')"></u-icon>
<image :src="pic.uri" @click="imgPreview2(pic)" class="upLoadImg"></image>
</view>
@@ -199,6 +201,8 @@
<script>
import {
RepairScanDeviceQrCodeDataList,
+ UploadImageDelete,
+ RepairScanDeviceSave
} from '../../config/api.js'
import {
data
@@ -270,18 +274,55 @@
count: 3,
success: (res) => {
const files = res.tempFiles;
+ const uploadList = []
+ console.log(res, 'res')
for (let i = 0; i < files.length; i++) {
let obj = new Object();
obj.name = 'files1;' + i + new Date().getTime();
- obj.uri = files[i].path;
- that.fileList.push(obj);
- if (obj.src == null || obj.src == '' || obj.src == undefined) {
- that.imgPreviewSrcs.push(obj.uri)
- } else {
- that.imgPreviewSrcs.push(obj.src)
- }
+ obj.uri = files[i].path;
+ uploadList.push(obj);
}
+
+ const header = {
+ 'Content-Type': 'multipart/form-data',
+ 'Token': uni.getStorageSync('Token')
+ }
+ uni.uploadFile({
+ url: that.$baseUrl + '/DeviceManager/UploadImageSave',
+ files: uploadList.length === 0 ? [{
+ "uri": "/"
+ }] : uploadList,
+ header: header,
+ formData: { //鏁呴殰鎻忚堪:G 鏇存崲澶囦欢锛欱
+ type: 'G'
+ },
+ success: (res) => {
+ console.log(res, 'res')
+ let result = JSON.parse(res.data)
+ if (res.statusCode == 200 && result.code == '200') {
+ // uni.$u.toast('鎻愪氦鎴愬姛锛�')
+ result.data.forEach(i => {
+ that.fileList.push({
+ uri: 'http://121.196.36.24:8019/' + i,
+ name: i
+ })
+
+ that.imgPreviewSrcs.push(
+ 'http://121.196.36.24:8019/' + i)
+ })
+ } else {
+ uni.$u.toast(result.Message)
+ }
+ },
+ fail(res) {
+ console.log(res, 'res2')
+ uni.$u.toast('鍥剧墖鎻愪氦澶辫触锛�')
+
+ },
+ })
+
+
}
})
},
@@ -292,16 +333,61 @@
count: 3,
success: (res) => {
const files = res.tempFiles;
+ const uploadList = []
for (let i = 0; i < files.length; i++) {
let obj = new Object();
- obj.name = 'files2;' + i + new Date().getTime();
+ // obj.name = 'files2;' + i + new Date().getTime();
+ // obj.files2 = i + new Date().getTime();
obj.uri = files[i].path;
- that.fileList2.push(obj);
- if (obj.src == null || obj.src == '' || obj.src == undefined) {
- that.imgPreviewSrcs2.push(obj.uri)
- } else {
- that.imgPreviewSrcs2.push(obj.src)
+ uploadList.push(obj);
+ // if (obj.src == null || obj.src == '' || obj.src == undefined) {
+ // that.imgPreviewSrcs2.push(obj.uri)
+ // } else {
+ // that.imgPreviewSrcs2.push(obj.src)
+ // }
+
+
+ const header = {
+ 'Content-Type': 'multipart/form-data',
+ 'Token': uni.getStorageSync('Token')
}
+ uni.uploadFile({
+ url: that.$baseUrl + '/DeviceManager/UploadImageSave',
+ files: uploadList.length === 0 ? [{
+ "uri": "/"
+ }] : uploadList,
+ header: header,
+ formData: { //鏁呴殰鎻忚堪:G 鏇存崲澶囦欢锛欱
+ type: 'B'
+ },
+ success: (res) => {
+ console.log(res, 'res')
+ let result = JSON.parse(res.data)
+ if (res.statusCode == 200 && result.code == '200') {
+ // uni.$u.toast('鎻愪氦鎴愬姛锛�')
+ result.data.forEach(i => {
+ that.fileList2.push({
+ uri: 'http://121.196.36.24:8019/' +
+ i,
+ name: i
+ })
+
+ that.imgPreviewSrcs2.push(
+ 'http://121.196.36.24:8019/' + i)
+ })
+ } else {
+ uni.$u.toast(result.Message)
+ }
+ },
+ fail(res) {
+ console.log(res, 'res2')
+ uni.$u.toast('鍥剧墖鎻愪氦澶辫触锛�')
+
+ },
+ })
+
+
+
}
}
@@ -326,11 +412,21 @@
})
},
// 鍒犻櫎鍥剧墖
- deletePic(img) {
+ async deletePic(img, type) {
+
this.fileList = this.fileList.filter(i => i.name !== img.name)
this.fileList2 = this.fileList2.filter(i => i.name !== img.name)
this.imgPreviewSrcs = this.imgPreviewSrcs.filter(i => i !== img.uri)
this.imgPreviewSrcs2 = this.imgPreviewSrcs2.filter(i => i !== img.uri)
+
+ // 璋冪敤鎺ュ彛鎶婄浉瀵瑰簲鐨勫浘鐗囧垹鎺�
+ const data = {
+ "type": type,
+ "url": img.name
+ }
+ await UploadImageDelete(data)
+
+
},
init() {
uni.stopPullDownRefresh();
@@ -410,66 +506,84 @@
// 纭鎻愪氦鎸夐挳
async submit() {
- const header = {
- // 'Content-Type': 'multipart/form-data',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'rediskey': uni.getStorageSync('rediskey'),
- 'admin': uni.getStorageSync('usercode'),
- 'username': encodeURIComponent(uni.getStorageSync('username')),
- 'navTabId': uni.getStorageSync('usercode'),
- 'userid': uni.getStorageSync('userid'),
- 'guid': uni.getStorageSync('guid'),
- 'usertype': 'APP'
- }
+
+ // const header = {
+ // 'Content-Type': 'multipart/form-data',
+ // 'Token': uni.getStorageSync('Token')
+ // }
const result = this.topContent.find(item => item.docu_code === this.radioValue)
const formData = {
- username: uni.getStorageSync('username'),
docu_code: result.docu_code,
eqpcode: result.eqpcode,
wkshpcode: result.wksp_code,
faultdescr: this.descMessage,
is_stoprepair: this.isStop,
- // files1: this.fileList,
+ groupimage1: this.fileList.map(i => i.name),
+ groupimage2: this.fileList2.map(i => i.name),
repaircontent: this.descMessage2,
replaceparts: this.descMessage3
}
- // console.log(formData)
- // console.log([...this.fileList, ...this.fileList2].length)
+ console.log(formData, 123)
+
this.isDisabledSubmitButton = true
- uni.uploadFile({
- url: this.$baseUrl + '/AppDeviceManage/RepairScanDeviceSave',
- files: [...this.fileList, ...this.fileList2].length === 0 ? [{
- "uri": "/"
- }] : [...this.fileList, ...this.fileList2],
- header: header,
- formData: formData,
- success: (res) => {
- console.log(res)
- let result = JSON.parse(res.data)
- if (res.statusCode == 200 && result.code == '200') {
- uni.$u.toast('鎻愪氦鎴愬姛锛�')
- this.topContent = this.topContent.filter(i => i.docu_code !== this.radioValue)
- this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
- .docu_code
- this.descMessage = ''
- this.imgPreviewSrcs = []
- this.fileList = []
- this.isStop = 'Y'
- this.descMessage2 = ''
- this.descMessage3 = ''
- this.fileList2 = []
- this.imgPreviewSrcs2 = []
- } else {
- uni.$u.toast(result.Message)
- }
- this.isDisabledSubmitButton = false
- },
- fail(res) {
- uni.$u.toast('鎻愪氦澶辫触锛�')
- this.isDisabledSubmitButton = false
- },
- })
+
+ const res = await RepairScanDeviceSave(formData)
+ if (res.code == '200') {
+ uni.$u.toast('鎻愪氦鎴愬姛锛�')
+ this.topContent = this.topContent.filter(i => i.docu_code !== this.radioValue)
+ this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
+ .docu_code
+ this.descMessage = ''
+ this.imgPreviewSrcs = []
+ this.fileList = []
+ this.isStop = 'Y'
+ this.descMessage2 = ''
+ this.descMessage3 = ''
+ this.fileList2 = []
+ this.imgPreviewSrcs2 = []
+ this.isDisabledSubmitButton = false
+ } else {
+ uni.$u.toast(result.Message)
+ this.isDisabledSubmitButton = false
+ }
+
+
+ // uni.uploadFile({
+ // url: this.$baseUrl + '/DeviceManager/RepairScanDeviceSave',
+ // files: [...this.fileList, ...this.fileList2].length === 0 ? [{
+ // "uri": "/"
+ // }] : [...this.fileList, ...this.fileList2],
+ // name: 'files',
+ // header: header,
+ // formData: formData,
+ // success: (res) => {
+ // console.log(res, 'res')
+ // let result = JSON.parse(res.data)
+ // if (res.statusCode == 200 && result.code == '200') {
+ // uni.$u.toast('鎻愪氦鎴愬姛锛�')
+ // this.topContent = this.topContent.filter(i => i.docu_code !== this.radioValue)
+ // this.radioValue = this.topContent.length === 0 ? '' : this.topContent[0]
+ // .docu_code
+ // this.descMessage = ''
+ // this.imgPreviewSrcs = []
+ // this.fileList = []
+ // this.isStop = 'Y'
+ // this.descMessage2 = ''
+ // this.descMessage3 = ''
+ // this.fileList2 = []
+ // this.imgPreviewSrcs2 = []
+ // } else {
+ // uni.$u.toast(result.Message)
+ // }
+ // this.isDisabledSubmitButton = false
+ // },
+ // fail(res) {
+ // console.log(res, 'res2')
+ // uni.$u.toast('鎻愪氦澶辫触锛�')
+ // this.isDisabledSubmitButton = false
+ // },
+ // })
},
}
--
Gitblit v1.9.3