| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- /**
- * 工具函数(从 common.wxs 转换而来)
- */
- /**
- * 只展示月和日
- */
- export const lengthFormat = function (str: string): string | undefined {
- if (str) {
- return str.substring(5);
- }
- };
- /**
- * 转中字
- */
- export const numToCn = function (num: number): string | undefined {
- var str: string | undefined;
- switch (num) {
- case 1:
- str = "一";
- break;
- case 2:
- str = "二";
- break;
- case 3:
- str = "三";
- break;
- case 4:
- str = "四";
- break;
- case 5:
- str = "五";
- break;
- case 6:
- str = "六";
- break;
- case 7:
- str = "七";
- break;
- case 8:
- str = "八";
- break;
- case 9:
- str = "九";
- break;
- case 10:
- str = "十";
- break;
- }
- return str;
- };
- /**
- * 日期格式化 日 月
- */
- export const dateFormat = function (str: string): string {
- if (!str) {
- return "";
- }
- return str.substring(5, 7) + "." + str.substring(8, 10);
- };
- /**
- * 是否含有
- */
- export const isHas = function (val: any, arr: any[]): boolean {
- if (!arr) {
- return false;
- }
- for (var i = 0; i < arr.length; i++) {
- if (arr[i] == val) {
- return true;
- }
- }
- return false;
- };
- /**
- * 消息是否选中
- */
- export const msgSelected = function (item: any, list: any[]): boolean {
- for (var i = 0; i < list.length; i++) {
- if (item.Ids == list[i].Ids) {
- return true;
- }
- }
- return false;
- };
- /**
- * 处方是否选中
- */
- export const presSelected = function (item: any, list: any[]): boolean {
- for (var i = 0; i < list.length; i++) {
- if (item.PrescNo == list[i].PrescNo) {
- return true;
- }
- }
- return false;
- };
- /**
- * 是否包含字段
- */
- export const isIndexOf = function (str: string, val: string): boolean {
- return str.indexOf(val) != -1;
- };
|