fix:工艺路线表单残留问题根治:xtSelect外部清空值时同步清空显示文字(残留主因);画布/右侧新增弹框加key每次打开强制重建实例;route_form编辑时sort不再被count+1覆盖;无routeId不再全量拉辅料
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
ec59a0ac98
commit
205768fbc3
|
|
@ -87,9 +87,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 复用现有单步表单:新增/编辑一条 Route -->
|
<!-- 复用现有单步表单:新增/编辑一条 Route;key 随每次打开递增,强制重建实例杜绝上次内容残留 -->
|
||||||
<route-form
|
<route-form
|
||||||
v-if="dialogVisible"
|
v-if="dialogVisible"
|
||||||
|
:key="dialogSeq"
|
||||||
ref="routeForm"
|
ref="routeForm"
|
||||||
:count="count"
|
:count="count"
|
||||||
:routepack="routepack"
|
:routepack="routepack"
|
||||||
|
|
@ -141,6 +142,7 @@ export default {
|
||||||
edges: [],
|
edges: [],
|
||||||
count: 0,
|
count: 0,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
|
dialogSeq: 0,
|
||||||
// 左侧物料面板
|
// 左侧物料面板
|
||||||
matType: "30",
|
matType: "30",
|
||||||
matKeyword: "",
|
matKeyword: "",
|
||||||
|
|
@ -479,6 +481,7 @@ export default {
|
||||||
|
|
||||||
/** 打开单步表单;prefill 为 null 表示纯新增 */
|
/** 打开单步表单;prefill 为 null 表示纯新增 */
|
||||||
openForm(mode, prefill) {
|
openForm(mode, prefill) {
|
||||||
|
this.dialogSeq += 1;
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const inst = this.$refs.routeForm.open(mode);
|
const inst = this.$refs.routeForm.open(mode);
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,17 @@ onMounted(() => {
|
||||||
const init = () => {
|
const init = () => {
|
||||||
if (props.label) {
|
if (props.label) {
|
||||||
selectLabel.value = props.label;
|
selectLabel.value = props.label;
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
// 外部把值清空(表单重置/实例复用)时同步清空显示文字,否则输入框会残留上次选择的内容
|
||||||
|
const emptyVal =
|
||||||
|
props.modelValue == null ||
|
||||||
|
props.modelValue === "" ||
|
||||||
|
(Array.isArray(props.modelValue) && props.modelValue.length === 0);
|
||||||
|
if (emptyVal) {
|
||||||
|
selectLabel.value = "";
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (props.multiple) {
|
if (props.multiple) {
|
||||||
if (isFixOptions.value) {
|
if (isFixOptions.value) {
|
||||||
selectLabel.value = props.options
|
selectLabel.value = props.options
|
||||||
|
|
@ -149,7 +159,6 @@ const init = () => {
|
||||||
selectLabel.value = props.obj[props.labelField];
|
selectLabel.value = props.obj[props.labelField];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isFixOptions = ref(false);
|
const isFixOptions = ref(false);
|
||||||
|
|
|
||||||
|
|
@ -397,6 +397,11 @@ export default {
|
||||||
},
|
},
|
||||||
getroutemats(){
|
getroutemats(){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
// 无 routeId(画布拉线预填等新增场景)时不请求,避免拉回全量辅料
|
||||||
|
if (!that.routeId) {
|
||||||
|
that.routemats = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
that.$API.mtm.routemat.list.req({ route: that.routeId,page: 0}).then((res) => {
|
that.$API.mtm.routemat.list.req({ route: that.routeId,page: 0}).then((res) => {
|
||||||
that.routemats = res;
|
that.routemats = res;
|
||||||
});
|
});
|
||||||
|
|
@ -500,7 +505,8 @@ export default {
|
||||||
that.resetForm();
|
that.resetForm();
|
||||||
that.visible = true;
|
that.visible = true;
|
||||||
that.$nextTick(() => {
|
that.$nextTick(() => {
|
||||||
if(that.count){
|
// 仅新增时按现有数量预填排序;编辑时保留 setData 带入的原 sort
|
||||||
|
if(that.count && mode === "add"){
|
||||||
that.form.sort = that.count+1;
|
that.form.sort = that.count+1;
|
||||||
}
|
}
|
||||||
that.$refs.dialogForm && that.$refs.dialogForm.clearValidate();
|
that.$refs.dialogForm && that.$refs.dialogForm.clearValidate();
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@
|
||||||
</el-container>
|
</el-container>
|
||||||
<save-dialog
|
<save-dialog
|
||||||
v-if="dialog.save"
|
v-if="dialog.save"
|
||||||
|
:key="dialogSeq"
|
||||||
ref="saveDialog"
|
ref="saveDialog"
|
||||||
:count = "count"
|
:count = "count"
|
||||||
:routepack="routepack"
|
:routepack="routepack"
|
||||||
|
|
@ -217,6 +218,7 @@ export default {
|
||||||
dialog: {
|
dialog: {
|
||||||
save: false,
|
save: false,
|
||||||
},
|
},
|
||||||
|
dialogSeq: 0,
|
||||||
fileList:[],
|
fileList:[],
|
||||||
form: {
|
form: {
|
||||||
name: "",
|
name: "",
|
||||||
|
|
@ -341,13 +343,14 @@ export default {
|
||||||
table_add() {
|
table_add() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.count = this.$refs.tables.tableData.length;
|
that.count = this.$refs.tables.tableData.length;
|
||||||
console.log("count",that.count);
|
this.dialogSeq += 1;
|
||||||
this.dialog.save = true;
|
this.dialog.save = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.saveDialog.open("add");
|
this.$refs.saveDialog.open("add");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
table_edit(row) {
|
table_edit(row) {
|
||||||
|
this.dialogSeq += 1;
|
||||||
this.dialog.save = true;
|
this.dialog.save = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.saveDialog.open("edit").setData(row);
|
this.$refs.saveDialog.open("edit").setData(row);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue