From e404c076586d9682c3d782a4ecb0dc254f0bfd48 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 25 四月 2024 21:33:41 +0800
Subject: [PATCH] 一些更改

---
 src/views/tigerprojects/mes/eng/router/index.vue |  388 +++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 261 insertions(+), 127 deletions(-)

diff --git a/src/views/tigerprojects/mes/eng/router/index.vue b/src/views/tigerprojects/mes/eng/router/index.vue
index 39e7692..8d0e5a3 100644
--- a/src/views/tigerprojects/mes/eng/router/index.vue
+++ b/src/views/tigerprojects/mes/eng/router/index.vue
@@ -1,138 +1,272 @@
 <template>
   <PageWrapper title="宸ヨ壓娴佺▼鍥�" content="鏍规嵁鐢熶骇宸ヨ壓璁捐宸ヨ壓娴佺▼" contentFullHeight fixedHeight>
-    <FlowChart :data="demoData" />
+    <a-layout style="min-height: 100vh">
+      <a-layout-content>
+        <FlowChart :data="demoData" />
+      </a-layout-content>
+      <a-layout-sider
+        width="450"
+        style="background: #fafafa; border-left: 1px solid #d9d9d9; padding: 20px"
+        ><BasicForm
+          autoFocusFirstItem
+          :labelWidth="80"
+          :schemas="schemas"
+          :actionColOptions="{ span: 24 }"
+          :submitButtonOptions="{ text: '纭畾' }"
+          @submit="handleSubmit"
+          @reset="handleReset"
+      /></a-layout-sider>
+    </a-layout>
   </PageWrapper>
 </template>
 
-<script lang="ts">
+<script lang="ts" setup>
   import { FlowChart } from '/@/components/FlowChart';
   import { PageWrapper } from '/@/components/Page';
+  import { BasicForm, FormSchema } from '/@/components/Form/index';
+  import { getOperAllList } from '/@/api/tigerapi/mes/oper';
+  import { ref } from 'vue';
 
-  export default {
-    components: { FlowChart, PageWrapper },
-    setup() {
-      let demoData = {
-        nodes: [
-          {
-            id: '5d82e943-477f-4313-aaff-a736d8caba74',
-            type: 'rect',
-            x: 340,
-            y: 120,
-            properties: {},
-            text: {
-              x: 340,
-              y: 120,
-              value: '娴嬭瘯宸ュ簭',
-            },
-          },
-          {
-            id: '6e0c6714-69a7-4160-8bda-61f4e6d285dd',
-            type: 'rect',
-            x: 560,
-            y: 120,
-            properties: {},
-            text: {
-              x: 560,
-              y: 120,
-              value: '涓婃枡宸ュ簭',
-            },
-          },
-          {
-            id: '80b2ee17-5a0e-4586-ba28-6ba59fcc0f59',
-            type: 'rect',
-            x: 340,
-            y: 280,
-            properties: {
-              isReturn: true,
-            },
-            text: {
-              x: 340,
-              y: 280,
-              value: '缁翠慨宸ュ簭',
-            },
-          },
+  const isRuter = (type: string) => type === '0';
+  const isOper = (type: string) => type === '1';
+  const schemas: FormSchema[] = [
+    // {
+    //   field: 'divider-basic',
+    //   component: 'Divider',
+    //   label: '灞炴�ч〉',
+    // },
+    {
+      field: 'func_type',
+      label: '灞炴�ч〉',
+      component: 'RadioButtonGroup',
+      defaultValue: '0',
+      componentProps: {
+        options: [
+          { label: '宸ヨ壓娴佺▼', value: '0' },
+          { label: '宸ュ簭', value: '1' },
         ],
-        edges: [
-          {
-            id: 'Flow_0p4u47c',
-            type: 'bpmn:sequenceFlow',
-            sourceNodeId: '5d82e943-477f-4313-aaff-a736d8caba74',
-            targetNodeId: '6e0c6714-69a7-4160-8bda-61f4e6d285dd',
-            startPoint: {
-              x: 390,
-              y: 120,
-            },
-            endPoint: {
-              x: 510,
-              y: 120,
-            },
-            properties: {},
-            pointsList: [
-              {
-                x: 390,
-                y: 120,
-              },
-              {
-                x: 510,
-                y: 120,
-              },
-            ],
-          },
-          {
-            id: 'Flow_09tu4cm',
-            type: 'bpmn:sequenceFlow',
-            sourceNodeId: '5d82e943-477f-4313-aaff-a736d8caba74',
-            targetNodeId: '80b2ee17-5a0e-4586-ba28-6ba59fcc0f59',
-            startPoint: {
-              x: 340,
-              y: 160,
-            },
-            endPoint: {
-              x: 340,
-              y: 240,
-            },
-            properties: {},
-            pointsList: [
-              {
-                x: 340,
-                y: 160,
-              },
-              {
-                x: 340,
-                y: 240,
-              },
-            ],
-          },
-          {
-            id: '22226ec4-9960-497d-93cb-6226a3f29b3d',
-            type: 'custom-edge',
-            sourceNodeId: '80b2ee17-5a0e-4586-ba28-6ba59fcc0f59',
-            targetNodeId: '5d82e943-477f-4313-aaff-a736d8caba74',
-            startPoint: {
-              x: 351,
-              y: 240,
-            },
-            endPoint: {
-              x: 351,
-              y: 160,
-            },
-            properties: {},
-            pointsList: [
-              {
-                x: 351,
-                y: 240,
-              },
-              {
-                x: 351,
-                y: 160,
-              },
-            ],
-          },
-        ],
-      };
-      return {
-        demoData,
-      };
+      },
+      colProps: { lg: 24, md: 24 },
     },
-  };
+    {
+      field: 'OPER_CODE',
+      component: 'ApiSelect',
+      label: '閫夋嫨宸ュ簭',
+      componentProps: {
+        api: getOperAllList,
+        // params: {
+        //   id: 1,
+        // },
+        resultField: 'items',
+        labelField: 'OPER_NAME',
+        valueField: 'OPER_CODE',
+        // not request untill to select
+        immediate: false,
+        onChange: (e) => {
+          console.log('selected:', e);
+        },
+        // atfer request callback
+        onOptionsChange: (options) => {
+          console.log('get options', options.length, options);
+        },
+      },
+      ifShow: ({ values }) => isOper(values.func_type),
+    },
+    {
+      field: 'field2',
+      component: 'Input',
+      label: '宸ュ簭绫诲瀷',
+      // componentProps:{},
+      // can func
+      componentProps: ({ schema, formModel }) => {
+        console.log('form:', schema);
+        console.log('formModel:', formModel);
+        return {
+          placeholder: '娴嬭瘯',
+          onChange: (e: any) => {
+            console.log(e);
+          },
+        };
+      },
+      renderComponentContent: () => {
+        return {
+          prefix: () => '宸ュ簭',
+          suffix: () => '绫诲瀷',
+        };
+      },
+    },
+    {
+      field: 'field3',
+      component: 'Select',
+      label: '宸ュ簭琛屼负',
+      componentProps: {
+        options: [
+          {
+            label: '瀛樺偍杩囩▼',
+            value: '1',
+            key: '1',
+          },
+          {
+            label: '鏉$爜瑙勫垯',
+            value: '2',
+            key: '2',
+          },
+          {
+            label: '琛屼负涓�',
+            value: '3',
+            key: '3',
+          },
+          {
+            label: '琛屼负浜�',
+            value: '4',
+            key: '4',
+          },
+          {
+            label: '琛屼负涓�',
+            value: '5',
+            key: '5',
+          },
+        ],
+      },
+    },
+    {
+      field: 'field4',
+      component: 'Switch',
+      label: '鏄惁璁$畻鐩撮�氱巼',
+      colProps: {
+        span: 16,
+      },
+      labelWidth: 200,
+    },
+    {
+      field: 'field5',
+      component: 'Switch',
+      label: '鏄惁鍙烦绔�',
+      colProps: {
+        span: 16,
+      },
+      labelWidth: 200,
+    },
+  ];
+  const demoData = ref({
+    nodes: [
+      {
+        id: '5d82e943-477f-4313-aaff-a736d8caba74',
+        type: 'rect',
+        x: 340,
+        y: 120,
+        properties: {},
+        text: {
+          x: 340,
+          y: 120,
+          value: '娴嬭瘯宸ュ簭',
+        },
+      },
+      {
+        id: '6e0c6714-69a7-4160-8bda-61f4e6d285dd',
+        type: 'rect',
+        x: 560,
+        y: 120,
+        properties: {},
+        text: {
+          x: 560,
+          y: 120,
+          value: '涓婃枡宸ュ簭',
+        },
+      },
+      {
+        id: '80b2ee17-5a0e-4586-ba28-6ba59fcc0f59',
+        type: 'rect',
+        x: 340,
+        y: 280,
+        properties: {
+          isReturn: true,
+        },
+        text: {
+          x: 340,
+          y: 280,
+          value: '缁翠慨宸ュ簭',
+        },
+      },
+    ],
+    edges: [
+      {
+        id: 'Flow_0p4u47c',
+        type: 'bpmn:sequenceFlow',
+        sourceNodeId: '5d82e943-477f-4313-aaff-a736d8caba74',
+        targetNodeId: '6e0c6714-69a7-4160-8bda-61f4e6d285dd',
+        startPoint: {
+          x: 390,
+          y: 120,
+        },
+        endPoint: {
+          x: 510,
+          y: 120,
+        },
+        properties: {},
+        pointsList: [
+          {
+            x: 390,
+            y: 120,
+          },
+          {
+            x: 510,
+            y: 120,
+          },
+        ],
+      },
+      {
+        id: 'Flow_09tu4cm',
+        type: 'bpmn:sequenceFlow',
+        sourceNodeId: '5d82e943-477f-4313-aaff-a736d8caba74',
+        targetNodeId: '80b2ee17-5a0e-4586-ba28-6ba59fcc0f59',
+        startPoint: {
+          x: 340,
+          y: 160,
+        },
+        endPoint: {
+          x: 340,
+          y: 240,
+        },
+        properties: {},
+        pointsList: [
+          {
+            x: 340,
+            y: 160,
+          },
+          {
+            x: 340,
+            y: 240,
+          },
+        ],
+      },
+      {
+        id: '22226ec4-9960-497d-93cb-6226a3f29b3d',
+        type: 'custom-edge',
+        sourceNodeId: '80b2ee17-5a0e-4586-ba28-6ba59fcc0f59',
+        targetNodeId: '5d82e943-477f-4313-aaff-a736d8caba74',
+        startPoint: {
+          x: 351,
+          y: 240,
+        },
+        endPoint: {
+          x: 351,
+          y: 160,
+        },
+        properties: {},
+        pointsList: [
+          {
+            x: 351,
+            y: 240,
+          },
+          {
+            x: 351,
+            y: 160,
+          },
+        ],
+      },
+    ],
+  });
+  function handleReset() {}
+  function handleSubmit(_values: any) {}
 </script>

--
Gitblit v1.9.3