修复bug

This commit is contained in:
Jerry
2024-08-14 23:31:15 +08:00
parent 24ba8f571c
commit 3a347a3a1a
19 changed files with 261 additions and 105 deletions

View File

@@ -244,7 +244,7 @@ const props = withDefaults(
},
);
const table = ref<ANY_OBJECT>();
const table = ref();
const form = inject('form', () => {
console.error('OnlineCustomTable: form not injected');
return { isEdit: false } as ANY_OBJECT;
@@ -403,10 +403,12 @@ const onRadioSelectChange = () => {
props.onRadioChange(selectRow);
}
};
// const setSelectedRow = (rowNum: number) => {
// table.value.getTableImpl().setRadioRow(props.dataList[rowNum]);
// nextTick(onRadioSelectChange);
// };
const setSelectedRow = (rowNum: number) => {
nextTick(() => {
table.value.getTableImpl().setRadioRow(props.dataList[rowNum]);
onRadioSelectChange();
});
};
// 取消行内编辑
// const cancelRowEvent = (row: ANY_OBJECT) => {
// if (form().isEdit) return;
@@ -554,6 +556,10 @@ watch(
refreshColumn();
},
);
defineExpose({
setSelectedRow,
});
</script>
<style scoped>

View File

@@ -170,13 +170,10 @@ const uploadWidgetImpl = reactive(
const getDisabledStatus = () => {
if (form().isEdit) return true;
let formWidgetAuth: ANY_OBJECT | null = null;
if (form().formAuth) {
formWidgetAuth = form().formAuth();
if (formWidgetAuth != null) {
formWidgetAuth = formWidgetAuth.pc[pps.widget.variableName];
}
}
const formWidgetAuth: ANY_OBJECT | null = form().formAuth && form().formAuth() && form().formAuth().pc
? form().formAuth().pc[pps.widget.variableName]
: null;
if (formWidgetAuth && formWidgetAuth.disabled) return true;
return props.widget.props.disabled;
};

View File

@@ -355,13 +355,9 @@ const getWidgetProps = computed(() => {
});
const getDisabledStatus = () => {
let formWidgetAuth: ANY_OBJECT | null = null;
if (form().formAuth) {
formWidgetAuth = form().formAuth();
if (formWidgetAuth != null) {
formWidgetAuth = formWidgetAuth.pc[pps.widget.variableName];
}
}
const formWidgetAuth: ANY_OBJECT | null = form().formAuth && form().formAuth() && form().formAuth().pc
? form().formAuth().pc[pps.widget.variableName]
: null;
if (formWidgetAuth && formWidgetAuth.disabled) return true;
return pps.widget.props.disabled;
};
@@ -400,6 +396,8 @@ const onValueInput = (val: ANY_OBJECT | undefined) => {
if (multiSelect.value && Array.isArray(tempValue) /*&& tempValue.length > 0*/) {
tempValue = tempValue.join(',') + ',';
}
} else {
tempValue = val;
}
console.log('widget update:value', tempValue);
emit('update:value', tempValue);
@@ -413,10 +411,9 @@ const onValueChange = (
) => {
let tempVal: ValueType | undefined = undefined;
let dictData = null;
tempVal = parseValue(val);
console.log('widget onValueChange >>>', val);
if (val) {
tempVal = parseValue(val);
if (val != null) {
if (multiSelect.value) {
dictData = val
.map((item: string) => {
@@ -442,8 +439,6 @@ const onValueChange = (
}
}
}
// 这个似乎没有起到什么作用
emit('change', tempVal, {
dictData: dictData,
selectRow: selectRow,