Commit 41f1f5a8 authored by Damon's avatar Damon

perf: 完工项数据处理优化

parent 781230d0
......@@ -28,13 +28,8 @@
</view>
</view>
<slot></slot>
<!-- <view class="img-list">
<u-image class="pic" width="160rpx" height="160rpx" :border-radius="10" @click="selectUpload" :src="uploadImage"></u-image>
</view> -->
</view>
<!-- <u-action-sheet :list="list" v-model="maskShow" :cancel-btn="true" @click="uploadSelect"></u-action-sheet> -->
</view>
<!-- <take-photo v-if="takeStatus" @close="closeTake" :upload="false" :currentItem="currentItemDate"></take-photo> -->
</view>
</template>
......@@ -98,7 +93,6 @@ export default {
.map((img) => {
return { src: img ? img : '' }
})
this.setValue()
}
},
methods: {
......@@ -120,102 +114,7 @@ export default {
delFile(index) {
this.imgList.splice(index, 1)
this.setValue()
},
/*
selectUpload(){
if (this.imgList.length === 10) {
return this.$refs.uToast.show({
title: '图片已超出最大数量',
type: 'error',
})
}
// 弹窗展示
this.maskShow = true
},
uploadSelect(index) {
if (index === 0) {
this.uploadFile('photo')
} else {
this.uploadFile()
}
},
async uploadFile(type){
const self = this
if(type&&type==='photo'){
// 直接打开相册
let options = {
sourceType:['album'],//['album', 'camera']
count: 3,
sizeType: ['compressed']
}
const value = await this.chooseImg(options)
self.setTmpValue(value)
//await this.chooseImage('qiniu',config)
//self.setValue()
return
}
// 使用拍照工具拍摄
this.photograph()
this.getWatermark()
},
closeTake(val) {
if(val && val.length > 0){
// val.forEach(item=>{
// this.imgList.push(item)
// })
// const files = val.map(v => {
// return { path: v.path }
// })
const files = val.map(v => v.path)
this.uploadTakeImg(files)
// this.setValue()
}
this.takeStatus = false
},
async uploadTakeImg(files) {
const value = await this.saveToTask(files)
this.setTmpValue(value)
// const options = {
// files:files, // 必填 临时文件路径 格式: [{path: "图片地址"}]
// load: false, //(默认 true 说明:本接口是否提示加载动画)
// maxSize: 300000, //(默认 无 说明:上传的文件最大字节数限制,默认不限制)
// onEachUpdate: res => {
// const value = [uploader.qiniuTokenObj.visitPrefix + res.url]
// this.valueChange(value)
// },
// Update: res => {
// }
// }
// uploader.qnFileUpload(options)
},
photograph(){// 获取拍照规范接口
let self = this
let param = {"partnerCompanyId":self.partnerCompanyId,
"categoryId":self.categoryId,
"brandId":self.brandId,
"fieldName":self.item.fieldsName}
this.$u.api.orderStandardItem(param).then((res)=>{
if (res.code == 200 && res.data.length>0) {
self.currentItemDate = res.data[0]
}else{
console.log("获取完工项的拍照标准异常",res.data.message)
}
self.takeStatus = true
})
},
getWatermark(){
if(getApp().globalData.photo.waterSetting){
return
}
var data={partnerCompanyId:this.partnerCompanyId}
this.$u.api.getWatermark(data).then((res) => {
if (res.code == 200) {
getApp().globalData.photo.waterSetting = res.data
} else {
console.log("获取水印备注异常",res.data.message)
}
});
}*/
}
},
}
</script>
......@@ -263,17 +162,4 @@ export default {
transform: rotate(90deg);
}
}
// .list {
// display: flex;
// .txt {
// color: #666;
// padding: 10rpx;
// &.active {
// background-color: red;
// color: #fff;
// }
// }
// }
</style>
......@@ -39,6 +39,7 @@
style="height: 100%"
scroll-y
scroll-with-animation
scroll-anchoring
class="right-box"
@scroll="rightScroll"
:scroll-into-view="itemId"
......@@ -337,7 +338,6 @@ import XhLabel from '@/components/createCom/XhLabel'
import XhParts from '@/components/createCom/XhParts'
import takePhoto from '@/components/take/index.vue'
import baseFile from '@/components/upload/index'
import Detail from '@/components/order/detail.vue'
// 表单类型map
const formType = new Map([
......@@ -467,9 +467,7 @@ export default {
arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
timer: null, // 定时器
form: {
// 一维表单
},
form: {},
submitBtnStatus: false,
completeCheck: {
status: false,
......@@ -516,7 +514,6 @@ export default {
XhServiceMore,
XhLabel,
XhParts,
Detail,
'take-photo': takePhoto,
},
mixins: [baseFile],
......@@ -629,8 +626,9 @@ export default {
},
initData(res) {
this.form = res.data.value || {}
this.initFormData()
const list = res.data.config.sort((a, b) => a.order - b.order)
this.loadOrderDetail()
const data = Object.create(res.data.config, {})
const list = data.sort((a, b) => a.order - b.order)
if (this.readOnly) this.tabIndex = 0
list.forEach((item, index) => {
if (this.maintainStep === item.panelFieldsName && !this.readOnly) {
......@@ -679,13 +677,10 @@ export default {
}
this.checkCompleteError(list)
} else {
this.list = list
this.list = Object.freeze(list)
}
uni.hideLoading()
},
initFormData() {
this.loadOrderDetail()
},
loadOrderDetail() {
if (
!this.$u.test.isEmpty(this.form) &&
......@@ -754,7 +749,7 @@ export default {
panelName: '异常处理',
items: result,
}
this.list = list
this.list = Object.freeze(list)
this.tabIndex = index
},
......@@ -1327,7 +1322,7 @@ export default {
return
}
}
}, 10)
}, 100)
},
handleTouchstart() {
// 防止输入光标滚动出现错乱
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment