From 078f603f7686c274067028bd23032625e6eee3ce Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期三, 12 六月 2024 14:54:48 +0800
Subject: [PATCH] 工厂登录

---
 src/views/tigerprojects/mes/eng/route/index.vue |   71 +++++++++++++++++++++++++++++++++--
 1 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/src/views/tigerprojects/mes/eng/route/index.vue b/src/views/tigerprojects/mes/eng/route/index.vue
index f0c3508..27d22f0 100644
--- a/src/views/tigerprojects/mes/eng/route/index.vue
+++ b/src/views/tigerprojects/mes/eng/route/index.vue
@@ -20,7 +20,13 @@
         style="background: #fafafa; border-left: 1px solid #d9d9d9; padding: 10px"
         :zeroWidthTriggerStyle="{ 'margin-top': '-70px', 'background-color': 'gray' }"
       >
-        <PropsPanel ref="propsPanel" :activeKey="routeConfig.activeKey">
+        <PropsPanel ref="propsPanel" 
+          :activeKey="routeConfig.activeKey" 
+          :IsOperation="IsOperation" 
+          :title="title"
+          :colSlots="colSlots"
+          :crudColSlots="crudColSlots"
+          :entityName="entityName">
           <!-- <template v-for="item of formConfig.schemas" #[`${item.component}Props`]="data">
             <slot
               :name="`${item.component}Props`"
@@ -35,13 +41,13 @@
   </PageWrapper>
 </template>
 
-<script lang="ts" setup>
+<script lang="ts" setup name="Route_View">
   import { FlowChart } from '/@/components/FlowChart';
   import { PageWrapper } from '/@/components/Page';
   import { SaveRouteData, getRouteData } from '/@/api/tigerapi/mes/router';
   import { useModal } from '/@/components/Modal';
   import RouteModal from './RouteModal.vue';
-  import { onMounted, ref, unref, Ref, provide, reactive, nextTick } from 'vue';
+  import { onMounted, ref, unref, Ref, provide, reactive, nextTick, watch } from 'vue';
   import { Layout, LayoutContent, LayoutSider } from 'ant-design-vue';
   import {
     RouteData,
@@ -62,6 +68,8 @@
   import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is';
   import { useRoute } from 'vue-router';
   import { useTabs } from '/@/hooks/web/useTabs';
+  import LogicFlow from '@logicflow/core';
+import { getEntity } from '/@/api/tigerapi/system';
 
   const [registerDrawer, { openDrawer }] = useDrawer();
   const [registerModal, { openModal }] = useModal();
@@ -91,9 +99,58 @@
   provide<Ref<MES_ROUTE>>('mesRoute', currRoute);
   const selectnode = ref({} as node);
   const currRotId = ref(route.params?.id);
-
+  const colSlots = ref<any>([]);
+  const crudColSlots = ref<any>([]);
+  const entityName = ref<any>('MES_POSITION');
+  const props = defineProps({
+    rotId: { type: String, default: '' },
+  });
+  const IsOperation = ref(false);
+  const title = ref('琛屼负');
+  watch(
+    () => props.rotId,
+    (v) => {
+      if (v !== currRotId.value) {
+        currRotId.value = v;
+        if (!isNullOrUnDef(unref(currlf))) {
+          unref(currlf).render({});
+          routeData.value = {
+            nodes: [],
+            edges: [],
+          };
+          init(currlf);
+        }
+      }
+    },
+    { deep: true },
+  );
+  
+  const currlf = ref(null) as Ref<LogicFlow | null>;
   console.log(currRotId.value);
+
+  onMounted(() => {
+    getEntity({
+            sqlcmd: `ASSEMBLY_NAME ='MES_POSITION'`,
+            entityName: 'SYS_LOW_CODE',
+          }).then((data) => {
+            var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON);
+            for (const i in searchForms) {
+              if(!isNullOrUnDef(searchForms[i]['colSlot'])){
+                colSlots.value.push('form-'+searchForms[i]['colSlot']);
+              }
+            }
+
+            var _cruds = JSON.parse(data.Data.Items[0].FORM_JSON);
+            for (const i in _cruds) {
+              if(!isNullOrUnDef(_cruds[i]['colSlot'])){
+                crudColSlots.value.push(_cruds[i]['colSlot']);
+              }
+            }
+            entityName.value = 'MES_POSITION';
+          });
+  });
   async function init(lf) {
+    currlf.value = unref(lf);
     //閫氳繃宸ヨ壓璺嚎ID鑾峰彇鍥惧舰鏁版嵁锛屽苟娓叉煋
     var _data = await getRouteData(currRotId.value);
     console.log('缁勪欢宸叉寕杞�', _data);
@@ -102,7 +159,7 @@
     if (_data.Data != null) {
       //宸ヨ壓璺嚎涓讳俊鎭�
       currRoute.value = _data.Data.route;
-      if (!isNullOrEmpty(currRotId.value)) {
+      if (!isNullOrEmpty(currRotId.value) && isNullOrEmpty(props.rotId)) {
         setTitle('璁捐锛氬伐鑹鸿矾绾�-' + currRoute.value.ROT_CODE);
       }
       _data.Data.nodes.forEach((n) => {
@@ -409,6 +466,8 @@
     if (selectnode.value.properties.operType && selectnode.value.properties.operType == 'Action') {
       var _act = routeConfig.routeData.acts.filter((x) => x.ID == selectnode.value.id)[0];
       routeConfig.activeKey = 3;
+      IsOperation.value = false;
+      title.value = '琛屼负';
       routeConfig.currentAct = {
         ID: selectnode.value.id,
         CREATE_TIME: currRoute.value.CREATE_TIME,
@@ -473,6 +532,8 @@
 
       console.log(routeConfig.currentItem);
       routeConfig.activeKey = 2;
+      IsOperation.value = true;
+      title.value = '宀椾綅';
     }
   }
 

--
Gitblit v1.9.3