|
|
@ -48,18 +48,27 @@ |
|
|
|
color:rgb(48,49,51); |
|
|
|
} |
|
|
|
} |
|
|
|
.upImg{ |
|
|
|
width:100%; |
|
|
|
.u-upload{ |
|
|
|
background:#F7F7F7; |
|
|
|
border-radius: 8rpx; |
|
|
|
padding:20rpx; |
|
|
|
min-height:260rpx; |
|
|
|
margin-top:14rpx; |
|
|
|
display:flex; |
|
|
|
flex-wrap: wrap; |
|
|
|
&>.album{ |
|
|
|
align-content: flex-start; |
|
|
|
&/deep/ .u-upload__wrap__preview{ |
|
|
|
border-radius: 10rpx; |
|
|
|
&>.u-upload__wrap__preview__image{ |
|
|
|
height:170rpx!important; |
|
|
|
width:170rpx!important; |
|
|
|
} |
|
|
|
&>.u-upload__deletable{ |
|
|
|
width:30rpx; |
|
|
|
height:30rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
.album{ |
|
|
|
background:#fff; |
|
|
|
border-radius: 24rpx; |
|
|
|
border-radius: 20rpx; |
|
|
|
width:170rpx; |
|
|
|
height:170rpx; |
|
|
|
text{ |
|
|
@ -122,7 +131,7 @@ |
|
|
|
font-size:20rpx; |
|
|
|
color:#FBA83C; |
|
|
|
} |
|
|
|
&/deep/>.u-form-item__body__right__message{ |
|
|
|
&/deep/ .u-form-item__body__right__message{ |
|
|
|
margin-left:0!important; |
|
|
|
} |
|
|
|
} |
|
|
@ -138,11 +147,11 @@ |
|
|
|
<button v-if="btnText" @click="btnFun" class="cu-btn bg-green shadow">{{btnText}}</button> |
|
|
|
</view> |
|
|
|
<view v-if="type=='select'" class="plant-youbian" :class="{noData:!/^\d+$/.test(value)}" @click="show=true">{{/^\d+$/.test(value)&&columns[0][value][keyName]||placeholder||`请选择${label}`}}</view> |
|
|
|
<view v-if="type=='upImg'" class="upImg"> |
|
|
|
<view class="album" @click="selectImg"> |
|
|
|
<u-upload v-if="type=='upImg'" :fileList="imgList" previewFullImage multiple :maxCount="num" @delete="delImg" @afterRead="afterRead"> |
|
|
|
<view class="album"> |
|
|
|
<text class="plant-paizhao">添加照片</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-upload> |
|
|
|
<textarea v-if="type=='textarea'" auto-height :value="value" :placeholder="placeholder||`请输入${label}`" @input="$emit('input',e)"/> |
|
|
|
<view v-if="type=='dateRange'" class="dateRange"> |
|
|
|
<text style="margin-right:20rpx;" :class="{noData:!value[0]}" @click="dateType='start';show=true">{{value[0]||startPlaceholder||'开始时间'}}</text> |
|
|
@ -173,6 +182,8 @@ |
|
|
|
:show="show" |
|
|
|
mode="date" |
|
|
|
:value="date" |
|
|
|
:maxDate="maxDate" |
|
|
|
:minDate="minDate" |
|
|
|
closeOnClickOverlay |
|
|
|
@close="show=false" |
|
|
|
@cancel="show=false" |
|
|
@ -250,37 +261,49 @@ import request from '@/common/request' |
|
|
|
downValue:[], |
|
|
|
show:false, |
|
|
|
dateType:"start", |
|
|
|
imgList:[], |
|
|
|
} |
|
|
|
}, |
|
|
|
computed:{ |
|
|
|
date(){ |
|
|
|
if(this.dateType=='start')return this.value[0]||new Date().format('yyyy-MM-dd'); |
|
|
|
else return this.value[1]||new Date().format('yyyy-MM-dd'); |
|
|
|
}, |
|
|
|
maxDate(){ |
|
|
|
if(this.type=='dateRange' && this.dateType=='start' && this.value[1])return new Date(this.value[1]).getTime(); |
|
|
|
}, |
|
|
|
minDate(){ |
|
|
|
if(this.type=='dateRange' && this.dateType=='end' && this.value[0])return new Date(this.value[0]).getTime(); |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
async selectImg(){ |
|
|
|
var res=await uni.chooseImage({ |
|
|
|
count:this.num-this.value.length, |
|
|
|
sizeType:['compressed'], |
|
|
|
}) |
|
|
|
if(/ok/.test(res[1].errMsg)){ |
|
|
|
console.log(res[1].tempFiles.map(v=>v.name),'---asfd-----') |
|
|
|
var upImg=await request("/sys/common/uploadBatch",{ |
|
|
|
file:res[1].tempFiles, |
|
|
|
body:{ |
|
|
|
name:res[1].tempFiles.map(v=>v.name) |
|
|
|
async afterRead(e){ |
|
|
|
this.imgList=this.imgList.concat(e.file.map(v=>Object.assign(v,{ |
|
|
|
status: 'uploading', |
|
|
|
message:"上传中", |
|
|
|
}))) |
|
|
|
for(var i=0; i<e.file.length;i++){ |
|
|
|
var res=await request('/sys/common/upload',{ |
|
|
|
file:e.file[i] |
|
|
|
}) |
|
|
|
if(res.statu){ |
|
|
|
this.imgList.some((v,k)=>{ |
|
|
|
if(v==e.file[i]){ |
|
|
|
v.status='success' |
|
|
|
v.message='' |
|
|
|
this.$set(this.imgList,k,this.imgList[k]) |
|
|
|
return true |
|
|
|
} |
|
|
|
return false |
|
|
|
}) |
|
|
|
console.log(upImg,"-----333333------------") |
|
|
|
}else{ |
|
|
|
uni.showModal({ |
|
|
|
title:"提示", |
|
|
|
content:res.msg||"选取图片失败!", |
|
|
|
showCancel:false, |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
this.imgList=this.imgList.filter(v=>!v==e.file[i]) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
delImg(e){ |
|
|
|
console.log(e,'------------delImg----------') |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
</script> |