1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
| <!--
| * @Description: 工艺路线添加页面
| * @Author: Ben Lin
| * @version:
| * @Date: 2024-06-20 12:13:27
| * @LastEditors: Ben Lin
| * @LastEditTime: 2024-06-25 00:07:08
| -->
| <template>
| <Card title="添加工艺">
| <CardGrid v-for="item in navItems" :key="item.title" @click="changeItem(item.action)">
| <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>
| </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 { 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 {
| title: string;
| icon: string;
| color: string;
| 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: 'add_green|svg',
| color: '#1fdaca',
| url: '/addRoute',
| action: 'addRoute',
| },
| {
| title: '添加客户工艺路线',
| icon: 'add_customer|svg',
| color: '#bf0c2c',
| url: '/addCustomer',
| action: 'addCustomer',
| },
| // {
| // title: '销售出库单',
| // icon: 'Out|svg',
| // color: '#e18525',
| // url: '/saleoutorder',
| // },
| // {
| // title: '完工入库单',
| // icon: 'In|svg',
| // color: '#3fb27f',
| // url: '/finishedwarehouse',
| // },
| // {
| // title: '生产退料单',
| // icon: 'materialret|svg',
| // color: '#4daf1bc9',
| // url: '/materialret',
| // },
| // {
| // title: '盘点单',
| // icon: 'inventory|svg',
| // color: '#00d8ff',
| // url: '/inventory',
| // },
| // {
| // title: '调拨单',
| // icon: 'transfer|svg',
| // color: '#00d8ff',
| // url: '/transfer',
| // },
| // {
| // title: '实时库存',
| // icon: 'WmsItem|svg',
| // color: '#00d8ff',
| // url: '/WmsItem',
| // },
| ];
| function changeItem(action) {
| openModal(true, {
| title: '工艺路线列表',
| schemas: [
| {
| field: 'ROT_CODE',
| component: 'Input',
| label: '工艺路线编码',
| colProps: {
| span: 12,
| },
| },
| ],
| ItemColumns: [
| {
| title: t('工艺路线编码'),
| dataIndex: 'ROT_CODE',
| resizable: true,
| sorter: true,
| width: 200,
| },
| {
| title: t('工艺路线名称'),
| dataIndex: 'ROT_NAME',
| resizable: true,
| sorter: true,
| width: 180,
| },
| ],
| tableName: 'MES_ROUTE',
| rowKey: 'ROT_CODE',
| returnFieldName: 'ROUTE_CODE', //返回值要赋值的字段名称
| searchInfo: { TABLE_NAME: 'MES_ROUTE' },
| which: action,
| });
| }
|
| /**
| * @description: 选择工艺路线成功返回方法
| * @param {*} d
| * @param {*} u
| * @return {*}
| */
| async function handleSuccess(d, u) {
| if (isNullOrEmpty(Prod_Code.value)) {
| 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: Prod_Code.value });
| } else {
| await RouteToCust({ rotId: codes[i], prodCode: Prod_Code.value, custCode: '' });
| }
| }
|
| await refreshPage();
| }
| </script>
|
|