From 01bcf534119297468283976ed22a43c587f6cb38 Mon Sep 17 00:00:00 2001
From: Cloud Zhang <941187371@qq.com>
Date: 星期四, 16 五月 2024 16:10:23 +0800
Subject: [PATCH] 飞达操作

---
 src/views/tigerprojects/mes/smt/feeder/feeder/FeederDrawer.vue             |   74 +++
 src/views/tigerprojects/mes/smt/feeder/feeder/index.vue                    |  170 ++++++++
 src/views/tigerprojects/mes/smt/feeder/feeder_type/FeederTypeDrawer.vue    |   74 +++
 src/views/tigerprojects/mes/smt/feeder/feeder_type/smt_feeder_type.data.ts |   95 ++++
 src/api/tigerapi/mes/smt/feeder.ts                                         |  180 ++++++++
 src/views/tigerprojects/mes/smt/feeder/feeder/smt_feeder.data.ts           |  337 ++++++++++++++++
 src/views/tigerprojects/mes/smt/feeder/feeder_type/index.vue               |  158 +++++++
 src/api/tigerapi/mes/smt/feedertype.ts                                     |  168 ++++++++
 8 files changed, 1,256 insertions(+), 0 deletions(-)

diff --git a/src/api/tigerapi/mes/smt/feeder.ts b/src/api/tigerapi/mes/smt/feeder.ts
new file mode 100644
index 0000000..8e7fd3c
--- /dev/null
+++ b/src/api/tigerapi/mes/smt/feeder.ts
@@ -0,0 +1,180 @@
+import { buildUUID } from '../../../../utils/uuid';
+//import { ApiAction, ApiActionPage } from '../../model/baseModel';
+import { genAction, Api } from '../../system';
+import { useUserStore } from '/@/store/modules/user';
+import { defHttp } from '/@/utils/http/axios';
+import { isNullOrEmpty } from '/@/utils/is';
+import { formatToDateTime } from '/@/utils/dateUtil';
+
+/*
+ * 鑾峰彇椋炶揪淇℃伅
+ */
+
+export const getListByPage = async (params: any) => {
+  let order = ''
+  if (params.order != undefined) {
+    order = params.order == 'descend' ? (params.field + ' desc') : params.field
+  }
+  let sqlcmd = '1=1';
+  if (params?.FEEDER_CODE != undefined && params?.FEEDER_CODE != '') {
+    sqlcmd += " And FEEDER_CODE like '%" + params?.FEEDER_CODE + "%'";
+  }
+
+  let option = {
+    UserId: useUserStore().getUserInfo.userId as string,
+    ByOrg: true,
+    OrgCode: useUserStore().getUserInfo.orgCode as string
+  }
+  if (!isNullOrEmpty(params.page)) {
+    const usParams = genAction('SMT_FEEDER', {
+      QueryAble_T: '',
+      where: sqlcmd,
+      order: order,
+      page: {
+        pageAble_T: 'string',
+        draw: 1,
+        pageIndex: params.page,
+        pageSize: params.pageSize,
+      }
+    });
+    return getListByPageAsync(usParams);
+  } else {
+    const usParams = genAction('SMT_FEEDER', {
+      QueryAble_T: '',
+      where: sqlcmd
+    });
+    return getListByPageAsync(usParams);
+  }
+  // const rParams = genActionPage('BIZ_ERP_PROD_IN', sqlcmd, params.page, params.pageSize,option);
+  // return getFinishedwarehouseListByPageAsync(rParams);
+};
+async function getListByPageAsync(params: any) {
+  const data = await defHttp.post(
+    { url: Api.QueryUrl, params },
+    {
+      isTransformResponse: false,
+    },
+  );
+  let model = {}
+  if (isNullOrEmpty(data.Data.page)) {
+    model = {
+      items: data.Data.Items,
+    };
+  } else {
+    model = {
+      items: data.Data.page.data,
+      total: data.Data.page.totals,
+    };
+  }
+  return model;
+}
+//鏂板椋炶揪淇℃伅
+export const Save = async (params: Recordable, isUpdate: boolean, isbaofei: boolean) => {
+  const item: any = {
+    ID: params.ID,
+    CREATE_TIME: params?.CREATE_TIME,
+    CREATE_USER: params?.CREATE_USER,
+    UPDATE_TIME: params?.UPDATE_TIME,
+    UPDATE_USER: params?.UPDATE_USER,
+    GHOST_ROW: params?.GHOST_ROW,
+    AUTH_ORG: params?.AUTH_ORG,
+    AUTH_PROD: params?.AUTH_PROD,
+    AUTH_WH: params?.AUTH_WH,
+    FEEDER_CODE: params?.FEEDER_CODE,
+    FEEDER_NAME: params?.FEEDER_NAME,
+    FEEDER_TYPE: params?.FEEDER_TYPE,
+    MAX_COUNT: params?.MAX_COUNT,
+    ALERT_COUNT: params?.ALERT_COUNT,
+    USED_COUNT: params?.USED_COUNT,
+    IS_USE: params?.IS_USE,
+    IS_PRINT: params?.IS_PRINT,
+    WORK_ORDER: params?.WORK_ORDER,
+    LINE_CODE: params?.LINE_CODE,
+    SMT_CODE: params?.SMT_CODE,
+    SLOT_NO: params?.SLOT_NO,
+    PCB_SURFACE: params?.PCB_SURFACE,
+    ITEM_CODE: params?.ITEM_CODE,
+    REMARK: params?.REMARK,
+  };
+  let data;
+
+  if (isUpdate) {
+    if (isbaofei) {
+      item.STATUS = 5;
+    }
+    const time = new Date();
+    item.UPDATE_TIME = formatToDateTime(time);
+    item.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    // regionitem.ORG_CODE = useUserStore().getUserInfo.orgCode as string;
+    // regionitem.AUTH_ORG = useUserStore().getUserInfo.orgCode as string;
+    data = await defHttp.post(
+      { url: Api.UpdateEntity, params: genAction('SMT_FEEDER', item) },
+      {
+        errorMessageMode: 'none',
+        isTransformResponse: false,
+      },
+    );
+  } else {
+    // const usParams = genAction(
+    //   'SMT_SOLDER',
+    //   "REGION_CODE='" + params.REGION_CODE + "'AND AUTH_ORG='" + regionitem.ORG_CODE + "'",
+    // );
+    //var check = await isExist(usParams);
+    //console.log('check',check)
+    //if (!check.Data) {
+    item.ID = buildUUID(); //鐢熸垚GUID
+    item.UPDATE_TIME = formatToDateTime(new Date());
+    item.CREATE_USER = useUserStore().getUserInfo.userId as string;
+    item.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    // regionitem.ORG_CODE = useUserStore().getUserInfo.orgCode as string;
+    // regionitem.AUTH_ORG = useUserStore().getUserInfo.orgCode as string;
+    data = await defHttp.post(
+      { url: Api.AddEntity, params: genAction('SMT_FEEDER', item) },
+      {
+        errorMessageMode: 'none',
+        isTransformResponse: false,
+      },
+    );
+    //} else {
+    // return check.Message;
+    //return '閲嶅浜�';
+    //}
+  }
+  return data;
+};
+//鍒犻櫎
+export const Delete = async (Tool_Id: string) => {
+  const usParams = genAction('SMT_FEEDER', `ID='${Tool_Id}'`)
+  return await defHttp.post(
+    { url: Api.DeleteWhere, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false
+    }
+  )
+}
+//涓嬫媺鍒楄〃
+// STATUSs 鍗曟嵁鐘舵��
+export const optionsListApi = async (params: Recordable) => {
+  const usParams = genAction('V_SMT_TOOL+ALARM_TYPEs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      // apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
+//绫诲瀷
+export const optionsListApiType = async (params: Recordable) => {
+  const usParams = genAction('V_SMT_TOOL+TYPEs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      // apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
\ No newline at end of file
diff --git a/src/api/tigerapi/mes/smt/feedertype.ts b/src/api/tigerapi/mes/smt/feedertype.ts
new file mode 100644
index 0000000..331ff7c
--- /dev/null
+++ b/src/api/tigerapi/mes/smt/feedertype.ts
@@ -0,0 +1,168 @@
+import { buildUUID } from '../../../../utils/uuid';
+//import { ApiAction, ApiActionPage } from '../../model/baseModel';
+import { genAction, Api } from '../../system';
+import { useUserStore } from '/@/store/modules/user';
+import { defHttp } from '/@/utils/http/axios';
+import { isNullOrEmpty } from '/@/utils/is';
+import { formatToDateTime } from '/@/utils/dateUtil';
+
+/*
+ * 鑾峰彇椋炶揪绫诲瀷淇℃伅
+ */
+
+export const getListByPage = async (params: any) => {
+  let order = ''
+  if (params.order != undefined) {
+    order = params.order == 'descend' ? (params.field + ' desc') : params.field
+  }
+  let sqlcmd = '1=1';
+  if (params?.FEEDER_CODE != undefined && params?.FEEDER_CODE != '') {
+    sqlcmd += " And FEEDER_CODE like '%" + params?.FEEDER_CODE + "%'";
+  }
+
+  let option = {
+    UserId: useUserStore().getUserInfo.userId as string,
+    ByOrg: true,
+    OrgCode: useUserStore().getUserInfo.orgCode as string
+  }
+  if (!isNullOrEmpty(params.page)) {
+    const usParams = genAction('SMT_FEEDER_HIS', {
+      QueryAble_T: '',
+      where: sqlcmd,
+      order: order,
+      page: {
+        pageAble_T: 'string',
+        draw: 1,
+        pageIndex: params.page,
+        pageSize: params.pageSize,
+      }
+    });
+    return getListByPageAsync(usParams);
+  } else {
+    const usParams = genAction('SMT_FEEDER_HIS', {
+      QueryAble_T: '',
+      where: sqlcmd
+    });
+    return getListByPageAsync(usParams);
+  }
+  // const rParams = genActionPage('BIZ_ERP_PROD_IN', sqlcmd, params.page, params.pageSize,option);
+  // return getFinishedwarehouseListByPageAsync(rParams);
+};
+async function getListByPageAsync(params: any) {
+  const data = await defHttp.post(
+    { url: Api.QueryUrl, params },
+    {
+      isTransformResponse: false,
+    },
+  );
+  let model = {}
+  if (isNullOrEmpty(data.Data.page)) {
+    model = {
+      items: data.Data.Items,
+    };
+  } else {
+    model = {
+      items: data.Data.page.data,
+      total: data.Data.page.totals,
+    };
+  }
+  return model;
+}
+//鏂板椋炶揪绫诲瀷淇℃伅
+export const Save = async (params: Recordable, isUpdate: boolean, isbaofei: boolean) => {
+  const item: any = {
+    ID: params.ID,
+    CREATE_TIME: params?.CREATE_TIME,
+    CREATE_USER: params?.CREATE_USER,
+    UPDATE_TIME: params?.UPDATE_TIME,
+    UPDATE_USER: params?.UPDATE_USER,
+    GHOST_ROW: params?.GHOST_ROW,
+    AUTH_ORG: params?.AUTH_ORG,
+    AUTH_PROD: params?.AUTH_PROD,
+    AUTH_WH: params?.AUTH_WH,
+    FEEDER_CODE: params?.FEEDER_CODE,
+    FEEDER_NAME: params?.FEEDER_NAME,
+    REMARK: params?.REMARK,
+  };
+  let data;
+
+  if (isUpdate) {
+    if (isbaofei) {
+      item.STATUS = 5;
+    }
+    const time = new Date();
+    item.UPDATE_TIME = formatToDateTime(time);
+    item.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    // regionitem.ORG_CODE = useUserStore().getUserInfo.orgCode as string;
+    // regionitem.AUTH_ORG = useUserStore().getUserInfo.orgCode as string;
+    data = await defHttp.post(
+      { url: Api.UpdateEntity, params: genAction('SMT_FEEDER_HIS', item) },
+      {
+        errorMessageMode: 'none',
+        isTransformResponse: false,
+      },
+    );
+  } else {
+    // const usParams = genAction(
+    //   'SMT_SOLDER',
+    //   "REGION_CODE='" + params.REGION_CODE + "'AND AUTH_ORG='" + regionitem.ORG_CODE + "'",
+    // );
+    //var check = await isExist(usParams);
+    //console.log('check',check)
+    //if (!check.Data) {
+    item.ID = buildUUID(); //鐢熸垚GUID
+    item.UPDATE_TIME = formatToDateTime(new Date());
+    item.CREATE_USER = useUserStore().getUserInfo.userId as string;
+    item.UPDATE_USER = useUserStore().getUserInfo.userId as string;
+    // regionitem.ORG_CODE = useUserStore().getUserInfo.orgCode as string;
+    // regionitem.AUTH_ORG = useUserStore().getUserInfo.orgCode as string;
+    data = await defHttp.post(
+      { url: Api.AddEntity, params: genAction('SMT_FEEDER_HIS', item) },
+      {
+        errorMessageMode: 'none',
+        isTransformResponse: false,
+      },
+    );
+    //} else {
+    // return check.Message;
+    //return '閲嶅浜�';
+    //}
+  }
+  return data;
+};
+//鍒犻櫎
+export const Delete = async (Tool_Id: string) => {
+  const usParams = genAction('SMT_FEEDER_HIS', `ID='${Tool_Id}'`)
+  return await defHttp.post(
+    { url: Api.DeleteWhere, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false
+    }
+  )
+}
+//涓嬫媺鍒楄〃
+// STATUSs 鍗曟嵁鐘舵��
+export const optionsListApi = async (params: Recordable) => {
+  const usParams = genAction('V_SMT_TOOL+ALARM_TYPEs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      // apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
+//绫诲瀷
+export const optionsListApiType = async (params: Recordable) => {
+  const usParams = genAction('V_SMT_TOOL+TYPEs', '');
+  return await defHttp.post(
+    { url: Api.urlQueryEnum, params: usParams },
+    {
+      errorMessageMode: 'none',
+      isTransformResponse: false,
+      // apiUrl: globSetting.taskApiUrl
+    },
+  );
+};
\ No newline at end of file
diff --git a/src/views/tigerprojects/mes/smt/feeder/feeder/FeederDrawer.vue b/src/views/tigerprojects/mes/smt/feeder/feeder/FeederDrawer.vue
new file mode 100644
index 0000000..542be19
--- /dev/null
+++ b/src/views/tigerprojects/mes/smt/feeder/feeder/FeederDrawer.vue
@@ -0,0 +1,74 @@
+<template>
+  <BasicDrawer
+    v-bind="$attrs"
+    @register="registerDrawer"
+    showFooter
+    :title="getTitle"
+    width="800px"
+    @ok="handleSubmit"
+  >
+    <BasicForm @register="registerForm" />
+  </BasicDrawer>
+</template>
+<script lang="ts">
+  import { defineComponent, ref, computed, unref } from 'vue';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+  import { formSchema } from './smt_tool.data';
+  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
+
+  import { Save } from '/@/api/tigerapi/mes/smt/feeder';
+
+  export default defineComponent({
+    name: 'ToolDrawer',
+    components: { BasicDrawer, BasicForm },
+    emits: ['success', 'register'],
+    setup(_, { emit }) {
+      const isUpdate = ref(true);
+      const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
+        resetFields();
+        setDrawerProps({ confirmLoading: false });
+        isUpdate.value = !!data?.isUpdate;
+        if (unref(isUpdate)) {
+          setFieldsValue({
+            ...data.record,
+          });
+        }
+      });
+      const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
+        labelWidth: 120,
+        schemas: formSchema,
+        actionColOptions: {
+          span: 24,
+        },
+        showActionButtonGroup: false,
+      });
+
+      const getTitle = computed(() => (!unref(isUpdate) ? '鏂板椋炶揪' : '缂栬緫椋炶揪'));
+
+      async function handleSubmit() {
+        try {
+          const values = await validate();
+          setDrawerProps({ confirmLoading: true });
+          // TODO custom api
+          //淇濆瓨鐗╂枡
+          const apiAction = Save(values, unref(isUpdate),false);
+          apiAction.then((action) => {
+            if (action.IsSuccessed) {
+              closeDrawer();
+              emit('success');
+            }
+          });
+        } finally {
+          setDrawerProps({ confirmLoading: false });
+        }
+      }
+
+      return {
+        registerDrawer,
+        registerForm,
+        getTitle,
+        handleSubmit,
+      };
+    },
+  });
+</script>
diff --git a/src/views/tigerprojects/mes/smt/feeder/feeder/index.vue b/src/views/tigerprojects/mes/smt/feeder/feeder/index.vue
new file mode 100644
index 0000000..7da011c
--- /dev/null
+++ b/src/views/tigerprojects/mes/smt/feeder/feeder/index.vue
@@ -0,0 +1,170 @@
+<template>
+  <div>
+    <BasicTable @register="registerTable">
+      <template #toolbar>
+        <a-button color="primary" @click="addTool"> 娣诲姞 </a-button>
+        <a-button ghost color="primary" @click="aoaToExcel"> 瀵煎嚭 </a-button>
+      </template>
+      <template #action="{ record }">
+        <TableAction :actions="[
+      {
+        icon: 'clarity:note-edit-line',
+        tooltip: '淇敼',
+        onClick: handleEdit.bind(null, record),
+      },
+      {
+        icon: 'ant-design:delete-outlined',
+        tooltip: '鍒犻櫎',
+        popConfirm: {
+          title: '鏄惁纭鍒犻櫎?',
+          placement: 'left',
+          confirm: handleDelete.bind(null, record),
+        },
+      },
+    ]" />
+      </template>
+    </BasicTable>
+    <Loading :loading="compState.loading" :tip="compState.tip" />
+    <!-- <WmsItemDrawer @register="registerDrawer" @success="handleSuccess" /> -->
+    <FeederDrawer @register="registerDrawer" @success="handleSuccess" />
+  </div>
+</template>
+<script lang="ts" setup>
+import { reactive, unref } from 'vue';
+import { aoaToSheetXlsx } from '/@/components/Excel';
+import { BasicTable, useTable, TableAction } from '/@/components/Table';
+import FeederDrawer from './FeederDrawer.vue';
+import { useDrawer } from '/@/components/Drawer';
+import { columns, searchFormSchema } from './smt_feeder.data';
+import { getListByPage, Save, Delete } from '/@/api/tigerapi/mes/smt/feeder';
+import { useGo } from '/@/hooks/web/usePage';
+import { Loading } from '/@/components/Loading';
+import { useMessage } from '/@/hooks/web/useMessage';
+import { useI18n } from '/@/hooks/web/useI18n';
+
+const { t } = useI18n();
+const { createMessage } = useMessage();
+const [registerDrawer, { openDrawer }] = useDrawer();
+const go = useGo();
+const compState = reactive({
+  absolute: false,
+  loading: false,
+  tip: '鍔犺浇涓�...',
+});
+const [registerTable, { getForm, getPaginationRef, reload }] = useTable({
+  title: '椋炶揪淇℃伅',
+  api: getListByPage,
+  columns,
+  formConfig: {
+    labelWidth: 120,
+    schemas: searchFormSchema,
+  },
+  actionColumn: {
+    width: 120,
+    title: '鎿嶄綔',
+    dataIndex: 'action',
+    slots: { customRender: 'action' },
+    fixed: 'right', //undefined,
+  },
+  ellipsis: true,
+  useSearchForm: true,
+  showTableSetting: false,
+  bordered: true,
+  showIndexColumn: false,
+});
+let arr: any[] = [];
+//瀵煎嚭
+function aoaToExcel() {
+  const totals = getPaginationRef().total
+  if (totals < 30000) {
+    arr = [];
+    compState.loading = true;
+    const col = getForm().getFieldsValue()
+    getListByPage(col).then((res) => {
+      res.items.forEach(element => {
+        arr.push({
+          '椋炶揪缂栫爜': element.FEEDER_CODE,
+          '椋炶揪鍚嶇О': element.FEEDER_NAME,
+          '椋炶揪绫诲瀷': element.FEEDER_TYPE,
+          '鏈�澶т娇鐢ㄦ鏁�': element.MAX_COUNT,
+          '棰勮浣跨敤娆℃暟': element.ALERT_COUNT,
+          '褰撳墠浣跨敤娆℃暟': element.USE_COUNT,
+          '鏄惁浣跨敤涓�': element.IS_USE,
+          '鏄惁鎵撳嵃': element.IS_PRINT,
+          '宸ュ崟鍙�': element.WORK_ORDER,
+          '浜х嚎缂栫爜': element.LINE_CODE,
+          '璐寸墖鏈虹紪鐮�': element.SMT_CODE,
+          '绔欎綅鍙�': element.SLOT_NO,
+          '鍔犲伐闈�': element.PCB_SURFACE,
+          '鐗╂枡缂栫爜': element.ITEM_CODE,
+          '澶囨敞': element.REMARK,
+          '鍒涘缓浜�': element.CREATE_USER,
+          '鍒涘缓鏃堕棿': element.CREATE_TIME,
+        });
+      });
+      const arrHeader = columns.map((column) => column.title);
+      const arrData = arr.map((item) => {
+        return Object.keys(item).map((key) => item[key]);
+      });
+      // 淇濊瘉data椤哄簭涓巋eader涓�鑷�
+      if (arr.length < 30000) {
+        aoaToSheetXlsx({
+          data: arrData,
+          header: arrHeader,
+          filename: '椋炶揪淇℃伅.xlsx',
+        });
+      } else {
+        createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+      }
+
+      compState.loading = false;
+
+    })
+
+  } else {
+    createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+  }
+
+
+}
+//娣诲姞
+function addTool() {
+  openDrawer(true, {
+    isUpdate: false,
+  });
+}
+//缂栬緫
+function handleEdit(record: any) {
+  openDrawer(true, {
+    isUpdate: true,
+    record
+  });
+}
+function handleSuccess() {
+  reload();
+}
+//鎶ュ簾
+function handleBao(record: any) {
+  const apiAction = Save(record, unref(true), true);
+  apiAction.then((action) => {
+    if (action.IsSuccessed) {
+      createMessage.success(t('宸叉姤搴�'));
+      reload();
+    } else {
+      createMessage.success(t('鎶ュ簾鎿嶄綔澶辫触'));
+    }
+  });
+}
+//鍒犻櫎
+function handleDelete(record: any) {
+  const apiAction = Delete(record.ID);
+  apiAction.then((action) => {
+    if (action.IsSuccessed) {
+      createMessage.success(t('宸插垹闄�'));
+      reload();
+    } else {
+      createMessage.success(t('鍒犻櫎鎿嶄綔澶辫触'));
+    }
+  });
+}
+</script>
diff --git a/src/views/tigerprojects/mes/smt/feeder/feeder/smt_feeder.data.ts b/src/views/tigerprojects/mes/smt/feeder/feeder/smt_feeder.data.ts
new file mode 100644
index 0000000..bd58422
--- /dev/null
+++ b/src/views/tigerprojects/mes/smt/feeder/feeder/smt_feeder.data.ts
@@ -0,0 +1,337 @@
+import { BasicColumn } from '/@/components/Table';
+import { FormSchema } from '/@/components/Table';
+import { optionsListApi,optionsListApiType } from '/@/api/tigerapi/mes/smt/feeder';
+import { h,unref } from 'vue';
+import { Tag ,Tooltip} from 'ant-design-vue';
+import{ useLocale } from '/@/locales/useLocale';
+
+const { getLocale }=useLocale();
+
+export const columns: BasicColumn[] = [
+  {
+    title: '椋炶揪缂栫爜',
+    dataIndex: 'FEEDER_CODE',
+    width:200,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '椋炶揪鍚嶇О',
+    dataIndex: 'FEEDER_NAME',
+    width: 100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '椋炶揪绫诲瀷',
+    dataIndex: 'FEEDER_TYPE',
+    width: 100,
+    sorter: true,
+    resizable: true,
+    // customRender: ({ record }) => {
+    //   const status = record.TYPE;
+    //   var text = '';
+    //   var color = '';
+    //   switch (status) {
+    //     case 0:
+    //       text = '閽㈢綉';
+    //       color = 'green';
+    //       break;
+    //     case 1:
+    //       text = '鍒垁';
+    //       color = 'blue';
+    //       break;
+    //     default:
+    //       break;
+    //   }
+    //   return h(Tooltip, { title: 'xxxxxx' }, () => h(Tag, { color: color }, () => text));
+    // },
+  },
+  {
+    title: '鏈�澶т娇鐢ㄦ鏁�',
+    dataIndex: 'MAX_COUNT',
+    width: 100,
+    sorter: true,
+    resizable: true,
+    // customRender: ({ record }) => {
+    //   const status = record.ALARM_TYPE;
+    //   var text = '';
+    //   var color = '';
+    //   switch (status) {
+    //     case '0':
+    //       text = '姝e父';
+    //       color = 'green';
+    //       break;
+    //     case '1':
+    //       text = '淇濆吇棰勮';
+    //       color = 'blue';
+    //       break;
+    //     case '2':
+    //       text = '鎶ュ簾棰勮';
+    //       color = 'blue';
+    //       break;
+    //     default:
+    //       break;
+    //   }
+    //   return h(Tooltip, { title: 'xxxxxx' }, () => h(Tag, { color: color }, () => text));
+    // },
+  },
+  {
+    title: '棰勮浣跨敤娆℃暟',
+    dataIndex: 'ALERT_COUNT',
+    width:100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '褰撳墠浣跨敤娆℃暟',
+    dataIndex: 'USE_COUNT',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鏄惁浣跨敤涓�',
+    dataIndex: 'IS_USE',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鏄惁鎵撳嵃',
+    dataIndex: 'IS_PRINT',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '宸ュ崟鍙�',
+    dataIndex: 'WORK_ORDER',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '浜х嚎缂栫爜',
+    dataIndex: 'LINE_CODE',
+    width:100,
+    sorter: true,
+    resizable:true
+  } ,
+  {
+    title: '璐寸墖鏈虹紪鐮�',
+    dataIndex: 'SMT_CODE',
+    width:100,
+    sorter: true,
+    resizable:true
+  } ,
+  {
+    title: '绔欎綅鍙�',
+    dataIndex: 'SLOT_NO',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鍔犲伐闈�',
+    dataIndex: 'PCB_SURFACE',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鐗╂枡缂栫爜',
+    dataIndex: 'ITEM_CODE',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '澶囨敞',
+    dataIndex: 'REMARK',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鍒涘缓浜�',
+    dataIndex: 'CREATE_USER',
+    width:100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鍒涘缓鏃堕棿',
+    dataIndex: 'CREATE_TIME',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    field: 'FEEDER_CODE',
+    label: '椋炶揪缂栫爜',
+    component: 'Input',
+    colProps: { span: 8 },
+  }
+];
+
+//鏂板缁勪欢export const
+export const formSchema: FormSchema[] = [
+  {
+    field: 'ID',
+    label: 'ID',
+    component: 'Input',
+    show: false,
+  },
+  {
+    label: '椋炶揪缂栫爜',
+    field: 'FEEDER_CODE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '椋炶揪鍚嶇О',
+    field: 'FEEDER_NAME',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '椋炶揪绫诲瀷',
+    field: 'FEEDER_TYPE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '鏈�澶т娇鐢ㄦ鏁�',
+    field: 'MAX_COUNT',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '棰勮浣跨敤娆℃暟',
+    field: 'ALERT_COUNT',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '褰撳墠浣跨敤娆℃暟',
+    field: 'USE_COUNT',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+  ,
+  {
+    label: '鏄惁浣跨敤涓�',
+    field: 'IS_USE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Select',
+    componentProps: {
+      options: [
+        {
+          label: 'Y',
+          value: 'Y',
+          key: 'Y',
+        },
+        {
+          label: 'N',
+          value: 'N',
+          key: 'N',
+        },
+      ],
+    },
+  }
+  ,
+  {
+    label: '鏄惁鎵撳嵃',
+    field: 'IS_PRINT',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Select',
+    componentProps: {
+      options: [
+        {
+          label: 'Y',
+          value: 'Y',
+          key: 'Y',
+        },
+        {
+          label: 'N',
+          value: 'N',
+          key: 'N',
+        },
+      ],
+    },
+  }
+  ,
+  {
+    label: '宸ュ崟鍙�',
+    field: 'WORK_ORDER',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+  ,
+  {
+    label: '浜х嚎缂栫爜',
+    field: 'LINE_CODE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  } ,
+  {
+    label: '璐寸墖鏈虹紪鐮�',
+    field: 'SMT_CODE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  } ,
+  {
+    label: '绔欎綅鍙�',
+    field: 'SLOT_NO',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+  ,
+  {
+    label: '鍔犲伐闈�',
+    field: 'PCB_SURFACE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+  ,
+  {
+    label: '鐗╂枡缂栫爜',
+    field: 'ITEM_CODE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+  ,
+  {
+    label: '澶囨敞',
+    field: 'REMARK',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+];
diff --git a/src/views/tigerprojects/mes/smt/feeder/feeder_type/FeederTypeDrawer.vue b/src/views/tigerprojects/mes/smt/feeder/feeder_type/FeederTypeDrawer.vue
new file mode 100644
index 0000000..7a08f1e
--- /dev/null
+++ b/src/views/tigerprojects/mes/smt/feeder/feeder_type/FeederTypeDrawer.vue
@@ -0,0 +1,74 @@
+<template>
+  <BasicDrawer
+    v-bind="$attrs"
+    @register="registerDrawer"
+    showFooter
+    :title="getTitle"
+    width="800px"
+    @ok="handleSubmit"
+  >
+    <BasicForm @register="registerForm" />
+  </BasicDrawer>
+</template>
+<script lang="ts">
+  import { defineComponent, ref, computed, unref } from 'vue';
+  import { BasicForm, useForm } from '/@/components/Form/index';
+  import { formSchema } from './smt_tool.data';
+  import { BasicDrawer, useDrawerInner } from '/@/components/Drawer';
+
+  import { Save } from '/@/api/tigerapi/mes/smt/feedertype';
+
+  export default defineComponent({
+    name: 'ToolDrawer',
+    components: { BasicDrawer, BasicForm },
+    emits: ['success', 'register'],
+    setup(_, { emit }) {
+      const isUpdate = ref(true);
+      const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner((data) => {
+        resetFields();
+        setDrawerProps({ confirmLoading: false });
+        isUpdate.value = !!data?.isUpdate;
+        if (unref(isUpdate)) {
+          setFieldsValue({
+            ...data.record,
+          });
+        }
+      });
+      const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
+        labelWidth: 120,
+        schemas: formSchema,
+        actionColOptions: {
+          span: 24,
+        },
+        showActionButtonGroup: false,
+      });
+
+      const getTitle = computed(() => (!unref(isUpdate) ? '鏂板椋炶揪绫诲瀷' : '缂栬緫椋炶揪绫诲瀷'));
+
+      async function handleSubmit() {
+        try {
+          const values = await validate();
+          setDrawerProps({ confirmLoading: true });
+          // TODO custom api
+          //淇濆瓨鐗╂枡
+          const apiAction = Save(values, unref(isUpdate),false);
+          apiAction.then((action) => {
+            if (action.IsSuccessed) {
+              closeDrawer();
+              emit('success');
+            }
+          });
+        } finally {
+          setDrawerProps({ confirmLoading: false });
+        }
+      }
+
+      return {
+        registerDrawer,
+        registerForm,
+        getTitle,
+        handleSubmit,
+      };
+    },
+  });
+</script>
diff --git a/src/views/tigerprojects/mes/smt/feeder/feeder_type/index.vue b/src/views/tigerprojects/mes/smt/feeder/feeder_type/index.vue
new file mode 100644
index 0000000..fd1a6a0
--- /dev/null
+++ b/src/views/tigerprojects/mes/smt/feeder/feeder_type/index.vue
@@ -0,0 +1,158 @@
+<template>
+  <div>
+    <BasicTable @register="registerTable">
+      <template #toolbar>
+        <a-button color="primary" @click="addTool"> 娣诲姞 </a-button>
+        <a-button ghost color="primary" @click="aoaToExcel"> 瀵煎嚭 </a-button>
+      </template>
+      <template #action="{ record }">
+        <TableAction :actions="[
+      {
+        icon: 'clarity:note-edit-line',
+        tooltip: '淇敼',
+        onClick: handleEdit.bind(null, record),
+      },
+      {
+        icon: 'ant-design:delete-outlined',
+        tooltip: '鍒犻櫎',
+        popConfirm: {
+          title: '鏄惁纭鍒犻櫎?',
+          placement: 'left',
+          confirm: handleDelete.bind(null, record),
+        },
+      },
+    ]" />
+      </template>
+    </BasicTable>
+    <Loading :loading="compState.loading" :tip="compState.tip" />
+    <!-- <WmsItemDrawer @register="registerDrawer" @success="handleSuccess" /> -->
+    <FeederTypeDrawer @register="registerDrawer" @success="handleSuccess" />
+  </div>
+</template>
+<script lang="ts" setup>
+import { reactive, unref } from 'vue';
+import { aoaToSheetXlsx } from '/@/components/Excel';
+import { BasicTable, useTable, TableAction } from '/@/components/Table';
+import FeederTypeDrawer from './FeederTypeDrawer.vue';
+import { useDrawer } from '/@/components/Drawer';
+import { columns, searchFormSchema } from './smt_feeder_type.data';
+import { getListByPage, Save, Delete } from '/@/api/tigerapi/mes/smt/feedertype';
+import { useGo } from '/@/hooks/web/usePage';
+import { Loading } from '/@/components/Loading';
+import { useMessage } from '/@/hooks/web/useMessage';
+import { useI18n } from '/@/hooks/web/useI18n';
+
+const { t } = useI18n();
+const { createMessage } = useMessage();
+const [registerDrawer, { openDrawer }] = useDrawer();
+const go = useGo();
+const compState = reactive({
+  absolute: false,
+  loading: false,
+  tip: '鍔犺浇涓�...',
+});
+const [registerTable, { getForm, getPaginationRef, reload }] = useTable({
+  title: '宸ュ叿淇℃伅',
+  api: getListByPage,
+  columns,
+  formConfig: {
+    labelWidth: 120,
+    schemas: searchFormSchema,
+  },
+  actionColumn: {
+    width: 120,
+    title: '鎿嶄綔',
+    dataIndex: 'action',
+    slots: { customRender: 'action' },
+    fixed: 'right', //undefined,
+  },
+  ellipsis: true,
+  useSearchForm: true,
+  showTableSetting: false,
+  bordered: true,
+  showIndexColumn: false,
+});
+let arr: any[] = [];
+//瀵煎嚭
+function aoaToExcel() {
+  const totals = getPaginationRef().total
+  if (totals < 30000) {
+    arr = [];
+    compState.loading = true;
+    const col = getForm().getFieldsValue()
+    getListByPage(col).then((res) => {
+      res.items.forEach(element => {
+        arr.push({
+          '椋炶揪缂栫爜': element.FEEDER_CODE,
+          '椋炶揪鍚嶇О': element.FEEDER_NAME,
+          '澶囨敞': element.REMARK,
+          '鍒涘缓浜�': element.CREATE_USER,
+          '鍒涘缓鏃堕棿': element.CREATE_TIME,
+        });
+      });
+      const arrHeader = columns.map((column) => column.title);
+      const arrData = arr.map((item) => {
+        return Object.keys(item).map((key) => item[key]);
+      });
+      // 淇濊瘉data椤哄簭涓巋eader涓�鑷�
+      if (arr.length < 30000) {
+        aoaToSheetXlsx({
+          data: arrData,
+          header: arrHeader,
+          filename: '椋炶揪绫诲瀷淇℃伅.xlsx',
+        });
+      } else {
+        createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+      }
+
+      compState.loading = false;
+
+    })
+
+  } else {
+    createMessage.error(t('瀵煎嚭鏁版嵁涓嶈兘瓒呰繃涓変竾鏉★紝濡傞渶瑕佹洿澶氱殑璇疯仈绯荤鐞嗗憳'));
+  }
+
+
+}
+//娣诲姞
+function addTool() {
+  openDrawer(true, {
+    isUpdate: false,
+  });
+}
+//缂栬緫
+function handleEdit(record: any) {
+  openDrawer(true, {
+    isUpdate: true,
+    record
+  });
+}
+function handleSuccess() {
+  reload();
+}
+//鎶ュ簾
+function handleBao(record: any) {
+  const apiAction = SaveTool(record, unref(true), true);
+  apiAction.then((action) => {
+    if (action.IsSuccessed) {
+      createMessage.success(t('宸叉姤搴�'));
+      reload();
+    } else {
+      createMessage.success(t('鎶ュ簾鎿嶄綔澶辫触'));
+    }
+  });
+}
+//鍒犻櫎
+function handleDelete(record: any) {
+  const apiAction = DeleteTool(record.ID);
+  apiAction.then((action) => {
+    if (action.IsSuccessed) {
+      createMessage.success(t('宸插垹闄�'));
+      reload();
+    } else {
+      createMessage.success(t('鍒犻櫎鎿嶄綔澶辫触'));
+    }
+  });
+}
+</script>
diff --git a/src/views/tigerprojects/mes/smt/feeder/feeder_type/smt_feeder_type.data.ts b/src/views/tigerprojects/mes/smt/feeder/feeder_type/smt_feeder_type.data.ts
new file mode 100644
index 0000000..d3b7581
--- /dev/null
+++ b/src/views/tigerprojects/mes/smt/feeder/feeder_type/smt_feeder_type.data.ts
@@ -0,0 +1,95 @@
+import { BasicColumn } from '/@/components/Table';
+import { FormSchema } from '/@/components/Table';
+import { optionsListApi,optionsListApiType } from '/@/api/tigerapi/mes/smt/feeder';
+import { h,unref } from 'vue';
+import { Tag ,Tooltip} from 'ant-design-vue';
+import{ useLocale } from '/@/locales/useLocale';
+
+const { getLocale }=useLocale();
+
+export const columns: BasicColumn[] = [
+  {
+    title: '椋炶揪缂栫爜',
+    dataIndex: 'FEEDER_CODE',
+    width:200,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '椋炶揪鍚嶇О',
+    dataIndex: 'FEEDER_NAME',
+    width: 100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '澶囨敞',
+    dataIndex: 'REMARK',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+  ,
+  {
+    title: '鍒涘缓浜�',
+    dataIndex: 'CREATE_USER',
+    width:100,
+    sorter: true,
+    resizable:true
+  },
+  {
+    title: '鍒涘缓鏃堕棿',
+    dataIndex: 'CREATE_TIME',
+    width:100,
+    sorter: true,
+    resizable:true
+  }
+];
+
+export const searchFormSchema: FormSchema[] = [
+  {
+    field: 'FEEDER_CODE',
+    label: '椋炶揪缂栫爜',
+    component: 'Input',
+    colProps: { span: 8 },
+  }
+];
+
+//鏂板缁勪欢export const
+export const formSchema: FormSchema[] = [
+  {
+    field: 'ID',
+    label: 'ID',
+    component: 'Input',
+    show: false,
+  },
+  {
+    label: '椋炶揪缂栫爜',
+    field: 'FEEDER_CODE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '椋炶揪鍚嶇О',
+    field: 'FEEDER_NAME',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '椋炶揪绫诲瀷',
+    field: 'FEEDER_TYPE',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  },
+  {
+    label: '澶囨敞',
+    field: 'REMARK',
+    required: true,
+    colProps: { span: 8 },
+    component: 'Input',
+  }
+];

--
Gitblit v1.9.3