Bladeren bron

预警联动控制-更新

lxh 1 maand geleden
bovenliggende
commit
154f166d65

+ 310 - 0
src/views/vent/deviceManager/workingFace/CustomNormalTable.vue

@@ -0,0 +1,310 @@
+<template>
+  <div>
+    <BasicTable @register="registerTable" :rowSelection="rowSelection">
+      <template #tableTitle>
+        <a-button preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">新增</a-button
+        ><span style="color: #f00">(注:新增时请先选择系统类型 <b style="color: rgb(255, 191, 0); font-size: 20px">↑</b>)</span>
+        <a-dropdown v-if="selectedRowKeys.length > 0" :getPopupContainer="getPopupContainer">
+          <template #overlay>
+            <a-menu>
+              <a-menu-item key="1" @click="batchHandleDelete">
+                <Icon icon="ant-design:delete-outlined" />
+                删除
+              </a-menu-item>
+            </a-menu>
+          </template>
+          <a-button
+            >批量操作
+            <Icon style="fontsize: 12px" icon="ant-design:down-outlined" />
+          </a-button>
+        </a-dropdown>
+      </template>
+      <template #action="{ record }">
+        <a class="table-action-link" @click="handleEdit(record)">编辑</a>
+        <a-popconfirm title="确定删除?" @confirm="handleDelete(record)">
+          <a class="table-action-link">删除</a>
+        </a-popconfirm>
+        <slot name="action" v-bind="{ record }"></slot>
+      </template>
+      <template #bodyCell="{ column, record }">
+        <slot name="filterCell" v-bind="{ column, record }"></slot>
+      </template>
+    </BasicTable>
+    <DeviceModal @register="registerModal" @saveOrUpdate="saveOrUpdateHandler" :showTab="showTab" :deviceType="deviceType" />
+    <!-- <DeviceModal v-model:visible="modalVisible" @saveOrUpdate="saveOrUpdateHandler" @close-modal="closeModal" :showTab="showTab"  /> -->
+  </div>
+</template>
+
+<script lang="ts" setup>
+  //ts语法
+  import { ref, provide, reactive, toRaw, defineExpose, watch } from 'vue';
+  import { BasicTable, ActionItem, EditRecordRow, BasicColumn } from '/@/components/Table';
+  import { useModal } from '/@/components/Modal';
+  import DeviceModal from '../comment/DeviceModal.vue';
+  // import { getToken } from '/@/utils/auth';
+  // import { useGlobSetting } from '/@/hooks/setting';
+  import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
+  import { useListPage } from '/@/hooks/system/useListPage';
+  import { getPopupContainer } from '/@/utils';
+  import { message } from 'ant-design-vue';
+
+  const props = defineProps({
+    columnsType: {
+      type: String,
+      // required: true,
+    },
+    columns: {
+      type: Array,
+      // required: true,
+      default: () => [],
+    },
+    searchFormSchema: {
+      type: Array,
+      default: () => [],
+    },
+    formSchema: {
+      type: Array,
+      required: true,
+    },
+    list: {
+      type: Function,
+      required: true,
+    },
+    getImportUrl: {
+      type: String,
+    },
+    getExportUrl: {
+      type: String,
+    },
+    deleteById: {
+      type: Function,
+      required: true,
+    },
+    batchDelete: {
+      type: Function,
+    },
+    saveOrUpdate: {
+      type: Function,
+      required: true,
+    },
+    pointList: {
+      type: Function,
+    },
+    showTab: {
+      type: Boolean,
+      default: false,
+    },
+    designScope: {
+      type: String,
+    },
+    title: {
+      type: String,
+    },
+    deviceType: {
+      type: String,
+    },
+  });
+
+  const emit = defineEmits(['submitSuccess', 'editHandler']);
+
+  const isUpdate = ref(false);
+  const record = reactive({});
+  const formSchemaData = ref(props.formSchema);
+  const deviceTypeId = ref('');
+  const pageType = ref('');
+
+  watch(
+    () => props.formSchema,
+    (val) => {
+      formSchemaData.value = val;
+    }
+  );
+
+  provide('formSchema', formSchemaData);
+  provide('isUpdate', isUpdate);
+  provide('formData', record);
+  provide('deviceType', props.deviceType);
+  // const glob = useGlobSetting();
+  const [registerModal, { openModal, closeModal }] = useModal();
+
+  const columnList = getTableHeaderColumns(props.columnsType);
+
+  // 列表页面公共参数、方法
+  const { prefixCls, tableContext, onExportXls, onImportXls, doRequest } = useListPage({
+    designScope: props.designScope,
+    tableProps: {
+      showTableSetting: false,
+      title: props.title,
+      api: props.list,
+      columns: props.columns.length > 0 ? (props.columns as any[]) : columnList,
+      // size: 'small',
+      // bordered: false,
+      showIndexColumn: true,
+      formConfig: {
+        showAdvancedButton: true,
+        // labelWidth: 100,
+        labelAlign: 'left',
+        labelCol: {
+          xs: 24,
+          sm: 24,
+          md: 24,
+          lg: 9,
+          xl: 7,
+          xxl: 5,
+        },
+        schemas: props.searchFormSchema as any[],
+      },
+      useSearchForm: props.searchFormSchema.length > 0 ? true : false,
+      striped: true,
+      actionColumn: {
+        width: 180,
+      },
+      beforeFetch: (params) => {
+        return Object.assign(params, { column: 'createTime', devicekind: props.deviceType });
+      },
+    },
+  });
+
+  //注册table数据
+  const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
+
+  const saveOrUpdateHandler = async (params) => {
+    try {
+      await props.saveOrUpdate(params, isUpdate.value);
+      !props.showTab ? closeModal() : '';
+      await doRequest(props.list, { confirm: false });
+      emit('submitSuccess', params);
+    } catch (error) {
+      message.error('保存失败,请联系管理员');
+    }
+  };
+
+  // const closeModalFn = () => {
+  //   closeModal()
+  // }
+  /**
+   * 新增事件
+   */
+  function handleAdd() {
+    const searchFormData = getForm().getFieldsValue();
+    if (searchFormData && searchFormData['strtype']) {
+      emit('editHandler', searchFormData);
+      for (let key in record) {
+        if (key == 'strtype') {
+          record[key] = searchFormData['strtype'];
+        } else {
+          delete record[key];
+        }
+      }
+      isUpdate.value = false;
+      openModal(
+        true,
+        {
+          record: { strtype: searchFormData['strtype'] },
+        },
+        false
+      );
+    } else {
+      message.info('请先选择系统类型!!');
+    }
+  }
+
+  /**
+   * 编辑事件
+   */
+  function handleEdit(data) {
+    emit('editHandler', data);
+    isUpdate.value = true;
+    Object.assign(record, toRaw(data));
+    openModal(
+      true,
+      {
+        record,
+      },
+      false
+    );
+  }
+
+  /**
+   * 删除事件
+   */
+  async function handleDelete(record) {
+    await props.deleteById({ id: record.id }, reload);
+  }
+
+  /**
+   * 批量删除事件
+   */
+  async function batchHandleDelete() {
+    doRequest(() => props.batchDelete({ ids: selectedRowKeys.value }));
+  }
+  /**
+   * 查看
+   */
+  // function handleDetail(record) {
+  //   iframeUrl.value = `${glob.uploadUrl}/sys/annountCement/show/${record.id}?token=${getToken()}`;
+  //   openDetail(true);
+  // }
+  /**
+   * 操作列定义
+   * @param record
+   */
+  function getActions(record: EditRecordRow, column: BasicColumn): ActionItem[] {
+    return [
+      {
+        label: '编辑',
+        onClick: handleEdit.bind(null, record, column),
+      },
+      {
+        label: '删除',
+        popConfirm: {
+          title: '是否确认删除',
+          confirm: handleDelete.bind(null, record, column),
+        },
+      },
+      // {
+      //   label: '查看',
+      //   onClick: handleDetail.bind(null, record),
+      // },
+    ];
+  }
+
+  defineExpose({
+    doRequest,
+    onExportXls,
+    onImportXls,
+    reload,
+    getForm,
+  });
+</script>
+
+<style scoped lang="less">
+  @ventSpace: zxm;
+  @vent-table-no-hover: #00bfff10;
+
+  :deep(.@{ventSpace}-table-cell-row-hover) {
+    background: #264d8833 !important;
+  }
+  :deep(.@{ventSpace}-table-row-selected) {
+    background: #268bc522 !important;
+  }
+
+  :deep(.@{ventSpace}-table-tbody > tr > td) {
+    background-color: #0dc3ff05;
+  }
+  :deep(.jeecg-basic-table-row__striped) {
+    td {
+      background-color: @vent-table-no-hover !important;
+    }
+  }
+  :deep(.@{ventSpace}-select-dropdown) {
+    .@{ventSpace}-select-item-option-selected,
+    .@{ventSpace}-select-item-option-active {
+      background-color: #ffffff33 !important;
+    }
+
+    .@{ventSpace}-select-item:hover {
+      background-color: #ffffff33 !important;
+    }
+  }
+</style>

+ 98 - 0
src/views/vent/deviceManager/workingFace/index.vue

@@ -0,0 +1,98 @@
+<template>
+  <div class="device-manager-box">
+    <CustomNormalTable
+      :columns="[]"
+      :searchFormSchema="searchFormSchema"
+      :list="list"
+      :formSchema="formSchema"
+      :deleteById="deleteById"
+      :batchDelete="batchDeleteById"
+      :saveOrUpdate="saveOrUpdate"
+      @edit-handler="changeFormItems"
+      designScope="workingFace-tabel"
+      title="智能管控"
+      :showTab="true"
+      deviceType="managesys"
+      columnsType="managesys_list"
+    />
+  </div>
+</template>
+
+<script lang="ts" name="system-user" setup>
+  //ts语法
+  import { ref, onMounted } from 'vue';
+  import CustomNormalTable from './CustomNormalTable.vue';
+  import { searchFormSchema, commentFormSchema } from './workingFace.data';
+  import { list, deleteById, batchDeleteById, saveOrUpdate } from './workingFace.api';
+
+  import { FormSchema } from '/@/components/Table';
+  import { getFormSchemaColumns } from '/@/hooks/web/useWebColumns';
+
+  const formSchema = ref<FormSchema[]>([]);
+  const isRefresh = ref(false);
+
+  const arrToFormColumns = (tableHeaderColumns = [], strtype) => {
+    const columnList: any[] = [];
+    if (tableHeaderColumns.length > 0) {
+      tableHeaderColumns.forEach((item: any) => {
+        let columnsItem;
+        if (item.type == 1 || item.type == 10) {
+          columnsItem = {
+            label: item.des, //_dictText
+            field: item.monitorcode,
+            component: item.type == 1 ? 'Input' : item.type == 10 ? 'InputTextArea' : '',
+          };
+        } else {
+          if (item.type == 3) {
+            columnsItem = {
+              label: item.des, //_dictText
+              field: item.monitorcode,
+              component: 'RadioGroup',
+              defaultValue: 1,
+              componentProps: () => {
+                return {
+                  options: [
+                    { label: '是', value: 1, key: '1' },
+                    { label: '否', value: 0, key: '2' },
+                  ],
+                  stringToNumber: true,
+                };
+              },
+            };
+          }
+          if (item.type == 4) {
+            columnsItem = {
+              label: item.des, //_dictText
+              field: item.monitorcode,
+              component: 'JDictSelectTag',
+              componentProps: {
+                dictCode: item.dict,
+                placeholder: '请选择',
+                stringToNumber: true,
+              },
+            };
+          }
+        }
+        columnList.push(columnsItem);
+        formSchema.value = [...commentFormSchema(strtype), ...columnList];
+      });
+    } else {
+      formSchema.value = commentFormSchema(strtype) as any[];
+    }
+  };
+
+  const changeFormItems = (data) => {
+    if (data && data['strtype']) {
+      const formSchemaColumns = getFormSchemaColumns(`${data['strtype']}_edit`) || [];
+      arrToFormColumns(formSchemaColumns, data['strtype']);
+      isRefresh.value = true;
+    } else {
+      formSchema.value = commentFormSchema(data['strtype']) as any[];
+      isRefresh.value = true;
+    }
+  };
+
+  onMounted(() => {});
+</script>
+
+<style scoped></style>

+ 99 - 0
src/views/vent/deviceManager/workingFace/workingFace.api.ts

@@ -0,0 +1,99 @@
+import { defHttp } from '/@/utils/http/axios';
+import { Modal } from 'ant-design-vue';
+
+enum Api {
+  list = '/safety/ventanalyManageSystem/list',
+  save = '/safety/ventanalyManageSystem/add',
+  edit = '/safety/ventanalyManageSystem/edit',
+  modalList = '/ventanaly-model/Vmodel/ventanalyModel/list',
+  huifengids = '/ventanaly-jingtaifengliang/xufengController/getXufengHuifengJingtai',
+  xufengids = '/safety/ventanalyManageSystem/queryXufengliangList',
+  caimei = '/ventanaly-jingtaifengliang/xufengController/getXufengCaimeiInfoJingtai',
+  juejin = '/ventanaly-jingtaifengliang/xufengController/getXufengJuejinInfoJingtai',
+  dongshi = '/ventanaly-jingtaifengliang/xufengController/getXufengDongshiInfoJingtai',
+  cheliang = '/ventanaly-jingtaifengliang/xufengController/getXufengCheliangiInfoJingtai',
+  qita = '/ventanaly-jingtaifengliang/xufengController/getXufengOtherInfoJingtai',
+  beiyong = '/ventanaly-jingtaifengliang/xufengController/getXufengBeiyongInfoJingtai',
+  getDeviceIds = '/safety/ventanalyMonitorParams/getdevices',
+  deleteById = '/safety/ventanalyManageSystem/delete',
+  deleteBatch = '/sys/user/deleteBatch',
+  importExcel = '/sys/user/importExcel',
+  exportXls = '/sys/user/exportXls',
+}
+/**
+ * 导出api
+ * @param params
+ */
+export const getExportUrl = Api.exportXls;
+/**
+ * 导入api
+ */
+export const getImportUrl = Api.importExcel;
+/**
+ * 列表接口
+ * @param params
+ */
+export const list = (params) => defHttp.get({ url: Api.list, params });
+
+/**
+ * 列表接口
+ * @param params
+ */
+export const modalList = (params) => defHttp.get({ url: Api.modalList, params });
+
+/**
+ * 列表接口
+ * @param params
+ */
+export const huifengids = (params) => defHttp.post({ url: Api.huifengids, params });
+
+/**
+ * 列表接口
+ * @param params
+ */
+export const caimei = (params) => defHttp.post({ url: Api.caimei, params });
+export const juejin = (params) => defHttp.post({ url: Api.juejin, params });
+export const dongshi = (params) => defHttp.post({ url: Api.dongshi, params });
+export const cheliang = (params) => defHttp.post({ url: Api.cheliang, params });
+export const qita = (params) => defHttp.post({ url: Api.qita, params });
+export const beiyong = (params) => defHttp.post({ url: Api.beiyong, params });
+
+/**
+ * 列表接口
+ * @param params
+ */
+export const getDeviceIds = (params) => defHttp.get({ url: Api.getDeviceIds, params });
+
+/**
+ * 删除用户
+ */
+export const deleteById = (params, handleSuccess) => {
+  return defHttp.delete({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
+    handleSuccess();
+  });
+};
+/**
+ * 批量删除用户
+ * @param params
+ */
+export const batchDeleteById = (params, handleSuccess) => {
+  Modal.confirm({
+    title: '确认删除',
+    content: '是否删除选中数据',
+    okText: '确认',
+    cancelText: '取消',
+    onOk: () => {
+      return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
+        handleSuccess();
+      });
+    },
+  });
+};
+/**
+ * 保存或者更新用户
+ * @param params
+ */
+export const saveOrUpdate = (params, isUpdate) => {
+  const url = isUpdate ? Api.edit : Api.save;
+  return isUpdate ? defHttp.put({ url: url, params }) : defHttp.post({ url: url, params });
+};

+ 251 - 0
src/views/vent/deviceManager/workingFace/workingFace.data.ts

@@ -0,0 +1,251 @@
+import { BasicColumn } from '/@/components/Table';
+import { FormSchema } from '/@/components/Table';
+import { list, modalList, huifengids, beiyong, qita, cheliang, dongshi, juejin, caimei } from './workingFace.api';
+
+export const columns: BasicColumn[] = [
+  {
+    title: '系统名称',
+    dataIndex: 'strname',
+    width: 120,
+  },
+  // {
+  //   title: '系统型号',
+  //   dataIndex: 'strinstallpos',
+  //   width: 100,
+  // },
+  {
+    title: '系统Code',
+    dataIndex: 'nwindowtype_dictText',
+    width: 100,
+  },
+  {
+    title: '类型',
+    dataIndex: 'strtype',
+    width: 80,
+  },
+  {
+    title: '模型ID',
+    dataIndex: 'fperheight',
+    width: 100,
+  },
+  {
+    title: '控制策略',
+    dataIndex: 'nwindow',
+    width: 100,
+  },
+  {
+    title: '风向',
+    width: 150,
+    dataIndex: 'stationname',
+  },
+];
+
+export const recycleColumns: BasicColumn[] = [
+  {
+    title: '名称',
+    dataIndex: 'strname',
+    width: 100,
+  },
+  {
+    title: '是否为常闭型',
+    dataIndex: 'bnormalclose',
+    width: 100,
+  },
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    label: '系统类型',
+    field: 'strtype',
+    component: 'JDictSelectTag',
+    colProps: { span: 6 },
+    componentProps: {
+      dictCode: 'syskind',
+      placeholder: '请选择系统型号',
+    },
+  },
+  {
+    label: '系统名称',
+    field: 'systemname',
+    component: 'Input',
+    colProps: { span: 6 },
+  },
+];
+
+export const commentFormSchema = (strtype) => {
+  return [
+    {
+      label: '',
+      field: 'id',
+      component: 'Input',
+      show: false,
+    },
+    {
+      label: '系统名称',
+      field: 'systemname',
+      component: 'Input',
+    },
+    {
+      label: '系统Code',
+      field: 'code',
+      component: 'Input',
+    },
+    {
+      label: '系统类型',
+      field: 'strtype',
+      component: 'JDictSelectTag',
+      defaultValue: strtype,
+      required: true,
+      componentProps: {
+        disabled: true,
+        dictCode: 'syskind',
+        placeholder: '请选择系统型号',
+      },
+    },
+    {
+      label: '模型ID',
+      field: 'nmodelid',
+      component: 'ApiSelect',
+      componentProps: () => {
+        return {
+          api: modalList,
+          resultField: 'records',
+          labelField: 'strmodelname',
+          valueField: 'nmodelid',
+        };
+      },
+    },
+    {
+      label: '控制策略',
+      field: 'workmode',
+      component: 'JDictSelectTag',
+      componentProps: {
+        dictCode: 'workmode',
+        placeholder: '请选择控制策略',
+        stringToNumber: true,
+      },
+    },
+    {
+      label: '监测类型',
+      field: 'monitorflag_dictText',
+      component: 'JDictSelectTag',
+      componentProps: {
+        dictCode: 'monitorflag',
+        placeholder: '请选择状态',
+      },
+    },
+    {
+      label: '风向',
+      field: 'windkind',
+      component: 'JDictSelectTag',
+      componentProps: {
+        dictCode: 'winddir',
+        placeholder: '请选择风向',
+        stringToNumber: true,
+      },
+    },
+    {
+      label: '所属回风系统',
+      field: 'huifengid',
+      component: 'ApiSelect',
+      componentProps: () => {
+        return {
+          api: huifengids,
+          labelField: 'huifeng_name',
+          valueField: 'id',
+          resultField: 'obj',
+        };
+      },
+    },
+    {
+      label: '关联需风量地点',
+      field: 'xufengliangid',
+      component: 'ApiSelect',
+      componentProps: ({ formModel }) => {
+        let api;
+        if (formModel['strtype'] == 'sys_dongshi') {
+          api = dongshi;
+        } else if (formModel['strtype'] == 'sys_cheliang') {
+          api = cheliang;
+        } else if (formModel['strtype'] == 'sys_surface_juejin') {
+          api = juejin;
+        } else if (formModel['strtype'] == 'sys_surface_caimei') {
+          api = caimei;
+        } else if (formModel['strtype'] == 'sys_surface_beiyong') {
+          api = beiyong;
+        } else if (formModel['strtype'] == 'sys_other') {
+          api = qita;
+        }
+        if (api)
+          return {
+            api: api.bind(null, { id: formModel['huifengid'] }),
+            labelField: 'work_name',
+            valueField: 'id',
+            resultField: 'obj',
+          };
+      },
+    },
+    {
+      label: '模型类型',
+      field: 'strsystype',
+      component: 'JDictSelectTag',
+      componentProps: ({ formModel }) => {
+        if (formModel['strtype']) {
+          console.log('场景类型---->', formModel['strtype']);
+          return {
+            dictCode: `${formModel['strtype']}_modal`,
+            placeholder: '请选择模型类型',
+          };
+        }
+        return {
+          options: [],
+        };
+      },
+    },
+    {
+      label: '是否绑定采空区',
+      field: 'linkEmptyFlag',
+      component: 'RadioGroup',
+      defaultValue: 0,
+      componentProps: ({ formActionType }) => {
+        return {
+          options: [
+            { label: '绑定采空区', value: 1, key: '1' },
+            { label: '不绑定', value: 0, key: '2' },
+          ],
+          onChange: (e: any) => {
+            const { updateSchema } = formActionType;
+            updateSchema({
+              field: 'linkEmpty',
+              label: '绑定采空区ID',
+              component: 'ApiSelect',
+              show: e.target.value == 1 ? true : false,
+              componentProps: () => {
+                return {
+                  api: list.bind(null, { strtype: 'sys_empty', pageSize: 1000 }),
+                  labelField: 'systemname',
+                  valueField: 'id',
+                  resultField: 'records',
+                };
+              },
+            });
+          },
+        };
+      },
+    },
+    {
+      label: '绑定采空区ID',
+      field: 'linkEmpty',
+      component: 'ApiSelect',
+      show: false,
+      componentProps: () => {
+        return {
+          api: list.bind(null, { strtype: 'sys_empty', pageSize: 1000 }),
+          labelField: 'systemname',
+          valueField: 'id',
+          resultField: 'records',
+        };
+      },
+    },
+  ];
+};