diff --git a/web/src/components/fileSelector/index.vue b/web/src/components/fileSelector/index.vue
index d0d79b8..4b91abd 100644
--- a/web/src/components/fileSelector/index.vue
+++ b/web/src/components/fileSelector/index.vue
@@ -23,7 +23,7 @@
-
+
@@ -41,7 +41,7 @@
-
+
@@ -59,13 +59,13 @@
-
+
+ @open="if (listData.length === 0) listRequest();" @close="onClose" @closed="onClosed" modal-class="_overlay">
文件选择
@@ -112,8 +112,8 @@
- 取消
- 确定
+ 取消
+ 确定
@@ -216,7 +216,7 @@ const onItemClick = async (e: MouseEvent) => {
target.classList.add('active');
data.value = fileId;
}
- onDataChange(data.value);
+ // onDataChange(data.value);
};
// 每次列表刷新都得更新一下选择状态,因为所有标签页共享列表
const selectedInit = async () => {
@@ -230,8 +230,22 @@ const selectedInit = async () => {
}
};
const uploadRef = ref();
+const onSave = () => {
+ onDataChange(data.value);
+ emit('onSave', data.value);
+ selectVisiable.value = false;
+};
+const onClose = () => {
+ data.value = props.modelValue;
+ emit('onClose');
+ selectVisiable.value = false;
+};
+const onClosed = () => {
+ clearState();
+ emit('onClosed');
+};
// 清空状态
-const clear = () => {
+const clearState = () => {
filterForm.name = '';
pageForm.page = 1;
pageForm.limit = 10;
@@ -240,12 +254,12 @@ const clear = () => {
// all数据不能清,因为all只会在挂载的时候赋值一次
// listAllData.value = [];
};
-const dataClear = () => { data.value = null; onDataChange(null); }
+const clear = () => { data.value = null; onDataChange(null); }
// fs-crud部分
const data = ref(null);
-const emit = defineEmits(['update:modelValue']);
+const emit = defineEmits(['update:modelValue', 'onSave', 'onClose', 'onClosed']);
watch(() => props.modelValue, (val) => { data.value = val; }, { immediate: true });
const { ui } = useUi();
const formValidator = ui.formItem.injectFormItemContext();
@@ -255,8 +269,7 @@ const onDataChange = (value: any) => {
formValidator.onBlur();
};
-defineExpose({ data, onDataChange, selectVisiable, clear, dataClear });
-
+defineExpose({ data, onDataChange, selectVisiable, clearState, clear });
onMounted(() => {
if (props.multiple && props.inputType !== 'selector')