<template>
|
<el-dialog
|
title="库位选择"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
width="500px"
|
>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="80px"
|
class="l-mes"
|
>
|
<el-form-item
|
v-if="isQualified"
|
label="合格库位"
|
prop="targetQualifiedLocationId"
|
>
|
<el-input
|
v-model="dataForm.targetQualifiedLocationIdNo"
|
placeholder="合格库位"
|
readonly
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openLocationDialog('targetQualifiedLocationId')"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
<el-form-item
|
v-if="!isQualified"
|
label="不合格库位"
|
prop="targetUnqualifiedLocationId"
|
>
|
<el-input
|
v-model="dataForm.targetUnqualifiedLocationIdNo"
|
placeholder="不合格库位"
|
readonly
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openLocationDialog('targetUnqualifiedLocationId')"
|
></el-button>
|
</el-input>
|
</el-form-item>
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>确定</el-button
|
>
|
</span>
|
<locationDialog
|
:currshowlist.sync="showLocation"
|
@listenToLocationEvent="selectLocation"
|
/>
|
</el-dialog>
|
</template>
|
<script>
|
import locationDialog from '@/views/common/location.vue'
|
import { batchUpdateApplyPartV2 } from '@/api/quality/newReport'
|
export default {
|
components: { locationDialog },
|
data() {
|
return {
|
reportInfo: {},
|
visible: false,
|
dataForm: {
|
targetQualifiedLocationId: null,
|
targetUnqualifiedLocationId: null,
|
targetQualifiedLocationIdNo: null,
|
targetUnqualifiedLocationIdNo: null
|
},
|
isQualified: null,
|
showLocation: false,
|
dataRule: {},
|
isSubmit: false,
|
locType: null
|
}
|
},
|
created() {},
|
methods: {
|
init(reportInfo, isQualified) {
|
this.initData()
|
this.reportInfo = JSON.parse(JSON.stringify(reportInfo))
|
this.isQualified = isQualified
|
this.visible = true
|
},
|
// 初始化dataForm数据
|
initData() {
|
this.dataForm = {
|
targetQualifiedLocationId: null,
|
targetUnqualifiedLocationId: null,
|
targetQualifiedLocationIdNo: null,
|
targetUnqualifiedLocationIdNo: null
|
}
|
},
|
openLocationDialog(type) {
|
this.locType = type
|
this.showLocation = true
|
},
|
selectLocation(param) {
|
if (param) {
|
this.dataForm[this.locType] = param.id
|
this.dataForm[this.locType + 'No'] = param.locNo
|
}
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.isSubmit = true
|
batchUpdateApplyPartV2(
|
[
|
{
|
id: this.reportInfo.id,
|
isQualified: this.isQualified,
|
systemNo: this.reportInfo.systemNo,
|
lotBatchNo: this.reportInfo.lotBatchNo,
|
...this.dataForm
|
}
|
],
|
1
|
)
|
.then((data) => {
|
this.$message.success('标记成功 ' + data.data.msg)
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('submitFinished')
|
})
|
.finally(() => {
|
this.isSubmit = false
|
})
|
}
|
}
|
}
|
</script>
|