cuilei
2025-06-13 935ba5c0c47e305a554102dec8ab4e1dc8459483
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
<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="8">
                <a-form-model-item prop="classifyNum" label="工具分类编码">
                  <a-input placeholder="请输入工具分类编码" v-model="model.classifyNum" :disabled="true" />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item prop="classifyName" label="工具分类名称">
                  <a-input placeholder="请输入工具分类名称" v-model="model.classifyName"  :disabled="true" />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <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-row>
              <a-col :span="8">
                <a-form-model-item prop="chineseName"
                                   label="中文名称">
                  <a-input :placeholder="disableSubmit?'':'请输入中文名称'" v-model="model.chineseName" :disabled="disableSubmit"/>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item prop="foreignLanguageName"
                                   label="外文名称">
                  <a-input :placeholder="disableSubmit?'':'请输入外文名称'" v-model="model.foreignLanguageName" :disabled="disableSubmit" />
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <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-row>
             <a-col :span="8">
                <a-form-model-item prop="standardLevel"
                                   label="标注级别">
                  <a-input :placeholder="disableSubmit?'':'请输入标准级别'" v-model="model.standardLevel" :disabled="disableSubmit"/>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <a-form-model-item prop="standardCode" label="标准号">
                  <a-input :placeholder="disableSubmit?'':'请输入标准号'" v-model="model.standardCode" :disabled="disableSubmit"/>
                </a-form-model-item>
              </a-col>
              <a-col :span="8">
                <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-form-model>
    </a-spin>
  </j-modal>
</template>
 
<script>
import { getAction,postAction, httpAction } from '@/api/manage'
import { validateDuplicateValueInDelFlag } from '@/utils/util'
import JSelectProduction from '@comp/jeecgbiz/JSelectProduction.vue'
import { getSystemConfigValue } from '@api/api'
  import { duplicateCheck } from '@/api/api'//重复校验
 
export default {
  name: 'ParaBaseModal',
  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: '请输入中文名称' }
        ],
        bladeShape: [
          { required: true, message: '请输入刀片形状' }
        ],
        bladeLength: [
          { required: true, message: '请输入刀片长度' }
        ],
        cuttingEdgeCount: [
          { required: true, message: '请输入切削刃数' }
        ],
        bladeThickness: [
          { required: true, message: '请输入刀片厚度' }
        ],
        clampingType: [
          { required: true, message: '请输入夹固型式' }
        ],
         noseAngleR: [
          { required: true, message: '请输入刀尖R' }
        ],
        toolMaterial: [
          { required: true, message: '请输入刀片材料' }
        ],
        paintcoatFlag: [
          { required: true, message: '请选择是否涂层' }
        ],
        technicalConditions: [
          { required: true, message: '请输入附加技术条件' }
        ]
      },
      url: {
        add: '/tms/baseTools/add',
        edit: '/tms/baseTools/edit',
      },
    }
  },
  created() {
  },
  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>