|
@@ -31,6 +31,25 @@
|
|
|
<a-textarea v-decorator="['finishContent']"/>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="相关图片"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol2"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol2"
|
|
|
+ >
|
|
|
+ <a-upload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :multiple="true"
|
|
|
+ list-type="picture"
|
|
|
+ :file-list="defaultRepairFileList"
|
|
|
+ @change="handleRepairFileChange"
|
|
|
+ accept="image/*"
|
|
|
+ :headers="headers"
|
|
|
+ >
|
|
|
+ <a-button> <a-icon type="upload" /> 上传图片 </a-button>
|
|
|
+ </a-upload>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
</row-list>
|
|
|
</a-form>
|
|
|
<template slot="footer">
|
|
@@ -44,7 +63,9 @@
|
|
|
<script>
|
|
|
import pick from 'lodash.pick'
|
|
|
import { finish } from '@/api/preparation/preparation'
|
|
|
-
|
|
|
+import { uploadUrl } from '@/api/upms/file'
|
|
|
+import Vue from 'vue'
|
|
|
+import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
export default {
|
|
|
name: 'FinishForm',
|
|
|
data () {
|
|
@@ -53,7 +74,13 @@ export default {
|
|
|
confirmLoading: false,
|
|
|
modalTitle: null,
|
|
|
form: this.$form.createForm(this),
|
|
|
- visible: false
|
|
|
+ visible: false,
|
|
|
+ uploadUrl: uploadUrl,
|
|
|
+ // 下拉框map
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
|
|
|
+ },
|
|
|
+ defaultRepairFileList: []
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
@@ -69,6 +96,7 @@ export default {
|
|
|
this.model = record
|
|
|
this.modalTitle = '完成工单'
|
|
|
const { form: { setFieldsValue } } = this
|
|
|
+ this.defaultRepairFileList = this.BaseTool.UPLOAD.transImg(this.repairFileList)
|
|
|
this.$nextTick(() => {
|
|
|
setFieldsValue(Object.assign(pick(record, [
|
|
|
'id',
|
|
@@ -84,6 +112,8 @@ export default {
|
|
|
this.confirmLoading = false
|
|
|
return
|
|
|
}
|
|
|
+ // 日期处理
|
|
|
+ values.imageList = this.repairFileList
|
|
|
finish(values).then(() => {
|
|
|
this.$message.info('完成工单')
|
|
|
this.handleCancel(values)
|
|
@@ -92,6 +122,10 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ handleRepairFileChange (info) {
|
|
|
+ this.defaultRepairFileList = info.fileList
|
|
|
+ this.repairFileList = this.setFileList(info, 12)
|
|
|
+ },
|
|
|
handleCancel (values) {
|
|
|
this.visible = false
|
|
|
this.confirmLoading = false
|
|
@@ -101,6 +135,18 @@ export default {
|
|
|
} else {
|
|
|
this.$emit('ok')
|
|
|
}
|
|
|
+ },
|
|
|
+ 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 []
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|