| | |
| | | * @version: |
| | | * @Date: 2024-06-02 17:52:35 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-10-15 20:55:16 |
| | | * @LastEditTime: 2024-10-23 23:01:49 |
| | | */ |
| | | |
| | | import { ActionItem, FormSchema, PopConfirm } from '/@/components/Table'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { isNullOrEmpty, isNullOrUnDef } from '/@/utils/is'; |
| | | import { isArray, isNullOrEmpty, isNullOrUnDef, isTimeViaRegExp8601 } from '/@/utils/is'; |
| | | import { woCustFn, woformSchema } from '/@/views/components/bizMesWo'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { Ref, unref } from 'vue'; |
| | | import { getRouteData, getWoRouteData } from '/@/api/tigerapi/mes/router'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { formatToDateTime } from '/@/utils/dateUtil'; |
| | | import { dateUtil, formatToDateTime } from '/@/utils/dateUtil'; |
| | | import { DeleteEntity, getEntity } from '/@/api/tigerapi/system'; |
| | | import { useGo } from '/@/hooks/web/usePage'; |
| | | import { useQueryStore } from '/@/store/modules/queryInpage'; |
| | | import { RouteRecordName } from 'vue-router'; |
| | | import { cloneDeep } from 'lodash-es'; |
| | | import dayjs from 'dayjs'; |
| | | import { utils } from 'sortablejs'; |
| | | |
| | | const { t } = useI18n(); |
| | | /** |
| | |
| | | * @return {*} |
| | | */ |
| | | export function GetActionsData(params: {}, ...args) { |
| | | let data = [] as ActionItem[]; |
| | | const data = [] as ActionItem[]; |
| | | return data; |
| | | } |
| | | |
| | |
| | | export async function initRoute(lf, rotId, routeData, currlf, rotType) { |
| | | currlf.value = unref(lf); |
| | | //通过工艺路线ID获取图形数据,并渲染 |
| | | var _data = rotType == 'Wo' ? await getWoRouteData(rotId) : await getRouteData(rotId); |
| | | const _data = rotType == 'Wo' ? await getWoRouteData(rotId) : await getRouteData(rotId); |
| | | console.log('组件已挂载', _data); |
| | | if (_data.Data != null) { |
| | | _data.Data.nodes.forEach((n) => { |
| | |
| | | d.CREATE_USER = useUserStore().getUserInfo.userId as string; |
| | | d.UPDATE_TIME = formatToDateTime(new Date()); |
| | | d.UPDATE_USER = useUserStore().getUserInfo.userId as string; |
| | | var _data2: any[] = []; |
| | | if (!isNullOrEmpty(data.value[item])) { |
| | | _data2 = data.value[item].map((item) => { |
| | | return item; |
| | | }); |
| | | } |
| | | d.AUTH_ORG = useUserStore().getUserInfo.orgCode as string; |
| | | let _data2: any[] = cloneDeep(data.value[item]); |
| | | _data2.push(d); |
| | | data.value[item] = _data2; |
| | | } |
| | |
| | | const name = params['name']; |
| | | const useTables = args[1]; |
| | | if (!isNullOrEmpty(params['data'])) { |
| | | var _data = params['data'].value[name].filter((item) => item['ID'] != params['record']['ID']); |
| | | const _data = params['data'].value[name].filter((item) => item['ID'] != params['record']['ID']); |
| | | params['data'].value[name] = _data; |
| | | useTables[name][1].setProps({ |
| | | dataSource: [], |
| | |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | export function GenerateActionButton(params: any, buttons: Ref<[]>, openDrawer: Fn, reload: Fn) { |
| | | let actionItem = [] as ActionItem[]; |
| | | export function GenerateActionButton( |
| | | params: any, |
| | | buttons: Ref<[]>, |
| | | openDrawer: Fn, |
| | | reload: Fn, |
| | | actionItem: ActionItem[], |
| | | ) { |
| | | buttons.value.map((x) => { |
| | | if (x['BUTTON_TYPE'] == 1) { |
| | | let url = ''; |
| | |
| | | }; |
| | | } |
| | | } |
| | | actionItem.push({ |
| | | icon: isNullOrEmpty(x['ICON_URL']) ? url : x['ICON_URL'], |
| | | tooltip: _tooltip, |
| | | onClick: _click, |
| | | color: color, |
| | | popConfirm: _popConfirm, |
| | | name: x['DO_METHOD'], |
| | | }); |
| | | if (x['DO_METHOD'] != 'ToPrint') { |
| | | actionItem.push({ |
| | | icon: isNullOrEmpty(x['ICON_URL']) ? url : x['ICON_URL'], |
| | | tooltip: _tooltip, |
| | | onClick: _click, |
| | | color: color, |
| | | popConfirm: _popConfirm, |
| | | name: x['DO_METHOD'], |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | return actionItem; |
| | |
| | | export function goByParams(path: string, params: {}, go) { |
| | | if (path.split('/').length > 2 && path.split('/')[2] == 'LC') { |
| | | getEntity({ |
| | | sqlcmd: `ASSEMBLY_NAME ='${path.split('/')[1]}'`, |
| | | sqlcmd: `CODE_NAME ='${path.split('/')[1]}'`, |
| | | entityName: 'SYS_LOW_CODE', |
| | | order: '', |
| | | }).then((data) => { |
| | | var searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); |
| | | let colSlots = [] as string[]; |
| | | const searchForms = JSON.parse(data.Data.Items[0].SEARCH_FORM_JSON); |
| | | const colSlots = [] as string[]; |
| | | for (const i in searchForms) { |
| | | if (!isNullOrUnDef(searchForms[i]['colSlot'])) { |
| | | colSlots.push('form-' + searchForms[i]['colSlot']); |
| | | } |
| | | } |
| | | |
| | | var _cruds = JSON.parse(data.Data.Items[0].FORM_JSON); |
| | | let crudColSlots = [] as string[]; |
| | | const _cruds = JSON.parse(data.Data.Items[0].FORM_JSON); |
| | | const crudColSlots = [] as string[]; |
| | | for (const i in _cruds) { |
| | | if (!isNullOrUnDef(_cruds[i]['colSlot'])) { |
| | | crudColSlots.push(_cruds[i]['colSlot']); |
| | |
| | | colSlots: colSlots, |
| | | crudColSlots: crudColSlots, |
| | | sName: `${path.split('/')[1]}_update`, |
| | | }; |
| | | }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${id.sName}_params`); |
| | | sessionStorage.setItem(`${id.sName}_params`, encodeURI(JSON.stringify({ params: params }))); |
| | |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${id.sName}_params`); |
| | | sessionStorage.setItem(`${id.sName}_params`, encodeURI(JSON.stringify(id))); |
| | | go(`/${path.split('/')[1]}/${path.split('/')[2]}/${encodeURI(JSON.stringify({ sName: id.sName, Name: id.Name }))}`); |
| | | go( |
| | | `/${path.split('/')[1]}/${path.split('/')[2]}/${encodeURI(JSON.stringify({ sName: id.sName, Name: id.Name }))}`, |
| | | ); |
| | | } else { |
| | | const id = { sName: `${path.split('/')[1]}_update`,params: params }; |
| | | const id = { sName: `${path.split('/')[1]}_update`, params: params }; |
| | | // 将对象转换为JSON字符串并保存到sessionStorage |
| | | sessionStorage.removeItem(`${id.sName}_params`); |
| | | sessionStorage.setItem(`${id.sName}_params`, encodeURI(JSON.stringify(id))); |
| | | go(`${path}/${encodeURI(JSON.stringify({ sName: id.sName}))}`); |
| | | go(`${path}/${encodeURI(JSON.stringify({ sName: id.sName }))}`); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description: 调用api前,参数整理 |
| | | * @param {*} t |
| | | * @return {*} |
| | | */ |
| | | export function SearchInfoFn(param: any, name: RouteRecordName | null | undefined, ByOrg: boolean) { |
| | | const useQuery = useQueryStore(); |
| | | if ( |
| | | !isNullOrUnDef(useQuery.getCurSearchInfo) && |
| | | useQuery.getCurSearchInfo.some((q) => q.name == name) |
| | | ) { |
| | | const curSearchInfo = useQuery.getCurSearchInfo.filter((q) => q.name == name); |
| | | const Keys = Object.getOwnPropertyNames(curSearchInfo[0].searchInfo); |
| | | for (const k in Keys) { |
| | | if (Keys[k] != 'page' && Keys[k] != 'pageSize') { |
| | | param[Keys[k]] = curSearchInfo[0].searchInfo[Keys[k]]; |
| | | } |
| | | } |
| | | useQuery.setCurSearchInfo({ name: name, searchInfo: param }); |
| | | } |
| | | if (isNullOrEmpty(param.option) && ByOrg) { |
| | | param.option = { |
| | | //根据据点查询,必需带这个参数 |
| | | UserId: useUserStore().getUserInfo.userId, |
| | | ByOrg: true, |
| | | CurOrg: useUserStore().getUserInfo.orgCode, |
| | | }; |
| | | } |
| | | return param; |
| | | } |
| | | |
| | | /** |
| | | * @description: 请求之后对返回值进行处理 |
| | | * @param {*} t |
| | | * @return {*} |
| | | */ |
| | | export function afterFetchFn(t: any, name: RouteRecordName | null | undefined, f) { |
| | | const useQuery = useQueryStore(); |
| | | if ( |
| | | !isNullOrUnDef(useQuery.getCurSearchInfo) && |
| | | useQuery.getCurSearchInfo.some((q) => q.name == name) |
| | | ) { |
| | | const curSearchInfo = useQuery.getCurSearchInfo.filter((q) => q.name == name); |
| | | const params = cloneDeep(curSearchInfo[0].searchInfo); |
| | | const Keys = Object.getOwnPropertyNames(params); |
| | | for (const k in Keys) { |
| | | if (!isNullOrEmpty(params[Keys[k]]?.length) && isArray(params[Keys[k]])) { |
| | | if (isTimeViaRegExp8601(params[Keys[k]][0])) { |
| | | params[Keys[k]][0] = dateUtil(params[Keys[k]][0]); |
| | | params[Keys[k]][1] = dateUtil(params[Keys[k]][1]); |
| | | } |
| | | } |
| | | if (!isNullOrEmpty(params[Keys[k]]) && isTimeViaRegExp8601(params[Keys[k]])) { |
| | | params[Keys[k]] = dateUtil(params[Keys[k]]); |
| | | } |
| | | } |
| | | f.setFieldsValue(params); |
| | | } |
| | | } |