fix
This commit is contained in:
parent
3d190c7476
commit
3c5b9e86a5
|
|
@ -3,5 +3,8 @@ import { Feature } from 'oak-frontend-base';
|
|||
import { Aspect, Context, DeduceCreateOperationData } from 'oak-domain/lib/types';
|
||||
export declare class ExtraFile<ED extends EntityDict, Cxt extends Context<ED>, AD extends Record<string, Aspect<ED, Cxt>>> extends Feature<ED, Cxt, AD> {
|
||||
constructor();
|
||||
upload(extraFile: DeduceCreateOperationData<ED['extraFile']['Schema']>, scene: string): Promise<any>;
|
||||
upload(extraFile: DeduceCreateOperationData<ED['extraFile']['Schema']>, scene: string): Promise<{
|
||||
url: string;
|
||||
bucket: string;
|
||||
}>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,16 +8,18 @@ const triggers = [
|
|||
when: 'before',
|
||||
fn: async ({ operation }, context, params) => {
|
||||
const { data, filter } = operation;
|
||||
const { result } = await context.rowStore.select('userEntityGrant', {
|
||||
data: Object.assign({
|
||||
iState: 1
|
||||
}, data),
|
||||
filter: {
|
||||
iState: 'init',
|
||||
},
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
}, context, params);
|
||||
// const { result } = await context.rowStore.select('userEntityGrant', {
|
||||
// data: Object.assign({
|
||||
// id: 1,
|
||||
// iState: 1
|
||||
// }, data),
|
||||
// filter: {
|
||||
// iState: 'init',
|
||||
// },
|
||||
// indexFrom: 0,
|
||||
// count: 1,
|
||||
// }, context, params);
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import { EntityDict } from 'oak-app-domain/EntityDict';
|
||||
import { CreateTriggerInTxn, Trigger } from 'oak-domain/lib/types/Trigger';
|
||||
import { GeneralRuntimeContext } from '../RuntimeContext';
|
||||
import { CreateOperationData as CreateUserEntityGrantData } from 'oak-app-domain/UserEntityGrant/Schema';
|
||||
|
||||
import { assign } from "lodash";
|
||||
import { assign, keys } from 'lodash';
|
||||
import { OakRowInconsistencyException } from 'oak-domain/lib/types';
|
||||
import assert from 'assert';
|
||||
import { OpRecord } from '../../../oak-domain/src/types/Entity';
|
||||
const triggers: Trigger<EntityDict, 'userEntityGrant', GeneralRuntimeContext<EntityDict>>[] = [
|
||||
{
|
||||
name: '当创建userEntityGrant时,查询是否有未过期的实体',
|
||||
|
|
@ -12,16 +15,37 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', GeneralRuntimeContext<Ent
|
|||
when: 'before',
|
||||
fn: async ({ operation }, context, params) => {
|
||||
const { data, filter } = operation;
|
||||
const { result } = await context.rowStore.select('userEntityGrant', {
|
||||
data: Object.assign({
|
||||
iState: 1
|
||||
}, data),
|
||||
filter: {
|
||||
iState: 'init',
|
||||
const fn = async (userEntityGrantData: CreateUserEntityGrantData) => {
|
||||
const { action, entity, entityId, relation} = userEntityGrantData;
|
||||
const { result } = await context.rowStore.select('userEntityGrant', {
|
||||
data: {
|
||||
id: 1,
|
||||
action: 1,
|
||||
entity: 1,
|
||||
entityId: 1,
|
||||
relation: 1,
|
||||
},
|
||||
filter: {
|
||||
iState: 'init',
|
||||
action,
|
||||
entity,
|
||||
entityId,
|
||||
relation,
|
||||
},
|
||||
indexFrom: 0,
|
||||
count: 1,
|
||||
}, context, params);
|
||||
}, context, params);
|
||||
if (result.length) {
|
||||
throw new OakRowInconsistencyException(result[0] as any, '该userEntityGrant未过期');
|
||||
}
|
||||
}
|
||||
if (data instanceof Array) {
|
||||
assert('授权不存在一对多的情况')
|
||||
}
|
||||
else {
|
||||
fn(data)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"navigationBarTitleText": "添加权限",
|
||||
"navigationBarTitleText": "二维码",
|
||||
"usingComponents": {
|
||||
"g-btn": "../../../components/UI/g-btn/index",
|
||||
"g-input": "../../../components/UI/g-input/index",
|
||||
|
|
@ -11,16 +11,8 @@
|
|||
box-sizing: border-box;
|
||||
.safe-area-inset-bottom();
|
||||
}
|
||||
.label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: @size-spacing-base;
|
||||
border-bottom: 1px solid @background-color-base;
|
||||
|
||||
}
|
||||
.cell-col {
|
||||
.col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid @background-color-base
|
||||
align-items: center;
|
||||
}
|
||||
|
|
@ -38,36 +38,15 @@ OakPage({
|
|||
...userEntityGrant,
|
||||
}),
|
||||
}, {
|
||||
properties: {
|
||||
entity: String,
|
||||
entityId: String,
|
||||
relations: String,
|
||||
},
|
||||
data: {
|
||||
},
|
||||
lifetimes: {
|
||||
ready(options) {
|
||||
this.data.entity && this.setUpdateData('entity', this.data.entity);
|
||||
this.data.entityId && this.setUpdateData('entityId', this.data.entityId);
|
||||
this.setUpdateData('action', 'grant');
|
||||
this.setData({
|
||||
relationArr: JSON.parse(this.data.relations),
|
||||
})
|
||||
if (!this.data.wechatQrCode$entity[0] || this.data.wechatQrCode$entity[0].expiresAt) {
|
||||
//请求创建wechatQrcode
|
||||
// const result = await requestWechatQrcode();
|
||||
this.setData({
|
||||
url: result.url,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
radioChange(e) {
|
||||
this.setUpdateData('relation', e.detail.value);
|
||||
},
|
||||
requestWechatQrcode() {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<!-- index.wxml -->
|
||||
<view class="page-body">
|
||||
<view class="col">
|
||||
<image src="{{url}}" />
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -38,6 +38,18 @@ OakPage({
|
|||
methods: {
|
||||
radioChange(e) {
|
||||
this.setUpdateData('relation', e.detail.value);
|
||||
},
|
||||
handleConfirm() {
|
||||
try {
|
||||
this.execute(
|
||||
this.data.oakId ? 'update' : 'create',
|
||||
() => {
|
||||
}
|
||||
);
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -4,11 +4,11 @@
|
|||
<radio-group bindchange="radioChange" class="test">
|
||||
<label class="label" wx:for="{{relationArr}}" wx:key="*this">
|
||||
<view>
|
||||
<radio value="{{item}}" checked="true" />
|
||||
<radio value="{{item}}" />
|
||||
</view>
|
||||
<view>{{item}}</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
<g-btn type="primary">确定</g-btn>
|
||||
<g-btn type="primary" bind:click="handleConfirm">确定</g-btn>
|
||||
</view>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<!-- index.wxml -->
|
||||
<view class="page-body">
|
||||
<view class="cell-col">
|
||||
<radio-group bindchange="radioChange" class="test">
|
||||
<label class="label" wx:for="{{relationArr}}" wx:key="*this">
|
||||
<view>
|
||||
<radio value="{{item}}" checked="true" />
|
||||
</view>
|
||||
<view>{{item}}</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
<g-btn type="primary">确定</g-btn>
|
||||
</view>
|
||||
Loading…
Reference in New Issue