You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udiwms-vue/src/views/inout/editCode.vue

183 lines
5.8 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<el-form :model="editData" :rules="formRules" ref="dataForm">
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>条码</span>
</div>
</el-col>
<el-col :span="16">
<el-form-item prop="code">
<el-input
v-model="editData.code"
clearable
disabled
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>生产日期:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="productDate">
<el-input v-model="editData.produceDate" auto-complete="off"
oninput="if(value.length>6)value=value.slice(0,6)"
type="number"
:disabled="false"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>失效日期:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="expireDate">
<el-input v-model="editData.expireDate" auto-complete="off"
oninput="if(value.length>6)value=value.slice(0,6)"
type="number"
:disabled="false"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>批次号:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="batchNo">
<el-input v-model="editData.batchNo" auto-complete="off" :disabled="false"></el-input>
</el-form-item>
</el-col>
<el-col :span="3">
<div class="ao-text">
<span>序列号:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="serialNo">
<el-input v-model="editData.serialNo" auto-complete="off" :disabled="xlhEnable"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="3">
<div class="ao-text">
<span>数量:</span>
</div>
</el-col>
<el-col :span="7">
<el-form-item prop="count">
<el-input v-model="editData.count" auto-complete="off"
type="number"
min="1"
:disabled="editData.serialNo!=null && editData.serialNo!='' "></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="17">
</el-col>
<el-col :span="7">
<el-button @click="cancelDialog"> </el-button>
<el-button type="primary" @click="saveCode()"> </el-button>
</el-col>
</el-row>
</el-form>
</div>
</template>
<script>
import {
findByCode,
saveCode
} from "../../api/inout/code";
export default {
name: "editCode",
props: {
editTye: {
type: Object,
required: true,
},
closeCodeDialog: {
type: Function,
required: true,
},
repeatAddCode: {
type: Function,
required: false,
},
codeDetail: {
type: Object,
required: true,
},
editData: null
},
data() {
return {
xlhEnable: false,
};
},
methods: {
saveCode() {
if (this.editTye == 1) {
this.repeatAddCode(this.editData);
} else {
saveCode(this.editData)
.then((response) => {
if (response.code === 20000) {
this.$message.success("提交成功");
this.codeDetail = this.editData;
this.closeCodeDialog();
} else {
this.$message.error(response.message);
}
this.loading = false;
});
}
},
cancelDialog() {
this.closeCodeDialog();
},
findByCode() {
let query = {udiCode: this.editData.code};
findByCode(query)
.then((response) => {
if (response.code === 20000) {
if (response.data.scbssfbhxlh == "否") {
this.xlhEnable = true;
}
} else {
}
this.loading = false;
});
}
},
created() {
this.editData = JSON.parse(JSON.stringify(this.codeDetail));
this.findByCode();
}
}
</script>
<style scoped>
</style>