commit:流程支持自动化任务

This commit is contained in:
Jerry
2024-10-11 21:42:49 +08:00
parent 9a1b811a76
commit 32c31fd4df
52 changed files with 4093 additions and 309 deletions

View File

@@ -66,11 +66,6 @@ const widgetId = ref(getUUID());
const selectedItems = ref<ANY_OBJECT[]>([]);
const pps = computed(() => props.props);
const refreshData = (data: ANY_OBJECT) => {
if (data.path === 'thirdSelectDept/' + widgetId.value && data.isSuccess) {
handlerEditOperate(data.data);
}
};
const handlerEditOperate = (items: Ref<ANY_OBJECT>) => {
selectedItems.value = [];
if (props.multiple) {
@@ -187,10 +182,6 @@ watch(
immediate: true,
},
);
defineExpose({
refreshData,
});
</script>
<style scoped>

View File

@@ -103,11 +103,11 @@ import { onBeforeUnmount, shallowRef } from 'vue';
import { Editor, Toolbar } from '@wangeditor/editor-for-vue';
import { ANY_OBJECT } from '@/types/generic';
const emit = defineEmits<{ 'update:value': [string | undefined] }>();
const emit = defineEmits<{ 'update:modelValue': [string | undefined] }>();
const props = withDefaults(
defineProps<{
value?: string;
modelValue?: string;
editorConfig?: ANY_OBJECT;
toolbarConfig?: ANY_OBJECT;
height?: string;
@@ -127,16 +127,7 @@ const props = withDefaults(
const editorRef = shallowRef();
const mode = ref('default');
// 内容 HTML
const valueHtml = computed({
get() {
return props.value;
},
set(val) {
console.log('richeditor value input', val);
emit('update:value', val);
},
});
const valueHtml = ref(props.modelValue);
// 组件销毁时,也及时销毁编辑器
onBeforeUnmount(() => {
@@ -147,16 +138,17 @@ onBeforeUnmount(() => {
const handleCreated = (editor: ANY_OBJECT) => {
editorRef.value = editor; // 记录 editor 实例,重要!
editor.setHtml(valueHtml.value);
console.log('editor', editor);
console.log(editor.getAllMenuKeys());
};
watch(
() => props.value,
() => props.modelValue,
newValue => {
if (editorRef.value && newValue !== editorRef.value.txt.html())
editorRef.value.txt.html(newValue);
if (newValue !== valueHtml.value) {
valueHtml.value = newValue;
}
},
{
deep: true,
@@ -164,8 +156,15 @@ watch(
},
);
watch(
() => valueHtml.value,
newValue => {
emit('update:modelValue', newValue);
},
);
const getHtml = () => {
return editorRef.value ? editorRef.value.txt.html() : undefined;
return editorRef.value ? editorRef.value.getHtml() : undefined;
};
defineExpose({ getHtml });

View File

@@ -65,11 +65,6 @@ const pps = withDefaults(
const widgetId = ref(getUUID());
const selectedItems = ref<ANY_OBJECT[]>([]);
const refreshData = (data: ANY_OBJECT) => {
if (data.path === 'thirdSelectUser/' + widgetId.value && data.isSuccess) {
handlerEditOperate(data.data);
}
};
const handlerEditOperate = (items: Ref<ANY_OBJECT>) => {
selectedItems.value = [];
if (pps.multiple) {
@@ -194,10 +189,6 @@ watch(
immediate: true,
},
);
defineExpose({
refreshData,
});
</script>
<style scoped>