|
@@ -153,10 +153,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { reactive, ref } from "vue";
|
|
|
+import { reactive, ref, onMounted } from "vue";
|
|
|
import personList from "../personList.vue";
|
|
|
import securityFacilitiesErrService from "@/api/securityFacilitiesErr/securityFacilitiesErrService";
|
|
|
import tools from "@/api/sys/tools";
|
|
|
+import { useRoute } from "vue-router";
|
|
|
+// 图片路径
|
|
|
+import $base from "@/utils/config";
|
|
|
|
|
|
export default {
|
|
|
components: { personList },
|
|
@@ -166,7 +169,7 @@ export default {
|
|
|
const onClickLeft = () => {
|
|
|
history.back();
|
|
|
};
|
|
|
- const info = reactive({
|
|
|
+ const info = ref({
|
|
|
id: "",
|
|
|
siteName: {
|
|
|
id: "",
|
|
@@ -185,6 +188,43 @@ export default {
|
|
|
state: "0",
|
|
|
assessment: "0",
|
|
|
});
|
|
|
+
|
|
|
+ // 根据路由初始化
|
|
|
+ let route = useRoute();
|
|
|
+ onMounted(() => {
|
|
|
+ if (route.query.id) {
|
|
|
+ new securityFacilitiesErrService().queryById(route.query.id).then((data) => {
|
|
|
+ info.value = data;
|
|
|
+ if(info.value.facilityType=="1"){
|
|
|
+ info.value.facilityTypename="消防设备";
|
|
|
+ }else{
|
|
|
+ info.value.facilityTypename="监控、音频";
|
|
|
+ }
|
|
|
+
|
|
|
+ //附件处理
|
|
|
+ info.value.enclosure.split("|").forEach((item) => {
|
|
|
+ if (item.trim().length > 0) {
|
|
|
+ fileList.value.push({
|
|
|
+ name: decodeURIComponent(
|
|
|
+ item.substring(item.lastIndexOf("/") + 1)
|
|
|
+ ),
|
|
|
+ url: $base + item.replace('程序附件//','程序附件/'),
|
|
|
+ });
|
|
|
+ fileupList.value.push({
|
|
|
+ name: decodeURIComponent(
|
|
|
+ item.substring(item.lastIndexOf("/") + 1)
|
|
|
+ ),
|
|
|
+ url: item,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(info.value);
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
// 场所名称
|
|
|
let places = ref([]);
|
|
|
const customFieldName = {
|
|
@@ -203,7 +243,7 @@ export default {
|
|
|
const getPlace = ({ selectedOptions }) => {
|
|
|
if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
|
|
|
showPlace.value = false;
|
|
|
- info.siteName = selectedOptions[0];
|
|
|
+ info.value.siteName = selectedOptions[0];
|
|
|
//场所选择完成后刷新
|
|
|
getVideoAudioList();
|
|
|
getFireStationList();
|
|
@@ -214,8 +254,8 @@ export default {
|
|
|
const facilityTypes = [{text:"监控、音频",value:"0"},{text:"消防设备",value:"1"}];
|
|
|
const getfacilityType= ({ selectedOptions }) => {
|
|
|
if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
|
|
|
- info.facilityType = selectedOptions[0].value;
|
|
|
- info.facilityTypename = selectedOptions[0].text;
|
|
|
+ info.value.facilityType = selectedOptions[0].value;
|
|
|
+ info.value.facilityTypename = selectedOptions[0].text;
|
|
|
getVideoAudioList();
|
|
|
getFireStationList();
|
|
|
showLx.value = false;
|
|
@@ -227,12 +267,12 @@ export default {
|
|
|
let VideoAudios = ref([]);
|
|
|
//同时选择好场所、设施类型后才获取视频列表
|
|
|
const getVideoAudioList= () => {
|
|
|
- if(info.siteName.id!=""&&info.facilityType=="0"){
|
|
|
+ if(info.value.siteName.id!=""&&info.value.facilityType=="0"){
|
|
|
new tools()
|
|
|
.videoPointList({
|
|
|
current: 1,
|
|
|
size: 10000,
|
|
|
- siteId: info.siteName.id,
|
|
|
+ siteId: info.value.siteName.id,
|
|
|
})
|
|
|
.then(({ records }) => {
|
|
|
VideoAudios.value=records;
|
|
@@ -242,8 +282,8 @@ export default {
|
|
|
};
|
|
|
const setVideoAudios= ({ selectedOptions }) => {
|
|
|
if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
|
|
|
- info.videoAudioPoint = selectedOptions[0];
|
|
|
- info.position=selectedOptions[0].position;
|
|
|
+ info.value.videoAudioPoint = selectedOptions[0];
|
|
|
+ info.value.position=selectedOptions[0].position;
|
|
|
showVideoAudio.value = false;
|
|
|
}
|
|
|
};
|
|
@@ -254,12 +294,12 @@ export default {
|
|
|
let FireStations = ref([]);
|
|
|
//同时选择好场所、设施类型后才获取消防点位列表
|
|
|
const getFireStationList= () => {
|
|
|
- if(info.siteName.id!=""&&info.facilityType=="1"){
|
|
|
+ if(info.value.siteName.id!=""&&info.value.facilityType=="1"){
|
|
|
new tools()
|
|
|
.fireStationList({
|
|
|
current: 1,
|
|
|
size: 10000,
|
|
|
- siteId: info.siteName.id,
|
|
|
+ siteId: info.value.siteName.id,
|
|
|
})
|
|
|
.then(({ records }) => {
|
|
|
FireStations.value=records;
|
|
@@ -269,8 +309,8 @@ export default {
|
|
|
};
|
|
|
const setFireStations= ({ selectedOptions }) => {
|
|
|
if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
|
|
|
- info.siteFireProtection = selectedOptions[0];
|
|
|
- info.position=selectedOptions[0].position;
|
|
|
+ info.value.siteFireProtection = selectedOptions[0];
|
|
|
+ info.value.position=selectedOptions[0].position;
|
|
|
showFireStation.value = false;
|
|
|
}
|
|
|
};
|
|
@@ -313,15 +353,15 @@ export default {
|
|
|
// 提交数据
|
|
|
const submit = () => {
|
|
|
//添加保存前判断
|
|
|
- if(info.siteName.id==""){
|
|
|
+ if(info.value.siteName.id==""){
|
|
|
window.xm.showToast({
|
|
|
message:"请先选择场所信息!"
|
|
|
})
|
|
|
}else{
|
|
|
|
|
|
//保存前附件处理
|
|
|
- info.enclosure = fileupList.value.map((option) => option.url).join("|");
|
|
|
- new securityFacilitiesErrService().save(info).then((res) => {
|
|
|
+ info.value.enclosure = fileupList.value.map((option) => option.url).join("|");
|
|
|
+ new securityFacilitiesErrService().save(info.value).then((res) => {
|
|
|
if(res.data=="保存安防设施异常成功"){
|
|
|
window.xm.showToast({
|
|
|
message:"保存成功!"
|