소스 검색

Merge remote-tracking branch 'origin/master'

lanceJiang 1 년 전
부모
커밋
552c9daa95

+ 1 - 1
src/components/scWorkflow/nodes/promoter.vue

@@ -36,7 +36,7 @@
 				<el-main>
 					<el-form label-position="top">
 						<el-form-item label="谁可以发起此审批">
-							<el-button type="primary" icon="plus" round @click="selectHandle(2, form.nodeAssigneeList)">选择角色</el-button>
+							<el-button type="primary" icon="plus" round @click="selectHandle(3, form.nodeAssigneeList)">选择角色</el-button>
 							<div class="tags-list">
 								<el-tag v-for="(role, index) in form.nodeAssigneeList" :key="role.id" type="info" closable @close="delRole(index)">{{
 									role.name

+ 3 - 1
src/layout/components/Header/components/Avatar.vue

@@ -28,7 +28,7 @@ import useStore from '@/store'
 import { useRoute, useRouter } from 'vue-router'
 
 import { ElMessageBox } from 'element-plus'
-const { setting, app, user } = useStore()
+const { setting, app, user /*, flow*/ } = useStore()
 const router = useRouter()
 const route = useRoute()
 const userInfo = computed(() => {
@@ -43,6 +43,8 @@ function logout() {
 		cancelButtonText: '取消',
 		type: 'warning'
 	}).then(() => {
+		// flow.$reset()
+		localStorage.clear()
 		user.logout().then(() => {
 			router.push(`/login?redirect=${route.fullPath}`)
 		})

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

@@ -26,7 +26,9 @@ export const useFlowStore = defineStore({
 
 			cacheSwitch: false, // 缓存开关
 			modelContent: '', // 流程模型定义JSON内容
+			// processForm: {}, // 流程定义表单
 			processForm: '{}', // 流程定义表单
+			businessForm: {},
 			processSetting: {
 				allowRevocation: true, // 允许撤销审批中的申请
 				allowRevocationDay: true, // 允许撤销指定天内通过的审批

+ 4 - 4
src/views/flow/create/business.vue

@@ -54,7 +54,7 @@ const { tagsView } = useStore()
 const router = useRouter()
 const route = useRoute()
 const flowStore = useFlowStore()
-const { categoryId, formId, processId, processIcon, processKey, processName, remark, modelContent, processForm, processSetting } = storeToRefs(flowStore)
+const { categoryId, formId, processId, processIcon, processKey, processName, remark, modelContent, businessForm, processSetting } = storeToRefs(flowStore)
 
 const compRefs = ref() // 实例化子组件
 const cache_components = ref({})
@@ -115,7 +115,7 @@ const submitHandler = async () => {
 		processName: processName.value,
 		remark: remark.value,
 		processId: processId.value,
-		processForm: processForm.value,
+		businessForm: JSON.stringify(businessForm.value),
 		modelContent: JSON.stringify({
 			key: processKey.value,
 			name: processName.value,
@@ -194,8 +194,8 @@ const getCurrentProcessDetailEv = () => {
 			remark.value = res.remark
 			let nodeConfig = JSON.parse(res.modelContent).nodeConfig
 			modelContent.value = JSON.stringify(nodeConfig)
-			processForm.value = res.processForm
-			flowStore.setProcessForm(processForm)
+			businessForm.value = JSON.parse(res.businessForm || '{}') || {}
+			// flowStore.setProcessForm(processForm)
 			flowStore.setProcessSetting(res.processSetting)
 			// 默认执行一次保存
 			const _refs = compRefs.value

+ 3 - 3
src/views/flow/create/child.vue

@@ -100,7 +100,7 @@ const submitHandler = async () => {
 		processName: processName.value,
 		remark: remark.value,
 		processId: processId.value,
-		processForm: processForm.value,
+		processForm: JSON.stringify(processForm.value),
 		modelContent: JSON.stringify({
 			key: processKey.value,
 			name: processName.value,
@@ -179,8 +179,8 @@ const getCurrentProcessDetailEv = () => {
 			remark.value = res.remark
 			let nodeConfig = JSON.parse(res.modelContent).nodeConfig
 			modelContent.value = JSON.stringify(nodeConfig)
-			processForm.value = res.processForm
-			flowStore.setProcessForm(processForm)
+			processForm.value = JSON.parse(res.processForm) || {}
+			// flowStore.setProcessForm(processForm)
 			flowStore.setProcessSetting(res.processSetting)
 			// 默认执行一次保存
 			const _refs = compRefs.value

+ 9 - 5
src/views/flow/create/components/BasicInfo.vue

@@ -44,10 +44,13 @@ const rules = {
 			trigger: 'blur'
 		}
 	],
-	formId: [
+	businessForm: [
 		{
 			required: true,
-			message: '请选择流程表单',
+			validator: (rule, value, callback) => {
+				if (!value || !value.formId) return callback('请选择流程表单')
+				callback()
+			},
 			trigger: 'change'
 		}
 	],
@@ -177,9 +180,10 @@ defineExpose({
 				<el-form-item label="名称" prop="processName">
 					<el-input v-model="flowInfo.processName" clearable maxlength="15"></el-input>
 				</el-form-item>
-				<el-form-item v-if="from === 'business'" prop="formId">
-					<SelectProcessForm v-model="flowInfo.formId" />
-					<el-input class="hidden" :model-value="flowInfo.formId" />
+				<el-form-item v-if="from === 'business'" prop="businessForm">
+					<SelectProcessForm v-model="flowInfo.businessForm" />
+					<el-input class="hidden" :model-value="flowInfo.businessForm.formId" />
+					<el-input class="hidden" :model-value="flowInfo.businessForm.formName" />
 				</el-form-item>
 				<el-form-item label="说明" prop="remark">
 					<el-input v-model="flowInfo.remark" type="textarea" clearable></el-input>

+ 13 - 26
src/views/flow/create/components/SelectProcessForm.vue

@@ -1,7 +1,7 @@
 <template>
 	<div>
 		<el-button type="primary" icon="plus" round @click="selectProcessForm">选择流程表单</el-button>
-		<el-tag v-if="modelValue" class="ml-2" size="small" closable @close="delProcessForm">{{ selected_label || '-' }}</el-tag>
+		<el-tag v-if="modelValue?.formId" class="ml-2" size="small" closable @close="delProcessForm">{{ selected_label || '-' }}</el-tag>
 		<!-- 查看流程表单 查看 -->
 		<el-dialog v-model="visible" class="le-dialog local-select-process-form-dialog" title="选择流程表单" width="272">
 			<!--			<el-scrollbar max-height="400px">
@@ -22,8 +22,8 @@
 				value-key="id"
 				label-key="name"
 				:loading="optionsRef.loading"
+				@update:selected_label="update_selected_label"
 			>
-				<!--				@update:selected_label="update_selected_label"-->
 				<template #default="{ item, index, disabled }">
 					<div class="item">
 						{{ item.name }} <el-tag class="ml-2" size="small">{{ typeOptions_config[item.type] || '-' }}</el-tag>
@@ -49,8 +49,8 @@ import { typeOptions_config } from '@/views/flow/form/data.tsx'
 const props = defineProps({
 	modelValue: {
 		required: true,
-		type: String
-		// default: ''
+		type: Object as PropType<{ formId: string; formName?: string }>,
+		default: () => ({ formId: undefined, formName: undefined })
 	}
 	// value: {
 	// 	type: String,
@@ -62,7 +62,7 @@ const localValue = ref<any>(undefined)
 watch(
 	() => props.modelValue,
 	val => {
-		localValue.value = val
+		localValue.value = val?.formId
 	}
 )
 const optionsRef = ref({ list: [], loading: false })
@@ -73,35 +73,28 @@ formtemplate.formTemplatePageApi({ page: 1, pageSize: 9999 }).then((res: any) =>
 	}
 })
 const selected = computed(() => {
-	const modelValue = props.modelValue
-	return optionsRef.value.list.find(v => v.id === modelValue)
+	const formId = props.modelValue.formId
+	return optionsRef.value.list.find(v => v.id === formId)
 })
 const selected_label = computed(() => {
 	return selected.value?.name
 })
+const local_selected_label = ref()
 const update_selected_label = (label: string) => {
-	console.log(label, 'label')
-	selected_label.value = label
+	// console.log(label, 'label')
+	local_selected_label.value = label
 }
 const visible = ref(false)
 const selectProcessForm = () => {
 	console.log('selectProcessForm')
 	visible.value = true
-	localValue.value = props.modelValue
+	localValue.value = props.modelValue?.formId
 }
 const delProcessForm = () => {
 	console.log('delProcessForm')
-	emits('update:modelValue', undefined)
+	emits('update:modelValue', {})
 }
 
-const validateForm = ref({
-	rule: [],
-	loading: false
-})
-const EReditorRef = ref()
-const modelContentConfig = ref({})
-const activeData = ref([])
-
 const queryDetail = () => {}
 onMounted(queryDetail)
 const closeDialog = () => {
@@ -109,7 +102,7 @@ const closeDialog = () => {
 	visible.value = false
 }
 const submit = () => {
-	emits('update:modelValue', localValue.value)
+	emits('update:modelValue', { formId: localValue.value, formName: local_selected_label.value })
 	closeDialog()
 }
 
@@ -121,12 +114,6 @@ const submit = () => {
 		$myEmit('update:modelValue', val)
 	}
 })*/
-watch(
-	() => props.value,
-	val => {
-		console.error(val, 'props.value')
-	}
-)
 </script>
 
 <style scoped lang="scss">

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

@@ -193,7 +193,6 @@ const getCurrentProcessDetailEv = () => {
 			let nodeConfig = JSON.parse(res.modelContent).nodeConfig
 			modelContent.value = JSON.stringify(nodeConfig)
 			processForm.value = res.processForm
-			flowStore.setProcessForm(processForm)
 			flowStore.setProcessSetting(res.processSetting)
 			// 默认执行一次保存
 			const _refs = compRefs.value