@javaguns/flow-ui
Version:
``` <template> <a-spin :spinning="loading"> <FlowDesigner ref="flowDesigner" top="50px"> </FlowDesigner> </a-spin> </template> <script lang="ts" setup> import { ref, provide, onMounted } from 'vue'; import { FlowDesigner, LoadingKey } from '@j
2 lines (1 loc) • 5.16 kB
JavaScript
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("@javaguns/utils"),s=require("@javaguns/icon"),c=require("../../utils/dataApi.js"),C=require("../common/flowSelect.vue.js"),N=e.defineComponent({name:"flow-base-setting"}),b=e.defineComponent({...N,props:{modelId:{},definitionId:{}},setup(V,{expose:w}){const _=u.pluginManager.getComponent("Alert"),p=u.pluginManager.getComponent("Row"),l=u.pluginManager.getComponent("Col"),r=u.pluginManager.getComponent("Input"),h=u.pluginManager.getComponent("Button"),x=u.pluginManager.getComponent("Popconfirm"),d=V,n=e.ref([]),m="说明:用来维护流程流转过程中、各个节点需要使用到的属性信息、主要用在条件判断节点",y=e.reactive([{value:"input",name:"文本框"},{value:"number",name:"数字框"},{value:"textarea",name:"文本域"},{value:"select",name:"下拉框"},{value:"selectMultiple",name:"下拉框(多选)"},{value:"radio",name:"单选框"},{value:"checkbox",name:"复选框"},{value:"user",name:"用户控件"},{value:"dept",name:"部门控件"},{value:"date",name:"日期控件"},{value:"datetime",name:"日期时间控件"},{value:"time",name:"时间"}]);e.onMounted(()=>{f(d.modelId),console.log(n.value)});const f=async o=>{const i={formModelId:o,classify:3},t=await c.getFlowVariableFields(i);t&&t.data&&t.data.data&&t.data.data.length>0?n.value=t.data.data:g()},g=()=>{n.value.push({fieldId:u.getId(),formModelId:d.modelId,formDefinitionId:d.definitionId,fieldName:"",fieldKey:"",fieldModel:"",fieldType:"input",width:"100",topic:!1,summary:!1,required:!1,disabled:!1,classify:3,add:!0,key:Date.now()})},v=async o=>{if(o.add){let i=n.value.indexOf(o);i!==-1&&n.value.splice(i,1)}else await c.deleteFlowVariableFields({fieldId:o.fieldId}),f(d.modelId)};return w({save:async()=>{try{return await c.saveFlowVariableFields(n.value),f(d.modelId),!0}catch{return!1}}}),(o,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(_),{message:m,title:m,type:"warning"}),e.createVNode(e.unref(p),{style:{"margin-top":"10px"}},{default:e.withCtx(()=>[e.createVNode(e.unref(l),{span:6,class:"guns-flow-variable-setting-header"},{default:e.withCtx(()=>[e.createTextVNode("显示名")]),_:1}),e.createVNode(e.unref(l),{span:5,class:"guns-flow-variable-setting-header"},{default:e.withCtx(()=>[e.createTextVNode("属性名")]),_:1}),e.createVNode(e.unref(l),{span:5,class:"guns-flow-variable-setting-header"},{default:e.withCtx(()=>[e.createTextVNode("列名")]),_:1}),e.createVNode(e.unref(l),{span:6,class:"guns-flow-variable-setting-header"},{default:e.withCtx(()=>[e.createTextVNode("组件")]),_:1}),e.createVNode(e.unref(l),{span:2,class:"guns-flow-variable-setting-header"},{default:e.withCtx(()=>[e.createTextVNode("操作")]),_:1})]),_:1}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,t=>(e.openBlock(),e.createBlock(e.unref(p),{key:t.fieldId,gutter:8},{default:e.withCtx(()=>[e.createVNode(e.unref(l),{span:6,class:"guns-flow-variable-setting-body"},{default:e.withCtx(()=>[e.createVNode(e.unref(r),{value:t.fieldName,"onUpdate:value":a=>t.fieldName=a,modelValue:t.fieldName,"onUpdate:modelValue":a=>t.fieldName=a,placeholder:"请输入显示名"},null,8,["value","onUpdate:value","modelValue","onUpdate:modelValue"])]),_:2},1024),e.createVNode(e.unref(l),{span:5,class:"guns-flow-variable-setting-body"},{default:e.withCtx(()=>[e.createVNode(e.unref(r),{value:t.fieldKey,"onUpdate:value":a=>t.fieldKey=a,modelValue:t.fieldKey,"onUpdate:modelValue":a=>t.fieldKey=a,placeholder:"请输入属性名"},null,8,["value","onUpdate:value","modelValue","onUpdate:modelValue"])]),_:2},1024),e.createVNode(e.unref(l),{span:5,class:"guns-flow-variable-setting-body"},{default:e.withCtx(()=>[e.createVNode(e.unref(r),{value:t.fieldModel,"onUpdate:value":a=>t.fieldModel=a,modelValue:t.fieldModel,"onUpdate:modelValue":a=>t.fieldModel=a,placeholder:"请输入列名"},null,8,["value","onUpdate:value","modelValue","onUpdate:modelValue"])]),_:2},1024),e.createVNode(e.unref(l),{span:6,class:"guns-flow-variable-setting-body"},{default:e.withCtx(()=>[e.createVNode(C.default,{modelValue:t.fieldType,"onUpdate:modelValue":a=>t.fieldType=a,mode:"simple",datas:y},null,8,["modelValue","onUpdate:modelValue","datas"])]),_:2},1024),e.createVNode(e.unref(l),{span:2,class:"guns-flow-variable-setting-body"},{default:e.withCtx(()=>[t.add?(e.openBlock(),e.createBlock(e.unref(s.IconDeleteOutline),{key:0,onClick:a=>v(t)},null,8,["onClick"])):(e.openBlock(),e.createBlock(e.unref(x),{key:1,title:"确定要删除此记录吗?",width:"200","ok-text":"删除","cancel-text":"关闭","confirm-button-text":"删除","cancel-button-text":"关闭",onConfirm:a=>v(t)},{reference:e.withCtx(()=>[e.createVNode(e.unref(s.IconDeleteOutline))]),default:e.withCtx(()=>[e.createVNode(e.unref(s.IconDeleteOutline))]),_:2},1032,["onConfirm"]))]),_:2},1024)]),_:2},1024))),128)),e.createVNode(e.unref(h),{class:"guns-flow-variable-setting-butoon",onClick:g},{default:e.withCtx(()=>[e.createVNode(e.unref(s.IconPlusOutline))]),_:1})],64))}});exports.default=b;