| | |
| | | * @version: |
| | | * @Date: 2024-06-20 12:13:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-21 00:11:00 |
| | | * @LastEditTime: 2024-06-21 15:37:05 |
| | | --> |
| | | <template> |
| | | <Card title="操作"> |
| | |
| | | import GeneralModal from '/@/views/components/GeneralModal.vue'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { Ref, inject, ref, watch } from 'vue'; |
| | | import { isNullOrEmpty } from '/@/utils/is'; |
| | | import { useTabs } from '/@/hooks/web/useTabs'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | |
| | | const { refreshPage } = useTabs(); |
| | | const {createErrorModal} = useMessage(); |
| | | // const props = defineProps({ |
| | | // prodCode: { type: String }, |
| | | // }); |
| | | const { t } = useI18n(); |
| | | const [register, { openModal }] = useModal(); |
| | | interface NavItem { |
| | |
| | | url: string; |
| | | action: string; |
| | | } |
| | | const Prod_Code = inject('prodCode') as Ref<string>; |
| | | |
| | | // watch( |
| | | // () => Prod_Code, |
| | | // (v) => { |
| | | // if (v !== Prod_Code.value) { |
| | | // Prod_Code.value = isNullOrEmpty(v) ? Prod_Code.value : v; |
| | | // } |
| | | // }, |
| | | // { deep: true }, |
| | | // ); |
| | | |
| | | // 快捷导航 |
| | | const navItems: NavItem[] = [ |
| | | { |
| | | title: '添加工艺路线', |
| | | icon: 'ion:home-outline', |
| | | title: '添加产品工艺路线', |
| | | icon: 'add_green|svg', |
| | | color: '#1fdaca', |
| | | url: '/workbench', |
| | | url: '/addRoute', |
| | | action: 'addRoute', |
| | | }, |
| | | { |
| | | title: '添加客户', |
| | | icon: 'materialreq|svg', |
| | | title: '添加客户工艺路线', |
| | | icon: 'add_customer|svg', |
| | | color: '#bf0c2c', |
| | | url: '/materialreq', |
| | | url: '/addCustomer', |
| | | action: 'addCustomer', |
| | | }, |
| | | // { |
| | |
| | | * @param {*} u |
| | | * @return {*} |
| | | */ |
| | | function handleSuccess(d, u) { |
| | | async function handleSuccess(d, u) { |
| | | if(isNullOrEmpty(Prod_Code.value)){ |
| | | createErrorModal({ title: t('sys.api.errorTip'), content: '产品为空,不能添加工艺路线,请点击左侧选择产品' }); |
| | | return; |
| | | } |
| | | let codes = d.values.id.split(','); |
| | | let eintity: any[] = []; |
| | | var i; |
| | | for (i = 0; i < codes.length; i++) { |
| | | RouteToProd({ rotId: codes[i], prodCode: 'K5811AA015007' }).then(() => {}); |
| | | await RouteToProd({ rotId: codes[i], prodCode: Prod_Code.value }); |
| | | } |
| | | |
| | | await refreshPage(); |
| | | } |
| | | </script> |