parent
4e8847f93f
commit
d07a03293d
|
@ -219,7 +219,6 @@ export default {
|
||||||
fileAddressList: fileAddressList
|
fileAddressList: fileAddressList
|
||||||
}
|
}
|
||||||
this.infoForm.incidentDate = new Date(data.info.incidentDate)
|
this.infoForm.incidentDate = new Date(data.info.incidentDate)
|
||||||
this.infoForm.reportDate = new Date(data.info.reportDate)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -395,8 +394,7 @@ export default {
|
||||||
analysis: '', // 原因分析及责任认定
|
analysis: '', // 原因分析及责任认定
|
||||||
suggestions: '', // 考核建议
|
suggestions: '', // 考核建议
|
||||||
measures: '', // 整改措施
|
measures: '', // 整改措施
|
||||||
creator: '', // 填表人
|
creator: '' // 填表人
|
||||||
reportDate: null // 报出日期
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -409,7 +407,6 @@ export default {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
|
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 = {
|
const params = {
|
||||||
...this.infoForm,
|
...this.infoForm,
|
||||||
photos: this.infoForm.fileList.map(item => item.remotePathName),
|
photos: this.infoForm.fileList.map(item => item.remotePathName),
|
||||||
|
|
|
@ -67,17 +67,6 @@
|
||||||
<el-form-item :label-width="formLabelWidth" label="填表人" prop="creator">
|
<el-form-item :label-width="formLabelWidth" label="填表人" prop="creator">
|
||||||
<el-input v-model="infoForm.creator" :disabled="isDisabled" autocomplete="off"/>
|
<el-input v-model="infoForm.creator" :disabled="isDisabled" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label-width="formLabelWidth" label="报出日期" prop="reportDate">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="infoForm.reportDate"
|
|
||||||
:disabled="isDisabled"
|
|
||||||
type="datetime"
|
|
||||||
placeholder="请选择报出日期"
|
|
||||||
style="width: 100%;"
|
|
||||||
format="yyyy-MM-dd HH:mm:ss"
|
|
||||||
value-format="yyyy-MM-dd HH:mm:ss"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="upload"
|
ref="upload"
|
||||||
|
@ -108,6 +97,7 @@
|
||||||
:limit="limitNum"
|
:limit="limitNum"
|
||||||
:on-remove="handleRemoveAnnex"
|
:on-remove="handleRemoveAnnex"
|
||||||
:before-upload="beforeEventUpload"
|
:before-upload="beforeEventUpload"
|
||||||
|
:on-preview="handleDownloadAnnex"
|
||||||
:on-error="handleError"
|
:on-error="handleError"
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
name="file"
|
name="file"
|
||||||
|
@ -176,8 +166,7 @@ export default {
|
||||||
analysis: '', // 原因分析及责任认定
|
analysis: '', // 原因分析及责任认定
|
||||||
suggestions: '', // 考核建议
|
suggestions: '', // 考核建议
|
||||||
measures: '', // 整改措施
|
measures: '', // 整改措施
|
||||||
creator: '', // 填表人
|
creator: '' // 填表人
|
||||||
reportDate: null // 报出日期
|
|
||||||
},
|
},
|
||||||
formLabelWidth: '140px',
|
formLabelWidth: '140px',
|
||||||
/** 事故类型 */
|
/** 事故类型 */
|
||||||
|
@ -186,7 +175,7 @@ export default {
|
||||||
incidentLevels: [],
|
incidentLevels: [],
|
||||||
tableName: '',
|
tableName: '',
|
||||||
/** 图片上传限制个数 */
|
/** 图片上传限制个数 */
|
||||||
limitNum: 1,
|
limitNum: 6,
|
||||||
/** 预览弹窗 */
|
/** 预览弹窗 */
|
||||||
dialogImgVisible: false,
|
dialogImgVisible: false,
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -202,8 +191,7 @@ export default {
|
||||||
analysis: [{ required: true, message: '原因分析及责任认定不能为空', trigger: 'blur' }],
|
analysis: [{ required: true, message: '原因分析及责任认定不能为空', trigger: 'blur' }],
|
||||||
suggestions: [{ required: true, message: '考核建议不能为空', trigger: 'blur' }],
|
suggestions: [{ required: true, message: '考核建议不能为空', trigger: 'blur' }],
|
||||||
measures: [{ required: true, message: '整改措施不能为空', trigger: 'blur' }],
|
measures: [{ required: true, message: '整改措施不能为空', trigger: 'blur' }],
|
||||||
creator: [{ required: true, message: '填表人不能为空', trigger: 'blur' }],
|
creator: [{ required: true, message: '填表人不能为空', trigger: 'blur' }]
|
||||||
reportDate: [{ required: true, message: '报出日期不能为空', trigger: 'blur' }]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -223,30 +211,34 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
// 若有数据项的ID, 则请求接口并回显表单
|
// 若有数据项的ID, 则请求接口并回显表单
|
||||||
requestFN('/accident/' + id, {}).then((data) => {
|
requestFN('/accident/' + id, {}).then((data) => {
|
||||||
|
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 = {
|
this.infoForm = {
|
||||||
...data.info,
|
...data.info,
|
||||||
fileList: [
|
fileList: fileList,
|
||||||
{
|
fileAddressList: fileAddressList
|
||||||
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 = []
|
|
||||||
}
|
}
|
||||||
this.infoForm.incidentDate = new Date(data.info.incidentDate)
|
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) {
|
if (file.remotePathName) {
|
||||||
requestFN(`/accident/delete/photos`, {
|
requestFN(`/accident/delete/photos`, {
|
||||||
path: file.remotePathName
|
path: file.remotePathName
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.result === 'success') {
|
if (res.result === 'success') {
|
||||||
this.infoForm.fileList = []
|
this.infoForm.fileList = fileList
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '文件删除成功',
|
message: '文件删除成功',
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -275,13 +267,13 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 文件列表移除文件时的钩子
|
* 文件列表移除文件时的钩子
|
||||||
*/
|
*/
|
||||||
handleRemoveAnnex(file) {
|
handleRemoveAnnex(file, fileList) {
|
||||||
if (file.remotePathName) {
|
if (file.remotePathName) {
|
||||||
requestFN(`/accident/delete/photos`, {
|
requestFN(`/accident/delete/photos`, {
|
||||||
path: file.remotePathName
|
path: file.remotePathName
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.result === 'success') {
|
if (res.result === 'success') {
|
||||||
this.infoForm.fileAddressList = []
|
this.infoForm.fileAddressList = fileList
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '文件删除成功',
|
message: '文件删除成功',
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -300,6 +292,17 @@ export default {
|
||||||
this.dialogImageUrl = file.url
|
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)
|
formData.append('file', file)
|
||||||
upload('/accident/import/photos', formData).then((data) => {
|
upload('/accident/import/photos', formData).then((data) => {
|
||||||
if (data.result === 'success') {
|
if (data.result === 'success') {
|
||||||
this.infoForm = {
|
this.infoForm.fileList.push({
|
||||||
...this.infoForm,
|
name: file.name,
|
||||||
fileList: [{
|
url: config.fileUrl + data.path,
|
||||||
name: file.name,
|
remotePathName: data.path
|
||||||
url: config.fileUrl + data.path,
|
})
|
||||||
remotePathName: data.path
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
|
@ -369,14 +369,11 @@ export default {
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
upload('/accident/import/photos', formData).then((data) => {
|
upload('/accident/import/photos', formData).then((data) => {
|
||||||
if (data.result === 'success') {
|
if (data.result === 'success') {
|
||||||
this.infoForm = {
|
this.infoForm.fileAddressList.push({
|
||||||
...this.infoForm,
|
name: file.name,
|
||||||
fileAddressList: [{
|
url: config.fileUrl + data.path,
|
||||||
name: file.name,
|
remotePathName: data.path
|
||||||
url: config.fileUrl + data.path,
|
})
|
||||||
remotePathName: data.path
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
|
@ -416,8 +413,7 @@ export default {
|
||||||
analysis: '', // 原因分析及责任认定
|
analysis: '', // 原因分析及责任认定
|
||||||
suggestions: '', // 考核建议
|
suggestions: '', // 考核建议
|
||||||
measures: '', // 整改措施
|
measures: '', // 整改措施
|
||||||
creator: '', // 填表人
|
creator: '' // 填表人
|
||||||
reportDate: null // 报出日期
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -430,23 +426,21 @@ export default {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
|
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 = {
|
const params = {
|
||||||
...this.infoForm,
|
...this.infoForm,
|
||||||
photos: this.infoForm.fileList[0].remotePathName,
|
photos: this.infoForm.fileList.map(item => item.remotePathName),
|
||||||
attachmentAddress: address == null ? '' : address.remotePathName,
|
attachmentAddress: this.infoForm.fileAddressList.map(item => item.remotePathName),
|
||||||
|
attachmentNames: this.infoForm.fileAddressList.map(item => item.name),
|
||||||
type: 2
|
type: 2
|
||||||
}
|
}
|
||||||
delete params.fileList
|
delete params.fileList
|
||||||
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
||||||
.then((response) => {
|
.then(() => {
|
||||||
// 删除成功后的处理
|
// 删除成功后的处理
|
||||||
this.$message.success(this.tableName + '成功')
|
this.$message.success(this.tableName + '成功')
|
||||||
this.infoForm = this.$options.data().infoForm
|
this.infoForm = this.$options.data().infoForm
|
||||||
this.$parent.activeName = 'List'
|
this.$parent.activeName = 'List'
|
||||||
// eslint-disable-next-line handle-callback-err
|
}).catch(() => {
|
||||||
}).catch((error) => {
|
|
||||||
this.$message.error(this.tableName + '失败')
|
this.$message.error(this.tableName + '失败')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue