|
@@ -16,26 +16,19 @@
|
|
:key="modalForm.id"
|
|
:key="modalForm.id"
|
|
label-width="70px"
|
|
label-width="70px"
|
|
>
|
|
>
|
|
- <el-form-item prop="serialNo" label="批次号:">
|
|
|
|
- <el-select
|
|
|
|
- v-model.trim="modalForm.code"
|
|
|
|
- filterable
|
|
|
|
|
|
+ <el-form-item prop="sequence" label="批次号:">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model.trim="modalForm.alphabet"
|
|
placeholder="编码"
|
|
placeholder="编码"
|
|
- :disabled="!!originCode"
|
|
|
|
|
|
+ disabled
|
|
style="width: 80px"
|
|
style="width: 80px"
|
|
>
|
|
>
|
|
- <el-option
|
|
|
|
- v-for="item in codes"
|
|
|
|
- :key="item"
|
|
|
|
- :label="item"
|
|
|
|
- :value="item"
|
|
|
|
- ></el-option>
|
|
|
|
- </el-select>
|
|
|
|
|
|
+ </el-input>
|
|
<el-input-number
|
|
<el-input-number
|
|
- v-model="modalForm.serialNo"
|
|
|
|
- placeholder="请输入编号"
|
|
|
|
|
|
+ v-model="modalForm.sequence"
|
|
|
|
+ placeholder="请输入"
|
|
:min="1"
|
|
:min="1"
|
|
- :max="9999"
|
|
|
|
|
|
+ :max="999999"
|
|
:step="1"
|
|
:step="1"
|
|
step-strictly
|
|
step-strictly
|
|
:controls="false"
|
|
:controls="false"
|
|
@@ -51,16 +44,16 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+const initModalForm = { alphabet: "A", sequence: 1 };
|
|
|
|
+
|
|
export default {
|
|
export default {
|
|
name: "select-batch-no-dialog",
|
|
name: "select-batch-no-dialog",
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
modalIsShow: false,
|
|
modalIsShow: false,
|
|
- modalForm: { code: "", serialNo: 1 },
|
|
|
|
- originCode: "",
|
|
|
|
- codes: "abcdefghijklmnopqrstuvwxyz".toUpperCase().split(""),
|
|
|
|
|
|
+ modalForm: { ...initModalForm },
|
|
rules: {
|
|
rules: {
|
|
- serialNo: [
|
|
|
|
|
|
+ sequence: [
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
message: "请输入批次号",
|
|
message: "请输入批次号",
|
|
@@ -78,15 +71,13 @@ export default {
|
|
this.modalIsShow = true;
|
|
this.modalIsShow = true;
|
|
},
|
|
},
|
|
dialogOpened() {
|
|
dialogOpened() {
|
|
- const batchNo = this.$ls.get("batchNo", "");
|
|
|
|
- if (batchNo) {
|
|
|
|
- this.modalForm.code = batchNo[0];
|
|
|
|
- this.modalForm.serialNo = Number(batchNo.substring(1) || "0") + 1;
|
|
|
|
|
|
+ const batchInfo = this.$ls.get("batchInfo");
|
|
|
|
+ if (batchInfo) {
|
|
|
|
+ this.modalForm.alphabet = batchInfo.alphabet;
|
|
|
|
+ this.modalForm.sequence = batchInfo.sequence + 1;
|
|
} else {
|
|
} else {
|
|
- this.modalForm.code = "";
|
|
|
|
- this.modalForm.serialNo = 1;
|
|
|
|
|
|
+ this.modalForm = { ...initModalForm };
|
|
}
|
|
}
|
|
- this.originCode = this.modalForm.code;
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.$refs.modalFormComp.clearValidate();
|
|
this.$refs.modalFormComp.clearValidate();
|
|
@@ -96,9 +87,12 @@ export default {
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
const valid = await this.$refs.modalFormComp.validate().catch(() => {});
|
|
if (!valid) return;
|
|
if (!valid) return;
|
|
|
|
|
|
- const batchNo = `${this.modalForm.code}${this.modalForm.serialNo}`;
|
|
|
|
|
|
+ const batchNo = `${this.modalForm.alphabet}${this.modalForm.sequence}`;
|
|
|
|
|
|
- this.$ls.set("batchNo", batchNo);
|
|
|
|
|
|
+ this.$ls.set("batchInfo", {
|
|
|
|
+ ...this.modalForm,
|
|
|
|
+ batchNo,
|
|
|
|
+ });
|
|
this.$emit("confirm", batchNo);
|
|
this.$emit("confirm", batchNo);
|
|
this.cancel();
|
|
this.cancel();
|
|
},
|
|
},
|