Ben Lin
2024-06-12 da85b09c600ddcf4e5c8cad66012fa29a8252b39
岗位资源更新
已修改7个文件
220 ■■■■■ 文件已修改
src/api/tigerapi/mes/mesApi.ts 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/mes/router.ts 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/model/router.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/system.ts 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/mes/eng/route/components/PostProps.vue 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/mes/eng/route/components/PropsPanel.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tigerprojects/mes/eng/route/index.vue 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/tigerapi/mes/mesApi.ts
@@ -1,3 +1,11 @@
/*
 * @Description: file content
 * @Author: your name
 * @version:
 * @Date: 2024-04-27 15:54:50
 * @LastEditors: your name
 * @LastEditTime: 2024-06-12 20:28:14
 */
export enum mesApi {
  GetRoute = '/MES/GetRoute',
  GetRouteData = '/MES/GetRouteData',
@@ -8,4 +16,5 @@
  DeleteMesWo = '/MES/DeleteMesWo',
  SaveMesWs = '/MES/SaveMesWs',
  DeleteMesWs = '/MES/DeleteMesWs',
  SaveRouteNodePost = '/MES/SaveRouteNodePost',
}
src/api/tigerapi/mes/router.ts
@@ -1,7 +1,7 @@
import { ApiAction, ApiActionPage } from '../../model/baseModel';
import { Api, genAction, genActionPage } from '../system';
import { defHttp } from '/@/utils/http/axios';
import { MES_ROUTE, RouteData } from '../model/router';
import { MES_ROUTE, MES_ROUTE_NODE_POST, RouteData } from '../model/router';
import { mesApi } from './mesApi';
import { useUserStore } from '/@/store/modules/user';
import { RoutePageListGetResultModel, RoutelistPageParams } from '../model/mesModel';
@@ -27,7 +27,11 @@
  return data;
}
//保存
/**
 * @description: 保存工艺路线
 * @param {RouteData} params
 * @return {*}
 */
export const SaveRouteData = async (params: RouteData) => {
  const data = await defHttp.post(
    { url: mesApi.SaveRouteData, params: genAction('', params) },
@@ -38,6 +42,7 @@
  );
  return data;
};
export const SaveRoute = async (params: MES_ROUTE) => {
  params.CREATE_USER = useUserStore().getUserInfo.userId as string;
  params.UPDATE_USER = useUserStore().getUserInfo.userId as string;
@@ -104,3 +109,14 @@
      isTransformResponse: false,
    },
  );
  export const SaveRouteNodePost = async (params: MES_ROUTE_NODE_POST[]) => {
    const data = await defHttp.post(
      { url: mesApi.SaveRouteNodePost, params: genAction('MES_ROUTE_NODE_POST', params) },
      {
        errorMessageMode: 'none',
        isTransformResponse: false,
      },
    );
    return data;
  };
src/api/tigerapi/model/router.ts
@@ -158,3 +158,8 @@
  edges: MES_ROUTE_EDGE[];
  acts: MES_ROUTE_NODE_ACT[];
}
export interface MES_ROUTE_NODE_POST {
    NODE_ID: string;
    POST_CODE: string;
}
src/api/tigerapi/system.ts
@@ -31,7 +31,7 @@
  iSYS_ROLE_PROD,
} from './model/systemModel';
import { defHttp } from '/@/utils/http/axios';
import { isNullOrEmpty, isTimeType } from '/@/utils/is';
import { isDate, isNullOrEmpty, isTimeType } from '/@/utils/is';
import { MES_ROUTE_EDGE, MES_ROUTE_NODE } from './model/router';
export enum Api {
@@ -712,7 +712,7 @@
      Keys[k] != '0' &&
      !Keys[k].toString().endsWith('PSelect_0')
    ) {
      if (!isNullOrEmpty(params[Keys[k]].length) && isTimeType(params[Keys[k]][0])) {
      if (!isNullOrEmpty(params[Keys[k]].length) && isDate(params[Keys[k]][0])) {
        sqlcmd += ` And ${Keys[k]} > '${params[Keys[k]][0]}'`;
        sqlcmd += ` And ${Keys[k]} < '${params[Keys[k]][1]}'`;
      } else {
@@ -784,7 +784,28 @@
  );
}
//获取服务器Json文件返回Json数据
/**
 * @description: 根据条件删除
 * @param {string} sqlcmd
 * @param {string} entityName
 * @return {*}
 */
export const DeleteWhere = async (sqlcmd: string, entityName: string) => {
  const usParams = genAction(entityName, sqlcmd);
  return await defHttp.post(
    { url: Api.DeleteWhere, params: usParams },
    {
      errorMessageMode: 'none',
      isTransformResponse: false,
    },
  );
};
/**
 * @description: 获取服务器Json文件返回Json数据
 * @param {string} url
 * @return {*}
 */
export async function fetchJson(url: string) {
  try {
    const response = await fetch(url);
src/views/tigerprojects/mes/eng/route/components/PostProps.vue
@@ -4,24 +4,22 @@
 * @version: 
 * @Date: 2024-06-11 21:07:04
 * @LastEditors: your name
 * @LastEditTime: 2024-06-12 17:29:41
 * @LastEditTime: 2024-06-12 23:04:02
-->
<!--
 * @Description: 右侧属性面板控件 表单属性面板
-->
<template>
  <div class="mt-3">
    <Button type="primary" @click="handleCreate" preIcon="add_02|svg" :size="size"> 新增 </Button>
    <a-table :columns="columns" :data-source="data" bordered>
      <template #name="{ text }">
        <a>{{ text }}</a>
    <BasicTable @register="registerTable">
      <template #toolbar>
        <a-button type="primary" @click="handleCreate" preIcon="add_02|svg" :size="size"> 新增 </a-button>
      </template>
      <template #action="{ record }">
        <TableAction :actions="[
          {
            icon: 'ant-design:delete-outlined',
            color: 'error',
            tooltip: '删除',
            popConfirm: {
              title: '是否确认删除?',
              placement: 'left',
@@ -30,23 +28,25 @@
          },
        ]" />
      </template>
    </a-table>
    </BasicTable>
  </div>
  <NormalModal @register="register" @success="handleSuccess"></NormalModal>
</template>
<script lang="ts" setup>
import { Table, notification } from 'ant-design-vue';
import { Button } from '/@/components/Button';
import { TableAction } from '/@/components/Table';
import { notification } from 'ant-design-vue';
import { BasicTable, TableAction, useTable } from '/@/components/Table';
import { SizeType } from 'ant-design-vue/es/config-provider';
import { ref } from 'vue';
import { onMounted, ref, unref, watch } from 'vue';
import { useModal } from '/@/components/Modal';
import NormalModal from '/@/views/components/NormalModal.vue';
import { useI18n } from '/@/hooks/web/useI18n';
import { DeleteEntity, DeleteWhere, SaveEntity, getEntity, getListByPage } from '/@/api/tigerapi/system';
import { useRouteDesignState } from '../hooks/useRouteDesignState';
import { SaveRouteNodePost } from '/@/api/tigerapi/mes/router';
const { t } = useI18n();
const ATable = Table;
const { routeConfig, mesRoute } = useRouteDesignState();
const size = ref<SizeType>('small');
const columns = [
  {
@@ -60,31 +60,37 @@
    dataIndex: 'POST_CODE',
    key: 'POST_CODE',
  },
  {
    title: '操作',
    key: 'operation',
    fixed: 'right',
    width: 65,
    slots: { customRender: 'action' },
  },
];
const data: DataItem[] = [];
for (let i = 0; i < 5; i++) {
  data.push({
    key: i,
    POST_NAME: `Edrward ${i}`,
    POST_CODE: 32,
  });
}
interface DataItem {
  key: number;
  POST_NAME: string;
  POST_CODE: number;
}
const [register, { openModal }] = useModal();
const [registerTable, { reload }] = useTable({
  title: '列表',
  api: getListByPage,
  searchInfo: { TABLE_NAME: 'V_MES_ROUTE_NOE_POST', NODE_ID: routeConfig.currentItem.ID },
  columns,
  useSearchForm: false,
  showTableSetting: false,
  bordered: true,
  showIndexColumn: false,
  actionColumn: {
    width: 80,
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
  },
});
// watch(
//   () => routeConfig.currentItem.ID,
//   (newVal, oldVal) => {
//     if (newVal != oldVal) {
//       reload();
//     }
//   },
//   { deep: true, immediate: true },
// );
onMounted(() => {
});
/**
 * @description: 新增方法
@@ -130,11 +136,26 @@
   * @return {*}
   */
function handleDelete(record: Recordable) {
  DeleteWhere(`POST_CODE = '${record.POST_CODE}'`, 'MES_ROUTE_NODE_POST').then((res) => {
    reload();
  });
}
/**
 * @description: 选择岗位资源成功返回方法
 * @param {*} d
 * @param {*} u
 * @return {*}
 */
function handleSuccess(d, u) {
  let xx = d.values.val.split(',');
  let a = '';
  let codes = d.values.val.split(',');
  let eintity: any[] = [];
  var i;
  for (i = 0; i < codes.length; i++) {
    eintity.push({ NODE_ID: routeConfig.currentItem.ID, POST_CODE: codes[i], REMARK: '' });
  }
  SaveRouteNodePost(eintity).then((res) => {
    reload();
  });
 }
</script>
src/views/tigerprojects/mes/eng/route/components/PropsPanel.vue
@@ -4,7 +4,7 @@
 * @version: 
 * @Date: 2024-04-28 15:15:22
 * @LastEditors: your name
 * @LastEditTime: 2024-06-12 15:44:00
 * @LastEditTime: 2024-06-12 22:53:25
-->
<!--
 * @Description: 右侧属性配置面板
@@ -52,6 +52,7 @@
    entityName: String,
  });
  const IsOper = ref(false);
  const IsReload = ref(false);
  const title = ref('');
  const posttitle = ref('');
  const colSlots = ref<any>([]);
src/views/tigerprojects/mes/eng/route/index.vue
@@ -2,32 +2,14 @@
  <PageWrapper title="工艺流程图" content="根据生产工艺设计工艺流程" contentFullHeight fixedHeight>
    <Layout class="h-full">
      <LayoutContent :style="{ overflow: 'initial' }">
        <FlowChart
          :data="routeData"
          @save-data="handleSave"
          @add-lf="handleAddlf"
          @select-node="handleSelect"
          @click-blank="clickBlank"
          @init="init"
        />
        <FlowChart :data="routeData" @save-data="handleSave" @add-lf="handleAddlf" @select-node="handleSelect"
          @click-blank="clickBlank" @init="init" />
      </LayoutContent>
      <LayoutSider
        :class="`right`"
        collapsible
        :reverseArrow="true"
        collapsedWidth="0"
        width="400"
      <LayoutSider :class="`right`" collapsible :reverseArrow="true" collapsedWidth="0" 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"
          :IsOperation="IsOperation"
          :title="title"
          :posttitle="posttitle"
          :colSlots="colSlots"
          :crudColSlots="crudColSlots"
          :entityName="entityName">
        :zeroWidthTriggerStyle="{ 'margin-top': '-70px', 'background-color': 'gray' }">
        <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`"
@@ -130,27 +112,12 @@
  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';
          });
  });
onMounted(() => { });
/**
 * @description: 工艺路线初始化
 * @param {*} lf
 * @return {*}
 */
  async function init(lf) {
    currlf.value = unref(lf);
    //通过工艺路线ID获取图形数据,并渲染
@@ -505,6 +472,7 @@
      };
    } else {
      //是工序
    IsOperation.value = false;
      routeConfig.currentItem = {
        ID: selectnode.value.id,
        CREATE_TIME: currRoute.value.CREATE_TIME,
@@ -532,12 +500,13 @@
      routeConfig.canSkip = _node.CAN_SKIP == 'Y';
      routeConfig.isInput = _node.IS_INPUT == 'Y';
      routeConfig.isOutput = _node.IS_OUTPUT == 'Y';
    setTimeout(() => {
      console.log(routeConfig.currentItem);
      routeConfig.activeKey = 2;
      IsOperation.value = true;
      title.value = '工序';
      posttitle.value = '岗位';
    }, 50);
    }
  }