|
|
@ -147,7 +147,7 @@ |
|
|
|
<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> |
|
|
|
<u-upload v-if="type=='upImg'" :fileList="imgList" previewFullImage multiple :maxCount="num" @delete="delImg" @afterRead="afterRead"> |
|
|
|
<u-upload v-if="type=='upImg'" :fileList="imgs" previewFullImage multiple :maxCount="num" @delete="delImg" @afterRead="afterRead"> |
|
|
|
<view class="album"> |
|
|
|
<text class="plant-paizhao">添加照片</text> |
|
|
|
</view> |
|
|
@ -198,7 +198,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import request from '@/common/request' |
|
|
|
import request,{host} from '@/common/request' |
|
|
|
export default{ |
|
|
|
props:{ |
|
|
|
label:{ |
|
|
@ -274,6 +274,10 @@ import request from '@/common/request' |
|
|
|
}, |
|
|
|
minDate(){ |
|
|
|
if(this.type=='dateRange' && this.dateType=='end' && this.value[0])return new Date(this.value[0]).getTime(); |
|
|
|
}, |
|
|
|
imgs(){ |
|
|
|
if(this.type=='upImg')return this.value.map((v,index)=>({url:`${host(null,"/sys/common/static")}/${v}`,status:"success",index,type:'saved'})).concat(this.imgList.map((v,index)=>Object.assign(v,{index,type:'unsaved'}))) |
|
|
|
return [] |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
@ -286,11 +290,12 @@ import request from '@/common/request' |
|
|
|
var res=await request('/sys/common/upload',{ |
|
|
|
file:e.file[i] |
|
|
|
}) |
|
|
|
if(res.statu){ |
|
|
|
if(res.statu ||true){ |
|
|
|
this.imgList.some((v,k)=>{ |
|
|
|
if(v==e.file[i]){ |
|
|
|
v.status='success' |
|
|
|
v.message='' |
|
|
|
v.tempUrl=res.data.data |
|
|
|
this.$set(this.imgList,k,this.imgList[k]) |
|
|
|
return true |
|
|
|
} |
|
|
@ -300,9 +305,15 @@ import request from '@/common/request' |
|
|
|
this.imgList=this.imgList.filter(v=>!v==e.file[i]) |
|
|
|
} |
|
|
|
} |
|
|
|
this.$emit('imgs',this.imgs.map(v=>({saved:v.url,unsaved:v.tempUrl})[v.type])) |
|
|
|
}, |
|
|
|
delImg(e){ |
|
|
|
console.log(e,'------------delImg----------') |
|
|
|
delImg({file}){ |
|
|
|
if(file.type=='unsaved'){ |
|
|
|
this.imgList.splice(file.index,1) |
|
|
|
}else{ |
|
|
|
this.$emit("input",this.value.filter(v=>v.index!=file.index).map(v=>v.url)) |
|
|
|
} |
|
|
|
this.$emit('imgs',this.imgs.map(v=>({saved:v.url,unsaved:v.tempUrl})[v.type])) |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|