|
@@ -35,32 +35,38 @@ const userTypeOption = ref([
|
|
|
|
|
|
const rules = reactive<FormRules<any>>({
|
|
|
name: [
|
|
|
- { required: true, message: "Please input Activity name", trigger: "blur" },
|
|
|
+ { required: true, message: "请输入审核节点名称", trigger: "blur" },
|
|
|
],
|
|
|
- desc: [
|
|
|
- { required: true, message: "Please input activity form", trigger: "blur" },
|
|
|
+ userType: [
|
|
|
+ { required: true, message: "人员类型不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ candidateUsers: [
|
|
|
+ { required: true, message: "候选人员不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ assignee: [
|
|
|
+ { required: true, message: "指定人员不能为空", trigger: "blur" },
|
|
|
+ ],
|
|
|
+ candidateGroups: [
|
|
|
+ { required: true, message: "指定角色不能为空", trigger: "blur" },
|
|
|
],
|
|
|
});
|
|
|
|
|
|
-const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
- // if (!formEl) return
|
|
|
- // await formEl.validate((valid, fields) => {
|
|
|
- // if (valid) {
|
|
|
- // console.log('submit!')
|
|
|
- // } else {
|
|
|
- // console.log('error submit!', fields)
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
- if (flowRef.value && flowRef.value.updateNodeData && selectedNode.value) {
|
|
|
- selectedNode.value.data.information = JSON.parse(
|
|
|
- JSON.stringify(formData.value)
|
|
|
- );
|
|
|
- flowRef.value.updateNodeData(
|
|
|
- JSON.parse(JSON.stringify(markRaw(selectedNode.value)))
|
|
|
- );
|
|
|
- cancel();
|
|
|
- }
|
|
|
+const submitForm = () => {
|
|
|
+ ruleFormRef.value.validate(async (valid, fields) => {
|
|
|
+ if (valid) {
|
|
|
+ if (flowRef.value && flowRef.value.updateNodeData && selectedNode.value) {
|
|
|
+ selectedNode.value.data.information = JSON.parse(
|
|
|
+ JSON.stringify(formData.value)
|
|
|
+ );
|
|
|
+ flowRef.value.updateNodeData(
|
|
|
+ JSON.parse(JSON.stringify(markRaw(selectedNode.value)))
|
|
|
+ );
|
|
|
+ cancel();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('error submit!', fields)
|
|
|
+ }
|
|
|
+ })
|
|
|
};
|
|
|
|
|
|
const cancel = () => {
|
|
@@ -110,10 +116,14 @@ const onNodeOperation = async (name: HJMethodName, node: HJNodeData): void => {
|
|
|
|
|
|
selectedNode.value = JSON.parse(JSON.stringify(node));
|
|
|
|
|
|
- if (selectedNode.value && selectedNode.value.data.information) {
|
|
|
- formData.value = JSON.parse(
|
|
|
- JSON.stringify(selectedNode.value.data.information)
|
|
|
- );
|
|
|
+ if (selectedNode.value) {
|
|
|
+ if(selectedNode.value.data.information){
|
|
|
+ formData.value = JSON.parse(
|
|
|
+ JSON.stringify(selectedNode.value.data.information)
|
|
|
+ );
|
|
|
+ }else{
|
|
|
+ formData.value = {}
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
console.log("selectedNode", selectedNode.value);
|
|
@@ -165,6 +175,7 @@ const testGetCurrentData = () => {
|
|
|
class="demo-ruleForm"
|
|
|
:size="formSize"
|
|
|
status-icon
|
|
|
+ :rules="rules"
|
|
|
v-show="infoVisible"
|
|
|
>
|
|
|
<el-form-item label="节点名称" prop="name">
|
|
@@ -229,8 +240,8 @@ const testGetCurrentData = () => {
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="submitForm(ruleFormRef)">
|
|
|
- 保存
|
|
|
+ <el-button type="primary" @click="submitForm">
|
|
|
+ 确定
|
|
|
</el-button>
|
|
|
<el-button @click="cancel">取消</el-button>
|
|
|
</el-form-item>
|