Просмотр исходного кода

Merge branch 'master' of http://39.97.59.228:8013/hrx/goaf-monitoring-system

bobo04052021@163.com 5 месяцев назад
Родитель
Сommit
0f78d0305f

+ 0 - 1
package.json

@@ -58,7 +58,6 @@
     "path-to-regexp": "^6.3.0",
     "pinia": "2.1.7",
     "print-js": "^1.6.0",
-    "qiankun": "^2.10.16",
     "qrcode": "^1.5.4",
     "qs": "^6.14.0",
     "resize-observer-polyfill": "^1.5.1",

Разница между файлами не показана из-за своего большого размера
+ 478 - 7192
pnpm-lock.yaml


+ 6 - 5
src/api/sys/menu.ts

@@ -61,11 +61,12 @@ export const getMenuList: () => Promise<getMenuListResultModel> = () => {
       menu: __STATIC_ROUTES__.map((ele) => {
         if (ele.children && ele.children.length && ele.meta?.generation) {
           const template = ele.children[0];
-          ele.children.push(
-            ...tree.map((d) => {
-              return generateStaticSealedMonitorRoute(template, d);
-            })
-          );
+          const routes = tree.map((d) => {
+            const route = generateStaticSealedMonitorRoute(template, d);
+            route.meta.hideMenu = route.children?.length === 0;
+            return route;
+          });
+          ele.children.push(...routes);
         }
 
         return ele;

BIN
src/assets/font/D-DIN-Bold.otf


BIN
src/assets/font/D-DIN.otf


+ 3 - 2
src/components/Configurable/detail/CustomChart.vue

@@ -15,6 +15,7 @@
       chartConfig: ModuleDataChart;
       height?: string;
       width?: string;
+      chartOption?: EChartsOption;
     }>(),
     {
       chartData: () => [],
@@ -32,10 +33,10 @@
     const domWidth = inst ? inst.getWidth() : 500;
     // 依据每一个图表配置生成图表选项
     const { yAxis = [], xAxis = [], legend, order, type, sortBy, series, dataZoom = [] } = props.chartConfig;
-    const textStyle = {
+    const textStyle = get(props.chartOption, 'textStyle', {
       color: '#fff',
       // color: '#fff',
-    };
+    });
 
     let sorttedData: any[] = [];
     if (Array.isArray(props.chartData)) {

+ 32 - 21
src/components/Configurable/detail/MiniBoard.vue

@@ -104,6 +104,14 @@
 </script>
 <style lang="less" scoped>
   @import '/@/design/theme.less';
+  @font-face {
+    font-family: 'DDIN-Bold';
+    src: url('/@/assets/font//D-DIN-Bold.otf');
+  }
+  @font-face {
+    font-family: 'DDIN';
+    src: url('/@/assets/font//D-DIN.otf');
+  }
 
   .mini-board {
     --image-board-bg-A-1: url('/@/assets/images/sealedGoaf/configurable/miniBoard/board-bg-A-1.png');
@@ -156,17 +164,18 @@
   }
   .mini-board__label_A {
     color: #000000;
-    font-size: 13px;
-    font-family: 'Microsoft YaHei';
-    font-weight: bold;
+    font-size: 137x;
+    font-family: 'Source Han Sans SC';
+    font-style: normal;
+    font-weight: 700;
     padding-bottom: 5px;
   }
   .mini-board__value_A {
     width: 55px;
     color: #000000;
-    font-size: 22px;
+    font-size: 26px;
     padding-bottom: 10px;
-    font-family: 'Microsoft YaHei';
+    font-family: 'DDIN-Bold';
   }
   .mini-board_B {
     width: 98px;
@@ -179,37 +188,38 @@
   .mini-board__label_B {
     color: #000000;
     font-size: 14px;
-    font-family: 'Microsoft YaHei';
+    font-family: 'Source Han Sans SC';
+    font-weight: 700;
+
   }
   .mini-board__value_B {
     color: #000000;
     font-size: 26px;
-    font-weight: bold;
-    font-family: 'Microsoft YaHei';
+    font-family: 'DDIN-Bold';
     padding-bottom: 17px;
   }
   /* 1. 第一个容器:label和value为蓝色 */
   .mini-board_B:nth-child(1) .mini-board__label_B,
   .mini-board_B:nth-child(1) .mini-board__value_B {
-    color: #1890ff;
+    color: #0052cc;
   }
 
   /* 2. 第二个容器:label和value为黄色 */
   .mini-board_B:nth-child(2) .mini-board__label_B,
   .mini-board_B:nth-child(2) .mini-board__value_B {
-    color: #36a64d;
+    color: #4caf50;
   }
 
   /* 3. 第三个容器:label和value为橙色 */
   .mini-board_B:nth-child(3) .mini-board__label_B,
   .mini-board_B:nth-child(3) .mini-board__value_B {
-    color: #a97523;
+    color: #c97800;
   }
 
   /* 4. 第四个容器:label和value为红色 */
   .mini-board_B:nth-child(4) .mini-board__label_B,
   .mini-board_B:nth-child(4) .mini-board__value_B {
-    color: #d6666c;
+    color: #c45656;
   }
   .mini-board_C {
     width: 98px;
@@ -222,19 +232,19 @@
   .mini-board__label_C {
     color: #000000;
     font-size: 14px;
-    font-family: 'Microsoft YaHei';
+    font-family: 'Source Han Sans SC';
+    font-weight: 700;
   }
   .mini-board__value_C {
     color: #000000;
     font-size: 26px;
-    font-weight: bold;
-    font-family: 'Microsoft YaHei';
+    font-family: 'DDIN-Bold';
     padding-bottom: 17px;
   }
   /* 1. 第一个容器:label和value为蓝色 */
   .mini-board_C:nth-child(1) .mini-board__label_C,
   .mini-board_C:nth-child(1) .mini-board__value_C {
-    color: #1890ff;
+    color: #0052cc;
   }
 
   /* 2. 第二个容器:label和value为黄色 */
@@ -252,25 +262,26 @@
   /* 4. 第四个容器:label和value为红色 */
   .mini-board_C:nth-child(4) .mini-board__label_C,
   .mini-board_C:nth-child(4) .mini-board__value_C {
-    color: #ff4d4f;
+    color: #c45656;
   }
   .mini-board_D {
     width: 96px;
-    height: 65px;
+    height: 75px;
     background-image: var(--image-board-bg-D);
     background-size: 100% 100%;
-    padding-top: 6px;
+    padding-top: 12px;
   }
 
   .mini-board__label_D {
     color: #000000;
     font-size: 14px;
-    font-family: 'Microsoft YaHei';
+    font-weight: 800;
   }
   .mini-board__value_D {
     color: #2b6ff0;
     font-size: 22px;
-    font-family: 'Microsoft YaHei';
+    font-family: 'DDIN-Bold';
+    padding-bottom: 3px;
   }
 
   .mini-board_E {

+ 5 - 5
src/components/Form/src/hooks/useFormEvents.ts

@@ -58,10 +58,10 @@ export function useFormEvents({
       let value = values[key];
 
       //antd3升级后,online表单时间控件选中值报js错 TypeError: Reflect.has called on non-object
-      if(!(values instanceof Object)){
+      if (!(values instanceof Object)) {
         return;
       }
-      
+
       const hasKey = Reflect.has(values, key);
 
       value = handleInputNumberValue(schema?.component, value);
@@ -100,14 +100,14 @@ export function useFormEvents({
    */
   function getSchemaByField(field: string): Nullable<FormSchema> {
     if (!isString(field)) {
-      return null
+      return null;
     }
     const schemaList: FormSchema[] = unref(getSchema);
     const index = schemaList.findIndex((schema) => schema.field === field);
     if (index !== -1) {
       return cloneDeep(schemaList[index]);
     }
-    return null
+    return null;
   }
 
   /**
@@ -270,7 +270,7 @@ export function useFormEvents({
     } catch (error) {
       // 代码逻辑说明: 列表查询表单会触发校验错误导致重置失败,原因不明
       emit('submit', {});
-      console.error('query form validate error, please ignore!', error)
+      console.error('query form validate error, please ignore!', error);
       //throw new Error(error);
     }
   }

+ 5 - 4
src/views/analysis/warningAnalysis/airLeakStatus/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="monitoring-page">
     <!-- 新增Tabs组件区分实时/历史数据 -->
-    <Tabs v-model:activeKey="activeTab" type="card" style="margin-bottom: 16px">
+    <Tabs v-model:activeKey="activeTab" type="line" style="margin-bottom: 16px">
       <TabPane tab="实时监测" key="realtime">
         <div class="board-info">
           <div :key="index" v-for="(item, index) in boardData" class="board-item">
@@ -9,7 +9,7 @@
           </div>
         </div>
         <!-- 实时数据表格 -->
-        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <!-- 操作按钮 -->
@@ -27,7 +27,7 @@
 
       <TabPane tab="历史数据" key="history">
         <!-- 历史数据表格 -->
-        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <button @click="openModal(record, 'history')" class="action-btn">
@@ -339,7 +339,8 @@ onMounted(() => {
   display: flex;
   padding: 10px;
   background-color: #fff;
-  margin: 0 10px;
+  // margin: 0 10px;
+  margin-bottom: 5px;
   gap: 10px;
   box-sizing: border-box;
 }

+ 5 - 4
src/views/analysis/warningAnalysis/autoFireAnalysis/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="monitoring-page">
     <!-- 新增Tabs组件区分实时/历史数据 -->
-    <Tabs v-model:activeKey="activeTab" type="card" style="margin-bottom: 16px">
+    <Tabs v-model:activeKey="activeTab" type="line" style="margin-bottom: 16px">
       <TabPane tab="实时监测" key="realtime">
         <div class="board-info">
           <MiniBoard
@@ -15,7 +15,7 @@
           />
         </div>
         <!-- 实时数据表格 -->
-        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }" style="padding: 0">
+        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }">
           <template #action="{ record }">
             <div class="action-buttons">
               <!-- 操作按钮 -->
@@ -29,7 +29,7 @@
 
       <TabPane tab="历史数据" key="history">
         <!-- 历史数据表格 -->
-        <BasicTable @register="registerHistoryTable">
+        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }">
           <template #action="{ record }">
             <div class="action-buttons">
               <button @click="openModal(record, 'history')" class="action-btn">
@@ -318,8 +318,9 @@ onMounted(() => {
   box-sizing: border-box;
   background-color: #fff;
   padding: 10px;
-  margin: 0 10px;
   gap: 100px;
+  // margin: 0 10px;
+  margin-bottom: 5px;
 }
 .board-item {
   box-sizing: border-box;

+ 5 - 4
src/views/analysis/warningAnalysis/fireAreaJudgeAnalysis/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="monitoring-page">
     <!-- 新增Tabs组件区分实时/历史数据 -->
-    <Tabs v-model:activeKey="activeTab" type="card" style="margin-bottom: 16px">
+    <Tabs v-model:activeKey="activeTab" type="line" style="margin-bottom: 16px">
       <TabPane tab="实时监测" key="realtime">
         <div class="board-info">
           <MiniBoard
@@ -15,7 +15,7 @@
           />
         </div>
         <!-- 实时数据表格 -->
-        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <!-- 操作按钮 -->
@@ -29,7 +29,7 @@
 
       <TabPane tab="历史数据" key="history">
         <!-- 历史数据表格 -->
-        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <button @click="openModal(record, 'history')" class="action-btn">
@@ -307,7 +307,8 @@ onMounted(() => {
   box-sizing: border-box;
   background-color: #fff;
   padding: 10px;
-  margin: 0 10px;
+  // margin: 0 10px;
+  margin-bottom: 5px;
   gap: 100px;
 }
 .board-item {

+ 5 - 4
src/views/analysis/warningAnalysis/overlimitAlarm/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="monitoring-page">
     <!-- 新增Tabs组件区分实时/历史数据 -->
-    <Tabs v-model:activeKey="activeTab" type="card" style="margin-bottom: 16px">
+    <Tabs v-model:activeKey="activeTab" type="line" style="margin-bottom: 16px">
       <TabPane tab="实时监测" key="realtime">
         <div class="board-info">
           <MiniBoard
@@ -15,7 +15,7 @@
           />
         </div>
         <!-- 实时数据表格 -->
-        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <!-- 操作按钮 -->
@@ -29,7 +29,7 @@
 
       <TabPane tab="历史数据" key="history">
         <!-- 历史数据表格 -->
-        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <button @click="openModal(record, 'history')" class="action-btn">
@@ -318,7 +318,8 @@ onMounted(() => {
   box-sizing: border-box;
   background-color: #fff;
   padding: 10px;
-  margin: 0 10px;
+  // margin: 0 10px;
+  margin-bottom: 5px;
   gap: 100px;
 }
 .board-item {

+ 5 - 4
src/views/analysis/warningAnalysis/pressureDiffAnalysis/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="monitoring-page">
     <!-- 新增Tabs组件区分实时/历史数据 -->
-    <Tabs v-model:activeKey="activeTab" type="card" style="margin-bottom: 16px">
+    <Tabs v-model:activeKey="activeTab" type="line" style="margin-bottom: 16px">
       <TabPane tab="实时监测" key="realtime">
         <div class="board-info">
           <MiniBoard
@@ -15,7 +15,7 @@
           />
         </div>
         <!-- 实时数据表格 -->
-        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <!-- 操作按钮 -->
@@ -33,7 +33,7 @@
 
       <TabPane tab="历史数据" key="history">
         <!-- 历史数据表格 -->
-        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <button @click="openModal(record, 'history')" class="action-btn">
@@ -340,7 +340,8 @@ onMounted(() => {
   box-sizing: border-box;
   background-color: #fff;
   padding: 10px;
-  margin: 0 10px;
+  // margin: 0 10px;
+  margin-bottom: 5px;
   gap: 100px;
 }
 .board-item {

+ 5 - 4
src/views/analysis/warningAnalysis/sealRiskJudgeAnalysis/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="monitoring-page">
     <!-- 新增Tabs组件区分实时/历史数据 -->
-    <Tabs v-model:activeKey="activeTab" type="card" style="margin-bottom: 16px">
+    <Tabs v-model:activeKey="activeTab" type="line" style="margin-bottom: 16px">
       <TabPane tab="实时监测" key="realtime">
         <div class="board-info">
           <MiniBoard
@@ -15,7 +15,7 @@
           />
         </div>
         <!-- 实时数据表格 -->
-        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <!-- 核心:判断record是否有有效数据,无则显示- -->
           <template #action="{ record }">
             <button @click="openModal(record, 'detail')" class="action-btn detail-btn" title="操作">
@@ -31,7 +31,7 @@
 
       <TabPane tab="历史数据" key="history">
         <!-- 历史数据表格 -->
-        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }">
+        <BasicTable @register="registerHistoryTable" :scroll="{ x: 'max-content' }" :style="{ padding: 0 }">
           <template #action="{ record }">
             <div class="action-buttons">
               <button @click="openModal(record, 'history')" class="action-btn">
@@ -320,7 +320,8 @@ onMounted(() => {
   box-sizing: border-box;
   background-color: #fff;
   padding: 10px;
-  margin: 0 10px;
+  // margin: 0 10px;
+  margin-bottom: 5px;
   gap: 100px;
 }
 .board-item {

+ 4 - 4
src/views/dashboard/SealedGoaf/configurable.data.sealedGoaf.ts

@@ -514,7 +514,7 @@ export const testConfigSealedGoaf: Config[] = [
       },
     },
     showStyle: {
-      size: 'width:440px;height:340px;',
+      size: 'width:440px;height:330px;',
       version: '原版',
       position: 'top:-20px;right:25px;',
     },
@@ -681,9 +681,9 @@ export const testConfigSealedGoaf: Config[] = [
       // },
     },
     showStyle: {
-      size: 'width:440px;height:310px;',
+      size: 'width:440px;height:300px;',
       version: '原版',
-      position: 'top:330px;right:25px;',
+      position: 'top:320px;right:25px;',
     },
   },
   // 7. 当日报警情况统计
@@ -768,7 +768,7 @@ export const testConfigSealedGoaf: Config[] = [
       preset: [],
     },
     showStyle: {
-      size: 'width:440px;height:180px;',
+      size: 'width:440px;height:205px;',
       version: '原版',
       position: 'bottom:10px;right:25px;',
     },

+ 19 - 2
src/views/monitor/sealedMonitor/components/RealtimeDetailsModal.vue

@@ -5,14 +5,21 @@
       <div v-for="(item, index) in modalDetailsData.basicInfo" :key="index" class="info-item">
         <span class="label">{{ item.label }}:</span>
         <span class="value" :class="getBasicInfoTagClass(item.value)">
-          {{ item.value }}
+          {{ dataRef[item.value] || '-' }}
         </span>
       </div>
     </div>
 
     <!-- 监测数据卡片 -->
     <div class="data-cards">
-      <MiniBoard v-for="(item, index) in modalDetailsData.board" :key="index" type="D" :label="item.label" :value="item.value" layout="val-top" />
+      <MiniBoard
+        v-for="(item, index) in modalDetailsData.board"
+        :key="index"
+        type="D"
+        :label="item.label"
+        :value="dataRef[item.value] || '-'"
+        layout="val-top"
+      />
     </div>
 
     <!-- 图表区域 -->
@@ -29,6 +36,11 @@
           <CustomChart
             :chart-data="modalDetailsData.gasConcentrationData"
             :chart-config="modalDetailsData.gasConcentrationConfig"
+            :chart-option="{
+              textStyle: {
+                color: '#000',
+              },
+            }"
             style="height: 100%; width: 100%"
           />
         </div>
@@ -39,6 +51,11 @@
           <CustomChart
             :chart-data="modalDetailsData.pressureData"
             :chart-config="modalDetailsData.pressureConfig"
+            :chart-option="{
+              textStyle: {
+                color: '#000',
+              },
+            }"
             style="height: 100%; width: 100%"
           />
         </div>

+ 17 - 17
src/views/monitor/sealedMonitor/monitor.data.ts

@@ -141,19 +141,19 @@ export const minesData = [
   },
 ];
 
-export const modalDetailsData: {} = {
+export const modalDetailsData = {
   basicInfo: [
     {
       label: '煤矿名称',
-      value: '神木市三江能源有限公司',
+      value: 'mineName',
     },
     {
-      label: '密闭名称',
-      value: 'xxxx采空区密闭',
+      label: '设备位置',
+      value: 'devicePos',
     },
     {
       label: '所属煤层',
-      value: 'xxxx煤层',
+      value: 'coalSeamName',
     },
     {
       label: '自燃情况',
@@ -161,53 +161,53 @@ export const modalDetailsData: {} = {
     },
     {
       label: '是否漏风',
-      value: '闭内气体涌出',
+      value: 'leakageAlarm',
     },
     {
       label: '自然发火隐患',
-      value: '低风险',
+      value: 'fireAlarm',
     },
     {
       label: '密闭启封判定',
-      value: '不可启封',
+      value: 'unsealAlarm',
     },
     {
       label: '爆炸危险性',
-      value: '低风险',
+      value: 'explosionAlarm',
     },
   ],
   board: [
     {
       label: 'CO(ppm)',
-      value: '21',
+      value: 'coVal',
     },
     {
       label: 'CO2(PPM)',
-      value: '21',
+      value: 'co2Val',
     },
     {
       label: 'O2(%)',
-      value: '24',
+      value: 'o2Val',
     },
     {
       label: 'CH4(%)',
-      value: '17',
+      value: 'ch4Val',
     },
     {
       label: 'C2H4(ppm)',
-      value: '23',
+      value: 'c2h4Val',
     },
     {
       label: 'C2H2(ppm)',
-      value: '14',
+      value: 'c2h2Val',
     },
     {
       label: '温度(℃)',
-      value: '14',
+      value: 'temperature',
     },
     {
       label: '压差(Pa)',
-      value: '14',
+      value: 'sourcePressure',
     },
   ],
   demoBlastData: {

+ 2 - 6
src/views/system/algorithm/algorithm.api.ts

@@ -27,9 +27,7 @@ export function getCoalSeamAlarmRule(params: any) {
   return defHttp.post({ url: Api.getCoalSeamAlarmRule, params });
 }
 export function updateCoalSeamAlarmRule(params: any) {
-  return defHttp.post({ url: Api.updateCoalSeamAlarmRule, params }).then(() => {
-    message.success('修改成功');
-  });
+  return defHttp.post({ url: Api.updateCoalSeamAlarmRule, params });
 }
 export function addCoalSeamAlarmRule(params: any) {
   return defHttp.post({ url: Api.addCoalSeamAlarmRule, params }).then(() => {
@@ -51,9 +49,7 @@ export function addGoafDataLimit(params: any) {
   });
 }
 export function updateGoafDataLimit(params: any) {
-  return defHttp.post({ url: Api.updateGoafDataLimit, params }).then(() => {
-    message.success('修改成功');
-  });
+  return defHttp.post({ url: Api.updateGoafDataLimit, params });
 }
 export function deleteGoafDataLimit(params: any) {
   return defHttp.post({ url: Api.deleteGoafDataLimit, params }, { joinParamsToUrl: true });

+ 123 - 29
src/views/system/algorithm/algorithm.data.ts

@@ -3,17 +3,6 @@ import { FormSchema } from '/@/components/Form';
 import { BasicColumn } from '/@/components/Table';
 import { Tag } from 'ant-design-vue';
 
-const goafAlarmOptions = [
-  { value: 'ch4Val', label: '甲烷' },
-  { value: 'o2Val', label: '氧气' },
-  { value: 'coVal', label: '一氧化碳' },
-  { value: 'co2Val', label: '二氧化碳' },
-  { value: 'c2h4Val', label: '乙烯' },
-  { value: 'c2h2Val', label: '乙炔' },
-  { value: 'sourcePressure', label: '压差' },
-  { value: 'temperature', label: '温度' },
-];
-
 /** 煤层预警参数 表格配置 */
 export const columnsCoalAlarm: BasicColumn[] = [
   {
@@ -467,32 +456,137 @@ export const schemasCoalAlarm: FormSchema[] = [
     colProps: { span: 12 },
   },
 ];
+
+export const goafAlarmModel = {
+  ch4Val: {
+    alarmField: 'ch4Val',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+  o2Val: {
+    alarmField: 'o2Val',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+  coVal: {
+    alarmField: 'coVal',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+  co2Val: {
+    alarmField: 'co2Val',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+  c2h4Val: {
+    alarmField: 'c2h4Val',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+  c2h2Val: {
+    alarmField: 'c2h2Val',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+  sourcePressure: {
+    alarmField: 'sourcePressure',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+  temperature: {
+    alarmField: 'temperature',
+    lowerLimit: undefined,
+    upperLimit: undefined,
+  },
+};
+
 export const schemasGoafLimit: FormSchema[] = [
   {
-    label: 'ID',
-    field: 'id',
-    show: false,
+    field: 'ch4Val',
+    label: '甲烷',
+    labelWidth: 118,
     component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.ch4Val,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
   },
   {
-    label: '监测值:',
-    field: 'alarmField',
-    component: 'Select',
-    defaultValue: 'ch4Val',
-    componentProps: {
-      options: goafAlarmOptions,
-    },
+    field: 'o2Val',
+    label: '氧气',
+    labelWidth: 118,
+    component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.o2Val,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
   },
   {
-    label: '下限值:',
-    field: 'lowerLimit',
-    defaultValue: 0,
-    component: 'InputNumber',
+    field: 'coVal',
+    label: '一氧化碳',
+    labelWidth: 118,
+    component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.coVal,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
   },
   {
-    label: '上限值:',
-    field: 'upperLimit',
-    defaultValue: 100,
-    component: 'InputNumber',
+    field: 'co2Val',
+    label: '二氧化碳',
+    labelWidth: 118,
+    component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.co2Val,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
+  },
+  {
+    field: 'c2h4Val',
+    label: '乙烯',
+    labelWidth: 118,
+    component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.c2h4Val,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
+  },
+  {
+    field: 'c2h2Val',
+    label: '乙炔',
+    labelWidth: 118,
+    component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.c2h2Val,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
+  },
+  {
+    field: 'sourcePressure',
+    label: '压差',
+    labelWidth: 118,
+    component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.sourcePressure,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
+  },
+  {
+    field: 'temperature',
+    label: '温度',
+    labelWidth: 118,
+    component: 'Input',
+    slot: 'InputRangeGoaf',
+    defaultValue: goafAlarmModel.temperature,
+    /** 借用 */
+    groupName: '下限 - 上限',
+    colProps: { span: 12 },
   },
 ];

+ 63 - 28
src/views/system/algorithm/index.vue

@@ -17,9 +17,9 @@
             <button @click="handleEdit({ goafId: record.id, mineCode: last(expandedRowKeys) }, 'goaf')" class="action-btn">
               <SvgIcon name="edit" />
             </button>
-            <button @click="handleAdd({ goafId: record.id, mineCode: last(expandedRowKeys) }, 'goaf')" class="action-btn ml-1">
+            <!-- <button @click="handleAdd({ goafId: record.id, mineCode: last(expandedRowKeys) }, 'goaf')" class="action-btn ml-1">
               <PlusOutlined />
-            </button>
+            </button> -->
             <a-popconfirm title="确认删除?" @confirm="handleDelete(record, 'coal')">
               <button @click="handleDelete(record, 'goaf')" class="action-btn ml-1">
                 <SvgIcon name="delete" />
@@ -33,9 +33,9 @@
         <button @click="handleEdit({ coalSeamId: record.id, mineCode: record.mineCode }, 'coal')" class="action-btn">
           <SvgIcon name="edit" />
         </button>
-        <button @click="handleAdd({ coalSeamId: record.id, mineCode: record.mineCode }, 'coal')" class="action-btn ml-1">
+        <!-- <button @click="handleAdd({ coalSeamId: record.id, mineCode: record.mineCode }, 'coal')" class="action-btn ml-1">
           <PlusOutlined />
-        </button>
+        </button> -->
         <a-popconfirm title="确认删除?" @confirm="handleDelete(record, 'coal')">
           <button class="action-btn ml-1">
             <SvgIcon name="delete" />
@@ -73,6 +73,15 @@
           </a-input-group>
         </a-form-item>
       </template>
+      <template #InputRangeGoaf="{ model, field, schema }">
+        <a-form-item v-if="model[field]">
+          <a-input-group>
+            <a-input-number v-model:value="model[field][`lowerLimit`]" style="width: calc(50% - 100px)" placeholder="-" />
+            <a-input style="width: 200px; border-left: 0; pointer-events: none; color: inherit" :value="schema.groupName" disabled />
+            <a-input-number v-model:value="model[field][`upperLimit`]" style="width: calc(50% - 100px); border-left: 0" placeholder="-" />
+          </a-input-group>
+        </a-form-item>
+      </template>
     </BasicForm>
   </BasicModal>
 </template>
@@ -85,7 +94,7 @@
   import { useForm, BasicForm } from '/@/components/Form';
   import { BasicTable, useTable } from '/@/components/Table';
   import { useListPage } from '/@/hooks/system/useListPage';
-  import { columnsCoalAlarm, columnsGoafLimit, schemasCoalAlarm, schemasGoafLimit, searchFormSchema } from './algorithm.data';
+  import { columnsCoalAlarm, columnsGoafLimit, schemasCoalAlarm, schemasGoafLimit, searchFormSchema, goafAlarmModel } from './algorithm.data';
   import {
     addCoalSeamAlarmRule,
     deleteCoalSeamAlarmRule,
@@ -99,9 +108,9 @@
     getGoafDataLimit,
   } from './algorithm.api';
   import { Flex } from 'ant-design-vue';
-  import { PlusOutlined } from '@ant-design/icons-vue';
-  import { last } from 'lodash-es';
-
+  // import { PlusOutlined } from '@ant-design/icons-vue';
+  import { forEach, isNil, last, map } from 'lodash-es';
+  import { message } from 'ant-design-vue';
   import { SvgIcon } from '/@/components/Icon';
 
   const { prefixCls } = useDesign('algorithm-list');
@@ -165,8 +174,30 @@
       'goaf',
       {
         schemas: schemasGoafLimit,
-        submitFunc: (res) => (res.id ? updateGoafDataLimit(res) : addGoafDataLimit(res)),
-        fetchRecord: (params) => getGoafDataLimit(params).then((r) => last(r)),
+        submitFunc: (res) =>
+          Promise.all(
+            map(res, (item) => {
+              if (item.id) {
+                return updateGoafDataLimit(item);
+              }
+              if (!isNil(item.lowerLimit) || !isNil(item.upperLimit)) {
+                return addGoafDataLimit(item);
+              }
+              return Promise.resolve();
+            })
+          ),
+        fetchRecord: (params) =>
+          getGoafDataLimit(params).then((r) => {
+            const result: any = {};
+            forEach(goafAlarmModel, (item, key) => {
+              result[key] = { ...params, ...item };
+            });
+            forEach(r, (item) => {
+              result[item.alarmField] = item;
+            });
+
+            return result;
+          }),
       },
     ],
   ]);
@@ -174,7 +205,7 @@
     ['coal', { title: '预警参数设置', visible: true, loading: true }],
     ['goaf', { title: '超限预警设置', visible: true, loading: true }],
   ]);
-  const submitResolver = ref<(res: any) => Promise<void>>();
+  const submitResolver = ref<(res: any) => Promise<unknown>>();
   // 点击编辑后,获取对应的表单和弹窗配置
   async function handleEdit(record, sign: string) {
     if (!modalPropsMap.has(sign)) return;
@@ -196,26 +227,26 @@
 
     setModalProps({ loading: false });
   }
-  async function handleAdd(record, sign: string) {
-    if (!modalPropsMap.has(sign)) return;
-    if (!formPropsMap.has(sign)) return;
-    setModalProps(modalPropsMap.get(sign) as ModalProps);
-    const { schemas, submitFunc } = formPropsMap.get(sign)!;
-    await nextTick();
-    await resetSchema(schemas);
+  // async function handleAdd(record, sign: string) {
+  //   if (!modalPropsMap.has(sign)) return;
+  //   if (!formPropsMap.has(sign)) return;
+  //   setModalProps(modalPropsMap.get(sign) as ModalProps);
+  //   const { schemas, submitFunc } = formPropsMap.get(sign)!;
+  //   await nextTick();
+  //   await resetSchema(schemas);
 
-    await nextTick();
+  //   await nextTick();
 
-    await resetFields();
+  //   await resetFields();
 
-    await nextTick();
+  //   await nextTick();
 
-    // 不要使用setFormProps因为它会错误的触发submit方法
-    // await setFormProps({ submitFunc });
-    submitResolver.value = (res) => submitFunc(Object.assign(res, record));
+  //   // 不要使用setFormProps因为它会错误的触发submit方法
+  //   // await setFormProps({ submitFunc });
+  //   submitResolver.value = (res) => submitFunc(Object.assign(res, record));
 
-    setModalProps({ loading: false });
-  }
+  //   setModalProps({ loading: false });
+  // }
 
   const deletionPropsMap = new Map<string, { api: (id: string) => Promise<void> }>([
     ['coal', { api: (id) => deleteCoalSeamAlarmRule({ id }) }],
@@ -228,7 +259,7 @@
   }
 
   const [registerModal, { setModalProps }] = useModal();
-  const [registerForm, { resetFields, setFieldsValue, validate, resetSchema }] = useForm({
+  const [registerForm, { setFieldsValue, validate, resetSchema }] = useForm({
     model: {},
     schemas: schemasCoalAlarm,
     showResetButton: false,
@@ -239,7 +270,11 @@
 
   function handleSubmit() {
     return validate().then((res) => {
-      submitResolver.value && submitResolver.value(res);
+      submitResolver.value &&
+        submitResolver.value(res).then(() => {
+          message.success('操作成功');
+          setModalProps({ visible: false });
+        });
     });
   }
 </script>

Некоторые файлы не были показаны из-за большого количества измененных файлов