diff --git a/OrangeFormsOpen-VUE3/src/api/flow/FlowOperationController.ts b/OrangeFormsOpen-VUE3/src/api/flow/FlowOperationController.ts index c1808b79..dc82777d 100644 --- a/OrangeFormsOpen-VUE3/src/api/flow/FlowOperationController.ts +++ b/OrangeFormsOpen-VUE3/src/api/flow/FlowOperationController.ts @@ -278,4 +278,12 @@ export default class FlowOperationController extends BaseController { httpOptions, ); } + // 获取用户任务信息 + static viewTaskFormKey(params: ANY_OBJECT, httpOptions?: RequestOption) { + return super.get( + API_CONTEXT + '/flow/flowOperation/viewTaskFormKey', + params, + httpOptions, + ); + } } diff --git a/OrangeFormsOpen-VUE3/src/api/system/DictionaryController.ts b/OrangeFormsOpen-VUE3/src/api/system/DictionaryController.ts index ab8648ab..a8fa542a 100644 --- a/OrangeFormsOpen-VUE3/src/api/system/DictionaryController.ts +++ b/OrangeFormsOpen-VUE3/src/api/system/DictionaryController.ts @@ -7,7 +7,8 @@ import { API_CONTEXT } from '../config'; export default class DictionaryController extends BaseController { static dictSysRole(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/upms/sysRole/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/upms/sysRole/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('角色字典', res.data); resolve(dictData); @@ -20,7 +21,8 @@ export default class DictionaryController extends BaseController { // 全局编码字典 static dictGlobalDict(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/upms/globalDict/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/upms/globalDict/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase( '编码字典', @@ -42,7 +44,8 @@ export default class DictionaryController extends BaseController { static dictGlobalDictByIds(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/upms/globalDict/listDictByIds', params, httpOptions) + super + .get(API_CONTEXT + '/upms/globalDict/listDictByIds', params, httpOptions) .then(res => { const dictData = new DictionaryBase('编码字典', res.data); resolve(dictData); @@ -55,7 +58,8 @@ export default class DictionaryController extends BaseController { static dictSysDept(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/upms/sysDept/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/upms/sysDept/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('部门字典', res.data); resolve(dictData); @@ -71,7 +75,8 @@ export default class DictionaryController extends BaseController { httpOptions?: RequestOption, ): Promise { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/upms/sysDept/listDictByParentId', params, httpOptions) + super + .get(API_CONTEXT + '/upms/sysDept/listDictByParentId', params, httpOptions) .then(res => { const dictData = new DictionaryBase('部门字典', res.data); resolve(dictData); @@ -84,7 +89,8 @@ export default class DictionaryController extends BaseController { static dictSysMenu(params: ANY_OBJECT, httpOptions?: RequestOption): Promise { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/upms/sysMenu/listMenuDict', params, httpOptions) + super + .get(API_CONTEXT + '/upms/sysMenu/listMenuDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('菜单字典', res.data); resolve(dictData); @@ -97,11 +103,12 @@ export default class DictionaryController extends BaseController { static dictDeptPost(params: ANY_OBJECT, httpOptions?: RequestOption): Promise { return new Promise((resolve, reject) => { - super.get( - API_CONTEXT + '/upms/sysDept/listSysDeptPostWithRelation', - params, - httpOptions, - ) + super + .get( + API_CONTEXT + '/upms/sysDept/listSysDeptPostWithRelation', + params, + httpOptions, + ) .then(res => { resolve(res.data); }) @@ -112,7 +119,8 @@ export default class DictionaryController extends BaseController { } static dictSysPost(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/upms/sysPost/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/upms/sysPost/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('岗位字典', res.data); resolve(dictData); @@ -125,7 +133,8 @@ export default class DictionaryController extends BaseController { static dictReportDblink(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/report/reportDblink/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/report/reportDblink/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('数据库链接', res.data); resolve(dictData); @@ -138,7 +147,8 @@ export default class DictionaryController extends BaseController { static dictReportDict(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/report/reportDict/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/report/reportDict/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('报表字典', res.data); resolve(dictData); @@ -150,7 +160,8 @@ export default class DictionaryController extends BaseController { } static dictAreaCode(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/app/areaCode/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/app/areaCode/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('行政区划', res.data); resolve(dictData); @@ -163,7 +174,8 @@ export default class DictionaryController extends BaseController { static dictAreaCodeByParentId(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/app/areaCode/listDictByParentId', params, httpOptions) + super + .get(API_CONTEXT + '/app/areaCode/listDictByParentId', params, httpOptions) .then(res => { const dictData = new DictionaryBase('行政区划', res.data); resolve(dictData); @@ -177,7 +189,8 @@ export default class DictionaryController extends BaseController { // 业务相关的接口 static dictKnowledge(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get('/admin/app/knowledge/listDict', params, httpOptions) + super + .get('/admin/app/knowledge/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('知识点字典', res.data); resolve(dictData); @@ -190,7 +203,8 @@ export default class DictionaryController extends BaseController { static dictStudent(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get(API_CONTEXT + '/app/student/listDict', params, httpOptions) + super + .get(API_CONTEXT + '/app/student/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('学生字典', res.data); dictData.setList(res.data); @@ -204,7 +218,8 @@ export default class DictionaryController extends BaseController { static dictTeacher(params: ANY_OBJECT, httpOptions?: RequestOption) { return new Promise((resolve, reject) => { - super.get('/admin/app/teacher/listDict', params, httpOptions) + super + .get('/admin/app/teacher/listDict', params, httpOptions) .then(res => { const dictData = new DictionaryBase('老师字典', res.data); resolve(dictData); diff --git a/OrangeFormsOpen-VUE3/src/common/staticDict/generated.ts b/OrangeFormsOpen-VUE3/src/common/staticDict/generated.ts index d82fcb10..1c7fb8db 100644 --- a/OrangeFormsOpen-VUE3/src/common/staticDict/generated.ts +++ b/OrangeFormsOpen-VUE3/src/common/staticDict/generated.ts @@ -1,4 +1,3 @@ import { DictionaryBase } from './types'; - export {}; diff --git a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomBlock.vue b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomBlock.vue index 4a00fe12..6ee19eba 100644 --- a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomBlock.vue +++ b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomBlock.vue @@ -220,7 +220,6 @@ const values = computed({ return props.value; }, set(val: Array) { - console.log('block values>>>>>>>>>>>>', val); emit('update:value', val); }, }); diff --git a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue index d6571685..9f663461 100644 --- a/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue +++ b/OrangeFormsOpen-VUE3/src/online/components/OnlineCustomWidget.vue @@ -355,6 +355,10 @@ const getWidgetProps = computed(() => { }); const getDisabledStatus = () => { + const formWidgetAuth: ANY_OBJECT | null = form().formAuth() + ? form().formAuth().pc[pps.widget.variableName] + : null; + if (formWidgetAuth && formWidgetAuth.disabled) return true; return pps.widget.props.disabled; }; diff --git a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineEditForm/index.vue b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineEditForm/index.vue index 315cf29b..0bc268f0 100644 --- a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineEditForm/index.vue +++ b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineEditForm/index.vue @@ -259,7 +259,6 @@ const { } = useForm(props); provide('form', () => { - console.log('provide form1', props, form); return { ...form.value, mode: props.mode || 'pc', diff --git a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineWorkFlowForm/index.vue b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineWorkFlowForm/index.vue index 0edd5585..3aecb0ae 100644 --- a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineWorkFlowForm/index.vue +++ b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/OnlineWorkFlowForm/index.vue @@ -68,6 +68,7 @@ const props = withDefaults( isEdit: false, readOnly: false, fullscreen: false, + flowInfo: undefined, mode: 'pc', }, ); @@ -82,6 +83,7 @@ const { rules, masterTable, formData, + formAuth, richEditWidgetList, tableWidgetList, getWidgetValue, @@ -132,6 +134,9 @@ provide('form', () => { return props.currentWidget === widget; }, getWidgetObject: widgetData.getWidgetObject, + formAuth: () => { + return formAuth.value; + }, }; }); @@ -228,23 +233,73 @@ const initFormData = () => { }); }; +const viewTaskFormKey = () => { + if ( + props.flowInfo == null || + props.flowInfo.taskId == null || + props.flowInfo.taskId === '' || + props.flowInfo.processInstanceId == null || + props.flowInfo.processInstanceId === '' + ) { + return Promise.resolve(); + } + let paraams = { + processInstanceId: props.flowInfo.processInstanceId, + taskId: props.flowInfo.taskId, + }; + return new Promise((resolve, reject) => { + FlowOperationController.viewTaskFormKey(paraams) + .then(res => { + try { + let temp = JSON.parse(res.data); + formAuth.value = temp.formAuth; + Object.keys(formAuth.value || {}).forEach(key => { + let formAuthItem = formAuth.value[key]; + Object.keys(formAuthItem).forEach(subKey => { + let authItem = formAuthItem[subKey]; + if (authItem && authItem != null && authItem !== '') { + formAuthItem[subKey] = authItem.split(',').map(item => parseInt(item)); + } else { + formAuthItem[subKey] = [0, 0]; + } + let disabled = formAuthItem[subKey][0] === 1; + let hide = formAuthItem[subKey][1] === 1; + formAuthItem[subKey].disabled = disabled; + formAuthItem[subKey].hide = hide; + }); + }); + console.log(formAuth.value); + } catch (e) { + formAuth.value = null; + } + resolve(); + }) + .catch(e => { + reject(e); + }); + }); +}; + onMounted(() => { isReady.value = false; if (!props.isEdit) { - initWidgetRule(); - - initFormData() - .then(() => { - initWidgetLinkage(); - setTimeout(() => { - componentRef.value.clearValidate(); + viewTaskFormKey().then(() => { + initWidgetRule(); + initFormData() + .then(() => { + initWidgetLinkage(); + setTimeout(() => { + componentRef.value.clearValidate(); + }); + }) + .catch((e: Error) => { + console.warn(e); }); - }) - .catch((e: Error) => { - console.warn(e); - }); + isReady.value = true; + }); + } else { + isReady.value = true; } - isReady.value = true; }); const getFormDataImpl = (variableList: ANY_OBJECT[] | null = null) => { diff --git a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts index 0bd24c51..ab8cdd1d 100644 --- a/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts +++ b/OrangeFormsOpen-VUE3/src/pages/online/OnlinePageRender/hooks/useForm.ts @@ -142,7 +142,11 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref | null = n return getSystemVariableValue(widget.bindData.systemVariableType); } }; - const getWidgetVisible = () => { + const getWidgetVisible = widget => { + const formWidgetAuth: ANY_OBJECT | null = formAuth.value + ? formAuth.value.pc[widget.variableName] + : null; + if (formWidgetAuth && formWidgetAuth.hide) return false; return true; }; const onValueChange = (widget: ANY_OBJECT, value: ANY_OBJECT) => { @@ -295,7 +299,8 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref | null = n } }; const checkOperationPermCode = (operation: ANY_OBJECT | null) => { - if (dialogParams.value.formConfig.formType !== SysOnlineFormType.QUERY || props.isEdit) return true; + if (dialogParams.value.formConfig.formType !== SysOnlineFormType.QUERY || props.isEdit) + return true; return checkPermCodeExist(getOperationPermCode(operation)); }; const checkOperationDisabled = ( @@ -592,7 +597,9 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref | null = n }); } if (widget.props.dictInfo && widget.props.dictInfo.dictId) { - widget.props.dictInfo.dict = dialogParams.value.formConfig.dictMap.get(widget.props.dictInfo.dictId); + widget.props.dictInfo.dict = dialogParams.value.formConfig.dictMap.get( + widget.props.dictInfo.dictId, + ); } if (widget.column && widget.column.dictInfo != null) { dropdownWidgetList.push(widget); @@ -663,8 +670,10 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref | null = n }); } errorMessage.value = []; - if (dialogParams.value.formConfig.tableWidget) initWidget(dialogParams.value.formConfig.tableWidget); - if (dialogParams.value.formConfig.leftWidget) initWidget(dialogParams.value.formConfig.leftWidget); + if (dialogParams.value.formConfig.tableWidget) + initWidget(dialogParams.value.formConfig.tableWidget); + if (dialogParams.value.formConfig.leftWidget) + initWidget(dialogParams.value.formConfig.leftWidget); if (errorMessage.value.length > 0) { console.error(errorMessage); } @@ -899,12 +908,15 @@ export const useForm = (props: ANY_OBJECT, formRef: Ref | null = n }); }; + const formAuth = ref(); + return { rules, isReady, dialogParams, form, formData, + formAuth, masterTable, isRelation, tableWidgetList, diff --git a/OrangeFormsOpen-VUE3/src/pages/workflow/handlerFlowTask/index.vue b/OrangeFormsOpen-VUE3/src/pages/workflow/handlerFlowTask/index.vue index 19775f2e..c99d36ce 100644 --- a/OrangeFormsOpen-VUE3/src/pages/workflow/handlerFlowTask/index.vue +++ b/OrangeFormsOpen-VUE3/src/pages/workflow/handlerFlowTask/index.vue @@ -352,42 +352,43 @@ const handlerStart = ( } else { preHandlerOperation(operation, true, xml) .then(res => { - getMasterData(operation.type, (res || {}).assignee).then(formData => { - FlowOperationController.startAndTakeUserTask( - { - processDefinitionKey: dialogParams.value.processDefinitionKey, - masterData: formData.masterData || {}, - slaveData: formData.slaveData, - taskVariableData: { - ...formData.taskVariableData, - latestApprovalStatus: operation.latestApprovalStatus, + getMasterData(operation.type, (res || {}).assignee) + .then(formData => { + FlowOperationController.startAndTakeUserTask( + { + processDefinitionKey: dialogParams.value.processDefinitionKey, + masterData: formData.masterData || {}, + slaveData: formData.slaveData, + taskVariableData: { + ...formData.taskVariableData, + latestApprovalStatus: operation.latestApprovalStatus, + }, + flowTaskCommentDto: { + approvalType: operation.type, + }, + copyData: (copyItemList || []).reduce((retObj, item) => { + retObj[item.type] = item.id; + return retObj; + }, {}), }, - flowTaskCommentDto: { - approvalType: operation.type, + { + // 判断是否是从流程设计里启动 + processDefinitionKey: isPreview.value + ? undefined + : dialogParams.value.processDefinitionKey, }, - copyData: (copyItemList || []).reduce((retObj, item) => { - retObj[item.type] = item.id; - return retObj; - }, {}), - }, - { - // 判断是否是从流程设计里启动 - processDefinitionKey: isPreview.value - ? undefined - : dialogParams.value.processDefinitionKey, - }, - ) - .then(() => { - handlerClose(); - ElMessage.success('启动成功!'); - }) - .catch(e => { - console.warn(e); - }); - }) - .catch(e => { - console.warn(e); - }); + ) + .then(() => { + handlerClose(); + ElMessage.success('启动成功!'); + }) + .catch(e => { + console.warn(e); + }); + }) + .catch(e => { + console.warn(e); + }); }) .catch(e => { console.warn(e); diff --git a/OrangeFormsOpen-VUE3/src/pages/workflow/package/refactor/form/flowFormConfig.vue b/OrangeFormsOpen-VUE3/src/pages/workflow/package/refactor/form/flowFormConfig.vue index a1de6995..055969d8 100644 --- a/OrangeFormsOpen-VUE3/src/pages/workflow/package/refactor/form/flowFormConfig.vue +++ b/OrangeFormsOpen-VUE3/src/pages/workflow/package/refactor/form/flowFormConfig.vue @@ -35,16 +35,36 @@ /> - - - + + + + + + + + + + + +