From 6f6207ef6eb81d2abb3805bc2cba889ea2abd135 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期日, 02 六月 2024 01:12:32 +0800 Subject: [PATCH] 低代码更新 --- src/utils/env.ts | 2 src/assets/icons/add_blue.svg | 1 src/hooks/setting/index.ts | 2 src/views/tigerprojects/system/lowcode/setting/setting.data.ts | 92 +++ src/api/tigerapi/model/systemModel.ts | 44 + src/assets/icons/subtract.svg | 1 src/views/tigerprojects/system/lowcode/setting/pageDetail.vue | 760 ++++++++++++++++++++++++++++ types/config.d.ts | 2 src/locales/lang/zh_CN.ts | 2 src/views/components/EntityModal.vue | 156 +++++ src/views/tigerprojects/system/lowcode/normal/normalDrawer.vue | 11 .env.development | 1 src/views/components/ItemModal.vue | 236 +++----- src/api/tigerapi/wms/wms_item_his.ts | 77 +- src/locales/lang/en.ts | 5 .env.production | 1 src/api/tigerapi/system.ts | 61 ++ src/views/tigerprojects/system/lowcode/normal/index.vue | 41 + src/views/tigerprojects/system/lowcode/setting/index.vue | 97 +++ 19 files changed, 1,397 insertions(+), 195 deletions(-) diff --git a/.env.development b/.env.development index afc8e2c..91f55df 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,7 @@ # Basic interface address SPA VITE_GLOB_API_URL=http://localhost:9528/api +VITE_GLOB_SYS_API_URL=http://localhost:9528 #VITE_GLOB_API_URL=http://172.18.8.56:9633/api # VITE_GLOB_API_URL=http://localhost:9633/api #Tsk Interface address diff --git a/.env.production b/.env.production index da723f5..80448ac 100644 --- a/.env.production +++ b/.env.production @@ -14,6 +14,7 @@ # VITE_GLOB_API_URL=/basic-api # VITE_GLOB_API_URL=http://172.18.8.55:9533/api VITE_GLOB_API_URL=http://47.115.28.255:9520/api +VITE_GLOB_SYS_API_URL=http://47.115.28.255:9520 # VITE_GLOB_API_URL=http://localhost:9527/api #Tsk Interface address # VITE_GLOB_TSK_API_URL=http://172.18.8.55:9533/api diff --git a/src/api/tigerapi/model/systemModel.ts b/src/api/tigerapi/model/systemModel.ts index 6e29d97..5cbf973 100644 --- a/src/api/tigerapi/model/systemModel.ts +++ b/src/api/tigerapi/model/systemModel.ts @@ -1,4 +1,5 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; + export type AD_INFO = { nation?: string; province?: string; @@ -118,7 +119,7 @@ USER_NAME: string; USER_PWD: string; CREATE_TIME: string; - STATUS_CODE:any; + STATUS_CODE: any; } export interface UserGPListItem { @@ -280,6 +281,46 @@ HALF_CHECK: string; } +export type EntityParams = { + Namespace?: string; + StartWith?: string; +}; + +export interface EntityList { + Total: number; + Data: EntityListItem[]; +} + +export interface EntityListItem { + FullName: string; + Namespace: string; + Name: string; + Properties: EntityPropertie[]; +} + +export interface EntityPropertie { + Name: string; + Type: string; +} + +export interface SYS_LOW_CODE { + ID: string; + CREATE_TIME: Date; + CREATE_USER: string; + UPDATE_TIME: Date; + UPDATE_USER: string; + GHOST_ROW: boolean; + AUTH_ORG: string; + AUTH_PROD: string; + AUTH_WH: string; + SEARCH_FORM_JSON: string; + BASE_FORM_JSON: string; + FORM_JSON: string; + ASSEMBLY_NAME: string; + SEARCH_ASSY_NAME: string; + CRUD_ASSY_NAME: string; +} + /** * @description: Request list return value */ @@ -290,3 +331,4 @@ export type RoleListGetResultModel = RoleListItem[]; export type ParamsListGetResultModel = BasicFetchResult<ParamsListItem>; export type LoginLogPageListGetResultModel = BasicFetchResult<LoginLogListItem>; +export type EntityListGetResultModel = BasicFetchResult<EntityPropertie>; diff --git a/src/api/tigerapi/system.ts b/src/api/tigerapi/system.ts index 3d0f4d5..5b47319 100644 --- a/src/api/tigerapi/system.ts +++ b/src/api/tigerapi/system.ts @@ -1,4 +1,5 @@ import { UserConfigFn } from 'vite'; +import { useGlobSetting } from '/@/hooks/setting'; import { buildUUID } from '../../utils/uuid'; import { DateFormat } from '../../utils/dataformat'; import { ApiAction, ApiActionJob, ApiActionPage } from '../model/baseModel'; @@ -25,6 +26,8 @@ LoginLogPageListGetResultModel, iSYS_ROLE_ORG, iSYS_ROLE_WH, + EntityParams, + EntityList, } from './model/systemModel'; import { defHttp } from '/@/utils/http/axios'; import { isNullOrEmpty } from '/@/utils/is'; @@ -76,7 +79,10 @@ //瀵煎叆 ValidateTableImport = '/SMT/ValidateTableImport', SaveValidateTableImport = '/SMT/SaveValidateTableImport', + GetEntityNameList = '/System/Entitys/Get', } + +const globSetting = useGlobSetting(); /** * 鐢熸垚apiaction,甯﹀垎椤� @@ -726,3 +732,58 @@ export function getClassName<T>(ctor: new () => T): string { return ctor.name; } + +export const getEntityList = (params?: EntityParams) => + defHttp.get<EntityList>( + { url: Api.GetEntityNameList, params }, + { + isTransformResponse: false, + apiUrl: globSetting.sysApiUrl, + }, + ); + +export async function getEntityNameList(params?: EntityParams) { + const data = await defHttp.get<EntityList>( + { url: Api.GetEntityNameList, params }, + { + isTransformResponse: false, + apiUrl: globSetting.sysApiUrl, + }, + ); + const model = { + items: data.Data, + total: data.Total, + }; + return model; +} + +export async function getEntityPropertieList(params?: EntityParams) { + const data = await defHttp.get<EntityList>( + { url: Api.GetEntityNameList, params }, + { + isTransformResponse: false, + apiUrl: globSetting.sysApiUrl, + }, + ); + const model = { + items: data.Data.filter((x) => x.Name == params?.StartWith)[0].Properties, + total: data.Total, + }; + return model; +} + +/* 閫氱敤鑾峰彇瀹炰綋璁板綍 */ +export const getEntity = async (params: { sqlcmd: string; entityName: string }) => { + const usParams = genAction(params.entityName, { + QueryAble_T: '', + where: params.sqlcmd, + order: '', + }); + return await defHttp.post( + { url: Api.QueryUrl, params: usParams }, + { + errorMessageMode: 'none', + isTransformResponse: false, + }, + ); +}; diff --git a/src/api/tigerapi/wms/wms_item_his.ts b/src/api/tigerapi/wms/wms_item_his.ts index 0a55047..9b45581 100644 --- a/src/api/tigerapi/wms/wms_item_his.ts +++ b/src/api/tigerapi/wms/wms_item_his.ts @@ -10,9 +10,9 @@ * 鑾峰彇瀹炴椂搴撳瓨鍒嗛〉鍒楄〃 */ export const getWmsItemHisListByPage = async (params: WmsItemPageParams) => { - let order = '' + let order = ''; if (params.order != undefined) { - order = params.order == 'descend' ? (params.field + ' desc') : params.field + order = params.order == 'descend' ? params.field + ' desc' : params.field; } let sqlcmd = '1=1'; if (params?.SN != undefined && params?.SN != '') { @@ -27,57 +27,64 @@ if (params?.TRACE_INFO != undefined && params?.TRACE_INFO != '') { sqlcmd += " And TRACE_INFO like '" + params?.TRACE_INFO + "%'"; } - var option ={ - UserId:useUserStore().getUserInfo.userId as string, - ByOrg:true, - OrgCode:useUserStore().getUserInfo.orgCode as string - } + const option = { + UserId: useUserStore().getUserInfo.userId as string, + ByOrg: true, + OrgCode: useUserStore().getUserInfo.orgCode as string, + }; //const rParams = genActionPage('V_WMS_ITEM_HIS', sqlcmd, params.page, params.pageSize); - if(!isNullOrEmpty(params.page)){ - const usParams = genAction('V_WMS_ITEM_HIS', { - QueryAble_T: '', - where: sqlcmd, - order: order, - page: { - pageAble_T: 'string', - draw: 1, - pageIndex: params.page, - pageSize: params.pageSize, - },option - },option); + if (!isNullOrEmpty(params.page)) { + const usParams = genAction( + 'V_WMS_ITEM_HIS', + { + QueryAble_T: '', + where: sqlcmd, + order: order, + page: { + pageAble_T: 'string', + draw: 1, + pageIndex: params.page, + pageSize: params.pageSize, + }, + option, + }, + option, + ); return getWmsItemListByPageAsync(usParams); - }else{ - const usParams = genAction('V_WMS_ITEM_HIS', { - QueryAble_T: '', - where: sqlcmd, - option - },option); + } else { + const usParams = genAction( + 'V_WMS_ITEM_HIS', + { + QueryAble_T: '', + where: sqlcmd, + option, + }, + option, + ); return getWmsItemListByPageAsync(usParams); } - }; async function getWmsItemListByPageAsync(params: any) { const data = await defHttp.post( - { url: Api.QueryUrl, params,timeout: 10*60*1000 }, + { url: Api.QueryUrl, params, timeout: 10 * 60 * 1000 }, { isTransformResponse: false, }, ); - let model = {} - if(isNullOrEmpty(data.Data.page)){ - model = { + let model = {}; + if (isNullOrEmpty(data.Data.page)) { + model = { items: data.Data.Items, }; - }else{ - model = { + } else { + model = { items: data.Data.page.data, total: data.Data.page.totals, }; } - + return model; } - //涓嬫媺鍒楄〃 // STATUSs 浠撳簱鐘舵�� @@ -91,4 +98,4 @@ // apiUrl: globSetting.taskApiUrl }, ); -}; \ No newline at end of file +}; diff --git a/src/assets/icons/add_blue.svg b/src/assets/icons/add_blue.svg new file mode 100644 index 0000000..8271d7d --- /dev/null +++ b/src/assets/icons/add_blue.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1717145055695" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4247" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M524.8 64c4.693 0 8.533 3.84 8.533 8.533v418.134h418.134c4.693 0 8.533 3.84 8.533 8.533v46.933a8.533 8.533 0 0 1-8.533 8.534H533.333V972.8a8.533 8.533 0 0 1-8.533 8.533h-46.933a8.533 8.533 0 0 1-8.534-8.533V554.667H51.2a8.533 8.533 0 0 1-8.533-8.534V499.2c0-4.693 3.84-8.533 8.533-8.533h418.133V72.533c0-4.693 3.84-8.533 8.534-8.533H524.8z" fill="#0a6fa4" p-id="4248"></path></svg> \ No newline at end of file diff --git a/src/assets/icons/subtract.svg b/src/assets/icons/subtract.svg new file mode 100644 index 0000000..48fe2eb --- /dev/null +++ b/src/assets/icons/subtract.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1717145761846" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7020" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M85.33 469.33h853.33v85.33H85.33z" p-id="7021" fill="#0a6fa4"></path></svg> \ No newline at end of file diff --git a/src/hooks/setting/index.ts b/src/hooks/setting/index.ts index 4157ba8..e788ff9 100644 --- a/src/hooks/setting/index.ts +++ b/src/hooks/setting/index.ts @@ -11,12 +11,14 @@ VITE_GLOB_MAP_KEY, VITE_GLOB_TSK_API_URL, VITE_GLOB_DOWNLOAD_URL, + VITE_GLOB_SYS_API_URL, } = getAppEnvConfig(); // Take global configuration const glob: Readonly<GlobConfig> = { title: VITE_GLOB_APP_TITLE, apiUrl: VITE_GLOB_API_URL, + sysApiUrl: VITE_GLOB_SYS_API_URL, taskApiUrl: VITE_GLOB_TSK_API_URL, shortName: VITE_GLOB_APP_TITLE.replace(/\s/g, '_').replace(/-/g, '_'), urlPrefix: VITE_GLOB_API_URL_PREFIX, diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index f8cba68..d9ca686 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -10,7 +10,10 @@ antdLocale, }, apiMessage: { - ...(await defHttp.get({ url: `${Api.GetLanguage}?locale=en` }, { isTransformResponse: false })), + ...(await defHttp.get( + { url: `${Api.GetLanguage}?locale=en-us` }, + { isTransformResponse: false }, + )), antdLocale, }, dateLocale: null, diff --git a/src/locales/lang/zh_CN.ts b/src/locales/lang/zh_CN.ts index 146343b..8b46c80 100644 --- a/src/locales/lang/zh_CN.ts +++ b/src/locales/lang/zh_CN.ts @@ -11,7 +11,7 @@ }, apiMessage: { ...(await defHttp.get( - { url: `${Api.GetLanguage}?locale=zh-CN` }, + { url: `${Api.GetLanguage}?locale=zh-cn` }, { isTransformResponse: false }, )), antdLocale, diff --git a/src/utils/env.ts b/src/utils/env.ts index 137f977..6d85784 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -28,6 +28,7 @@ const { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, + VITE_GLOB_SYS_API_URL, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL, VITE_GLOB_MAP_KEY, @@ -38,6 +39,7 @@ return { VITE_GLOB_APP_TITLE, VITE_GLOB_API_URL, + VITE_GLOB_SYS_API_URL, VITE_GLOB_TSK_API_URL, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL, diff --git a/src/views/components/EntityModal.vue b/src/views/components/EntityModal.vue new file mode 100644 index 0000000..dfa7210 --- /dev/null +++ b/src/views/components/EntityModal.vue @@ -0,0 +1,156 @@ +<template> + <BasicModal + width="800px" + :height="600" + v-bind="$attrs" + @register="register" + title="瀹炰綋鍒楄〃" + @ok="handleSubmit" + > + <!-- <div class="pt-3px pr-3px"> + <BasicForm @register="registerForm" :model="model" /> + </div> --> + <div> + <BasicTable @register="registerTable"> + <!-- <template #toolbar> + <a-button type="primary" @click="handleCreate"> 鏂板鐩樼偣 </a-button> + </template> --> + </BasicTable> + </div> + </BasicModal> +</template> +<script lang="ts" setup> + import { ref, unref } from 'vue'; + import { BasicModal, useModalInner } from '/@/components/Modal'; + import { FormSchema } from '/@/components/Form/index'; + import { BasicTable, BasicColumn, useTable } from '/@/components/Table'; + import { useI18n } from '/@/hooks/web/useI18n'; + import { getEntityNameList } from '/@/api/tigerapi/system'; + + const { t } = useI18n(); + const schemas: FormSchema[] = [ + { + field: 'StartWith', + component: 'Input', + label: '瀹炰綋鍚�', + colProps: { + span: 12, + }, + }, + ]; + + //鍒楄〃 + const ItemColumns: BasicColumn[] = [ + { + title: t('瀹炰綋鍚�'), + dataIndex: 'Name', + resizable: true, + sorter: true, + width: 180, + }, + { + title: t('瀹炰綋鍏ㄥ悕'), + dataIndex: 'FullName', + resizable: true, + sorter: true, + width: 200, + }, + { + title: t('鍛藉悕绌洪棿'), + dataIndex: 'Namespace', + resizable: true, + sorter: true, + width: 200, + }, + ]; + const emit = defineEmits(['success', 'register']); + const checkedKeys = ref<Array<string | number>>([]); + const [registerTable, { reload, getForm }] = useTable({ + title: '瀹炰綋鍒楄〃', + api: getEntityNameList, + searchInfo: { StartWith: '', Namespace: 'Tiger.Model' }, + columns: ItemColumns, + formConfig: { + labelWidth: 120, + schemas, + }, + useSearchForm: true, + showTableSetting: false, + // pagination: { pageSize: 8 }, + rowKey: 'Name', + rowSelection: { + selectedRowKeys: checkedKeys, + + type: 'checkbox', + // getCheckboxProps(record: Recordable) { + // // Demo: 绗竴琛岋紙id涓�0锛夌殑閫夋嫨妗嗙鐢� + // if (record.id === '0') { + // return { disabled: true }; + // } else { + // return { disabled: false }; + // } + // }, + onSelect: onSelect, + onSelectAll: onSelectAll, + }, + bordered: true, + showIndexColumn: false, + // actionColumn: { + // width: 80, + // title: '鎿嶄綔', + // dataIndex: 'action', + // slots: { customRender: 'action' }, + // fixed: 'right' //undefined, + // }, + }); + const [register, { setModalProps, closeModal }] = useModalInner((data) => { + setModalProps({ confirmLoading: false }); + data && onDataReceive(data); + }); + + async function onDataReceive(data) { + console.log('Data Received', data); + getForm().resetFields(); + checkedKeys.value = []; + reload(); + // 鏂瑰紡1; + // setFieldsValue({ + // field2: data.data, + // field1: data.info, + // }); + } + + async function handleSubmit() { + try { + var values = ''; + // checkedKeys.value.forEach(element => { + // values+=element; + // }); + values = checkedKeys.value.join(','); + closeModal(); + emit('success', { + isUpdate: unref(false), + values: { values, id: 0 }, + }); + } finally { + setModalProps({ confirmLoading: false }); + } + } + function onSelect(record, selected) { + if (selected) { + checkedKeys.value = [...checkedKeys.value, record.Name]; + } else { + checkedKeys.value = checkedKeys.value.filter((Name) => Name !== record.Name); + } + } + function onSelectAll(selected, selectedRows, changeRows) { + const changeIds = changeRows.map((item) => item.Name); + if (selected) { + checkedKeys.value = [...checkedKeys.value, ...changeIds]; + } else { + checkedKeys.value = checkedKeys.value.filter((Name) => { + return !changeIds.includes(Name); + }); + } + } +</script> diff --git a/src/views/components/ItemModal.vue b/src/views/components/ItemModal.vue index 7295093..36fea02 100644 --- a/src/views/components/ItemModal.vue +++ b/src/views/components/ItemModal.vue @@ -19,11 +19,10 @@ </div> </BasicModal> </template> -<script lang="ts"> - import { defineComponent, ref, unref } from 'vue'; +<script lang="ts" setup> + import { ref, unref } from 'vue'; import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; - import { getTreeList } from '/@/api/tigerapi/dept'; import { BasicTable, BasicColumn, TableAction, useTable } from '/@/components/Table'; import { getItemListByPage } from '/@/api/tigerapi/wms/inventory'; import { useI18n } from '/@/hooks/web/useI18n'; @@ -41,7 +40,7 @@ ]; //鐗╂枡鍒楄〃 - export const ItemColumns: BasicColumn[] = [ + const ItemColumns: BasicColumn[] = [ { title: t('鐗╂枡缂栫爜'), dataIndex: 'ITEM_CODE', @@ -82,148 +81,97 @@ // resizable:true, // } ]; - export default defineComponent({ - components: { BasicModal, BasicForm, BasicTable, TableAction }, - props: { - userData: { type: Object }, + + const emit = defineEmits(['success', 'register']); + const checkedKeys = ref<Array<string | number>>([]); + const [registerTable, { reload, getForm }] = useTable({ + title: '鐗╂枡鍒楄〃', + api: getItemListByPage, + columns: ItemColumns, + formConfig: { + labelWidth: 120, + schemas, }, - emit: ['success', 'register'], - setup(_, { emit }) { - const modelRef = ref({}); - const [ - registerForm, - { - // setFieldsValue, - // setProps - updateSchema, - //validate - }, - ] = useForm({ - labelWidth: 120, - schemas, - showActionButtonGroup: false, - actionColOptions: { - span: 24, - }, - }); - const checkedKeys = ref<Array<string | number>>([]); - const [registerTable, { reload }] = useTable({ - title: '鐗╂枡鍒楄〃', - api: getItemListByPage, - columns: ItemColumns, - formConfig: { - labelWidth: 120, - schemas, - }, - useSearchForm: true, - showTableSetting: true, - rowKey: 'ITEM_CODE', - rowSelection: { - selectedRowKeys: checkedKeys, + useSearchForm: true, + showTableSetting: false, + rowKey: 'ITEM_CODE', + rowSelection: { + selectedRowKeys: checkedKeys, - type: 'checkbox', - // getCheckboxProps(record: Recordable) { - // // Demo: 绗竴琛岋紙id涓�0锛夌殑閫夋嫨妗嗙鐢� - // if (record.id === '0') { - // return { disabled: true }; - // } else { - // return { disabled: false }; - // } - // }, - onSelect: onSelect, - onSelectAll: onSelectAll, - }, - bordered: true, - showIndexColumn: false, - // actionColumn: { - // width: 80, - // title: '鎿嶄綔', - // dataIndex: 'action', - // slots: { customRender: 'action' }, - // fixed: 'right' //undefined, - // }, - }); - const [register, { setModalProps, closeModal }] = useModalInner((data) => { - setModalProps({ confirmLoading: false }); - data && onDataReceive(data); - }); - - async function onDataReceive(data) { - console.log('Data Received', data); - // 鏂瑰紡1; - // setFieldsValue({ - // field2: data.data, - // field1: data.info, - // }); - - // // 鏂瑰紡2 - modelRef.value = { field2: data.data, field1: data.info }; - const treeData = await getTreeList(); - updateSchema([ - { - field: 'USER_PWD', - show: !unref(false), - }, - { - field: 'ORG_CODE', - componentProps: { treeData }, - }, - ]); - // setProps({ - // model:{ field2: data.data, field1: data.info } - // }) - } - - // function handleVisibleChange(v) { - // v && props.userData && nextTick(() => onDataReceive(props.userData)); - // } - - async function handleSubmit() { - try { - var values = ''; - // checkedKeys.value.forEach(element => { - // values+=element; - // }); - values = checkedKeys.value.join(','); - closeModal(); - emit('success', { - isUpdate: unref(false), - values: { values, id: 0 }, - }); - } finally { - setModalProps({ confirmLoading: false }); - } - } - function onSelect(record, selected) { - if (selected) { - checkedKeys.value = [...checkedKeys.value, record.ITEM_CODE]; - } else { - checkedKeys.value = checkedKeys.value.filter( - (ITEM_CODE) => ITEM_CODE !== record.ITEM_CODE, - ); - } - } - function onSelectAll(selected, selectedRows, changeRows) { - const changeIds = changeRows.map((item) => item.ITEM_CODE); - if (selected) { - checkedKeys.value = [...checkedKeys.value, ...changeIds]; - } else { - checkedKeys.value = checkedKeys.value.filter((ITEM_CODE) => { - return !changeIds.includes(ITEM_CODE); - }); - } - } - - return { - register, - schemas, - registerForm, - model: modelRef, - handleSubmit, - registerTable, - onSelect, - onSelectAll, - }; + type: 'checkbox', + // getCheckboxProps(record: Recordable) { + // // Demo: 绗竴琛岋紙id涓�0锛夌殑閫夋嫨妗嗙鐢� + // if (record.id === '0') { + // return { disabled: true }; + // } else { + // return { disabled: false }; + // } + // }, + onSelect: onSelect, + onSelectAll: onSelectAll, }, + bordered: true, + showIndexColumn: false, + // actionColumn: { + // width: 80, + // title: '鎿嶄綔', + // dataIndex: 'action', + // slots: { customRender: 'action' }, + // fixed: 'right' //undefined, + // }, }); + const [register, { setModalProps, closeModal }] = useModalInner((data) => { + setModalProps({ confirmLoading: false }); + data && onDataReceive(data); + }); + + async function onDataReceive(data) { + console.log('Data Received', data); + // 鏂瑰紡1; + // setFieldsValue({ + // field2: data.data, + // field1: data.info, + // }); + checkedKeys.value = []; + getForm().resetFields(); + reload(); + } + + // function handleVisibleChange(v) { + // v && props.userData && nextTick(() => onDataReceive(props.userData)); + // } + + async function handleSubmit() { + try { + var values = ''; + // checkedKeys.value.forEach(element => { + // values+=element; + // }); + values = checkedKeys.value.join(','); + closeModal(); + emit('success', { + isUpdate: unref(false), + values: { values, id: 0 }, + }); + } finally { + setModalProps({ confirmLoading: false }); + } + } + function onSelect(record, selected) { + if (selected) { + checkedKeys.value = [...checkedKeys.value, record.ITEM_CODE]; + } else { + checkedKeys.value = checkedKeys.value.filter((ITEM_CODE) => ITEM_CODE !== record.ITEM_CODE); + } + } + function onSelectAll(selected, selectedRows, changeRows) { + const changeIds = changeRows.map((item) => item.ITEM_CODE); + if (selected) { + checkedKeys.value = [...checkedKeys.value, ...changeIds]; + } else { + checkedKeys.value = checkedKeys.value.filter((ITEM_CODE) => { + return !changeIds.includes(ITEM_CODE); + }); + } + } </script> diff --git a/src/views/tigerprojects/system/lowcode/normal/index.vue b/src/views/tigerprojects/system/lowcode/normal/index.vue index d3a78a3..9d56235 100644 --- a/src/views/tigerprojects/system/lowcode/normal/index.vue +++ b/src/views/tigerprojects/system/lowcode/normal/index.vue @@ -28,19 +28,22 @@ </div> </template> <script lang="ts" setup> - import { onMounted, ref } from 'vue'; + import { h, onMounted, ref } from 'vue'; import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table'; import { useDrawer } from '/@/components/Drawer'; import normalDrawer from './normalDrawer.vue'; - import { DeleteEntity, fetchJson, getListByPage } from '/@/api/tigerapi/system'; + import { DeleteEntity, fetchJson, getEntity, getListByPage } from '/@/api/tigerapi/system'; import { useGlobSetting } from '/@/hooks/setting'; import { useRoute } from 'vue-router'; + import { Tag, Tooltip } from 'ant-design-vue'; + import { isNullOrEmpty } from '/@/utils/is'; const route = useRoute(); const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); const globSetting = useGlobSetting(); const _columns = ref([]); const _searchFormSchema = ref([]); + const _crudFormSchema = ref([]); const [registerDrawer, { openDrawer }] = useDrawer(); const [registerTable, { reload }] = useTable({ title: '鍒楄〃淇℃伅', @@ -69,6 +72,7 @@ openDrawer(true, { isUpdate: false, entityName: objParams.value.ID, + formJson: _crudFormSchema.value, }); } @@ -77,6 +81,7 @@ record, isUpdate: true, entityName: objParams.value.ID, + formJson: _crudFormSchema.value, }); } @@ -96,11 +101,31 @@ } onMounted(async () => { - _searchFormSchema.value = await fetchJson( - `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Searchform.json`, - ); - _columns.value = await fetchJson( - `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Baseform.json`, - ); + /* 鐢╦son鑾峰彇鍒� */ + // _searchFormSchema.value = await fetchJson( + // `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Searchform.json`, + // ); + // var objs = await fetchJson( + // `${globSetting.downloadUrl}/LowCode/${objParams.value.ID}/${objParams.value.ID}_Baseform.json`, + // ); + // for (const i in objs) { + // if (!isNullOrEmpty(objs[i].customRender)) { + // const func = new Function(objs[i].customRender)(); + // objs[i].customRender = ({ record }) => { + // let texts = func(record); + // return h(Tooltip, { title: texts.text }, () => + // h(Tag, { color: texts.color }, () => texts.text), + // ); + // }; + // } + // } + // _columns.value = objs; + const data = await getEntity({ + sqlcmd: "ASSEMBLY_NAME ='" + objParams.value.ID + "'", + entityName: 'SYS_LOW_CODE', + }); + _searchFormSchema.value = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); + _columns.value = JSON.parse(data.Data.Items[0].BASE_FORM_JSON); + _crudFormSchema.value = JSON.parse(data.Data.Items[0].FORM_JSON); }); </script> diff --git a/src/views/tigerprojects/system/lowcode/normal/normalDrawer.vue b/src/views/tigerprojects/system/lowcode/normal/normalDrawer.vue index 44f1cdc..533b40d 100644 --- a/src/views/tigerprojects/system/lowcode/normal/normalDrawer.vue +++ b/src/views/tigerprojects/system/lowcode/normal/normalDrawer.vue @@ -34,11 +34,12 @@ const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { isUpdate.value = !!data?.isUpdate; entityName.value = data?.entityName; - formSchema.value = await fetchJson( - `${globSetting.downloadUrl}/LowCode/${unref(entityName)}/${ - entityName.value - }_addEditform.json`, - ); + // formSchema.value = await fetchJson( + // `${globSetting.downloadUrl}/LowCode/${unref(entityName)}/${ + // entityName.value + // }_addEditform.json`, + // ); + formSchema.value = data?.formJson; resetFields(); setDrawerProps({ confirmLoading: false }); diff --git a/src/views/tigerprojects/system/lowcode/setting/index.vue b/src/views/tigerprojects/system/lowcode/setting/index.vue new file mode 100644 index 0000000..6851301 --- /dev/null +++ b/src/views/tigerprojects/system/lowcode/setting/index.vue @@ -0,0 +1,97 @@ +<template> + <div> + <BasicTable @register="registerTable"> + <template #toolbar> + <a-button type="primary" @click="handleCreate" preIcon="add_02|svg"> 鏂板 </a-button> + </template> + <template #action="{ record }"> + <TableAction + :actions="[ + { + icon: 'clarity:note-edit-line', + onClick: handleEdit.bind(null, record), + }, + { + icon: 'ant-design:delete-outlined', + color: 'error', + popConfirm: { + title: '鏄惁纭鍒犻櫎?', + placement: 'left', + confirm: handleDelete.bind(null, record), + }, + }, + ]" + /> + </template> + </BasicTable> + </div> +</template> +<script lang="ts" setup> + import { onMounted, ref } from 'vue'; + import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table'; + import { DeleteEntity, fetchJson, getListByPage } from '/@/api/tigerapi/system'; + import { useGlobSetting } from '/@/hooks/setting'; + import { useGo } from '/@/hooks/web/usePage'; + import { buildUUID } from '/@/utils/uuid'; + + const go = useGo(); + const globSetting = useGlobSetting(); + const _columns = ref([]); + const _searchFormSchema = ref([]); + const [registerTable, { reload }] = useTable({ + title: '鍒楄〃淇℃伅', + api: getListByPage, + searchInfo: { TABLE_NAME: 'SYS_LOW_CODE' }, + columns: _columns as unknown as BasicColumn[], + formConfig: { + labelWidth: 120, + schemas: _searchFormSchema as unknown as FormSchema[], + }, + useSearchForm: true, + showTableSetting: true, + bordered: true, + canResize: true, + showIndexColumn: false, + actionColumn: { + width: 80, + title: '鎿嶄綔', + dataIndex: 'action', + slots: { customRender: 'action' }, + fixed: undefined, + }, + }); + + function handleCreate() { + const ID = { Update: '0', ID: buildUUID(), Name: '' }; + go(`/PageDetail/${encodeURI(JSON.stringify(ID))}`); + } + + function handleEdit(record: Recordable) { + const ID = { Update: '1', ID: record.ID, Name: record.ASSEMBLY_NAME }; + go(`/PageDetail/${encodeURI(JSON.stringify(ID))}`); + } + + function handleDelete(record: Recordable) { + console.log(record); + //鍒犻櫎 + const apiAction = DeleteEntity(record, 'SYS_LOW_CODE'); + apiAction.then((action) => { + if (action.IsSuccessed) { + reload(); + } + }); + } + + function handleSuccess() { + reload(); + } + + onMounted(async () => { + _searchFormSchema.value = await fetchJson( + `${globSetting.downloadUrl}/LowCode/SYS_LOW_CODE/SYS_LOW_CODE_Searchform.json`, + ); + _columns.value = await fetchJson( + `${globSetting.downloadUrl}/LowCode/SYS_LOW_CODE/SYS_LOW_CODE_Baseform.json`, + ); + }); +</script> diff --git a/src/views/tigerprojects/system/lowcode/setting/pageDetail.vue b/src/views/tigerprojects/system/lowcode/setting/pageDetail.vue new file mode 100644 index 0000000..6ff3592 --- /dev/null +++ b/src/views/tigerprojects/system/lowcode/setting/pageDetail.vue @@ -0,0 +1,760 @@ +<template> + <PageWrapper + class="high-form" + title="浣庝唬鐮侀〉闈㈢鐞�" + content="杩欐槸浣庝唬鐮侀〉闈㈢鐞嗭紝鍦ㄨ繖鑳藉鏍规嵁瀹炰綋绫婚厤缃鍒犳敼鍔熻兘椤甸潰銆�" + @back="goBack" + > + <a-card title="鏌ヨ鏉′欢閰嶇疆" :bordered="false"> + <BasicForm @register="register"> + <template #add="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="handleSelecNew" + preIcon="search|svg" + /> + <EntityModal @register="registerNewAdd" @success="handleNewSuccess" /> + </template> + <template #condAdd="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="condAdd" + preIcon="add_blue|svg" + /> + </template> + <template #subtract="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="del(field)" + preIcon="subtract|svg" + /> + </template> + <template #[item]="{ model, field }" v-for="(item, index) in searchSlots" :key="item"> + <a-input-group compact> + <ApiSelect + style="width: 25%" + :api="getEntityPropertieList" + :params="{ StartWith: getFieldsValue().ASSEMBLY_NAME, Namespace: 'Tiger.Model' }" + v-model:value="model[field]" + resultField="items" + label-field="Name" + valueField="Name" + /> + <a-input v-model:value="objInputs[field]" style="width: 55%" /> + <Select + ref="select" + v-model:value="searchSelectVals[field]" + style="width: 20%" + :options="options" + :readonly="true" + /> + </a-input-group> + </template> + <template #[item]="{ model, field }" v-for="item in swSlots" :key="item"> + <a-switch v-model:checked="model[field]" /> + </template> + </BasicForm> + </a-card> + <a-card title="涓昏〃鏍奸厤缃�" :bordered="false" class="!mt-5"> + <div> + <BasicForm @register="registerMain"> + <template #add="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="mainSelectAssy" + preIcon="search|svg" + /> + <EntityModal @register="registerMainAdd" @success="mainAssySuccess" /> + </template> + <template #mainCondAdd="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="mainCondAdd" + preIcon="add_blue|svg" + /> + </template> + <template #mainSubtract="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="mainDel(field)" + preIcon="subtract|svg" + /> + </template> + <template #[item]="{ model, field }" v-for="(item, index) in mainSlots" :key="item"> + <a-input-group compact> + <ApiSelect + style="width: 30%" + :api="getEntityPropertieList" + :params="{ + StartWith: getFieldsValueMain().MainAssemblyName, + Namespace: 'Tiger.Model', + }" + v-model:value="model[field]" + resultField="items" + label-field="Name" + valueField="Name" + /> + <a-input v-model:value="mainInputs[field]" style="width: 70%" /> + </a-input-group> + </template> + <template #[item]="{ model, field }" v-for="item in mainSwSlots" :key="item"> + <a-switch v-model:checked="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in mainsSwSlots" :key="item"> + <a-switch v-model:checked="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in mainwSwSlots" :key="item"> + <a-switch v-model:checked="model[field]" /> + </template> + </BasicForm> + </div> + </a-card> + <a-card title="澧炲垹鏀归厤缃�" :bordered="false" class="!mt-5"> + <BasicForm @register="registerCrud"> + <template #add="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="handleSelectCrud" + preIcon="search|svg" + /> + <EntityModal @register="registerCrudAdd" @success="handleCrudSuccess" /> + </template> + <template #crudCondAdd="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="crudCondAdd" + preIcon="add_blue|svg" + /> + </template> + <template #crudSubtract="{ field }"> + <a-button + v-if="field" + class="mt-1 ml-1" + size="small" + @click="crudDel(field)" + preIcon="subtract|svg" + /> + </template> + <template #[item]="{ model, field }" v-for="(item, index) in crudSlots" :key="item"> + <a-input-group compact> + <ApiSelect + style="width: 25%" + :api="getEntityPropertieList" + :params="{ + StartWith: getFieldsValueCrud().crudAssemblyName, + Namespace: 'Tiger.Model', + }" + v-model:value="model[field]" + resultField="items" + label-field="Name" + valueField="Name" + /> + <a-input v-model:value="crudInputs[field]" style="width: 55%" /> + <Select + ref="select" + v-model:value="crudSelectVals[field]" + style="width: 20%" + :options="options" + :readonly="true" + /> + </a-input-group> + </template> + <template #[item]="{ model, field }" v-for="item in crudSwSlots" :key="item"> + <a-switch v-model:checked="model[field]" /> + </template> + <template #[item]="{ model, field }" v-for="item in crudrSwSlots" :key="item"> + <a-switch v-model:checked="model[field]" /> + </template> + </BasicForm> + </a-card> + + <template #rightFooter> + <a-button class="mr-4" type="info" @click="cancel"> 鍙栨秷 </a-button> + <a-button type="primary" @click="submitAll"> 鐢熸垚 </a-button> + </template> + </PageWrapper> +</template> +<script lang="ts" setup> + import { BasicForm, useForm } from '/@/components/Form'; + import { onMounted, ref, unref } from 'vue'; + import { Card, InputGroup, Select, Input, Switch } from 'ant-design-vue'; + import { ApiSelect } from '/@/components/Form/index'; + import { useRoute, useRouter } from 'vue-router'; + import { PageWrapper } from '/@/components/Page'; + import { useGo } from '/@/hooks/web/usePage'; + import { newFormSchema, crudSchemas, mainSchemas } from './setting.data'; + import { useTabs } from '/@/hooks/web/useTabs'; + import EntityModal from '/@/views/components/EntityModal.vue'; + import { buildUUID } from '/@/utils/uuid'; + import { SelectTypes } from 'ant-design-vue/es/select'; + import { useMultipleTabStore } from '/@/store/modules/multipleTab'; + import { useModal } from '/@/components/Modal'; + import { SaveEntity, getEntityPropertieList } from '/@/api/tigerapi/system'; + import { EntityPropertie, SYS_LOW_CODE } from '/@/api/tigerapi/model/systemModel'; + import { isNullOrEmpty } from '/@/utils/is'; + import { useUserStore } from '/@/store/modules/user'; + + const ACard = Card; + const AInputGroup = InputGroup; + const AInput = Input; + const ASwitch = Switch; + const route = useRoute(); + const go = useGo(); + const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); + const { setTitle } = useTabs(); + const tabStore = useMultipleTabStore(); + const router = useRouter(); + + const { currentRoute } = router; + function getCurrentTab() { + const route = unref(currentRoute); + return tabStore.getTabList.find((item) => item.fullPath === route.fullPath)!; + } + const currentTab = getCurrentTab(); + var _title = + objParams.value.Update == '0' + ? '浣庝唬鐮侀〉闈㈣鎯呮柊澧�' + : `浣庝唬鐮侀〉闈㈣鎯呯紪杈戯細${objParams.value.Name}`; + setTitle(_title); + const [registerCrudAdd, { openModal: openCrudModal }] = useModal(); + const [registerNewAdd, { openModal: openNewModal }] = useModal(); + const [registerMainAdd, { openModal: openMainModal }] = useModal(); + const [ + register, + { + resetFields, + setFieldsValue, + getFieldsValue, + appendSchemaByField, + removeSchemaByField, + validate, + }, + ] = useForm({ + labelWidth: 120, + baseColProps: { + span: 24, + }, + schemas: newFormSchema, + showActionButtonGroup: false, + }); + const [ + registerCrud, + { + setFieldsValue: setFieldsValueCrud, + getFieldsValue: getFieldsValueCrud, + appendSchemaByField: appendSchemaByFieldCrud, + removeSchemaByField: removeSchemaByFieldCrud, + validate: crudvalidate, + }, + ] = useForm({ + labelWidth: 120, + baseColProps: { + span: 24, + }, + schemas: crudSchemas, + showActionButtonGroup: false, + }); + const [ + registerMain, + { + setFieldsValue: setFieldsValueMain, + getFieldsValue: getFieldsValueMain, + appendSchemaByField: appendSchemaByFieldMain, + removeSchemaByField: removeSchemaByFieldMain, + validate: validateMainForm, + }, + ] = useForm({ + labelWidth: 120, + baseColProps: { + span: 24, + }, + schemas: mainSchemas, + showActionButtonGroup: false, + }); + const objInputs = ref({} as { [key: string]: any }); + const mainInputs = ref({} as { [key: string]: any }); + const crudInputs = ref({} as { [key: string]: any }); + const searchProperties = ref([] as EntityPropertie[]); + const mainProperties = ref([] as EntityPropertie[]); + const crudProperties = ref([] as EntityPropertie[]); + const searchSlots = ref([] as string[]); + const mainSlots = ref([] as string[]); + const crudSlots = ref([] as string[]); + const swSlots = ref([] as string[]); + const mainSwSlots = ref([] as string[]); + const crudSwSlots = ref([] as string[]); + const mainsSwSlots = ref([] as string[]); + const mainwSwSlots = ref([] as string[]); + const crudrSwSlots = ref([] as string[]); + const searchSelectVals = ref({} as { [key: string]: any }); + const mainSelectVals = ref({} as { [key: string]: any }); + const crudSelectVals = ref({} as { [key: string]: any }); + const options = ref<SelectTypes['options']>([ + { + value: 'Input', + label: '杈撳叆妗�', + }, + { + value: 'InputPassword', + label: '杈撳叆瀵嗙爜妗�', + }, + { + value: 'InputNumber', + label: '杈撳叆鏁板瓧妗�', + }, + { + value: 'Select', + label: '涓嬫媺妗�', + }, + { + value: 'ApiSelect', + label: 'Api涓嬫媺妗�', + }, + { + value: 'Checkbox', + label: 'Checkbox', + }, + { + value: 'TimePicker', + label: '鏃堕棿閫夋嫨鍣�', + }, + { + value: 'Switch', + label: '寮�鍏�', + }, + ]); + onMounted(async () => {}); + + async function submitAll() { + try { + const [values, crudvalues, mainvalues] = await Promise.all([ + validate(), + crudvalidate(), + validateMainForm(), + ]); + /* 鏌ヨ鏉′欢Json */ + const Keys = Object.getOwnPropertyNames(values); + var searchjsons = []; + var _json = {}; + var _n = 0; + for (const k in Keys) { + console.log(`${k}:${Keys[k]}`); + if (!isNullOrEmpty(values[Keys[k]])) { + if (Keys[k].toString().startsWith(getFieldsValue().ASSEMBLY_NAME)) { + _json['field'] = values[Keys[k]]; + _json['label'] = objInputs.value[Keys[k]]; + _json['defaultValue'] = ''; + _json['component'] = searchSelectVals.value[Keys[k]]; + _n = _n + 4; + } + if (Keys[k].toString().startsWith('InputNumber')) { + _json['colProps'] = { span: values[Keys[k]] }; + _n++; + } + if (Keys[k].toString().startsWith('Switch')) { + _json['ifShow'] = values[Keys[k]] as boolean; + _n++; + } + if (!isNullOrEmpty(_json) && _n == 6) { + searchjsons.push(_json); + _json = {}; + _n = 0; + } + } + } + console.log(JSON.stringify(searchjsons)); + /* 涓昏〃鏍糐son */ + const mKeys = Object.getOwnPropertyNames(mainvalues); + var mjsons = []; + var mjson = {}; + var i = 0; + for (const k in mKeys) { + console.log(`${k}:${mKeys[k]}`); + if (isNullOrEmpty(mainvalues[mKeys[k]])) { + if ( + mKeys[k].toString().startsWith('Switch') || + mKeys[k].toString().startsWith('sSwitch') || + mKeys[k].toString().startsWith('wSwitch') + ) { + mainvalues[mKeys[k]] = false; + } + } + if (!isNullOrEmpty(mainvalues[mKeys[k]])) { + if (mKeys[k].toString().startsWith(getFieldsValueMain().MainAssemblyName)) { + mjson['dataIndex'] = mainvalues[mKeys[k]]; + mjson['title'] = mainInputs.value[mKeys[k]]; + i = i + 2; + } + if (mKeys[k].toString().startsWith('Switch')) { + mjson['ifShow'] = mainvalues[mKeys[k]] as boolean; + i++; + } + if (mKeys[k].toString().startsWith('sSwitch')) { + mjson['sorter'] = mainvalues[mKeys[k]] as boolean; + i++; + } + if (mKeys[k].toString().startsWith('wSwitch')) { + mjson['resizable'] = mainvalues[mKeys[k]] as boolean; + i++; + } + if (!isNullOrEmpty(mjson) && i == 5) { + mjsons.push(mjson); + i = 0; + mjson = {}; + } + } + } + console.log(JSON.stringify(mjsons)); + /* 澧炲垹鏀笿son */ + const cKeys = Object.getOwnPropertyNames(crudvalues); + var cjsons = []; + var cjson = {}; + var c = 0; + for (const k in cKeys) { + console.log(`${k}:${cKeys[k]}`); + if (isNullOrEmpty(crudvalues[mKeys[k]])) { + if ( + cKeys[k].toString().startsWith('Switch') || + cKeys[k].toString().startsWith('rSwitch') + ) { + crudvalues[mKeys[k]] = false; + } + } + if (!isNullOrEmpty(crudvalues[cKeys[k]])) { + if (cKeys[k].toString().startsWith(getFieldsValueCrud().crudAssemblyName)) { + cjson['field'] = crudvalues[cKeys[k]]; + cjson['label'] = crudInputs.value[cKeys[k]]; + cjson['component'] = crudSelectVals.value[cKeys[k]]; + c = c + 3; + } + if (cKeys[k].toString().startsWith('Switch')) { + cjson['show'] = crudvalues[cKeys[k]] as boolean; + c++; + } + if (cKeys[k].toString().startsWith('rSwitch')) { + cjson['required'] = crudvalues[cKeys[k]] as boolean; + c++; + } + if (cKeys[k].toString().startsWith('InputNumber')) { + cjson['colProps'] = { span: crudvalues[cKeys[k]] }; + c++; + } + if (!isNullOrEmpty(cjson) && c == 6) { + cjsons.push(cjson); + c = 0; + cjson = {}; + } + } + } + console.log(JSON.stringify(cjsons)); + var entity: SYS_LOW_CODE = { + CREATE_USER: useUserStore().getUserInfo.userId as string, + UPDATE_USER: useUserStore().getUserInfo.userId as string, + SEARCH_FORM_JSON: JSON.stringify(searchjsons), + BASE_FORM_JSON: JSON.stringify(mjsons), + FORM_JSON: JSON.stringify(cjsons), + ASSEMBLY_NAME: getFieldsValueMain().MainAssemblyName, + CRUD_ASSY_NAME: getFieldsValueCrud().crudAssemblyName, + SEARCH_ASSY_NAME: getFieldsValue().ASSEMBLY_NAME, + }; + SaveEntity(entity, unref(objParams.value.Update) == '1', 'SYS_LOW_CODE').then((action) => { + if (action.IsSuccessed) { + cancel(); + } + }); + } catch (error) { + console.log(error); + } + } + + async function cancel() { + try { + tabStore.closeTab(currentTab, router); + } catch (error) {} + } + async function handleCreate() { + await validate(); + } + + function handleEdit(record: Recordable) {} + //鐐瑰嚮鎵撳紑鐗╂枡鍒楄〃妗� + function handleSelecNew() { + openNewModal(true, { + data: 'content', + info: 'Info', + }); + } + + function mainSelectAssy() { + openMainModal(true, { + data: 'content', + info: 'Info', + }); + } + + function handleSelectCrud() { + openCrudModal(true, { + data: 'content', + info: 'Info', + }); + } + + async function mainAssySuccess(d, u) { + setFieldsValueMain({ + MainAssemblyName: d.values.values, + }); + var data = await getEntityPropertieList({ + StartWith: d.values.values, + Namespace: 'Tiger.Model', + }); + mainProperties.value = data.items; + } + + async function handleNewSuccess(d, u) { + setFieldsValue({ + ASSEMBLY_NAME: d.values.values, + }); + var data = await getEntityPropertieList({ + StartWith: d.values.values, + Namespace: 'Tiger.Model', + }); + searchProperties.value = data.items; + } + + function handleCrudSuccess(d, u) { + setFieldsValueCrud({ + crudAssemblyName: d.values.values, + }); + } + const n = ref(1); + const m = ref(1); + const j = ref(1); + /** + * @description: 鎵归噺娣诲姞 鏌ヨ閰嶇疆 + */ + function condAdd() { + appendSchemaByField( + [ + { + field: `${getFieldsValue().ASSEMBLY_NAME}${n.value}a`, + component: 'InputGroup', + label: '瀛楁' + n.value, + // required: true, + slot: 'fac' + n.value, + colProps: { span: 14 }, + }, + { + field: `Switch${n.value}`, + component: 'Switch', + label: '鏄惁鏄剧ず', + slot: `sw${n.value}`, + colProps: { span: 3 }, + }, + { + field: `InputNumber${n.value}`, + component: 'InputNumber', + label: '鍒楀', + colProps: { span: 3 }, + }, + { + field: `${n.value}`, + component: 'Input', + label: ' ', + slot: 'subtract', + colProps: { span: 4 }, + }, + ], + '', + ); + searchSlots.value.push('fac' + n.value); + swSlots.value.push(`sw${n.value}`); + objInputs.value[`${getFieldsValue().ASSEMBLY_NAME}${n.value}a`] = ''; + searchSelectVals.value[`${getFieldsValue().ASSEMBLY_NAME}${n.value}a`] = ''; + console.log(searchSlots.value); + n.value++; + } + + function del(field) { + removeSchemaByField([ + `${getFieldsValue().ASSEMBLY_NAME}${field}a`, + `Switch${field}`, + `InputNumber${field}`, + `${field}`, + ]); + swSlots.value.splice(swSlots.value.indexOf(`sw${field}`), 1); + searchSlots.value.splice(searchSlots.value.indexOf(`fac${field}`), 1); + if (searchSlots.value.length == 0) { + n.value = 1; + } + } + + /* 涓昏〃閰嶇疆 */ + function mainCondAdd() { + appendSchemaByFieldMain( + [ + { + field: `${getFieldsValueMain().MainAssemblyName}${m.value}a`, + component: 'InputGroup', + label: '瀛楁' + m.value, + // required: true, + slot: 'mainfac' + m.value, + colProps: { span: 12 }, + }, + { + field: `Switch${m.value}`, + component: 'Switch', + label: '鏄惁鏄剧ず', + slot: `mainSw${m.value}`, + colProps: { span: 3 }, + }, + { + field: `sSwitch${m.value}`, + component: 'Switch', + label: '鏄惁鎺掑簭', + slot: `mainsSw${m.value}`, + colProps: { span: 3 }, + }, + { + field: `wSwitch${m.value}`, + component: 'Switch', + label: '鏄惁鍙皟瀹�', + slot: `mainwSw${m.value}`, + colProps: { span: 3 }, + }, + // { + // field: `InputNumber${m.value}`, + // component: 'InputNumber', + // label: '鍒楀', + // colProps: { span: 3 }, + // }, + { + field: `${m.value}`, + component: 'Input', + label: ' ', + slot: 'mainSubtract', + colProps: { span: 3 }, + }, + ], + '', + ); + mainSlots.value.push('mainfac' + m.value); + mainSwSlots.value.push(`mainSw${m.value}`); + mainsSwSlots.value.push(`mainsSw${m.value}`); + mainwSwSlots.value.push(`mainwSw${m.value}`); + mainInputs.value[`${getFieldsValueMain().MainAssemblyName}${m.value}a`] = ''; + mainSelectVals.value[`${getFieldsValueMain().MainAssemblyName}${m.value}a`] = ''; + console.log(mainSlots.value); + m.value++; + } + + function mainDel(field) { + removeSchemaByFieldMain([ + `${getFieldsValueMain().MainAssemblyName}${field}a`, + `Switch${field}`, + `sSwitch${field}`, + `wSwitch${field}`, + `InputNumber${field}`, + `${field}`, + ]); + mainSwSlots.value.splice(mainSwSlots.value.indexOf(`mainSw${field}`), 1); + mainsSwSlots.value.splice(mainsSwSlots.value.indexOf(`mainsSw${field}`), 1); + mainwSwSlots.value.splice(mainwSwSlots.value.indexOf(`mainwSw${field}`), 1); + mainSlots.value.splice(mainSlots.value.indexOf(`mainfac${field}`), 1); + if (mainSlots.value.length == 0) { + m.value = 1; + } + } + + /* 澧炲垹鏀归厤缃� */ + function crudCondAdd() { + appendSchemaByFieldCrud( + [ + { + field: `${getFieldsValueCrud().crudAssemblyName}${j.value}a`, + component: 'InputGroup', + label: '瀛楁' + j.value, + // required: true, + slot: 'crudfac' + j.value, + colProps: { span: 12 }, + }, + { + field: `Switch${j.value}`, + component: 'Switch', + label: '鏄惁鏄剧ず', + slot: `crudSw${j.value}`, + colProps: { span: 3 }, + }, + { + field: `rSwitch${j.value}`, + component: 'Switch', + label: '鏄惁蹇呭~', + slot: `crudrSw${j.value}`, + colProps: { span: 3 }, + }, + { + field: `InputNumber${j.value}`, + component: 'InputNumber', + label: '鍒楀', + colProps: { span: 3 }, + }, + { + field: `${j.value}`, + component: 'Input', + label: ' ', + slot: 'crudSubtract', + colProps: { span: 3 }, + }, + ], + '', + ); + crudSlots.value.push('crudfac' + j.value); + crudSwSlots.value.push(`crudSw${j.value}`); + crudrSwSlots.value.push(`crudrSw${j.value}`); + crudInputs.value[`${getFieldsValueCrud().crudAssemblyName}${j.value}a`] = ''; + crudSelectVals.value[`${getFieldsValueCrud().crudAssemblyName}${j.value}a`] = ''; + console.log(crudSlots.value); + j.value++; + } + + function crudDel(field) { + removeSchemaByFieldCrud([ + `${getFieldsValueCrud().crudAssemblyName}${field}a`, + `Switch${field}`, + `rSwitch${field}`, + `InputNumber${field}`, + `${field}`, + ]); + crudSwSlots.value.splice(crudSwSlots.value.indexOf(`crudSw${field}`), 1); + crudrSwSlots.value.splice(crudrSwSlots.value.indexOf(`crudrSw${field}`), 1); + crudSlots.value.splice(crudSlots.value.indexOf(`crudfac${field}`), 1); + if (crudSlots.value.length == 0) { + j.value = 1; + } + } + + function goBack() { + // 鏈緥鐨勬晥鏋滄椂鐐瑰嚮杩斿洖濮嬬粓璺宠浆鍒拌处鍙峰垪琛ㄩ〉锛屽疄闄呭簲鐢ㄦ椂鍙繑鍥炰笂涓�椤� + go('/LowCodePage'); + } +</script> +<style lang="less" scoped> + .high-form { + padding-bottom: 48px; + } +</style> diff --git a/src/views/tigerprojects/system/lowcode/setting/setting.data.ts b/src/views/tigerprojects/system/lowcode/setting/setting.data.ts new file mode 100644 index 0000000..86734e0 --- /dev/null +++ b/src/views/tigerprojects/system/lowcode/setting/setting.data.ts @@ -0,0 +1,92 @@ +import { BasicColumn, FormSchema } from '/@/components/Table'; + +//鍒楄〃鏄剧ず +export const dtlColumns: BasicColumn[] = [ + { + title: '瀛楁鍚�', + dataIndex: 'FieldName', + ifShow: false, + width: 180, + }, +]; + +export const newFormSchema: FormSchema[] = [ + { + field: 'ASSEMBLY_NAME', + label: '瀹炰綋绫诲悕', + component: 'Input', + colProps: { span: 8 }, + }, + { + field: '00', + component: 'Input', + label: '1', + colSlot: 'add', + colProps: { + span: 2, + }, + }, + { + field: '0', + component: 'Input', + label: '1', + colSlot: 'condAdd', + colProps: { + span: 10, + }, + }, +]; + +export const crudSchemas: FormSchema[] = [ + { + field: 'crudAssemblyName', + label: '瀹炰綋绫诲悕', + component: 'Input', + colProps: { span: 8 }, + }, + { + field: '00', + component: 'Input', + label: '1', + colSlot: 'add', + colProps: { + span: 2, + }, + }, + { + field: '0', + component: 'Input', + label: '1', + colSlot: 'crudCondAdd', + colProps: { + span: 10, + }, + }, +]; + +export const mainSchemas: FormSchema[] = [ + { + field: 'MainAssemblyName', + label: '瀹炰綋绫诲悕', + component: 'Input', + colProps: { span: 8 }, + }, + { + field: '00', + component: 'Input', + label: '1', + colSlot: 'add', + colProps: { + span: 2, + }, + }, + { + field: '0', + component: 'Input', + label: '1', + colSlot: 'mainCondAdd', + colProps: { + span: 10, + }, + }, +]; diff --git a/types/config.d.ts b/types/config.d.ts index fa08c58..6f73423 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -141,6 +141,7 @@ title: string; // Service interface url apiUrl: string; + sysApiUrl: string; taskApiUrl: string; // Upload url uploadUrl?: string; @@ -156,6 +157,7 @@ VITE_GLOB_APP_TITLE: string; // Service interface url VITE_GLOB_API_URL: string; + VITE_GLOB_SYS_API_URL: string; VITE_GLOB_TSK_API_URL: string; // Service interface url prefix VITE_GLOB_API_URL_PREFIX?: string; -- Gitblit v1.9.3