巡检任务图片上传逻辑修改

master
jinna 11 months ago
parent 726469d4ea
commit 82e7a4048b
  1. 36
      src/views/businessManagement/inspection/task.vue
  2. 10
      src/views/device/deviceSystem.vue

@ -183,7 +183,7 @@
</span>
</el-dialog>
<el-dialog class="inspectionDialog" :title="dialogTitle" :visible.sync="dialogInspection" :append-to-body="true"
width="70%" :close-on-click-modal="false">
width="70%" :close-on-click-modal="false" custom-class="task_dialog">
<div style="height: 500px; overflow: auto">
<el-form ref="inspectionForm" :model="inspectionForm" :rules="inspectionRules" label-width="120px"
label-position="left">
@ -276,10 +276,10 @@
</el-table-column>
<el-table-column prop="imgs" align="center" label="现场照片">
<template slot-scope="scope">
<el-upload list-type="picture-card" v-show="dialogTitle != '巡检确认'" :disabled="dialogTitle == '巡检确认'||scope.row.picUrl != ''"
<el-upload list-type="picture-card" v-show="dialogTitle != '巡检确认'" :disabled="dialogTitle == '巡检确认'" :class="scope.row.picUrl != '' ? 'exceed' : ''"
class="upload-demo" action="/api/blade-resource/oss/endpoint/put-file"
:on-success="handleSuccess(scope.row)" :on-remove="handleRemove(scope.row)" :headers="headers"
:limit="1" :on-exceed="handleExceed" :file-list="scope.row.fileList" :before-upload="beforeAvatarUpload(index,scope.row.fileList)">
:limit="1" :file-list="scope.row.fileList" :before-upload="beforeAvatarUpload(index,scope.row.fileList)">
<i class="el-icon-plus"></i>
</el-upload>
<img @click="clickImg(scope.row.picUrl)" style="width: 200px;height: 200px;cursor: pointer;"
@ -765,6 +765,7 @@ export default {
clickFloor(val) {
console.log('val----------->', val)
this.inspectionForm.tableData = this.inspectionTable
console.log('inspectionTable===================>',this.inspectionTable)
this.deviceName = ''
// this.activeFloor = val.value
this.activeFloorName = val
@ -773,6 +774,7 @@ export default {
this.activeRoom = this.roomArr[0]
let firstRoom = firstFloor.details.find(item => item.deptName == this.activeRoom)
this.tableData = firstRoom.details
this.$forceUpdate()
},
clickRoom(val) {
this.activeRoom = val
@ -1270,7 +1272,6 @@ export default {
//
handleSuccess(val) {
return (response, file, fileList) => {
console.log('val==========>', val)
// this.inspectionForm.tableData[index].picUrl = response.data.link
val.picUrl = response.data.link
val.fileList = [
@ -1279,17 +1280,34 @@ export default {
name: response.data.originalName
}
]
this.inspectionTable.map(item =>{
if(item.id == val.id){
item.fileList = [
{
url: response.data.link,
name: response.data.originalName
}
]
item.picUrl = response.data.link
}
})
}
},
getRowKeys(row) {
return row.id
},
//
handleRemove(index) {
handleRemove(val) {
return (file, fileList) => {
// this.inspectionForm.tableData[index].picUrl = ''
val.picUrl = ''
val.fileList = []
this.inspectionTable.map(item =>{
if(item.id == val.id){
item.fileList = []
item.picUrl = ''
}
})
}
},
beforeAvatarUpload(index,list){
@ -1414,4 +1432,12 @@ export default {
}
}
}
.task_dialog{
.exceed{
.el-upload{
display: none;
}
}
}
</style>

@ -156,7 +156,7 @@
<!-- :limit="3" -->
<el-upload class="upload-demo" action="/api/blade-resource/oss/endpoint/put-file"
:on-success="handleSuccess" :on-remove="handleRemove" multiple :disabled="viewType == 'view'"
accept=".jpeg,.jpg,.png,.pdf" :on-exceed="handleExceed" :file-list="imgList">
accept=".jpeg,.jpg,.png,.pdf" :on-exceed="handleExceed" :file-list="imgList" :headers="headers">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">支持上传jpegjpgpdf文件且不超过10M</div>
</el-upload>
@ -318,6 +318,8 @@
</template>
<script>
import website from '@/config/website';
import { getToken, removeToken, removeRefreshToken } from '@/util/auth';
import printJS from 'print-js'
import { mapGetters } from "vuex";
import requestSub from '../components/requestSub.vue'
@ -345,6 +347,7 @@ export default {
tableData: [],
searchForm: {},
selectionList: [],
headers:{},
option: {
height: "auto",
calcHeight: 30,
@ -603,6 +606,11 @@ export default {
this.repairPersonList = res.data.data
})
this.headers = {
"Authorization": `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`,
'Blade-Auth': 'bearer ' + getToken(),
'Blade-Requested-With': 'BladeHttpRequest'
}
this.onLoad()
},
methods: {

Loading…
Cancel
Save