From fa77d6fcb0b770edc33c65ee9b947c34af2c3bf9 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期四, 25 四月 2024 21:23:29 +0800 Subject: [PATCH] 工艺路线修改 --- src/views/tigerprojects/mes/eng/router/index.vue | 146 ++++++++++++++++++++ src/views/sys/login/LoginForm.vue | 33 ++-- src/components/FlowChart/src/FlowChart.vue | 167 +++-------------------- src/views/sys/login/Login.vue | 16 +- src/main.ts | 2 5 files changed, 189 insertions(+), 175 deletions(-) diff --git a/src/components/FlowChart/src/FlowChart.vue b/src/components/FlowChart/src/FlowChart.vue index 134da94..318cc49 100644 --- a/src/components/FlowChart/src/FlowChart.vue +++ b/src/components/FlowChart/src/FlowChart.vue @@ -1,25 +1,13 @@ <template> <div class="h-full" :class="prefixCls"> - <FlowChartToolbar :prefixCls="prefixCls" v-if="toolbar" @view-data="handlePreview" + <FlowChartToolbar + :prefixCls="prefixCls" + v-if="toolbar" + @view-data="handlePreview" @save-data="handleSave" - @add-data="handleAdd"/> - <a-layout style="min-height: 100vh"> - <a-layout-content> - <div ref="lfElRef" class="h-full"></div> - </a-layout-content> - <a-layout-sider - width="450" - style="background: #fafafa; border-left: 1px solid #d9d9d9; padding: 20px" - ><BasicForm - autoFocusFirstItem - :labelWidth="80" - :schemas="schemas" - :actionColOptions="{ span: 24 }" - :submitButtonOptions="{ text: '纭畾' }" - @submit="handleSubmit" - @reset="handleReset" - /></a-layout-sider> - </a-layout> + @add-data="handleAdd" + /> + <div ref="lfElRef" class="h-full"></div> <BasicModal @register="register" title="娴佺▼鏁版嵁" width="50%"> <JsonPreview :data="graphData" /> </BasicModal> @@ -41,135 +29,17 @@ import { configDefaultDndPanel } from './config'; import '@logicflow/core/dist/style/index.css'; import '@logicflow/extension/lib/style/index.css'; - import { BasicForm, FormSchema } from '/@/components/Form/index'; - import { getOperAllList } from '/@/api/tigerapi/mes/oper'; import { useGlobSetting } from '/@/hooks/setting'; import customEdge from './customEdge'; + import { useMessage } from '/@/hooks/web/useMessage'; + import { useI18n } from '/@/hooks/web/useI18n'; - const isRuter = (type: string) => type === '0'; - const isOper = (type: string) => type === '1'; - const schemas: FormSchema[] = [ - // { - // field: 'divider-basic', - // component: 'Divider', - // label: '灞炴�ч〉', - // }, - { - field: 'func_type', - label: '灞炴�ч〉', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '宸ヨ壓娴佺▼', value: '0' }, - { label: '宸ュ簭', value: '1' }, - ], - }, - colProps: { lg: 24, md: 24 }, - }, - { - field: 'OPER_CODE', - component: 'ApiSelect', - label: '閫夋嫨宸ュ簭', - componentProps: { - api: getOperAllList, - // params: { - // id: 1, - // }, - resultField: 'items', - labelField: 'OPER_NAME', - valueField: 'OPER_CODE', - // not request untill to select - immediate: false, - onChange: (e) => { - console.log('selected:', e); - }, - // atfer request callback - onOptionsChange: (options) => { - console.log('get options', options.length, options); - }, - }, - ifShow: ({ values }) => isOper(values.func_type), - }, - { - field: 'field2', - component: 'Input', - label: '宸ュ簭绫诲瀷', - // componentProps:{}, - // can func - componentProps: ({ schema, formModel }) => { - console.log('form:', schema); - console.log('formModel:', formModel); - return { - placeholder: '娴嬭瘯', - onChange: (e: any) => { - console.log(e); - }, - }; - }, - renderComponentContent: () => { - return { - prefix: () => '宸ュ簭', - suffix: () => '绫诲瀷', - }; - }, - }, - { - field: 'field3', - component: 'Select', - label: '宸ュ簭琛屼负', - componentProps: { - options: [ - { - label: '瀛樺偍杩囩▼', - value: '1', - key: '1', - }, - { - label: '鏉$爜瑙勫垯', - value: '2', - key: '2', - }, - { - label: '琛屼负涓�', - value: '3', - key: '3', - }, - { - label: '琛屼负浜�', - value: '4', - key: '4', - }, - { - label: '琛屼负涓�', - value: '5', - key: '5', - }, - ], - }, - }, - { - field: 'field4', - component: 'Switch', - label: '鏄惁璁$畻鐩撮�氱巼', - colProps: { - span: 16, - }, - labelWidth: 200, - }, - { - field: 'field5', - component: 'Switch', - label: '鏄惁鍙烦绔�', - colProps: { - span: 16, - }, - labelWidth: 200, - }, - ]; + const { notification } = useMessage(); + const { t } = useI18n(); + export default defineComponent({ name: 'FlowChart', - components: { BasicModal, FlowChartToolbar, JsonPreview, BasicForm }, + components: { BasicModal, FlowChartToolbar, JsonPreview }, props: { flowOptions: { type: Object as PropType<Definition>, @@ -299,6 +169,14 @@ } }); } + lf.on('node:click,edge:click', (data) => { + console.log(data.data.text.value, data.isSelected); + notification.success({ + message: t('鐐瑰嚮浜嗚妭鐐�'), + description: `${data.data.text.value}: ${data.isSelected}`, + duration: 3, + }); + }); } function handlePreview() { @@ -336,9 +214,6 @@ lfElRef, handlePreview, graphData, - schemas, - handleReset: () => {}, - handleSubmit: (_values: any) => {}, handleSave, handleAdd, }; diff --git a/src/main.ts b/src/main.ts index 60c3c05..f9d6534 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,6 +15,7 @@ import { router, setupRouter } from '@/router'; import { setupRouterGuard } from '@/router/guard'; import { setupStore } from '@/store'; +// import { buildUUID } from '@/utils/uuid'; import App from './App.vue'; @@ -33,6 +34,7 @@ // 娉ㄥ唽鍏ㄥ眬缁勪欢 registerGlobComp(app); + // app.config.globalProperties.name = buildUUID(); // Multilingual configuration // 澶氳瑷�閰嶇疆 // Asynchronous case: language files may be obtained from the server side diff --git a/src/views/sys/login/Login.vue b/src/views/sys/login/Login.vue index dd11c68..ca6e832 100644 --- a/src/views/sys/login/Login.vue +++ b/src/views/sys/login/Login.vue @@ -14,7 +14,7 @@ <div class="container relative h-full py-2 mx-auto sm:px-10"> <div class="flex h-full"> <div class="hidden min-h-full pl-4 mr-4 xl:flex xl:flex-col xl:w-6/12"> - <AppLogo class="-enter-x"/> + <AppLogo class="-enter-x" /> <div class="my-auto"> <!-- <img :alt="title" @@ -46,9 +46,8 @@ </div> </template> <script lang="ts" setup> - import { computed } from 'vue'; - import { AppLogo } from '/@/components/Application'; - import { AppLocalePicker } from '/@/components/Application'; + import { computed, getCurrentInstance } from 'vue'; + import { AppLogo, AppLocalePicker } from '/@/components/Application'; import LoginForm from './LoginForm.vue'; import ForgetPasswordForm from './ForgetPasswordForm.vue'; import { useGlobSetting } from '/@/hooks/setting'; @@ -61,13 +60,14 @@ type: Boolean, }, }); - + const { appContext } = getCurrentInstance(); const globSetting = useGlobSetting(); const { prefixCls } = useDesign('login'); const { t } = useI18n(); const localeStore = useLocaleStore(); const showLocale = localeStore.getShowPicker; const title = computed(() => globSetting?.title ?? ''); + const name = appContext.config.globalProperties.name; </script> <style lang="less"> @prefix-cls: ~'@{namespace}-login'; @@ -141,7 +141,7 @@ .@{logo-prefix-cls} { position: absolute; // top: 12px; - top:69px; + top: 69px; height: 30px; &__title { @@ -165,12 +165,12 @@ &__title { // font-size: 24px; // color: #fff; - color:red; + color: red; text-shadow: 1px 1px 1px #fff; } img { - width:280px; //48px; + width: 280px; //48px; } } } diff --git a/src/views/sys/login/LoginForm.vue b/src/views/sys/login/LoginForm.vue index f17ecaf..9da2003 100644 --- a/src/views/sys/login/LoginForm.vue +++ b/src/views/sys/login/LoginForm.vue @@ -27,7 +27,7 @@ <FormItem name="dept" class="enter-x dept"> <ARow class="enter-x"> <ACol :md="24" :xs="24" :span="24"> - <BasicForm @register="registerForm" /> + <BasicForm @register="registerForm" /> </ACol> </ARow> </FormItem> @@ -57,14 +57,13 @@ </Button> </FormItem> </Form> - </template> <script lang="ts" setup> - import { reactive, ref, unref, computed, onMounted,h } from 'vue'; + import { reactive, ref, unref, computed, onMounted, h } from 'vue'; import { BasicForm, useForm } from '/@/components/Form/index'; import { Checkbox, Form, Input, Row, Col, Button, Select, Divider } from 'ant-design-vue'; import LoginFormTitle from './LoginFormTitle.vue'; - + import { useI18n } from '/@/hooks/web/useI18n'; import { useMessage } from '/@/hooks/web/useMessage'; @@ -75,11 +74,9 @@ import { AccountInfo } from '/@/api/tigerapi/model/systemModel'; import { accountFormSchema } from './loginDept.data'; import { getTreeList, optionsListApi } from '/@/api/tigerapi/dept'; - //import { onKeyStroke } from '@vueuse/core'; - - + const ACol = Col; const ARow = Row; const FormItem = Form.Item; @@ -132,12 +129,12 @@ async function handleLogin() { const data = await validForm(); const orgData = await validate(); - console.log('data',data) + console.log('data', data); if (!data) return; try { loading.value = true; //const positionInfo = await getUserIpConfig(); - const Info = { ad_info: {}, ip: '' } //positionInfo.status === 110 ? { ad_info: {}, ip: '' } : positionInfo.result; + const Info = { ad_info: {}, ip: '' }; //positionInfo.status === 110 ? { ad_info: {}, ip: '' } : positionInfo.result; const accountInfo: AccountInfo = { useR_CODE: data.account, password: data.password, @@ -145,7 +142,7 @@ ad_info: Info.ad_info, ip: Info.ip, }; - + const userInfo = await userStore.login({ id: 'string', dataType: 'string', @@ -159,14 +156,12 @@ description: `${t('sys.login.loginSuccessDesc')}: ${userInfo.realName}`, duration: 3, }); - - - }else{ + } else { createErrorModal({ - title: t('sys.api.errorTip'), - content: t('sys.api.errMsg401'), - getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, - }); + title: t('sys.api.errorTip'), + content: t('sys.api.errMsg401'), + getContainer: () => document.body.querySelector(`.${prefixCls}`) || document.body, + }); } } catch (error) { createErrorModal({ @@ -181,8 +176,8 @@ } </script> <style lang="less" scoped> - .dept{ - /deep/.ant-select-selector{ + .dept { + /deep/.ant-select-selector { height: 37px !important; } /deep/.ant-select-single .ant-select-selector { diff --git a/src/views/tigerprojects/mes/eng/router/index.vue b/src/views/tigerprojects/mes/eng/router/index.vue index 39e7692..da189d3 100644 --- a/src/views/tigerprojects/mes/eng/router/index.vue +++ b/src/views/tigerprojects/mes/eng/router/index.vue @@ -1,15 +1,154 @@ <template> <PageWrapper title="宸ヨ壓娴佺▼鍥�" content="鏍规嵁鐢熶骇宸ヨ壓璁捐宸ヨ壓娴佺▼" contentFullHeight fixedHeight> - <FlowChart :data="demoData" /> + <a-layout style="min-height: 100vh"> + <a-layout-content> + <FlowChart :data="demoData" /> + </a-layout-content> + <a-layout-sider + width="450" + style="background: #fafafa; border-left: 1px solid #d9d9d9; padding: 20px" + ><BasicForm + autoFocusFirstItem + :labelWidth="80" + :schemas="schemas" + :actionColOptions="{ span: 24 }" + :submitButtonOptions="{ text: '纭畾' }" + @submit="handleSubmit" + @reset="handleReset" + /></a-layout-sider> + </a-layout> </PageWrapper> </template> <script lang="ts"> import { FlowChart } from '/@/components/FlowChart'; import { PageWrapper } from '/@/components/Page'; + import { BasicForm, FormSchema } from '/@/components/Form/index'; + import { getOperAllList } from '/@/api/tigerapi/mes/oper'; + const isRuter = (type: string) => type === '0'; + const isOper = (type: string) => type === '1'; + const schemas: FormSchema[] = [ + // { + // field: 'divider-basic', + // component: 'Divider', + // label: '灞炴�ч〉', + // }, + { + field: 'func_type', + label: '灞炴�ч〉', + component: 'RadioButtonGroup', + defaultValue: '0', + componentProps: { + options: [ + { label: '宸ヨ壓娴佺▼', value: '0' }, + { label: '宸ュ簭', value: '1' }, + ], + }, + colProps: { lg: 24, md: 24 }, + }, + { + field: 'OPER_CODE', + component: 'ApiSelect', + label: '閫夋嫨宸ュ簭', + componentProps: { + api: getOperAllList, + // params: { + // id: 1, + // }, + resultField: 'items', + labelField: 'OPER_NAME', + valueField: 'OPER_CODE', + // not request untill to select + immediate: false, + onChange: (e) => { + console.log('selected:', e); + }, + // atfer request callback + onOptionsChange: (options) => { + console.log('get options', options.length, options); + }, + }, + ifShow: ({ values }) => isOper(values.func_type), + }, + { + field: 'field2', + component: 'Input', + label: '宸ュ簭绫诲瀷', + // componentProps:{}, + // can func + componentProps: ({ schema, formModel }) => { + console.log('form:', schema); + console.log('formModel:', formModel); + return { + placeholder: '娴嬭瘯', + onChange: (e: any) => { + console.log(e); + }, + }; + }, + renderComponentContent: () => { + return { + prefix: () => '宸ュ簭', + suffix: () => '绫诲瀷', + }; + }, + }, + { + field: 'field3', + component: 'Select', + label: '宸ュ簭琛屼负', + componentProps: { + options: [ + { + label: '瀛樺偍杩囩▼', + value: '1', + key: '1', + }, + { + label: '鏉$爜瑙勫垯', + value: '2', + key: '2', + }, + { + label: '琛屼负涓�', + value: '3', + key: '3', + }, + { + label: '琛屼负浜�', + value: '4', + key: '4', + }, + { + label: '琛屼负涓�', + value: '5', + key: '5', + }, + ], + }, + }, + { + field: 'field4', + component: 'Switch', + label: '鏄惁璁$畻鐩撮�氱巼', + colProps: { + span: 16, + }, + labelWidth: 200, + }, + { + field: 'field5', + component: 'Switch', + label: '鏄惁鍙烦绔�', + colProps: { + span: 16, + }, + labelWidth: 200, + }, + ]; export default { - components: { FlowChart, PageWrapper }, + components: { FlowChart, PageWrapper, BasicForm }, setup() { let demoData = { nodes: [ @@ -132,6 +271,9 @@ }; return { demoData, + schemas, + handleReset: () => {}, + handleSubmit: (_values: any) => {}, }; }, }; -- Gitblit v1.9.3