|
@@ -81,6 +81,38 @@
|
|
|
<a-textarea
|
|
|
v-decorator="['remark']" />
|
|
|
</a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ label="图片"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-upload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :multiple="true"
|
|
|
+ list-type="picture"
|
|
|
+ :file-list="defaultImageList"
|
|
|
+ @change="handleImageFileChange"
|
|
|
+ accept="image/*"
|
|
|
+ :headers="headers"
|
|
|
+ >
|
|
|
+ <a-button> <a-icon type="upload" /> 上传图片 </a-button>
|
|
|
+ </a-upload>
|
|
|
+ </a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ label="附件"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-upload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :multiple="true"
|
|
|
+ :file-list="defaultFileList"
|
|
|
+ @change="handleFileChange"
|
|
|
+ :headers="headers"
|
|
|
+ >
|
|
|
+ <a-button> <a-icon type="upload" /> 上传文件 </a-button>
|
|
|
+ </a-upload>
|
|
|
+ </a-form-item>
|
|
|
</a-form>
|
|
|
<template slot="footer">
|
|
|
<a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
|
|
@@ -91,6 +123,9 @@
|
|
|
<script>
|
|
|
import pick from 'lodash.pick'
|
|
|
import { addRepairFee, updateRepairFee } from '@/api/repair/fee'
|
|
|
+import { uploadUrl } from '@/api/upms/file'
|
|
|
+import Vue from 'vue'
|
|
|
+import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
|
|
|
export default {
|
|
|
name: 'BaseRepairFee',
|
|
@@ -98,6 +133,14 @@ export default {
|
|
|
return {
|
|
|
confirmLoading: false,
|
|
|
modalTitle: null,
|
|
|
+ defaultImageList: [],
|
|
|
+ imageList: [],
|
|
|
+ defaultFileList: [],
|
|
|
+ fileList: [],
|
|
|
+ uploadUrl: uploadUrl,
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
|
|
|
+ },
|
|
|
form: this.$form.createForm(this),
|
|
|
visible: false,
|
|
|
// 下拉框map
|
|
@@ -122,9 +165,17 @@ export default {
|
|
|
'repairNo': repairForm.no
|
|
|
})
|
|
|
})
|
|
|
+ this.imageList = []
|
|
|
+ this.fileList = []
|
|
|
+ this.defaultImageList = []
|
|
|
+ this.defaultFileList = []
|
|
|
this.modalTitle = '添加'
|
|
|
return
|
|
|
}
|
|
|
+ this.imageList = record.imageList
|
|
|
+ this.fileList = record.fileList
|
|
|
+ this.defaultImageList = this.BaseTool.UPLOAD.transImg(this.imageList)
|
|
|
+ this.defaultFileList = this.BaseTool.UPLOAD.transImg(this.fileList)
|
|
|
this.modalTitle = '编辑'
|
|
|
// 日期处理
|
|
|
this.$nextTick(() => {
|
|
@@ -148,6 +199,9 @@ export default {
|
|
|
this.confirmLoading = false
|
|
|
return
|
|
|
}
|
|
|
+ // 上传文件
|
|
|
+ values.imageList = this.imageList
|
|
|
+ values.fileList = this.fileList
|
|
|
// 日期处理
|
|
|
if (this.BaseTool.String.isBlank(values.id)) {
|
|
|
addRepairFee(values)
|
|
@@ -166,6 +220,26 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ handleImageFileChange (info) {
|
|
|
+ this.defaultImageList = info.fileList
|
|
|
+ this.imageList = this.setFileList(info, 18)
|
|
|
+ },
|
|
|
+ handleFileChange (info) {
|
|
|
+ this.defaultFileList = info.fileList
|
|
|
+ this.fileList = this.setFileList(info, 18)
|
|
|
+ },
|
|
|
+ setFileList (info, type) {
|
|
|
+ const file = info.file
|
|
|
+ const fileList = info.fileList
|
|
|
+ if (file.status === 'done') {
|
|
|
+ return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
|
|
|
+ } else if (file.status === 'removed') {
|
|
|
+ return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
|
|
|
+ } else if (file.status === 'error') {
|
|
|
+ this.$message.error('上传失败')
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ },
|
|
|
handleCancel (values) {
|
|
|
this.visible = false
|
|
|
this.confirmLoading = false
|