refector: opl创建编辑时图片必填

This commit is contained in:
caoqianming 2023-04-13 14:19:20 +08:00
parent 982a69b65e
commit 1fcca2467a
10 changed files with 223 additions and 150 deletions

View File

@ -137,11 +137,12 @@
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -419,24 +420,29 @@
edit(row) {},
saveSubmit() {
// debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
debugger;
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
that.formData.create_imgs.push(item.response.id)
}
// let imgId = item.response.id?item.response.id:item.id;
// that.formData.create_imgs.push(imgId)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();

View File

@ -136,10 +136,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -291,10 +294,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
})
})
this.getOplcates()
@ -424,21 +424,29 @@
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();

View File

@ -147,10 +147,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -303,10 +306,8 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
})
})
this.getOplcates()
@ -435,21 +436,29 @@
},
edit(row) {},
saveSubmit() {
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
debugger;
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {

View File

@ -146,10 +146,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -283,9 +286,6 @@
Authorization: "Bearer " + this.vuex_token
}
},
imgUpSuccess(data,index,lists){
this.fileList=lists;
},
//operation
getOperation() {
let that = this;
@ -307,10 +307,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
})
})
this.getOplcates()
@ -454,21 +451,29 @@
edit(row) {},
saveSubmit() {
//
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
console.log(1, that.oplCateCode)
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {

View File

@ -145,10 +145,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -301,10 +304,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
})
})
this.getOplcates()
@ -434,21 +434,29 @@
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();

View File

@ -137,11 +137,12 @@
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -284,10 +285,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
id:item.id
})
})
this.getOplcates()
@ -412,22 +410,29 @@
edit(row) {},
saveSubmit() {
// debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
debugger;
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();

View File

@ -136,10 +136,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -291,10 +294,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
id:item.id
})
})
this.getOplcates()
@ -424,21 +424,29 @@
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();

View File

@ -146,10 +146,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -300,10 +303,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
id:item.id
})
})
this.getOplcates()
@ -447,21 +447,29 @@
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();

View File

@ -145,10 +145,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -302,10 +305,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
id:item.id
})
})
this.getOplcates()
@ -449,23 +449,31 @@
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
that.formData.start_time = that.formData.start_time+':00';
that.formData.end_time = that.formData.end_time+':00';
// that.formData.start_time = that.formData.start_time+':00';
// that.formData.end_time = that.formData.end_time+':00';
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();

View File

@ -238,10 +238,13 @@
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">照片</text>
</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
:file-list="fileList" max-count="9"></u-upload>
</view>
</view>
</view>
@ -412,10 +415,7 @@
res.create_imgs_.forEach(item=>{
that.fileList.push({
url: that.vuex_host+item.path,
progress: 0,
id:item.id,
error: false,
file: item
id:item.id
})
})
this.getOplcates()
@ -559,9 +559,6 @@
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
// that.formData.start_time = that.formData.start_time;
@ -570,15 +567,26 @@
// that.formData.power_end_time = that.formData.power_end_time;
// that.formData.work_time = that.formData.work_time;
that.formData.create_imgs = [];
that.fileList.forEach(item=>{
if(item.id){
console.log(item.id);
that.formData.create_imgs.push(item.id)
}else{
console.log(item.response.id)
let files = [];
// filter100(100)
files = this.$refs.uUpload.lists.filter(val => {
return val.progress == 100;
})
files.forEach(item=>{
if(item.response){
that.formData.create_imgs.push(item.response.id)
}else{
that.formData.create_imgs.push(item.id)
}
})
if(that.formData.create_imgs.length === 0){
uni.showToast({
title: '请上传作业准备照片',
icon: 'none'
})
return
}
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();