diff --git a/src/components/userEntityGrant/share/index.xml b/src/components/userEntityGrant/share/index.xml index 61bedafc6..6685d8f5a 100644 --- a/src/components/userEntityGrant/share/index.xml +++ b/src/components/userEntityGrant/share/index.xml @@ -1,11 +1,5 @@ - diff --git a/src/components/userRelation/upsert/byUserEntityGrant/index.json b/src/components/userRelation/upsert/byUserEntityGrant/index.json index a444281dd..91d2cedff 100644 --- a/src/components/userRelation/upsert/byUserEntityGrant/index.json +++ b/src/components/userRelation/upsert/byUserEntityGrant/index.json @@ -10,7 +10,10 @@ "l-list": "@oak-frontend-base/miniprogram_npm/lin-ui/list/index", "l-radio": "@oak-frontend-base/miniprogram_npm/lin-ui/radio/index", "l-radio-group": "@oak-frontend-base/miniprogram_npm/lin-ui/radio-group/index", + "l-checkbox-group": "@oak-frontend-base/miniprogram_npm/lin-ui/checkbox-group/index", + "l-checkbox": "@oak-frontend-base/miniprogram_npm/lin-ui/checkbox/index", "l-counter": "@oak-frontend-base/miniprogram_npm/lin-ui/counter/index", - "userEntityGrant-detail": "../../../../pages/userEntityGrant/detail/index" + "l-switch": "@oak-frontend-base/miniprogram_npm/lin-ui/switch/index", + "userEntityGrant-share": "../../../userEntityGrant/share/index" } } diff --git a/src/components/userRelation/upsert/byUserEntityGrant/index.ts b/src/components/userRelation/upsert/byUserEntityGrant/index.ts index 6dcea791a..2b1fad01f 100644 --- a/src/components/userRelation/upsert/byUserEntityGrant/index.ts +++ b/src/components/userRelation/upsert/byUserEntityGrant/index.ts @@ -22,9 +22,11 @@ export default OakComponent({ qrCodeType: 1, }, isList: false, - formData: ({ data: userEntityGrant }) => ({ - userEntityGrant, - }), + formData({ data: userEntityGrant, props }) { + return { + userEntityGrant, + }; + }, properties: { entity: '' as keyof EntityDict, entityId: '', @@ -36,7 +38,8 @@ export default OakComponent({ qrCodeType: '' as QrCodeType, multiple: false, rule: 'single' as EntityDict['userEntityGrant']['OpSchema']['rule'], - ruleOnRow: 'single' as EntityDict['userEntityGrant']['OpSchema']['ruleOnRow'], + ruleOnRow: + 'single' as EntityDict['userEntityGrant']['OpSchema']['ruleOnRow'], }, data: { period: 15, @@ -127,12 +130,28 @@ export default OakComponent({ }, setRelation(value: any) { this.update({ - relationIds: [value], + relationIds: value, }); }, setRelationMp(e: any) { - const { currentKey } = e.detail; - this.setRelation(currentKey); + const { key } = e.detail; + const { userEntityGrant } = this.state; + const relationIds = [...(userEntityGrant.relationIds || [])]; + const index = relationIds.findIndex((ele) => ele === key); + if (index > -1) { + relationIds.splice(index, 1); + } else { + relationIds.push(key); + } + + // 小程序 多选处理 + const newRelations = this.props.relations?.map((ele) => + Object.assign({}, ele, { + checked: relationIds.includes(ele.id), + }) + ); + this.setState({ relations: newRelations }); + this.setRelation(relationIds); }, setNumber(value: number) { this.update({ @@ -150,6 +169,20 @@ export default OakComponent({ const { count } = e.detail; this.setPeriod(count); }, + setMultiple(m: boolean) { + this.setState({ multiple: m }); + }, + setMultipleMp(e: any) { + const { value } = e.detail; + this.setMultiple(value); + }, + setRule(m: string) { + this.setState({ rule: m }); + }, + setRuleMp(e: any) { + const { currentKey } = e.detail; + this.setRule(currentKey); + }, setUnit(u: Unit) { const { defaultPeriods } = this.state; this.setState({ unit: u }); @@ -222,10 +255,10 @@ export default OakComponent({ qrCodeType: QrCodeType; type: EntityDict['userEntityGrant']['Schema']['type']; relations: EntityDict['relation']['OpSchema'][]; - claimUrl: string, + claimUrl: string; multiple: boolean; rule: EntityDict['userEntityGrant']['Schema']['rule']; - ruleOnRow: EntityDict['userEntityGrant']['OpSchema']['ruleOnRow'], + ruleOnRow: EntityDict['userEntityGrant']['OpSchema']['ruleOnRow']; } > ) => React.ReactElement; diff --git a/src/components/userRelation/upsert/byUserEntityGrant/index.xml b/src/components/userRelation/upsert/byUserEntityGrant/index.xml index 252f2f835..5b4ba62ed 100644 --- a/src/components/userRelation/upsert/byUserEntityGrant/index.xml +++ b/src/components/userRelation/upsert/byUserEntityGrant/index.xml @@ -1,112 +1,68 @@ - - + + 请通过分享或者截屏二维码方式分享权限 - - - + + - 权限: + {{t('userEntityGrant:attr.relationIds')}}: - - - {{item.display || t(entity + ':r.' + item.name)}} - - + + + {{item.display || t(entity + ':r.' + item.name)}} + + - - 人次: - - - - 单人次 - - - 不限人次 - - + + + {{t('userEntityGrant:attr.rule')}}: + + + + {{t('userEntityGrant:v.rule.' + item)}} + + + - + + + + {{t('multiple')}}: + + + + + - 有效期: + {{t('userEntityGrant:attr.expiresAt')}}: - - + - + {{unitArr[unitIndex].label}} + + + - - - - - 确定 + + {{t('common::action.confirm')}} \ No newline at end of file diff --git a/src/components/userRelation/upsert/byUserEntityGrant/web.pc.tsx b/src/components/userRelation/upsert/byUserEntityGrant/web.pc.tsx index 98d64fdc5..204ea4351 100644 --- a/src/components/userRelation/upsert/byUserEntityGrant/web.pc.tsx +++ b/src/components/userRelation/upsert/byUserEntityGrant/web.pc.tsx @@ -65,7 +65,6 @@ export default function render( style={{ marginBottom: 16 }} />