|
|
@@ -114,22 +114,8 @@
|
|
|
<van-field class="textarea" :rules="[{ required: true}]" v-model="form.remark" rows="1" type="textarea" placeholder="请输入随访记录" />
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
- <van-row class="cell">
|
|
|
- <van-col span="6">图片视频:</van-col>
|
|
|
- <van-col span="18">
|
|
|
- <div class="box" ref="boxlist">
|
|
|
- <div class="boxlist">
|
|
|
- <div v-for="(item,index) in form.fileList" :key="index">
|
|
|
- <img v-if="item.type.indexOf('image') !== -1" :src="item.url" alt="">
|
|
|
- <video v-else style="object-fit:cover;" :src="item.url" poster='../../assets/video.png'></video>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <van-uploader v-model="fileList" accept="*" :after-read="afterRead" @delete='deleteUploader'>
|
|
|
- </van-uploader>
|
|
|
- </div>
|
|
|
-
|
|
|
- </van-col>
|
|
|
- </van-row>
|
|
|
+ <vanUploader :text="'图片'" @getfileList="getfileList"></vanUploader>
|
|
|
+ <vanUploader :text="'视频'" @getfileList="getfileList"></vanUploader>
|
|
|
<div style="text-align:center;">
|
|
|
<van-button native-type="submit" :disabled="disabled">确 定</van-button>
|
|
|
</div>
|
|
|
@@ -145,7 +131,9 @@ import {
|
|
|
uploadImage,
|
|
|
listChildInfoByName,
|
|
|
} from '../../api/index.js'
|
|
|
+import vanUploader from '../../components/vanUploader.vue'
|
|
|
export default {
|
|
|
+ components: { vanUploader },
|
|
|
data() {
|
|
|
return {
|
|
|
show: false,
|
|
|
@@ -162,6 +150,8 @@ export default {
|
|
|
maxDate: new Date(2025, 10, 1),
|
|
|
positionSearch: '',
|
|
|
childList: [],
|
|
|
+ pics: [],
|
|
|
+ videos: [],
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
@@ -233,11 +223,12 @@ export default {
|
|
|
this.show = false
|
|
|
},
|
|
|
async saveFollowUp(values) {
|
|
|
- var appendFile = []
|
|
|
- this.form.fileList.forEach((item) => {
|
|
|
- appendFile.push(item.url)
|
|
|
- })
|
|
|
- this.form.appendFile = appendFile.join(',')
|
|
|
+ if (this.pics.length == 0) {
|
|
|
+ this.$toast.fail('请选择至少一张图片')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.form.pics = this.pics.join(',')
|
|
|
+ this.form.videos = this.videos.join(',')
|
|
|
var data = JSON.parse(JSON.stringify(this.form))
|
|
|
data.followDate = data.followDate + ' 00:00:00'
|
|
|
const res = await saveFollowUp(data)
|
|
|
@@ -251,35 +242,21 @@ export default {
|
|
|
this.streetList = res.data
|
|
|
},
|
|
|
getPositionList() {},
|
|
|
- async afterRead(file) {
|
|
|
- console.log(file, 'file')
|
|
|
- file.status = 'uploading'
|
|
|
- file.message = '上传中...'
|
|
|
- let formDate = new FormData()
|
|
|
- //添加入参
|
|
|
- formDate.append('file', file.file)
|
|
|
- const res = await uploadImage(formDate)
|
|
|
- if (res.code == '0000') {
|
|
|
- file.status = 'success'
|
|
|
- file.message = '成功'
|
|
|
- this.form.fileList.push({
|
|
|
- url: res.data,
|
|
|
- type: file.file.type,
|
|
|
- })
|
|
|
- // 上传图片 设置col高度
|
|
|
- if (this.form.fileList.length % 2 == 0) {
|
|
|
- var index = 3.2 * (this.form.fileList.length / 2 + 1) + 'rem'
|
|
|
- this.$refs.boxlist.style.height = index
|
|
|
+ getfileList(v, index) {
|
|
|
+ if (index == undefined) {
|
|
|
+ if (v.indexOf('.png') != -1 || v.indexOf('.jpg') != -1) {
|
|
|
+ this.pics.push(v)
|
|
|
+ } else {
|
|
|
+ this.videos.push(v)
|
|
|
}
|
|
|
} else {
|
|
|
- file.status = 'failed'
|
|
|
- file.message = '上传失败'
|
|
|
+ if (v == '图片') {
|
|
|
+ this.pics.splice(index, 1)
|
|
|
+ } else {
|
|
|
+ this.videos.splice(index, 1)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- deleteUploader(v, index) {
|
|
|
- console.log(index)
|
|
|
- this.form.fileList.splice(index.index, 1)
|
|
|
- },
|
|
|
},
|
|
|
}
|
|
|
</script>
|