<template>
|
<div>
|
<slot name="function"/>
|
|
<div class="content-container">
|
<a-form-model ref="form" :model="model" :rules="validateRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="equipmentIdList" label="设备组">
|
<a-select v-model="model.equipmentIdList" mode="multiple" placeholder="请选择设备" :maxTagCount="3"
|
allow-clear>
|
<a-select-option v-for="item in equipmentList" :key="item.equipmentId">
|
{{item.equipmentId+`[${item.equipmentName}]`}}
|
</a-select-option>
|
</a-select>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item label="零件号" prop="partId">
|
<a-input placeholder="请输入零件号" v-model="model.partId" allowClear/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item label="加工零件数量" prop="processCount">
|
<a-input-number :min="0" v-model="model.processCount" placeholder="请输入加工零件数量" style="width: 100%"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item label="合格零件数量" prop="passCount">
|
<a-input-number :min="0" v-model="model.passCount" placeholder="请输入合格零件数量" style="width: 100%"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item label="日期" prop="theDate">
|
<a-date-picker v-model="model.theDate" value-format="YYYY-MM-DD" style="width: 100%"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<div style="text-align: center">
|
<a-button @click="handleSubmit" icon="check" :loading="loading" type="primary">保存</a-button>
|
</div>
|
</a-form-model>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { getAction, postAction } from '@/api/manage'
|
|
export default {
|
name: 'ReportPassRate',
|
data() {
|
return {
|
model: {},
|
equipmentList: [],
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 8 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 8 }
|
},
|
validateRules: {
|
equipmentIdList: [
|
{ required: true, message: '请选择设备!', trigger: 'change' }
|
],
|
partId: [
|
{ required: true, message: '请输入零件号!', trigger: 'change' }
|
],
|
processCount: [
|
{ required: true, message: '请输入加工零件数量!', trigger: 'change' }
|
],
|
passCount: [
|
{ required: true, message: '请输入合格零件数量!', trigger: 'change' }
|
],
|
theDate: [
|
{ required: true, message: '请选择日期!', trigger: 'change' }
|
]
|
},
|
loading: false,
|
url: {
|
equipmentList: '/mdc/mdcEquipment/getEquipmentList',
|
submit: '/mdc/mdcPartProcessInfo/add'
|
}
|
}
|
},
|
created() {
|
this.getEquipmentListByApi()
|
},
|
methods: {
|
// 获取设备列表
|
getEquipmentListByApi() {
|
const that = this
|
getAction(this.url.equipmentList)
|
.then(res => {
|
if (res.success) that.equipmentList = res.result
|
})
|
},
|
|
// 提交表单
|
handleSubmit() {
|
const that = this
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.loading = true
|
that.model.equipmentIds = that.model.equipmentIdList.join()
|
postAction(that.url.submit, that.model)
|
.then(res => {
|
if (res.success) {
|
that.$notification.success({
|
message: '消息',
|
description: res.message
|
})
|
} else {
|
that.$notification.warning({
|
message: '消息',
|
description: res.message
|
})
|
}
|
})
|
.finally(() => {
|
that.loading = false
|
})
|
} else {
|
return false
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="less">
|
.content-container {
|
flex: 1;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
|
/deep/ .ant-form {
|
width: 75%;
|
}
|
}
|
</style>
|