فهرست منبع

feat: 发起流程支持表单权限

luoyali 7 ماه پیش
والد
کامیت
fcd21721ba

+ 15 - 13
src/components/scWorkflow/nodes/promoter.vue

@@ -31,7 +31,7 @@
 							</div>
 						</el-form-item>
 
-						<el-form-item label="表单权限">
+						<el-form-item label="表单权限" v-if="processType === 'main'">
 							<el-table ref="multipleTableRef" :data="form.extendConfig.formConfig" style="width: 100%" border>
 								<el-table-column property="label" label="表单字段" align="center" />
 								<el-table-column align="center">
@@ -86,7 +86,7 @@ export default {
 		/*Plus() {
 			return Plus
 		},*/
-		...mapState(useFlowStore, ['processForm']) //映射函数,取出processForm
+		...mapState(useFlowStore, ['processForm', 'processType']) //映射函数,取出processForm\processType
 	},
 	watch: {
 		modelValue() {
@@ -101,18 +101,20 @@ export default {
 			if (this.disabled) return
 			this.form = JSON.parse(JSON.stringify(this.nodeConfig))
 			/* 自定义表单权限 - 发起人*/
-			const { formStructure } = JSON.parse(this.processForm)
-			const formConfig = this.form.extendConfig?.formConfig || []
-			const operateTable = (formStructure?.fields || []).map(item => {
-				let opera = '1'
-				formConfig.map(i => {
-					if (item.id === i.id) {
-						opera = i.opera
-					}
+			if (this.processType === 'main') {
+				const { formStructure } = JSON.parse(this.processForm)
+				const formConfig = this.form.extendConfig?.formConfig || []
+				const operateTable = (formStructure?.fields || []).map(item => {
+					let opera = '1'
+					formConfig.map(i => {
+						if (item.id === i.id) {
+							opera = i.opera
+						}
+					})
+					return { label: item.label, id: item.id, opera: opera }
 				})
-				return { label: item.label, id: item.id, opera: opera }
-			})
-			this.form.extendConfig = { formConfig: operateTable }
+				this.form.extendConfig = { formConfig: operateTable }
+			}
 			/* 自定义表单权限 - 发起人*/
 			this.isEditTitle = false
 			this.drawer = true

+ 4 - 0
src/store/modules/flow.ts

@@ -5,6 +5,7 @@ export const useFlowStore = defineStore({
 	id: 'flow',
 	state: () => {
 		return {
+			processType: '', // child: 子流程,main: 主流程 business: 业务流程
 			storeInfoName: '',
 			processId: '',
 			processKey: '', // 唯一标识
@@ -57,6 +58,9 @@ export const useFlowStore = defineStore({
 		// 流程设置
 		setProcessSetting(value: any) {
 			this.processSetting = value
+		},
+		setProcessType(value: string) {
+			this.processType = value
 		}
 	},
 	persist: true

+ 1 - 0
src/views/flow/create/business.vue

@@ -195,6 +195,7 @@ const isView = computed(() => {
 	return queryObj.value?.view === '1'
 })
 const getCurrentProcessDetailEv = () => {
+	flowStore.setProcessType('business')
 	let _id = queryObj.value.id
 	if (_id) {
 		cache_components.value = {}

+ 2 - 1
src/views/flow/create/child.vue

@@ -27,7 +27,7 @@
 			</div>
 		</div>
 		<div class="create-approval-main">
-			<component :is="item.component" v-for="(item, idx) in componentsArr" v-show="item.value === activeTab" ref="compRefs" :key="idx" />
+			<component :is="item.component" v-for="(item, idx) in componentsArr" v-show="item.value === activeTab" ref="compRefs" :key="idx" 	from="child"/>
 		</div>
 	</div>
 </template>
@@ -168,6 +168,7 @@ const isView = computed(() => {
 	return queryObj.value?.view === '1'
 })
 const getCurrentProcessDetailEv = () => {
+	flowStore.setProcessType('child')
 	let _id = queryObj.value.id
 	if (_id) {
 		cache_components.value = {}

+ 1 - 0
src/views/flow/create/index.vue

@@ -188,6 +188,7 @@ const isView = computed(() => {
 	return queryObj.value?.view === '1'
 })
 const getCurrentProcessDetailEv = () => {
+	flowStore.setProcessType('main')
 	let _id = queryObj.value.id
 	if (_id) {
 		cache_components.value = {}