Browse Source

feat: 人员流程任务 -》 指定成员 -》 人员选择 添加搜索条件

luoyali 1 year ago
parent
commit
bb194b6828

+ 1 - 0
package.json

@@ -22,6 +22,7 @@
   "dependencies": {
     "@codemirror/lang-cpp": "^6.0.2",
     "@codemirror/lang-javascript": "^6.2.2",
+    "@codemirror/lang-json": "^6.0.1",
     "@codemirror/lang-python": "^6.1.6",
     "@codemirror/theme-one-dark": "^6.1.2",
     "@element-plus/icons-vue": "^2.3.1",

+ 3 - 2
src/components/CodeMirrorEditor/index.vue

@@ -3,6 +3,7 @@ import { watch, ref, toRefs, computed } from 'vue'
 import { Codemirror } from 'vue-codemirror'
 import { javascript } from '@codemirror/lang-javascript'
 import { python } from '@codemirror/lang-python'
+import { json } from '@codemirror/lang-json'
 // import { oneDark } from '@codemirror/theme-one-dark'
 const code = ref('')
 const props = defineProps({
@@ -29,9 +30,9 @@ const props = defineProps({
 const emit = defineEmits(['update:modelValue'])
 const { modelValue, language, disabled, style } = toRefs(props)
 const fullScreen = ref(false)
-const lang = { javascript, python }[language.value]
+const lang = json()
 // const extensions = [lang(), oneDark]
-const extensions = [lang()]
+const extensions = [lang]
 watch(
 	() => modelValue.value,
 	val => {

+ 3 - 2
src/components/scWorkflow/select.vue

@@ -12,7 +12,7 @@
 			<div class="sc-user-select">
 				<div class="sc-user-select__left">
 					<div class="sc-user-select__search">
-						<el-input v-model="keyword" prefix-icon="Search" placeholder="搜索成员">
+						<el-input v-model="username" prefix-icon="Search" placeholder="搜索成员">
 							<template #append>
 								<el-button icon="Search" @click="search"></el-button>
 							</template>
@@ -259,6 +259,7 @@ export default {
 			showGrouploading: false,
 			showUserloading: false,
 			keyword: '',
+      username: '',
 			groupId: '',
 			pageSize: config.user.pageSize,
 			total: 0,
@@ -323,7 +324,7 @@ export default {
 			this.showUserloading = true
 			var params = {
 				data: {
-					keyword: this.keyword || null,
+					username: this.username || null,
 					departmentId: this.groupId || null
 				},
 				page: this.currentPage,

+ 23 - 21
src/views/flow/create/components/FlowDesign.vue

@@ -1,18 +1,17 @@
 <script setup name="FlowDesign">
 import { onMounted, ref, watch } from 'vue'
-// import JsonEditorVue from 'json-editor-vue3'
 import CodeMirrorEditor from '@/components/CodeMirrorEditor/index.vue'
 
 import ScWorkflow from '@/components/scWorkflow'
 import useFlowStore from '@/store/modules/flow'
 import useClipboard from 'vue-clipboard3'
 import { storeToRefs } from 'pinia'
+import { ElMessage } from 'element-plus'
 
 const flowStore = useFlowStore()
 const { modelContent } = storeToRefs(flowStore)
 const { toClipboard } = useClipboard()
 
-const fetchTxtFileData = ref('你好 世界!')
 const formRef = ref()
 const drawer = ref(false)
 const jsonFormat = ref({})
@@ -37,24 +36,22 @@ const updateCompInfo = () => {
 	}
 }
 
-const copyParseJson = async () => {
-	await toClipboard(JSON.stringify(jsonFormat.value, null, '  '))
-}
+// const copyParseJson = async () => {
+// 	await toClipboard(JSON.stringify(jsonFormat.value, null, '  '))
+// }
 
 const copyJson = async () => {
-	await toClipboard(JSON.stringify(jsonFormat.value))
-}
-
-watch(
-	() => form.value.processConfig,
-	value => {
-		jsonFormat.value = JSON.stringify(form.value.processConfig)
-	},
-	{
-		// 初始化立即执行
-		immediate: true
+	if (!jsonFormat.value) {
+		return ElMessage.warning('当前没有数据噢')
+	}
+	const json = JSON.parse(jsonFormat.value || {})
+	try {
+		await toClipboard(JSON.stringify(json))
+		ElMessage.success('复制成功')
+	} catch (e) {
+		ElMessage.warning('复制失败')
 	}
-)
+}
 
 const validate = () => {
 	// 保存表单设计
@@ -65,6 +62,11 @@ const validate = () => {
 	})
 }
 
+const openDrawerEv = () => {
+	jsonFormat.value = JSON.stringify(form.value.processConfig, null, '  ')
+	drawer.value = !drawer.value
+}
+
 onMounted(() => {
 	updateCompInfo()
 })
@@ -80,16 +82,16 @@ defineExpose({
 <template>
 	<div>
 		<div style="z-index: 999" class="fixed top-44 right-48">
-			<el-button type="primary" @click="() => (drawer = true)"> 查看 JSON </el-button>
+			<el-button type="primary" @click="openDrawerEv"> 查看 JSON </el-button>
 		</div>
 
 		<ScWorkflow v-model="form.processConfig"></ScWorkflow>
 
-		<el-dialog v-model="drawer" size="600px" :append-to-body="true" title="查看JSON">
+		<el-dialog v-if="drawer" v-model="drawer" class="le-dialog" size="600px" :append-to-body="true" title="查看JSON" destroy-on-close>
 			<code-mirror-editor v-model="jsonFormat"></code-mirror-editor>
 			<template #footer>
-				<el-button type="primary">复制 JSON</el-button>
-				<el-button>关 闭</el-button>
+				<el-button type="primary" @click="copyJson">复制 JSON</el-button>
+				<el-button @click="() => (drawer = false)">关 闭</el-button>
 			</template>
 		</el-dialog>
 	</div>