mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 10:36:31 +08:00
1、菜单绑定在线表单时候过滤掉不符合条件的页面。
This commit is contained in:
@@ -211,7 +211,7 @@ const SysMenuType = new DictionaryBase('菜单类型', [
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: '表单',
|
||||
name: '菜单',
|
||||
symbol: 'MENU',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -80,7 +80,7 @@ export const useThirdParty = (props: ThirdProps) => {
|
||||
};
|
||||
|
||||
export const useThirdPartyAlive = () => {
|
||||
let refreshTimer: number;
|
||||
let refreshTimer: number | null | ReturnType<typeof setInterval>;
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
|
||||
@@ -168,11 +168,6 @@ const getWidgetStyle = computed(() => {
|
||||
};
|
||||
});
|
||||
const getComponent = computed(() => {
|
||||
console.log(
|
||||
'widget getComponent',
|
||||
pps.widget.widgetType,
|
||||
SysCustomWidgetType.getValue(pps.widget.widgetType),
|
||||
);
|
||||
if (
|
||||
[
|
||||
SysCustomWidgetType.Text,
|
||||
@@ -185,7 +180,6 @@ const getComponent = computed(() => {
|
||||
return OnlineCustomLabel;
|
||||
}
|
||||
let mode = form().mode;
|
||||
console.log('widget getComponent mode', mode);
|
||||
|
||||
switch (pps.widget.widgetType) {
|
||||
case SysCustomWidgetType.Label:
|
||||
@@ -251,7 +245,6 @@ const isDictWidget = computed(() => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const bindValue = computed<string | number | boolean | any[] | ANY_OBJECT | Date | undefined>({
|
||||
get() {
|
||||
console.log('widget bind props.value >>', pps.value);
|
||||
let tempValue = pps.value === undefined ? '' : pps.value;
|
||||
if (isDictWidget.value) tempValue = tempValue == null ? '' : tempValue + '';
|
||||
if (multiSelect.value && pps.value && typeof tempValue === 'string') {
|
||||
@@ -291,7 +284,6 @@ const bindValue = computed<string | number | boolean | any[] | ANY_OBJECT | Date
|
||||
}
|
||||
},
|
||||
set(val) {
|
||||
console.log('widget .......bindValue..........', val, typeof val);
|
||||
onValueInput(val as ANY_OBJECT | undefined);
|
||||
},
|
||||
});
|
||||
@@ -324,7 +316,6 @@ const getWidgetProps = computed(() => {
|
||||
) {
|
||||
props['value-format'] = 'YYYY-MM-DD HH:mm:ss';
|
||||
}
|
||||
console.log('widget props', SysCustomWidgetType.getValue(pps.widget.widgetType), props);
|
||||
return {
|
||||
...props,
|
||||
clearable: true,
|
||||
@@ -381,12 +372,9 @@ const parseValue = (val: ValueType): ANY_OBJECT => {
|
||||
const onValueInput = (val: ANY_OBJECT | undefined) => {
|
||||
let tempValue: ValueType | undefined = undefined;
|
||||
if (val) {
|
||||
console.log('widget typeof val', typeof val, val instanceof InputEvent, val instanceof Event);
|
||||
if (val instanceof InputEvent) {
|
||||
console.warn('widget input value is InputEvent');
|
||||
return;
|
||||
} else if (val instanceof Event) {
|
||||
console.log('wiget >>>>>>> value >>>>>>', val, val.target instanceof HTMLInputElement);
|
||||
if (val.target instanceof HTMLInputElement) {
|
||||
tempValue = val.target.value;
|
||||
}
|
||||
@@ -400,7 +388,6 @@ const onValueInput = (val: ANY_OBJECT | undefined) => {
|
||||
} else {
|
||||
tempValue = val;
|
||||
}
|
||||
console.log('widget update:value', tempValue);
|
||||
emit('update:value', tempValue);
|
||||
emit('update:modelValue', tempValue);
|
||||
// ElDatePicker(DateRange)有了这个事件才能更新显示
|
||||
@@ -413,7 +400,6 @@ const onValueChange = (
|
||||
let tempVal: ValueType | undefined = undefined;
|
||||
let dictData = null;
|
||||
tempVal = parseValue(val);
|
||||
console.log('widget onValueChange >>>', val);
|
||||
if (val != null) {
|
||||
if (multiSelect.value) {
|
||||
dictData = val
|
||||
@@ -454,7 +440,6 @@ const loadDropdownData = () => {
|
||||
dictDataList.value = [];
|
||||
setTimeout(() => {
|
||||
let dictInfo = (pps.widget.props.dictInfo || {}).dict;
|
||||
console.log('widget OnlineCustomWidget loadDropdownData', dictInfo, pps);
|
||||
if (dictInfo && form().getDictDataList) {
|
||||
let dictCall;
|
||||
if (form().pageCode != null) {
|
||||
@@ -466,7 +451,6 @@ const loadDropdownData = () => {
|
||||
}
|
||||
dictCall
|
||||
.then((res: ANY_OBJECT[]) => {
|
||||
console.log('OnlineCustomWidget loadDropdownData', res);
|
||||
res.forEach((item: ANY_OBJECT) => {
|
||||
item.id = item.id + '';
|
||||
if (item.parentId) item.parentId = item.parentId + '';
|
||||
@@ -485,15 +469,12 @@ const loadDropdownData = () => {
|
||||
};
|
||||
|
||||
const getHtml = () => {
|
||||
console.log('widget call getHtml()');
|
||||
const refs = (getCurrentInstance()?.refs || {}) as ANY_OBJECT;
|
||||
console.log('refs', refs);
|
||||
if (pps.widget.widgetType === SysCustomWidgetType.RichEditor) {
|
||||
return refs[pps.widget.variableName] ? refs[pps.widget.variableName].getHtml() : undefined;
|
||||
}
|
||||
};
|
||||
const reset = () => {
|
||||
console.log('widget call reset()');
|
||||
onValueInput(undefined);
|
||||
onValueChange(undefined);
|
||||
nextTick(() => {
|
||||
@@ -502,7 +483,6 @@ const reset = () => {
|
||||
};
|
||||
const refresh = () => {
|
||||
const refs = (getCurrentInstance()?.refs || {}) as ANY_OBJECT;
|
||||
console.log('widget call refresh() refs:', refs);
|
||||
if (
|
||||
refs[pps.widget.variableName] &&
|
||||
typeof refs[pps.widget.variableName].refresh === 'function'
|
||||
@@ -520,7 +500,6 @@ defineExpose({
|
||||
watch(
|
||||
() => pps.widget,
|
||||
() => {
|
||||
console.log('props widget change', pps.widget);
|
||||
if (pps.widget) loadDropdownData();
|
||||
},
|
||||
{
|
||||
@@ -575,7 +554,6 @@ watch(
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
console.log('getComponent', getComponent.value, getWidgetProps.value);
|
||||
//propsWidget.value.widgetImpl = getCurrentInstance();
|
||||
//propsWidget.value.parent = parentWidget;
|
||||
});
|
||||
|
||||
@@ -395,7 +395,6 @@ const onSaveFormData = () => {
|
||||
};
|
||||
// 提交
|
||||
const onSubmit = () => {
|
||||
console.log('OnlineEditForm submit', dialogParams.value);
|
||||
if (dialogParams.value.isEdit) return;
|
||||
if (Array.isArray(richEditWidgetList)) {
|
||||
richEditWidgetList.forEach(richWidget => {
|
||||
@@ -405,7 +404,6 @@ const onSubmit = () => {
|
||||
});
|
||||
}
|
||||
formRef.value.validate((valid: boolean) => {
|
||||
console.log('OnlineEditForm submit validate', valid, form.value);
|
||||
if (!valid) return;
|
||||
if (dialogParams.value.saveData) {
|
||||
// 非级联保存数据
|
||||
@@ -494,13 +492,9 @@ const initFormData = () => {
|
||||
form.value.tableMap.forEach((table: ANY_OBJECT) => {
|
||||
if (table.relation && table.relation.relationType === SysOnlineRelationType.ONE_TO_ONE) {
|
||||
relationNameList.push(table.relation.variableName);
|
||||
formData[table.relation.variableName] = table.columnList.reduce(
|
||||
(retObj: ANY_OBJECT, column: ANY_OBJECT) => {
|
||||
retObj[column.columnName] = undefined;
|
||||
return retObj;
|
||||
},
|
||||
{},
|
||||
);
|
||||
table.columnList.forEach(column => {
|
||||
formData[table.relation.variableName][column.columnName] = undefined;
|
||||
});
|
||||
} else if (table.relation == null) {
|
||||
datasourceName = table.datasource.variableName;
|
||||
}
|
||||
@@ -512,10 +506,9 @@ const initFormData = () => {
|
||||
} else {
|
||||
// 从表字段
|
||||
if (dialogParams.value.rowData[key]) {
|
||||
formData[key] = {
|
||||
...formData[key],
|
||||
...dialogParams.value.rowData[key],
|
||||
};
|
||||
Object.keys(dialogParams.value.rowData[key]).forEach(subKey => {
|
||||
formData[key][subKey] = dialogParams.value.rowData[key][subKey];
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -571,7 +564,7 @@ onMounted(() => {
|
||||
});
|
||||
})
|
||||
.catch((e: Error) => {
|
||||
console.warn(e);
|
||||
console.error(e);
|
||||
});
|
||||
}
|
||||
isReady.value = true;
|
||||
|
||||
@@ -47,7 +47,8 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
isCopy: props.isCopy || thirdParams.value.isCopy || false,
|
||||
readOnly: props.readOnly || thirdParams.value.readOnly || false,
|
||||
fullscreen: props.fullscreen || thirdParams.value.fullscreen || false,
|
||||
saveData: !thirdParams.value.saveData ? props.saveData : thirdParams.value.saveData,
|
||||
saveData:
|
||||
(thirdParams.value || {}).saveData == null ? props.saveData : thirdParams.value.saveData,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -221,7 +222,13 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
const relationId = (widget.props.relativeTable || {}).relationId;
|
||||
const relation = dialogParams.value.formConfig.relationMap.get(relationId);
|
||||
if (relation != null) {
|
||||
formData[relation.variableName] = selectRow || {};
|
||||
if (selectRow != null) {
|
||||
Object.keys(selectRow).forEach(key => {
|
||||
formData[relation.variableName][key] = selectRow[key];
|
||||
});
|
||||
} else {
|
||||
formData[relation.variableName] = Object.create({});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -337,7 +344,6 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
formId: formId,
|
||||
})
|
||||
.then(res => {
|
||||
console.log('<<<<<<OnlineFormController.render>>>>>', res);
|
||||
const onlineForm = res.data.onlineForm;
|
||||
let formConfigData = JSON.parse(onlineForm.widgetJson);
|
||||
formConfigData = formConfigData.pc;
|
||||
@@ -413,7 +419,6 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
if (dlgComponent == null) {
|
||||
return Promise.reject(new Error('错误的操作组件!!!'));
|
||||
} else {
|
||||
console.log('handlerOperation component', dlgComponent);
|
||||
const thirdPath = 'thirdOnlineEditForm';
|
||||
operationCallback.value = callback;
|
||||
return Dialog.show(
|
||||
@@ -456,7 +461,6 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
return widget.relation ? formData[widget.relation.variableName] : [];
|
||||
};
|
||||
const setTableData = (widget: ANY_OBJECT, dataList: ANY_OBJECT[]) => {
|
||||
console.log('setTableData', widget, dataList);
|
||||
if (widget == null) return;
|
||||
if (widget.relation) {
|
||||
formData[widget.relation.variableName] = dataList;
|
||||
@@ -510,7 +514,6 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
formData.customField[field.fieldName] = undefined;
|
||||
});
|
||||
}
|
||||
console.log('initPage formData', formData);
|
||||
};
|
||||
|
||||
const errorMessage = ref<ANY_OBJECT[]>([]);
|
||||
@@ -756,7 +759,6 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
widgetRuleKey &&
|
||||
(widget.props.required || (widget.column && Array.isArray(widget.column.ruleList)))
|
||||
) {
|
||||
console.log('rules >>>>>>>>>>', rules, 'widgetRuleKey', widgetRuleKey);
|
||||
if (rules) {
|
||||
rules[widgetRuleKey] = [];
|
||||
// 必填验证
|
||||
@@ -799,22 +801,24 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
|
||||
// TODO initWidgetLinkage
|
||||
const initWidgetLinkage = () => {
|
||||
// dialogParams.value.formConfig.linkageMap.forEach((widgetList: ANY_OBJECT[], key: string) => {
|
||||
// const column = dialogParams.value.formConfig.columnMap.get(key);
|
||||
// const table = column ? dialogParams.value.formConfig.tableMap.get(column.tableId) : undefined;
|
||||
// const watchKey =
|
||||
// 'formData.' +
|
||||
// (table.relation == null ? table.datasource.variableName : table.relation.variableName) +
|
||||
// '.';
|
||||
// watchKey += column.columnName;
|
||||
// watch(watchKey, newValue => {
|
||||
// if (Array.isArray(widgetList)) {
|
||||
// widgetList.forEach(widget => {
|
||||
// resetWidget(widget);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
/*
|
||||
dialogParams.value.formConfig.linkageMap.forEach((widgetList: ANY_OBJECT[], key: string) => {
|
||||
const column = dialogParams.value.formConfig.columnMap.get(key);
|
||||
const table = column ? dialogParams.value.formConfig.tableMap.get(column.tableId) : undefined;
|
||||
let watchKey =
|
||||
'formData.' +
|
||||
(table.relation == null ? table.datasource.variableName : table.relation.variableName) +
|
||||
'.';
|
||||
watchKey += column.columnName;
|
||||
watch(watchKey, newValue => {
|
||||
if (Array.isArray(widgetList)) {
|
||||
widgetList.forEach(widget => {
|
||||
resetWidget(widget);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
};
|
||||
const getPrintParamItem = (row, printParamList) => {
|
||||
let param;
|
||||
@@ -847,7 +851,6 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
selectRows: ANY_OBJECT[] | undefined | null,
|
||||
fileName: string,
|
||||
) => {
|
||||
console.log('onPrint', operation, row, fileName);
|
||||
if (operation == null) return;
|
||||
let printParam;
|
||||
if (row != null) {
|
||||
@@ -875,19 +878,17 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
)
|
||||
.then(res => {
|
||||
const downloadUrl = res.data;
|
||||
console.log('downloadUrl', downloadUrl);
|
||||
downloadBlob(downloadUrl as string, {}, 'get')
|
||||
.then(blobData => {
|
||||
const pdfUrl = window.URL.createObjectURL(blobData as Blob);
|
||||
window.open('./lib/pdfjs/web/viewer.html?file=' + pdfUrl);
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e);
|
||||
ElMessage.error(e);
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
console.log(e);
|
||||
console.error(e);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -933,7 +934,7 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref<FormInstance> | null = n
|
||||
});
|
||||
})
|
||||
.catch(e => {
|
||||
console.warn(e);
|
||||
console.error(e);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -339,30 +339,32 @@ const loadPageAndForms = () => {
|
||||
formTreeData.value = [];
|
||||
return;
|
||||
}
|
||||
formTreeData.value = pageList.map(page => {
|
||||
let children = formList
|
||||
.filter((form: ANY_OBJECT) => {
|
||||
return (
|
||||
form.pageId === page.pageId &&
|
||||
form.formKind === SysOnlineFormKind.PAGE &&
|
||||
(form.formType === SysOnlineFormType.QUERY ||
|
||||
form.formType === SysOnlineFormType.ADVANCE_QUERY)
|
||||
);
|
||||
})
|
||||
.map((form: ANY_OBJECT) => {
|
||||
return {
|
||||
id: form.formId,
|
||||
name: form.formName,
|
||||
};
|
||||
});
|
||||
formTreeData.value = pageList
|
||||
.map(page => {
|
||||
let children = formList
|
||||
.filter((form: ANY_OBJECT) => {
|
||||
return (
|
||||
form.pageId === page.pageId &&
|
||||
form.formKind === SysOnlineFormKind.PAGE &&
|
||||
(form.formType === SysOnlineFormType.QUERY ||
|
||||
form.formType === SysOnlineFormType.ADVANCE_QUERY)
|
||||
);
|
||||
})
|
||||
.map((form: ANY_OBJECT) => {
|
||||
return {
|
||||
id: form.formId,
|
||||
name: form.formName,
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
id: page.pageId,
|
||||
name: page.pageName,
|
||||
disabled: !page.published,
|
||||
children,
|
||||
};
|
||||
});
|
||||
return {
|
||||
id: page.pageId,
|
||||
name: page.pageName,
|
||||
disabled: !page.published,
|
||||
children,
|
||||
};
|
||||
})
|
||||
.filter(page => page.children.length > 0);
|
||||
if (formData.value.onlineFormId) {
|
||||
onlineFormPath.value = findTreeNodePath(
|
||||
formTreeData.value,
|
||||
|
||||
Reference in New Issue
Block a user