| | |
| | | * @version: |
| | | * @Date: 2024-05-30 13:28:20 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-08-06 19:57:41 |
| | | * @LastEditTime: 2024-10-20 21:51:55 |
| | | --> |
| | | <template> |
| | | <div> |
| | |
| | | import { useRoute, useRouter } from 'vue-router'; |
| | | import { Tag, Tooltip } from 'ant-design-vue'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { custOnChange, OpenCustModal, GetUseModalData, initRoute } from '../data'; |
| | | import { custOnChange, OpenCustModal, GetUseModalData, initRoute, goByParams } from '../data'; |
| | | import { useLocale } from '/@/locales/useLocale'; |
| | | import { uploadApi } from '/@/api/sys/upload'; |
| | | import { useGo } from '/@/hooks/web/usePage'; |
| | |
| | | import { getRoleButtons } from '/@/api/sys/menu'; |
| | | import { EntityCustFunctionType } from '/@/api/tigerapi/model/basModel'; |
| | | import { isFunction } from 'xe-utils'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | |
| | | const { notification, createMessage } = useMessage(); |
| | | const { getLocale } = useLocale(); |
| | | const { t } = useI18n(); |
| | | const route = useRoute(); |
| | | const { currentRoute } = useRouter(); |
| | | const go = useGo(); |
| | | const objParams = ref(JSON.parse(decodeURI(route.params?.id as string))); |
| | | // 从sessionStorage中读取参数并转换回对象 |
| | | const _savedParams =sessionStorage.getItem(`${objParams.value.sName}_params`) |
| | | const savedParams = _savedParams ? ref(JSON.parse(decodeURI(_savedParams))) : ref({}); |
| | | const entityName = ref(objParams.value.ID); |
| | | const _columns = ref<any[]>([]); |
| | | const _searchFormSchema = ref<any[]>([]); |
| | |
| | | }); |
| | | const keyFieldValues = ref<any>(null); |
| | | provide<Ref<any>>('objParams', objParams); |
| | | provide<Ref<any>>('savedParams', savedParams as any); |
| | | provide<Ref<any[]>>('_columns', _columns); |
| | | provide<Ref<any[]>>('_searchFormSchema', _searchFormSchema); |
| | | provide<Ref<any[]>>('_crudFormSchema', _crudFormSchema); |
| | |
| | | if (InitCrudFormSchema && isFunction(InitCrudFormSchema)) { |
| | | _cruds = InitCrudFormSchema(objParams.value.ID); |
| | | } else { |
| | | /* 没有初始化增删改页面结构的方法时进入 */ |
| | | /* 没有初始化增删改页面结构的方法时进入 */ |
| | | _cruds = JSON.parse(data.Data.Items[0].FORM_JSON); |
| | | } |
| | | for (const i in _cruds) { |
| | |
| | | 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), |
| | | ); |
| | | /* 如果是链接就跳转并传入配置的参数 */ |
| | | if (texts.isLink == 'Y') { |
| | | return h('a', [ |
| | | h( |
| | | 'span', |
| | | { |
| | | onClick: () => { |
| | | goByParams(texts.path, texts.params, go); |
| | | }, |
| | | }, |
| | | texts.text, |
| | | ), |
| | | ]); |
| | | } else { |
| | | return h(Tooltip, { title: texts.text }, () => |
| | | h(Tag, { color: texts.color }, () => texts.text), |
| | | ); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="less" scoped> |
| | | .hover-div { |
| | | cursor: pointer; /* 鼠标经过时显示手指指针样式 */ |
| | | } |
| | | </style> |