diff --git a/src/utils/api/index.js b/src/utils/api/index.js index d3b3206..4dee1b7 100644 --- a/src/utils/api/index.js +++ b/src/utils/api/index.js @@ -362,3 +362,13 @@ export function getReturnedPhotoJoggle(data) { data, }); } + +//获取装置信息 + +export function getTerminalInfoJoggle(data) { + return request({ + url: "/api/getTerminalInfo", + method: "post", + data, + }); +} diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog copy.vue b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog copy.vue new file mode 100644 index 0000000..f85c6f0 --- /dev/null +++ b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog copy.vue @@ -0,0 +1,279 @@ + + + diff --git a/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue index ba6a623..c489a04 100644 --- a/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue +++ b/src/views/management/monitoringEquipment/photographicDevice/components/addPhotoDialog.vue @@ -2,101 +2,70 @@ - - - - - - - - + + - - - - - - + + - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + + - - + + + {{ item.channelname }} + @@ -106,7 +75,7 @@ import { addTerminalJoggle, updateTerminalJoggle, getAllChannelListJoggle, - getAllTowerJoggle, + getSearchInfo, } from "@/utils/api/index"; export default { props: { @@ -117,12 +86,6 @@ export default { type: String, default: "新增", }, - formItem: { - type: Object, - default: function () { - return {}; - }, - }, }, data() { @@ -135,121 +98,81 @@ export default { } }; return { - page: 1, // 当前页数 - pageSize: 10, // 每页数量 - channelOptions: "", - channelArr: [], - toweridOptions: "", - toweridVal: "", - formInfo: {}, + isShow: false, + formInfo: { + // lineVal: "", + // towerVal: "", + // equipName: "", + // cmdid: "", + // simCard: "", + // displayName: "", + channelVal: [], + }, + channelOptions: [], //所有通道列表 + lineOptions: [], //线路 + toweridOptions: [], //杆塔 rules: { - // displayName: [ - // { required: true, message: "请输入显示名", trigger: "blur" }, - // ], cmdid: [ { required: true, message: "请输入装置ID", trigger: "blur" }, { validator: validCmid, trigger: "blur" }, ], - // lineid: [ - // { required: true, message: "请输入线路编号", trigger: "blur" }, - // ], - towerid: [ - { required: true, message: "请输入杆塔编号", trigger: "change" }, - ], - // hasPan: [ - // { required: true, message: "请输入是否带云台", trigger: "change" }, - // ], - channelVal: [ - { required: true, message: "请选择通道", trigger: "change" }, - ], - // equipName: [ - // { required: true, message: "请输入装置名称", trigger: "blur" }, - // ], - // model: [{ required: true, message: "请输入装置型号", trigger: "blur" }], - // latitude: [{ required: true, message: "请输入纬度", trigger: "blur" }], - // longitude: [{ required: true, message: "请输入经度", trigger: "blur" }], - // orgId: [{ required: true, message: "请输入原始 ID", trigger: "blur" }], - // essentialInfoVersion: [ - // { required: true, message: "请输入版本号", trigger: "blur" }, - // ], - // bsIdentifier: [ - // { required: true, message: "请输入出厂编号", trigger: "blur" }, - // ], - // bsManufacturer: [ - // { required: true, message: "请输入生产厂家", trigger: "blur" }, - // ], - // bsProductionDate: [ - // { required: true, message: "请输入生产日期", trigger: "blur" }, - // ], }, - //表单数组,对象 - formArr: [], }; }, methods: { + //判断 + getdataform(val) { + console.log(val); + if (val == null) { + return (this.formInfo = { + channelVal: [], + }); + } + this.formInfo = val; + }, // 保存确定操作 submitForm() { - this.$refs.formPhotoInfo.validate((valid) => { + this.$refs.formgrapInfo.validate((valid) => { if (valid) { - console.log(this.channelArr); - let formObj = { - bsIdentifier: this.formInfo.bsIdentifier, - bsManufacturer: this.formInfo.bsManufacturer, - bsProductionDate: this.formInfo.bsProductionDate, - cmdid: this.formInfo.cmdid, - displayName: this.formInfo.displayName, - equipName: this.formInfo.equipName, - essentialInfoVersion: this.formInfo.essentialInfoVersion, - hasPan: this.formInfo.hasPan, - latitude: this.formInfo.latitude, - //lineid: this.formInfo.lineid, - longitude: this.formInfo.longitude, - model: this.formInfo.model, - orgId: this.formInfo.orgId, - towerid: this.formInfo.towerid, - }; - this.formArr.push(formObj); - console.log(this.formArr); - // 走保存请求 + console.log(valid); if (this.photoDialogTitle == "新增") { - addTerminalJoggle({ list: this.formArr }) + console.log(this.formInfo); + this.formInfo = { + channelid: this.formInfo.channelVal, + cmdid: this.formInfo.cmdid, + lineid: this.formInfo.lineVal, + equipName: this.formInfo.equipName, + sim: this.formInfo.simCard, + displayName: this.formInfo.cmdid, + towerid: this.formInfo.towerVal, + }; + addTerminalJoggle(this.formInfo) .then((res) => { - console.log(res); - this.$emit("photoDialogClose", 1); //关闭弹窗 - this.formArr = []; - + this.isShow = false; this.$message.success("添加成功"); + this.$parent.terminalList(); //刷新 }) .catch((err) => { console.log(err); //代码错误、请求失败捕获 this.$message.error("添加失败"); }); - } else if (this.photoDialogTitle == "修改") { - let changeformObj = { - bsIdentifier: this.formInfo.bsIdentifier, - bsManufacturer: this.formInfo.bsManufacturer, - bsProductionDate: this.formInfo.bsProductionDate, + } else { + this.formInfo = { + channelid: this.formInfo.channelVal, cmdid: this.formInfo.cmdid, - displayName: this.formInfo.displayName, + lineid: this.formInfo.lineVal, equipName: this.formInfo.equipName, - essentialInfoVersion: this.formInfo.essentialInfoVersion, - hasPan: this.formInfo.hasPan, - latitude: this.formInfo.latitude, - // lineid: this.formInfo.lineid, - longitude: this.formInfo.longitude, - model: this.formInfo.model, - orgId: this.formInfo.orgId, - towerid: this.formInfo.towerid, - id: this.formInfo.id, + sim: this.formInfo.simCard, + displayName: this.formInfo.cmdid, + towerid: this.formInfo.towerVal, }; - updateTerminalJoggle(changeformObj) + updateTerminalJoggle(this.formInfo) .then((res) => { - console.log(res); - this.$emit("photoDialogClose", 1); //关闭弹窗 + this.isShow = false; this.$message.success("修改成功"); + this.$parent.lineList(); }) .catch((err) => { - console.log(err); //代码错误、请求失败捕获 this.$message.error("修改失败"); }); } @@ -259,11 +182,38 @@ export default { } }); }, - //取消关闭弹窗 - closeDialog(flag) { - this.$refs.formPhotoInfo.resetFields(); - this.formInfo.hasPan = 0; - this.$emit("photoDialogClose", flag); + + //获取所有线路 + getLine() { + getSearchInfo({ type: 2 }).then((res) => { + console.log(res); + this.lineOptions = res.data.list; + if (res.data.list.length == 0) { + this.lineOptions = []; + this.formInfo.lineVal = ""; + } else { + this.lineOptions = res.data.list; + this.formInfo.lineVal = res.data.list[0].id; + } + // this.dyOptions = res.data.list; + // this.formdata.dyid = res.data.list == [] ? "" : res.data.list[0].id; + this.getTower(); + }); + }, + //获取所有杆塔 + getTower() { + getSearchInfo({ type: 3, id: this.formInfo.lineVal }) + .then((res) => { + console.log(res); + if (res.data.list.length == 0) { + this.toweridOptions = []; + this.formInfo.towerVal = ""; + } else { + this.toweridOptions = res.data.list; + this.formInfo.towerVal = res.data.list[0].id; + } + }) + .catch((err) => {}); }, //获取所有通道 getChannel() { @@ -276,68 +226,38 @@ export default { console.log(err); }); }, - //杆塔编号选择 - getTowerid() { - getAllTowerJoggle() - .then((res) => { - this.toweridOptions = res.data.list; - console.log(this.channelOptions); - }) - .catch((err) => { - console.log(err); - }); - }, - //通道id 选择 - changeChannelId(val) { - console.log(val); - this.channelArr = val; + display() { + this.isShow = true; }, - //通道id 选择 - changetowerid(val) { - let opt = {}; - opt = this.toweridOptions.find((item) => { - return item.lineName; - }); - // let channelObj = {}; - // channelObj = this.channelOption.find(function (i) { - // return i.value; - // }); - console.log(opt.lineName); - //this.toweridVal = val; + hide() { + this.isShow = false; }, }, - mounted() { - console.log("打印传过来的对象", this.formItem); - console.log("打印传过来的对象", this.formItem.bsIdentifier); - this.formInfo = JSON.parse(JSON.stringify(this.formItem)); - }, + mounted() {}, created() { this.getChannel(); - this.getTowerid(); - }, - watch: { - formItem: { - handler(newVal, oldVal) { - // 调用函数 - this.$nextTick(() => { - this.formInfo = JSON.parse(JSON.stringify(this.formItem)); - }); - }, - immediate: true, - deep: true, - }, + this.getLine(); }, + watch: {}, };