123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- <template>
- <BasicModal
- v-bind="$attrs"
- @register="registerModal"
- :title="title"
- width="1000px"
- :showCancelBtn="false"
- :showOkBtn="false"
- :footer="null"
- destroyOnClose
- >
- <a-tabs v-if="props.showTab" v-model:activeKey="activeKey">
- <a-tab-pane key="1" tab="基本信息" force-render>
- <FormModal :record="record" @saveOrUpdate="(values) => emit('saveOrUpdate', values)" />
- </a-tab-pane>
- <a-tab-pane key="2" tab="点表关联">
- <PointTable
- v-if="record.strtype"
- :columns="pointColumns"
- :pointType="record.strtype"
- :deviceId="deviceData.id"
- @save="savePointData"
- @delete="deletePointById"
- />
- </a-tab-pane>
- <a-tab-pane key="3" tab="设备关联" v-if="deviceType == 'managesys'">
- <WorkFacePointTable :columns="pointColumns" :deviceId="deviceData.id" @save="savePointData" @delete="deletePointById" />
- </a-tab-pane>
- <a-tab-pane v-if="deviceType == 'managesys'" key = "4" tab="预警条目管理">
- <ManagerWarningDeviceTable v-if="activeKey == '4'" :deviceId="deviceData.id" />
- </a-tab-pane>
- <a-tab-pane key="5" :tab="deviceType !== 'managesys' ? '报警配置' : '配置预警设备'">
- <template v-if="activeKey == '5'">
- <WarningTable v-if="deviceType !== 'managesys'" :deviceId="deviceData.id" :pointType="record.strtype" />
- <BackWindDeviceTable v-else :deviceId="deviceData.id" />
- </template>
- </a-tab-pane>
- <a-tab-pane v-if="deviceType == 'managesys'" key = "6" tab="配置控制设备">
- <template v-if="activeKey == '6'">
- <WarningTable v-if="deviceType !== 'managesys'" :deviceId="deviceData.id" :pointType="record.strtype" />
- <ManagerWarningTable v-else :deviceId="deviceData.id" />
- </template>
- </a-tab-pane>
- <a-tab-pane key="7" tab="摄像头配置"
- ><EditRowTable
- :columns="cameraColumns"
- :list="cameraList.bind(null, { deviceid: deviceData.id })"
- @saveOrUpdate="saveCameraData"
- @deleteById="deleteCameraById"
- :isAdd="true"
- /></a-tab-pane>
- </a-tabs>
- <FormModal v-else :record="record" @saveOrUpdate="(values) => emit('saveOrUpdate', values)" />
- </BasicModal>
- </template>
- <script lang="ts" setup>
- import { computed, unref, inject, reactive, ref } from 'vue';
- import { BasicModal, useModalInner } from '/@/components/Modal';
- import EditRowTable from '../../comment/EditRowTable.vue';
- import PointTable from './pointTabel/PointTable.vue';
- import WarningTable from './warningTabel/index.vue';
- import ManagerWarningTable from './warningTabel/index1.vue';
- import ManagerWarningDeviceTable from './warningTabel/index2.vue';
- import BackWindDeviceTable from './warningTabel/index3.vue';
- import WorkFacePointTable from './pointTabel/WorkFacePointTable.vue';
- import FormModal from './FormModal.vue';
- import { cloneDeep } from 'lodash-es';
- import { columns as pointColumns } from './pointTabel/point.data';
- import { saveOrUpdate as pointSaveOrUpdate, deleteById as pointDeleteById } from './pointTabel/point.api';
- import { columns as cameraColumns } from './cameraTabel/camera.data';
- import { list as cameraList, saveOrUpdate as cameraSaveOrUpdate, deleteById as cameraDeleteById } from './cameraTabel/camera.api';
- const props = defineProps({
- showTab: { type: Boolean, required: true },
- deviceType: { type: String },
- });
- // 声明Emits
- const emit = defineEmits(['saveOrUpdate', 'register']);
- const isUpdate = inject('isUpdate');
- const deviceData = inject('formData') as any;
- const record = reactive({ strtype: '', strname: '' });
- const activeKey = ref('1')
- //表单赋值
- const [registerModal, { setModalProps }] = useModalInner(async (data) => {
- //重置表单
- setModalProps({ confirmLoading: false });
- Object.assign(record, data.record);
- });
- //设置标题
- const title = computed(
- () => {
- if (!unref(isUpdate)) {
- if (record.strname || record.systemname) {
- return `新增(${record.strname || record.systemname})`;
- }
- return `新增`;
- } else {
- if (record.strname || record.systemname) {
- return `编辑(${record.strname || record.systemname})`;
- }
- return `编辑`;
- }
- }
- // !unref(isUpdate) ? `新增(${record.strname || record.systemname})` : `编辑(${record.strname || record.systemname})`
- );
- const savePointData = (data) => {
- const record = cloneDeep(data.editValueRefs);
- pointSaveOrUpdate(Object.assign(record, { id: data.id, deviceId: deviceData.id }), data.id);
- };
- const saveCameraData = (data: any) => {
- const record = cloneDeep(data.editValueRefs);
- cameraSaveOrUpdate(Object.assign(record, { id: data.id, deviceid: deviceData.id }), data.id);
- };
- const deletePointById = (id, reload) => {
- pointDeleteById({ id: id }, reload);
- };
- const deleteCameraById = (id, reload) => {
- cameraDeleteById({ id: id }, reload);
- };
- </script>
- <style scoped lang="less">
- ::v-deep .suffix {
- height: 32px;
- line-height: 32px;
- margin-left: 5px;
- color: #fff;
- }
- </style>
|