Bladeren bron

Merge branch 'feat/business'

lanceJiang 1 jaar geleden
bovenliggende
commit
a5943adf4d

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

@@ -14,6 +14,7 @@ export const useFlowStore = defineStore({
 			remark: '', // 备注说明
 			createTime: '', // 创建时间
 			useScope: 0, // 使用范围 0,全员 1,指定人员(业务关联) 2,均不可提交
+			formId: undefined, //业务审批 表单Id
 			// processActorList: [
 			// 	{
 			// 		actorId: 0, // 参与者ID

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

@@ -27,7 +27,14 @@
 			</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="business"
+			/>
 		</div>
 	</div>
 </template>
@@ -42,12 +49,12 @@ import { useRoute, useRouter } from 'vue-router'
 import process from '@/api/flow/process'
 import useStore from '@/store'
 import { ElMessage } from 'element-plus'
-import ExtendSetTab from "@/views/flow/create/components/ExtendSet.vue";
+import ExtendSetTab from '@/views/flow/create/components/ExtendSet.vue'
 const { tagsView } = useStore()
 const router = useRouter()
 const route = useRoute()
 const flowStore = useFlowStore()
-const { categoryId, processId, processIcon, processKey, processName, remark, modelContent, processForm, processSetting } = storeToRefs(flowStore)
+const { categoryId, formId, processId, processIcon, processKey, processName, remark, modelContent, processForm, processSetting } = storeToRefs(flowStore)
 
 const compRefs = ref() // 实例化子组件
 const cache_components = ref({})
@@ -103,6 +110,7 @@ const submitHandler = async () => {
 		categoryId: categoryId.value,
 		processIcon: processIcon.value,
 		processType: 'business',
+		formId: formId.value,
 		processKey: processKey.value,
 		processName: processName.value,
 		remark: remark.value,

+ 18 - 0
src/views/flow/create/components/BasicInfo.vue

@@ -5,6 +5,13 @@ import UseSelect from '@/components/scWorkflow/select'
 import group from '@/api/flow/group'
 import { useRoute } from 'vue-router'
 import { flowIconPrefix, ImageArr } from '@/utils/index'
+import SelectProcessForm from './SelectProcessForm.vue'
+const props = defineProps({
+	from: {
+		type: String,
+		default: ''
+	}
+})
 const route = useRoute()
 const flowInfo = useFlowStore()
 const visiblePopover = ref(false)
@@ -37,6 +44,13 @@ const rules = {
 			trigger: 'blur'
 		}
 	],
+	formId: [
+		{
+			required: true,
+			message: '请选择流程表单',
+			trigger: 'change'
+		}
+	],
 	categoryId: [
 		{
 			required: true,
@@ -163,6 +177,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>
 				<el-form-item label="说明" prop="remark">
 					<el-input v-model="flowInfo.remark" type="textarea" clearable></el-input>
 				</el-form-item>

+ 150 - 0
src/views/flow/create/components/SelectProcessForm.vue

@@ -0,0 +1,150 @@
+<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-dialog v-model="visible" class="le-dialog local-select-process-form-dialog" title="选择流程表单" width="272">
+			<!--			<el-scrollbar max-height="400px">
+				<div class="content">
+					<div v-for="(_, i) of Array.from({ length: 40 })" :key="i">
+						我是内容 <br />
+						{{ i }}
+					</div>
+				</div>
+			</el-scrollbar>-->
+			<!--			240+32-->
+			<le-select
+				v-model="localValue"
+				class="w-[240px]"
+				:height="600"
+				:is-popover="false"
+				:options="optionsRef.list"
+				value-key="id"
+				label-key="name"
+				:loading="optionsRef.loading"
+			>
+				<!--				@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>
+					</div>
+				</template>
+			</le-select>
+			<template #footer>
+				<el-button @click="closeDialog">关 闭</el-button>
+				<el-button type="primary" @click="submit">确 定</el-button>
+			</template>
+		</el-dialog>
+	</div>
+</template>
+
+<script setup lang="ts">
+import { computed, onMounted, type PropType, reactive, ref, watch } from 'vue'
+import formtemplate from '@/api/flow/formtemplate.ts'
+import { typeOptions_config } from '@/views/flow/form/data.tsx'
+// import { processTaskApprovalInfo } from '@/api/flow/processTask'
+// import { ElMessage } from 'element-plus'
+// import { formatTimestamp } from '@/utils/datetime.ts'
+
+const props = defineProps({
+	modelValue: {
+		required: true,
+		type: String
+		// default: ''
+	}
+	// value: {
+	// 	type: String,
+	// 	default: ''
+	// }
+})
+const emits = defineEmits(['update:modelValue' /*, 'update:value'*/])
+const localValue = ref<any>(undefined)
+watch(
+	() => props.modelValue,
+	val => {
+		localValue.value = val
+	}
+)
+const optionsRef = ref({ list: [], loading: false })
+formtemplate.formTemplatePageApi({ page: 1, pageSize: 9999 }).then((res: any) => {
+	optionsRef.value = {
+		loading: false,
+		list: res.records
+	}
+})
+const selected = computed(() => {
+	const modelValue = props.modelValue
+	return optionsRef.value.list.find(v => v.id === modelValue)
+})
+const selected_label = computed(() => {
+	return selected.value?.name
+})
+const update_selected_label = (label: string) => {
+	console.log(label, 'label')
+	selected_label.value = label
+}
+const visible = ref(false)
+const selectProcessForm = () => {
+	console.log('selectProcessForm')
+	visible.value = true
+	localValue.value = props.modelValue
+}
+const delProcessForm = () => {
+	console.log('delProcessForm')
+	emits('update:modelValue', undefined)
+}
+
+const validateForm = ref({
+	rule: [],
+	loading: false
+})
+const EReditorRef = ref()
+const modelContentConfig = ref({})
+const activeData = ref([])
+
+const queryDetail = () => {}
+onMounted(queryDetail)
+const closeDialog = () => {
+	// emits('update:modelValue', false)
+	visible.value = false
+}
+const submit = () => {
+	emits('update:modelValue', localValue.value)
+	closeDialog()
+}
+
+/*const visible = computed({
+	get() {
+		return props.modelValue
+	},
+	set(val) {
+		$myEmit('update:modelValue', val)
+	}
+})*/
+watch(
+	() => props.value,
+	val => {
+		console.error(val, 'props.value')
+	}
+)
+</script>
+
+<style scoped lang="scss">
+.flow-detail-content {
+}
+.item {
+	display: flex;
+	align-items: center;
+}
+</style>
+<style lang="scss">
+// 全局样式
+.local-select-process-form-dialog {
+	.el-dialog__body {
+		//height: calc(100vh - 160px);
+		//height: calc(100vh - 200px);
+		//max-height: calc(100vh - 200px);
+		padding: 12px 16px;
+	}
+}
+</style>