| | |
| | | <!-- |
| | | * @Description: 工艺路线添加页面 |
| | | * @Description: 导航页面 |
| | | * @Author: Ben Lin |
| | | * @version: |
| | | * @Date: 2024-06-20 12:13:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-26 21:46:41 |
| | | * @LastEditTime: 2024-06-27 00:39:37 |
| | | --> |
| | | <template> |
| | | <Card :title="GetTitle()['navTitle']"> |
| | | <CardGrid v-for="item in GetNavItems()" :key="item.title" @click="naveChangeItem(item.action, openModal)"> |
| | | <CardGrid |
| | | v-for="item in GetNavItems()" |
| | | :key="item.title" |
| | | @click="navChangeItem(item.action, useModalData[item.action][1].openModal)" |
| | | > |
| | | <span class="flex flex-col items-center"> |
| | | <Icon :icon="item.icon" :color="item.color" size="20" /> |
| | | <span class="text-md mt-2 truncate">{{ item.title }}</span> |
| | | </span> |
| | | <GeneralModal |
| | | v-if="!item.isStep" |
| | | @register="useModalData[item.action][0]" |
| | | @success="(d, u) => handleSuccess(d, u, item.action, objParams, refreshPage)" |
| | | ></GeneralModal> |
| | | <StepModal |
| | | v-if="item.isStep" |
| | | @register="useModalData[item.action][0]" |
| | | @success="(d, u) => handleSuccess(d, u, item.action, objParams, refreshPage)" |
| | | /> |
| | | </CardGrid> |
| | | </Card> |
| | | <GeneralModal @register="register" @success="handleSuccess"></GeneralModal> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { Card, CardGrid } from 'ant-design-vue'; |
| | | import Icon from '@/components/Icon/Icon.vue'; |
| | | import { RouteToCust, RouteToProd } from '/@/api/tigerapi/mes/router'; |
| | | import GeneralModal from '/@/views/components/GeneralModal.vue'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import StepModal from '/@/views/components/StepModal.vue'; |
| | | import { Ref, inject, ref, watch } from 'vue'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { isNullOrUnDef } from '/@/utils/is'; |
| | | import { useTabs } from '/@/hooks/web/useTabs'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; |
| | | |
| | | const objParams = inject('objParams') as Ref<any>; |
| | |
| | | { |
| | | GetTitle() {}, |
| | | GetNavItems() {}, |
| | | naveChangeItem(action: any, ...args) {}, |
| | | navChangeItem(action: any, ...args) {}, |
| | | GetUseModals() {}, |
| | | GetSelectSuccess(d, u, ...args) {}, |
| | | } as EntityCustFunctionType, |
| | | ]); |
| | | /* 动态import实体名.ts的自定义方法 */ |
| | | try { |
| | | custImport.value = await import(`../entityts/${objParams.value['Name']}.ts`); |
| | | } catch (e) {} |
| | | const [{ GetTitle, GetNavItems, naveChangeItem }] = |
| | | isNullOrUnDef(custImport.value['default']) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | const [{ GetTitle, GetNavItems, navChangeItem, GetUseModals, GetSelectSuccess }] = isNullOrUnDef( |
| | | custImport.value['default'], |
| | | ) |
| | | ? EntityCustFunction.value |
| | | : custImport.value['default'](); |
| | | |
| | | const useModalData = ref(GetUseModals()); |
| | | const { refreshPage } = useTabs(); |
| | | const { createErrorModal } = useMessage(); |
| | | const { t } = useI18n(); |
| | | const [register, { openModal }] = useModal(); |
| | | |
| | | // watch( |
| | | // () => Prod_Code, |
| | |
| | | // ); |
| | | |
| | | /** |
| | | * @description: 选择工艺路线成功返回方法 |
| | | * @description: 弹出选择框成功返回方法 |
| | | * @param {*} d |
| | | * @param {*} u |
| | | * @return {*} |
| | | */ |
| | | async function handleSuccess(d, u) { |
| | | if (isNullOrEmpty(objParams.value['CODE'])) { |
| | | createErrorModal({ |
| | | title: t('sys.api.errorTip'), |
| | | content: '产品为空,不能添加工艺路线,请点击左侧选择产品', |
| | | }); |
| | | return; |
| | | } |
| | | let codes = d.values.id.split(','); |
| | | var i; |
| | | for (i = 0; i < codes.length; i++) { |
| | | if (d.which == 'addRoute') { |
| | | await RouteToProd({ rotId: codes[i], prodCode: objParams.value['CODE'] }); |
| | | } else { |
| | | await RouteToCust({ rotId: codes[i], prodCode: objParams.value['CODE'], custCode: '' }); |
| | | } |
| | | } |
| | | |
| | | await refreshPage(); |
| | | async function handleSuccess(d, u, item, objParams, refreshPage) { |
| | | GetSelectSuccess(d, u, item, objParams, refreshPage); |
| | | } |
| | | </script> |