cuijian
2025-07-09 9b6bd0c014b73456edb095ee53b22324437ae646
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
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    centered
    :confirmLoading="confirmLoading"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    switchFullscreen
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 工具基础信息
        </a-divider>
 
        <a-row :gutter="24">
              <a-col :span="6">
                <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="classifyNum" label="工具分类编码">
                      <a-input placeholder="请输入工具分类编码" v-model="model.classifyNum" :disabled="true" />
                    </a-form-model-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="classifyName" label="工具分类名称">
                      <a-input placeholder="请输入工具分类名称" v-model="model.classifyName"  :disabled="true" />
                    </a-form-model-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="toolCode" label="工具编码">
                      <a-input :placeholder="disableSubmit?'':'请输入工具编码'" v-model="model.toolCode" :disabled="disableSubmit"/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
              </a-col>
 
              <a-col :span="6">
                <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="chineseName"
                                      label="中文名称">
                      <a-input :placeholder="disableSubmit?'':'请输入中文名称'" v-model="model.chineseName" :disabled="disableSubmit"/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
                 <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="foreignLanguageName"
                                      label="外文名称">
                      <a-input :placeholder="disableSubmit?'':'请输入外文名称'" v-model="model.foreignLanguageName" :disabled="disableSubmit" />
                    </a-form-model-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="toolModel"
                                      label="型号/图号">
                      <a-input :placeholder="disableSubmit?'':'请输入型号/图号'" v-model="model.toolModel" :disabled="disableSubmit" />
                    </a-form-model-item>
                  </a-col>
                </a-row>
              </a-col>
 
              <a-col :span="6">
              <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="standardLevel"
                                      label="标注级别">
                      <a-input :placeholder="disableSubmit?'':'请输入标准级别'" v-model="model.standardLevel" :disabled="disableSubmit"/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
                 <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="standardCode" label="标准号">
                      <a-input :placeholder="disableSubmit?'':'请输入标准号'" v-model="model.standardCode" :disabled="disableSubmit"/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="24">
                    <a-form-model-item prop="signCode" label="序号">
                      <a-input :placeholder="disableSubmit?'':'请输入序号'" v-model="model.signCode" :disabled="disableSubmit"/>
                    </a-form-model-item>
                  </a-col>
                </a-row>
              </a-col>
 
              <a-col :span="6">
                 <a-row>
                  <a-col :span="24">
                    <a-form-model-item label='' :labelCol='{span:4}' :wrapperCol='{span:20}'>
                      <j-image-upload text='上传工具图片' v-model='model.toolPicture'></j-image-upload>
                    </a-form-model-item>
                  </a-col>
                 </a-row>
              </a-col>
            </a-row>
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 管理参数
        </a-divider>
 
        <a-row :gutter="24">
           <a-col :span="8">
                <a-form-model-item prop="applicationType"
                                   label="工具类型">
                  <j-dict-select-tag dict-code="equipment_category" :placeholder="disableSubmit?'':'请选择工具类型'"
                                     v-model="model.applicationType" :disabled="disableSubmit" />
                </a-form-model-item>
              </a-col>
           <a-col :span="8">
            <a-form-model-item prop="provinceCity" label="仓库省份城市">
              <a-input :placeholder="disableSubmit?'':'请输入仓库省份城市'" v-model="model.provinceCity" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="positionCode" label="库位号">
              <a-select
                :disabled="disableSubmit"
                :triggerChange="true"
                :options="locationCodeOptions"
                v-model="model.positionCode"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
 
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item prop="storageLocation" label="存储位置">
              <a-input :placeholder="disableSubmit?'':'请输入存储位置'" v-model="model.storageLocation" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="lowerInventory" label="最低库存">
              <a-input :placeholder="disableSubmit?'':'请输入最低库存'" v-model="model.lowerInventory" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="highestInventory" label="最高库存">
              <a-input :placeholder="disableSubmit?'':'请输入最高库存'" v-model="model.highestInventory" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
        </a-row>
 
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item prop="auxiliaryUnitFlag" label="是否有计量辅单位">
              <a-radio-group v-model="model.auxiliaryUnitFlag" :placeholder="disableSubmit?'':'请选择是否有计量辅单位'" :disabled="disableSubmit">
                <a-radio :value="'1'">是</a-radio>
                <a-radio :value="'2'">否</a-radio>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="mainUnit" label="计量主单位">
              <a-input :placeholder="disableSubmit?'':'请输入计量主单位'" v-model="model.mainUnit" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="auxiliaryUnit" label="计量辅单位">
              <a-input :placeholder="disableSubmit?'':'请输入计量辅单位'" v-model="model.auxiliaryUnit" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
        </a-row>
 
         <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item prop="supplierId" label="厂家">
              <a-input :placeholder="disableSubmit?'':'请输入厂家'" v-model="model.supplierId" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item prop="price" label="单价">
              <a-input :placeholder="disableSubmit?'':'请输入单价'" v-model="model.price" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
          <!-- <a-col :span="8">
            <a-form-model-item prop="status" label="状态">
              <a-input :placeholder="disableSubmit?'':'请输入状态'" v-model="model.status" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col> -->
        </a-row>
 
        <a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 参数信息
        </a-divider>
 
        <a-row :gutter="24">
          <a-col :span="6">
            <a-form-model-item label="螺纹代号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="threadCode">
              <a-input v-model="model.threadCode" :placeholder="disableSubmit?'':'请输入螺纹代号'"  :disabled="disableSubmit"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="螺距" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pitch">
              <a-input v-model="model.pitch" :placeholder="disableSubmit?'':'请输入螺距'"  :disabled="disableSubmit"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="螺纹旋向" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rotationDirection">
              <a-input v-model="model.rotationDirection" :placeholder="disableSubmit?'':'请输入螺纹旋向'"  :disabled="disableSubmit"></a-input>
            </a-form-model-item>
          </a-col>
           <a-col :span="6">
            <a-form-model-item label="螺纹公差带代号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tolerancezoneLevel">
              <a-input v-model="model.tolerancezoneLevel" :placeholder="disableSubmit?'':'请输入螺纹公差带代号'"  :disabled="disableSubmit"></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
 
        <a-row :gutter="24">
          <a-col :span="6">
            <a-form-model-item label="切削刃长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="edgeLength">
              <a-input v-model="model.edgeLength" :placeholder="disableSubmit?'':'请输入切削刃长'"  :disabled="disableSubmit"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="刀具总长" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="totalLength">
              <a-input v-model="model.totalLength" :placeholder="disableSubmit?'':'请输入刀具总长'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
           <a-col :span="6">
            <a-form-model-item label="刀具材料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toolMaterial">
              <a-input v-model="model.toolMaterial" :placeholder="disableSubmit?'':'请输入刀具材料'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
           <a-col :span="6">
            <a-form-model-item label="零件材料" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partMaterial">
              <a-input v-model="model.partMaterial" :placeholder="disableSubmit?'':'请输入零件材料'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="6">
            <a-form-model-item label="是否涂层" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paintcoatFlag">
              <a-radio-group v-model="model.paintcoatFlag" :placeholder="disableSubmit?'':'请选择是否涂层'" :disabled="disableSubmit">
                <a-radio :value="'1'">是</a-radio>
                <a-radio :value="'2'">否</a-radio>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="外型尺寸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="externalDimensions">
              <a-input v-model="model.externalDimensions" :placeholder="disableSubmit?'':'请输入外型尺寸'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
           <a-col :span="6">
            <a-form-model-item label="柄部规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="handleSpecifications">
              <a-input v-model="model.handleSpecifications" :placeholder="disableSubmit?'':'请输入柄部规格'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="附加技术条件" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="technicalConditions">
              <a-input v-model="model.technicalConditions" :placeholder="disableSubmit?'':'请输入附加技术条件'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="附加技术条件说明" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conditionsInfo">
              <a-input v-model="model.conditionsInfo" :placeholder="disableSubmit?'':'请输入附加技术条件说明'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="6">
            <a-form-model-item label="品牌" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="brand">
              <a-input v-model="model.brand" :placeholder="disableSubmit?'':'请输入品牌'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="制式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="types">
              <a-input v-model="model.types" :placeholder="disableSubmit?'':'请输入制式'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
         <a-col :span="6">
            <a-form-model-item label="冷却方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="coolingMethod">
              <a-input v-model="model.coolingMethod" :placeholder="disableSubmit?'':'请输入冷却方式'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="螺纹标准" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="threadStandard">
              <a-input v-model="model.threadStandard" :placeholder="disableSubmit?'':'请输入螺纹标准'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="6">
            <a-form-model-item label="排屑槽型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fluteSoltType">
              <a-input v-model="model.fluteSoltType" :placeholder="disableSubmit?'':'请输入排屑槽型'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="螺纹类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="threadType">
              <a-input v-model="model.threadType" :placeholder="disableSubmit?'':'请输入螺纹类型'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="导向尺寸" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="guidingSize">
              <a-input v-model="model.guidingSize" :placeholder="disableSubmit?'':'请输入导向尺寸'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="连接孔径" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="connectionAperture">
              <a-input v-model="model.connectionAperture" :placeholder="disableSubmit?'':'请输入连接孔径'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :span="6">
            <a-form-model-item label="连接键槽" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="connectingKeyway">
              <a-input v-model="model.connectingKeyway" :placeholder="disableSubmit?'':'请输入连接键槽'" :disabled="disableSubmit" ></a-input>
            </a-form-model-item>
          </a-col>        
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="remark" label="备注">
              <a-textarea :placeholder="disableSubmit?'':'请输入备注'" v-model="model.remark" :disabled="disableSubmit"/>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </j-modal>
</template>
 
<script>
import { getAction,postAction, httpAction } from '@/api/manage'
import JSelectProduction from '@comp/jeecgbiz/JSelectProduction.vue'
import { duplicateCheck } from '@/api/api'//重复校验
import { ajaxGetDictItems } from '@/api/api'
 
export default {
  name: 'ParaHoleToolsModal',
  components: { JSelectProduction },
  data() {
    return {
      title: '操作',
      visible: false,
      //控制编辑
      editable: false,
      //详情控制
      disableSubmit: false,
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 9 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 14 }
      },
      labelColLong: {
        xs: { span: 24 },
        sm: { span: 2 }
      },
      wrapperColLong: {
        xs: { span: 24 },
        sm: { span: 22 }
      },
      confirmLoading: false,
      validatorRules: {
        toolCode: [
          { required: true, message: '请输入工具编码' },
          { validator: this.validateNum }
        ],
        classifyNum: [
          { required: true, message: '请输入工具分类编码' }
        ],
        classifyName: [
          { required: true, message: '请输入工具分类名称' }
        ],
        toolModel: [
          { required: true, message: '请输入型号/图号' },
           { validator: this.validateModel }
        ],
        chineseName: [
          { required: true, message: '请输入中文名称' }
        ],
        threadCode: [
          { required: true, message: '请输入螺纹代号' }
        ],
        pitch: [
          { required: true, message: '请输入螺距' }
        ],
        rotationDirection: [
          { required: true, message: '请输入螺纹旋向' }
        ],
        tolerancezoneLevel: [
          { required: true, message: '请输入螺纹公差带代号' }
        ],
        edgeLength: [
          { required: true, message: '请输入切削刃长' }
        ],
        totalLength: [
          { required: true, message: '请输入刀具总长' }
        ],
        toolMaterial: [
          { required: true, message: '请输入刀具材料' }
        ],
        paintcoatFlag: [
          { required: true, message: '请选择是否涂层' }
        ],
        handleSpecifications: [
          { required: true, message: '请输入柄部规格' }
        ],
        technicalConditions: [
          { required: true, message: '请输入附件技术条件' }
        ]
      },
      url: {
        add: '/tms/baseTools/add',
        edit: '/tms/baseTools/edit',
      },
      locationCodeOptions:[]
    }
  },
  created() {
    ajaxGetDictItems("tms_goods_shelves,location_code,id", null).then((res) => {
        if (res.success) {
          this.locationCodeOptions = res.result
        }
      })
  },
  methods: {
    add(nodeSelected) {
      this.editable = false;
      //初始化默认值
      this.model = {};
      this.model.classifyId = nodeSelected.key
      this.model.classifyNum = nodeSelected.entity.classifyId
      this.model.classifyName = nodeSelected.entity.typeName
      this.model.paraTypeFlag = nodeSelected.entity.paraTypeFlag
      this.visible = true
    },
    edit(record) {
      this.editable = true;
      this.model = Object.assign({}, record)
      this.visible = true
    },
    close() {
      this.$emit('close')
      this.visible = false
      this.$refs.form.clearValidate()
    },
    handleOk() {
      const that = this
      // 触发表单验证
      this.$refs.form.validate(valid => {
        if (valid) {
          that.confirmLoading = true
          let formData = Object.assign(this.model)
          let httpUrl = ''
            let method = 'post'
            if (!this.model.id) {
              httpUrl += this.url.add
            } else {
              httpUrl += this.url.edit
            }
           httpAction(httpUrl, formData, method)
            .then((res) => {
              if (res.success) {
                that.$message.success(res.message)
               that.$emit('ok')
              } else {
                that.$message.warning(res.message)
              }
            })
            .finally(() => {
              that.confirmLoading = false
              that.close()
            })
        }
      })
    },
    handleCancel() {
      this.close()
    },
      //验证工具编码是否重复
    validateNum(rule, value, callback) {
      var params = {
        tableName: 'tms_base_tools',
        fieldName: 'tool_code',
        fieldVal: value,
        dataId: this.model.id
      };
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback()
        } else {
          callback("工具编码已存在!")
        }
      })
    },
      //验证型号/图号是否重复
    validateModel(rule, value, callback) {
      var params = {
        tableName: 'tms_base_tools',
        fieldName: 'tool_model',
        fieldVal: value,
        dataId: this.model.id
      };
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback()
        } else {
          callback("型号/图号已存在!")
        }
      })
    },
  }
}
</script>
 
<style lang="less" scoped>
/deep/ .ant-modal-body {
  padding: 0 24px;
}
 
/deep/ .ant-upload {
  width: 185px;
  height: 185px;
}
 
/deep/ .img {
  display: flex;
  justify-content: center;
 
  .ant-upload-picture-card-wrapper {
    width: auto;
  }
}
 
/deep/ .ant-upload-list-picture-card-container {
  width: 185px;
  height: 185px;
}
 
/deep/ .ant-upload-list-item {
  width: 185px;
  height: 185px;
}
</style>