| | |
| | | * @version: |
| | | * @Date: 2024-06-19 20:34:27 |
| | | * @LastEditors: Ben Lin |
| | | * @LastEditTime: 2024-06-22 00:04:06 |
| | | * @LastEditTime: 2024-06-25 18:30:51 |
| | | */ |
| | | |
| | | import { GetRoutePTree } from '/@/api/tigerapi/mes/router'; |
| | | import { convertToTree } from '/@/api/tigerapi/system'; |
| | | |
| | | function _default() { |
| | | /** |
| | | * @description: 获取树形图标 |
| | | * @param {Recordable} params |
| | | * @return {*} |
| | | */ |
| | | function CreateIcon(params: Recordable<any>) { |
| | | let icon = ''; |
| | | switch (params['type']) { |
| | | case 'Product': |
| | | icon = 'similar-product|svg'; |
| | | break; |
| | | case 'Route': |
| | | icon = 'route|svg'; |
| | | break; |
| | | case 'Node': |
| | | icon = 'node|svg'; |
| | | break; |
| | | case 'Action': |
| | | icon = 'rot_action|svg'; |
| | | break; |
| | | case 'Customer': |
| | | icon = 'customer|svg'; |
| | | break; |
| | | } |
| | | return icon; |
| | | } |
| | | const methods = { |
| | | /** |
| | | * @description: 获取树形图标 |
| | | * @param {Recordable} params |
| | | * @return {*} |
| | | */ |
| | | CreateIcon: (params: Recordable<any>) => { |
| | | let icon = ''; |
| | | switch (params['type']) { |
| | | case 'Product': |
| | | icon = 'similar-product|svg'; |
| | | break; |
| | | case 'Route': |
| | | icon = 'route|svg'; |
| | | break; |
| | | case 'Node': |
| | | icon = 'node|svg'; |
| | | break; |
| | | case 'Action': |
| | | icon = 'rot_action|svg'; |
| | | break; |
| | | case 'Customer': |
| | | icon = 'customer|svg'; |
| | | break; |
| | | } |
| | | return icon; |
| | | }, |
| | | /** |
| | | * @description: 高级表单和详情页面返回主页面的url |
| | | * @return {*} |
| | | */ |
| | | GetHomeUrl: () => { |
| | | return `/V_BAS_PROD/LC/${encodeURI(JSON.stringify({ ID: 'V_BAS_PROD', colSlots: [], crudColSlots: [] }))}`; |
| | | }, |
| | | /** |
| | | * @description: 获取树形数据 |
| | | * @param {string} type |
| | | * @return {*} |
| | | */ |
| | | fetchTreeData: async (type: string, itemCode: string) => { |
| | | let data = { title: '', treeData: [] as any[], fieldNames: {} }; |
| | | let prodTreeData = await GetRoutePTree(itemCode); |
| | | data.treeData = convertToTree(prodTreeData, 'pid', 'id', 'root'); |
| | | data.title = '工艺路线'; |
| | | data.fieldNames = { key: 'id', title: 'name' }; |
| | | return data; |
| | | }, |
| | | }; |
| | | |
| | | return [CreateIcon] |
| | | return [methods]; |
| | | } |
| | | |
| | | export default _default; |