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>
|
||||
|
||||
<!-- 复用现有单步表单:新增/编辑一条 Route -->
|
||||
<!-- 复用现有单步表单:新增/编辑一条 Route;key 随每次打开递增,强制重建实例杜绝上次内容残留 -->
|
||||
<route-form
|
||||
v-if="dialogVisible"
|
||||
:key="dialogSeq"
|
||||
ref="routeForm"
|
||||
:count="count"
|
||||
:routepack="routepack"
|
||||
|
|
@ -141,6 +142,7 @@ export default {
|
|||
edges: [],
|
||||
count: 0,
|
||||
dialogVisible: false,
|
||||
dialogSeq: 0,
|
||||
// 左侧物料面板
|
||||
matType: "30",
|
||||
matKeyword: "",
|
||||
|
|
@ -479,6 +481,7 @@ export default {
|
|||
|
||||
/** 打开单步表单;prefill 为 null 表示纯新增 */
|
||||
openForm(mode, prefill) {
|
||||
this.dialogSeq += 1;
|
||||
this.dialogVisible = true;
|
||||
this.$nextTick(() => {
|
||||
const inst = this.$refs.routeForm.open(mode);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,17 @@ onMounted(() => {
|
|||
const init = () => {
|
||||
if (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 (isFixOptions.value) {
|
||||
selectLabel.value = props.options
|
||||
|
|
@ -150,7 +160,6 @@ const init = () => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const isFixOptions = ref(false);
|
||||
const tableData = ref(null);
|
||||
|
|
|
|||
|
|
@ -397,6 +397,11 @@ export default {
|
|||
},
|
||||
getroutemats(){
|
||||
let that = this;
|
||||
// 无 routeId(画布拉线预填等新增场景)时不请求,避免拉回全量辅料
|
||||
if (!that.routeId) {
|
||||
that.routemats = [];
|
||||
return;
|
||||
}
|
||||
that.$API.mtm.routemat.list.req({ route: that.routeId,page: 0}).then((res) => {
|
||||
that.routemats = res;
|
||||
});
|
||||
|
|
@ -500,7 +505,8 @@ export default {
|
|||
that.resetForm();
|
||||
that.visible = true;
|
||||
that.$nextTick(() => {
|
||||
if(that.count){
|
||||
// 仅新增时按现有数量预填排序;编辑时保留 setData 带入的原 sort
|
||||
if(that.count && mode === "add"){
|
||||
that.form.sort = that.count+1;
|
||||
}
|
||||
that.$refs.dialogForm && that.$refs.dialogForm.clearValidate();
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@
|
|||
</el-container>
|
||||
<save-dialog
|
||||
v-if="dialog.save"
|
||||
:key="dialogSeq"
|
||||
ref="saveDialog"
|
||||
:count = "count"
|
||||
:routepack="routepack"
|
||||
|
|
@ -217,6 +218,7 @@ export default {
|
|||
dialog: {
|
||||
save: false,
|
||||
},
|
||||
dialogSeq: 0,
|
||||
fileList:[],
|
||||
form: {
|
||||
name: "",
|
||||
|
|
@ -341,13 +343,14 @@ export default {
|
|||
table_add() {
|
||||
let that = this;
|
||||
that.count = this.$refs.tables.tableData.length;
|
||||
console.log("count",that.count);
|
||||
this.dialogSeq += 1;
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add");
|
||||
});
|
||||
},
|
||||
table_edit(row) {
|
||||
this.dialogSeq += 1;
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("edit").setData(row);
|
||||
|
|
|
|||
Loading…
Reference in New Issue