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

反馈上传文件

parent 9bff3ea6
...@@ -45,4 +45,13 @@ data: query||{} ...@@ -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 @@ ...@@ -30,6 +30,29 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </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-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上次保养记录ID" ref="scbyjlid" prop="scbyjlid"> <el-form-item label="上次保养记录ID" ref="scbyjlid" prop="scbyjlid">
...@@ -45,8 +68,8 @@ ...@@ -45,8 +68,8 @@
</div> </div>
</DefaultDialog> </DefaultDialog>
</template> </template>
<script> <script>
const baseurl=process.env.VUE_APP_BASE_API
/* 引入需要的接口*/ /* 引入需要的接口*/
import { import {
doQuery, doQuery,
...@@ -55,7 +78,8 @@ ...@@ -55,7 +78,8 @@
// doDelete // doDelete
} from '@/api/equipment/sbbyjl.js'; } from '@/api/equipment/sbbyjl.js';
import { import {
doSave doSave,
attachmentList
} from "@/api/equipment/sbbymx.js" } from "@/api/equipment/sbbymx.js"
/* edit页面*/ /* edit页面*/
import { import {
...@@ -72,7 +96,12 @@ props:['app'], ...@@ -72,7 +96,12 @@ props:['app'],
}, },
data() { data() {
return { return {
readonly:false,
fileList:[],
headers:{Gtoken:sessionStorage.getItem('Gtoken')},
action:baseurl+'/aqgl/sbgl/sbbyjl/attachment/upload',
form: { form: {
//ID //ID
id:'', id:'',
//设备ID //设备ID
...@@ -91,7 +120,26 @@ props:['app'], ...@@ -91,7 +120,26 @@ props:['app'],
} }
}, },
methods: { 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, query: doQuery,
/* treeQuery */ /* treeQuery */
...@@ -104,6 +152,7 @@ props:['app'], ...@@ -104,6 +152,7 @@ props:['app'],
}, },
save(){ save(){
let params={ let params={
attachments:this.fileList,
details:[{id:'',records:[]}], details:[{id:'',records:[]}],
master:{...this.form} 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