|
|
@ -54,12 +54,11 @@
|
|
|
|
<el-form-item :label-width="formLabelWidth" label="事故概述" prop="summary">
|
|
|
|
<el-form-item :label-width="formLabelWidth" label="事故概述" prop="summary">
|
|
|
|
<el-input v-model="infoForm.summary" :disabled="isDisabled" autocomplete="off"/>
|
|
|
|
<el-input v-model="infoForm.summary" :disabled="isDisabled" autocomplete="off"/>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="photos">
|
|
|
|
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
|
|
|
<el-upload
|
|
|
|
<el-upload
|
|
|
|
ref="upload"
|
|
|
|
ref="upload"
|
|
|
|
:disabled="isDisabled"
|
|
|
|
:disabled="isDisabled"
|
|
|
|
:file-list.sync="fileList"
|
|
|
|
:file-list="infoForm.fileList"
|
|
|
|
:src="config.fileUrl + infoForm.photos"
|
|
|
|
|
|
|
|
:multiple="false"
|
|
|
|
:multiple="false"
|
|
|
|
:auto-upload="true"
|
|
|
|
:auto-upload="true"
|
|
|
|
:limit="limitNum"
|
|
|
|
:limit="limitNum"
|
|
|
@ -101,7 +100,9 @@
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog :visible.sync="dialogImgVisible">
|
|
|
|
<el-dialog :visible.sync="dialogImgVisible">
|
|
|
|
<img :src="config.fileUrl+infoForm.photos" width="100%" alt="">
|
|
|
|
<div v-if="infoForm.fileList.length > 0">
|
|
|
|
|
|
|
|
<img :src="infoForm.fileList[0].url" width="100%" alt="">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="ui-height"/>
|
|
|
|
<div class="ui-height"/>
|
|
|
@ -141,7 +142,7 @@ export default {
|
|
|
|
seriouslyInjured: null, // 重伤人数
|
|
|
|
seriouslyInjured: null, // 重伤人数
|
|
|
|
cause: '', // 事故起因
|
|
|
|
cause: '', // 事故起因
|
|
|
|
summary: '', // 事故概述
|
|
|
|
summary: '', // 事故概述
|
|
|
|
photos: '', // 事故照片
|
|
|
|
fileList: [], // 事故照片
|
|
|
|
analysis: '', // 原因分析及责任认定
|
|
|
|
analysis: '', // 原因分析及责任认定
|
|
|
|
suggestions: '', // 考核建议
|
|
|
|
suggestions: '', // 考核建议
|
|
|
|
measures: '', // 整改措施
|
|
|
|
measures: '', // 整改措施
|
|
|
@ -156,9 +157,6 @@ export default {
|
|
|
|
tableName: '',
|
|
|
|
tableName: '',
|
|
|
|
/** 图片上传限制个数 */
|
|
|
|
/** 图片上传限制个数 */
|
|
|
|
limitNum: 1,
|
|
|
|
limitNum: 1,
|
|
|
|
/** 图片 */
|
|
|
|
|
|
|
|
fileList: [],
|
|
|
|
|
|
|
|
allowRemove: true, // 添加一个控制标志
|
|
|
|
|
|
|
|
/** 预览弹窗 */
|
|
|
|
/** 预览弹窗 */
|
|
|
|
dialogImgVisible: false,
|
|
|
|
dialogImgVisible: false,
|
|
|
|
rules: {
|
|
|
|
rules: {
|
|
|
@ -175,7 +173,7 @@ export default {
|
|
|
|
seriouslyInjured: [{ required: true, message: '隐患类型不能为空', trigger: 'blur' }],
|
|
|
|
seriouslyInjured: [{ required: true, message: '隐患类型不能为空', trigger: 'blur' }],
|
|
|
|
cause: [{ required: true, message: '事故起因不能为空', trigger: 'blur' }],
|
|
|
|
cause: [{ required: true, message: '事故起因不能为空', trigger: 'blur' }],
|
|
|
|
summary: [{ required: true, message: '事故概述不能为空', trigger: 'blur' }],
|
|
|
|
summary: [{ required: true, message: '事故概述不能为空', trigger: 'blur' }],
|
|
|
|
photos: [{ required: true, message: '事故照片不能为空', trigger: 'blur' }],
|
|
|
|
fileList: [{ required: true, message: '事故照片不能为空', trigger: 'blur' }],
|
|
|
|
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' }],
|
|
|
@ -200,8 +198,16 @@ export default {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// 若有数据项的ID, 则请求接口并回显表单
|
|
|
|
// 若有数据项的ID, 则请求接口并回显表单
|
|
|
|
requestFN('/accident/' + id, {}).then((data) => {
|
|
|
|
requestFN('/accident/' + id, {}).then((data) => {
|
|
|
|
this.infoForm = data.info
|
|
|
|
this.infoForm = {
|
|
|
|
this.getFileImageBinaray(data.info.photos)
|
|
|
|
...data.info,
|
|
|
|
|
|
|
|
fileList: [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
name: 'photo',
|
|
|
|
|
|
|
|
url: config.fileUrl + data.info.photos,
|
|
|
|
|
|
|
|
remotePathName: data.info.photos
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
}).catch((e) => {
|
|
|
|
}).catch((e) => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -213,9 +219,11 @@ export default {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
handleRemovePicture(file) {
|
|
|
|
handleRemovePicture(file) {
|
|
|
|
if (file.remotePathName) {
|
|
|
|
if (file.remotePathName) {
|
|
|
|
requestFN(`/accident/delete/photos/${file.remotePathName}`).then((res) => {
|
|
|
|
requestFN(`/accident/delete/photos`, {
|
|
|
|
|
|
|
|
path: file.remotePathName
|
|
|
|
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.result === 'success') {
|
|
|
|
if (res.result === 'success') {
|
|
|
|
this.infoForm.photos = []
|
|
|
|
this.infoForm.fileList = []
|
|
|
|
this.$message({
|
|
|
|
this.$message({
|
|
|
|
message: '文件删除成功',
|
|
|
|
message: '文件删除成功',
|
|
|
|
type: 'info',
|
|
|
|
type: 'info',
|
|
|
@ -274,7 +282,14 @@ 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.photos = data.path
|
|
|
|
this.infoForm = {
|
|
|
|
|
|
|
|
...this.infoForm,
|
|
|
|
|
|
|
|
fileList: [{
|
|
|
|
|
|
|
|
name: file.name,
|
|
|
|
|
|
|
|
url: config.fileUrl + data.path,
|
|
|
|
|
|
|
|
remotePathName: data.path
|
|
|
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
return false
|
|
|
|
return false
|
|
|
@ -311,7 +326,7 @@ export default {
|
|
|
|
seriouslyInjured: null, // 重伤人数
|
|
|
|
seriouslyInjured: null, // 重伤人数
|
|
|
|
cause: '', // 事故起因
|
|
|
|
cause: '', // 事故起因
|
|
|
|
summary: '', // 事故概述
|
|
|
|
summary: '', // 事故概述
|
|
|
|
photos: [], // 事故照片
|
|
|
|
fileList: [], // 事故照片
|
|
|
|
analysis: '', // 原因分析及责任认定
|
|
|
|
analysis: '', // 原因分析及责任认定
|
|
|
|
suggestions: '', // 考核建议
|
|
|
|
suggestions: '', // 考核建议
|
|
|
|
measures: '', // 整改措施
|
|
|
|
measures: '', // 整改措施
|
|
|
@ -324,11 +339,11 @@ export default {
|
|
|
|
* 表单确认按钮
|
|
|
|
* 表单确认按钮
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
confirm() {
|
|
|
|
confirm() {
|
|
|
|
console.log('ok >>>>' + this.infoForm.photos)
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
const params = {
|
|
|
|
...this.infoForm
|
|
|
|
...this.infoForm,
|
|
|
|
// photos: this.infoForm.photos[0].remotePathName
|
|
|
|
photos: this.infoForm.fileList[0].remotePathName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete params.fileList
|
|
|
|
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
|
|
|
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
|
|
|
.then((response) => {
|
|
|
|
.then((response) => {
|
|
|
|
// 删除成功后的处理
|
|
|
|
// 删除成功后的处理
|
|
|
|