¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | }, |
| | | ); |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | }, |
| | | ); |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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顺åºä¸headerä¸è´ |
| | | 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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 = 'æ£å¸¸'; |
| | | // 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', |
| | | } |
| | | ]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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顺åºä¸headerä¸è´ |
| | | 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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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', |
| | | } |
| | | ]; |