diff --git a/src/views/accident/event/components/addOrEdit.vue b/src/views/accident/event/components/addOrEdit.vue
index 0caef1d..b2bf752 100644
--- a/src/views/accident/event/components/addOrEdit.vue
+++ b/src/views/accident/event/components/addOrEdit.vue
@@ -219,7 +219,6 @@ export default {
fileAddressList: fileAddressList
}
this.infoForm.incidentDate = new Date(data.info.incidentDate)
- this.infoForm.reportDate = new Date(data.info.reportDate)
})
}
},
@@ -395,8 +394,7 @@ export default {
analysis: '', // 原因分析及责任认定
suggestions: '', // 考核建议
measures: '', // 整改措施
- creator: '', // 填表人
- reportDate: null // 报出日期
+ creator: '' // 填表人
}
},
@@ -409,7 +407,6 @@ export default {
return false
}
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
- this.infoForm.reportDate = formatDate(this.infoForm.reportDate, 'YYYY-MM-DD HH:mm:ss')
const params = {
...this.infoForm,
photos: this.infoForm.fileList.map(item => item.remotePathName),
diff --git a/src/views/accident/records/components/addOrEdit.vue b/src/views/accident/records/components/addOrEdit.vue
index 9ebe882..487a78d 100644
--- a/src/views/accident/records/components/addOrEdit.vue
+++ b/src/views/accident/records/components/addOrEdit.vue
@@ -67,17 +67,6 @@
-
-
-
{
+ const fileList = []
+ if (data.info.photos != null && data.info.photos !== '') {
+ JSON.parse(data.info.photos).map((item) => {
+ fileList.push({
+ name: 'photo',
+ url: config.fileUrl + item,
+ remotePathName: item
+ })
+ })
+ }
+ const fileAddressList = []
+ if (data.info.attachmentAddress != null && data.info.attachmentAddress !== '') {
+ const names = data.info.attachmentNames == null ? [] : JSON.parse(data.info.attachmentNames)
+ const address = data.info.attachmentAddress == null ? [] : JSON.parse(data.info.attachmentAddress)
+ for (let i = 0; i < address.length; i++) {
+ fileAddressList.push({
+ name: names[i] || '附件',
+ url: config.fileUrl + address[i],
+ remotePathName: address[i]
+ })
+ }
+ }
this.infoForm = {
...data.info,
- fileList: [
- {
- name: 'photo',
- url: config.fileUrl + data.info.photos,
- remotePathName: data.info.photos
- }
- ],
- fileAddressList: [
- {
- name: '附件',
- url: config.fileUrl + data.info.attachmentAddress,
- remotePathName: data.info.attachmentAddress
- }
- ]
- }
- const fileAddress = this.infoForm.fileAddressList[0].remotePathName
- if (fileAddress == null || fileAddress === '') {
- this.infoForm.fileAddressList = []
+ fileList: fileList,
+ fileAddressList: fileAddressList
}
this.infoForm.incidentDate = new Date(data.info.incidentDate)
- this.infoForm.reportDate = new Date(data.info.reportDate)
- }).catch((e) => {
})
}
},
@@ -255,13 +247,13 @@ export default {
/**
* 文件列表移除文件时的钩子
*/
- handleRemovePicture(file) {
+ handleRemovePicture(file, fileList) {
if (file.remotePathName) {
requestFN(`/accident/delete/photos`, {
path: file.remotePathName
}).then((res) => {
if (res.result === 'success') {
- this.infoForm.fileList = []
+ this.infoForm.fileList = fileList
this.$message({
message: '文件删除成功',
type: 'info',
@@ -275,13 +267,13 @@ export default {
/**
* 文件列表移除文件时的钩子
*/
- handleRemoveAnnex(file) {
+ handleRemoveAnnex(file, fileList) {
if (file.remotePathName) {
requestFN(`/accident/delete/photos`, {
path: file.remotePathName
}).then((res) => {
if (res.result === 'success') {
- this.infoForm.fileAddressList = []
+ this.infoForm.fileAddressList = fileList
this.$message({
message: '文件删除成功',
type: 'info',
@@ -300,6 +292,17 @@ export default {
this.dialogImageUrl = file.url
},
+ /**
+ * 点击文件列表中已上传的文件时的钩子
+ */
+ handleDownloadAnnex(file) {
+ var a = document.createElement('a')
+ var event = new MouseEvent('click')
+ a.download = file.name
+ a.href = file.url
+ a.dispatchEvent(event)
+ },
+
/**
* 文件上传失败时的钩子处理
*/
@@ -340,14 +343,11 @@ export default {
formData.append('file', file)
upload('/accident/import/photos', formData).then((data) => {
if (data.result === 'success') {
- this.infoForm = {
- ...this.infoForm,
- fileList: [{
- name: file.name,
- url: config.fileUrl + data.path,
- remotePathName: data.path
- }]
- }
+ this.infoForm.fileList.push({
+ name: file.name,
+ url: config.fileUrl + data.path,
+ remotePathName: data.path
+ })
}
})
return false
@@ -369,14 +369,11 @@ export default {
formData.append('file', file)
upload('/accident/import/photos', formData).then((data) => {
if (data.result === 'success') {
- this.infoForm = {
- ...this.infoForm,
- fileAddressList: [{
- name: file.name,
- url: config.fileUrl + data.path,
- remotePathName: data.path
- }]
- }
+ this.infoForm.fileAddressList.push({
+ name: file.name,
+ url: config.fileUrl + data.path,
+ remotePathName: data.path
+ })
}
})
return false
@@ -416,8 +413,7 @@ export default {
analysis: '', // 原因分析及责任认定
suggestions: '', // 考核建议
measures: '', // 整改措施
- creator: '', // 填表人
- reportDate: null // 报出日期
+ creator: '' // 填表人
}
},
@@ -430,23 +426,21 @@ export default {
return false
}
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
- this.infoForm.reportDate = formatDate(this.infoForm.reportDate, 'YYYY-MM-DD HH:mm:ss')
- const address = this.infoForm.fileAddressList[0]
const params = {
...this.infoForm,
- photos: this.infoForm.fileList[0].remotePathName,
- attachmentAddress: address == null ? '' : address.remotePathName,
+ photos: this.infoForm.fileList.map(item => item.remotePathName),
+ attachmentAddress: this.infoForm.fileAddressList.map(item => item.remotePathName),
+ attachmentNames: this.infoForm.fileAddressList.map(item => item.name),
type: 2
}
delete params.fileList
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
- .then((response) => {
+ .then(() => {
// 删除成功后的处理
this.$message.success(this.tableName + '成功')
this.infoForm = this.$options.data().infoForm
this.$parent.activeName = 'List'
- // eslint-disable-next-line handle-callback-err
- }).catch((error) => {
+ }).catch(() => {
this.$message.error(this.tableName + '失败')
})
})