// 表单校验规则由 schema2code 生成,不建议直接修改校验规则,而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema const validator = { "adMixture": { "rules": [ { "format": "string" } ], "title": "摩尔组成", "label": "摩尔组成" }, "adMixtureV": { "rules": [ { "format": "string" } ], "title": "体积组成", "label": "体积组成" }, "adMixtureD": { "rules": [ { "format": "string" } ], "title": "质量组成", "label": "质量组成" }, "dCbtj": { "rules": [ { "format": "string" } ], "title": "参比条件", "label": "参比条件" }, "dPb": { "rules": [ { "format": "string" } ], "title": "参比压力", "label": "参比压力" }, "dTb": { "rules": [ { "format": "string" } ], "title": "参比温度", "label": "参比温度" }, "dPf": { "rules": [ { "format": "string" } ], "title": "绝对压力", "label": "绝对压力" }, "dTf": { "rules": [ { "format": "string" } ], "title": "工况温度", "label": "工况温度" }, "dMrx": { "rules": [ { "format": "string" } ], "title": "分子量", "label": "分子量" }, "dZb": { "rules": [ { "format": "string" } ], "title": "标况压缩因子", "label": "标况压缩因子" }, "dZf": { "rules": [ { "format": "string" } ], "title": "工况压缩因子", "label": "工况压缩因子" }, "dFpv": { "rules": [ { "format": "string" } ], "title": "超压缩系数", "label": "超压缩系数" }, "dDb": { "rules": [ { "format": "string" } ], "title": "标况摩尔密度", "label": "标况摩尔密度" }, "dDf": { "rules": [ { "format": "string" } ], "title": "工况摩尔密度", "label": "工况摩尔密度" }, "dRhob": { "rules": [ { "format": "string" } ], "title": "标况质量密度", "label": "标况质量密度" }, "dRhof": { "rules": [ { "format": "string" } ], "title": "工况质量密度", "label": "工况质量密度" }, "dRD_Ideal": { "rules": [ { "format": "string" } ], "title": "理想气体的相对密度", "label": "理想气体的相对密度" }, "dRD_Real": { "rules": [ { "format": "string" } ], "title": "真实气体的相对密度", "label": "真实气体的相对密度" }, "dHo": { "rules": [ { "format": "string" } ], "title": "理想气体的比焓", "label": "理想气体的比焓" }, "dH": { "rules": [ { "format": "string" } ], "title": "真实气体的焓", "label": "真实气体的焓" }, "dS": { "rules": [ { "format": "string" } ], "title": "真实气体的熵", "label": "真实气体的熵" }, "dCpi": { "rules": [ { "format": "string" } ], "title": "理想气体定压热容", "label": "理想气体定压热容" }, "dCp": { "rules": [ { "format": "string" } ], "title": "定压热容", "label": "定压热容" }, "dCv": { "rules": [ { "format": "string" } ], "title": "定容积热容", "label": "定容积热容" }, "dk": { "rules": [ { "format": "string" } ], "title": "比热比", "label": "比热比" }, "dKappa": { "rules": [ { "format": "string" } ], "title": "等熵指数", "label": "等熵指数" }, "dSOS": { "rules": [ { "format": "string" } ], "title": "声速", "label": "声速" }, "dCstar": { "rules": [ { "format": "string" } ], "title": "临界流函数", "label": "临界流函数" }, "dHhvMol": { "rules": [ { "format": "string" } ], "title": "摩尔高位发热量", "label": "摩尔高位发热量" }, "dLhvMol": { "rules": [ { "format": "string" } ], "title": "摩尔低位发热量", "label": "摩尔低位发热量" }, "dHhvv": { "rules": [ { "format": "string" } ], "title": "体积高位发热量", "label": "体积高位发热量" }, "dLhvv": { "rules": [ { "format": "string" } ], "title": "体积低位发热量", "label": "体积低位发热量" }, "dHhvm": { "rules": [ { "format": "string" } ], "title": "质量高位发热量", "label": "质量高位发热量" }, "dLhvm": { "rules": [ { "format": "string" } ], "title": "质量地位发热量", "label": "质量地位发热量" }, "dZb11062": { "rules": [ { "format": "string" } ], "title": "标况压缩因子", "label": "标况压缩因子" }, "dRhob11062": { "rules": [ { "format": "string" } ], "title": "标况质量密度", "label": "标况质量密度" }, "dRhof11062": { "rules": [ { "format": "string" } ], "title": "工况质量密度", "label": "工况质量密度" }, "dRD_Ideal11062": { "rules": [ { "format": "string" } ], "title": "理想气体的相对密度", "label": "理想气体的相对密度" }, "dRD_Real11062": { "rules": [ { "format": "string" } ], "title": "真实气体的相对密度", "label": "真实气体的相对密度" }, "dWobbeIndex": { "rules": [ { "format": "string" } ], "title": "真实气体的沃泊指数", "label": "真实气体的沃泊指数" }, "Pc": { "rules": [ { "format": "string" } ], "title": "临界压力", "label": "临界压力" }, "TC": { "rules": [ { "format": "string" } ], "title": "临界温度", "label": "临界温度" }, "Bzsx": { "rules": [ { "format": "string" } ], "title": "爆炸上限", "label": "爆炸上限" }, "Bzxx": { "rules": [ { "format": "string" } ], "title": "爆炸下限", "label": "爆炸下限" }, "TotalC": { "rules": [ { "format": "string" } ], "title": "总炭含量", "label": "总炭含量" }, "C2": { "rules": [ { "format": "string" } ], "title": "C2组分含量", "label": "C2组分含量" }, "C2j": { "rules": [ { "format": "string" } ], "title": "C2以上组分含量", "label": "C2以上组分含量" }, "C3j": { "rules": [ { "format": "string" } ], "title": "C3以上组分含量", "label": "C3以上组分含量" }, "C4j": { "rules": [ { "format": "string" } ], "title": "C4以上组分含量", "label": "C4以上组分含量" }, "C5j": { "rules": [ { "format": "string" } ], "title": "C5以上组分含量", "label": "C5以上组分含量" }, "C6j": { "rules": [ { "format": "string" } ], "title": "C6以上组分含量", "label": "C6以上组分含量" }, "C3C4": { "rules": [ { "format": "string" } ], "title": "C3C4组分含量", "label": "C3C4组分含量" }, "createBy": { "rules": [ { "format": "string" } ], "title": "创建人", "label": "创建人" }, "updateBy": { "rules": [ { "format": "string" } ], "title": "更新人", "label": "更新人" }, "createTime": { "rules": [ { "format": "datetime" } ], "title": "创建时间", "label": "创建时间" }, "updateTime": { "rules": [ { "format": "datetime" } ], "title": "更新时间", "label": "更新时间" } } const enumConverter = {} function filterToWhere(filter, command) { let where = {} for (let field in filter) { let { type, value } = filter[field] switch (type) { case "search": if (typeof value === 'string' && value.length) { where[field] = new RegExp(value) } break; case "select": if (value.length) { let selectValue = [] for (let s of value) { selectValue.push(command.eq(s)) } where[field] = command.or(selectValue) } break; case "range": if (value.length) { let gt = value[0] let lt = value[1] where[field] = command.and([command.gte(gt), command.lte(lt)]) } break; case "date": if (value.length) { let [s, e] = value let startDate = new Date(s) let endDate = new Date(e) where[field] = command.and([command.gte(startDate), command.lte(endDate)]) } break; case "timestamp": if (value.length) { let [startDate, endDate] = value where[field] = command.and([command.gte(startDate), command.lte(endDate)]) } break; } } return where } export { validator, enumConverter, filterToWhere }