This commit is contained in:
qsc 2023-09-27 20:02:04 +08:00
parent 8bee0689df
commit aeb1acb13c
10 changed files with 106 additions and 133 deletions

View File

@ -1,63 +1,48 @@
"use strict";
// import assert from 'assert';
// import { ButtonProps } from 'antd';
// import { ButtonProps as MobileButtonProps } from 'antd-mobile';
// import { EntityDict } from '../../../oak-app-domain';
// import { FileState } from '../../../features/extraFile2';
// export default OakComponent({
// formData({ features }) {
// const ids: string[] = this.getEfIds();
// const states = ids.map(
// id => features.extraFile2.getFileState(id)
// );
// let state: FileState = 'uploaded';
// states.forEach(
// (ele) => {
// if (ele) {
// if (['failed', 'local'].includes(ele.state)) {
// state = ele.state;
// }
// else if (ele.state === 'uploading' && state === 'uploaded') {
// state = 'uploading';
// }
// }
// }
// );
// return {
// state,
// };
// },
// properties: {
// efPaths: [] as string[],
// size: 'middle' as ButtonProps['size'] | MobileButtonProps['size'],
// block: false as ButtonProps['block'] | MobileButtonProps['block'],
// type: 'primary' as ButtonProps['type'] | MobileButtonProps['type'],
// executeText: '',
// },
// methods: {
// getEfIds() {
// const { efPaths } = this.props;
// const { oakFullpath } = this.state;
// assert(efPaths);
// if (oakFullpath) {
// const ids = efPaths.map(
// (path) => {
// const path2 = path ? `${oakFullpath}.path` : oakFullpath;
// const data = this.features.runningTree.getFreshValue(path2);
// if (data) {
// return (data as EntityDict['extraFile']['OpSchema'][]).map(
// ele => ele.id
// );
// }
// }
// ).flat().filter(
// ele => !!ele
// ) as string[];
// return ids;
// }
// return [];
// },
// upload() {
// }
// }
// });
import assert from 'assert';
export default OakComponent({
formData({ features }) {
const ids = this.getEfIds();
const states = ids.map(id => features.extraFile2.getFileState(id));
let state = 'uploaded';
states.forEach((ele) => {
if (ele) {
if (['failed', 'local'].includes(ele.state)) {
state = ele.state;
}
else if (ele.state === 'uploading' && state === 'uploaded') {
state = 'uploading';
}
}
});
return {
state,
};
},
properties: {
efPaths: [],
size: 'middle',
block: false,
type: 'primary',
executeText: '',
},
methods: {
getEfIds() {
const { efPaths } = this.props;
const { oakFullpath } = this.state;
assert(efPaths);
if (oakFullpath) {
const ids = efPaths.map((path) => {
const path2 = path ? `${oakFullpath}.path` : oakFullpath;
const data = this.features.runningTree.getFreshValue(path2);
if (data) {
return data.map(ele => ele.id);
}
}).flat().filter(ele => !!ele);
return ids;
}
return [];
},
upload() {
}
}
});

View File

@ -21,7 +21,7 @@ export const SelectFreeEntities = [
'mobile',
'wechatQrCode',
'wechatLogin',
'messageTypeTemplateId',
'messageTypeTemplate',
'articleMenu',
'article',
];

View File

@ -361,7 +361,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
entity?: never;
} | {
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "wechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
}) & {
[k: string]: any;
};

View File

@ -1,63 +1,51 @@
"use strict";
// import assert from 'assert';
// import { ButtonProps } from 'antd';
// import { ButtonProps as MobileButtonProps } from 'antd-mobile';
// import { EntityDict } from '../../../oak-app-domain';
// import { FileState } from '../../../features/extraFile2';
// export default OakComponent({
// formData({ features }) {
// const ids: string[] = this.getEfIds();
// const states = ids.map(
// id => features.extraFile2.getFileState(id)
// );
// let state: FileState = 'uploaded';
// states.forEach(
// (ele) => {
// if (ele) {
// if (['failed', 'local'].includes(ele.state)) {
// state = ele.state;
// }
// else if (ele.state === 'uploading' && state === 'uploaded') {
// state = 'uploading';
// }
// }
// }
// );
// return {
// state,
// };
// },
// properties: {
// efPaths: [] as string[],
// size: 'middle' as ButtonProps['size'] | MobileButtonProps['size'],
// block: false as ButtonProps['block'] | MobileButtonProps['block'],
// type: 'primary' as ButtonProps['type'] | MobileButtonProps['type'],
// executeText: '',
// },
// methods: {
// getEfIds() {
// const { efPaths } = this.props;
// const { oakFullpath } = this.state;
// assert(efPaths);
// if (oakFullpath) {
// const ids = efPaths.map(
// (path) => {
// const path2 = path ? `${oakFullpath}.path` : oakFullpath;
// const data = this.features.runningTree.getFreshValue(path2);
// if (data) {
// return (data as EntityDict['extraFile']['OpSchema'][]).map(
// ele => ele.id
// );
// }
// }
// ).flat().filter(
// ele => !!ele
// ) as string[];
// return ids;
// }
// return [];
// },
// upload() {
// }
// }
// });
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const assert_1 = tslib_1.__importDefault(require("assert"));
exports.default = OakComponent({
formData({ features }) {
const ids = this.getEfIds();
const states = ids.map(id => features.extraFile2.getFileState(id));
let state = 'uploaded';
states.forEach((ele) => {
if (ele) {
if (['failed', 'local'].includes(ele.state)) {
state = ele.state;
}
else if (ele.state === 'uploading' && state === 'uploaded') {
state = 'uploading';
}
}
});
return {
state,
};
},
properties: {
efPaths: [],
size: 'middle',
block: false,
type: 'primary',
executeText: '',
},
methods: {
getEfIds() {
const { efPaths } = this.props;
const { oakFullpath } = this.state;
(0, assert_1.default)(efPaths);
if (oakFullpath) {
const ids = efPaths.map((path) => {
const path2 = path ? `${oakFullpath}.path` : oakFullpath;
const data = this.features.runningTree.getFreshValue(path2);
if (data) {
return data.map(ele => ele.id);
}
}).flat().filter(ele => !!ele);
return ids;
}
return [];
},
upload() {
}
}
});

View File

@ -24,7 +24,7 @@ exports.SelectFreeEntities = [
'mobile',
'wechatQrCode',
'wechatLogin',
'messageTypeTemplateId',
'messageTypeTemplate',
'articleMenu',
'article',
];

View File

@ -370,7 +370,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
entity?: never;
} | {
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "wechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
}) & {
[k: string]: any;
};

View File

@ -361,7 +361,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
entity?: never;
} | {
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "wechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
}) & {
[k: string]: any;
};

View File

@ -25,7 +25,7 @@ export const SelectFreeEntities = [
'mobile',
'wechatQrCode',
'wechatLogin',
'messageTypeTemplateId',
'messageTypeTemplate',
'articleMenu',
'article',
];

View File

@ -371,7 +371,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
entity?: never;
} | {
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "wechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
}) & {
[k: string]: any;
};

View File

@ -363,7 +363,7 @@ export type UpdateOperationData = FormUpdateData<Omit<OpSchema, "entity" | "enti
entity?: never;
} | {
entity?: ("user" | "userEntityGrant" | "userSystem" | "userWechatPublicTag" | "wechatLogin" | "wechatMenu" | "wechatPublicAutoReply" | "wechatPublicTag" | "wechatPublicTemplate" | "wechatQrCode" | "wechatUser" | string) | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "wechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
entityId?: ForeignKey<"User" | "UserEntityGrant" | "UserSystem" | "UserWechatPublicTag" | "WechatLogin" | "WechatMenu" | "wechatPublicAutoReply" | "WechatPublicTag" | "WechatPublicTemplate" | "WechatQrCode" | "WechatUser"> | null;
}) & {
[k: string]: any;
};