business_tms_program 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +12 -0
- package/.eslintrc-auto-import.json +113 -0
- package/.eslintrc.js +121 -0
- package/.prettierrc.js +9 -0
- package/.stylelintignore +4 -0
- package/README.md +43 -0
- package/components.d.ts +23 -0
- package/index.html +20 -0
- package/package.json +70 -0
- package/shims-uni.d.ts +10 -0
- package/src/App.vue +81 -0
- package/src/api/afterSale.ts +184 -0
- package/src/api/context.ts +26 -0
- package/src/api/device.ts +134 -0
- package/src/api/index.ts +80 -0
- package/src/api/installtion.ts +155 -0
- package/src/api/model/index.ts +15 -0
- package/src/api/model/userModel.ts +62 -0
- package/src/api/order.ts +49 -0
- package/src/api/system.ts +19 -0
- package/src/api/user.ts +171 -0
- package/src/auto-imports.d.ts +108 -0
- package/src/components/ConfirmDialog.vue +101 -0
- package/src/components/DaySelect.vue +212 -0
- package/src/components/Drawer.vue +104 -0
- package/src/components/DrawerSelect.vue +105 -0
- package/src/components/DropMenu.vue +144 -0
- package/src/components/Empty.vue +49 -0
- package/src/components/Loading.vue +41 -0
- package/src/components/RippleBtn.vue +159 -0
- package/src/components/SinglePick.vue +120 -0
- package/src/components/Skeleton.vue +43 -0
- package/src/components/Timeline.vue +85 -0
- package/src/components/Upload.vue +217 -0
- package/src/config/app.ts +32 -0
- package/src/config/env.ts +29 -0
- package/src/dict/afterSale.ts +161 -0
- package/src/dict/device.ts +29 -0
- package/src/dict/installtion.ts +141 -0
- package/src/dict/systems.ts +4 -0
- package/src/env.d.ts +8 -0
- package/src/hooks/useForm.ts +222 -0
- package/src/hooks/useUpload.ts +80 -0
- package/src/main.ts +8 -0
- package/src/manifest.json +39 -0
- package/src/pages/acceptance/DeviceInfo.vue +132 -0
- package/src/pages/acceptance/list.vue +276 -0
- package/src/pages/afterSale/DeviceInfo.vue +128 -0
- package/src/pages/afterSale/Step.vue +0 -0
- package/src/pages/afterSale/faultReport.vue +552 -0
- package/src/pages/afterSale/orderDetail.vue +327 -0
- package/src/pages/afterSale/orderFinish.vue +517 -0
- package/src/pages/afterSale/orderList.vue +305 -0
- package/src/pages/afterSale/returnVisit.vue +288 -0
- package/src/pages/afterSale/searchDeviceList.vue +148 -0
- package/src/pages/device/Search.vue +201 -0
- package/src/pages/device/acceptance.vue +270 -0
- package/src/pages/device/detail.vue +165 -0
- package/src/pages/device/index.vue +322 -0
- package/src/pages/device/info.vue +140 -0
- package/src/pages/device/list.vue +219 -0
- package/src/pages/device/materialTowerCode.vue +589 -0
- package/src/pages/device/searchList.vue +224 -0
- package/src/pages/installtion/Record.vue +145 -0
- package/src/pages/installtion/StatusTimeline.vue +85 -0
- package/src/pages/installtion/addAcceptance.vue +409 -0
- package/src/pages/installtion/addRecord.vue +338 -0
- package/src/pages/installtion/orderDetail.vue +220 -0
- package/src/pages/installtion/orderList.vue +100 -0
- package/src/pages/user/component/PersonAgree.vue +226 -0
- package/src/pages/user/component/PrivayAgree.vue +221 -0
- package/src/pages/user/component/SliderCode.vue +173 -0
- package/src/pages/user/forgetPassword.vue +249 -0
- package/src/pages/user/index.vue +139 -0
- package/src/pages/user/login.vue +342 -0
- package/src/pages/user/register.vue +348 -0
- package/src/pages/user/repassword.vue +329 -0
- package/src/pages/user/utils/mcaptcha.js +75 -0
- package/src/pages/user/utils/verifyCode.ts +41 -0
- package/src/pages/workspace/index.vue +225 -0
- package/src/pages.json +203 -0
- package/src/shime-uni.d.ts +6 -0
- package/src/static/icon/system/breeder_icon.png +0 -0
- package/src/static/icon/system/check.png +0 -0
- package/src/static/icon/system/factory_icon.png +0 -0
- package/src/static/icon/system/plus.png +0 -0
- package/src/static/icon/system/right.png +0 -0
- package/src/static/icon/system/unCheck.png +0 -0
- package/src/static/icon/tab/search.png +0 -0
- package/src/static/icon/tab/user.png +0 -0
- package/src/static/icon/tab/user_active.png +0 -0
- package/src/static/icon/tab/workspace.png +0 -0
- package/src/static/icon/tab/workspace_active.png +0 -0
- package/src/static/img/active_dot.png +0 -0
- package/src/static/img/afterSale_icon.png +0 -0
- package/src/static/img/check.png +0 -0
- package/src/static/img/close.png +0 -0
- package/src/static/img/confirm.png +0 -0
- package/src/static/img/empty.png +0 -0
- package/src/static/img/equipment_icon.png +0 -0
- package/src/static/img/fault_icon.png +0 -0
- package/src/static/img/install_icon.png +0 -0
- package/src/static/img/login_bg2.png +0 -0
- package/src/static/img/movable_right.png +0 -0
- package/src/static/img/navigation.png +0 -0
- package/src/static/img/psw_off.png +0 -0
- package/src/static/img/psw_on.png +0 -0
- package/src/static/img/scan.png +0 -0
- package/src/static/img/scan_icon.png +0 -0
- package/src/static/img/search.png +0 -0
- package/src/static/img/turn_right.png +0 -0
- package/src/static/img/unActive_dot.png +0 -0
- package/src/static/img/verifyBg.png +0 -0
- package/src/stores/index.ts +11 -0
- package/src/stores/modules/customer.ts +146 -0
- package/src/stores/modules/installtion.ts +30 -0
- package/src/stores/modules/system.ts +56 -0
- package/src/stores/modules/user.ts +133 -0
- package/src/stores/types.ts +16 -0
- package/src/stores/utils.ts +6 -0
- package/src/styles/index.less +63 -0
- package/src/types/chengyiApi.d.ts +36 -0
- package/src/types/index.d.ts +95 -0
- package/src/utils/address.ts +17 -0
- package/src/utils/cipher.ts +61 -0
- package/src/utils/form.ts +155 -0
- package/src/utils/httpEnum.ts +31 -0
- package/src/utils/image.ts +21 -0
- package/src/utils/index.ts +111 -0
- package/src/utils/request.ts +139 -0
- package/src/utils/requestCancelHandle.ts +67 -0
- package/stylelint.config.js +87 -0
- package/tsconfig.docs.json +11 -0
- package/tsconfig.json +30 -0
- package/typedoc.json +6 -0
- package/vite.config.ts +55 -0
|
@@ -0,0 +1,589 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, reactive } from 'vue'
|
|
3
|
+
import { useForm } from '@/hooks/useForm';
|
|
4
|
+
import { queryDeviceDetail, querySiloSupplier, updateDeviceInfo, type TmsDeviceInfoUpdateDTO, type SiloSupplierItem } from '@/api/device'
|
|
5
|
+
import { type ValidationRules } from '@/utils/form';
|
|
6
|
+
import SinglePick from '@/components/SinglePick.vue';
|
|
7
|
+
import RippleBtn from '@/components/RippleBtn.vue';
|
|
8
|
+
import { MaterialTowerCodeRuleEnum, materialTowerCodeRuleMap } from '@/dict/device';
|
|
9
|
+
import { formatDateTime } from '@/utils/index';
|
|
10
|
+
|
|
11
|
+
defineOptions({
|
|
12
|
+
name: "materialTowerCode"
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// 料塔编码规则选项
|
|
16
|
+
const codeRuleOptions = [
|
|
17
|
+
{ label: materialTowerCodeRuleMap[MaterialTowerCodeRuleEnum.SUPPLIER], value: MaterialTowerCodeRuleEnum.SUPPLIER },
|
|
18
|
+
{ label: materialTowerCodeRuleMap[MaterialTowerCodeRuleEnum.DELIVERY], value: MaterialTowerCodeRuleEnum.DELIVERY }
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// 表单数据类型(内部使用枚举值)
|
|
22
|
+
type FormDataType = {
|
|
23
|
+
siloCodeRules: string; // 料塔编码规则(枚举值:SUPPLIER 或 DELIVERY)
|
|
24
|
+
supplierAbbrEn: string; // 料塔供应商缩写
|
|
25
|
+
produceTime: string; // 生产日期
|
|
26
|
+
shippingTime: string; // 发货月份
|
|
27
|
+
produceFlowCode: string; // 生产流水编码
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 表单初始数据
|
|
31
|
+
const initialData: FormDataType = {
|
|
32
|
+
siloCodeRules: '',
|
|
33
|
+
supplierAbbrEn: '',
|
|
34
|
+
produceTime: '',
|
|
35
|
+
shippingTime: '',
|
|
36
|
+
produceFlowCode: '',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// 校验规则
|
|
40
|
+
const validationRules: ValidationRules<Partial<FormDataType>> = {
|
|
41
|
+
siloCodeRules: {
|
|
42
|
+
required: true,
|
|
43
|
+
message: '请选择料塔编码规则',
|
|
44
|
+
},
|
|
45
|
+
supplierAbbrEn: {
|
|
46
|
+
required: true,
|
|
47
|
+
message: '请选择料塔供应商',
|
|
48
|
+
},
|
|
49
|
+
produceTime: {
|
|
50
|
+
required: false,
|
|
51
|
+
message: '请选择生产日期',
|
|
52
|
+
},
|
|
53
|
+
produceFlowCode: {
|
|
54
|
+
required: false,
|
|
55
|
+
pattern: /^(0[1-9]|[1-9][0-9])$/,
|
|
56
|
+
message: '请输入01-99的整数',
|
|
57
|
+
},
|
|
58
|
+
shippingTime: {
|
|
59
|
+
required: false,
|
|
60
|
+
message: '请选择发货月份',
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const { formData, errState, setFormItem, validateForm, validateOneField, initialForm } = useForm<FormDataType>(
|
|
65
|
+
initialData,
|
|
66
|
+
validationRules as ValidationRules<FormDataType>,
|
|
67
|
+
false,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
const state = reactive({
|
|
71
|
+
deviceCode: '',
|
|
72
|
+
loading: false,
|
|
73
|
+
supplierList: [] as SiloSupplierItem[],
|
|
74
|
+
deviceInfo: {} as any,
|
|
75
|
+
lastUpdateInfo: '', // 上一次更新信息
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
// 供应商选项(用于SinglePick)
|
|
79
|
+
const supplierOptions = computed(() => {
|
|
80
|
+
return state.supplierList.map(item => ({
|
|
81
|
+
label: `${item.supplierName}(${item.supplierAbbrEn})`,
|
|
82
|
+
value: item.supplierAbbrEn
|
|
83
|
+
}))
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// 当前选择的规则类型
|
|
87
|
+
const currentRuleType = computed(() => formData.siloCodeRules)
|
|
88
|
+
|
|
89
|
+
// 获取今日日期(用于限制日期选择)
|
|
90
|
+
const getTodayDate = () => {
|
|
91
|
+
const today = new Date();
|
|
92
|
+
const year = today.getFullYear();
|
|
93
|
+
const month = String(today.getMonth() + 1).padStart(2, '0');
|
|
94
|
+
const day = String(today.getDate()).padStart(2, '0');
|
|
95
|
+
return `${year}-${month}-${day}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 获取当月(用于限制月份选择)
|
|
99
|
+
const getCurrentMonth = () => {
|
|
100
|
+
const today = new Date();
|
|
101
|
+
const year = today.getFullYear();
|
|
102
|
+
const month = String(today.getMonth() + 1).padStart(2, '0');
|
|
103
|
+
return `${year}-${month}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const changeValue = (key: keyof FormDataType, detail: any) => {
|
|
107
|
+
setFormItem(key, detail.value);
|
|
108
|
+
// 切换规则时,清空相关字段
|
|
109
|
+
if (key === 'siloCodeRules') {
|
|
110
|
+
if (detail.value === MaterialTowerCodeRuleEnum.SUPPLIER) {
|
|
111
|
+
setFormItem('shippingTime', '');
|
|
112
|
+
// 清空发货月份的错误状态
|
|
113
|
+
errState.shippingTime = '';
|
|
114
|
+
} else {
|
|
115
|
+
setFormItem('produceTime', '');
|
|
116
|
+
setFormItem('produceFlowCode', '');
|
|
117
|
+
// 清空生产日期和生产流水编号的错误状态
|
|
118
|
+
errState.produceTime = '';
|
|
119
|
+
errState.produceFlowCode = '';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// 当字段值改变时,清空该字段的错误状态(验证会在提交时进行)
|
|
123
|
+
if (key === 'produceTime' || key === 'produceFlowCode' || key === 'shippingTime') {
|
|
124
|
+
errState[key] = '';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// 将 YYYY-MM-DD 格式转换为 YYYYMMDD
|
|
129
|
+
const formatDateWithoutDash = (dateStr: string): string => {
|
|
130
|
+
if (!dateStr) return '';
|
|
131
|
+
return dateStr.replace(/-/g, '');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// 将 YYYYMMDD 格式转换为 YYYY-MM-DD(用于 picker 组件)
|
|
135
|
+
const formatDateWithDash = (dateStr: string): string => {
|
|
136
|
+
if (!dateStr) return '';
|
|
137
|
+
if (dateStr.length === 8) {
|
|
138
|
+
return `${dateStr.substring(0, 4)}-${dateStr.substring(4, 6)}-${dateStr.substring(6, 8)}`;
|
|
139
|
+
}
|
|
140
|
+
return dateStr;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// 将 YYYY-MM 格式转换为 YYYYMM
|
|
144
|
+
const formatMonthWithoutDash = (monthStr: string): string => {
|
|
145
|
+
if (!monthStr) return '';
|
|
146
|
+
return monthStr.replace(/-/g, '');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 将 YYYYMM 格式转换为 YYYY-MM(用于 picker 组件)
|
|
150
|
+
const formatMonthWithDash = (monthStr: string): string => {
|
|
151
|
+
if (!monthStr) return '';
|
|
152
|
+
if (monthStr.length === 6) {
|
|
153
|
+
return `${monthStr.substring(0, 4)}-${monthStr.substring(4, 6)}`;
|
|
154
|
+
}
|
|
155
|
+
return monthStr;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 生产日期选择
|
|
159
|
+
const handleProduceTimeChange = (e: any) => {
|
|
160
|
+
const value = e.detail.value;
|
|
161
|
+
// 将 YYYY-MM-DD 格式转换为 YYYYMMDD(去掉短横线)
|
|
162
|
+
if (value) {
|
|
163
|
+
const dateStr = value.substring(0, 10);
|
|
164
|
+
const formattedDate = formatDateWithoutDash(dateStr);
|
|
165
|
+
changeValue('produceTime', { value: formattedDate });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// 发货月份选择
|
|
170
|
+
const handleShippingTimeChange = (e: any) => {
|
|
171
|
+
const value = e.detail.value;
|
|
172
|
+
// 将 YYYY-MM 格式转换为 YYYYMM(去掉短横线)
|
|
173
|
+
if (value && value.length === 7) {
|
|
174
|
+
const formattedMonth = formatMonthWithoutDash(value);
|
|
175
|
+
changeValue('shippingTime', { value: formattedMonth });
|
|
176
|
+
} else if (value) {
|
|
177
|
+
// 如果后端返回的是完整日期,只取年月部分并转换
|
|
178
|
+
const dateStr = value.substring(0, 7);
|
|
179
|
+
const formattedMonth = formatMonthWithoutDash(dateStr);
|
|
180
|
+
changeValue('shippingTime', { value: formattedMonth });
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 获取供应商列表
|
|
185
|
+
const fetchSupplierList = async () => {
|
|
186
|
+
try {
|
|
187
|
+
const res = await querySiloSupplier();
|
|
188
|
+
if (res) {
|
|
189
|
+
state.supplierList = res;
|
|
190
|
+
}
|
|
191
|
+
} catch (error) {
|
|
192
|
+
console.error('获取供应商列表失败', error);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// 解析料塔编码并回显数据
|
|
197
|
+
const parseSiloCode = (siloCode: string) => {
|
|
198
|
+
if (!siloCode) return;
|
|
199
|
+
|
|
200
|
+
// 按短横线分割
|
|
201
|
+
const parts = siloCode.split('-');
|
|
202
|
+
|
|
203
|
+
if (parts.length === 3) {
|
|
204
|
+
// 供应商编码:三个部分(供应商缩写-生产日期-生产流水编码)
|
|
205
|
+
// 例如:BDL-20260109-05
|
|
206
|
+
const [supplierAbbrEn, produceTimeStr, produceFlowCode] = parts;
|
|
207
|
+
|
|
208
|
+
setFormItem('siloCodeRules', MaterialTowerCodeRuleEnum.SUPPLIER);
|
|
209
|
+
setFormItem('supplierAbbrEn', supplierAbbrEn);
|
|
210
|
+
|
|
211
|
+
// 生产日期:将 YYYYMMDD 格式转换为 YYYY-MM-DD(用于 picker 显示)
|
|
212
|
+
if (produceTimeStr && produceTimeStr.length === 8) {
|
|
213
|
+
setFormItem('produceTime', produceTimeStr); // 存储时保持 YYYYMMDD 格式
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 生产流水编码
|
|
217
|
+
if (produceFlowCode) {
|
|
218
|
+
setFormItem('produceFlowCode', produceFlowCode);
|
|
219
|
+
}
|
|
220
|
+
} else if (parts.length === 2) {
|
|
221
|
+
// 发货编码:两个部分(供应商缩写-发货月份)
|
|
222
|
+
// 例如:BDL-20260109
|
|
223
|
+
const [supplierAbbrEn, shippingTimeStr] = parts;
|
|
224
|
+
|
|
225
|
+
setFormItem('siloCodeRules', MaterialTowerCodeRuleEnum.DELIVERY);
|
|
226
|
+
setFormItem('supplierAbbrEn', supplierAbbrEn);
|
|
227
|
+
|
|
228
|
+
// 发货月份:将 YYYYMM 格式转换为 YYYY-MM(用于 picker 显示)
|
|
229
|
+
if (shippingTimeStr) {
|
|
230
|
+
// 如果长度是8位,可能是 YYYYMMDD,只取前6位作为月份
|
|
231
|
+
const monthStr = shippingTimeStr.length === 8 ? shippingTimeStr.substring(0, 6) : shippingTimeStr;
|
|
232
|
+
if (monthStr.length === 6) {
|
|
233
|
+
setFormItem('shippingTime', monthStr); // 存储时保持 YYYYMM 格式
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// 获取设备详情
|
|
240
|
+
const fetchDeviceDetail = async (code: string) => {
|
|
241
|
+
state.loading = true;
|
|
242
|
+
try {
|
|
243
|
+
const res = await queryDeviceDetail({ deviceCode: code });
|
|
244
|
+
if (res) {
|
|
245
|
+
state.deviceInfo = res;
|
|
246
|
+
// 如果有料塔编码,解析并回显数据
|
|
247
|
+
if (res.siloCode) {
|
|
248
|
+
parseSiloCode(res.siloCode);
|
|
249
|
+
}
|
|
250
|
+
// 设置上一次更新信息
|
|
251
|
+
if (res.lastUpdateTime && res.updateBy) {
|
|
252
|
+
state.lastUpdateInfo = `上一次更新: ${formatDateTime(res.lastUpdateTime)} ${res.updateBy}`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
} catch (error) {
|
|
256
|
+
console.error('获取设备详情失败', error);
|
|
257
|
+
} finally {
|
|
258
|
+
state.loading = false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// 提交表单
|
|
263
|
+
const submitForm = async () => {
|
|
264
|
+
const isValid = await validateForm();
|
|
265
|
+
if (!isValid) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// 根据规则类型校验必填字段
|
|
270
|
+
if (formData.siloCodeRules === MaterialTowerCodeRuleEnum.SUPPLIER) {
|
|
271
|
+
// 供应商编码规则下,生产日期和生产流水编号必填
|
|
272
|
+
if (!formData.produceTime) {
|
|
273
|
+
errState.produceTime = '请选择生产日期';
|
|
274
|
+
uni.showToast({
|
|
275
|
+
title: '请选择生产日期',
|
|
276
|
+
icon: 'none',
|
|
277
|
+
duration: 2000,
|
|
278
|
+
});
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (!formData.produceFlowCode) {
|
|
282
|
+
errState.produceFlowCode = '请输入生产流水编号';
|
|
283
|
+
uni.showToast({
|
|
284
|
+
title: '请输入生产流水编号',
|
|
285
|
+
icon: 'none',
|
|
286
|
+
duration: 2000,
|
|
287
|
+
});
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
// 验证生产流水编号格式
|
|
291
|
+
if (!/^(0[1-9]|[1-9][0-9])$/.test(formData.produceFlowCode)) {
|
|
292
|
+
errState.produceFlowCode = '请输入01-99的整数';
|
|
293
|
+
uni.showToast({
|
|
294
|
+
title: '请输入01-99的整数',
|
|
295
|
+
icon: 'none',
|
|
296
|
+
duration: 2000,
|
|
297
|
+
});
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
} else if (formData.siloCodeRules === MaterialTowerCodeRuleEnum.DELIVERY) {
|
|
301
|
+
// 发货编码规则下,发货月份必填
|
|
302
|
+
if (!formData.shippingTime) {
|
|
303
|
+
errState.shippingTime = '请选择发货月份';
|
|
304
|
+
uni.showToast({
|
|
305
|
+
title: '请选择发货月份',
|
|
306
|
+
icon: 'none',
|
|
307
|
+
duration: 2000,
|
|
308
|
+
});
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// 将枚举值转换为数字:SUPPLIER -> 1, DELIVERY -> 2
|
|
314
|
+
const siloCodeRulesNumber = formData.siloCodeRules === MaterialTowerCodeRuleEnum.SUPPLIER ? 1 : 2;
|
|
315
|
+
|
|
316
|
+
const params: TmsDeviceInfoUpdateDTO = {
|
|
317
|
+
deviceCode: state.deviceCode,
|
|
318
|
+
siloCodeRules: siloCodeRulesNumber,
|
|
319
|
+
supplierAbbrEn: formData.supplierAbbrEn,
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
if (formData.siloCodeRules === MaterialTowerCodeRuleEnum.SUPPLIER) {
|
|
323
|
+
// 供应商编码规则下,生产日期和生产流水编号必填
|
|
324
|
+
params.produceTime = formData.produceTime;
|
|
325
|
+
params.produceFlowCode = formData.produceFlowCode;
|
|
326
|
+
} else {
|
|
327
|
+
// 发货编码规则下,发货月份必填
|
|
328
|
+
params.shippingTime = formData.shippingTime;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
try {
|
|
332
|
+
const res = await updateDeviceInfo(params);
|
|
333
|
+
if (res) {
|
|
334
|
+
uni.showToast({
|
|
335
|
+
title: '保存成功',
|
|
336
|
+
icon: 'success',
|
|
337
|
+
duration: 2000,
|
|
338
|
+
success: () => {
|
|
339
|
+
setTimeout(() => {
|
|
340
|
+
uni.navigateBack();
|
|
341
|
+
}, 2000);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
} catch (error) {
|
|
346
|
+
console.error('保存失败', error);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
onLoad((event: any) => {
|
|
351
|
+
const { deviceCode } = event;
|
|
352
|
+
if (deviceCode) {
|
|
353
|
+
state.deviceCode = deviceCode;
|
|
354
|
+
fetchDeviceDetail(deviceCode);
|
|
355
|
+
fetchSupplierList();
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
</script>
|
|
359
|
+
|
|
360
|
+
<template>
|
|
361
|
+
<view class="content">
|
|
362
|
+
<view class="form-content">
|
|
363
|
+
<view class="section-title">料塔编码规则</view>
|
|
364
|
+
<view class="uni-form-item flex-space">
|
|
365
|
+
<view class="l-label">
|
|
366
|
+
<view class="flag">*</view>料塔编码规则
|
|
367
|
+
</view>
|
|
368
|
+
<SinglePick
|
|
369
|
+
class="select-box"
|
|
370
|
+
:value="formData.siloCodeRules"
|
|
371
|
+
:range="codeRuleOptions"
|
|
372
|
+
value-key="value"
|
|
373
|
+
label-key="label"
|
|
374
|
+
showRightIcon
|
|
375
|
+
placeholder="请选择"
|
|
376
|
+
@change="(v: any) => changeValue('siloCodeRules', { value: v })"
|
|
377
|
+
/>
|
|
378
|
+
</view>
|
|
379
|
+
<view class="err-text" v-if="errState.siloCodeRules">{{ errState.siloCodeRules }}</view>
|
|
380
|
+
</view>
|
|
381
|
+
|
|
382
|
+
<view class="form-content">
|
|
383
|
+
<view class="section-title">料塔编码</view>
|
|
384
|
+
<view class="uni-form-item flex-space">
|
|
385
|
+
<view class="l-label">
|
|
386
|
+
<view class="flag">*</view>料塔供应商
|
|
387
|
+
</view>
|
|
388
|
+
<SinglePick
|
|
389
|
+
class="select-box"
|
|
390
|
+
:value="formData.supplierAbbrEn"
|
|
391
|
+
:range="supplierOptions"
|
|
392
|
+
value-key="value"
|
|
393
|
+
label-key="label"
|
|
394
|
+
showRightIcon
|
|
395
|
+
placeholder="请选择"
|
|
396
|
+
@change="(v: any) => changeValue('supplierAbbrEn', { value: v })"
|
|
397
|
+
/>
|
|
398
|
+
</view>
|
|
399
|
+
<view class="err-text" v-if="errState.supplierAbbrEn">{{ errState.supplierAbbrEn }}</view>
|
|
400
|
+
|
|
401
|
+
<!-- 供应商编码规则时显示 -->
|
|
402
|
+
<template v-if="currentRuleType === MaterialTowerCodeRuleEnum.SUPPLIER">
|
|
403
|
+
<view class="uni-form-item flex-space">
|
|
404
|
+
<view class="l-label">
|
|
405
|
+
<view class="flag">*</view>生产日期
|
|
406
|
+
</view>
|
|
407
|
+
<view class="dateSelect-box">
|
|
408
|
+
<image class="right-icon" src="/static/img/turn_right.png" />
|
|
409
|
+
<picker
|
|
410
|
+
mode="date"
|
|
411
|
+
fields="day"
|
|
412
|
+
:value="formatDateWithDash(formData.produceTime)"
|
|
413
|
+
:end="getTodayDate()"
|
|
414
|
+
@change="handleProduceTimeChange">
|
|
415
|
+
<view class="common-picker">{{ formatDateWithDash(formData.produceTime) || '请选择' }}</view>
|
|
416
|
+
</picker>
|
|
417
|
+
</view>
|
|
418
|
+
</view>
|
|
419
|
+
<view class="err-text" v-if="errState.produceTime">{{ errState.produceTime }}</view>
|
|
420
|
+
|
|
421
|
+
<view class="uni-form-item flex-space">
|
|
422
|
+
<view class="l-label">
|
|
423
|
+
<view class="flag">*</view>生产流水编码
|
|
424
|
+
</view>
|
|
425
|
+
<input
|
|
426
|
+
class="input-field"
|
|
427
|
+
type="number"
|
|
428
|
+
placeholder="请输入"
|
|
429
|
+
:value="formData.produceFlowCode"
|
|
430
|
+
@input="(e: any) => changeValue('produceFlowCode', e.detail)"
|
|
431
|
+
maxlength="2"
|
|
432
|
+
/>
|
|
433
|
+
</view>
|
|
434
|
+
<view class="err-text" v-if="errState.produceFlowCode">{{ errState.produceFlowCode }}</view>
|
|
435
|
+
</template>
|
|
436
|
+
|
|
437
|
+
<!-- 发货编码规则时显示 -->
|
|
438
|
+
<template v-if="currentRuleType === MaterialTowerCodeRuleEnum.DELIVERY">
|
|
439
|
+
<view class="uni-form-item flex-space">
|
|
440
|
+
<view class="l-label">
|
|
441
|
+
<view class="flag">*</view>发货月份
|
|
442
|
+
</view>
|
|
443
|
+
<view class="dateSelect-box">
|
|
444
|
+
<image class="right-icon" src="/static/img/turn_right.png" />
|
|
445
|
+
<picker
|
|
446
|
+
mode="date"
|
|
447
|
+
fields="month"
|
|
448
|
+
:value="formatMonthWithDash(formData.shippingTime)"
|
|
449
|
+
:end="getCurrentMonth()"
|
|
450
|
+
@change="handleShippingTimeChange">
|
|
451
|
+
<view class="common-picker">{{ formatMonthWithDash(formData.shippingTime) || '请选择' }}</view>
|
|
452
|
+
</picker>
|
|
453
|
+
</view>
|
|
454
|
+
</view>
|
|
455
|
+
<view class="err-text" v-if="errState.shippingTime">{{ errState.shippingTime }}</view>
|
|
456
|
+
</template>
|
|
457
|
+
</view>
|
|
458
|
+
|
|
459
|
+
<view class="update-info" v-if="state.lastUpdateInfo">
|
|
460
|
+
{{ state.lastUpdateInfo }}
|
|
461
|
+
</view>
|
|
462
|
+
|
|
463
|
+
<RippleBtn @click="submitForm" :customStyle="'margin-top: 48rpx;padding-bottom: 10rpx'">
|
|
464
|
+
<view class="submit-btn">保存</view>
|
|
465
|
+
</RippleBtn>
|
|
466
|
+
</view>
|
|
467
|
+
</template>
|
|
468
|
+
|
|
469
|
+
<style scoped lang="less">
|
|
470
|
+
.content {
|
|
471
|
+
background-color: #F5F5F5;
|
|
472
|
+
min-height: 100vh;
|
|
473
|
+
padding: 32rpx;
|
|
474
|
+
|
|
475
|
+
.form-content {
|
|
476
|
+
margin-bottom: 32rpx;
|
|
477
|
+
background-color: #fff;
|
|
478
|
+
border-radius: 16rpx;
|
|
479
|
+
padding: 0 32rpx;
|
|
480
|
+
position: relative;
|
|
481
|
+
|
|
482
|
+
.section-title {
|
|
483
|
+
padding: 32rpx 0 24rpx 0;
|
|
484
|
+
font-size: 32rpx;
|
|
485
|
+
font-weight: 500;
|
|
486
|
+
color: #000000;
|
|
487
|
+
line-height: 48rpx;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.uni-form-item {
|
|
491
|
+
display: flex;
|
|
492
|
+
justify-content: space-between;
|
|
493
|
+
align-items: center;
|
|
494
|
+
color: rgba(0, 0, 0, 0.6);
|
|
495
|
+
|
|
496
|
+
&:not(:last-child) {
|
|
497
|
+
border-bottom: 1rpx solid rgba(0, 0, 0, 0.05);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.flex-space {
|
|
502
|
+
display: flex;
|
|
503
|
+
justify-content: space-between;
|
|
504
|
+
align-items: center;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.l-label {
|
|
508
|
+
display: flex;
|
|
509
|
+
align-items: center;
|
|
510
|
+
padding: 32rpx 0;
|
|
511
|
+
font-size: 32rpx;
|
|
512
|
+
color: rgba(0, 0, 0, 0.6);
|
|
513
|
+
line-height: 48rpx;
|
|
514
|
+
|
|
515
|
+
.flag {
|
|
516
|
+
font-size: 32rpx;
|
|
517
|
+
color: #E34D59;
|
|
518
|
+
line-height: 38rpx;
|
|
519
|
+
margin-right: 4rpx;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.select-box {
|
|
524
|
+
flex: 1;
|
|
525
|
+
min-width: 0;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
.dateSelect-box {
|
|
529
|
+
display: flex;
|
|
530
|
+
align-items: center;
|
|
531
|
+
flex-direction: row-reverse;
|
|
532
|
+
flex: 1;
|
|
533
|
+
min-width: 0;
|
|
534
|
+
|
|
535
|
+
.right-icon {
|
|
536
|
+
margin-left: 16rpx;
|
|
537
|
+
width: 32rpx;
|
|
538
|
+
height: 32rpx;
|
|
539
|
+
text-align: right;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.common-picker {
|
|
544
|
+
flex: 1;
|
|
545
|
+
text-align: right;
|
|
546
|
+
font-size: 32rpx;
|
|
547
|
+
color: rgba(0, 0, 0, 0.4);
|
|
548
|
+
line-height: 48rpx;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.input-field {
|
|
552
|
+
flex: 1;
|
|
553
|
+
text-align: right;
|
|
554
|
+
font-size: 32rpx;
|
|
555
|
+
color: rgba(0, 0, 0, 0.4);
|
|
556
|
+
line-height: 48rpx;
|
|
557
|
+
padding: 32rpx 0;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.err-text {
|
|
561
|
+
padding: 8rpx 0 16rpx 0;
|
|
562
|
+
font-size: 24rpx;
|
|
563
|
+
color: rgb(245, 140, 140);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.update-info {
|
|
568
|
+
padding: 0 32rpx 16rpx 32rpx;
|
|
569
|
+
font-size: 24rpx;
|
|
570
|
+
color: rgba(0, 0, 0, 0.4);
|
|
571
|
+
line-height: 34rpx;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
.submit-btn {
|
|
575
|
+
box-sizing: border-box;
|
|
576
|
+
width: 686rpx;
|
|
577
|
+
padding: 24rpx 0 26rpx 0;
|
|
578
|
+
line-height: 58rpx;
|
|
579
|
+
font-family: Source Han Sans SC, Source Han Sans SC;
|
|
580
|
+
font-weight: 400;
|
|
581
|
+
font-size: 40rpx;
|
|
582
|
+
color: rgba(255, 255, 255, 0.9);
|
|
583
|
+
background: linear-gradient(270deg, #1D9DE9 0%, #1D6FE9 100%);
|
|
584
|
+
box-shadow: 0px 16rpx 16rpx 2rpx rgba(29, 157, 233, 0.1);
|
|
585
|
+
border-radius: 52rpx;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
</style>
|
|
589
|
+
|