feat: 同步2

This commit is contained in:
huangchengfa 2025-03-30 22:21:59 +08:00
parent 9ff1938221
commit 9dadfea1f6
13 changed files with 2123 additions and 619 deletions

View File

@ -21,8 +21,8 @@
<el-table-column width="55" #default="{ row }">
<el-radio v-model="ridioIndex" :label="row.id"></el-radio>
</el-table-column>
<el-table-column prop="sitename" align="center" label="场所"></el-table-column>
<el-table-column prop="partname" align="center" label="部位"></el-table-column>
<el-table-column prop="sitename" align="center" label="场所"></el-table-column>
<el-table-column prop="partname" align="center" label="部位"></el-table-column>
<el-table-column prop="name" align="center" label="设备名称"></el-table-column>
<el-table-column prop="nbbh" align="center" label="内部编号"></el-table-column>
</el-table>
@ -155,20 +155,8 @@ const getListData = async () => {
tableData.value = [];
tableloading.value = true;
const params = listQuery.value;
getApi(params, "/mosty-jcgl/aqsbssZb/getPage").then((res) => {
getApi(params, "/mosty-jcgl/sbglAqsbss/getPage").then((res) => {
if (res) {
res.records.forEach(item => {
let card = item.idEntityCard
if (card) {
if (card.length == 18) {
item.sex = (card.substring(16, 17)) % 2 == 0 ? '2' : '1'
} else {
item.sex = '1'
}
} else {
item.sex = null
}
})
tableData.value = res?.records;
total.value = Number(res.total);
tableloading.value = false;

View File

@ -1,141 +1,141 @@
<template>
<div style="width:100%">
<!-- radio -->
<el-radio-group v-model="modelVal" @change="onChange" v-if="props.selectType === 'radio'"
:disabled="props.disabled">
<el-radio v-for="(item, i) in props.dictData" :key="i" :label="item.value ? item.value : item.dm"
:disabled="item.disabled" @click='getlable(item)'>{{ item.label ? item.label : item.zdmc
}}</el-radio>
</el-radio-group>
<!-- select -->
<el-select class="pxdx_box" v-model="modelVal" clearable :multiple='props.multiple' :disabled="props.disabled"
:placeholder="props.placeholder" v-else-if="props.selectType === 'select'" @change="onChange" @clear="changeclear"
style="width:100%" :collapse-tags="collapseTags">
<el-option v-for="item in props.dictData" :key="item.value" :label="item.label" :value="item.value"
@click='getlable(item)' :disabled="item.disabled" />
</el-select>
</div>
</template>
<script setup>
import { defineProps, defineEmits, watchEffect, watch } from "vue"
const props = defineProps({
modelValue: String,// ||
dictData: Array, //
disabled: {
type: Boolean,
default: false
},//
placeholder: {
type: String,
default: "请选择"
},
//
multiple: {
type: Boolean,
default: false
},
//
selectType: {
type: String,
default: "radio" //radio || select
},
/** 原生属性 -- 多选时是否将选中值按文字的形式展示 */
collapseTags: {
type: Boolean,
default: undefined,
},
//
disabledItem: Array,
/** 自动清空字典匹配不上的内容(目前仅做单选) */
autoClear: {
type: Boolean,
default: true
}
})
const modelVal = defineModel()
const emits = defineEmits(["update:modelValue", 'onChange', 'getselect', 'changeclear'])
const onChange = (val) => {
emits("update:modelValue", val)
let namearr = []
if (props.multiple) {
for (let i = 0; i < val.length; i++) {
const name = props.dictData && props.dictData.find(item => item.value == val[i])?.label
namearr.push(name)
}
emits("onChange", val, namearr)
} else {
const label = props.dictData && props.dictData.find(item => item.value == val)?.label
emits("onChange", val, label)
}
}
function getlable(val) {
if (props.disabled) return
emits("getselect", val)
}
function changeclear(val) {
emits("changeclear", val)
}
/** 获取需要的内容 */
const getNeedVal = (val,dictData) => {
let arr = []
if (typeof val === 'string' && val) {
arr = val.split(',')
} else if (Array.isArray(val)) {
arr = val.map(item=>item)
}
/** 是否有脏数据,即字典没有的数据 */
const isSomeNotHad = arr.some(value => {
return !dictData.find(item => item.value == value)
})
if (isSomeNotHad) {
arr = arr.filter(value => {
const obj = dictData.find(item => item.value == value)
return obj
})
}
return arr
}
watch([() => props.dictData, () => props.modelValue], ([opt, val]) => {
if (props.autoClear && opt?.length && val?.length) {
//
if (props.multiple) {
// const newVal = getNeedVal(val,opt)
// emits("update:modelValue", newVal)
//
} else {
//
let arr = Array.isArray(opt) ? opt : []
const curr = arr.find(item => item?.value == val)
if (!curr) emits("update:modelValue", '')
}
}
})
watchEffect(() => {
//
if (props.dictData?.length) {
props.dictData.forEach(item => {
item.disabled = false
})
if (props.disabledItem?.length) {
props.dictData.forEach(item => {
props.disabledItem.forEach(it => {
if (item.value == it) {
item.disabled = true
}
})
})
} else {
props.dictData.forEach(item => {
item.disabled = false
})
}
}
})
</script>
<style>
.el-select-dropdown__item.is-disabled {
color: #999 !important;
}
</style>
<template>
<div style="width:100%">
<!-- radio -->
<el-radio-group v-model="modelVal" @change="onChange" v-if="props.selectType === 'radio'"
:disabled="props.disabled">
<el-radio v-for="(item, i) in props.dictData" :key="i" :label="item.value ? item.value : item.dm"
:disabled="item.disabled" @click='getlable(item)'>{{ item.label ? item.label : item.zdmc
}}</el-radio>
</el-radio-group>
<!-- select -->
<el-select class="pxdx_box" v-model="modelVal" clearable :multiple='props.multiple' :disabled="props.disabled"
:placeholder="props.placeholder" v-else-if="props.selectType === 'select'" @change="onChange" @clear="changeclear"
style="width:100%" :collapse-tags="collapseTags">
<el-option v-for="item in props.dictData" :key="item.value" :label="item.label" :value="item.value"
@click='getlable(item)' :disabled="item.disabled" />
</el-select>
</div>
</template>
<script setup>
import { defineProps, defineEmits, watchEffect, watch } from "vue"
const props = defineProps({
modelValue: String,// ||
dictData: Array, //
disabled: {
type: Boolean,
default: false
},//
placeholder: {
type: String,
default: "请选择"
},
//
multiple: {
type: Boolean,
default: false
},
//
selectType: {
type: String,
default: "radio" //radio || select
},
/** 原生属性 -- 多选时是否将选中值按文字的形式展示 */
collapseTags: {
type: Boolean,
default: undefined,
},
//
disabledItem: Array,
/** 自动清空字典匹配不上的内容(目前仅做单选) */
autoClear: {
type: Boolean,
default: true
}
})
const modelVal = defineModel()
const emits = defineEmits(["update:modelValue", 'onChange', 'getselect', 'changeclear'])
const onChange = (val) => {
emits("update:modelValue", val)
let namearr = []
if (props.multiple) {
for (let i = 0; i < val.length; i++) {
const name = props.dictData && props.dictData.find(item => item.value == val[i])?.label
namearr.push(name)
}
emits("onChange", val, namearr)
} else {
const label = props.dictData && props.dictData.find(item => item.value == val)?.label
emits("onChange", val, label)
}
}
function getlable(val) {
if (props.disabled) return
emits("getselect", val)
}
function changeclear(val) {
emits("changeclear", val)
}
/** 获取需要的内容 */
const getNeedVal = (val,dictData) => {
let arr = []
if (typeof val === 'string' && val) {
arr = val.split(',')
} else if (Array.isArray(val)) {
arr = val.map(item=>item)
}
/** 是否有脏数据,即字典没有的数据 */
const isSomeNotHad = arr.some(value => {
return !dictData.find(item => item.value == value)
})
if (isSomeNotHad) {
arr = arr.filter(value => {
const obj = dictData.find(item => item.value == value)
return obj
})
}
return arr
}
watch([() => props.dictData, () => props.modelValue], ([opt, val]) => {
if (props.autoClear && opt?.length && val?.length) {
//
if (props.multiple) {
// const newVal = getNeedVal(val,opt)
// emits("update:modelValue", newVal)
//
} else {
//
let arr = Array.isArray(opt) ? opt : []
const curr = arr.find(item => item?.value == val)
if (!curr) emits("update:modelValue", '')
}
}
})
watchEffect(() => {
//
if (props.dictData?.length) {
props.dictData.forEach(item => {
item.disabled = false
})
if (props.disabledItem?.length) {
props.dictData.forEach(item => {
props.disabledItem.forEach(it => {
if (item.value == it) {
item.disabled = true
}
})
})
} else {
props.dictData.forEach(item => {
item.disabled = false
})
}
}
})
</script>
<style>
.el-select-dropdown__item.is-disabled {
color: #999 !important;
}
</style>

View File

@ -1,107 +1,107 @@
<template>
<div style="width: 100%;">
<el-cascader ref="cascader" v-model="modelVal" filterable :props="pageData.cascaderProps"
:options="pageData.options" @change="handleChange" :placeholder="props.placeholder" style="width: 100%;"
:disabled="props.disabled" :show-all-levels="showAllLevels" clearable />
</div>
</template>
<script setup>
import { defineProps, reactive, onMounted, defineEmits, ref, watchEffect } from "vue"
import { getApi } from "@/api/tobAcco_api.js";
const props = defineProps({
modelValue: String,//||
placeholder: {
type: String,
default: "请选择"
},
// || xzqh || array()
type: {
type: String,
default: ""
},
zdlist: {
type: Array,
default: [],//()
},
disabled: Boolean,
zdbh: String,//
})
const modelVal = defineModel()
const cascader = ref()
const emits = defineEmits(["update:modelValue", "nameChange", "onChange"])
const showAllLevels = ref(false);//
const pageData = reactive({
options: [],
cascaderProps: {
children: "itemList",
label: "zdmc",
value: "dm",
checkStrictly: false
}
})
onMounted(() => {
})
//
const getDictCdata = () => {
showAllLevels.value = false;
getApi({ zdbh: props.zdbh }, "/mosty-base/sysDict/getDictTree").then(res => {
if (res) {
pageData.options = res.itemList
}
})
}
//
const getXzqhDictCdata = () => {
showAllLevels.value = false;
pageData.cascaderProps.checkStrictly = true
getApi({ zdbh: props.zdbh, dm: "52" }, "/mosty-base/sysDict/getDictTreeXzqh").then(res => {
pageData.options = res ? res.itemList : []
})
}
const handleChange = (val) => {
if (cascader.value.getCheckedNodes()[0]) {
/** 选择的名称数组例如['载客','大型'] */
const pathLabels = cascader.value.getCheckedNodes()[0].pathLabels
/**选择的值 例如 [1,2] */
const pathValues = cascader.value.getCheckedNodes()[0].pathValues
const checkedNodes = cascader.value.getCheckedNodes()[0].label
const checkObj = {
dm: cascader.value.getCheckedNodes()[0].value,
label: cascader.value.getCheckedNodes()[0].label,
}
emits("update:modelValue", cascader.value.getCheckedNodes()[0].value)
emits("nameChange", checkedNodes, pathLabels)
emits("onChange", checkObj, pathValues)
} else {
emits("update:modelValue", '')
emits("nameChange", null, [])
emits("onChange", null, [])
}
}
watchEffect(() => {
if (props.zdbh) {
if (props.type == 'xzqh') {
getXzqhDictCdata()
} else {
getDictCdata()
}
} else {
if (props.type == 'array') {
pageData.options = props.zdlist
}
}
})
</script>
<style lang="scss" scoped></style>
<style>
.el-cascader-node:not(.is-disabled):focus,
.el-cascader-node:not(.is-disabled):hover {
color: #fff;
}
<template>
<div style="width: 100%;">
<el-cascader ref="cascader" v-model="modelVal" filterable :props="pageData.cascaderProps"
:options="pageData.options" @change="handleChange" :placeholder="props.placeholder" style="width: 100%;"
:disabled="props.disabled" :show-all-levels="showAllLevels" clearable />
</div>
</template>
<script setup>
import { defineProps, reactive, onMounted, defineEmits, ref, watchEffect } from "vue"
import { getApi } from "@/api/tobAcco_api.js";
const props = defineProps({
modelValue: String,//||
placeholder: {
type: String,
default: "请选择"
},
// || xzqh || array()
type: {
type: String,
default: ""
},
zdlist: {
type: Array,
default: [],//()
},
disabled: Boolean,
zdbh: String,//
})
const modelVal = defineModel()
const cascader = ref()
const emits = defineEmits(["update:modelValue", "nameChange", "onChange"])
const showAllLevels = ref(false);//
const pageData = reactive({
options: [],
cascaderProps: {
children: "itemList",
label: "zdmc",
value: "dm",
checkStrictly: false
}
})
onMounted(() => {
})
//
const getDictCdata = () => {
showAllLevels.value = false;
getApi({ zdbh: props.zdbh }, "/mosty-base/sysDict/getDictTree").then(res => {
if (res) {
pageData.options = res.itemList
}
})
}
//
const getXzqhDictCdata = () => {
showAllLevels.value = false;
pageData.cascaderProps.checkStrictly = true
getApi({ zdbh: props.zdbh, dm: "52" }, "/mosty-base/sysDict/getDictTreeXzqh").then(res => {
pageData.options = res ? res.itemList : []
})
}
const handleChange = (val) => {
if (cascader.value.getCheckedNodes()[0]) {
/** 选择的名称数组例如['载客','大型'] */
const pathLabels = cascader.value.getCheckedNodes()[0].pathLabels
/**选择的值 例如 [1,2] */
const pathValues = cascader.value.getCheckedNodes()[0].pathValues
const checkedNodes = cascader.value.getCheckedNodes()[0].label
const checkObj = {
dm: cascader.value.getCheckedNodes()[0].value,
label: cascader.value.getCheckedNodes()[0].label,
}
emits("update:modelValue", cascader.value.getCheckedNodes()[0].value)
emits("nameChange", checkedNodes, pathLabels)
emits("onChange", checkObj, pathValues)
} else {
emits("update:modelValue", '')
emits("nameChange", null, [])
emits("onChange", null, [])
}
}
watchEffect(() => {
if (props.zdbh) {
if (props.type == 'xzqh') {
getXzqhDictCdata()
} else {
getDictCdata()
}
} else {
if (props.type == 'array') {
pageData.options = props.zdlist
}
}
})
</script>
<style lang="scss" scoped></style>
<style>
.el-cascader-node:not(.is-disabled):focus,
.el-cascader-node:not(.is-disabled):hover {
color: #fff;
}
</style>

View File

@ -3,7 +3,7 @@
<!-- 查询 -->
<div class='tabox'>
<div class="headBox3">
<el-input placeholder="请输入内部编号进行查询" v-model="pageData.listQuery.nbbh" clearable style='width:250px'></el-input>
<el-input placeholder="请输入设备编号进行查询" v-model="pageData.listQuery.sbbh" clearable style='width:250px'></el-input>
<el-button type="primary" @click="Searchdata" class="ml6">
<el-icon>
<Search />
@ -19,6 +19,9 @@
</div>
<MOSTY.Table :table-columns="pageData.tableColumns" :tableData="pageData.tableData" :tableloading="tableloading"
:tableHeight="'40vh'" :isSort="true" @SortChange="SortChange">
<template #cameraType="{ row }">
<dict-tag :options="D_BZ_SXTLX" :value="row.cameraType" :tag="false" />
</template>
<template #actions="{ row, $index }">
<span class="operedit" @click="handlexg(row, $index)" v-if='props.isEdit'>
<el-icon>
@ -59,6 +62,7 @@ import { reactive, ref, getCurrentInstance, watchEffect } from "vue"
import { getApi, postApi } from "@/api/tobAcco_api.js";
import { ElMessage } from "element-plus";
const { proxy } = getCurrentInstance();
const { D_BZ_SXTLX } = proxy.$dict("D_BZ_SXTLX")
const emits = defineEmits(["handleChange", 'tableChange']);
const tableloading = ref(false);
const addbpdShow = ref(false)
@ -78,6 +82,11 @@ const props = defineProps({
isEdit: {
type: Boolean,
default: true
},
//
sblx: {
type: String,
default: ''
}
});
const formData = ref({})
@ -93,8 +102,8 @@ const pageData = reactive({
sortable: true
},
{
title: "内部编号",
prop: "nbbh",
title: "设备编号",
prop: "sbbh",
sortable: true
},
{
@ -126,8 +135,15 @@ const pageData = reactive({
tableData: []
})
watchEffect(() => {
if (props.obj.id) {
pageData.listQuery.zbid = props.obj.id
if (props.sblx == '200102010000') {
pageData.tableColumns.splice(2, 0, {
title: "类型",
prop: "cameraType",
slot: true
})
}
if (props.obj.parentid) {
pageData.listQuery.zbid = props.obj.parentid
//
getzblist()
}
@ -178,7 +194,7 @@ function handleSee(row) {
function handledelete(row) {
getApi({}, `/mosty-jcgl/aqsbssZb/del/${row.id}`).then(res => {
ElMessage.success("删除成功");
emits("searchChange", true);
emits("tableChange", true);
getzblist()
})
}

View File

@ -28,19 +28,25 @@
:label="item.partname ? item.partname : item.qtmc" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="设备编号:" prop="sbbh">
<el-input v-model="fromObj.sbbh" clearable style="width: 337px"></el-input>
</el-form-item>
<el-form-item label="设备名称:" prop="name">
<el-input v-model="fromObj.name" style="width: 337px" />
</el-form-item>
<el-form-item label="具体位置:" prop="location">
<el-input v-model="fromObj.location" clearable style="width: 337px"></el-input>
</el-form-item>
<el-form-item label="摄像头国标编号:" prop="spbh" v-if="fromObj.sblx == '200102010000'">
<el-input v-model="fromObj.spbh" clearable type="number" style="width: 337px"></el-input>
<el-form-item label="摄像头类型:" prop="cameraType" v-if="fromObj.sblx == '06'">
<el-select v-model="fromObj.cameraType" style="width: 337px;">
<el-option v-for="item in D_BZ_SXTLX" :key="item.value" :label="item.label"
:value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="摄像头IP地址:" prop="ipaddr" v-if="fromObj.sblx == '200102010000'">
<el-form-item label="摄像头IP地址:" prop="ipaddr" v-if="fromObj.sblx == '06'">
<el-input v-model="fromObj.ipaddr" clearable style="width: 337px"></el-input>
</el-form-item>
<el-form-item label="摄像头端口号:" prop="port" v-if="fromObj.sblx == '200102010000'">
<el-form-item label="摄像头端口号:" prop="port" v-if="fromObj.sblx == '06'">
<el-input v-model="fromObj.port" type="number" clearable style="width: 337px"></el-input>
</el-form-item>
</el-form>
@ -65,13 +71,15 @@ import { ElMessage } from "element-plus";
import { getApi, postApi } from "@/api/tobAcco_api.js";
const { proxy } = getCurrentInstance();
const saveloading = ref(false)
const { D_BZ_SXTLX } = proxy.$dict("D_BZ_SXTLX")
const rules = {
sitename: [{ required: true, message: "请输入场所名称", trigger: "blur" }],
cameraType: [{ required: true, message: "请选择摄像头类型", trigger: "blur" }],
buildingname: [{ required: true, message: "请选择所属建筑物", trigger: "blur" }],
floorname: [{ required: true, message: "请选择所属楼层", trigger: "blur" }],
partname: [{ required: true, message: "请选择所属部位", trigger: "blur" }],
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
spbh: [{ required: true, message: "请输入摄像头国标编号", trigger: "blur" }],
sbbh: [{ required: true, message: "请输入设备编号", trigger: "blur" }],
ipaddr: [{ required: true, message: "请输入摄像头IP地址", trigger: "blur" }],
port: [{ required: true, message: "请输入摄像头端口号", trigger: "blur" }],
location: [{ required: true, message: "请输入具体位置", trigger: "blur" }],
@ -89,10 +97,11 @@ const bwlist = ref([])
const emit = defineEmits("saveSuccess");
const ruleFormRef = ref();
onMounted(() => {
console.log(props.formData.sblx)
fromObj.value.sblx = props.formData.sblx
fromObj.value.sitename = props.formData.sitename
fromObj.value.siteid = props.formData.siteid
fromObj.value.zbid = props.formData.id
fromObj.value.zbid = props.formData.parentid
getjzwlist(props.formData.siteid)
if (props.formData.id) {
getmain(props.formData.id)
@ -203,24 +212,10 @@ function getmain(id) {
getlcxq(res.buildingid);
getjzwlist(res.siteid)
getbwdata(res.floorid)
gettotal()
}
});
}
}
//
function gettotal() {
postApi({
bizId: fromObj.value.id,
bizType: fromObj.value.sblx
}, '/mosty-jcgl/deviceUpkeepRecord/statistics').then(res => {
tablist2.value.forEach(item => {
if (item.title.includes(["维保记录"])) {
item.num = res ? res : 0
}
})
})
}
//
function getlcxq(id) {
getApi({}, `/mosty-jcgl/building/getBuildingById/${id}`).then(res => {
@ -234,17 +229,11 @@ function getlcxq(id) {
}
const black = () => {
if (props.formData.saveBtnShow) {
proxy.$modal.confirm('离开会丢失页面中修改的内容,确认离开吗?')
.then(() => {
//
ruleFormRef.value.clearValidate();
emit("saveSuccess");
})
.catch(() => {
// catch error
})
proxy.$modal.confirm('离开会丢失页面中修改的内容,确认离开吗?').then(() => {
ruleFormRef.value.clearValidate();
emit("saveSuccess");
})
} else {
//
ruleFormRef.value.clearValidate();
emit("saveSuccess");
}

View File

@ -1,79 +1,77 @@
import * as ElIcons from "@element-plus/icons-vue";
import { createApp, reactive } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import { getItem, removeAllItem } from "@/utils/storage";
import installElementPlus from "./plugins/element";
import plugins from "./plugins";
import "./assets/css/element-plus.scss";
import "./assets/css/layout.scss";
import "./assets/css/public.scss";
import ELMessage from "element-plus";
import InfiniteScroll from "./utils/lazyLoad";
import DictTag from "@/components/DictTag/index";
import * as echarts from "echarts";
import percentageDirective from "@/utils/percentage";
import VueUeditorWrap from "vue-ueditor-wrap";
import { ElMessageBox, ElMessage } from "element-plus"
const app = createApp(App);
app.directive("percentage", percentageDirective);
import * as ElIcons from "@element-plus/icons-vue"
import { createApp } from "vue"
import App from "./App.vue"
import router from "./router"
import store from "./store"
import { getItem } from "@/utils/storage"
import installElementPlus from "./plugins/element"
import plugins from "./plugins"
import "./assets/css/element-plus.scss"
import "./assets/css/layout.scss"
import "./assets/css/public.scss"
import ELMessage from "element-plus"
import InfiniteScroll from "./utils/lazyLoad"
import DictTag from "@/components/DictTag/index"
import * as echarts from "echarts"
import percentageDirective from "@/utils/percentage"
import VueUeditorWrap from "vue-ueditor-wrap"
const app = createApp(App)
app.directive("percentage", percentageDirective)
//注册自定义指令
// app.use(InfiniteScroll);
app.use(VueUeditorWrap);
Object.keys(ElIcons).forEach((key) => {
app.use(VueUeditorWrap)
Object.keys(ElIcons).forEach(key => {
//全局注册 element 图标
app.component(key, ElIcons[key]);
});
app.component(key, ElIcons[key])
})
//告诉前页面内的事件监听器内部是否会调用preventDefault函数来阻止事件的默认行为以便浏览器根据这个信息更好地做出决策来优化页面性能
// import "default-passive-events";
import installDirective from "@/directives";
import installDirective from "@/directives"
// 初始化样式表
import "@/styles/base.scss";
import "@/styles/base.scss"
// import "@/styles/common.scss";
// 导入svgIcon
import installIcons from "@/icons";
import installIcons from "@/icons"
//导入路由鉴权
import "./permission";
import "./permission"
//全局属性(v2过滤器)
import installFilter from "@/filters";
import installFilter from "@/filters"
//事件总线
import mitt from "mitt";
import mitt from "mitt"
import { resetForm } from "@/utils/validate";
import { getDict, setCascader, getDictValue, setDict } from "@/utils/dict";
import { resetForm } from "@/utils/validate"
import { getDict, setCascader, getDictValue, setDict } from "@/utils/dict"
//挂载全局方法
app.config.globalProperties.resetForm = resetForm;
app.config.globalProperties.InfiniteScroll = InfiniteScroll;
app.config.globalProperties.$dict = getDict; //字典公共函数
app.config.globalProperties.$message = ELMessage; //element提示组件
app.config.globalProperties.$set = setCascader; //设置级联选择器回显
app.config.globalProperties.$getDictVal = getDictValue; //翻译字典数据
app.config.globalProperties.$setDict = setDict; //翻译字典数据
app.config.globalProperties.mittBus = new mitt(); //配置事件总线
app.component("DictTag", DictTag); //字典组件
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.InfiniteScroll = InfiniteScroll
app.config.globalProperties.$dict = getDict //字典公共函数
app.config.globalProperties.$message = ELMessage //element提示组件
app.config.globalProperties.$set = setCascader //设置级联选择器回显
app.config.globalProperties.$getDictVal = getDictValue //翻译字典数据
app.config.globalProperties.$setDict = setDict //翻译字典数据
app.config.globalProperties.mittBus = new mitt() //配置事件总线
app.config.globalProperties.$Hls = window.Hls //配置事件总线
app.component("DictTag", DictTag) //字典组件
// 将echarts挂载到全局中这样组件就能通过 this.$echarts 访问了
app.config.globalProperties.$echarts = echarts; //echarts图表
installElementPlus(app);
installIcons(app);
installFilter(app);
installDirective(app);
app.use(store).use(router).use(plugins).mount("#app");
app.config.globalProperties.$echarts = echarts //echarts图表
installElementPlus(app)
installIcons(app)
installFilter(app)
installDirective(app)
app.use(store).use(router).use(plugins).mount("#app")
// 路由的导航守卫,主要防止未登录时跳转到其他页面
router.beforeEach((to, from, next) => {
let token = getItem("token");
let token = getItem("token")
if (to.path === "/login") {
window.localStorage.removeItem("token");
next();
window.localStorage.removeItem("token")
next()
} else {
if (!token) next("/login");
else next();
if (!token) next("/login")
else next()
}
});
})

File diff suppressed because it is too large Load Diff

View File

@ -100,7 +100,6 @@ function getlogin() {
isTrue.value = true
})
} else {
if (loginForm.value.checked) {
localStorage.setItem("userName", loginForm.value.userName);
localStorage.setItem("password", loginForm.value.password);
@ -115,26 +114,20 @@ function getlogin() {
fullPath: "/dutyBook/home/workbench",
meta: {
meta: {
title: "工作台"
// icon: "gerenzhongxin"
title: "消防管理大屏"
}
},
name: "dutyBook/home/workbench",
params: {},
path: "/dutyBook/home/workbench",
query: {},
title: "工作台"
title: "消防管理大屏"
},
{
immediate: true
}
);
// router.push('/editPassword')
router.push('/dutyBook/home/workbench')
// router.push('/newsystem').then(() => {
// //
// location.reload();
// });
getuserinfo()
}

View File

@ -8,6 +8,12 @@
<el-form-item label="设备名称:" prop="sbmc">
<el-input v-model="data.fromObj.sbmc" placeholder="请输入设备名称" style="width: 220px"></el-input>
</el-form-item>
<el-form-item label="设备类型:" prop="cameraType">
<el-select v-model="data.fromObj.cameraType" placeholder="请选择设备类型" clearable style="width: 220px">
<el-option v-for="item in D_BZ_SXTLX" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="国标编号:" prop="sbbh">
<el-input v-model="data.fromObj.sbbh" type="number" placeholder="请输入国标编号" style="width: 220px"></el-input>
</el-form-item>
@ -56,7 +62,7 @@ import ChooseUser from "@/components/MyComponents/ChooseUser/Leader.vue"
import PageTitle from "@/components/PageTitle/PageTitle.vue"
import MyTable from "@/components/aboutTable/MyTable/index.vue"
const { proxy } = getCurrentInstance()
const { D_BZ_DLSBZT } = proxy.$dict("D_BZ_DLSBZT")
const { D_BZ_DLSBZT, D_BZ_SXTLX } = proxy.$dict("D_BZ_DLSBZT", "D_BZ_SXTLX")
const ruleFormRef = ref()
const props = defineProps({
saveBtnShow: {
@ -70,6 +76,7 @@ const props = defineProps({
})
const rules = reactive({
sbmc: [{ required: true, message: "请输入设备名称" }],
cameraType: [{ required: true, message: "请选择设备类型" }],
sbbh: [{ required: true, message: "请输入设备编号" }],
sbzt: [{ required: true, message: "请选择设备状态" }],
hosts: [{ required: true, message: "请输入IP地址" }],

View File

@ -18,9 +18,14 @@
<MOSTY.Table :table-columns="data.tableColumn" :tableData="data.tableData" :tableloading="tableloading"
:isSort="true">
<template #sbzt="{ row }">
<dict-tag v-if="row.sbzt" :options="D_BZ_DLSBZT" :value="row.sbzt" :tag="false" :color="row.sbzt == '01' ? 'green' : 'orange'" />
<dict-tag v-if="row.sbzt" :options="D_BZ_DLSBZT" :value="row.sbzt" :tag="false"
:color="row.sbzt == '01' ? 'green' : 'orange'" />
<span v-else></span>
</template>
<template #cameraType="{ row }">
<dict-tag v-if="row.cameraType" :options="D_BZ_SXTLX" :value="row.cameraType" :tag="false" />
<span v-else>--</span>
</template>
<!--操作-->
<template #actions="{ row }">
<span class="operesee" @click="seeInfo(row)"><el-icon>
@ -56,7 +61,7 @@ import { exportXlsx } from "@/excel/Export2Excel.js"
import { ElMessage } from "element-plus"
import { reactive, onMounted, ref, getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
const { D_BZ_DLSBZT } = proxy.$dict("D_BZ_DLSBZT")
const { D_BZ_DLSBZT, D_BZ_SXTLX } = proxy.$dict("D_BZ_DLSBZT", "D_BZ_SXTLX")
const emit = defineEmits("changePage")
const tableloading = ref(false)
const listQuery = reactive({
@ -72,6 +77,13 @@ const searchArr = reactive([
width: "250px",
placeholder: "请选择设备状态"
},
{
showType: "select",
prop: "cameraType",
options: D_BZ_SXTLX,
width: "250px",
placeholder: "请选择设备类型"
},
{
showType: "input",
prop: "keywords",
@ -99,6 +111,11 @@ const data = reactive({
title: "端口号",
prop: "port"
},
{
title: "设备类型",
prop: "cameraType",
slot: true
},
{
title: "设备状态",
prop: "sbzt",
@ -127,6 +144,7 @@ const changeSize = val => {
const onSearch = obj => {
listQuery.sbzt = obj.sbzt
listQuery.keywords = obj.keywords
listQuery.cameraType = obj.cameraType
getTableData()
}
//

View File

@ -1,67 +1,83 @@
<template>
<MOSTY.FromPage :title="props.formData.title" @closeDialog="closepost">
<MOSTY.FromPage :title="props.editObj.title" @closeDialog="closepost">
<template #content>
<MOSTY.Assort :title="'基础信息'" />
<el-form :model="props.formData" ref="ruleFormRef" label-position="right" :rules="rules" label-width="150px"
:disabled='!props.formData.saveBtnShow'>
<el-form :model="data.config" ref="ruleFormRef" label-position="right" :rules="rules" label-width="150px"
:disabled='!props.editObj.saveBtnShow'>
<el-form-item label="设备类型:" prop="sblx">
<el-select v-model="props.formData.sblx" placeholder="请选择设备类型" clearable style="width: 337px">
<el-select v-model="data.config.sblx" placeholder="请选择设备类型" clearable style="width: 337px">
<el-option v-for="item in D_BZ_YJSBLX" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="预警设备名称:" prop="sbmc">
<el-input v-model="props.formData.sbmc" style="width: 337px" />
<el-input v-model="data.config.sbmc" style="width: 337px" />
</el-form-item>
<el-form-item label="设备编号:" prop="sbbh">
<el-input v-model="props.formData.sbbh" style="width: 337px" />
<el-input v-model="data.config.sbbh" style="width: 337px" />
</el-form-item>
<el-form-item label="设备状态:" prop="sbzt">
<el-select v-model="props.formData.sbzt" placeholder="请选择设备状态" clearable style="width: 337px">
<el-select v-model="data.config.sbzt" placeholder="请选择设备状态" clearable style="width: 337px">
<el-option v-for="item in D_BZ_DLSBZT" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="IP地址" prop="ipaddr">
<el-input v-model="data.config.ipaddr" placeholder="请输入IP地址" style="width: 337px"></el-input>
</el-form-item>
<el-form-item label="端口号:" prop="port">
<el-input v-model="data.config.port" type="number" placeholder="请输入端口号" style="width: 337px"></el-input>
</el-form-item>
<el-form-item label="绑定设备:" prop="parentname">
<el-input v-model="props.formData.parentname" style="width: 337px" readonly clearable>
<el-input v-model="data.config.parentname" style="width: 337px" readonly clearable>
<template #append>
<el-button class='cursor' @click="chooseSb()">选择</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="设备名称:" prop="name">
<el-input v-model="props.formData.name" style="width: 337px" disabled />
</el-form-item>
<el-form-item label="所属场所:" prop="sitename">
<el-input v-model="props.formData.sitename" style="width: 337px" disabled />
<el-input v-model="data.config.sitename" style="width: 337px" disabled />
</el-form-item>
<el-form-item :label="props.formData.publicarea == '1' ? '所属场区:' : '所属建筑物:'" prop="buildingname">
<el-input v-model="props.formData.buildingname" style="width: 337px" disabled />
<el-form-item :label="data.config.publicarea == '1' ? '所属场区:' : '所属建筑物:'" prop="buildingname">
<el-input v-model="data.config.buildingname" style="width: 337px" disabled />
</el-form-item>
<el-form-item label="所属楼层:" prop="floorname" v-if="props.formData.publicarea != '1'">
<el-input v-model="props.formData.floorname" style="width: 337px" disabled />
<el-form-item label="所属楼层:" prop="floorname" v-if="data.config.publicarea != '1'">
<el-input v-model="data.config.floorname" style="width: 337px" disabled />
</el-form-item>
<el-form-item label="部位名称:" prop="partname">
<el-input v-model="props.formData.partname" style="width: 337px" disabled />
<el-input v-model="data.config.partname" style="width: 337px" disabled />
</el-form-item>
<el-form-item label="责任部门:" prop="deptname">
<el-input v-model="props.formData.deptname" style="width: 337px" disabled />
<el-input v-model="data.config.deptname" style="width: 337px" disabled />
</el-form-item>
<el-form-item label="责任人:" style="width: 100%; " prop="responsibilitypersonname">
<el-input v-model="props.formData.responsibilitypersonname" :rows="3" type="textarea" style="width:1310px"
<el-input v-model="data.config.responsibilitypersonname" :rows="3" type="textarea" style="width:1310px"
disabled />
</el-form-item>
<el-form-item label="具体位置:" style="width: 100%; " prop="location">
<el-input v-model="props.formData.location" :rows="3" type="textarea" style="width:1310px" />
<el-input v-model="data.config.location" :rows="3" type="textarea" style="width:1310px" />
</el-form-item>
<el-form-item label="备注:" style="width: 100%; ">
<el-input v-model="props.formData.bz" :rows="3" type="textarea" style="width:1310px" />
<el-input v-model="data.config.bz" :rows="3" type="textarea" style="width:1310px" />
</el-form-item>
</el-form>
<MOSTY.Assort v-if="data.config.id" :title="'关联信息(固定信息)'" />
<div>
<div v-if="data.config.id">
<div class="table-lable">
<span>动态信息</span>
<img :src="getImgUrl('img/icon-jt.png')" style="cursor: pointer" @click="isShowdt = !isShowdt" />
</div>
<div v-if="data.config.id">
<MOSTY.TabList :tablist="tablist2" :obj="data.config" :showCount="true" :sblx="sblx"
:isEdit="props.editObj.saveBtnShow" @tableChange="tableChange" @resetChange="resetChange" />
</div>
</div>
</div>
</template>
<template #footer>
<el-button type="primary" @click="saveData(ruleFormRef)" v-loading="saveloading"
v-if='props.formData.saveBtnShow'> <el-icon>
<el-button type="primary" @click="saveData(ruleFormRef)" v-loading="saveloading" v-if='props.editObj.saveBtnShow'>
<el-icon>
<DocumentChecked />
</el-icon> </el-button>
<el-button @click="closepost"><el-icon>
@ -70,18 +86,17 @@
</template>
</MOSTY.FromPage>
<div>
<Sbss v-model="showSbss" :data="props.formData.parentid" :sbid="leaderid" :sblx="sblx" @choosedSbss="choosedSbss"
<Sbss v-model="showSbss" :data="data.config.parentid" :sbid="leaderid" :sblx="sblx" @choosedSbss="choosedSbss"
searchType="04"></Sbss>
</div>
</template>
<script setup>
import { ref, getCurrentInstance, defineAsyncComponent, onMounted, watch } from "vue";
import { getImgUrl } from "@/utils/tools.js"
import { ref, getCurrentInstance, onMounted, watch, reactive, defineAsyncComponent } from "vue";
import * as MOSTY from "@/components/MyComponents/index";
import Sbss from "@/components/MyComponents/ChooseUser/sbss.vue";
import { ElMessage } from "element-plus";
import * as rule from "@/utils/rules.js";
import { getItem } from "@/utils/storage";
import { getApi, postApi } from "@/api/tobAcco_api.js";
const { proxy } = getCurrentInstance();
const { D_BZ_DLSBZT, D_BZ_YJSBLX } = proxy.$dict("D_BZ_DLSBZT", "D_BZ_YJSBLX")
@ -93,39 +108,65 @@ const rules = {
sbmc: [{ required: true, message: "请输入预警设备名称" }],
sbbh: [{ required: true, message: "请输入设备编号" }],
sbzt: [{ required: true, message: "请选择设备状态" }],
sblx: [{ required: true, message: "请选择设备类型" }],
parentname: [{ required: true, message: "请选择绑定设备" }],
name: [{ required: true, message: "设备名称不能为空" }],
ipaddr: [{ required: true, message: "请输入IP地址" }],
port: [{ required: true, message: "请输入端口号" }],
deptname: [{ required: true, message: "责任部门不能为空" }],
responsibilitypersonname: [{ required: true, message: "责任人不能为空" }],
location: [{ required: true, message: "请输入具体位置" }]
};
const tablist2 = ref([])
const saveloading = ref(false)
const showSbss = ref(false);
const ruleFormRef = ref();
const sblx = ref(null)
const emits = defineEmits(["saveSuccess", '"update:modelValue"']);
const emit = defineEmits(["saveSuccess", '"update:modelValue"']);
//
const props = defineProps({
modelValue: {
type: Boolean,
required: true
},
formData: {
editObj: {
type: Object,
default: {}
default: () => { }
}
});
const data = reactive({
fromObj: {},
config: {
title: "",
saveBtnShow: true,
type: ""
}
})
watch(
() => props.formData.sblx,
() => data.config.sblx,
(val) => {
let arr = [['01', '200101030500'], ['02', '200101020200'], ['03', '200101020100'], ['04', '200101020300'],
['05', '200101030100']];
['05', '200101030100'], ['06', '200102010000']];
for (let i = 0; i < arr.length; i++) {
const item = arr[i];
let zddm = item[0];
let sblxdm = item[1];
if (zddm == val) {
sblx.value = sblxdm;
if (["200101060100", '200101060200', '200101030500', '200101020200',
'200101020100', '200101020300', '200102010000', "200101030100"].includes(sblx.value)) {
let title = '附属设备'
if (['200101020200', '200101020100'].includes(sblx.value)) {
title = '液位仪';
} else if ('200101020300' == sblx.value) {
title = '压力传感器'
} else if ('200102010000' == sblx.value) {
title = '视频摄像头'
}
tablist2.value.push({
title: title,
num: 0,
icon: "sbss2",
sblx: sblx.value,
actives: true,
components: defineAsyncComponent(() => import("@/components/MyComponents/TabList/Fssblb.vue"))
})
}
break
}
}
@ -136,45 +177,67 @@ watch(
}
);
onMounted(() => {
props.formData.publicarea = '1'
//
if (props.formData.buildingid) {
getApi({}, `/mosty-jcgl/building/getBuildingById/${props.formData.buildingid}`).then(res => {
props.formData.publicarea = res.publicarea ? res.publicarea : "2"
data.config.publicarea = '1'
if (props.editObj) {
data.config = props.editObj
}
getMain(data.config.id)
})
//
function gettabcount() {
getApi({ id: data.config.parentid }, "/mosty-jcgl/aqsbssZb/countAll").then(res => {
tablist2.value.forEach(item => {
if (["附属设备", "液位仪", "压力传感器", "视频摄像头"].includes(item.title)) {
item.num = res ? res : 0
}
})
})
}
//
function getMain(id) {
if (id) {
getApi({ id: id }, "/mosty-lps/yjsbInfo/getInfo").then(res => {
if (res) {
data.config = res
//
if (data.fromObj.buildingid) {
getApi({}, `/mosty-jcgl/building/getBuildingById/${data.fromObj.buildingid}`).then(res => {
data.config.publicarea = res.publicarea ? res.publicarea : "2"
})
}
//
gettabcount()
}
})
}
})
}
//
function tableChange(val) {
gettabcount()
}
//
function choosedSbss(data) {
props.formData.parentid = data.id
props.formData.parentname = data.name
props.formData.location = data.location
//
getApi({}, "/mosty-jcgl/sbglAqsbss/queryTbSbglAqsbssById?id=" + data.zbid).then((res) => {
if (res) {
props.formData.siteid = res.siteid
props.formData.sitename = res.sitename
props.formData.buildingid = res.buildingid
props.formData.buildingname = res.buildingname
//
//
getApi({}, `/mosty-jcgl/building/getBuildingById/${res.buildingid}`).then(res => {
props.formData.publicarea = res.publicarea ? res.publicarea : "2"
})
props.formData.floorid = res.floorid
props.formData.floorname = res.floorname
props.formData.partid = res.partid
props.formData.partname = res.partname
props.formData.sbid = res.id
props.formData.name = res.name
props.formData.deptcode = res.responsibilitydeptid
props.formData.deptname = res.responsibilitydeptname
props.formData.responsibilitypersonname = res.responsibilitypersonname
props.formData.responsibilityperson = res.responsibilityperson
} else {
ElMessage.error("未找到设备信息");
}
function choosedSbss(res) {
data.config.parentid = res.id
data.config.parentname = res.name
data.config.location = res.location
data.config.siteid = res.siteid
data.config.sitename = res.sitename
data.config.buildingid = res.buildingid
data.config.buildingname = res.buildingname
//
getApi({}, `/mosty-jcgl/building/getBuildingById/${res.buildingid}`).then(resp => {
data.config.publicarea = resp.publicarea ? resp.publicarea : "2"
})
data.config.floorid = res.floorid
data.config.floorname = res.floorname
data.config.partid = res.partid
data.config.partname = res.partname
data.config.sbid = res.id
data.config.name = res.name
data.config.deptcode = res.responsibilitydeptid
data.config.deptname = res.responsibilitydeptname
data.config.responsibilitypersonname = res.responsibilitypersonname
data.config.responsibilityperson = res.responsibilityperson
}
//
function chooseSb() {
@ -185,12 +248,12 @@ function chooseSb() {
showSbss.value = true
}
function closepost() {
if (props.formData.saveBtnShow) {
if (props.editObj.saveBtnShow) {
proxy.$modal.confirm('离开会丢失页面中修改的内容,确认离开吗?').then(() => {
emits("saveSuccess");
emit("changePage", "Main")
})
} else {
emits("saveSuccess");
emit("changePage", "Main")
}
}
//
@ -199,17 +262,17 @@ const saveData = async (ruleFormRef) => {
if (!ruleFormRef) return
ruleFormRef.validate((valid) => {
if (valid) {
if (!props.formData.id) {
postApi(props.formData, "/mosty-lps/yjsbInfo/add").then((res) => {
if (!props.editObj.id) {
postApi(data.config, "/mosty-lps/yjsbInfo/add").then((res) => {
ElMessage.success("新增成功");
emits("saveSuccess");
emit("changePage", "Main")
}).finally(() => {
saveloading.value = false
})
} else {
postApi(props.formData, "/mosty-lps/yjsbInfo/edit").then((res) => {
postApi(data.config, "/mosty-lps/yjsbInfo/edit").then((res) => {
ElMessage.success("修改成功");
emits("saveSuccess");
emit("changePage", "Main")
}).finally(() => {
saveloading.value = false
})

View File

@ -1,175 +1,243 @@
<template>
<div>
<div class="bigBox">
<!-- 基础隐患排查 -->
<div class="left" :style="{ width: lfBoxWid }">
<div class="title">
<div style="display: flex; align-items: center">
<div style="padding-top: 5px; margin-right: 5px">
<el-icon style="color: var(--el-color-primary) !important">
<List />
</el-icon>
</div>
<span class="zzjgxx" v-if="iconChange">场所部位</span>
</div>
<el-icon @click="handleCollapse" v-show="iconChange">
<DArrowLeft />
<MOSTY.PageTree pageTitle="预警设备管理" @getDeptId="getdeptData" :isShowOrgTree="isShowLeftTree">
<template #serach>
<el-divider />
<MOSTY.Search :searchArr="searchArr" @submit="onSearch" />
<el-divider />
<div class="btnBox">
<el-button @click="addInfo">
<el-icon size="small">
<Plus />
</el-icon>
<el-icon @click="handleCollapse" v-show="!iconChange">
<DArrowRight />
</el-icon>
</div>
<div class="treeBox" :style="{ height: treeHeight }">
<el-tree ref="treeRef" class="filter-tree" :props="endProps" node-key="id" :load="loadNode" lazy
:default-expanded-keys="defaultExpandedKeys" @node-click="nodeClick" :filter-node-method="filterNode"
:data="treeData" />
</div>
新增
</el-button>
</div>
<div class="right" :style="{ width: rgBoxWid }">
<div class="headBox">
<span class="title">预警设备列表</span>
</div>
<div class="box" style="flex: 1">
<YjsbList :searchObj="searchObj" />
</div>
</template>
<template #table>
<section class="eltab9">
<MOSTY.Table :table-columns="data.tableColumn" :tableData="data.tableData" :tableloading="tableloading"
:isSort="true" actionsW="300">
<template #sbzt="{ row }">
<dict-tag v-if="row.sbzt" :options="D_BZ_DLSBZT" :value="row.sbzt" :tag="false"
:color="row.sbzt == '01' ? 'green' : 'orange'" />
<span v-else></span>
</template>
<template #ipaddr="{ row }">
<span v-if="row.ipaddr && row.port">{{ row.ipaddr + ":" + row.port }}</span>
<span v-else>--</span>
</template>
<template #sblx="{ row }">
<dict-tag v-if="row.sblx" :options="D_BZ_YJSBLX" :value="row.sblx" :tag="false" />
<span v-else></span>
</template>
<template #actions="{ row }">
<span class="operesee" @click="videoControl(row)" v-if="row.sblx == '06'">
<el-icon>
<Compass />
</el-icon></span>
<span class="operesee" @click="showInfo(row)">
<el-icon>
<Compass />
</el-icon></span>
<span class="operedit" @click="editInfo(row)">
<el-icon>
<EditPen />
</el-icon></span>
<el-popconfirm confirm-button-text="" cancel-button-text="" icon-color="red" title="确定要删除?"
@confirm="delInfo(row)">
<template #reference>
<span class="operdel" size="small"><el-icon>
<Delete />
</el-icon>
删除</span>
</template>
</el-popconfirm>
</template>
</MOSTY.Table>
</section>
<div class="fenye">
<MOSTY.Pages :pageConfiger="listQuery" @changeNo="changeNo" @changeSize="changeSize"></MOSTY.Pages>
</div>
</div>
</div>
</template>
</MOSTY.PageTree>
</template>
<script setup>
import { onMounted, ref, reactive, getCurrentInstance } from "vue";
import { getItem } from "@/utils/storage"
import * as MOSTY from "@/components/MyComponents/index"
import { getApi, postApi } from "@/api/tobAcco_api.js"
import YjsbList from "./yjsbList.vue";
const emits = defineEmits(["changePage"])
const endProps = {
children: "childDeptList",
value: "id",
label: "name",
isLeaf: "leaf"
};
const defaultExpandedKeys = ref([])
const treeData = ref([]);
const node_had = ref([]);
const resolve_had = ref([]);
const iconChange = ref(true);
const lfBoxWid = ref("300px");
const rgBoxWid = ref("calc(100% - 300px)");
const treemrData = ref([]);
const treeRef = ref(null);
const searchObj = ref({})
const treeQuery = ref({
parentid: "",
type: '01',
import { ElMessage } from "element-plus"
import { reactive, ref, getCurrentInstance, onMounted } from "vue"
const { proxy } = getCurrentInstance()
const { D_BZ_DLSBZT, D_BZ_YJSBLX } = proxy.$dict("D_BZ_DLSBZT", "D_BZ_YJSBLX")
const emit = defineEmits("changePage")
const tableloading = ref(false)
const listQuery = reactive({
pageCurrent: 1,
pageSize: 10,
total: 0
})
const searchArr = reactive([
{
showType: "input",
prop: "keywords",
width: '250px',
placeholder: '请输入设备名称或编号查询'
},
{
showType: "select",
prop: "sblx",
options: D_BZ_YJSBLX,
width: "250px",
placeholder: "请选择设备类型"
},
{
showType: "select",
prop: "sbzt",
options: D_BZ_DLSBZT,
width: "250px",
placeholder: "请选择设备状态"
},
])
const data = reactive({
searchObj: {},
tableData: [],
tableColumn: [
{
title: "所属单位",
prop: "orgname"
},
{
title: "所属部门",
prop: "deptname"
},
{
title: "设备类型",
prop: "sblx",
slot: true
},
{
title: "设备名称",
prop: "sbmc"
},
{
title: "设备编号",
prop: "sbbh"
},
{
title: "设备状态",
prop: "sbzt",
slot: true
},
{
title: "物联IP端口",
prop: "ipaddr",
slot: true
},
{
title: "操作",
prop: "actions",
slot: true
}
]
})
onMounted(() => {
// videoControl();
});
//
function getTreeData() {
getApi(treeQuery.value, "/mosty-jcgl/site/querySceneTree").then((res) => {
if (res.length == 1) {
res.forEach((element) => {
treemrData.value = setTimeout(() => { treeRef.value.setCurrentKey(element.id) }, 200)
defaultExpandedKeys.value = [element.id]
if (element.siteid) {
searchObj.value.siteid = element.siteid
searchObj.value.deptId = null
} else {
searchObj.value.deptId = element.orgid ? element.orgid : element.id
searchObj.value.siteid = null
}
});
}
for (let i = 0; i < res.length; i++) {
res[i].leaf = !res[i].hasChildren;
}
if (res.length > 0) treeData.value = res;
});
//
const videoControl = row => {
console.log(row)
let arr = {
title: "视频",
sbbh: row.sbbh,
saveBtnShow: false,
type: "showVideo",
id: (row && row.parentid) ? row.parentid : '5200316847792de043a5b2a9dbede8698677'
}
emit("changePage", "VideoPlay", arr)
}
//
async function loadNode(node, resolve) {
treeQuery.value.parentid = node.data.id;
treeQuery.value.type = node.data.type;
if (node.level === 0) {
node_had.value = node;
resolve_had.value = resolve;
getTreeData();
}
if (node.level >= 1) {
getApi(treeQuery.value, "/mosty-jcgl/site/querySceneSiteTree").then(
(res) => {
for (let i = 0; i < res.length; i++) {
res[i].leaf = !res[i].hasChildren;
}
resolve(res);
}
);
}
//
const getdeptData = val => {
listQuery.deptId = val.id;
listQuery.pageCurrent = 1;
getTableData();
}
const filterNode = (value, data) => {
if (!value) return true;
return data.name.includes(value);
};
const nodeClick = (node) => {
if (node.siteid) {
searchObj.value.siteid = node.siteid
searchObj.value.deptId = null
} else {
searchObj.value.deptId = node.orgid ? node.orgid : node.id
searchObj.value.siteid = null
//
const changeNo = val => {
listQuery.pageCurrent = val
getTableData()
}
const changeSize = val => {
listQuery.pageSize = val
getTableData()
}
//
const onSearch = obj => {
listQuery.pageCurrent = 1;
listQuery.keywords = obj.keywords;
listQuery.sbzt = obj.sbzt;
listQuery.sblx = obj.sblx;
getTableData()
}
//
function getTableData() {
tableloading.value = true
getApi(listQuery, `/mosty-lps/yjsbInfo/getPageList`).then(res => {
if (res.records) {
data.tableData = res.records
tableloading.value = false
listQuery.total = res.total
} else {
data.tableData = []
tableloading.value = false
}
}).finally(() => {
tableloading.value = false
})
}
//
const addInfo = () => {
let arr = {
title: "新增预警设备",
saveBtnShow: true,
type: "add"
}
};
const handleCollapse = () => {
iconChange.value = !iconChange.value;
if (iconChange.value) {
lfBoxWid.value = "300px";
rgBoxWid.value = "calc(100% - 300px)";
} else {
lfBoxWid.value = "40px";
rgBoxWid.value = "calc(100% - 40px)";
emit("changePage", "AddOrEdite", arr)
}
//
const editInfo = row => {
let arr = {
title: "修改预警设备",
saveBtnShow: true,
type: "edit",
id: row.id ? row.id : null
}
};
emit("changePage", "AddOrEdite", arr)
}
//
const showInfo = row => {
let arr = {
title: "查看预警设备",
saveBtnShow: false,
id: row.id ? row.id : null
}
emit("changePage", "AddOrEdite", arr)
}
//
const delInfo = row => {
postApi({}, "/mosty-lps/yjsbInfo/del/" + row.id).then(res => {
ElMessage.success("删除成功")
getTableData()
})
}
</script>
<style lang="scss" scoped>
.bigBox {
.btnBox {
display: flex;
.title {
height: 39px;
line-height: 39px;
font-size: 18px;
color: var(--el-color-primary);
display: flex;
justify-content: space-between;
align-items: center;
.el-icon {
cursor: pointer;
}
}
.left {
width: 300px;
background: #ffffff;
box-shadow: 0px 2px 10px 0px rgba(107, 107, 107, 0.1);
border-radius: 0px 0px 0px 0px;
opacity: 1;
.treeBox {
height: calc(100vh - 164px);
overflow: auto;
}
}
.right {
padding: 0 10px;
margin: 0px 0 0 10px;
background: #fff;
.headBox {
display: flex;
align-items: center;
}
}
align-items: center;
justify-content: flex-end;
margin-bottom: 12px;
}
</style>
</style>

View File

@ -1,19 +1,22 @@
<template>
<div>
<Main v-if="showPage === 'Main'" @changePage="changePage"></Main>
<AddOrEdite v-else-if="showPage === 'AddOrEdite'" @changePage="changePage" :editObj="editObj.editObj"></AddOrEdite>
<VideoPlay v-else-if="showPage === 'VideoPlay'" @changePage="changePage" :editObj="editObj.editObj"></VideoPlay>
</div>
</template>
<script setup>
import Main from "./Main/index.vue";
import AddOrEdite from "./AddOrEdite/index.vue";
import VideoPlay from "./videoPlay/index.vue";
import { reactive, ref } from "vue";
let showPage = ref('Main')
let editObj = reactive({
editObj: null
})
const changePage = (val, obj) =>{
if(obj){
const changePage = (val, obj) => {
if (obj) {
editObj.editObj = obj
} else {
editObj.editObj = null
@ -21,6 +24,5 @@ const changePage = (val, obj) =>{
showPage.value = val
}
</script>
<style lang = "scss" scoped>
</style>
<style lang="scss" scoped></style>