<template>
|
<el-dialog
|
:title="!dataForm.id ? '报检' : '报检'"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
class="part-dialog"
|
>
|
<!--检测汇报关联的检验项-->
|
<div class="test-apply-div">
|
<div class="test-apply-header">
|
<span style="color:#303133;">报检申请</span>
|
</div>
|
<div class="test-apply-body">
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="120px"
|
class="l-mes"
|
>
|
<el-row>
|
<el-col :span="7">
|
<el-form-item label="申请类型" prop="applyType">
|
<el-select v-model="dataForm.applyType" placeholder="请选择">
|
<el-option
|
v-for="item in reportTypeOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="申请编号" prop="applyNo">
|
<el-input v-model="dataForm.applyNo" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="备注" prop="remark">
|
<el-input v-model="dataForm.remark" placeholder=""></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
</div>
|
<div class="test-part-div">
|
<div class="test-part-header">
|
<span style="color:#303133;">报检零件</span>
|
</div>
|
<div class="test-part-body">
|
<el-table
|
stripe
|
ref="applyPartList"
|
:data="applyPartList"
|
height="100%"
|
:row-style="{ height: '26px' }"
|
:cell-style="{ padding: '0' }"
|
>
|
<el-table-column
|
label="系统编号"
|
prop="systemNo"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="零件批号"
|
prop="outBatchNo"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="零件编号"
|
prop="partNo"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="零件名称"
|
prop="partName"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="生产数量"
|
prop="productQty"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
</el-table>
|
</div>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button
|
type="primary"
|
:disabled="saveDisabled"
|
@click="dataFormSubmit()"
|
>确定</el-button
|
>
|
</span>
|
</el-dialog>
|
</template>
|
<style>
|
.test-apply-div {
|
border: 1px solid #cfd5de;
|
border-radius: 4px;
|
width: 100%;
|
}
|
.test-apply-header {
|
padding: 18px 20px;
|
border-bottom: 1px solid #ebeef5;
|
}
|
.test-apply-body {
|
height: 90px;
|
}
|
.test-part-div {
|
border: 1px solid #cfd5de;
|
border-radius: 4px;
|
width: 100%;
|
}
|
.test-part-header {
|
padding: 18px 20px;
|
border-bottom: 1px solid #ebeef5;
|
}
|
.test-part-body {
|
height: 200px;
|
}
|
</style>
|
<script>
|
import { addApply } from '@/api/quality/apply'
|
import { remote } from '@/api/admin/dict'
|
|
export default {
|
props: {
|
applyPartList: {
|
type: Array,
|
default: []
|
}
|
},
|
data() {
|
return {
|
visible: false,
|
dataForm: {
|
id: 0,
|
applyNo: '',
|
applyType: '01output',
|
remark: ''
|
},
|
dataRule: {},
|
saveDisabled: false,
|
clickSaveArr: [],
|
reportTypeOptions: []
|
}
|
},
|
methods: {
|
init(id) {
|
this.dataForm.id = id || 0
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs.dataForm.resetFields()
|
remote('apply_report_type').then((response) => {
|
if (response.data.code === 0) {
|
this.reportTypeOptions = response.data.data
|
} else {
|
this.reportTypeOptions = []
|
}
|
})
|
})
|
},
|
// 表单提交
|
dataFormSubmit() {
|
let canClickFlag = true
|
this.clickSaveArr.push(new Date().getTime())
|
if (this.clickSaveArr.length > 1) {
|
if (
|
this.clickSaveArr[this.clickSaveArr.length - 1] -
|
this.clickSaveArr[this.clickSaveArr.length - 2] <
|
2000
|
) {
|
// 小于2秒则认为重复提交
|
canClickFlag = false
|
}
|
}
|
if (canClickFlag) {
|
this.saveDisabled = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
this.saveDisabled = false
|
} else {
|
if (this.applyPartList && this.applyPartList.length > 0) {
|
addApply(
|
Object.assign(this.dataForm, {
|
applyPartList: this.applyPartList
|
})
|
)
|
.then((data) => {
|
this.$message.success('报检成功')
|
this.visible = false
|
this.saveDisabled = false
|
this.$emit('refreshDataList')
|
})
|
.catch((error) => {
|
this.saveDisabled = false
|
})
|
} else {
|
this.saveDisabled = false
|
this.$message.warning('请选择产出零件')
|
}
|
}
|
} else {
|
this.saveDisabled = false
|
}
|
})
|
}
|
}
|
}
|
}
|
</script>
|