<template>
|
<el-dialog
|
v-diadrag
|
width="60%"
|
title="抽检规则编辑"
|
top="5vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
class="spotcheckruleedit-dialog"
|
>
|
<el-form
|
:model="dataForm"
|
:rules="rules"
|
ref="dataForm"
|
label-width="100px"
|
class="l-mes"
|
>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="规则编号" prop="ruleNo">
|
<el-input v-model="dataForm.ruleNo" disabled></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="规则名称" prop="ruleName">
|
<el-input
|
v-model="dataForm.ruleName"
|
placeholder="规则名称"
|
disabled
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="抽检工序" prop="samplingOperationName">
|
<el-input
|
v-model="dataForm.samplingOperationName"
|
placeholder="抽检工序"
|
disabled
|
>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="追溯工序" prop="retrospectOperationName">
|
<el-input
|
v-model="dataForm.retrospectOperationName"
|
placeholder="追溯工序"
|
disabled
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openSecondOperatePart"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="检测类型" prop="applyType">
|
<el-select
|
v-model="dataForm.applyType"
|
filterable
|
placeholder="请选择"
|
style="width: 100%;"
|
>
|
<el-option
|
v-for="(item, index) in reportTypeOptions"
|
:key="index"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="抽检比例">
|
<div style="display:flex;">
|
<div>
|
<el-input
|
v-model="dataForm.samplingNumerator"
|
placeholder="分子"
|
class="sampling-numerator-input"
|
></el-input>
|
</div>
|
<div style="width:20px;text-align:center;">/</div>
|
<div>
|
<el-input
|
v-model="dataForm.samplingDenominator"
|
placeholder="分母"
|
class="sampling-denominator-input"
|
></el-input>
|
</div>
|
</div>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="抽检位置" prop="samplingPosition">
|
<el-input
|
v-model="dataForm.samplingPosition"
|
placeholder="抽检位置"
|
>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12"> </el-col>
|
</el-row>
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button type="primary" @click="submit">确 定</el-button>
|
</div>
|
<operationSecondDialog
|
:currshowlist.sync="showSecondOperation"
|
@listenToOperationEvent="insertSecondOperation"
|
/>
|
</el-dialog>
|
</template>
|
<script>
|
import {
|
getDocumentSamplingRule,
|
updateDocumentSamplingRule
|
} from '@/api/quality/documentsamplingrule'
|
import { remote } from '@/api/admin/dict'
|
import operationSecondDialog from '@/views/common/operation.vue'
|
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
documentSamplingRuleId: {
|
type: Number,
|
default: 0
|
}
|
},
|
data() {
|
return {
|
innerVisible: false,
|
dataForm: {
|
id: 0,
|
ruleNo: null,
|
ruleName: null,
|
samplingOperationId: null,
|
samplingOperationName: null,
|
retrospectOperationId: null,
|
retrospectOperationName: null,
|
applyType: null,
|
samplingDenominator: null,
|
samplingNumerator: null,
|
samplingPosition: null
|
},
|
rules: {},
|
reportTypeOptions: [],
|
showSecondOperation: false
|
}
|
},
|
components: { operationSecondDialog },
|
methods: {
|
initData() {
|
getDocumentSamplingRule(this.documentSamplingRuleId).then((response) => {
|
this.dataForm = response.data.data
|
})
|
},
|
submit() {
|
updateDocumentSamplingRule(this.dataForm).then((response) => {
|
this.$emit('refreshSpotCheckRuleList')
|
this.$message.success('修改成功')
|
this.innerVisible = false
|
})
|
},
|
openSecondOperatePart() {
|
this.showSecondOperation = true
|
},
|
insertSecondOperation(operation) {
|
if (operation) {
|
this.dataForm.retrospectOperationId = operation.id
|
this.dataForm.retrospectOperationName = operation.name
|
}
|
},
|
initReportTypeSelect() {
|
remote('apply_report_type').then((response) => {
|
const code = response.data.code
|
if (code === 0) {
|
const _data = response.data.data
|
this.reportTypeOptions = _data
|
}
|
})
|
},
|
getReportTypeOptions() {
|
return this.reportTypeOptions
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.$nextTick(() => {
|
this.initData()
|
})
|
}
|
}
|
},
|
mounted() {
|
this.initReportTypeSelect()
|
}
|
}
|
</script>
|
<style>
|
.spotcheckruleedit-dialog .el-dialog__header {
|
padding: 10px 20px 10px;
|
}
|
.spotcheckruleedit-dialog .el-dialog__header .el-dialog__headerbtn {
|
top: 10px;
|
}
|
.spotcheckruleedit-dialog .el-dialog__body {
|
padding: 5px 20px;
|
}
|
|
.spotcheckruleedit-dialog .el-dialog__footer {
|
padding: 5px 20px 10px;
|
}
|
|
.spotcheckruleedit-dialog .el-dialog__body .avue-crud__pagination {
|
margin-top: 0px;
|
margin-bottom: 5px;
|
}
|
</style>
|