|
|
@@ -144,7 +144,6 @@
|
|
|
class="w100"
|
|
|
v-model="scope.row.reqMoldTime"
|
|
|
type="date"
|
|
|
- :picker-options="pickerOptions"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
></el-date-picker>
|
|
|
</el-form-item>
|
|
|
@@ -168,7 +167,9 @@
|
|
|
</div>
|
|
|
<div slot="footer">
|
|
|
<el-button plain @click="cancel">取消</el-button>
|
|
|
- <el-button type="primary" @click="confirm">确定</el-button>
|
|
|
+ <el-button type="primary" @click="confirm" :loading="loading"
|
|
|
+ >确定</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
@@ -211,7 +212,6 @@
|
|
|
|
|
|
columns: [
|
|
|
{
|
|
|
-
|
|
|
prop: 'batchNo',
|
|
|
label: '批次号',
|
|
|
align: 'center',
|
|
|
@@ -237,7 +237,7 @@
|
|
|
|
|
|
columns2: [
|
|
|
{
|
|
|
- slot: 'batchNo',
|
|
|
+ slot: 'batchNo',
|
|
|
prop: 'batchNo',
|
|
|
label: '批次号',
|
|
|
align: 'center',
|
|
|
@@ -275,16 +275,15 @@
|
|
|
slot: 'action',
|
|
|
showOverflowTooltip: true
|
|
|
}
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ loading: false,
|
|
|
+ custom_code: 1
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
open(row) {
|
|
|
this.visible = true;
|
|
|
this.formData = deepClone(row);
|
|
|
-
|
|
|
- console.log(this.formData);
|
|
|
-
|
|
|
if (this.formData.splitBatch == 1) {
|
|
|
this.columns[2].label = '剩余数量';
|
|
|
this.requiredFormingNum = this.formData.splitResidue;
|
|
|
@@ -295,8 +294,48 @@
|
|
|
this.form.surplusUnpack = [];
|
|
|
this.form.unpackList = [];
|
|
|
this.setSurplus();
|
|
|
+ // 自定义编码
|
|
|
+ if (!row.children || row.children.length == 0) {
|
|
|
+ this.custom_code = 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let maxSum = 0;
|
|
|
+ row.children.map((el) => {
|
|
|
+ if (!el.batchNo) return;
|
|
|
+ // 自定义批次号规则
|
|
|
+ let rules = this.extractIntegerAfterDash(el.batchNo);
|
|
|
+ if (!rules.exists || !rules.isInteger) return;
|
|
|
+ let value = rules.rightValue - 0;
|
|
|
+ maxSum = maxSum < value ? value : maxSum;
|
|
|
+ });
|
|
|
+ this.custom_code = maxSum - 0 + 1;
|
|
|
},
|
|
|
+ extractIntegerAfterDash(str) {
|
|
|
+ // 1. 检查字符串是否包含分隔符 '-'
|
|
|
+ if (str.includes('-')) {
|
|
|
+ // 2. 找到最后一个 '-' 的位置
|
|
|
+ const lastIndex = str.lastIndexOf('-');
|
|
|
+
|
|
|
+ // 3. 提取 '-' 右侧的内容
|
|
|
+ const rightPart = str.substring(lastIndex + 1).trim();
|
|
|
+
|
|
|
+ // 4. 验证是否为纯整数(正整数或0)
|
|
|
+ const isInteger = /^[1-9]\d*$|^0$/.test(rightPart); // 不允许负号和小数点
|
|
|
+
|
|
|
+ return {
|
|
|
+ exists: true,
|
|
|
+ rightValue: rightPart,
|
|
|
+ isInteger: isInteger
|
|
|
+ };
|
|
|
+ }
|
|
|
|
|
|
+ // 不存在分隔符时返回默认结果
|
|
|
+ return {
|
|
|
+ exists: false,
|
|
|
+ rightValue: null,
|
|
|
+ isInteger: false
|
|
|
+ };
|
|
|
+ },
|
|
|
setSurplus() {
|
|
|
this.form.surplusUnpack.push({
|
|
|
joinPlanCode: this.formData.code,
|
|
|
@@ -310,17 +349,17 @@
|
|
|
},
|
|
|
|
|
|
openUnpack() {
|
|
|
+ let batchNo = `${this.formData.batchNo}-${this.custom_code}`;
|
|
|
this.form.unpackList.push({
|
|
|
joinPlanCode: this.formData.code,
|
|
|
- batchNo: this.formData.batchNo,
|
|
|
+ batchNo: batchNo,
|
|
|
requiredFormingNum: '',
|
|
|
reqMoldTime: ''
|
|
|
});
|
|
|
+ this.custom_code = this.custom_code + 1;
|
|
|
},
|
|
|
|
|
|
changeNum(index) {
|
|
|
- console.log(index, '111111111111');
|
|
|
-
|
|
|
let num =
|
|
|
this.formData.splitBatch == 1
|
|
|
? this.formData.splitResidue
|
|
|
@@ -359,6 +398,7 @@
|
|
|
|
|
|
cancel() {
|
|
|
this.formData = {};
|
|
|
+ this.custom_code = 1;
|
|
|
this.visible = false;
|
|
|
// this.$refs.form.resetFields();
|
|
|
},
|
|
|
@@ -399,14 +439,18 @@
|
|
|
// console.log(params, '拆分参数----------------------');
|
|
|
|
|
|
// return;
|
|
|
-
|
|
|
- const res = await splitWork(params);
|
|
|
-
|
|
|
- if (res) {
|
|
|
- this.$message.success('拆分成功!');
|
|
|
-
|
|
|
- this.$emit('success', []);
|
|
|
- this.cancel();
|
|
|
+ this.loading = true;
|
|
|
+ try {
|
|
|
+ const res = await splitWork(params);
|
|
|
+ this.loading = false;
|
|
|
+ if (res) {
|
|
|
+ this.$message.success('拆分成功!');
|
|
|
+
|
|
|
+ this.$emit('success', []);
|
|
|
+ this.cancel();
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ this.loading = false;
|
|
|
}
|
|
|
}
|
|
|
});
|