| | |
| | | * @version: |
| | | * @Date: 2024-06-02 17:52:35 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-07-04 11:19:18 |
| | | * @LastEditTime: 2024-08-04 17:43:44 |
| | | */ |
| | | |
| | | import { ActionItem, FormSchema } from '/@/components/Table'; |
| | | import { ActionItem, FormSchema, PopConfirm } from '/@/components/Table'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { isNullOrEmpty } from '/@/utils/is'; |
| | | import { woCustFn, woformSchema } from '/@/views/components/bizMesWo'; |
| | | import { useModal } from '/@/components/Modal'; |
| | | import { Ref, unref } from 'vue'; |
| | | import { getRouteData } from '/@/api/tigerapi/mes/router'; |
| | | import { getRouteData, getWoRouteData } from '/@/api/tigerapi/mes/router'; |
| | | import { buildUUID } from '/@/utils/uuid'; |
| | | import { useUserStore } from '/@/store/modules/user'; |
| | | import { formatToDateTime } from '/@/utils/dateUtil'; |
| | |
| | | * @param {*} lf |
| | | * @return {*} |
| | | */ |
| | | export async function initRoute(lf, rotId, routeData, currlf) { |
| | | export async function initRoute(lf, rotId, routeData, currlf, rotType) { |
| | | currlf.value = unref(lf); |
| | | //通过工艺路线ID获取图形数据,并渲染 |
| | | var _data = await getRouteData(rotId); |
| | | var _data = rotType == 'Wo'?await getWoRouteData(rotId): await getRouteData(rotId); |
| | | console.log('组件已挂载', _data); |
| | | if (_data.Data != null) { |
| | | _data.Data.nodes.forEach((n) => { |
| | |
| | | } |
| | | |
| | | /** |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | * @description: 自定义删除方法 |
| | | * @param {Fn} args |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | export function custDel(args: Fn[], params: {}) { |
| | | const name = params['name']; |
| | | const useTables = args[1]; |
| | |
| | | } |
| | | |
| | | /* 高级表单公用方法 *********************************End */ |
| | | |
| | | /** |
| | | * @description: 获取权限按钮列表 |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | export function GenerateActionButton(params: any, buttons: Ref<[]>, openDrawer: Fn, reload: Fn) { |
| | | let actionItem = [] as ActionItem[]; |
| | | buttons.value.map((x) => { |
| | | if (x['BUTTON_TYPE'] == 1) { |
| | | let url = ''; |
| | | let color = undefined as 'success' | 'error' | 'warning' | undefined; |
| | | let _click = null as any; |
| | | let _popConfirm = undefined as PopConfirm | undefined; |
| | | let _tooltip = ''; |
| | | if (x['DO_METHOD'] == 'Edit') { |
| | | url = 'clarity:note-edit-line'; |
| | | _tooltip = '编辑'; |
| | | _click = editRecord.bind(null, openDrawer, params); |
| | | } else { |
| | | _click = () => {}; |
| | | if (x['DO_METHOD'] == 'Delete') { |
| | | url = 'ant-design:delete-outlined'; |
| | | color = 'error'; |
| | | _tooltip = '删除'; |
| | | _popConfirm = { |
| | | title: '是否确认删除?', |
| | | placement: 'left', |
| | | confirm: deleteRecord.bind(null, reload, params), |
| | | }; |
| | | } |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * @description: 公用编辑方法 |
| | | * @param {Fn} fn |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | export function editRecord(fn: Fn, params: {}) { |
| | | fn(true, params); |
| | | } |
| | | |
| | | /** |
| | | * @description: 公用删除方法 |
| | | * @param {Fn} fn |
| | | * @param {*} params |
| | | * @return {*} |
| | | */ |
| | | function deleteRecord(fn: Fn, params: {}) { |
| | | console.log(params['record']); |
| | | //删除 |
| | | DeleteEntity(params['record'], params['entityName']).then((action) => { |
| | | if (action.IsSuccessed) { |
| | | fn(); |
| | | } |
| | | }); |
| | | } |