1.还原隐患验收图片不能上传问题

hyx_2024-10-30_new
guoyuepeng 2024-09-26 16:22:49 +08:00
parent 92b6345e62
commit ff4e34a9b6
1 changed files with 24 additions and 137 deletions

View File

@ -33,46 +33,25 @@
<el-form-item :rules="form.IS_NORMAL =='1' ?formRule.RECTIFICATIONTIME:[{required: false}]" label="整改时间" prop="RECTIFICATIONTIME"> <el-form-item :rules="form.IS_NORMAL =='1' ?formRule.RECTIFICATIONTIME:[{required: false}]" label="整改时间" prop="RECTIFICATIONTIME">
<el-date-picker v-model="form.RECTIFICATIONTIME" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期" /> <el-date-picker v-model="form.RECTIFICATIONTIME" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期" />
</el-form-item> </el-form-item>
<!-- <el-form-item :rules="[{required: true}]" label="整改后图片" label-width="100px">-->
<!-- <el-upload-->
<!-- ref="zhenggaiupload"-->
<!-- :class="{hide:hideUpload}"-->
<!-- :file-list="rectify_files"-->
<!-- :on-remove="handleRemove"-->
<!-- :on-change="handleChangeIMG"-->
<!-- :limit="4"-->
<!-- :on-preview="handlePictureCardPreview"-->
<!-- :before-upload="beforeFileUpload"-->
<!-- :auto-upload="false"-->
<!-- class="avatar-uploader"-->
<!-- action="#"-->
<!-- accept=".jpg,.jpeg,.png"-->
<!-- list-type="picture-card">-->
<!-- <i class="el-icon-plus" />-->
<!-- </el-upload>-->
<!-- <el-dialog :visible.sync="dialogImageVisible">-->
<!-- <img :src="dialogImageUrl" width="100%" alt="">-->
<!-- </el-dialog>-->
<!-- </el-form-item>-->
<el-form-item :rules="[{required: true}]" label="整改后图片" label-width="100px"> <el-form-item :rules="[{required: true}]" label="整改后图片" label-width="100px">
<div class="parentBox"> <el-upload
<el-upload ref="zhenggaiupload"
:class="{hideShow: hideUpload}" :class="{hide:hideUpload}"
:multiple="true" :on-remove="handleRemove"
:on-exceed="onExceed" :on-change="handleChangeIMG"
:on-remove="handleRemove" :limit="4"
:limit="limit" :on-preview="handlePictureCardPreview"
:before-upload="beforeUpload" :before-upload="beforeFileUpload"
:http-request="uploadFiles" :auto-upload="false"
:on-preview="handlePictureCardPreview" class="avatar-uploader"
action="" action="#"
list-type="picture-card"> accept=".jpg,.jpeg,.png"
<i class="el-icon-plus"/> list-type="picture-card">
</el-upload> <i class="el-icon-plus" />
<el-dialog :visible.sync="dialogVisible"> </el-upload>
<img :src="imgUrl" width="100%"> <el-dialog :visible.sync="dialogImageVisible">
</el-dialog> <img :src="dialogImageUrl" width="100%" alt="">
</div> </el-dialog>
</el-form-item> </el-form-item>
<div v-if="pd.ISCONFIRM=='0'"> <div v-if="pd.ISCONFIRM=='0'">
<div class="form-flex"> <div class="form-flex">
@ -215,13 +194,11 @@ export default {
INVESTMENT_FUNDS: '', // INVESTMENT_FUNDS: '', //
RECTIFICATIONTIME: ''// RECTIFICATIONTIME: ''//
}, },
imgUrl: '',
rectify_files: [], rectify_files: [],
hideUpload: false, // hideUpload: false, //
dialogImageVisible: false, // dialogImageVisible: false, //
dialogImageUrl: '', // dialogImageUrl: '', //
scheme_files: [], // scheme_files: [], //
temporaryFilePath: [],
formRule: { formRule: {
RECTIFICATIONDEPT: [{ required: true, message: '请选择整改部门', trigger: 'blur' }], RECTIFICATIONDEPT: [{ required: true, message: '请选择整改部门', trigger: 'blur' }],
RECTIFICATIONOR: [{ required: true, message: '请选择整改人', trigger: 'blur' }], RECTIFICATIONOR: [{ required: true, message: '请选择整改人', trigger: 'blur' }],
@ -275,53 +252,6 @@ export default {
this.getEditMyInfo() this.getEditMyInfo()
}, },
methods: { methods: {
uploadFiles(file) {
//
if (this.beforeUpload(file.file)) {
this.formData = new FormData()
this.formData.append('FFILE', file.file)
//
upload(
'/mfolder/upLoadTemporary',
this.formData
).then((data) => {
if (data.result == 'success') {
this.$message({
message: '保存成功',
type: 'success'
})
this.loading = false
this.temporaryFilePath.push(data.temporaryFilePath)
console.info('this.temporaryFilePath========' + this.temporaryFilePath)
} else {
this.$message({
message: data.exception,
type: 'error'
})
this.loading = false
}
}).catch((e) => {
this.listLoading = false
this.loading = false
})
}
},
//
beforeUpload(file) {
if (file.size > 10 * 1024 * 1024) {
this.$message('文件过大请上传小于10MB的文件〜')
return false
}
return true
},
//
imageRemove() {
this.imgUrl = ''
this.$message({
message: '删除图片成功',
type: 'success'
})
},
getEditMyInfo: function() { getEditMyInfo: function() {
requestFN( requestFN(
'/user/goEditMyInfo', '/user/goEditMyInfo',
@ -484,8 +414,7 @@ export default {
}, },
saveRectify() { // saveRectify() { //
this.loading = true this.loading = true
// if (this.$refs.zhenggaiupload.uploadFiles.length < 1) { if (this.$refs.zhenggaiupload.uploadFiles.length < 1) {
if (this.temporaryFilePath.length < 1) {
this.$message({ this.$message({
message: '请上传整改后照片', message: '请上传整改后照片',
type: 'error' type: 'error'
@ -612,24 +541,16 @@ export default {
text: '加载中......', text: '加载中......',
background: 'rgba(0,0,0,0.5)' background: 'rgba(0,0,0,0.5)'
}) })
// this.$refs.zhenggaiupload.submit() this.$refs.zhenggaiupload.submit()
var todata = new FormData() var todata = new FormData()
for (var i = 0; i < _this.temporaryFilePath.length; i++) { for (var i = 0; i < _this.rectify_files.length; i++) {
if (_this.temporaryFilePath[i]) { if (_this.rectify_files[i]) {
todata.append('temporaryFilePath', _this.temporaryFilePath[i]) todata.append('FFILE', _this.rectify_files[i])
} }
} }
if (!todata.get('temporaryFilePath')) { if (!todata.get('FFILE')) {
return return
} }
// for (var i = 0; i < _this.rectify_files.length; i++) {
// if (_this.rectify_files[i]) {
// todata.append('FFILE', _this.rectify_files[i])
// }
// }
// if (!todata.get('FFILE')) {f
// return
// }
todata.append('FOREIGN_KEY', this.HIDDEN_ID) todata.append('FOREIGN_KEY', this.HIDDEN_ID)
todata.append('TYPE', 4) todata.append('TYPE', 4)
upload( upload(
@ -682,7 +603,6 @@ export default {
} }
todata.append('FOREIGN_KEY', this.HIDDEN_ID) todata.append('FOREIGN_KEY', this.HIDDEN_ID)
todata.append('TYPE', 8) todata.append('TYPE', 8)
todata.append('temporaryFilePath', this.temporaryFilePath)
upload( upload(
'/imgfiles/add', '/imgfiles/add',
todata todata
@ -764,39 +684,6 @@ export default {
this.scheme_files.push(file) this.scheme_files.push(file)
} }
}, },
submitUpload() {
var _this = this
this.$refs.zhenggaiupload.submit()
var todata = new FormData()
for (var i = 0; i < _this.rectify_files.length; i++) {
if (_this.rectify_files[i]) {
todata.append('FFILE', _this.rectify_files[i])
}
}
console.log(todata)
upload(
'/mfolder/upLoadTemporary',
todata
).then((data) => {
if (data.result == 'success') {
this.$message({
message: '保存成功',
type: 'success'
})
this.loading = false
this.temporaryFilePath = data.temporaryFilePath
} else {
this.$message({
message: data.exception,
type: 'error'
})
this.loading = false
}
}).catch((e) => {
this.listLoading = false
this.loading = false
})
},
back() { back() {
this.$parent.activeName = 'List' this.$parent.activeName = 'List'
} }