Browse Source

进尺与瓦斯涌出新增界面修改-提交

lxh 3 days ago
parent
commit
3cab7caadb

+ 56 - 0
src/views/vent/deviceManager/comment/DeviceGasModal.vue

@@ -0,0 +1,56 @@
+<template>
+  <BasicModal v-bind="$attrs" @register="registerModal" :title="title" width="1000px" :showCancelBtn="false"
+    :showOkBtn="false" :footer="null" :destroyOnClose="true" :mask-closable="false" @cancel="closeModalFn">
+    <FormModal :deviceType="deviceType" :record="deviceData" @saveOrUpdate="(values) => emit('saveOrUpdate', values)" />
+  </BasicModal>
+</template>
+<script lang="ts" setup>
+import { computed, unref, inject, reactive, ref, watch } from 'vue';
+import { BasicModal, useModalInner } from '/@/components/Modal';
+import FormModal from './FormModal.vue';
+
+
+
+const props = defineProps({
+  // showTab: { type: Boolean, required: true },
+  // deviceType: { type: String },
+});
+// 声明Emits
+const emit = defineEmits(['saveOrUpdate', 'register', 'closeModal']);
+const isUpdate = inject('isUpdate');
+const deviceData = inject('formData') as any;
+const deviceType = inject('deviceType') as any;
+const record = reactive({});
+
+//表单赋值
+const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
+  //重置表单
+  setModalProps({ confirmLoading: false });
+  Object.assign(deviceData, data.record);
+  // 判断是否是关键阻力路线
+});
+
+//设置标题
+const title = computed(() => {
+  if (!unref(isUpdate)) {
+    if (deviceData.strname || deviceData.systemname) {
+      return `新增(${deviceData.strname || deviceData.systemname})`;
+    }
+    return `新增`;
+  } 
+});
+
+const closeModalFn = () => {
+  closeModal();
+  emit('closeModal');
+};
+
+</script>
+<style scoped lang="less">
+::v-deep .suffix {
+  height: 32px;
+  line-height: 32px;
+  margin-left: 5px;
+  color: #fff;
+}
+</style>

+ 2 - 21
src/views/vent/deviceManager/comment/FormModal.vue

@@ -12,7 +12,6 @@
 <script lang="ts" setup>
 import { inject, nextTick, watch, unref, onMounted } from 'vue';
 import { BasicForm, useForm } from '/@/components/Form/index';
-import { getRegulation as getRegulationList } from '/@/views/vent/deviceManager/substationTabel/substation.api';
 
 // 声明Emits
 const emit = defineEmits(['saveOrUpdate']);
@@ -21,29 +20,11 @@ const props = defineProps({
   deviceType: { type: String },
   record: { type: Object },
 });
-console.log(props.deviceType, '1111111111');
 const existingSchemas = unref(inject('formSchema')) || [];
-const newSchema = {
-  label: '规程值',
-  field: 'regulation',
-  component: 'ApiSelect',
-  componentProps: ({ formModel }) => {
-    return {
-      api: getRegulationList.bind(null, { deviceKind: props.deviceType }),
-      labelField: 'name',
-      valueField: 'id',
-      onChange: (e, option) => {
-        if (option) formModel['regulation'] = option['name'];
-      },
-    };
-  },
-};
-// 在索引位置1处插入规程值配置
-const insertPosition = 3;
-const mergedSchemas = [...existingSchemas.slice(0, insertPosition), newSchema, ...existingSchemas.slice(insertPosition)];
+
 //表单配置
 const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
-  schemas: mergedSchemas,
+  schemas: existingSchemas as any[],
   showActionButtonGroup: false,
 });
 watch(

+ 309 - 0
src/views/vent/deviceManager/comment/NormalGasTable.vue

@@ -0,0 +1,309 @@
+<template>
+  <div>
+    <BasicTable @register="registerTable" :rowSelection="rowSelection">
+      <template #tableTitle>
+        <a-button preIcon="ant-design:plus-outlined" type="primary" @click="handleAdd">新增</a-button>
+        <a-button v-if="getExportUrl" type="primary" preIcon="ant-design:export-outlined" @click="onExportXlsFn"> 导出</a-button>
+        <j-upload-button v-if="getImportUrl" type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
+        <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" />
+  </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 './DeviceGasModal.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';
+
+  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: {
+      title: props.title,
+      api: props.list,
+      columns: props.columns.length > 0 ? (props.columns as any[]) : columnList,
+      showTableSetting: false,
+      // size: 'small',
+      // bordered: false,
+      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 });
+      },
+    },
+    exportConfig: {
+      name: props.title,
+      url: props.getExportUrl,
+    },
+    importConfig: {
+      url: props.getImportUrl,
+    },
+  });
+
+  const onExportXlsFn = () => {
+    const formData = getForm().getFieldsValue();
+    if (props.designScope == 'table-search-reset' && formData['devicetype']) {
+      // 针对接口模糊查询的
+      onExportXls({ ...formData, devicetype: formData['devicetype'] + '*' });
+    } else {
+      onExportXls();
+    }
+  };
+
+  //注册table数据
+  const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
+
+  const saveOrUpdateHandler = async (params) => {
+    try {
+      await props.saveOrUpdate(params, isUpdate.value);
+      // !props.showTab ? closeModal() : '';
+       closeModal();
+      reload();
+      emit('submitSuccess', params);
+    } catch (error) {
+      message.error('保存失败,请联系管理员');
+    }
+  };
+
+  // const closeModalFn = () => {
+  //   closeModal()
+  // }
+  /**
+   * 新增事件
+   */
+  function handleAdd() {
+    for (let key in record) {
+      delete record[key];
+    }
+    isUpdate.value = false;
+    openModal(true);
+  }
+
+  /**
+   * 编辑事件
+   */
+  function handleEdit(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>

+ 2 - 2
src/views/vent/deviceManager/deviceTable/device.data.ts

@@ -95,8 +95,8 @@ export const searchFormSchemaF: FormSchema[] = [
   },
 
   {
-    field: 'starttime',
-    label: '日期',
+    field: 'fteTime',
+    label: '进尺日期',
     component: 'DatePicker',
     componentProps: {
       showTime: false,

+ 79 - 170
src/views/vent/deviceManager/deviceTable/index-footage.vue

@@ -1,190 +1,99 @@
 <template>
   <div class="device-manager-box">
-    <NormalTable
-      v-if="isRefresh"
-      :columns="columns"
-      :searchFormSchema="searchFormSchemaF"
-      :list="footageList"
-      :formSchema="formSchema"
-      :deleteById="deleteByIdF"
-      :saveOrUpdate="saveOrUpdateF"
-      designScope="device-tabel"
-      title="进尺与瓦斯涌出列表"
-      :showTab="true"
-      :deviceType="deviceType"
-    />
+    <NormalTable v-if="isRefresh" :columns="columns" :searchFormSchema="searchFormSchemaF" :list="footageList"
+      :formSchema="formSchema" :deleteById="deleteByIdF" :saveOrUpdate="saveOrUpdateF" designScope="device-tabel"
+      title="进尺与瓦斯涌出列表" :showTab="true" :deviceType="deviceType" />
   </div>
 </template>
 
 <script lang="ts" name="system-user" setup>
-  //ts语法
-  import { ref, onMounted, unref } from 'vue';
-  import NormalTable from '../comment/NormalTable.vue';
-  import { footageList, deleteByIdF, batchDeleteById, saveOrUpdateF, getImportUrl1 } from './device.api';
-  import { list as substationList } from '../substationTabel/substation.api';
+//ts语法
+import { ref, onMounted, unref } from 'vue';
+import NormalTable from '../comment/NormalGasTable.vue';
+import { footageList, deleteByIdF, batchDeleteById, saveOrUpdateF, getImportUrl1,listF } from './device.api';
 
-  import { searchFormSchemaF } from './device.data';
-  import { FormSchema } from '/@/components/Table';
-  import { getFormSchemaColumns, getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
-  import { useRouter } from 'vue-router';
-  import { getAutoScrollContainer } from '/@/utils/common/compUtils';
+import { searchFormSchemaF } from './device.data';
+import { FormSchema } from '/@/components/Table';
+import { getFormSchemaColumns, getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
+import { useRouter } from 'vue-router';
+import { getAutoScrollContainer } from '/@/utils/common/compUtils';
 
-  const { currentRoute } = useRouter();
 
-  const formSchema = ref<FormSchema[]>([]);
-  const isRefresh = ref(false);
+const { currentRoute } = useRouter();
 
-  const deviceType = ref('');
+const formSchema = ref<FormSchema[]>([]);
+const isRefresh = ref(false);
 
-  const columns = ref<any[]>([]);
+const deviceType = ref('');
 
-  const arrToFormColumns = (tableHeaderColumns = []) => {
-    const columnList: any[] = [];
-    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 == 2 && item['monitorcode'] == 'nsubstationid') {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'ApiSelect',
-            componentProps: {
-              api: substationList,
-              labelField: 'strname',
-              valueField: 'id',
-            },
-          };
-        }
-        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,
-            },
-          };
-        }
-        // date日期
-        if (item.type == 8) {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'DatePicker',
-            componentProps: {
-              showTime: false,
-              valueFormat: 'YYYY-MM-DD',
-              getPopupContainer: getAutoScrollContainer,
-            },
-          };
-        }
-        // 日期+时间
-        if (item.type == 9) {
-          columnsItem = {
-            label: item.des, //_dictText
-            field: item.monitorcode,
-            component: 'DatePicker',
-            componentProps: {
-              showTime: true,
-              valueFormat: 'YYYY-MM-DD HH:mm:ss',
-              getPopupContainer: getAutoScrollContainer,
-            },
-          };
-        }
-      }
-      columnList.push(columnsItem);
-    });
-    formSchema.value = columnList;
-    formSchema.value.unshift(
-      {
-        label: '设备id', //_dictText
-        field: 'id',
-        component: 'Input',
-        componentProps: {
-          disabled: true,
-        },
+const columns = ref<any[]>([]);
+
+const arrToFormColumns = (tableHeaderColumns = []) => {
+  const columnList: any[] = [];
+
+  formSchema.value = columnList;
+  formSchema.value.unshift(
+    {
+      label: 'id', //_dictText
+      field: 'id',
+      component: 'Input',
+      componentProps: {
+        disabled: true,
       },
-      {
-        label: '点表',
-        field: 'strtype',
-        component: 'JDictSelectTag',
-        componentProps: {
-          dictCode: `${deviceType.value}kind`,
-          placeholder: '请选择点表',
-          // stringToNumber: true,
-        },
-      }
-    );
-    formSchema.value.push(
-      {
-        label: '设备排序', //_dictText
-        field: 'orderNum',
-        component: 'InputNumber',
+    },
+    {
+      label: '计划进尺',
+      field: 'planFte',
+      component: 'Input'
+    },
+    {
+      label: '实际进尺',
+      field: 'ateFte',
+      component: 'Input'
+    },
+
+    {
+      label: '累计进尺',
+      field: 'sumFte',
+      component: 'Input'
+    },
+    {
+      label: '设备类型',
+      field: 'devId',
+      component: 'ApiSelect',
+      componentProps: {
+        api: listF.bind(null, { devicekind: 'footageGas' }),
+        labelField: 'strname',
+        valueField: 'id',
+        resultField: 'records',
       },
-      {
-        label: '备用分站',
-        field: 'stationids',
-        component: 'ApiSelect',
-        componentProps: {
-          api: substationList,
-          labelField: 'strname',
-          valueField: 'id',
-        },
+    },
+    {
+      field: 'fteTime',
+      label: '进尺日期',
+      component: 'DatePicker',
+      componentProps: {
+        showTime: false,
+        valueFormat: 'YYYY-MM-DD',
+        getPopupContainer: getAutoScrollContainer,
       },
-      {
-        label: '是否显示',
-        field: 'linkId',
-        component: 'RadioGroup',
-        defaultValue: 1,
-        componentProps: () => {
-          return {
-            options: [
-              { label: '是', value: 1, key: '1' },
-              { label: '否', value: 0, key: '2' },
-            ],
-            stringToNumber: true,
-          };
-        },
-      }
-    );
-  };
+    },
+  
+  );
+ 
+};
 
-  onMounted(() => {
-    const route = unref(currentRoute);
-    const pageType = route.name;
-    deviceType.value = pageType;
-    // searchFormSchema[0].componentProps['dictCode'] = `${deviceType.value}kind`;
-    columns.value = getTableHeaderColumns(`${deviceType.value}_list`) || [];
-    const formSchemaColumns = getFormSchemaColumns(`${deviceType.value}_edit`) || [];
+onMounted(() => {
+  const route = unref(currentRoute);
+  const pageType = route.name;
+  deviceType.value = pageType as any;
+  // searchFormSchema[0].componentProps['dictCode'] = `${deviceType.value}kind`;
+  columns.value = getTableHeaderColumns(`${deviceType.value}_list`) || [];
+  const formSchemaColumns = getFormSchemaColumns(`${deviceType.value}_edit`) || [];
 
-    arrToFormColumns(formSchemaColumns);
-    isRefresh.value = true;
-  });
+  arrToFormColumns(formSchemaColumns);
+  isRefresh.value = true;
+});
 </script>
 
 <style scoped></style>

+ 2 - 2
src/views/vent/home/configurable/components/partition-top.vue

@@ -94,8 +94,8 @@ onMounted(() => {
 
 @{theme-deepblue} {
   .electro-chamber {
-    --image-bg: url('@/assets/images/themify/deepblue/home-container/configurable/electroChamber/1-1.png');
-    --image-nav-title: url('@/assets/images/themify/deepblue/home-container/configurable/electroChamber/1-2.png');
+    --image-bg: url('@/assets/images/themify/deepblue/home-container/configurable/electroChamper/1-1.png');
+    --image-nav-title: url('@/assets/images/themify/deepblue/home-container/configurable/electroChamper/1-2.png');
 
   }
 }

+ 2 - 4
src/views/vent/home/configurable/configurable.data.ts

@@ -5558,10 +5558,8 @@ export const testConfigElectro: Config[] = [
       complex_list: [],
       preset: [
         {
-          readFrom: 'ventData',
-          echartOption: {
-            colorList: ['#ff0000', '#ff7700', '#d8b66f', '#dbbf2e', '#61b4c5'],
-          },
+          readFrom: 'datalist',
+         
         },
       ],
       to: '/ventilate/warn/home',

+ 1 - 1
src/views/vent/home/configurable/electroChamber.vue

@@ -36,7 +36,7 @@ const { mainTitle, data, updateData } = useInitPage('机电硐室');
 let interval: number | undefined;
 
 onMounted(() => {
-  fetchConfigs('BD_dust').then(() => {
+  fetchConfigs('electro-champer').then(() => {
     configs.value = testConfigElectro;
     getElectroData({}).then(updateData);
   });