|
|
|
|
@ -44,6 +44,11 @@ |
|
|
|
|
@blur="(event) => { changeDescribe(event, index) }"> |
|
|
|
|
</el-input> |
|
|
|
|
</template> |
|
|
|
|
<template slot-scope="{disabled,type}" slot="informant"> |
|
|
|
|
<el-select v-model="item.form.informant" placeholder="请选择关联实验室" @change="(val) => changeLab(val,index)"> |
|
|
|
|
<el-option v-for="item in labData" :key="item.id" :label="item.deptName + '(' + item.phone + ')'" :value="item.id"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</template> |
|
|
|
|
<template slot-scope="{disabled,size}" slot="imgUrl"> |
|
|
|
|
<el-upload action="/api/blade-resource/oss/endpoint/put-file" list-type="picture-card" :headers="headers" |
|
|
|
|
:on-success="handleSuccess(index)" :on-remove="handleRemove(index)" multiple :before-upload="beforeAvatarUpload(index)" |
|
|
|
|
@ -70,13 +75,10 @@ import {getToken, removeToken, removeRefreshToken} from '@/util/auth'; |
|
|
|
|
import SelectTree from '../../components/selectTree/tree.vue' |
|
|
|
|
import { getDeviceList } from '@/api/device/device' |
|
|
|
|
import { getChildList } from '@/api/system/dictbiz' |
|
|
|
|
import { saveData, editData, saveDraft } from '@/api/operation/hand' |
|
|
|
|
import { saveData, editData, saveDraft,serviceSave,serviceDraft,getAllUser } from '@/api/operation/hand' |
|
|
|
|
import { nextTick } from 'vue'; |
|
|
|
|
import Compressor from 'compressorjs'; |
|
|
|
|
// import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg'; |
|
|
|
|
// import { compressVideo } from 'video-conversion'; |
|
|
|
|
|
|
|
|
|
// import ffmpeg from "@/util/ffmpeg"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
export default { |
|
|
|
|
name: 'requestSub', |
|
|
|
|
props: { |
|
|
|
|
@ -98,27 +100,21 @@ export default { |
|
|
|
|
editId: '', |
|
|
|
|
headers:{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
labData:[], |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.getLabData() |
|
|
|
|
this.headers = { |
|
|
|
|
"Authorization":`Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`, |
|
|
|
|
'Blade-Auth':'bearer ' + getToken(), |
|
|
|
|
'Blade-Requested-With':'BladeHttpRequest' |
|
|
|
|
} |
|
|
|
|
console.log('333333333333333333333',this.headers) |
|
|
|
|
console.log('this.userInfo.role_id',this.userInfo.role_id) |
|
|
|
|
if ((this.title == '编辑' && JSON.stringify(this.form) != '{}') || JSON.stringify(this.form) != '{}') { |
|
|
|
|
this.editId = this.form.id |
|
|
|
|
for (let key in this.form) { |
|
|
|
|
// this.addForm[0].form.deviceName = this.form.deviceName |
|
|
|
|
// this.addForm[0].form.faultPosition.node = this.deviceList.find(item => item.id == this.form.deviceName).position |
|
|
|
|
// this.addForm[0].form.faultType = this.deviceList.find(item => item.id == this.form.deviceName).type |
|
|
|
|
// this.addForm[0].form.faultDescribe = this.form.faultDescribe |
|
|
|
|
// this.addForm[0].form.picAttaches = this.form.picAttaches |
|
|
|
|
// this.addForm[0].form.videoAttaches = this.form.videoAttaches |
|
|
|
|
// this.addForm[0].formOption.column.find(item => item.prop == 'errorVideo').value = this.form.videoAttaches[0].link |
|
|
|
|
// this.addForm[0].formOption.column.find(item => item.prop == 'imgUrl').value = this.form.picAttaches.map(item => item.link) |
|
|
|
|
this.addForm = [ |
|
|
|
|
{ |
|
|
|
|
form: { |
|
|
|
|
@ -136,6 +132,15 @@ export default { |
|
|
|
|
submitBtn: false, |
|
|
|
|
menuPosition: 'right', |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "关联实验室", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
span: 24, |
|
|
|
|
prop: "informant", |
|
|
|
|
type: "select", |
|
|
|
|
formslot: true, |
|
|
|
|
display:this.userInfo.role_id == '1839536982874193922' ? true : false |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "故障现象描述", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
@ -225,7 +230,6 @@ export default { |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
console.log('2222222222222222222222222') |
|
|
|
|
this.addForm = [ |
|
|
|
|
{ |
|
|
|
|
form: { |
|
|
|
|
@ -243,6 +247,15 @@ export default { |
|
|
|
|
submitBtn: false, |
|
|
|
|
menuPosition: 'right', |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "关联实验室", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
span: 24, |
|
|
|
|
prop: "informant", |
|
|
|
|
type: "select", |
|
|
|
|
formslot: true, |
|
|
|
|
display:this.userInfo.role_id == '1839536982874193922' ? true : false |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "故障现象描述", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
@ -325,35 +338,19 @@ export default { |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
// getDeviceList({ current: 1, size: 100 }).then(res => { |
|
|
|
|
// this.deviceList = res.data.data.records |
|
|
|
|
// getChildList(1, 100, '1846802246527463425').then(res => { |
|
|
|
|
// this.typeList = res.data.data |
|
|
|
|
// }) |
|
|
|
|
// getChildList(1, 100, '1846792623628001282').then(res => { |
|
|
|
|
// this.treeOptions = res.data.data |
|
|
|
|
|
|
|
|
|
// console.log('addForm------------>', this.addForm) |
|
|
|
|
|
|
|
|
|
// }) |
|
|
|
|
|
|
|
|
|
// }) |
|
|
|
|
console.log('addForm------------->',this.addForm) |
|
|
|
|
this.$forceUpdate() |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
...mapGetters(["userInfo", "permission", "systemTime"]), |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
form(newVal, oldVal) { |
|
|
|
|
console.log('newVal---------------------') |
|
|
|
|
let arr = JSON.parse(JSON.stringify(this.addForm)) |
|
|
|
|
if ((this.title == '编辑' && JSON.stringify(this.form) != '{}') || JSON.stringify(this.form) != '{}') { |
|
|
|
|
this.editId = this.form.id |
|
|
|
|
for (let key in this.form) { |
|
|
|
|
// this.addForm[0].form.deviceName = this.form.deviceName |
|
|
|
|
// this.addForm[0].form.faultPosition.node = this.deviceList.find(item => item.id == this.form.deviceName).position |
|
|
|
|
// this.addForm[0].form.faultType = this.deviceList.find(item => item.id == this.form.deviceName).type |
|
|
|
|
// this.addForm[0].form.faultDescribe = this.form.faultDescribe |
|
|
|
|
// this.addForm[0].form.picAttaches = this.form.picAttaches |
|
|
|
|
// this.addForm[0].form.videoAttaches = this.form.videoAttaches |
|
|
|
|
// this.addForm[0].formOption.column.find(item => item.prop == 'errorVideo').value = this.form.videoAttaches[0].link |
|
|
|
|
// this.addForm[0].formOption.column.find(item => item.prop == 'imgUrl').value = this.form.picAttaches.map(item => item.link) |
|
|
|
|
this.addForm = [ |
|
|
|
|
{ |
|
|
|
|
form: { |
|
|
|
|
@ -372,6 +369,15 @@ export default { |
|
|
|
|
submitBtn: false, |
|
|
|
|
menuPosition: 'right', |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "关联实验室", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
span: 24, |
|
|
|
|
prop: "informant", |
|
|
|
|
type: "select", |
|
|
|
|
formslot: true, |
|
|
|
|
display:this.userInfo.role_id == '1839536982874193922' ? true : false |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "故障现象描述", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
@ -472,6 +478,15 @@ export default { |
|
|
|
|
submitBtn: false, |
|
|
|
|
menuPosition: 'right', |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "关联实验室", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
span: 24, |
|
|
|
|
prop: "informant", |
|
|
|
|
type: "select", |
|
|
|
|
formslot: true, |
|
|
|
|
display:this.userInfo.role_id == '1839536982874193922' ? true : false |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "故障现象描述", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
@ -557,6 +572,61 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
methods: { |
|
|
|
|
getLabData(){ |
|
|
|
|
getAllUser().then(res =>{ |
|
|
|
|
console.log() |
|
|
|
|
this.labData = res.data.data |
|
|
|
|
}) |
|
|
|
|
// this.labData = [ |
|
|
|
|
// { |
|
|
|
|
// id: "1859474667806449666", |
|
|
|
|
// createUser: "-1", |
|
|
|
|
// createDept: "-1", |
|
|
|
|
// createTime: "2024-11-21 13:51:23", |
|
|
|
|
// updateUser: "1123598821738675201", |
|
|
|
|
// updateTime: "2024-12-05 15:35:54", |
|
|
|
|
// status: 1, |
|
|
|
|
// isDeleted: 0, |
|
|
|
|
// tenantId: "000000", |
|
|
|
|
// code: "", |
|
|
|
|
// userType: 1, |
|
|
|
|
// account: "17852327323", |
|
|
|
|
// name: "靳娜", |
|
|
|
|
// realName: "靳娜", |
|
|
|
|
// avatar: "", |
|
|
|
|
// email: "", |
|
|
|
|
// phone: "17852327323", |
|
|
|
|
// birthday: "", |
|
|
|
|
// sex: -1, |
|
|
|
|
// roleId: "1846419477876510721", |
|
|
|
|
// deptId: "1862052949173280770", |
|
|
|
|
// deptName: "山东烁今实验室", |
|
|
|
|
// postId: "1839605322925801474", |
|
|
|
|
// address: "山东省青岛市崂山区仙霞岭路33号", |
|
|
|
|
// addressLon: "120.48031277706768", |
|
|
|
|
// addressLat: "36.11160956229114", |
|
|
|
|
// isMaintenanceClient: -1, |
|
|
|
|
// tenantName: "管理组", |
|
|
|
|
// userTypeName: "WEB", |
|
|
|
|
// roleName: "实验室管理员", |
|
|
|
|
// postName: "领导", |
|
|
|
|
// sexName: "性别", |
|
|
|
|
// userExt: "" |
|
|
|
|
// } |
|
|
|
|
// ] |
|
|
|
|
}, |
|
|
|
|
// 切换实验室 |
|
|
|
|
changeLab(val,index){ |
|
|
|
|
console.log('val----------->',val) |
|
|
|
|
console.log('index----------->',index) |
|
|
|
|
this.addForm[index].form = { |
|
|
|
|
...this.addForm[index].form, |
|
|
|
|
informant:val, |
|
|
|
|
informantPhone:this.labData.find(item => item.id == val).phone, |
|
|
|
|
reportUnit:this.labData.find(item => item.id == val).deptId, |
|
|
|
|
createDept:this.labData.find(item => item.id == val).createDept, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 选择设备 |
|
|
|
|
changeDevice(value, row) { |
|
|
|
|
console.log('value---------->', value) |
|
|
|
|
@ -745,7 +815,6 @@ export default { |
|
|
|
|
handleAdd() { |
|
|
|
|
let count = 0 |
|
|
|
|
this.addForm.forEach((formItem, index) => { |
|
|
|
|
console.log('form------------>', this.$refs[`form${index}`]) |
|
|
|
|
this.$refs[`form${index}`][0].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
console.log(`表单项${index}验证通过`); |
|
|
|
|
@ -770,6 +839,15 @@ export default { |
|
|
|
|
submitBtn: false, |
|
|
|
|
menuPosition: 'right', |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: "关联实验室", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
span: 24, |
|
|
|
|
prop: "informant", |
|
|
|
|
type: "select", |
|
|
|
|
formslot: true, |
|
|
|
|
display:this.userInfo.role_id == '1839536982874193922' ? true : false |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: "故障现象描述", |
|
|
|
|
labelWidth: 120, |
|
|
|
|
@ -856,26 +934,6 @@ export default { |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
// let emptyPos = this.addForm.find((item) => item.form.faultPosition == ""); |
|
|
|
|
// let emptyDevice = this.addForm.find((item) => item.form.deviceName == ""); |
|
|
|
|
// let emptyType = this.addForm.find((item) => item.form.faultType == ""); |
|
|
|
|
// let emptyDes = this.addForm.find((item) => item.form.faultDescribe == ""); |
|
|
|
|
// let emptyVideo = this.addForm.find((item) => item.form.errorVideo == ""); |
|
|
|
|
// let emptyImg = this.addForm.find( |
|
|
|
|
// (item) => item.form.picAttaches.length == 0 |
|
|
|
|
// ); |
|
|
|
|
// if ( |
|
|
|
|
// emptyPos || |
|
|
|
|
// emptyDevice || |
|
|
|
|
// emptyType || |
|
|
|
|
// emptyDes || |
|
|
|
|
// emptyVideo || |
|
|
|
|
// emptyImg |
|
|
|
|
// ) { |
|
|
|
|
// this.$message.error("需求填报时各内容均不可为空,请填写完全"); |
|
|
|
|
// } else { |
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
}, |
|
|
|
|
// 点击取消按钮 |
|
|
|
|
handleCancel() { |
|
|
|
|
@ -989,34 +1047,66 @@ export default { |
|
|
|
|
console.log(`表单项${index}验证通过`); |
|
|
|
|
// 执行提交操作 |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
console.log(`表单项${index}验证失败`); |
|
|
|
|
if (this.addForm[index].form.faultDescribe != '') { |
|
|
|
|
count++ |
|
|
|
|
this.$refs[`form${index}`][0].clearValidate() |
|
|
|
|
if(count == this.addForm.length){ |
|
|
|
|
let data = [] |
|
|
|
|
this.addForm.map(item => { |
|
|
|
|
data.push({ |
|
|
|
|
faultLocation: item.form.faultPosition.node, |
|
|
|
|
deviceName: item.form.deviceName, |
|
|
|
|
faultType: item.form.faultType, |
|
|
|
|
videoAttaches: item.form.videoAttaches, |
|
|
|
|
picAttaches: item.form.picAttaches, |
|
|
|
|
faultDescribe: item.form.faultDescribe, |
|
|
|
|
if(this.userInfo.role_id == '1839536982874193922'){ |
|
|
|
|
//客服角色 |
|
|
|
|
if (this.addForm[index].form.faultDescribe != '' && this.addForm[index].form.informant != ''){ |
|
|
|
|
count++ |
|
|
|
|
this.$refs[`form${index}`][0].clearValidate() |
|
|
|
|
if(count == this.addForm.length){ |
|
|
|
|
let data = [] |
|
|
|
|
this.addForm.map(item => { |
|
|
|
|
data.push({ |
|
|
|
|
faultLocation: item.form.faultPosition.node, |
|
|
|
|
deviceName: item.form.deviceName, |
|
|
|
|
faultType: item.form.faultType, |
|
|
|
|
videoAttaches: item.form.videoAttaches, |
|
|
|
|
picAttaches: item.form.picAttaches, |
|
|
|
|
faultDescribe: item.form.faultDescribe, |
|
|
|
|
createDept:item.form.createDept, |
|
|
|
|
informant:item.form.informant, |
|
|
|
|
informantPhone:item.form.informantPhone, |
|
|
|
|
reportUnit:item.form.reportUnit, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
console.log('data============>', data) |
|
|
|
|
saveDraft(data).then(res => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('保存成功') |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.$emit('close') |
|
|
|
|
console.log('data============>', data) |
|
|
|
|
serviceDraft(data).then(res => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('保存成功') |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if (this.addForm[index].form.faultDescribe != '') { |
|
|
|
|
count++ |
|
|
|
|
this.$refs[`form${index}`][0].clearValidate() |
|
|
|
|
if(count == this.addForm.length){ |
|
|
|
|
let data = [] |
|
|
|
|
this.addForm.map(item => { |
|
|
|
|
data.push({ |
|
|
|
|
faultLocation: item.form.faultPosition.node, |
|
|
|
|
deviceName: item.form.deviceName, |
|
|
|
|
faultType: item.form.faultType, |
|
|
|
|
videoAttaches: item.form.videoAttaches, |
|
|
|
|
picAttaches: item.form.picAttaches, |
|
|
|
|
faultDescribe: item.form.faultDescribe, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
console.log('data============>', data) |
|
|
|
|
saveDraft(data).then(res => { |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('保存成功') |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
@ -1026,126 +1116,93 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 点击确定按钮 |
|
|
|
|
handleConfirm(index) { |
|
|
|
|
// let emptyPos = this.addForm.find((item) => item.form.faultPosition == ""); |
|
|
|
|
// let emptyDevice = this.addForm.find((item) => item.form.deviceName == ""); |
|
|
|
|
// let emptyType = this.addForm.find((item) => item.form.faultType == ""); |
|
|
|
|
// let emptyDes = this.addForm.find((item) => item.form.faultDescribe == ""); |
|
|
|
|
// let emptyVideo = this.addForm.find((item) => item.form.errorVideo == ""); |
|
|
|
|
// let emptyImg = this.addForm.find( |
|
|
|
|
// (item) => item.form.picAttaches.length == 0 |
|
|
|
|
// ); |
|
|
|
|
// if ( |
|
|
|
|
// emptyPos || |
|
|
|
|
// emptyDevice || |
|
|
|
|
// emptyType || |
|
|
|
|
// emptyDes || |
|
|
|
|
// emptyVideo || |
|
|
|
|
// emptyImg |
|
|
|
|
// ) { |
|
|
|
|
// console.log('emptyPos----------->',emptyPos) |
|
|
|
|
// console.log('emptyDevice----------->',emptyDevice) |
|
|
|
|
// console.log('emptyType----------->',emptyType) |
|
|
|
|
// console.log('emptyDes----------->',emptyDes) |
|
|
|
|
// console.log('emptyVideo----------->',emptyVideo) |
|
|
|
|
// console.log('emptyImg----------->',emptyImg) |
|
|
|
|
// this.$message.error("需求填报时各内容均不可为空,请填写完全"); |
|
|
|
|
// } else { |
|
|
|
|
// console.log('addForm---------->', this.addForm) |
|
|
|
|
// let data = [] |
|
|
|
|
// this.addForm.map(item => { |
|
|
|
|
// data.push({ |
|
|
|
|
// id: this.editId ? this.editId : null, |
|
|
|
|
// faultLocation: item.form.faultPosition.node, |
|
|
|
|
// deviceName: item.form.deviceName, |
|
|
|
|
// faultType: item.form.faultType, |
|
|
|
|
// videoAttaches: item.form.videoAttaches, |
|
|
|
|
// picAttaches: item.form.picAttaches, |
|
|
|
|
// faultDescribe: item.form.faultDescribe, |
|
|
|
|
// submitType: 1 |
|
|
|
|
// }) |
|
|
|
|
// }) |
|
|
|
|
// console.log('data============>', data) |
|
|
|
|
// // if (this.title == '需求填报') { |
|
|
|
|
// console.log('11111111111111111') |
|
|
|
|
// saveData(data).then(res => { |
|
|
|
|
// console.log('res------------------->', res) |
|
|
|
|
// if (res.data.code == 200) { |
|
|
|
|
// this.$message.success('新增成功') |
|
|
|
|
// this.$emit('close') |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// // } else if (this.title == '编辑') { |
|
|
|
|
// // let query = { |
|
|
|
|
// // id: this.editId ? this.editId : null, |
|
|
|
|
// // faultLocation: this.addForm[0].form.faultPosition.node, |
|
|
|
|
// // deviceName: this.addForm[0].form.deviceName, |
|
|
|
|
// // faultType: this.addForm[0].form.faultType, |
|
|
|
|
// // videoAttaches: this.addForm[0].form.videoAttaches, |
|
|
|
|
// // picAttaches: this.addForm[0].form.picAttaches, |
|
|
|
|
// // faultDescribe: this.addForm[0].form.faultDescribe, |
|
|
|
|
// // submitType: 1 |
|
|
|
|
// // } |
|
|
|
|
// // console.log('22222222222222222222222') |
|
|
|
|
// // editData(query).then(res => { |
|
|
|
|
// // console.log('res------------------->', res) |
|
|
|
|
// // if (res.data.code == 200) { |
|
|
|
|
// // this.$message.success('新增成功') |
|
|
|
|
// // this.$emit('close') |
|
|
|
|
// // } |
|
|
|
|
// // }) |
|
|
|
|
// // } |
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// this.$refs.item[index].validate((valid, done,msg) => { |
|
|
|
|
// console.log('valid ------------->',valid) |
|
|
|
|
// }) |
|
|
|
|
let count = 0 |
|
|
|
|
this.addForm.forEach((formItem, index) => { |
|
|
|
|
console.log('form------------>', this.$refs[`form${index}`]) |
|
|
|
|
this.$refs[`form${index}`][0].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
console.log(`表单项${index}验证通过`); |
|
|
|
|
// 执行提交操作 |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
console.log(`表单项${index}验证失败`); |
|
|
|
|
if (this.addForm[index].form.faultDescribe != '') { |
|
|
|
|
count++ |
|
|
|
|
this.$refs[`form${index}`][0].clearValidate() |
|
|
|
|
if(count == this.addForm.length){ |
|
|
|
|
let data = [] |
|
|
|
|
this.addForm.map(item => { |
|
|
|
|
data.push({ |
|
|
|
|
id: this.editId ? this.editId : null, |
|
|
|
|
faultLocation: item.form.faultPosition, |
|
|
|
|
deviceName: item.form.deviceName, |
|
|
|
|
faultType: item.form.faultType, |
|
|
|
|
videoAttaches: item.form.videoAttaches, |
|
|
|
|
picAttaches: item.form.picAttaches, |
|
|
|
|
faultDescribe: item.form.faultDescribe, |
|
|
|
|
submitType: 1 |
|
|
|
|
if(this.userInfo.role_id == '1839536982874193922'){ |
|
|
|
|
//客服角色 |
|
|
|
|
if (this.addForm[index].form.faultDescribe != '' && this.addForm[index].form.informant != '') { |
|
|
|
|
count++ |
|
|
|
|
this.$refs[`form${index}`][0].clearValidate() |
|
|
|
|
if(count == this.addForm.length){ |
|
|
|
|
let data = [] |
|
|
|
|
this.addForm.map(item => { |
|
|
|
|
data.push({ |
|
|
|
|
id: this.editId ? this.editId : null, |
|
|
|
|
faultLocation: item.form.faultPosition, |
|
|
|
|
deviceName: item.form.deviceName, |
|
|
|
|
faultType: item.form.faultType, |
|
|
|
|
videoAttaches: item.form.videoAttaches, |
|
|
|
|
picAttaches: item.form.picAttaches, |
|
|
|
|
faultDescribe: item.form.faultDescribe, |
|
|
|
|
submitType: 1, |
|
|
|
|
createDept:item.form.createDept, |
|
|
|
|
informant:item.form.informant, |
|
|
|
|
informantPhone:item.form.informantPhone, |
|
|
|
|
reportUnit:item.form.reportUnit, |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
console.log('data---------->',data) |
|
|
|
|
if(data.videoAttaches && data.picAttaches && data.videoAttaches.length + data.picAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else if (data.videoAttaches && !data.picAttaches && data.videoAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else if (!data.videoAttaches && data.picAttaches && data.picAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else{ |
|
|
|
|
saveData(data).then(res => { |
|
|
|
|
console.log('res------------------->', res) |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('新增成功') |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
if(data.videoAttaches && data.picAttaches && data.videoAttaches.length + data.picAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else if (data.videoAttaches && !data.picAttaches && data.videoAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else if (!data.videoAttaches && data.picAttaches && data.picAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else{ |
|
|
|
|
console.log('data===========>',data) |
|
|
|
|
serviceSave(data).then(res =>{ |
|
|
|
|
console.log('res------------------->', res) |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('新增成功') |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if (this.addForm[index].form.faultDescribe != '') { |
|
|
|
|
count++ |
|
|
|
|
this.$refs[`form${index}`][0].clearValidate() |
|
|
|
|
if(count == this.addForm.length){ |
|
|
|
|
let data = [] |
|
|
|
|
this.addForm.map(item => { |
|
|
|
|
data.push({ |
|
|
|
|
id: this.editId ? this.editId : null, |
|
|
|
|
faultLocation: item.form.faultPosition, |
|
|
|
|
deviceName: item.form.deviceName, |
|
|
|
|
faultType: item.form.faultType, |
|
|
|
|
videoAttaches: item.form.videoAttaches, |
|
|
|
|
picAttaches: item.form.picAttaches, |
|
|
|
|
faultDescribe: item.form.faultDescribe, |
|
|
|
|
submitType: 1 |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
console.log('data---------->',data) |
|
|
|
|
if(data.videoAttaches && data.picAttaches && data.videoAttaches.length + data.picAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else if (data.videoAttaches && !data.picAttaches && data.videoAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else if (!data.videoAttaches && data.picAttaches && data.picAttaches.length > 3){ |
|
|
|
|
this.$message.error('故障视频与故障图片最多可上传3个') |
|
|
|
|
}else{ |
|
|
|
|
saveData(data).then(res => { |
|
|
|
|
console.log('res------------------->', res) |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success('新增成功') |
|
|
|
|
this.$emit('close') |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|