|
|
@ -10,7 +10,7 @@ |
|
|
|
</Transition> |
|
|
|
|
|
|
|
<div class="footer"> |
|
|
|
<Button style="padding:0 24px;" @click.native="handleSubmit" >保存</Button> |
|
|
|
<Button style="padding:0 24px;" @click.native="handleSubmit">保存</Button> |
|
|
|
<Button style="background: #C9C9C9;padding:0 24px;" @click.native="modelVisible = false">取消</Button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -45,11 +45,16 @@ export default { |
|
|
|
activeName: "TrafficAccident", |
|
|
|
formConfig: {}, |
|
|
|
tabConfigList, |
|
|
|
index: 1 |
|
|
|
index: 1, |
|
|
|
roads: [], |
|
|
|
direction: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
this.formConfig = tabConfigList[0].formConfig; |
|
|
|
// this.formConfig = tabConfigList[0].formConfig; |
|
|
|
this.initData().then(() => { |
|
|
|
this.handleChange({ index: 0 }) |
|
|
|
}) |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
modelVisible: { |
|
|
@ -68,39 +73,100 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
initData() { |
|
|
|
return Promise.all([ |
|
|
|
request({ |
|
|
|
url: `/business/road/query`, |
|
|
|
method: "get", |
|
|
|
}).then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
result.data.forEach(it => { |
|
|
|
this.roads.push({ key: it.id, label: it.roadName }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
Message.error("查询失败", err); |
|
|
|
}), |
|
|
|
request({ |
|
|
|
url: `/system/dict/data/type/iot_event_direction`, |
|
|
|
method: "get", |
|
|
|
}).then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
result.data.forEach(it => { |
|
|
|
this.direction.push({ key: it.dictValue, label: it.dictLabel }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
Message.error("查询失败", err); |
|
|
|
}) |
|
|
|
]) |
|
|
|
}, |
|
|
|
handleChange({ index }) { |
|
|
|
// console.log('index',index) |
|
|
|
this.index = index; |
|
|
|
this.formConfig = tabConfigList[index].formConfig; |
|
|
|
}, |
|
|
|
handleSubmit(){ |
|
|
|
const formData = this.$refs.FormConfigRef?.formData; |
|
|
|
let stakeMark = formData.stakeMark; |
|
|
|
let endStakeMark = formData.endStakeMark; |
|
|
|
console.log('122', { |
|
|
|
...formData, |
|
|
|
eventType: Number(this.index) + 1, |
|
|
|
stakeMark: (stakeMark && stakeMark.length > 0 ) ? ('K' + stakeMark[0] + '+' + stakeMark[1]) : '', |
|
|
|
endStakeMark: (endStakeMark && endStakeMark.length > 0 ) ? ('K' + endStakeMark[0] + '+' + endStakeMark[1]) : '', |
|
|
|
let formConfig = tabConfigList[index].formConfig; |
|
|
|
|
|
|
|
if (index == 7) { |
|
|
|
let fwq = []; |
|
|
|
|
|
|
|
request({ |
|
|
|
url: `/business/facility/query?facilityType=6`, |
|
|
|
method: "get" |
|
|
|
}).then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
result.data.forEach(it => { |
|
|
|
fwq.push({ key: it.id, label: it.facilityName }) |
|
|
|
}) |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
Message.error("查询失败", err); |
|
|
|
}); |
|
|
|
|
|
|
|
formConfig.list.forEach(it => { |
|
|
|
if (it.key === 'dcEventServiceArea.facilityId') { |
|
|
|
it.options.options = fwq; |
|
|
|
} |
|
|
|
}) |
|
|
|
// return |
|
|
|
request({ |
|
|
|
url: `/dc/system/event`, |
|
|
|
method: "post", |
|
|
|
data: { |
|
|
|
...formData, |
|
|
|
eventType: Number(this.index) + 1, |
|
|
|
stakeMark: (stakeMark && stakeMark.length > 0 ) ? ('K' + stakeMark[0] + '+' + stakeMark[1]) : '', |
|
|
|
endStakeMark: (endStakeMark && endStakeMark.length > 0 ) ? ('K' + endStakeMark[0] + '+' + endStakeMark[1]) : '', |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
formConfig.list.forEach(it => { |
|
|
|
if (it.key == 'direction') { |
|
|
|
it.options.options = this.direction; |
|
|
|
} |
|
|
|
if (it.key == 'roadId') { |
|
|
|
it.options.options = this.roads; |
|
|
|
} |
|
|
|
}) |
|
|
|
.then(() => { |
|
|
|
Message.success("提交成功"); |
|
|
|
this.modelVisible = false; |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
Message.error("提交失败"); |
|
|
|
|
|
|
|
this.formConfig = formConfig; |
|
|
|
}, |
|
|
|
handleSubmit() { |
|
|
|
// return |
|
|
|
this.$refs.FormConfigRef.validate().then((formData) => { |
|
|
|
let stakeMark = formData.stakeMark; |
|
|
|
let endStakeMark = formData.endStakeMark; |
|
|
|
request({ |
|
|
|
url: `/dc/system/event`, |
|
|
|
method: "post", |
|
|
|
data: { |
|
|
|
...formData, |
|
|
|
eventType: Number(this.index) + 1, |
|
|
|
stakeMark: (stakeMark && stakeMark.length > 0) ? ('K' + stakeMark[0] + '+' + stakeMark[1]) : '', |
|
|
|
endStakeMark: (endStakeMark && endStakeMark.length > 0) ? ('K' + endStakeMark[0] + '+' + endStakeMark[1]) : '', |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
.then((result) => { |
|
|
|
if (result.code != 200) return Message.error(result?.msg); |
|
|
|
Message.success("提交成功"); |
|
|
|
this.modelVisible = false; |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
Message.error("提交失败"); |
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|