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.
217 lines
6.0 KiB
Vue
217 lines
6.0 KiB
Vue
<template>
|
|
<div>
|
|
<el-form :model="editData" :rules="formRules" ref="dataForm" label-width="100px">
|
|
<el-row :gutter="20">
|
|
<el-col :span="20">
|
|
<el-form-item label="UDI码:" 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="11">
|
|
<el-form-item prop="productDate" label="生产日期">
|
|
<el-input v-model="editData.produceDate" auto-complete="off"
|
|
oninput="if(value.length>6)value=value.slice(0,6)"
|
|
type="number"
|
|
:disabled="editType!=1 || !isProduceDate"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="11">
|
|
<el-form-item prop="expireDate" label="失效日期">
|
|
<el-input v-model="editData.expireDate" auto-complete="off"
|
|
oninput="if(value.length>6)value=value.slice(0,6)"
|
|
type="number"
|
|
:disabled="editType!=1 || !isExpireDate"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="11">
|
|
<el-form-item prop="batchNo" label="批次号">
|
|
<el-input v-model="editData.batchNo" auto-complete="off" :disabled="editType!=1 || !isBatchNo"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="11">
|
|
<el-form-item prop="serialNo" label="序列号">
|
|
<el-input v-model="editData.serialNo" auto-complete="off" :disabled="editType!=1 || !isSerialNo"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="11">
|
|
<el-form-item prop="count" label="扫码数量">
|
|
<el-input v-model="editData.count" auto-complete="off"
|
|
type="number"
|
|
min="1"
|
|
disabled
|
|
:disabled="editData.serialNo!=null && editData.serialNo!='' "></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="11">
|
|
<el-form-item>
|
|
<el-checkbox v-model="isUseDyCheck" disabled>是否以使用单元数量出入库</el-checkbox>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div style="text-align: right;margin-top: 20px">
|
|
<el-button @click="cancelDialog">取 消</el-button>
|
|
<el-button type="primary" @click="saveCode()" :loading="determineLoading">确 定</el-button>
|
|
</div>
|
|
</el-form>
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import {
|
|
checkTempCode,
|
|
findByCode,
|
|
saveCode, tabCode
|
|
} from "@/api/inout/code";
|
|
import {isBlank} from "@/utils/strUtil";
|
|
|
|
export default {
|
|
name: "editCode",
|
|
props: {
|
|
editType: {
|
|
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,
|
|
isUseDyCheck: false,
|
|
isProduceDate: false,
|
|
isExpireDate: false,
|
|
isBatchNo: false,
|
|
isSerialNo: false,
|
|
determineLoading: false,
|
|
};
|
|
},
|
|
|
|
methods: {
|
|
saveCode() {
|
|
this.determineLoading = true
|
|
if (this.editType == 1) {
|
|
//校验该单有没有存在同序列号的码
|
|
if (!isBlank(this.editData.serialNo)) {
|
|
checkTempCode(this.editData).then((response) => {
|
|
this.determineLoading = false
|
|
if (response.code === 20000) {
|
|
this.repeatAddCode(this.editData);
|
|
return
|
|
} else {
|
|
this.$message.error(response.message);
|
|
return
|
|
}
|
|
});
|
|
} else {
|
|
this.determineLoading = false
|
|
this.repeatAddCode(this.editData);
|
|
}
|
|
|
|
// tabCode(this.editData)
|
|
// .then((response) => {
|
|
// console.log(response)
|
|
// if (response.code === 20000) {
|
|
// this.$message.success("提交成功");
|
|
// } else {
|
|
// this.$message.error(response.message);
|
|
// }
|
|
// this.loading = false;
|
|
// });
|
|
|
|
} else {
|
|
saveCode(this.editData)
|
|
.then((response) => {
|
|
this.determineLoading = false
|
|
console.log(response)
|
|
if (response.code === 20000) {
|
|
this.$message.success("提交成功");
|
|
this.codeDetail = this.editData;
|
|
this.closeCodeDialog();
|
|
} else {
|
|
this.$message.error(response.message);
|
|
}
|
|
this.loading = false;
|
|
this.determineLoading = 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;
|
|
}
|
|
if (response.data.zxxsbzbhsydysl > 1) {
|
|
this.isUseDyCheck = true;
|
|
}
|
|
let allowNoSerial = response.data.allowNoSerial ?? true;
|
|
if (isBlank(this.editData.serialNo) && !allowNoSerial) {
|
|
this.isSerialNo = true
|
|
}
|
|
|
|
|
|
} else {
|
|
}
|
|
this.loading = false;
|
|
});
|
|
}
|
|
|
|
}
|
|
,
|
|
created() {
|
|
|
|
this.editData = JSON.parse(JSON.stringify(this.codeDetail));
|
|
this.findByCode();
|
|
//判断三区有数据的不允许修改
|
|
if (isBlank(this.editData.produceDate)) {
|
|
this.isProduceDate = true
|
|
}
|
|
if (isBlank(this.editData.expireDate)) {
|
|
this.isExpireDate = true
|
|
}
|
|
if (isBlank(this.editData.batchNo)) {
|
|
this.isBatchNo = true
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|