Browse Source

Merge remote-tracking branch 'origin/master'

hubin 1 year ago
parent
commit
d55c34c7e1

+ 1 - 1
src/store/modules/flow.ts

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

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

@@ -115,7 +115,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,
@@ -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)
+			processForm.value = JSON.parse(res.processForm) || {}
+			// 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: [
+	processForm: [
 		{
 			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="processForm">
+					<SelectProcessForm v-model="flowInfo.processForm" />
+					<el-input class="hidden" :model-value="flowInfo.processForm.formId" />
+					<el-input class="hidden" :model-value="flowInfo.processForm.formName" />
 				</el-form-item>
 				<el-form-item label="说明" prop="remark">
 					<el-input v-model="flowInfo.remark" type="textarea" clearable></el-input>

+ 9 - 23
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">
@@ -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,8 +73,8 @@ 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
@@ -87,21 +87,13 @@ 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 +101,7 @@ const closeDialog = () => {
 	visible.value = false
 }
 const submit = () => {
-	emits('update:modelValue', localValue.value)
+	emits('update:modelValue', { formId: localValue.value, formName: selected_label.value })
 	closeDialog()
 }
 
@@ -121,12 +113,6 @@ const submit = () => {
 		$myEmit('update:modelValue', val)
 	}
 })*/
-watch(
-	() => props.value,
-	val => {
-		console.error(val, 'props.value')
-	}
-)
 </script>
 
 <style scoped lang="scss">

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

@@ -113,7 +113,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,
@@ -192,8 +192,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