import apis from '@/constants/api.swagger-constants'; import { request } from '@/utils'; import { CreateAssetCategoryQuery, UpdateAssetCategoryQuery, RemoveAssetCategoryQuery, } from '@easytwin/core'; export async function getList() { try { return await request(apis.assetCategoriesGet); } catch (err) { console.error('getAssetCategoryList:', err); return Promise.reject('获取资产分类列表失败!'); } } export async function create(query: CreateAssetCategoryQuery) { try { return await request(apis.assetCategoriesPost, { body: query }); } catch (err) { console.error('createAssetCategoryList:', err); return Promise.reject('创建资产分类失败!'); } } export async function update(query: UpdateAssetCategoryQuery) { try { return await request(apis.assetCategoriePatch, { params: { id: query.id }, body: { name: query.name }, }); } catch (err) { console.error('updateAssetCategoryList:', err); return Promise.reject('更新资产分类失败!'); } } export async function remove(query: RemoveAssetCategoryQuery) { try { return await request(apis.assetCategorieDelete, { params: { id: query.id }, }); } catch (err) { console.error('deleteAssetCategoryList:', err); return Promise.reject('删除资产分类失败!'); } } // AssetCategoryApi.getList(); // AssetCategoryApi.create({ name: '散点' }); // AssetCategoryApi.create({ name: '信息面板' }); // AssetCategoryApi.create({ name: 'Iframe 面板' }); // AssetCategoryApi.create({ name: '围栏' }); // [ // { // id: 'asgrLbKV1qz6JWnnP', // name: '灯光', // categories: [ // { // name: '点光源', // description: '', // thumb: '/easytwin/system/assets/Light/点光源.png', // categoryId: 'asgrLbKV1qz6JWnnP', // type: 'POINTLIGHT', // state: 'published', // config: { // resourcesFile: '', // state: { // positionX: 0, // positionY: 100, // positionZ: 0, // color: '#ffffff', // intensity: 1, // decay: 1, // castShadow: true, // }, // }, // }, // { // name: '平行光', // description: '', // thumb: '/easytwin/system/assets/Light/平行光.png', // categoryId: 'asgrLbKV1qz6JWnnP', // type: 'DIRECTLIGHT', // state: 'published', // config: { // resourcesFile: '', // state: { // positionX: 100, // positionY: 100, // positionZ: -100, // targetX: 0, // targetY: 0, // targetZ: 0, // color: '#ffffff', // intensity: 1, // castShadow: true, // }, // }, // }, // ], // }, // { // id: 'asgkcvSJ2FM0YxCL0', // name: '散点', // categories: [ // { // name: '基础散点', // description: '', // thumb: '/easytwin/system/assets/Point/基础散点.png', // categoryId: 'asgkcvSJ2FM0YxCL0', // type: 'POINT', // state: 'published', // config: { // resourcesFile: '/easytwin/system/assets/Point/基础散点.png', // state: { // imgFileId: null, // imgFileUrl: null, // width: 32, // height: 32, // lockedSize: true, // alwaysTop: true, // }, // }, // }, // { // name: '枪机摄像头散点', // description: '', // thumb: '/easytwin/system/assets/Point/枪机摄像头散点.png', // categoryId: 'asgkcvSJ2FM0YxCL0', // type: 'POINT', // state: 'published', // config: { // resourcesFile: '/easytwin/system/assets/Point/枪机摄像头散点.png', // state: { // imgFileId: null, // imgFileUrl: null, // width: 32, // height: 32, // lockedSize: true, // alwaysTop: true, // }, // }, // }, // { // name: '火灾警告散点', // description: '', // thumb: '/easytwin/system/assets/Point/火灾警告散点.png', // categoryId: 'asgkcvSJ2FM0YxCL0', // type: 'POINT', // state: 'published', // config: { // resourcesFile: '/easytwin/system/assets/Point/火灾警告散点.png', // state: { // imgFileId: null, // imgFileUrl: null, // width: 32, // height: 32, // lockedSize: true, // alwaysTop: true, // }, // }, // }, // { // name: '球机摄像头散点', // description: '', // thumb: '/easytwin/system/assets/Point/球机摄像头散点.png', // categoryId: 'asgkcvSJ2FM0YxCL0', // type: 'POINT', // state: 'published', // config: { // resourcesFile: '/easytwin/system/assets/Point/球机摄像头散点.png', // state: { // imgFileId: null, // imgFileUrl: null, // width: 32, // height: 32, // lockedSize: true, // alwaysTop: true, // }, // }, // }, // ], // }, // { // id: 'asgAtP1anIhFdLW8r', // name: 'Iframe面板', // categories: [ // { // name: 'Iframe', // description: '', // thumb: '/easytwin/system/assets/PoiIframe/iframe.png', // categoryId: 'asgAtP1anIhFdLW8r', // type: 'POIIFRAME', // state: 'published', // config: { // resourcesFile: '', // state: { // width: 400, // height: 300, // lockedSize: true, // offsetX: 0, // offsetY: 0, // }, // }, // }, // ], // }, // { // id: 'asgMsg0637vuV7ERB', // name: '信息面板', // categories: [ // { // name: '信息面板', // description: '', // thumb: '/easytwin/system/assets/PoiPanner/信息面板.png', // categoryId: 'asgMsg0637vuV7ERB', // type: 'POIPANNEL', // state: 'published', // config: { // resourcesFile: '', // state: { // imgFileId: null, // imgFileUrl: null, // lockedSize: true, // width: 120, // height: 80, // paddingX: 35, // paddingY: 8.5, // labelWidth: 5, // labelTextAlign: 'left', // labelFontFamily: 'Noto Sans CJK SC', // labelFontSize: 6, // labelFontColor: '#ffffff', // labelFontOpacity: 100, // valueLeftPadding: 12, // valueTextAlign: 'left', // valueFontFamily: 'Noto Sans CJK SC', // valueFontSize: 6, // valueFontColor: '#ffb029', // valueFontOpacity: 100, // lineValues: [ // { // code: 'location', // label: '位置:', // value: '加工车间', // positionX: 0, // positionY: 0, // useRowStyle: false, // labelWidth: 40, // labelTextAlign: 'left', // labelFontFamily: 'Noto Sans CJK SC', // labelFontSize: 16, // labelFontColor: '#ffffff', // labelFontOpacity: 100, // valueLeftPadding: 12, // valueTextAlign: 'left', // valueFontFamily: 'Noto Sans CJK SC', // valueFontSize: 16, // valueFontColor: '#ffffff', // valueFontOpacity: 100, // }, // { // code: 'temperatrue', // label: '温度:', // value: '15 ℃', // positionX: 0, // positionY: 14.5, // useRowStyle: false, // labelWidth: 40, // labelTextAlign: 'left', // labelFontFamily: 'Noto Sans CJK SC', // labelFontSize: 16, // labelFontColor: '#ffffff', // labelFontOpacity: 100, // valueLeftPadding: 12, // valueTextAlign: 'left', // valueFontFamily: 'Noto Sans CJK SC', // valueFontSize: 16, // valueFontColor: '#ffffff', // valueFontOpacity: 100, // }, // { // code: 'hun', // label: '湿度:', // value: '81%', // positionX: 0, // positionY: 29, // useRowStyle: false, // labelWidth: 40, // labelTextAlign: 'left', // labelFontFamily: 'Noto Sans CJK SC', // labelFontSize: 16, // labelFontColor: '#ffffff', // labelFontOpacity: 100, // valueLeftPadding: 12, // valueTextAlign: 'left', // valueFontFamily: 'Noto Sans CJK SC', // valueFontSize: 16, // valueFontColor: '#ffffff', // valueFontOpacity: 100, // }, // ], // }, // }, // }, // ], // }, // { // id: 'asgGHqMtKO5GQU1MY', // name: '围栏', // categories: [ // { // name: '围栏', // description: '', // thumb: '/easytwin/system/assets/Fence/围栏.png', // categoryId: 'asgGHqMtKO5GQU1MY', // type: 'FENCE', // state: 'published', // config: { // resourcesFile: '', // state: { // height: 100, // type: 'base', // closed: false, // color: [ // { offset: 0, color: '#ff78e6', alpha: 0 }, // { offset: 100, color: '#ff78e6', alpha: 50 }, // ], // opacity: 50, // useAnimation: false, // lineColor: '#FFB84E', // lieeOpacity: 100, // lineHeight: 10, // animationStep: 1, // videoFileId: null, // videoFileUrl: null, // videoHeight: 100, // }, // }, // }, // ], // }, // ].forEach(({ categories }) => // categories.forEach((category) => request(apis.createAsset, { body: category })), // );