搜索组件 支持money类型
This commit is contained in:
parent
f94b763aa4
commit
d0fd8d6fca
|
|
@ -103,7 +103,8 @@ function createWechatQrCode(options, context) {
|
|||
throw new Error('无法生成公众号-小程序二维码,服务号未正确配置');
|
||||
}
|
||||
selfMp = applications.find(function (ele) { return ele.type = 'wechatMp'; });
|
||||
if (!selfMp.config.qrCodePrefix) {
|
||||
if (!(selfMp && selfMp.config.appId &&
|
||||
selfMp.config.appSecret)) {
|
||||
throw new Error('无法生成公众号-小程序二维码,小程序未正确配置');
|
||||
}
|
||||
appId = self_4.id;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|||
var tslib_1 = require("tslib");
|
||||
var jsx_runtime_1 = require("react/jsx-runtime");
|
||||
var antd_1 = require("antd");
|
||||
var money_1 = require("oak-domain/lib/utils/money");
|
||||
var Entity_1 = require("oak-domain/lib/types/Entity");
|
||||
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
||||
var weekday_1 = tslib_1.__importDefault(require("dayjs/plugin/weekday"));
|
||||
|
|
@ -75,15 +76,18 @@ function Render(props) {
|
|||
}
|
||||
var _value = transformValue(column, filter);
|
||||
switch (attrType) {
|
||||
case 'money': {
|
||||
var ops = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte'];
|
||||
var moneyVal_1 = _value ? (0, money_1.ToYuan)(_value) : '';
|
||||
V = ((0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.input'), value: moneyVal_1, onChange: function (e) {
|
||||
var val = e.target.value;
|
||||
var val2 = /^(-?[1-9]\d*(\.\d*[1-9])?)|(-?0\.\d*[1-9])$/.test(val) ? (0, money_1.ToCent)(val) : moneyVal_1;
|
||||
setFilterAndResetFilter(val2);
|
||||
}, allowClear: true, onPressEnter: function () { } }));
|
||||
break;
|
||||
}
|
||||
case 'float': {
|
||||
var ops = [
|
||||
'$eq',
|
||||
'$ne',
|
||||
'$gt',
|
||||
'$gte',
|
||||
'$lt',
|
||||
'$lte',
|
||||
];
|
||||
var ops = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte'];
|
||||
V = ((0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: placeholder || t('placeholder.input'), value: _value, onChange: function (e) {
|
||||
var val = e.target.value;
|
||||
setFilterAndResetFilter(val);
|
||||
|
|
@ -92,14 +96,7 @@ function Render(props) {
|
|||
}
|
||||
case 'integer':
|
||||
case 'int': {
|
||||
var ops = [
|
||||
'$eq',
|
||||
'$ne',
|
||||
'$gt',
|
||||
'$gte',
|
||||
'$lt',
|
||||
'$lte',
|
||||
];
|
||||
var ops = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte'];
|
||||
if (op) {
|
||||
(0, assert_1.assert)(ops.includes(op), assertMessage(attr, attrType, op, ops));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ function setUserUnsubscribed(openId, context) {
|
|||
}
|
||||
function setUserSubscribed(openId, eventKey, context) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _a, applicationId, applicationType, list, now, data, doUpdate, sceneStr, wcqId, _b, wechatQrCode, application, _c, type, config, systemId, _d, appId, appSecret, wechatInstance, expired, entity, entityId, _e, _f, userEntityGrant, _g, id, granter, expired_1, entity2, qrCodeType, name_1, _h, domain, url, _j, appMp, config_1, appId_1, content;
|
||||
var _a, applicationId, applicationType, list, now, data, doUpdate, sceneStr, wcqId, _b, wechatQrCode, application, _c, type, config, systemId, _d, appId, appSecret, wechatInstance, expired, entity, entityId, _e, _f, userEntityGrant, _g, id, granter, expired_1, entity2, qrCodeType, name_1, _h, domain, url, _j, appMp, config_1, appId_1, url, content;
|
||||
var _this = this;
|
||||
return tslib_1.__generator(this, function (_k) {
|
||||
switch (_k.label) {
|
||||
|
|
@ -322,17 +322,18 @@ function setUserSubscribed(openId, eventKey, context) {
|
|||
filter: {
|
||||
systemId: systemId,
|
||||
type: 'wechatMp',
|
||||
}
|
||||
},
|
||||
}, { dontCollect: true })];
|
||||
case 8:
|
||||
_j = tslib_1.__read.apply(void 0, [_k.sent(), 1]), appMp = _j[0];
|
||||
(0, assert_1.default)(appMp, '公众号推送小程序码时找不到关联的小程序');
|
||||
config_1 = appMp.config;
|
||||
appId_1 = config_1.appId;
|
||||
content = "".concat(name_1, "\u4E3A\u60A8\u521B\u5EFA\u4E86\u4E00\u4E2A\u6388\u6743\uFF0C<a href=\"#\" data-miniprogram-appid=\"").concat(appId_1, "\" data-miniprogram-path=\"").concat((0, url_2.composeUrl)('/pages/wecharQrCode/scan', {
|
||||
url = (0, url_2.composeUrl)('/pages/wecharQrCode/scan', {
|
||||
oakId: wcqId,
|
||||
time: "".concat(Date.now()),
|
||||
}), "\">\u8BF7\u70B9\u51FB\u9886\u53D6</a>");
|
||||
});
|
||||
content = "".concat(name_1, "\u4E3A\u60A8\u521B\u5EFA\u4E86\u4E00\u4E2A\u6388\u6743\uFF0C<a href='#' data-miniprogram-appid='").concat(appId_1, "' data-miniprogram-path='").concat(url, "'>\u8BF7\u70B9\u51FB\u9886\u53D6</a>");
|
||||
(0, assert_1.default)(!expired_1); // 如果生成的wechatQrCode没过期,userEntityGrant就不可能过期。
|
||||
wechatInstance.sendServeMessage({
|
||||
openId: openId,
|
||||
|
|
|
|||
|
|
@ -131,8 +131,15 @@ export async function createWechatQrCode<ED extends EntityDict, T extends keyof
|
|||
throw new Error('无法生成公众号-小程序二维码,服务号未正确配置');
|
||||
}
|
||||
const selfMp = applications.find((ele) => ele.type = 'wechatMp');
|
||||
if (!(selfMp!.config as WechatMpConfig).qrCodePrefix) {
|
||||
throw new Error('无法生成公众号-小程序二维码,小程序未正确配置');
|
||||
if (
|
||||
!(
|
||||
selfMp && (selfMp!.config as WechatMpConfig).appId &&
|
||||
(selfMp!.config as WechatMpConfig).appSecret
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
'无法生成公众号-小程序二维码,小程序未正确配置'
|
||||
);
|
||||
}
|
||||
appId = self.id;
|
||||
appType = 'wechatPublic';
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export type Ops =
|
|||
|
||||
export type ColSpanType = 1 | 2 | 3 | 4;
|
||||
|
||||
export type ValueType = string | boolean | Array<Dayjs> | Dayjs;
|
||||
export type ValueType = string | boolean | number | Array<Dayjs> | Dayjs;
|
||||
|
||||
export type ColumnProps = {
|
||||
attr: string;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import {
|
|||
InputNumber,
|
||||
} from 'antd';
|
||||
import { WebComponentProps } from 'oak-frontend-base';
|
||||
import { ToYuan, ToCent } from 'oak-domain/lib/utils/money';
|
||||
import { EntityDict } from '../../../general-app-domain';
|
||||
import { initinctiveAttributes } from 'oak-domain/lib/types/Entity';
|
||||
import dayjs, { Dayjs } from 'dayjs';
|
||||
|
|
@ -165,15 +166,29 @@ export default function Render(
|
|||
const _value = transformValue(column, filter);
|
||||
|
||||
switch (attrType) {
|
||||
case 'money': {
|
||||
const ops: Ops[] = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte'];
|
||||
const moneyVal = _value ? ToYuan(_value) : '';
|
||||
V = (
|
||||
<Input
|
||||
placeholder={placeholder || t('placeholder.input')}
|
||||
value={moneyVal}
|
||||
onChange={(e) => {
|
||||
const val = e.target.value;
|
||||
const val2 =
|
||||
/^(-?[1-9]\d*(\.\d*[1-9])?)|(-?0\.\d*[1-9])$/.test(
|
||||
val
|
||||
) ? ToCent(val) : moneyVal;
|
||||
setFilterAndResetFilter(val2);
|
||||
}}
|
||||
allowClear
|
||||
onPressEnter={() => {}}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'float': {
|
||||
const ops: Ops[] = [
|
||||
'$eq',
|
||||
'$ne',
|
||||
'$gt',
|
||||
'$gte',
|
||||
'$lt',
|
||||
'$lte',
|
||||
];
|
||||
const ops: Ops[] = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte'];
|
||||
V = (
|
||||
<Input
|
||||
placeholder={placeholder || t('placeholder.input')}
|
||||
|
|
@ -190,14 +205,7 @@ export default function Render(
|
|||
}
|
||||
case 'integer':
|
||||
case 'int': {
|
||||
const ops: Ops[] = [
|
||||
'$eq',
|
||||
'$ne',
|
||||
'$gt',
|
||||
'$gte',
|
||||
'$lt',
|
||||
'$lte',
|
||||
];
|
||||
const ops: Ops[] = ['$eq', '$ne', '$gt', '$gte', '$lt', '$lte'];
|
||||
if (op) {
|
||||
assert(
|
||||
ops.includes(op),
|
||||
|
|
@ -471,7 +479,6 @@ export default function Render(
|
|||
column={column}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,25 +317,33 @@ async function setUserSubscribed(openId: string, eventKey: string, context: BRC)
|
|||
else {
|
||||
assert(qrCodeType === 'wechatPublicForMp');
|
||||
// 找到相关的小程序
|
||||
const [ appMp ] = await context.select('application', {
|
||||
data: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
const [appMp] = await context.select(
|
||||
'application',
|
||||
{
|
||||
data: {
|
||||
id: 1,
|
||||
config: 1,
|
||||
},
|
||||
filter: {
|
||||
systemId,
|
||||
type: 'wechatMp',
|
||||
},
|
||||
},
|
||||
filter: {
|
||||
systemId,
|
||||
type: 'wechatMp',
|
||||
}
|
||||
}, { dontCollect: true });
|
||||
{ dontCollect: true }
|
||||
);
|
||||
assert(appMp, '公众号推送小程序码时找不到关联的小程序');
|
||||
const { config } = appMp;
|
||||
const { appId } = config as WechatMpConfig;
|
||||
|
||||
const url = composeUrl(
|
||||
'/pages/wecharQrCode/scan',
|
||||
{
|
||||
oakId: wcqId,
|
||||
time: `${Date.now()}`,
|
||||
}
|
||||
)
|
||||
// 先试着发文字链接
|
||||
const content = `${name}为您创建了一个授权,<a href="#" data-miniprogram-appid="${appId}" data-miniprogram-path="${composeUrl('/pages/wecharQrCode/scan', {
|
||||
oakId: wcqId,
|
||||
time: `${Date.now()}`,
|
||||
})}">请点击领取</a>`;
|
||||
const content = `${name}为您创建了一个授权,<a href='#' data-miniprogram-appid='${appId}' data-miniprogram-path='${url}'>请点击领取</a>`;
|
||||
|
||||
assert(!expired); // 如果生成的wechatQrCode没过期,userEntityGrant就不可能过期。
|
||||
wechatInstance.sendServeMessage({
|
||||
|
|
|
|||
Loading…
Reference in New Issue