dengjunjie
3 天以前 b52018589bf6c7ec1d51ce8ad000a7aa993b0ab5
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
<template>
  <view-grid
    ref="grid"
    :columns="columns"
    :detail="detail"
    :editFormFields="editFormFields"
    :editFormOptions="editFormOptions"
    :searchFormFields="searchFormFields"
    :searchFormOptions="searchFormOptions"
    :table="table"
    :extend="extend"
  >
  </view-grid>
</template>
 
<script>
import extend from "@/extension/basicinfo/processInfo.js";
import { ref, defineComponent } from "vue";
 
export default defineComponent({
  setup() {
    // 工具函数:格式化数字为两位小数
    const formatTwoDecimal = (value) => {
      if (value === "" || value === null || value === undefined) return "";
      const num = parseFloat(value);
      return isNaN(num) ? "" : num.toFixed(2);
    };
 
    // 表格基础配置
    const table = ref({
      key: "id",
      footer: "Foots",
      cnName: "加工信息",
      name: "processInfo",
      url: "/processInfo/",
      sortName: "createDate",
      sortOrder: "desc", // 创建时间默认倒序
    });
 
    // 编辑表单字段 - 严格匹配后端Dt_ProcessInfo实体
    const editFormFields = ref({
      id: 0, // 主键默认值改为数字0
      palletCode: "",
      productCode: "",
      productName: "",
      productSn: "",
      pressTightenOk: 0, // 改为数字默认值
      pressTightenUnfinished: 0, // 改为数字默认值
      productStatus: 0, // 新增:产品状态字段
      screwTorque: "",
      screwAngle: "",
      pressPressure: "",
      productCheckHeight: "",
      threadPositionHeight: "",
      height1: "",
      height2: "",
      height3: "",
    });
 
    // 产品状态下拉选项(匹配后端注释)
    const productStatusOptions = [
      { key: "0", value: "不合格" },
      { key: "1", value: "合格" },
      { key: "2", value: "人工确认合格" },
    ];
 
    // 布尔型下拉选项(通用)
    const booleanOptions = [
      { key: "0", value: "否" },
      { key: "1", value: "是" },
    ];
 
    // 编辑表单配置 - 修正字段匹配,优化布局和命名
    const editFormOptions = ref([
      // 基础信息行
      [
        {
          title: "工装板编号",
          field: "palletCode",
          type: "input",
          width: 180,
          require: true,
          placeholder: "请输入工装板编号",
        },
        {
          title: "成品编号",
          field: "productCode",
          type: "input",
          width: 180,
          require: true,
          placeholder: "请输入成品编号",
        },
        {
          title: "成品名称",
          field: "productName",
          type: "input",
          width: 180,
          require: true,
          placeholder: "请输入成品名称",
        },
        {
          title: "流水号",
          field: "productSn",
          type: "input",
          width: 200,
          require: false,
          placeholder: "请输入产品流水号",
        },
      ],
      // 加工状态行 - 移除不存在的checkUnfinished,新增产品状态
      [
        {
          title: "压装拧紧_拧紧OK",
          field: "pressTightenOk",
          type: "select",
          width: 160,
          align: "center",
          defaultValue: 0,
          data: booleanOptions,
        },
        {
          title: "压装拧紧_本次加工未完成",
          field: "pressTightenUnfinished",
          type: "select",
          width: 180,
          align: "center",
          defaultValue: 0,
          data: booleanOptions,
        },
        {
          title: "产品状态",
          field: "productStatus",
          type: "select",
          width: 160,
          align: "center",
          defaultValue: 0,
          data: productStatusOptions,
        },
        {
          title: "压装位下压压力",
          field: "pressPressure",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
      ],
      // 压装检测参数行 - 优化标题,匹配后端注释
      [
        {
          title: "压装位拧紧检测扭力",
          field: "screwTorque",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
        {
          title: "压装位拧紧检测角度",
          field: "screwAngle",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
        {
          title: "产品检测高度",
          field: "productCheckHeight",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
        {
          title: "螺纹位置高度",
          field: "threadPositionHeight",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
      ],
      // 拧紧位检测高度行
      [
        {
          title: "拧紧位检测高度1",
          field: "height1",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
        {
          title: "拧紧位检测高度2",
          field: "height2",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
        {
          title: "拧紧位检测高度3",
          field: "height3",
          type: "input",
          inputType: "number",
          width: 180,
          require: false,
          attrs: { step: 0.01, min: 0 },
          placeholder: "保留2位小数",
          formatter: formatTwoDecimal,
          onBlur: (e) => {
            e.target.value = formatTwoDecimal(e.target.value);
          },
        },
      ],
    ]);
 
    // 搜索表单字段 - 匹配后端实体,移除无关字段
    const searchFormFields = ref({
      palletCode: "",
      productCode: "",
      productName: "",
      productSn: "",
      productStatus: "", // 新增:产品状态搜索
      createDate: "",
    });
 
    // 搜索表单配置 - 优化布局,新增产品状态搜索
    const searchFormOptions = ref([
      [
        { title: "工装板编号", field: "palletCode", type: "like", width: 180 },
        { title: "成品编号", field: "productCode", type: "like", width: 180 },
        { title: "成品名称", field: "productName", type: "like", width: 180 },
        { title: "流水号", field: "productSn", type: "like", width: 200 },
      ],
      [
        {
          title: "产品状态",
          field: "productStatus",
          type: "select",
          width: 180,
          data: productStatusOptions,
        },
        { title: "创建时间", field: "createDate", type: "datetime", width: 380 },
      ],
    ]);
 
    // 表格列配置 - 修正字段匹配,新增产品状态列,优化标题
    const columns = ref([
      {
        field: "id",
        title: "序号",
        type: "int",
        width: 80,
        hidden: true,
        align: "center",
      },
      {
        field: "palletCode",
        title: "工装板编号",
        type: "string",
        width: 140,
        align: "left",
      },
      {
        field: "productCode",
        title: "成品编号",
        type: "string",
        width: 140,
        align: "left",
      },
      {
        field: "productName",
        title: "成品名称",
        type: "string",
        width: 150,
        align: "left",
      },
      {
        field: "productSn",
        title: "流水号",
        type: "string",
        width: 180,
        align: "left",
        overflow: "ellipsis",
      },
      // 状态列 - 移除checkUnfinished,新增产品状态
      {
        field: "pressTightenOk",
        title: "拧紧OK",
        type: "select",
        width: 100,
        align: "center",
        bind: {
          key: "value",
          data: booleanOptions,
        },
      },
      {
        field: "pressTightenUnfinished",
        title: "拧紧未完成",
        type: "select",
        width: 120,
        align: "center",
        bind: {
          key: "value",
          data: booleanOptions,
        },
      },
      {
        field: "productStatus",
        title: "产品状态",
        type: "select",
        width: 120,
        align: "center",
        bind: {
          key: "value",
          data: productStatusOptions,
        },
      },
      // 压装检测参数列 - 优化标题,统一格式化
      {
        field: "pressPressure",
        title: "压装位下压压力",
        type: "decimal",
        width: 120,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.pressPressure),
      },
      {
        field: "screwTorque",
        title: "拧紧检测扭力",
        type: "decimal",
        width: 120,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.screwTorque),
      },
      {
        field: "screwAngle",
        title: "拧紧检测角度",
        type: "decimal",
        width: 120,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.screwAngle),
      },
      // 产品检测高度列
      {
        field: "productCheckHeight",
        title: "产品检测高度",
        type: "decimal",
        width: 120,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.productCheckHeight),
      },
      {
        field: "threadPositionHeight",
        title: "螺纹位置高度",
        type: "decimal",
        width: 120,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.threadPositionHeight),
      },
      {
        field: "height1",
        title: "高度1",
        type: "decimal",
        width: 100,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.height1),
      },
      {
        field: "height2",
        title: "高度2",
        type: "decimal",
        width: 100,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.height2),
      },
      {
        field: "height3",
        title: "高度3",
        type: "decimal",
        width: 100,
        align: "center",
        formatter: (row) => formatTwoDecimal(row.height3),
      },
      // 公共字段
      {
        field: "creater",
        title: "创建人",
        type: "string",
        width: 80,
        align: "center",
      },
      {
        field: "createDate",
        title: "创建时间",
        type: "datetime",
        width: 160,
        align: "center",
      },
      {
        field: "modifier",
        title: "修改人",
        type: "string",
        width: 80,
        align: "center",
      },
      {
        field: "modifyDate",
        title: "修改时间",
        type: "datetime",
        width: 160,
        align: "center",
      },
    ]);
 
    // 加工信息无明细
    const detail = ref({
      cnName: "",
      table: "",
      columns: [],
      sortName: "",
      key: "",
    });
 
    return {
      table,
      extend,
      editFormFields,
      editFormOptions,
      searchFormFields,
      searchFormOptions,
      columns,
      detail,
    };
  },
});
</script>