Ben Lin
2024-06-12 47df576f3a56a657b97c6179417a2d0f80441471
src/views/tigerprojects/mes/eng/route/index.vue
@@ -16,11 +16,18 @@
        collapsible
        :reverseArrow="true"
        collapsedWidth="0"
        width="300"
        width="400"
        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"
          :posttitle="posttitle"
          :colSlots="colSlots"
          :crudColSlots="crudColSlots"
          :entityName="entityName">
          <!-- <template v-for="item of formConfig.schemas" #[`${item.component}Props`]="data">
            <slot
              :name="`${item.component}Props`"
@@ -35,13 +42,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 +69,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 +100,59 @@
  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('');
  const posttitle = 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 +161,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) => {
@@ -408,7 +467,10 @@
    //是行为
    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;
      routeConfig.activeKey = 2;
      IsOperation.value = false;
      title.value = '行为';
      posttitle.value = '';
      routeConfig.currentAct = {
        ID: selectnode.value.id,
        CREATE_TIME: currRoute.value.CREATE_TIME,
@@ -473,6 +535,9 @@
      console.log(routeConfig.currentItem);
      routeConfig.activeKey = 2;
      IsOperation.value = true;
      title.value = '工序';
      posttitle.value = '岗位';
    }
  }
@@ -485,6 +550,8 @@
   */
  function clickBlank() {
    routeConfig.activeKey = 1;
    title.value = '';
    posttitle.value = '';
  }
  /*