Commit 8bb09a77 authored by 李苏's avatar 李苏 💬

反馈上传文件

parent 9bff3ea6
......@@ -45,4 +45,13 @@ data: query||{}
})
}
/* 附件list */
export function attachmentList(query) {
return request({
url: '/aqgl/sbgl/sbbyjl/attachment/list',
method: 'post',
data: query||{}
})
}
......@@ -30,6 +30,29 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24" style='padding-left: 120px;padding-bottom: 20px;'>
<!-- 附件-->
<el-upload
:on-success="success"
:data="{groupid:null}"
:headers='headers'
class="upload-demo"
:action="action"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-remove="beforeRemove"
multiple
:limit="6"
:on-exceed="handleExceed"
:file-list="fileList">
<el-button size="mini" type="primary">点击上传</el-button>
</el-upload>
</el-col>
</el-row>
<!-- <el-row :gutter="20">
<el-col :span="12">
<el-form-item label="上次保养记录ID" ref="scbyjlid" prop="scbyjlid">
......@@ -45,8 +68,8 @@
</div>
</DefaultDialog>
</template>
<script>
const baseurl=process.env.VUE_APP_BASE_API
/* 引入需要的接口*/
import {
doQuery,
......@@ -55,7 +78,8 @@
// doDelete
} from '@/api/equipment/sbbyjl.js';
import {
doSave
doSave,
attachmentList
} from "@/api/equipment/sbbymx.js"
/* edit页面*/
import {
......@@ -72,7 +96,12 @@ props:['app'],
},
data() {
return {
readonly:false,
fileList:[],
headers:{Gtoken:sessionStorage.getItem('Gtoken')},
action:baseurl+'/aqgl/sbgl/sbbyjl/attachment/upload',
form: {
//ID
id:'',
//设备ID
......@@ -91,7 +120,26 @@ props:['app'],
}
},
methods: {
success(res,file){
this.fileList.push({
name:file.name,
url:res.data.viewUrl,
id:res.data.id
})
},
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {
console.log('点击上传列表',file,this.fileList);
},
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择6个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`);
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${ file.name }?`);
},
/* 基础查询*/
query: doQuery,
/* treeQuery */
......@@ -104,6 +152,7 @@ props:['app'],
},
save(){
let params={
attachments:this.fileList,
details:[{id:'',records:[]}],
master:{...this.form}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment