任务配置

This commit is contained in:
cxc
2022-12-22 10:08:58 +08:00
parent ae130d30ab
commit 0ce78d416e
4 changed files with 38 additions and 17 deletions

View File

@ -6,7 +6,7 @@
<!-- <el-checkbox v-model="taskConfigForm.asyncAfter" label="异步后" @change="changeTaskAsync" />--> <!-- <el-checkbox v-model="taskConfigForm.asyncAfter" label="异步后" @change="changeTaskAsync" />-->
<!-- <el-checkbox v-model="taskConfigForm.exclusive" v-if="taskConfigForm.asyncAfter || taskConfigForm.asyncBefore" label="排除" @change="changeTaskAsync" />--> <!-- <el-checkbox v-model="taskConfigForm.exclusive" v-if="taskConfigForm.asyncAfter || taskConfigForm.asyncBefore" label="排除" @change="changeTaskAsync" />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<component :is="witchTaskComponent" v-bind="$props" /> <component :is="witchTaskComponent" :key="id" v-bind="$props" />
</el-form> </el-form>
</div> </div>
</template> </template>
@ -14,7 +14,7 @@
import UserTask from "./task-components/UserTask"; import UserTask from "./task-components/UserTask";
import ScriptTask from "./task-components/ScriptTask"; import ScriptTask from "./task-components/ScriptTask";
import ReceiveTask from "./task-components/ReceiveTask"; import ReceiveTask from "./task-components/ReceiveTask";
import { toRefs, ref } from "vue"; import { toRefs, ref, shallowRef } from "vue";
const props = defineProps({ const props = defineProps({
id: String, id: String,
type: String, type: String,
@ -26,17 +26,26 @@ const data = reactive({
asyncBefore: false, asyncBefore: false,
exclusive: false, exclusive: false,
}, },
installedComponent: { // installedComponent: {
// // 手工任务与普通任务一致,不需要其他配置
// // 接收消息任务,需要在全局下插入新的消息实例,并在该节点下的 messageRef 属性绑定该实例
// // 发送任务、服务任务、业务规则任务共用一个相同配置
// UserTask: UserTask, // 用户任务配置
// ScriptTask: ScriptTask, // 脚本任务配置
// ReceiveTask: ReceiveTask, // 消息接收任务
// },
});
const installedComponent = {
// 手工任务与普通任务一致,不需要其他配置 // 手工任务与普通任务一致,不需要其他配置
// 接收消息任务,需要在全局下插入新的消息实例,并在该节点下的 messageRef 属性绑定该实例 // 接收消息任务,需要在全局下插入新的消息实例,并在该节点下的 messageRef 属性绑定该实例
// 发送任务、服务任务、业务规则任务共用一个相同配置 // 发送任务、服务任务、业务规则任务共用一个相同配置
UserTask: "UserTask", // 用户任务配置 UserTask: shallowRef(UserTask), // 用户任务配置
ScriptTask: "ScriptTask", // 脚本任务配置 ScriptTask: shallowRef(ScriptTask), // 脚本任务配置
ReceiveTask: "ReceiveTask", // 消息接收任务 ReceiveTask: shallowRef(ReceiveTask), // 消息接收任务
}, };
}); const { taskConfigForm } = toRefs(data);
const { taskConfigForm, installedComponent } = toRefs(data); const witchTaskComponent = shallowRef();
const witchTaskComponent = ref("");
let bpmnElement; let bpmnElement;
watch( watch(
id, id,
@ -51,7 +60,7 @@ watch(
watch( watch(
type, type,
(val) => { (val) => {
witchTaskComponent.value = installedComponent.value[type.value]; witchTaskComponent.value = installedComponent[type.value].value;
}, },
{ immediate: true } { immediate: true }
); );

View File

@ -169,6 +169,11 @@ const userTaskForm = {
candidateGroups: "", candidateGroups: "",
text: "", text: "",
}; };
const props = defineProps({
id: String,
type: String,
});
const { id, type } = toRefs(props);
const loading = ref(false); const loading = ref(false);
const dataType = ref("USERS"); const dataType = ref("USERS");
const userOpen = ref(false); const userOpen = ref(false);

View File

@ -515,7 +515,7 @@ export const selectComponents = [
__slot__: { __slot__: {
"list-type": true, "list-type": true,
}, },
action: import.meta.env.VUE_APP_BASE_API + "/system/oss/upload", action: import.meta.env.VITE_APP_BASE_API + "/business/sysFile/upload",
disabled: false, disabled: false,
accept: "", accept: "",
name: "file", name: "file",
@ -629,7 +629,7 @@ export const layoutComponents = [
default: "主要按钮", default: "主要按钮",
}, },
type: "primary", type: "primary",
icon: "el-icon-search", icon: "search",
round: false, round: false,
size: "default", size: "default",
}, },

View File

@ -1,12 +1,19 @@
import { Plus } from "@element-plus/icons-vue";
import { ElIcon } from "element-plus";
export default { export default {
"list-type": (conf, key) => { "list-type": (conf, key) => {
const list = []; const list = [];
const config = conf.__config__; const config = conf.__config__;
if (conf["list-type"] === "picture-card") { if (conf["list-type"] === "picture-card") {
list.push(<i class="el-icon-plus"></i>); list.push(
<ElIcon>
<Plus />
</ElIcon>
);
} else { } else {
list.push( list.push(
<el-button size="small" type="primary" icon="el-icon-upload"> <el-button size="small" type="primary" icon="upload">
{config.buttonText} {config.buttonText}
</el-button> </el-button>
); );