| | |
| | | EntityList, |
| | | } from './model/systemModel'; |
| | | import { defHttp } from '/@/utils/http/axios'; |
| | | import { isNullOrEmpty } from '/@/utils/is'; |
| | | import { isNullOrEmpty, isTimeType } from '/@/utils/is'; |
| | | |
| | | export enum Api { |
| | | QueryUrl = '/Base/Query', |
| | |
| | | /* éç¨æ¥è¯¢å页 */ |
| | | export async function getListByPage<T>(params: T) { |
| | | const Keys = Object.getOwnPropertyNames(params); |
| | | let sqlcmd = ''; |
| | | let sqlcmd = '1=1 '; |
| | | let order = ''; |
| | | for (const k in Keys) { |
| | | console.log(`${k}:${Keys[k]}`); |
| | | if ( |
| | | !isNullOrEmpty(params[Keys[k]]) && |
| | | Keys[k] != 'page' && |
| | | Keys[k] != 'pageSize' && |
| | | Keys[k] != 'TABLE_NAME' |
| | | Keys[k] != 'TABLE_NAME' && |
| | | Keys[k] != 'order' && |
| | | Keys[k] != 'field' && |
| | | Keys[k] != '0' |
| | | ) { |
| | | sqlcmd += `And ${Keys[k]} like '%${params[Keys[k]]}%'`; |
| | | if (!isNullOrEmpty(params[Keys[k]].length) && isTimeType(params[Keys[k]][0])) { |
| | | sqlcmd += ` And ${Keys[k]} > '${params[Keys[k]][0]}'`; |
| | | sqlcmd += ` And ${Keys[k]} < '${params[Keys[k]][1]}'`; |
| | | } else { |
| | | sqlcmd += `And ${Keys[k]} like '%${params[Keys[k]]}%'`; |
| | | } |
| | | } |
| | | } |
| | | const rParams = genActionPage(params['TABLE_NAME'], sqlcmd, params['page'], params['pageSize']); |
| | | if (!isNullOrEmpty(params['order'])) { |
| | | order = params['order'] == 'descend' ? params['field'] + ' desc' : params['field']; |
| | | } |
| | | const rParams = genAction(params['TABLE_NAME'], { |
| | | QueryAble_T: '', |
| | | where: sqlcmd, |
| | | order: order, |
| | | page: { |
| | | pageAble_T: 'string', |
| | | draw: 1, |
| | | pageIndex: params['page'], |
| | | pageSize: params['pageSize'], |
| | | }, |
| | | }); |
| | | return getListByPageAsync(rParams); |
| | | } |
| | | async function getListByPageAsync(params: ApiActionPage) { |
| | | const data = await defHttp.post<ApiActionPage>( |
| | | { url: Api.EntityPageList, params }, |
| | | async function getListByPageAsync(params: any) { |
| | | const data = await defHttp.post( |
| | | { url: Api.QueryUrl, params }, |
| | | { |
| | | isTransformResponse: false, |
| | | }, |
| | | ); |
| | | const model = { |
| | | items: data.Data.data, |
| | | total: data.Data.totals, |
| | | items: data.Data.page.data, |
| | | total: data.Data.page.totals, |
| | | }; |
| | | return model; |
| | | } |
| | |
| | | const reg = /^http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- ./?%&=]*)?/; |
| | | return reg.test(path); |
| | | } |
| | | |
| | | export function isTime(value: any): value is Date { |
| | | return value instanceof Date && !isNaN(value.getTime()); |
| | | } |
| | | |
| | | export function isTimeViaConstructor(value: any): boolean { |
| | | return value instanceof Date || value.constructor === Date; |
| | | } |
| | | |
| | | export function isTimeViaRegExp(value: any): boolean { |
| | | return /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(value.toString()); |
| | | } |
| | | |
| | | export function isTimeType(value: string): boolean { |
| | | return !isNaN(Date.parse(value)); |
| | | } |
| | | |
| | | // // ç¤ºä¾ |
| | | // const time1 = new Date(); |
| | | // console.log(isTime(time1)); // true |
| | | |
| | | // const time2 = '2023-04-01T12:00:00Z'; |
| | | // console.log(isTimeViaRegExp(time2)); // true |
| | | |
| | | // const notTime = 'hello world'; |
| | | // console.log(isTime(notTime)); // false |
| | |
| | | sorter: true, |
| | | width: 180, |
| | | }, |
| | | // { |
| | | // title: t('ç©ææè¿°'), |
| | | // dataIndex: 'ITEM_DESC', |
| | | // resizable:true, |
| | | // }, |
| | | // { |
| | | // title: t('çç¹ç¶æ', |
| | | // dataIndex: 'STATUS', |
| | | // resizable:true, |
| | | // }, |
| | | // { |
| | | // title: t('çç¹ç»æ', |
| | | // dataIndex: 'RESULT', |
| | | // resizable:true, |
| | | // }, |
| | | // { |
| | | // title: t('WMSæ°é', |
| | | // dataIndex: 'QTY', |
| | | // resizable:true, |
| | | // }, |
| | | // { |
| | | // title: t('ACT_QTY', |
| | | // dataIndex: 'COUNT_TYPE', |
| | | // resizable:true, |
| | | // } |
| | | ]; |
| | | |
| | | const emit = defineEmits(['success', 'register']); |
| | | const checkedKeys = ref<Array<string | number>>([]); |
| | | const [registerTable, { reload, getForm }] = useTable({ |
| | | title: 'ç©æå表', |
| | | title: 'å表信æ¯', |
| | | api: getItemListByPage, |
| | | columns: ItemColumns, |
| | | formConfig: { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <BasicModal |
| | | width="800px" |
| | | :height="600" |
| | | v-bind="$attrs" |
| | | @register="register" |
| | | :title="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 { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; |
| | | import { BasicTable, BasicColumn, TableAction, useTable } from '/@/components/Table'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { getListByPage } from '/@/api/tigerapi/system'; |
| | | |
| | | const { t } = useI18n(); |
| | | const title = ref(''); |
| | | const tableName = ref(''); |
| | | const rowKey = ref(''); |
| | | const schemas = ref([] as FormSchema[]); |
| | | |
| | | //å表 |
| | | const ItemColumns = ref([] as BasicColumn[]); |
| | | |
| | | const emit = defineEmits(['success', 'register']); |
| | | const checkedKeys = ref<Array<string | number>>([]); |
| | | const [registerTable, { reload, getForm }] = useTable({ |
| | | title: 'å表信æ¯', |
| | | api: getListByPage, |
| | | searchInfo: { TABLE_NAME: tableName }, |
| | | columns: ItemColumns, |
| | | formConfig: { |
| | | labelWidth: 120, |
| | | schemas, |
| | | }, |
| | | useSearchForm: true, |
| | | showTableSetting: false, |
| | | rowKey: rowKey, |
| | | 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, |
| | | // }); |
| | | title.value = data?.title; |
| | | schemas.value = data?.schemas; |
| | | ItemColumns.value = data?.ItemColumns; |
| | | tableName.value = data?.tableName; |
| | | rowKey.value = data?.rowKey; |
| | | 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[rowKey.value]]; |
| | | } else { |
| | | checkedKeys.value = checkedKeys.value.filter((code) => code !== record[rowKey.value]); |
| | | } |
| | | } |
| | | function onSelectAll(selected, selectedRows, changeRows) { |
| | | const changeIds = changeRows.map((item) => item[rowKey.value]); |
| | | if (selected) { |
| | | checkedKeys.value = [...checkedKeys.value, ...changeIds]; |
| | | } else { |
| | | checkedKeys.value = checkedKeys.value.filter((code) => { |
| | | return !changeIds.includes(code); |
| | | }); |
| | | } |
| | | } |
| | | </script> |
| | |
| | | @click="handleSelectItem" |
| | | preIcon="search|svg" |
| | | /> |
| | | <ItemModal @register="registerItemAdd" @success="handleItemSuccess" /> |
| | | <NormalModal @register="registerItemAdd" @success="handleItemSuccess" /> |
| | | </template> |
| | | <template #action="{ record }"> |
| | | <TableAction |
| | |
| | | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
| | | import WoDrawer from './WoDrawer.vue'; |
| | | import WoModal from './WoModal.vue'; |
| | | import ItemModal from '/@/views/components/ItemModal.vue'; |
| | | import NormalModal from '/@/views/components/NormalModal.vue'; |
| | | import { useDrawer } from '/@/components/Drawer'; |
| | | import { columns, searchFormSchema } from './biz_mes_wo.data'; |
| | | import { DeleteMesWo } from '/@/api/tigerapi/mes/wo'; |
| | |
| | | //ç¹å»æå¼ç©æåè¡¨æ¡ |
| | | function handleSelectItem() { |
| | | openItemModal(true, { |
| | | data: 'content', |
| | | info: 'Info', |
| | | title: 'ç©æå表', |
| | | schemas: [ |
| | | { |
| | | field: 'ITEM_CODE', |
| | | component: 'Input', |
| | | label: 'ç©æç¼ç ', |
| | | colProps: { |
| | | span: 12, |
| | | }, |
| | | }, |
| | | ], |
| | | ItemColumns: [ |
| | | { |
| | | title: t('ç©æç¼ç '), |
| | | dataIndex: 'ITEM_CODE', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 200, |
| | | }, |
| | | { |
| | | title: t('ç©æåç§°'), |
| | | dataIndex: 'ITEM_NAME', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 180, |
| | | }, |
| | | ], |
| | | tableName: 'BAS_ITEM', |
| | | rowKey: 'ITEM_CODE', |
| | | }); |
| | | } |
| | | |
| | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | |
| | | const { t } = useI18n(); |
| | | const { notification } = useMessage(); |
| | | /* èªå®ä¹æé®æ¹æ³ */ |
| | | export function DftGrpRelease(reload: Fn, params: {}) { |
| | |
| | | onClick: () => {}, |
| | | }, |
| | | ]; |
| | | |
| | | export function dftGrpGetSelectSuccess(d, u) { |
| | | return { |
| | | ITEM_CODE: d.values.values, |
| | | }; |
| | | } |
| | | |
| | | export function dftGrpOpenSelectItem(openItemModal: Fn) { |
| | | openItemModal(true, { |
| | | title: 'ç©æå表', |
| | | schemas: [ |
| | | { |
| | | field: 'ITEM_CODE', |
| | | component: 'Input', |
| | | label: 'ç©æç¼ç ', |
| | | colProps: { |
| | | span: 12, |
| | | }, |
| | | }, |
| | | ], |
| | | ItemColumns: [ |
| | | { |
| | | title: t('ç©æç¼ç '), |
| | | dataIndex: 'ITEM_CODE', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 200, |
| | | }, |
| | | { |
| | | title: t('ç©æåç§°'), |
| | | dataIndex: 'ITEM_NAME', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 180, |
| | | }, |
| | | ], |
| | | tableName: 'BAS_ITEM', |
| | | rowKey: 'ITEM_CODE', |
| | | }); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | |
| | | const { t } = useI18n(); |
| | | const { notification } = useMessage(); |
| | | /* èªå®ä¹æé®æ¹æ³ */ |
| | | export function RsGrpRelease(reload: Fn, params: {}) { |
| | | console.log('ç¹å»äºä¸åæé®'); |
| | | notification.success({ |
| | | message: 'ç¹å»äºä¸åæé®', |
| | | description: `${params.entityName}`, |
| | | duration: 3, |
| | | }); |
| | | reload(); |
| | | } |
| | | |
| | | export const rsGrpactionColumn: BasicColumn = { |
| | | width: 180, |
| | | title: 'æä½', |
| | | dataIndex: 'action', |
| | | slots: { customRender: 'action' }, |
| | | fixed: undefined, |
| | | }; |
| | | |
| | | export const rsGrpActionItem: ActionItem[] = [ |
| | | { |
| | | icon: 'release|svg', |
| | | tooltip: 'ä¸å', |
| | | onClick: () => {}, |
| | | }, |
| | | ]; |
| | | |
| | | export function rsGrpGetSelectSuccess(d, u) { |
| | | return { |
| | | RSNG_CODE: d.values.values, |
| | | }; |
| | | } |
| | | |
| | | export function rsGrpOpenSelectItem(openItemModal: Fn) { |
| | | openItemModal(true, { |
| | | title: 'ä¸è¯åå ç»å表', |
| | | schemas: [ |
| | | { |
| | | field: 'RSNG_CODE', |
| | | component: 'Input', |
| | | label: 'ä¸è¯åå ç»ä»£ç ', |
| | | colProps: { |
| | | span: 12, |
| | | }, |
| | | }, |
| | | ], |
| | | ItemColumns: [ |
| | | { |
| | | title: t('ä¸è¯åå ç»ä»£ç '), |
| | | dataIndex: 'RSNG_CODE', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 200, |
| | | }, |
| | | { |
| | | title: t('ä¸è¯åå ç»åç§°'), |
| | | dataIndex: 'RSNG_NAME', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 180, |
| | | }, |
| | | ], |
| | | tableName: 'BAS_REASON_GRP', |
| | | rowKey: 'RSNG_CODE', |
| | | }); |
| | | } |
| | |
| | | import { DftGrpRelease, dftGrpActionItem, dftGrpactionColumn } from './basDefectGrp'; |
| | | import { |
| | | DftGrpRelease, |
| | | dftGrpActionItem, |
| | | dftGrpOpenSelectItem, |
| | | dftGrpGetSelectSuccess, |
| | | dftGrpactionColumn, |
| | | } from './basDefectGrp'; |
| | | import { rsGrpGetSelectSuccess, rsGrpOpenSelectItem } from './basReasonGrp'; |
| | | import { DeleteEntity } from '/@/api/tigerapi/system'; |
| | | import { ActionItem, BasicColumn } from '/@/components/Table'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | |
| | | const { t } = useI18n(); |
| | | |
| | | export function GetActionsData(params: {}, ...args: Fn[]) { |
| | | let data = [ |
| | |
| | | }, |
| | | }, |
| | | ] as ActionItem[]; |
| | | switch (params.entityName) { |
| | | switch (params['entityName']) { |
| | | case 'BAS_DEFECT_GRP': |
| | | const _d = dftGrpActionItem; |
| | | _d[0].onClick = DftGrpRelease.bind(null, args[1], params); |
| | |
| | | } |
| | | |
| | | function deleteRecord(fn: Fn, params: {}) { |
| | | console.log(params.record); |
| | | console.log(params['record']); |
| | | //å é¤ |
| | | const apiAction = DeleteEntity(params.record, params.entityName); |
| | | const apiAction = DeleteEntity(params['record'], params['entityName']); |
| | | apiAction.then((action) => { |
| | | if (action.IsSuccessed) { |
| | | fn(); |
| | |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | /* å¼¹åºéæ©æ¡éæ©æå */ |
| | | export function GetSelectSuccess(d, u, entityName: string) { |
| | | let data = {}; |
| | | switch (entityName) { |
| | | case 'BAS_DEFECT_GRP': |
| | | data = dftGrpGetSelectSuccess(d, u); |
| | | break; |
| | | case 'BAS_REASON_GRP': |
| | | data = rsGrpGetSelectSuccess(d, u); |
| | | break; |
| | | default: |
| | | data = { |
| | | ITEM_CODE: d.values.values, |
| | | }; |
| | | break; |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | /* æå¼å¼¹åºéæ©æ¡ */ |
| | | export function OpenSelectItem(openItemModal: Fn, entityName: string) { |
| | | switch (entityName) { |
| | | case 'BAS_DEFECT_GRP': |
| | | dftGrpOpenSelectItem(openItemModal); |
| | | break; |
| | | case 'BAS_REASON_GRP': |
| | | rsGrpOpenSelectItem(openItemModal); |
| | | break; |
| | | default: |
| | | openItemModal(true, { |
| | | title: 'ç©æå表', |
| | | schemas: [ |
| | | { |
| | | field: 'ITEM_CODE', |
| | | component: 'Input', |
| | | label: 'ç©æç¼ç ', |
| | | colProps: { |
| | | span: 12, |
| | | }, |
| | | }, |
| | | ], |
| | | ItemColumns: [ |
| | | { |
| | | title: t('ç©æç¼ç '), |
| | | dataIndex: 'ITEM_CODE', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 200, |
| | | }, |
| | | { |
| | | title: t('ç©æåç§°'), |
| | | dataIndex: 'ITEM_NAME', |
| | | resizable: true, |
| | | sorter: true, |
| | | width: 180, |
| | | }, |
| | | ], |
| | | tableName: 'BAS_ITEM', |
| | | rowKey: 'ITEM_CODE', |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | |
| | | <template #action="{ record }"> |
| | | <TableAction :actions="createActions(record)" /> |
| | | </template> |
| | | <template #form-add="{ field }"> |
| | | <a-button |
| | | v-if="field" |
| | | class="mt-1 ml-1" |
| | | size="small" |
| | | @click="handleSelectItem" |
| | | preIcon="search|svg" |
| | | /> |
| | | <NormalModal @register="registerItemAdd" @success="handleItemSuccess" /> |
| | | </template> |
| | | </BasicTable> |
| | | <normalDrawer @register="registerDrawer" @success="handleSuccess" /> |
| | | </div> |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { h, onMounted, ref } from 'vue'; |
| | | import { h, onMounted, ref, unref } from 'vue'; |
| | | import { BasicTable, useTable, TableAction, BasicColumn, FormSchema } from '/@/components/Table'; |
| | | import { useDrawer } from '/@/components/Drawer'; |
| | | import normalDrawer from './normalDrawer.vue'; |
| | | import { getEntity, getListByPage } from '/@/api/tigerapi/system'; |
| | | import NormalModal from '/@/views/components/NormalModal.vue'; |
| | | import { GetEnum, 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'; |
| | | import { GetActionColumn, GetActionsData } from './data'; |
| | | import { GetActionColumn, GetActionsData, OpenSelectItem, GetSelectSuccess } from './data'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { useLocale } from '/@/locales/useLocale'; |
| | | |
| | | const { getLocale } = useLocale(); |
| | | const route = useRoute(); |
| | | const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); |
| | | const entityName = ref(objParams.value.ID); |
| | | const globSetting = useGlobSetting(); |
| | | const _columns = ref([]); |
| | | const _searchFormSchema = ref([]); |
| | | const _crudFormSchema = ref([]); |
| | | const [registerItemAdd, { openModal: openItemModal }] = useModal(); |
| | | const [registerDrawer, { openDrawer }] = useDrawer(); |
| | | const [registerTable, { reload }] = useTable({ |
| | | const [registerTable, { getForm, reload }] = useTable({ |
| | | title: 'å表信æ¯', |
| | | api: getListByPage, |
| | | searchInfo: { TABLE_NAME: objParams.value.ID }, |
| | |
| | | sqlcmd: "ASSEMBLY_NAME ='" + objParams.value.ID + "'", |
| | | entityName: 'SYS_LOW_CODE', |
| | | }); |
| | | _searchFormSchema.value = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); |
| | | _crudFormSchema.value = JSON.parse(data.Data.Items[0].FORM_JSON); |
| | | var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); |
| | | for (const i in searchForms) { |
| | | if ( |
| | | !isNullOrEmpty(searchForms[i].componentProps) && |
| | | !isNullOrEmpty(searchForms[i].componentProps.api) && |
| | | searchForms[i].componentProps.api == 'GetEnum' |
| | | ) { |
| | | searchForms[i].componentProps.api = GetEnum; |
| | | searchForms[i].componentProps.params.name = `${objParams.value.ID}+${searchForms[i].field}s`; |
| | | searchForms[i].componentProps.labelField = unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name'; |
| | | } |
| | | if ( |
| | | !isNullOrEmpty(searchForms[i].componentProps) && |
| | | !isNullOrEmpty(searchForms[i].componentProps.api) && |
| | | searchForms[i].componentProps.api == 'getEntity' |
| | | ) { |
| | | searchForms[i].componentProps.api = getEntity; |
| | | searchForms[i].componentProps.resultField = 'Data.Items'; |
| | | } |
| | | } |
| | | _searchFormSchema.value = searchForms; |
| | | var _cruds = JSON.parse(data.Data.Items[0].FORM_JSON); |
| | | for (const i in _cruds) { |
| | | if ( |
| | | !isNullOrEmpty(_cruds[i].componentProps) && |
| | | !isNullOrEmpty(_cruds[i].componentProps.api) && |
| | | _cruds[i].componentProps.api == 'GetEnum' |
| | | ) { |
| | | _cruds[i].componentProps.api = GetEnum; |
| | | _cruds[i].componentProps.params.name = `${objParams.value.ID}+${_cruds[i].field}s`; |
| | | _cruds[i].componentProps.labelField = unref(getLocale) == 'zh_CN' ? 'Desc' : 'Name'; |
| | | } |
| | | if ( |
| | | !isNullOrEmpty(_cruds[i].componentProps) && |
| | | !isNullOrEmpty(_cruds[i].componentProps.api) && |
| | | _cruds[i].componentProps.api == 'getEntity' |
| | | ) { |
| | | _cruds[i].componentProps.api = getEntity; |
| | | _cruds[i].componentProps.resultField = 'Data.Items'; |
| | | } |
| | | } |
| | | _crudFormSchema.value = _cruds; |
| | | |
| | | var objs = JSON.parse(data.Data.Items[0].BASE_FORM_JSON); |
| | | for (const i in objs) { |
| | | if (!isNullOrEmpty(objs[i].customRender)) { |
| | |
| | | } |
| | | _columns.value = objs; |
| | | }); |
| | | |
| | | /* å¼¹åºéæ©æ¡éæ©æååäºä»¶ */ |
| | | function handleItemSuccess(d, u) { |
| | | getForm().setFieldsValue(GetSelectSuccess(d, u, getForm().getFieldsValue()['0'])); |
| | | } |
| | | |
| | | /* å¼¹åºéæ©æ¡ */ |
| | | function handleSelectItem() { |
| | | OpenSelectItem(openItemModal, getForm().getFieldsValue()['0']); |
| | | } |
| | | </script> |
| | |
| | | <template #[item]="{ model, field }" v-for="item in mainwSwSlots" :key="item"> |
| | | <a-switch v-model:checked="model[field]" /> |
| | | </template> |
| | | <template #[item]="{ model, field }" v-for="item in mainIaSlots" :key="item"> |
| | | <a-input v-model:value="model[field]" /> |
| | | </template> |
| | | </BasicForm> |
| | | </div> |
| | | </a-card> |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { BasicForm, useForm } from '/@/components/Form'; |
| | | import { onMounted, ref, unref } from 'vue'; |
| | | import { nextTick, 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 { 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 { SaveEntity, getEntity, 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'; |
| | |
| | | schemas: mainSchemas, |
| | | showActionButtonGroup: false, |
| | | }); |
| | | const SearchEntName = ref(''); |
| | | const MainEntName = ref(''); |
| | | const CrudEntName = ref(''); |
| | | const objInputs = ref({} as { [key: string]: any }); |
| | | const mainInputs = ref({} as { [key: string]: any }); |
| | | const crudInputs = ref({} as { [key: string]: any }); |
| | |
| | | const crudSwSlots = ref([] as string[]); |
| | | const mainsSwSlots = ref([] as string[]); |
| | | const mainwSwSlots = ref([] as string[]); |
| | | const mainIaSlots = ref([] as string[]); |
| | | const crudrSwSlots = ref([] as string[]); |
| | | const searchSelectVals = ref({} as { [key: string]: any }); |
| | | const mainSelectVals = ref({} as { [key: string]: any }); |
| | |
| | | label: 'Checkbox', |
| | | }, |
| | | { |
| | | value: 'TimePicker', |
| | | value: 'RangePicker', |
| | | label: 'æ¶é´éæ©å¨', |
| | | }, |
| | | { |
| | | value: 'Switch', |
| | | label: 'å¼å
³', |
| | | }, |
| | | { |
| | | value: 'PoPSelect', |
| | | label: 'å¼¹åºéæ©æ¡', |
| | | }, |
| | | ]); |
| | | onMounted(async () => { |
| | | |
| | | |
| | | onMounted(() => { |
| | | if (unref(objParams.value.Update) == '1') { |
| | | getEntity({ |
| | | sqlcmd: "ID ='" + objParams.value.ID + "'", |
| | | entityName: 'SYS_LOW_CODE', |
| | | }).then((data) => { |
| | | var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); |
| | | SearchEntName.value = data.Data.Items[0].SEARCH_ASSY_NAME; |
| | | setFieldsValue({ ASSEMBLY_NAME: data.Data.Items[0].SEARCH_ASSY_NAME }); |
| | | for (const i in searchForms) { |
| | | if (searchForms[i]['field'] != '0') { |
| | | condAdd(); |
| | | setFieldsValue({ |
| | | [`${SearchEntName.value}${Number(i) + 1}a`]: searchForms[i]['field'], |
| | | [`InputNumber${Number(i) + 1}`]: searchForms[i]['colProps'].span, |
| | | [`Switch${Number(i) + 1}`]: searchForms[i]['ifShow'], |
| | | }); |
| | | objInputs.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i]['label']; |
| | | searchSelectVals.value[`${SearchEntName.value}${Number(i) + 1}a`] = searchForms[i][ |
| | | 'comp' |
| | | ] |
| | | ? searchForms[i]['comp'] |
| | | : searchForms[i]['component']; |
| | | } |
| | | } |
| | | var crudForms = JSON.parse(data.Data.Items[0].FORM_JSON); |
| | | CrudEntName.value = data.Data.Items[0].CRUD_ASSY_NAME; |
| | | setFieldsValueCrud({ crudAssemblyName: data.Data.Items[0].CRUD_ASSY_NAME }); |
| | | for (const i in crudForms) { |
| | | crudCondAdd(); |
| | | setFieldsValueCrud({ |
| | | [`${CrudEntName.value}${Number(i) + 1}a`]: crudForms[i]['field'], |
| | | [`InputNumber${Number(i) + 1}`]: crudForms[i]['colProps'].span, |
| | | [`Switch${Number(i) + 1}`]: crudForms[i]['show'], |
| | | [`rSwitch${Number(i) + 1}`]: crudForms[i]['required'], |
| | | }); |
| | | crudInputs.value[`${CrudEntName.value}${Number(i) + 1}a`] = crudForms[i]['label']; |
| | | crudSelectVals.value[`${CrudEntName.value}${Number(i) + 1}a`] = crudForms[i]['component']; |
| | | } |
| | | var objs = JSON.parse(data.Data.Items[0].BASE_FORM_JSON); |
| | | MainEntName.value = data.Data.Items[0].ASSEMBLY_NAME; |
| | | setFieldsValueMain({ MainAssemblyName: MainEntName.value }); |
| | | for (const i in objs) { |
| | | mainCondAdd(); |
| | | setFieldsValueMain({ |
| | | [`${MainEntName.value}${Number(i) + 1}a`]: objs[i]['dataIndex'], |
| | | [`Switch${Number(i) + 1}`]: objs[i]['ifShow'], |
| | | [`sSwitch${Number(i) + 1}`]: objs[i]['sorter'], |
| | | [`wSwitch${Number(i) + 1}`]: objs[i]['resizable'], |
| | | [`InputTextArea${Number(i) + 1}`]: objs[i]['customRender'], |
| | | }); |
| | | mainInputs.value[`${MainEntName.value}${Number(i) + 1}a`] = objs[i]['title']; |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | async function submitAll() { |
| | |
| | | crudvalidate(), |
| | | validateMainForm(), |
| | | ]); |
| | | |
| | | /* æ¥è¯¢æ¡ä»¶Json */ |
| | | const Keys = Object.getOwnPropertyNames(values); |
| | | var searchjsons = []; |
| | |
| | | _n++; |
| | | } |
| | | if (!isNullOrEmpty(_json) && _n == 6) { |
| | | //妿æ¯å¼¹åºéæ©æ¡ |
| | | if (_json['component'] == 'PoPSelect') { |
| | | _json['component'] = 'Input'; |
| | | _json['comp'] = 'PoPSelect'; |
| | | searchjsons.push(_json); |
| | | _json = {}; |
| | | _json['field'] = '0'; |
| | | _json['label'] = '1'; |
| | | _json['defaultValue'] = ''; |
| | | _json['component'] = 'Input'; |
| | | _json['colProps'] = { span: 4 }; |
| | | _json['ifShow'] = true; |
| | | _json['colSlot'] = 'add'; |
| | | } |
| | | searchjsons.push(_json); |
| | | _json = {}; |
| | | _n = 0; |
| | |
| | | : (mainvalues[mKeys[k]] as boolean); |
| | | i++; |
| | | } |
| | | if (!isNullOrEmpty(mjson) && i == 5) { |
| | | if (mKeys[k].toString().startsWith('InputTextArea')) { |
| | | mjson['customRender'] = isNullOrEmpty(mainvalues[mKeys[k]]) ? '' : mainvalues[mKeys[k]]; |
| | | i++; |
| | | } |
| | | if (!isNullOrEmpty(mjson) && i == 6) { |
| | | mjsons.push(mjson); |
| | | i = 0; |
| | | mjson = {}; |
| | |
| | | for (const k in cKeys) { |
| | | console.log(`${k}:${cKeys[k]}`); |
| | | if (cKeys[k].toString().startsWith(getFieldsValueCrud().crudAssemblyName)) { |
| | | cjson['field'] = isNullOrEmpty(crudvalues[mKeys[k]]) ? '' : crudvalues[cKeys[k]]; |
| | | cjson['label'] = isNullOrEmpty(crudvalues[mKeys[k]]) ? '' : crudInputs.value[cKeys[k]]; |
| | | cjson['field'] = isNullOrEmpty(crudvalues[cKeys[k]]) ? '' : crudvalues[cKeys[k]]; |
| | | cjson['label'] = isNullOrEmpty(crudvalues[cKeys[k]]) ? '' : crudInputs.value[cKeys[k]]; |
| | | cjson['component'] = crudSelectVals.value[cKeys[k]]; |
| | | c = c + 3; |
| | | } |
| | | if (cKeys[k].toString().startsWith('Switch')) { |
| | | cjson['show'] = isNullOrEmpty(crudvalues[mKeys[k]]) |
| | | cjson['show'] = isNullOrEmpty(crudvalues[cKeys[k]]) |
| | | ? false |
| | | : (crudvalues[cKeys[k]] as boolean); |
| | | c++; |
| | | } |
| | | if (cKeys[k].toString().startsWith('rSwitch')) { |
| | | cjson['required'] = isNullOrEmpty(crudvalues[mKeys[k]]) |
| | | cjson['required'] = isNullOrEmpty(crudvalues[cKeys[k]]) |
| | | ? false |
| | | : (crudvalues[cKeys[k]] as boolean); |
| | | c++; |
| | |
| | | } |
| | | console.log(JSON.stringify(cjsons)); |
| | | var entity: SYS_LOW_CODE = { |
| | | ID: objParams.value.ID, |
| | | CREATE_USER: useUserStore().getUserInfo.userId as string, |
| | | UPDATE_USER: useUserStore().getUserInfo.userId as string, |
| | | SEARCH_FORM_JSON: JSON.stringify(searchjsons), |
| | |
| | | } |
| | | |
| | | function handleEdit(record: Recordable) {} |
| | | //ç¹å»æå¼ç©æåè¡¨æ¡ |
| | | |
| | | function handleSelecNew() { |
| | | openNewModal(true, { |
| | | data: 'content', |
| | |
| | | Namespace: 'Tiger.Model', |
| | | }); |
| | | mainProperties.value = data.items; |
| | | MainEntName.value = d.values.values; |
| | | } |
| | | |
| | | async function handleNewSuccess(d, u) { |
| | |
| | | Namespace: 'Tiger.Model', |
| | | }); |
| | | searchProperties.value = data.items; |
| | | SearchEntName.value = d.values.values; |
| | | } |
| | | |
| | | function handleCrudSuccess(d, u) { |
| | | async function handleCrudSuccess(d, u) { |
| | | setFieldsValueCrud({ |
| | | crudAssemblyName: d.values.values, |
| | | }); |
| | | var data = await getEntityPropertieList({ |
| | | StartWith: d.values.values, |
| | | Namespace: 'Tiger.Model', |
| | | }); |
| | | crudProperties.value = data.items; |
| | | CrudEntName.value = d.values.values; |
| | | } |
| | | function change(value, option, field) { |
| | | console.log(value, option, field); |
| | |
| | | appendSchemaByField( |
| | | [ |
| | | { |
| | | field: `${getFieldsValue().ASSEMBLY_NAME}${n.value}a`, |
| | | field: `${SearchEntName.value}${n.value}a`, |
| | | component: 'InputGroup', |
| | | label: 'åæ®µ' + n.value, |
| | | // required: true, |
| | | //required: true, |
| | | slot: 'fac' + n.value, |
| | | colProps: { span: 14 }, |
| | | }, |
| | |
| | | ); |
| | | 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`] = ''; |
| | | objInputs.value[`${SearchEntName.value}${n.value}a`] = ''; |
| | | searchSelectVals.value[`${SearchEntName.value}${n.value}a`] = ''; |
| | | console.log(searchSlots.value); |
| | | n.value++; |
| | | } |
| | | |
| | | function del(field) { |
| | | removeSchemaByField([ |
| | | `${getFieldsValue().ASSEMBLY_NAME}${field}a`, |
| | | `${SearchEntName.value}${field}a`, |
| | | `Switch${field}`, |
| | | `InputNumber${field}`, |
| | | `${field}`, |
| | |
| | | appendSchemaByFieldMain( |
| | | [ |
| | | { |
| | | field: `${getFieldsValueMain().MainAssemblyName}${m.value}a`, |
| | | field: `${MainEntName.value}${m.value}a`, |
| | | component: 'InputGroup', |
| | | label: 'åæ®µ' + m.value, |
| | | // required: true, |
| | |
| | | field: `InputTextArea${m.value}`, |
| | | component: 'InputTextArea', |
| | | label: 'èªå®ä¹æ¸²æ', |
| | | slot: `mainwIa${m.value}`, |
| | | colProps: { span: 21 }, |
| | | componentProps: { |
| | | placeholder: '请ç¼è¾æ¸²æä»£ç ', |
| | | rows: 4, |
| | | }, |
| | | }, |
| | | { |
| | | field: `${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`] = ''; |
| | | mainIaSlots.value.push(`mainwIa${m.value}`); |
| | | mainInputs.value[`${MainEntName.value}${m.value}a`] = ''; |
| | | mainSelectVals.value[`${MainEntName.value}${m.value}a`] = ''; |
| | | console.log(mainSlots.value); |
| | | m.value++; |
| | | } |
| | | |
| | | function mainDel(field) { |
| | | removeSchemaByFieldMain([ |
| | | `${getFieldsValueMain().MainAssemblyName}${field}a`, |
| | | `${MainEntName.value}${field}a`, |
| | | `Switch${field}`, |
| | | `sSwitch${field}`, |
| | | `wSwitch${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); |
| | | mainIaSlots.value.splice(mainIaSlots.value.indexOf(`mainwIa${field}`), 1); |
| | | mainSlots.value.splice(mainSlots.value.indexOf(`mainfac${field}`), 1); |
| | | if (mainSlots.value.length == 0) { |
| | | m.value = 1; |
| | |
| | | appendSchemaByFieldCrud( |
| | | [ |
| | | { |
| | | field: `${getFieldsValueCrud().crudAssemblyName}${j.value}a`, |
| | | field: `${CrudEntName.value}${j.value}a`, |
| | | component: 'InputGroup', |
| | | label: 'åæ®µ' + j.value, |
| | | // required: true, |
| | |
| | | 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`] = ''; |
| | | crudInputs.value[`${CrudEntName.value}${j.value}a`] = ''; |
| | | crudSelectVals.value[`${CrudEntName.value}${j.value}a`] = ''; |
| | | console.log(crudSlots.value); |
| | | j.value++; |
| | | } |
| | | |
| | | function crudDel(field) { |
| | | removeSchemaByFieldCrud([ |
| | | `${getFieldsValueCrud().crudAssemblyName}${field}a`, |
| | | `${CrudEntName.value}${field}a`, |
| | | `Switch${field}`, |
| | | `rSwitch${field}`, |
| | | `InputNumber${field}`, |
| | |
| | | <style lang="less" scoped> |
| | | .high-form { |
| | | padding-bottom: 48px; |
| | | } |
| | | </style>: { values: any[]; }: any: { values: any[]; }: any: { values: any[]; }: any: any: any: any: any: any: any |
| | | }</style |
| | | >: { values: any[]; }: any: { values: any[]; }: any: { values: any[]; }: any: any: any: any: any: |
| | | any: any |