if (typeof Promise !== "undefined" && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
const promise = this.constructor;
return this.then(
(value) => promise.resolve(callback()).then(() => value),
(reason) => promise.resolve(callback()).then(() => {
throw reason;
})
);
};
}
;
if (typeof uni !== "undefined" && uni && uni.requireGlobal) {
const global2 = uni.requireGlobal();
ArrayBuffer = global2.ArrayBuffer;
Int8Array = global2.Int8Array;
Uint8Array = global2.Uint8Array;
Uint8ClampedArray = global2.Uint8ClampedArray;
Int16Array = global2.Int16Array;
Uint16Array = global2.Uint16Array;
Int32Array = global2.Int32Array;
Uint32Array = global2.Uint32Array;
Float32Array = global2.Float32Array;
Float64Array = global2.Float64Array;
BigInt64Array = global2.BigInt64Array;
BigUint64Array = global2.BigUint64Array;
}
;
if (uni.restoreGlobal) {
uni.restoreGlobal(Vue, weex, plus, setTimeout, clearTimeout, setInterval, clearInterval);
}
(function(vue, shared) {
"use strict";
const ON_SHOW = "onShow";
const ON_HIDE = "onHide";
const ON_LAUNCH = "onLaunch";
const ON_LOAD = "onLoad";
function formatAppLog(type, filename, ...args) {
if (uni.__log__) {
uni.__log__(type, filename, ...args);
} else {
console[type].apply(console, [...args, filename]);
}
}
function resolveEasycom(component, easycom) {
return shared.isString(component) ? easycom : component;
}
const createHook = (lifecycle) => (hook, target = vue.getCurrentInstance()) => {
!vue.isInSSRComponentSetup && vue.injectHook(lifecycle, hook, target);
};
const onShow = /* @__PURE__ */ createHook(ON_SHOW);
const onHide = /* @__PURE__ */ createHook(ON_HIDE);
const onLaunch = /* @__PURE__ */ createHook(ON_LAUNCH);
const onLoad = /* @__PURE__ */ createHook(ON_LOAD);
const icons = {
"id": "2852637",
"name": "uniui图标库",
"font_family": "uniicons",
"css_prefix_text": "uniui-",
"description": "",
"glyphs": [
{
"icon_id": "25027049",
"name": "yanse",
"font_class": "color",
"unicode": "e6cf",
"unicode_decimal": 59087
},
{
"icon_id": "25027048",
"name": "wallet",
"font_class": "wallet",
"unicode": "e6b1",
"unicode_decimal": 59057
},
{
"icon_id": "25015720",
"name": "settings-filled",
"font_class": "settings-filled",
"unicode": "e6ce",
"unicode_decimal": 59086
},
{
"icon_id": "25015434",
"name": "shimingrenzheng-filled",
"font_class": "auth-filled",
"unicode": "e6cc",
"unicode_decimal": 59084
},
{
"icon_id": "24934246",
"name": "shop-filled",
"font_class": "shop-filled",
"unicode": "e6cd",
"unicode_decimal": 59085
},
{
"icon_id": "24934159",
"name": "staff-filled-01",
"font_class": "staff-filled",
"unicode": "e6cb",
"unicode_decimal": 59083
},
{
"icon_id": "24932461",
"name": "VIP-filled",
"font_class": "vip-filled",
"unicode": "e6c6",
"unicode_decimal": 59078
},
{
"icon_id": "24932462",
"name": "plus_circle_fill",
"font_class": "plus-filled",
"unicode": "e6c7",
"unicode_decimal": 59079
},
{
"icon_id": "24932463",
"name": "folder_add-filled",
"font_class": "folder-add-filled",
"unicode": "e6c8",
"unicode_decimal": 59080
},
{
"icon_id": "24932464",
"name": "yanse-filled",
"font_class": "color-filled",
"unicode": "e6c9",
"unicode_decimal": 59081
},
{
"icon_id": "24932465",
"name": "tune-filled",
"font_class": "tune-filled",
"unicode": "e6ca",
"unicode_decimal": 59082
},
{
"icon_id": "24932455",
"name": "a-rilidaka-filled",
"font_class": "calendar-filled",
"unicode": "e6c0",
"unicode_decimal": 59072
},
{
"icon_id": "24932456",
"name": "notification-filled",
"font_class": "notification-filled",
"unicode": "e6c1",
"unicode_decimal": 59073
},
{
"icon_id": "24932457",
"name": "wallet-filled",
"font_class": "wallet-filled",
"unicode": "e6c2",
"unicode_decimal": 59074
},
{
"icon_id": "24932458",
"name": "paihangbang-filled",
"font_class": "medal-filled",
"unicode": "e6c3",
"unicode_decimal": 59075
},
{
"icon_id": "24932459",
"name": "gift-filled",
"font_class": "gift-filled",
"unicode": "e6c4",
"unicode_decimal": 59076
},
{
"icon_id": "24932460",
"name": "fire-filled",
"font_class": "fire-filled",
"unicode": "e6c5",
"unicode_decimal": 59077
},
{
"icon_id": "24928001",
"name": "refreshempty",
"font_class": "refreshempty",
"unicode": "e6bf",
"unicode_decimal": 59071
},
{
"icon_id": "24926853",
"name": "location-ellipse",
"font_class": "location-filled",
"unicode": "e6af",
"unicode_decimal": 59055
},
{
"icon_id": "24926735",
"name": "person-filled",
"font_class": "person-filled",
"unicode": "e69d",
"unicode_decimal": 59037
},
{
"icon_id": "24926703",
"name": "personadd-filled",
"font_class": "personadd-filled",
"unicode": "e698",
"unicode_decimal": 59032
},
{
"icon_id": "24923351",
"name": "back",
"font_class": "back",
"unicode": "e6b9",
"unicode_decimal": 59065
},
{
"icon_id": "24923352",
"name": "forward",
"font_class": "forward",
"unicode": "e6ba",
"unicode_decimal": 59066
},
{
"icon_id": "24923353",
"name": "arrowthinright",
"font_class": "arrow-right",
"unicode": "e6bb",
"unicode_decimal": 59067
},
{
"icon_id": "24923353",
"name": "arrowthinright",
"font_class": "arrowthinright",
"unicode": "e6bb",
"unicode_decimal": 59067
},
{
"icon_id": "24923354",
"name": "arrowthinleft",
"font_class": "arrow-left",
"unicode": "e6bc",
"unicode_decimal": 59068
},
{
"icon_id": "24923354",
"name": "arrowthinleft",
"font_class": "arrowthinleft",
"unicode": "e6bc",
"unicode_decimal": 59068
},
{
"icon_id": "24923355",
"name": "arrowthinup",
"font_class": "arrow-up",
"unicode": "e6bd",
"unicode_decimal": 59069
},
{
"icon_id": "24923355",
"name": "arrowthinup",
"font_class": "arrowthinup",
"unicode": "e6bd",
"unicode_decimal": 59069
},
{
"icon_id": "24923356",
"name": "arrowthindown",
"font_class": "arrow-down",
"unicode": "e6be",
"unicode_decimal": 59070
},
{
"icon_id": "24923356",
"name": "arrowthindown",
"font_class": "arrowthindown",
"unicode": "e6be",
"unicode_decimal": 59070
},
{
"icon_id": "24923349",
"name": "arrowdown",
"font_class": "bottom",
"unicode": "e6b8",
"unicode_decimal": 59064
},
{
"icon_id": "24923349",
"name": "arrowdown",
"font_class": "arrowdown",
"unicode": "e6b8",
"unicode_decimal": 59064
},
{
"icon_id": "24923346",
"name": "arrowright",
"font_class": "right",
"unicode": "e6b5",
"unicode_decimal": 59061
},
{
"icon_id": "24923346",
"name": "arrowright",
"font_class": "arrowright",
"unicode": "e6b5",
"unicode_decimal": 59061
},
{
"icon_id": "24923347",
"name": "arrowup",
"font_class": "top",
"unicode": "e6b6",
"unicode_decimal": 59062
},
{
"icon_id": "24923347",
"name": "arrowup",
"font_class": "arrowup",
"unicode": "e6b6",
"unicode_decimal": 59062
},
{
"icon_id": "24923348",
"name": "arrowleft",
"font_class": "left",
"unicode": "e6b7",
"unicode_decimal": 59063
},
{
"icon_id": "24923348",
"name": "arrowleft",
"font_class": "arrowleft",
"unicode": "e6b7",
"unicode_decimal": 59063
},
{
"icon_id": "24923334",
"name": "eye",
"font_class": "eye",
"unicode": "e651",
"unicode_decimal": 58961
},
{
"icon_id": "24923335",
"name": "eye-filled",
"font_class": "eye-filled",
"unicode": "e66a",
"unicode_decimal": 58986
},
{
"icon_id": "24923336",
"name": "eye-slash",
"font_class": "eye-slash",
"unicode": "e6b3",
"unicode_decimal": 59059
},
{
"icon_id": "24923337",
"name": "eye-slash-filled",
"font_class": "eye-slash-filled",
"unicode": "e6b4",
"unicode_decimal": 59060
},
{
"icon_id": "24923305",
"name": "info-filled",
"font_class": "info-filled",
"unicode": "e649",
"unicode_decimal": 58953
},
{
"icon_id": "24923299",
"name": "reload-01",
"font_class": "reload",
"unicode": "e6b2",
"unicode_decimal": 59058
},
{
"icon_id": "24923195",
"name": "mic_slash_fill",
"font_class": "micoff-filled",
"unicode": "e6b0",
"unicode_decimal": 59056
},
{
"icon_id": "24923165",
"name": "map-pin-ellipse",
"font_class": "map-pin-ellipse",
"unicode": "e6ac",
"unicode_decimal": 59052
},
{
"icon_id": "24923166",
"name": "map-pin",
"font_class": "map-pin",
"unicode": "e6ad",
"unicode_decimal": 59053
},
{
"icon_id": "24923167",
"name": "location",
"font_class": "location",
"unicode": "e6ae",
"unicode_decimal": 59054
},
{
"icon_id": "24923064",
"name": "starhalf",
"font_class": "starhalf",
"unicode": "e683",
"unicode_decimal": 59011
},
{
"icon_id": "24923065",
"name": "star",
"font_class": "star",
"unicode": "e688",
"unicode_decimal": 59016
},
{
"icon_id": "24923066",
"name": "star-filled",
"font_class": "star-filled",
"unicode": "e68f",
"unicode_decimal": 59023
},
{
"icon_id": "24899646",
"name": "a-rilidaka",
"font_class": "calendar",
"unicode": "e6a0",
"unicode_decimal": 59040
},
{
"icon_id": "24899647",
"name": "fire",
"font_class": "fire",
"unicode": "e6a1",
"unicode_decimal": 59041
},
{
"icon_id": "24899648",
"name": "paihangbang",
"font_class": "medal",
"unicode": "e6a2",
"unicode_decimal": 59042
},
{
"icon_id": "24899649",
"name": "font",
"font_class": "font",
"unicode": "e6a3",
"unicode_decimal": 59043
},
{
"icon_id": "24899650",
"name": "gift",
"font_class": "gift",
"unicode": "e6a4",
"unicode_decimal": 59044
},
{
"icon_id": "24899651",
"name": "link",
"font_class": "link",
"unicode": "e6a5",
"unicode_decimal": 59045
},
{
"icon_id": "24899652",
"name": "notification",
"font_class": "notification",
"unicode": "e6a6",
"unicode_decimal": 59046
},
{
"icon_id": "24899653",
"name": "staff",
"font_class": "staff",
"unicode": "e6a7",
"unicode_decimal": 59047
},
{
"icon_id": "24899654",
"name": "VIP",
"font_class": "vip",
"unicode": "e6a8",
"unicode_decimal": 59048
},
{
"icon_id": "24899655",
"name": "folder_add",
"font_class": "folder-add",
"unicode": "e6a9",
"unicode_decimal": 59049
},
{
"icon_id": "24899656",
"name": "tune",
"font_class": "tune",
"unicode": "e6aa",
"unicode_decimal": 59050
},
{
"icon_id": "24899657",
"name": "shimingrenzheng",
"font_class": "auth",
"unicode": "e6ab",
"unicode_decimal": 59051
},
{
"icon_id": "24899565",
"name": "person",
"font_class": "person",
"unicode": "e699",
"unicode_decimal": 59033
},
{
"icon_id": "24899566",
"name": "email-filled",
"font_class": "email-filled",
"unicode": "e69a",
"unicode_decimal": 59034
},
{
"icon_id": "24899567",
"name": "phone-filled",
"font_class": "phone-filled",
"unicode": "e69b",
"unicode_decimal": 59035
},
{
"icon_id": "24899568",
"name": "phone",
"font_class": "phone",
"unicode": "e69c",
"unicode_decimal": 59036
},
{
"icon_id": "24899570",
"name": "email",
"font_class": "email",
"unicode": "e69e",
"unicode_decimal": 59038
},
{
"icon_id": "24899571",
"name": "personadd",
"font_class": "personadd",
"unicode": "e69f",
"unicode_decimal": 59039
},
{
"icon_id": "24899558",
"name": "chatboxes-filled",
"font_class": "chatboxes-filled",
"unicode": "e692",
"unicode_decimal": 59026
},
{
"icon_id": "24899559",
"name": "contact",
"font_class": "contact",
"unicode": "e693",
"unicode_decimal": 59027
},
{
"icon_id": "24899560",
"name": "chatbubble-filled",
"font_class": "chatbubble-filled",
"unicode": "e694",
"unicode_decimal": 59028
},
{
"icon_id": "24899561",
"name": "contact-filled",
"font_class": "contact-filled",
"unicode": "e695",
"unicode_decimal": 59029
},
{
"icon_id": "24899562",
"name": "chatboxes",
"font_class": "chatboxes",
"unicode": "e696",
"unicode_decimal": 59030
},
{
"icon_id": "24899563",
"name": "chatbubble",
"font_class": "chatbubble",
"unicode": "e697",
"unicode_decimal": 59031
},
{
"icon_id": "24881290",
"name": "upload-filled",
"font_class": "upload-filled",
"unicode": "e68e",
"unicode_decimal": 59022
},
{
"icon_id": "24881292",
"name": "upload",
"font_class": "upload",
"unicode": "e690",
"unicode_decimal": 59024
},
{
"icon_id": "24881293",
"name": "weixin",
"font_class": "weixin",
"unicode": "e691",
"unicode_decimal": 59025
},
{
"icon_id": "24881274",
"name": "compose",
"font_class": "compose",
"unicode": "e67f",
"unicode_decimal": 59007
},
{
"icon_id": "24881275",
"name": "qq",
"font_class": "qq",
"unicode": "e680",
"unicode_decimal": 59008
},
{
"icon_id": "24881276",
"name": "download-filled",
"font_class": "download-filled",
"unicode": "e681",
"unicode_decimal": 59009
},
{
"icon_id": "24881277",
"name": "pengyouquan",
"font_class": "pyq",
"unicode": "e682",
"unicode_decimal": 59010
},
{
"icon_id": "24881279",
"name": "sound",
"font_class": "sound",
"unicode": "e684",
"unicode_decimal": 59012
},
{
"icon_id": "24881280",
"name": "trash-filled",
"font_class": "trash-filled",
"unicode": "e685",
"unicode_decimal": 59013
},
{
"icon_id": "24881281",
"name": "sound-filled",
"font_class": "sound-filled",
"unicode": "e686",
"unicode_decimal": 59014
},
{
"icon_id": "24881282",
"name": "trash",
"font_class": "trash",
"unicode": "e687",
"unicode_decimal": 59015
},
{
"icon_id": "24881284",
"name": "videocam-filled",
"font_class": "videocam-filled",
"unicode": "e689",
"unicode_decimal": 59017
},
{
"icon_id": "24881285",
"name": "spinner-cycle",
"font_class": "spinner-cycle",
"unicode": "e68a",
"unicode_decimal": 59018
},
{
"icon_id": "24881286",
"name": "weibo",
"font_class": "weibo",
"unicode": "e68b",
"unicode_decimal": 59019
},
{
"icon_id": "24881288",
"name": "videocam",
"font_class": "videocam",
"unicode": "e68c",
"unicode_decimal": 59020
},
{
"icon_id": "24881289",
"name": "download",
"font_class": "download",
"unicode": "e68d",
"unicode_decimal": 59021
},
{
"icon_id": "24879601",
"name": "help",
"font_class": "help",
"unicode": "e679",
"unicode_decimal": 59001
},
{
"icon_id": "24879602",
"name": "navigate-filled",
"font_class": "navigate-filled",
"unicode": "e67a",
"unicode_decimal": 59002
},
{
"icon_id": "24879603",
"name": "plusempty",
"font_class": "plusempty",
"unicode": "e67b",
"unicode_decimal": 59003
},
{
"icon_id": "24879604",
"name": "smallcircle",
"font_class": "smallcircle",
"unicode": "e67c",
"unicode_decimal": 59004
},
{
"icon_id": "24879605",
"name": "minus-filled",
"font_class": "minus-filled",
"unicode": "e67d",
"unicode_decimal": 59005
},
{
"icon_id": "24879606",
"name": "micoff",
"font_class": "micoff",
"unicode": "e67e",
"unicode_decimal": 59006
},
{
"icon_id": "24879588",
"name": "closeempty",
"font_class": "closeempty",
"unicode": "e66c",
"unicode_decimal": 58988
},
{
"icon_id": "24879589",
"name": "clear",
"font_class": "clear",
"unicode": "e66d",
"unicode_decimal": 58989
},
{
"icon_id": "24879590",
"name": "navigate",
"font_class": "navigate",
"unicode": "e66e",
"unicode_decimal": 58990
},
{
"icon_id": "24879591",
"name": "minus",
"font_class": "minus",
"unicode": "e66f",
"unicode_decimal": 58991
},
{
"icon_id": "24879592",
"name": "image",
"font_class": "image",
"unicode": "e670",
"unicode_decimal": 58992
},
{
"icon_id": "24879593",
"name": "mic",
"font_class": "mic",
"unicode": "e671",
"unicode_decimal": 58993
},
{
"icon_id": "24879594",
"name": "paperplane",
"font_class": "paperplane",
"unicode": "e672",
"unicode_decimal": 58994
},
{
"icon_id": "24879595",
"name": "close",
"font_class": "close",
"unicode": "e673",
"unicode_decimal": 58995
},
{
"icon_id": "24879596",
"name": "help-filled",
"font_class": "help-filled",
"unicode": "e674",
"unicode_decimal": 58996
},
{
"icon_id": "24879597",
"name": "plus-filled",
"font_class": "paperplane-filled",
"unicode": "e675",
"unicode_decimal": 58997
},
{
"icon_id": "24879598",
"name": "plus",
"font_class": "plus",
"unicode": "e676",
"unicode_decimal": 58998
},
{
"icon_id": "24879599",
"name": "mic-filled",
"font_class": "mic-filled",
"unicode": "e677",
"unicode_decimal": 58999
},
{
"icon_id": "24879600",
"name": "image-filled",
"font_class": "image-filled",
"unicode": "e678",
"unicode_decimal": 59e3
},
{
"icon_id": "24855900",
"name": "locked-filled",
"font_class": "locked-filled",
"unicode": "e668",
"unicode_decimal": 58984
},
{
"icon_id": "24855901",
"name": "info",
"font_class": "info",
"unicode": "e669",
"unicode_decimal": 58985
},
{
"icon_id": "24855903",
"name": "locked",
"font_class": "locked",
"unicode": "e66b",
"unicode_decimal": 58987
},
{
"icon_id": "24855884",
"name": "camera-filled",
"font_class": "camera-filled",
"unicode": "e658",
"unicode_decimal": 58968
},
{
"icon_id": "24855885",
"name": "chat-filled",
"font_class": "chat-filled",
"unicode": "e659",
"unicode_decimal": 58969
},
{
"icon_id": "24855886",
"name": "camera",
"font_class": "camera",
"unicode": "e65a",
"unicode_decimal": 58970
},
{
"icon_id": "24855887",
"name": "circle",
"font_class": "circle",
"unicode": "e65b",
"unicode_decimal": 58971
},
{
"icon_id": "24855888",
"name": "checkmarkempty",
"font_class": "checkmarkempty",
"unicode": "e65c",
"unicode_decimal": 58972
},
{
"icon_id": "24855889",
"name": "chat",
"font_class": "chat",
"unicode": "e65d",
"unicode_decimal": 58973
},
{
"icon_id": "24855890",
"name": "circle-filled",
"font_class": "circle-filled",
"unicode": "e65e",
"unicode_decimal": 58974
},
{
"icon_id": "24855891",
"name": "flag",
"font_class": "flag",
"unicode": "e65f",
"unicode_decimal": 58975
},
{
"icon_id": "24855892",
"name": "flag-filled",
"font_class": "flag-filled",
"unicode": "e660",
"unicode_decimal": 58976
},
{
"icon_id": "24855893",
"name": "gear-filled",
"font_class": "gear-filled",
"unicode": "e661",
"unicode_decimal": 58977
},
{
"icon_id": "24855894",
"name": "home",
"font_class": "home",
"unicode": "e662",
"unicode_decimal": 58978
},
{
"icon_id": "24855895",
"name": "home-filled",
"font_class": "home-filled",
"unicode": "e663",
"unicode_decimal": 58979
},
{
"icon_id": "24855896",
"name": "gear",
"font_class": "gear",
"unicode": "e664",
"unicode_decimal": 58980
},
{
"icon_id": "24855897",
"name": "smallcircle-filled",
"font_class": "smallcircle-filled",
"unicode": "e665",
"unicode_decimal": 58981
},
{
"icon_id": "24855898",
"name": "map-filled",
"font_class": "map-filled",
"unicode": "e666",
"unicode_decimal": 58982
},
{
"icon_id": "24855899",
"name": "map",
"font_class": "map",
"unicode": "e667",
"unicode_decimal": 58983
},
{
"icon_id": "24855825",
"name": "refresh-filled",
"font_class": "refresh-filled",
"unicode": "e656",
"unicode_decimal": 58966
},
{
"icon_id": "24855826",
"name": "refresh",
"font_class": "refresh",
"unicode": "e657",
"unicode_decimal": 58967
},
{
"icon_id": "24855808",
"name": "cloud-upload",
"font_class": "cloud-upload",
"unicode": "e645",
"unicode_decimal": 58949
},
{
"icon_id": "24855809",
"name": "cloud-download-filled",
"font_class": "cloud-download-filled",
"unicode": "e646",
"unicode_decimal": 58950
},
{
"icon_id": "24855810",
"name": "cloud-download",
"font_class": "cloud-download",
"unicode": "e647",
"unicode_decimal": 58951
},
{
"icon_id": "24855811",
"name": "cloud-upload-filled",
"font_class": "cloud-upload-filled",
"unicode": "e648",
"unicode_decimal": 58952
},
{
"icon_id": "24855813",
"name": "redo",
"font_class": "redo",
"unicode": "e64a",
"unicode_decimal": 58954
},
{
"icon_id": "24855814",
"name": "images-filled",
"font_class": "images-filled",
"unicode": "e64b",
"unicode_decimal": 58955
},
{
"icon_id": "24855815",
"name": "undo-filled",
"font_class": "undo-filled",
"unicode": "e64c",
"unicode_decimal": 58956
},
{
"icon_id": "24855816",
"name": "more",
"font_class": "more",
"unicode": "e64d",
"unicode_decimal": 58957
},
{
"icon_id": "24855817",
"name": "more-filled",
"font_class": "more-filled",
"unicode": "e64e",
"unicode_decimal": 58958
},
{
"icon_id": "24855818",
"name": "undo",
"font_class": "undo",
"unicode": "e64f",
"unicode_decimal": 58959
},
{
"icon_id": "24855819",
"name": "images",
"font_class": "images",
"unicode": "e650",
"unicode_decimal": 58960
},
{
"icon_id": "24855821",
"name": "paperclip",
"font_class": "paperclip",
"unicode": "e652",
"unicode_decimal": 58962
},
{
"icon_id": "24855822",
"name": "settings",
"font_class": "settings",
"unicode": "e653",
"unicode_decimal": 58963
},
{
"icon_id": "24855823",
"name": "search",
"font_class": "search",
"unicode": "e654",
"unicode_decimal": 58964
},
{
"icon_id": "24855824",
"name": "redo-filled",
"font_class": "redo-filled",
"unicode": "e655",
"unicode_decimal": 58965
},
{
"icon_id": "24841702",
"name": "list",
"font_class": "list",
"unicode": "e644",
"unicode_decimal": 58948
},
{
"icon_id": "24841489",
"name": "mail-open-filled",
"font_class": "mail-open-filled",
"unicode": "e63a",
"unicode_decimal": 58938
},
{
"icon_id": "24841491",
"name": "hand-thumbsdown-filled",
"font_class": "hand-down-filled",
"unicode": "e63c",
"unicode_decimal": 58940
},
{
"icon_id": "24841492",
"name": "hand-thumbsdown",
"font_class": "hand-down",
"unicode": "e63d",
"unicode_decimal": 58941
},
{
"icon_id": "24841493",
"name": "hand-thumbsup-filled",
"font_class": "hand-up-filled",
"unicode": "e63e",
"unicode_decimal": 58942
},
{
"icon_id": "24841494",
"name": "hand-thumbsup",
"font_class": "hand-up",
"unicode": "e63f",
"unicode_decimal": 58943
},
{
"icon_id": "24841496",
"name": "heart-filled",
"font_class": "heart-filled",
"unicode": "e641",
"unicode_decimal": 58945
},
{
"icon_id": "24841498",
"name": "mail-open",
"font_class": "mail-open",
"unicode": "e643",
"unicode_decimal": 58947
},
{
"icon_id": "24841488",
"name": "heart",
"font_class": "heart",
"unicode": "e639",
"unicode_decimal": 58937
},
{
"icon_id": "24839963",
"name": "loop",
"font_class": "loop",
"unicode": "e633",
"unicode_decimal": 58931
},
{
"icon_id": "24839866",
"name": "pulldown",
"font_class": "pulldown",
"unicode": "e632",
"unicode_decimal": 58930
},
{
"icon_id": "24813798",
"name": "scan",
"font_class": "scan",
"unicode": "e62a",
"unicode_decimal": 58922
},
{
"icon_id": "24813786",
"name": "bars",
"font_class": "bars",
"unicode": "e627",
"unicode_decimal": 58919
},
{
"icon_id": "24813788",
"name": "cart-filled",
"font_class": "cart-filled",
"unicode": "e629",
"unicode_decimal": 58921
},
{
"icon_id": "24813790",
"name": "checkbox",
"font_class": "checkbox",
"unicode": "e62b",
"unicode_decimal": 58923
},
{
"icon_id": "24813791",
"name": "checkbox-filled",
"font_class": "checkbox-filled",
"unicode": "e62c",
"unicode_decimal": 58924
},
{
"icon_id": "24813794",
"name": "shop",
"font_class": "shop",
"unicode": "e62f",
"unicode_decimal": 58927
},
{
"icon_id": "24813795",
"name": "headphones",
"font_class": "headphones",
"unicode": "e630",
"unicode_decimal": 58928
},
{
"icon_id": "24813796",
"name": "cart",
"font_class": "cart",
"unicode": "e631",
"unicode_decimal": 58929
}
]
};
const _export_sfc = (sfc, props) => {
const target = sfc.__vccOpts || sfc;
for (const [key, val] of props) {
target[key] = val;
}
return target;
};
const getVal$1 = (val) => {
const reg = /^[0-9]*$/g;
return typeof val === "number" || reg.test(val) ? val + "px" : val;
};
const _sfc_main$p = {
name: "UniIcons",
emits: ["click"],
props: {
type: {
type: String,
default: ""
},
color: {
type: String,
default: "#333333"
},
size: {
type: [Number, String],
default: 16
},
customPrefix: {
type: String,
default: ""
}
},
data() {
return {
icons: icons.glyphs
};
},
computed: {
unicode() {
let code = this.icons.find((v2) => v2.font_class === this.type);
if (code) {
return unescape(`%u${code.unicode}`);
}
return "";
},
iconSize() {
return getVal$1(this.size);
}
},
methods: {
_onClick() {
this.$emit("click");
}
}
};
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"text",
{
style: vue.normalizeStyle({ color: $props.color, "font-size": $options.iconSize }),
class: vue.normalizeClass(["uni-icons", ["uniui-" + $props.type, $props.customPrefix, $props.customPrefix ? $props.type : ""]]),
onClick: _cache[0] || (_cache[0] = (...args) => $options._onClick && $options._onClick(...args))
},
null,
6
/* CLASS, STYLE */
);
}
const __easycom_0$3 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$g], ["__scopeId", "data-v-d31e1c47"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-icons/components/uni-icons/uni-icons.vue"]]);
const _sfc_main$o = {
name: "uniFormsItem",
options: {
virtualHost: true
},
provide() {
return {
uniFormItem: this
};
},
inject: {
form: {
from: "uniForm",
default: null
}
},
props: {
// 表单校验规则
rules: {
type: Array,
default() {
return null;
}
},
// 表单域的属性名,在使用校验规则时必填
name: {
type: [String, Array],
default: ""
},
required: {
type: Boolean,
default: false
},
label: {
type: String,
default: ""
},
// label的宽度 ,默认 80
labelWidth: {
type: [String, Number],
default: ""
},
// label 居中方式,默认 left 取值 left/center/right
labelAlign: {
type: String,
default: ""
},
// 强制显示错误信息
errorMessage: {
type: [String, Boolean],
default: ""
},
// 1.4.0 弃用,统一使用 form 的校验时机
// validateTrigger: {
// type: String,
// default: ''
// },
// 1.4.0 弃用,统一使用 form 的label 位置
// labelPosition: {
// type: String,
// default: ''
// },
// 1.4.0 以下属性已经废弃,请使用 #label 插槽代替
leftIcon: String,
iconColor: {
type: String,
default: "#606266"
}
},
data() {
return {
errMsg: "",
userRules: null,
localLabelAlign: "left",
localLabelWidth: "65px",
localLabelPos: "left",
border: false,
isFirstBorder: false
};
},
computed: {
// 处理错误信息
msg() {
return this.errorMessage || this.errMsg;
}
},
watch: {
// 规则发生变化通知子组件更新
"form.formRules"(val) {
this.init();
},
"form.labelWidth"(val) {
this.localLabelWidth = this._labelWidthUnit(val);
},
"form.labelPosition"(val) {
this.localLabelPos = this._labelPosition();
},
"form.labelAlign"(val) {
}
},
created() {
this.init(true);
if (this.name && this.form) {
this.$watch(
() => {
const val = this.form._getDataValue(this.name, this.form.localData);
return val;
},
(value, oldVal) => {
const isEqual2 = this.form._isEqual(value, oldVal);
if (!isEqual2) {
const val = this.itemSetValue(value);
this.onFieldChange(val, false);
}
},
{
immediate: false
}
);
}
},
unmounted() {
this.__isUnmounted = true;
this.unInit();
},
methods: {
/**
* 外部调用方法
* 设置规则 ,主要用于小程序自定义检验规则
* @param {Array} rules 规则源数据
*/
setRules(rules = null) {
this.userRules = rules;
this.init(false);
},
// 兼容老版本表单组件
setValue() {
},
/**
* 外部调用方法
* 校验数据
* @param {any} value 需要校验的数据
* @param {boolean} 是否立即校验
* @return {Array|null} 校验内容
*/
async onFieldChange(value, formtrigger = true) {
const {
formData,
localData,
errShowType,
validateCheck,
validateTrigger,
_isRequiredField,
_realName
} = this.form;
const name = _realName(this.name);
if (!value) {
value = this.form.formData[name];
}
const ruleLen = this.itemRules.rules && this.itemRules.rules.length;
if (!this.validator || !ruleLen || ruleLen === 0)
return;
const isRequiredField2 = _isRequiredField(this.itemRules.rules || []);
let result = null;
if (validateTrigger === "bind" || formtrigger) {
result = await this.validator.validateUpdate(
{
[name]: value
},
formData
);
if (!isRequiredField2 && (value === void 0 || value === "")) {
result = null;
}
if (result && result.errorMessage) {
if (errShowType === "undertext") {
this.errMsg = !result ? "" : result.errorMessage;
}
if (errShowType === "toast") {
uni.showToast({
title: result.errorMessage || "校验错误",
icon: "none"
});
}
if (errShowType === "modal") {
uni.showModal({
title: "提示",
content: result.errorMessage || "校验错误"
});
}
} else {
this.errMsg = "";
}
validateCheck(result ? result : null);
} else {
this.errMsg = "";
}
return result ? result : null;
},
/**
* 初始组件数据
*/
init(type = false) {
const {
validator,
formRules,
childrens,
formData,
localData,
_realName,
labelWidth,
_getDataValue,
_setDataValue
} = this.form || {};
this.localLabelAlign = this._justifyContent();
this.localLabelWidth = this._labelWidthUnit(labelWidth);
this.localLabelPos = this._labelPosition();
this.form && type && childrens.push(this);
if (!validator || !formRules)
return;
if (!this.form.isFirstBorder) {
this.form.isFirstBorder = true;
this.isFirstBorder = true;
}
if (this.group) {
if (!this.group.isFirstBorder) {
this.group.isFirstBorder = true;
this.isFirstBorder = true;
}
}
this.border = this.form.border;
const name = _realName(this.name);
const itemRule = this.userRules || this.rules;
if (typeof formRules === "object" && itemRule) {
formRules[name] = {
rules: itemRule
};
validator.updateSchema(formRules);
}
const itemRules = formRules[name] || {};
this.itemRules = itemRules;
this.validator = validator;
this.itemSetValue(_getDataValue(this.name, localData));
},
unInit() {
if (this.form) {
const {
childrens,
formData,
_realName
} = this.form;
childrens.forEach((item, index) => {
if (item === this) {
this.form.childrens.splice(index, 1);
delete formData[_realName(item.name)];
}
});
}
},
// 设置item 的值
itemSetValue(value) {
const name = this.form._realName(this.name);
const rules = this.itemRules.rules || [];
const val = this.form._getValue(name, value, rules);
this.form._setDataValue(name, this.form.formData, val);
return val;
},
/**
* 移除该表单项的校验结果
*/
clearValidate() {
this.errMsg = "";
},
// 是否显示星号
_isRequired() {
return this.required;
},
// 处理对齐方式
_justifyContent() {
if (this.form) {
const {
labelAlign
} = this.form;
let labelAli = this.labelAlign ? this.labelAlign : labelAlign;
if (labelAli === "left")
return "flex-start";
if (labelAli === "center")
return "center";
if (labelAli === "right")
return "flex-end";
}
return "flex-start";
},
// 处理 label宽度单位 ,继承父元素的值
_labelWidthUnit(labelWidth) {
return this.num2px(this.labelWidth ? this.labelWidth : labelWidth || (this.label ? 65 : "auto"));
},
// 处理 label 位置
_labelPosition() {
if (this.form)
return this.form.labelPosition || "left";
return "left";
},
/**
* 触发时机
* @param {Object} rule 当前规则内时机
* @param {Object} itemRlue 当前组件时机
* @param {Object} parentRule 父组件时机
*/
isTrigger(rule, itemRlue, parentRule) {
if (rule === "submit" || !rule) {
if (rule === void 0) {
if (itemRlue !== "bind") {
if (!itemRlue) {
return parentRule === "" ? "bind" : "submit";
}
return "submit";
}
return "bind";
}
return "submit";
}
return "bind";
},
num2px(num) {
if (typeof num === "number") {
return `${num}px`;
}
return num;
}
}
};
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["uni-forms-item", ["is-direction-" + $data.localLabelPos, $data.border ? "uni-forms-item--border" : "", $data.border && $data.isFirstBorder ? "is-first-border" : ""]])
},
[
vue.renderSlot(_ctx.$slots, "label", {}, () => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-forms-item__label", { "no-label": !$props.label && !$props.required }]),
style: vue.normalizeStyle({ width: $data.localLabelWidth, justifyContent: $data.localLabelAlign })
},
[
$props.required ? (vue.openBlock(), vue.createElementBlock("text", {
key: 0,
class: "is-required"
}, "*")) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"text",
null,
vue.toDisplayString($props.label),
1
/* TEXT */
)
],
6
/* CLASS, STYLE */
)
], true),
vue.createElementVNode("view", { class: "uni-forms-item__content" }, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-forms-item__error", { "msg--active": $options.msg }])
},
[
vue.createElementVNode(
"text",
null,
vue.toDisplayString($options.msg),
1
/* TEXT */
)
],
2
/* CLASS */
)
])
],
2
/* CLASS */
);
}
const __easycom_1$2 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$f], ["__scopeId", "data-v-462874dd"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue"]]);
var pattern = {
email: /^\S+?@\S+?\.\S+?$/,
idcard: /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,
url: new RegExp(
"^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$",
"i"
)
};
const FORMAT_MAPPING = {
"int": "integer",
"bool": "boolean",
"double": "number",
"long": "number",
"password": "string"
// "fileurls": 'array'
};
function formatMessage(args, resources = "") {
var defaultMessage = ["label"];
defaultMessage.forEach((item) => {
if (args[item] === void 0) {
args[item] = "";
}
});
let str = resources;
for (let key in args) {
let reg = new RegExp("{" + key + "}");
str = str.replace(reg, args[key]);
}
return str;
}
function isEmptyValue(value, type) {
if (value === void 0 || value === null) {
return true;
}
if (typeof value === "string" && !value) {
return true;
}
if (Array.isArray(value) && !value.length) {
return true;
}
if (type === "object" && !Object.keys(value).length) {
return true;
}
return false;
}
const types = {
integer(value) {
return types.number(value) && parseInt(value, 10) === value;
},
string(value) {
return typeof value === "string";
},
number(value) {
if (isNaN(value)) {
return false;
}
return typeof value === "number";
},
"boolean": function(value) {
return typeof value === "boolean";
},
"float": function(value) {
return types.number(value) && !types.integer(value);
},
array(value) {
return Array.isArray(value);
},
object(value) {
return typeof value === "object" && !types.array(value);
},
date(value) {
return value instanceof Date;
},
timestamp(value) {
if (!this.integer(value) || Math.abs(value).toString().length > 16) {
return false;
}
return true;
},
file(value) {
return typeof value.url === "string";
},
email(value) {
return typeof value === "string" && !!value.match(pattern.email) && value.length < 255;
},
url(value) {
return typeof value === "string" && !!value.match(pattern.url);
},
pattern(reg, value) {
try {
return new RegExp(reg).test(value);
} catch (e2) {
return false;
}
},
method(value) {
return typeof value === "function";
},
idcard(value) {
return typeof value === "string" && !!value.match(pattern.idcard);
},
"url-https"(value) {
return this.url(value) && value.startsWith("https://");
},
"url-scheme"(value) {
return value.startsWith("://");
},
"url-web"(value) {
return false;
}
};
class RuleValidator {
constructor(message) {
this._message = message;
}
async validateRule(fieldKey, fieldValue, value, data, allData) {
var result = null;
let rules = fieldValue.rules;
let hasRequired = rules.findIndex((item) => {
return item.required;
});
if (hasRequired < 0) {
if (value === null || value === void 0) {
return result;
}
if (typeof value === "string" && !value.length) {
return result;
}
}
var message = this._message;
if (rules === void 0) {
return message["default"];
}
for (var i2 = 0; i2 < rules.length; i2++) {
let rule = rules[i2];
let vt2 = this._getValidateType(rule);
Object.assign(rule, {
label: fieldValue.label || `["${fieldKey}"]`
});
if (RuleValidatorHelper[vt2]) {
result = RuleValidatorHelper[vt2](rule, value, message);
if (result != null) {
break;
}
}
if (rule.validateExpr) {
let now = Date.now();
let resultExpr = rule.validateExpr(value, allData, now);
if (resultExpr === false) {
result = this._getMessage(rule, rule.errorMessage || this._message["default"]);
break;
}
}
if (rule.validateFunction) {
result = await this.validateFunction(rule, value, data, allData, vt2);
if (result !== null) {
break;
}
}
}
if (result !== null) {
result = message.TAG + result;
}
return result;
}
async validateFunction(rule, value, data, allData, vt2) {
let result = null;
try {
let callbackMessage = null;
const res = await rule.validateFunction(rule, value, allData || data, (message) => {
callbackMessage = message;
});
if (callbackMessage || typeof res === "string" && res || res === false) {
result = this._getMessage(rule, callbackMessage || res, vt2);
}
} catch (e2) {
result = this._getMessage(rule, e2.message, vt2);
}
return result;
}
_getMessage(rule, message, vt2) {
return formatMessage(rule, message || rule.errorMessage || this._message[vt2] || message["default"]);
}
_getValidateType(rule) {
var result = "";
if (rule.required) {
result = "required";
} else if (rule.format) {
result = "format";
} else if (rule.arrayType) {
result = "arrayTypeFormat";
} else if (rule.range) {
result = "range";
} else if (rule.maximum !== void 0 || rule.minimum !== void 0) {
result = "rangeNumber";
} else if (rule.maxLength !== void 0 || rule.minLength !== void 0) {
result = "rangeLength";
} else if (rule.pattern) {
result = "pattern";
} else if (rule.validateFunction) {
result = "validateFunction";
}
return result;
}
}
const RuleValidatorHelper = {
required(rule, value, message) {
if (rule.required && isEmptyValue(value, rule.format || typeof value)) {
return formatMessage(rule, rule.errorMessage || message.required);
}
return null;
},
range(rule, value, message) {
const {
range,
errorMessage
} = rule;
let list = new Array(range.length);
for (let i2 = 0; i2 < range.length; i2++) {
const item = range[i2];
if (types.object(item) && item.value !== void 0) {
list[i2] = item.value;
} else {
list[i2] = item;
}
}
let result = false;
if (Array.isArray(value)) {
result = new Set(value.concat(list)).size === list.length;
} else {
if (list.indexOf(value) > -1) {
result = true;
}
}
if (!result) {
return formatMessage(rule, errorMessage || message["enum"]);
}
return null;
},
rangeNumber(rule, value, message) {
if (!types.number(value)) {
return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
}
let {
minimum,
maximum,
exclusiveMinimum,
exclusiveMaximum
} = rule;
let min = exclusiveMinimum ? value <= minimum : value < minimum;
let max = exclusiveMaximum ? value >= maximum : value > maximum;
if (minimum !== void 0 && min) {
return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMinimum ? "exclusiveMinimum" : "minimum"]);
} else if (maximum !== void 0 && max) {
return formatMessage(rule, rule.errorMessage || message["number"][exclusiveMaximum ? "exclusiveMaximum" : "maximum"]);
} else if (minimum !== void 0 && maximum !== void 0 && (min || max)) {
return formatMessage(rule, rule.errorMessage || message["number"].range);
}
return null;
},
rangeLength(rule, value, message) {
if (!types.string(value) && !types.array(value)) {
return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
}
let min = rule.minLength;
let max = rule.maxLength;
let val = value.length;
if (min !== void 0 && val < min) {
return formatMessage(rule, rule.errorMessage || message["length"].minLength);
} else if (max !== void 0 && val > max) {
return formatMessage(rule, rule.errorMessage || message["length"].maxLength);
} else if (min !== void 0 && max !== void 0 && (val < min || val > max)) {
return formatMessage(rule, rule.errorMessage || message["length"].range);
}
return null;
},
pattern(rule, value, message) {
if (!types["pattern"](rule.pattern, value)) {
return formatMessage(rule, rule.errorMessage || message.pattern.mismatch);
}
return null;
},
format(rule, value, message) {
var customTypes = Object.keys(types);
var format = FORMAT_MAPPING[rule.format] ? FORMAT_MAPPING[rule.format] : rule.format || rule.arrayType;
if (customTypes.indexOf(format) > -1) {
if (!types[format](value)) {
return formatMessage(rule, rule.errorMessage || message.typeError);
}
}
return null;
},
arrayTypeFormat(rule, value, message) {
if (!Array.isArray(value)) {
return formatMessage(rule, rule.errorMessage || message.typeError);
}
for (let i2 = 0; i2 < value.length; i2++) {
const element = value[i2];
let formatResult = this.format(rule, element, message);
if (formatResult !== null) {
return formatResult;
}
}
return null;
}
};
class SchemaValidator extends RuleValidator {
constructor(schema, options) {
super(SchemaValidator.message);
this._schema = schema;
this._options = options || null;
}
updateSchema(schema) {
this._schema = schema;
}
async validate(data, allData) {
let result = this._checkFieldInSchema(data);
if (!result) {
result = await this.invokeValidate(data, false, allData);
}
return result.length ? result[0] : null;
}
async validateAll(data, allData) {
let result = this._checkFieldInSchema(data);
if (!result) {
result = await this.invokeValidate(data, true, allData);
}
return result;
}
async validateUpdate(data, allData) {
let result = this._checkFieldInSchema(data);
if (!result) {
result = await this.invokeValidateUpdate(data, false, allData);
}
return result.length ? result[0] : null;
}
async invokeValidate(data, all, allData) {
let result = [];
let schema = this._schema;
for (let key in schema) {
let value = schema[key];
let errorMessage = await this.validateRule(key, value, data[key], data, allData);
if (errorMessage != null) {
result.push({
key,
errorMessage
});
if (!all)
break;
}
}
return result;
}
async invokeValidateUpdate(data, all, allData) {
let result = [];
for (let key in data) {
let errorMessage = await this.validateRule(key, this._schema[key], data[key], data, allData);
if (errorMessage != null) {
result.push({
key,
errorMessage
});
if (!all)
break;
}
}
return result;
}
_checkFieldInSchema(data) {
var keys = Object.keys(data);
var keys2 = Object.keys(this._schema);
if (new Set(keys.concat(keys2)).size === keys2.length) {
return "";
}
var noExistFields = keys.filter((key) => {
return keys2.indexOf(key) < 0;
});
var errorMessage = formatMessage({
field: JSON.stringify(noExistFields)
}, SchemaValidator.message.TAG + SchemaValidator.message["defaultInvalid"]);
return [{
key: "invalid",
errorMessage
}];
}
}
function Message() {
return {
TAG: "",
default: "验证错误",
defaultInvalid: "提交的字段{field}在数据库中并不存在",
validateFunction: "验证无效",
required: "{label}必填",
"enum": "{label}超出范围",
timestamp: "{label}格式无效",
whitespace: "{label}不能为空",
typeError: "{label}类型无效",
date: {
format: "{label}日期{value}格式无效",
parse: "{label}日期无法解析,{value}无效",
invalid: "{label}日期{value}无效"
},
length: {
minLength: "{label}长度不能少于{minLength}",
maxLength: "{label}长度不能超过{maxLength}",
range: "{label}必须介于{minLength}和{maxLength}之间"
},
number: {
minimum: "{label}不能小于{minimum}",
maximum: "{label}不能大于{maximum}",
exclusiveMinimum: "{label}不能小于等于{minimum}",
exclusiveMaximum: "{label}不能大于等于{maximum}",
range: "{label}必须介于{minimum}and{maximum}之间"
},
pattern: {
mismatch: "{label}格式不匹配"
}
};
}
SchemaValidator.message = new Message();
const deepCopy = (val) => {
return JSON.parse(JSON.stringify(val));
};
const typeFilter = (format) => {
return format === "int" || format === "double" || format === "number" || format === "timestamp";
};
const getValue = (key, value, rules) => {
const isRuleNumType = rules.find((val) => val.format && typeFilter(val.format));
const isRuleBoolType = rules.find((val) => val.format && val.format === "boolean" || val.format === "bool");
if (!!isRuleNumType) {
if (!value && value !== 0) {
value = null;
} else {
value = isNumber(Number(value)) ? Number(value) : value;
}
}
if (!!isRuleBoolType) {
value = isBoolean(value) ? value : false;
}
return value;
};
const setDataValue = (field, formdata, value) => {
formdata[field] = value;
return value || "";
};
const getDataValue = (field, data) => {
return objGet(data, field);
};
const realName = (name, data = {}) => {
const base_name = _basePath(name);
if (typeof base_name === "object" && Array.isArray(base_name) && base_name.length > 1) {
const realname = base_name.reduce((a2, b2) => a2 += `#${b2}`, "_formdata_");
return realname;
}
return base_name[0] || name;
};
const isRealName = (name) => {
const reg = /^_formdata_#*/;
return reg.test(name);
};
const rawData = (object = {}, name) => {
let newData = JSON.parse(JSON.stringify(object));
let formData = {};
for (let i2 in newData) {
let path = name2arr(i2);
objSet(formData, path, newData[i2]);
}
return formData;
};
const name2arr = (name) => {
let field = name.replace("_formdata_#", "");
field = field.split("#").map((v2) => isNumber(v2) ? Number(v2) : v2);
return field;
};
const objSet = (object, path, value) => {
if (typeof object !== "object")
return object;
_basePath(path).reduce((o2, k2, i2, _2) => {
if (i2 === _2.length - 1) {
o2[k2] = value;
return null;
} else if (k2 in o2) {
return o2[k2];
} else {
o2[k2] = /^[0-9]{1,}$/.test(_2[i2 + 1]) ? [] : {};
return o2[k2];
}
}, object);
return object;
};
function _basePath(path) {
if (Array.isArray(path))
return path;
return path.replace(/\[/g, ".").replace(/\]/g, "").split(".");
}
const objGet = (object, path, defaultVal = "undefined") => {
let newPath = _basePath(path);
let val = newPath.reduce((o2, k2) => {
return (o2 || {})[k2];
}, object);
return !val || val !== void 0 ? val : defaultVal;
};
const isNumber = (num) => {
return !isNaN(Number(num));
};
const isBoolean = (bool) => {
return typeof bool === "boolean";
};
const isRequiredField = (rules) => {
let isNoField = false;
for (let i2 = 0; i2 < rules.length; i2++) {
const ruleData = rules[i2];
if (ruleData.required) {
isNoField = true;
break;
}
}
return isNoField;
};
const isEqual = (a2, b2) => {
if (a2 === b2) {
return a2 !== 0 || 1 / a2 === 1 / b2;
}
if (a2 == null || b2 == null) {
return a2 === b2;
}
var classNameA = toString.call(a2), classNameB = toString.call(b2);
if (classNameA !== classNameB) {
return false;
}
switch (classNameA) {
case "[object RegExp]":
case "[object String]":
return "" + a2 === "" + b2;
case "[object Number]":
if (+a2 !== +a2) {
return +b2 !== +b2;
}
return +a2 === 0 ? 1 / +a2 === 1 / b2 : +a2 === +b2;
case "[object Date]":
case "[object Boolean]":
return +a2 === +b2;
}
if (classNameA == "[object Object]") {
var propsA = Object.getOwnPropertyNames(a2), propsB = Object.getOwnPropertyNames(b2);
if (propsA.length != propsB.length) {
return false;
}
for (var i2 = 0; i2 < propsA.length; i2++) {
var propName = propsA[i2];
if (a2[propName] !== b2[propName]) {
return false;
}
}
return true;
}
if (classNameA == "[object Array]") {
if (a2.toString() == b2.toString()) {
return true;
}
return false;
}
};
const _sfc_main$n = {
name: "uniForms",
emits: ["validate", "submit"],
options: {
virtualHost: true
},
props: {
// 即将弃用
value: {
type: Object,
default() {
return null;
}
},
// vue3 替换 value 属性
modelValue: {
type: Object,
default() {
return null;
}
},
// 1.4.0 开始将不支持 v-model ,且废弃 value 和 modelValue
model: {
type: Object,
default() {
return null;
}
},
// 表单校验规则
rules: {
type: Object,
default() {
return {};
}
},
//校验错误信息提示方式 默认 undertext 取值 [undertext|toast|modal]
errShowType: {
type: String,
default: "undertext"
},
// 校验触发器方式 默认 bind 取值 [bind|submit]
validateTrigger: {
type: String,
default: "submit"
},
// label 位置,默认 left 取值 top/left
labelPosition: {
type: String,
default: "left"
},
// label 宽度
labelWidth: {
type: [String, Number],
default: ""
},
// label 居中方式,默认 left 取值 left/center/right
labelAlign: {
type: String,
default: "left"
},
border: {
type: Boolean,
default: false
}
},
provide() {
return {
uniForm: this
};
},
data() {
return {
// 表单本地值的记录,不应该与传如的值进行关联
formData: {},
formRules: {}
};
},
computed: {
// 计算数据源变化的
localData() {
const localVal = this.model || this.modelValue || this.value;
if (localVal) {
return deepCopy(localVal);
}
return {};
}
},
watch: {
// 监听数据变化 ,暂时不使用,需要单独赋值
// localData: {},
// 监听规则变化
rules: {
handler: function(val, oldVal) {
this.setRules(val);
},
deep: true,
immediate: true
}
},
created() {
let getbinddata = getApp().$vm.$.appContext.config.globalProperties.binddata;
if (!getbinddata) {
getApp().$vm.$.appContext.config.globalProperties.binddata = function(name, value, formName) {
if (formName) {
this.$refs[formName].setValue(name, value);
} else {
let formVm;
for (let i2 in this.$refs) {
const vm = this.$refs[i2];
if (vm && vm.$options && vm.$options.name === "uniForms") {
formVm = vm;
break;
}
}
if (!formVm)
return formatAppLog("error", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:182", "当前 uni-froms 组件缺少 ref 属性");
formVm.setValue(name, value);
}
};
}
this.childrens = [];
this.inputChildrens = [];
this.setRules(this.rules);
},
methods: {
/**
* 外部调用方法
* 设置规则 ,主要用于小程序自定义检验规则
* @param {Array} rules 规则源数据
*/
setRules(rules) {
this.formRules = Object.assign({}, this.formRules, rules);
this.validator = new SchemaValidator(rules);
},
/**
* 外部调用方法
* 设置数据,用于设置表单数据,公开给用户使用 , 不支持在动态表单中使用
* @param {Object} key
* @param {Object} value
*/
setValue(key, value) {
let example = this.childrens.find((child) => child.name === key);
if (!example)
return null;
this.formData[key] = getValue(key, value, this.formRules[key] && this.formRules[key].rules || []);
return example.onFieldChange(this.formData[key]);
},
/**
* 外部调用方法
* 手动提交校验表单
* 对整个表单进行校验的方法,参数为一个回调函数。
* @param {Array} keepitem 保留不参与校验的字段
* @param {type} callback 方法回调
*/
validate(keepitem, callback) {
return this.checkAll(this.formData, keepitem, callback);
},
/**
* 外部调用方法
* 部分表单校验
* @param {Array|String} props 需要校验的字段
* @param {Function} 回调函数
*/
validateField(props = [], callback) {
props = [].concat(props);
let invalidFields = {};
this.childrens.forEach((item) => {
const name = realName(item.name);
if (props.indexOf(name) !== -1) {
invalidFields = Object.assign({}, invalidFields, {
[name]: this.formData[name]
});
}
});
return this.checkAll(invalidFields, [], callback);
},
/**
* 外部调用方法
* 移除表单项的校验结果。传入待移除的表单项的 prop 属性或者 prop 组成的数组,如不传则移除整个表单的校验结果
* @param {Array|String} props 需要移除校验的字段 ,不填为所有
*/
clearValidate(props = []) {
props = [].concat(props);
this.childrens.forEach((item) => {
if (props.length === 0) {
item.errMsg = "";
} else {
const name = realName(item.name);
if (props.indexOf(name) !== -1) {
item.errMsg = "";
}
}
});
},
/**
* 外部调用方法 ,即将废弃
* 手动提交校验表单
* 对整个表单进行校验的方法,参数为一个回调函数。
* @param {Array} keepitem 保留不参与校验的字段
* @param {type} callback 方法回调
*/
submit(keepitem, callback, type) {
for (let i2 in this.dataValue) {
const itemData = this.childrens.find((v2) => v2.name === i2);
if (itemData) {
if (this.formData[i2] === void 0) {
this.formData[i2] = this._getValue(i2, this.dataValue[i2]);
}
}
}
if (!type) {
formatAppLog("warn", "at uni_modules/uni-forms/components/uni-forms/uni-forms.vue:289", "submit 方法即将废弃,请使用validate方法代替!");
}
return this.checkAll(this.formData, keepitem, callback, "submit");
},
// 校验所有
async checkAll(invalidFields, keepitem, callback, type) {
if (!this.validator)
return;
let childrens = [];
for (let i2 in invalidFields) {
const item = this.childrens.find((v2) => realName(v2.name) === i2);
if (item) {
childrens.push(item);
}
}
if (!callback && typeof keepitem === "function") {
callback = keepitem;
}
let promise;
if (!callback && typeof callback !== "function" && Promise) {
promise = new Promise((resolve, reject) => {
callback = function(valid, invalidFields2) {
!valid ? resolve(invalidFields2) : reject(valid);
};
});
}
let results = [];
let tempFormData = JSON.parse(JSON.stringify(invalidFields));
for (let i2 in childrens) {
const child = childrens[i2];
let name = realName(child.name);
const result = await child.onFieldChange(tempFormData[name]);
if (result) {
results.push(result);
if (this.errShowType === "toast" || this.errShowType === "modal")
break;
}
}
if (Array.isArray(results)) {
if (results.length === 0)
results = null;
}
if (Array.isArray(keepitem)) {
keepitem.forEach((v2) => {
let vName = realName(v2);
let value = getDataValue(v2, this.localData);
if (value !== void 0) {
tempFormData[vName] = value;
}
});
}
if (type === "submit") {
this.$emit("submit", {
detail: {
value: tempFormData,
errors: results
}
});
} else {
this.$emit("validate", results);
}
let resetFormData = {};
resetFormData = rawData(tempFormData, this.name);
callback && typeof callback === "function" && callback(results, resetFormData);
if (promise && callback) {
return promise;
} else {
return null;
}
},
/**
* 返回validate事件
* @param {Object} result
*/
validateCheck(result) {
this.$emit("validate", result);
},
_getValue: getValue,
_isRequiredField: isRequiredField,
_setDataValue: setDataValue,
_getDataValue: getDataValue,
_realName: realName,
_isRealName: isRealName,
_isEqual: isEqual
}
};
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-forms" }, [
vue.createElementVNode("form", null, [
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
])
]);
}
const __easycom_2$1 = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$e], ["__scopeId", "data-v-9a1e3c32"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-forms/components/uni-forms/uni-forms.vue"]]);
var hostUrl = "http://zhongyao.fscuc.cn";
var hostUrl2 = "http://zy-web.fscuc.cn";
const service = (params2 = {}) => {
return new Promise((resolve, reject) => {
formatAppLog("log", "at static/js/request.js:12", "params.data.data", params2.data.data);
let query = "";
let tokens = "";
if (params2.data.data) {
params2.data.data;
}
if (params2.data.token) {
tokens = params2.data.token;
}
if (params2.data.query)
;
else {
query = params2.url;
}
formatAppLog("log", "at static/js/request.js:29", "params.data.token", tokens);
uni.request({
url: hostUrl + query,
// 接收请求的API
header: {
"Authorization": "Bearer " + tokens
// 'Accept': 'application/json, text/plain, */*',
// 'Content-Type': 'application/json',
// 'Access-Control-Allow-Origin': '*',
},
method: params2.method || "POST",
// 接收请求的方式,如果不传默认为POST
data: params2.data.data,
//JSON.stringify(params.data.data), // 接收请求的data,不传默认为空
success: (res) => {
if (res.statusCode !== 200 && res.statusCode !== 201) {
return uni.$showMsg("请求失败!请联系平台客服", 2e3);
} else {
resolve(res);
}
},
fail: (err) => {
return uni.$showMsg("请求接口失败!", 2e3);
}
});
});
};
const login = (params2 = {}) => {
return new Promise((resolve, reject) => {
formatAppLog("log", "at static/js/request.js:64", "request login ", hostUrl);
uni.request({
url: hostUrl + "/login/v2",
method: params2.method || "POST",
data: JSON.stringify(params2),
success: (res) => {
if (res.statusCode !== 200 && res.statusCode !== 201) {
return uni.$showMsg("请求失败!请联系平台客服", 2e3);
} else {
resolve(res);
}
},
fail: (err) => {
return uni.$showMsg("请求接口失败!", 2e3);
}
});
});
};
const sendToUser = (params2 = {}) => {
return new Promise((resolve, reject) => {
uni.request({
url: hostUrl2 + "/userPrescription/sendToUser",
method: "POST",
data: params2.data,
headers: { Authorization: "Bearer " + params2.token },
success: (res) => {
if (res.statusCode !== 200 && res.statusCode !== 201) {
return uni.$showMsg("请求失败!请联系平台客服", 2e3);
} else {
resolve(res);
}
},
fail: (err) => {
return uni.$showMsg("请求接口失败!", 2e3);
}
});
});
};
const selectOrderDetail = (params2 = {}) => {
return new Promise((resolve, reject) => {
uni.request({
// url: 'http://zhongyao.fscuc.cn' + '/login/v2',
url: hostUrl + `/prescription/prescriptionCore/selectOrderDetail?id=${params2.data.id}&preNo=${params2.data.preNo}&depolyStatus=${params2.data.depolyStatus}`,
method: params2.method || "POST",
data: JSON.stringify(params2),
header: {
"Authorization": "Bearer " + params2.data.token
},
success: (res) => {
if (res.statusCode !== 200 && res.statusCode !== 201) {
return uni.$showMsg("请求失败!请联系平台客服", 2e3);
} else {
resolve(res);
}
},
fail: (err) => {
return uni.$showMsg("请求接口失败!", 2e3);
}
});
});
};
const releaseOrder = (params2 = {}) => {
return new Promise((resolve, reject) => {
uni.request({
// url: 'http://zhongyao.fscuc.cn' + '/login/v2',
url: hostUrl + `/pharmacistStatus/releaseOrder?ids=${params2.data.ids}`,
method: params2.method || "POST",
data: JSON.stringify(params2),
header: {
"Authorization": "Bearer " + params2.data.token
},
success: (res) => {
if (res.statusCode !== 200 && res.statusCode !== 201) {
return uni.$showMsg("请求失败!请联系平台客服", 2e3);
} else {
resolve(res);
}
},
fail: (err) => {
return uni.$showMsg("请求接口失败!", 2e3);
}
});
});
};
const receiveOrderList = (data) => {
return service({
url: "/prescription/prescriptionCore/receiveOrderList",
method: "POST",
data
});
};
const updateWorkStatus = (data) => {
return service({
url: "/pharmacistStatus/updateWorkStatus",
method: "POST",
data
});
};
const updateOnlineStatus = (data) => {
return service({
url: "/pharmacistOnlineStatus/updateOnlineStatus",
method: "POST",
data
});
};
const saveDepoly = (data) => {
return service({
url: "/file/saveCoreFile",
method: "POST",
data
});
};
const saveReview = (data) => {
return service({
url: "/prescription/prescriptionCore/reviewPrescription",
method: "POST",
data
});
};
const __default__$5 = {
name: ""
};
const _sfc_main$m = /* @__PURE__ */ Object.assign(__default__$5, {
setup(__props) {
const showPassword = vue.ref(false);
const formData = vue.ref({
username: "",
password: "",
remember: false
});
onLoad(() => {
const sRemember = false;
if (uni.getStorageSync("remember")) {
JSON.parse(uni.getStorageSync("remember"));
}
formatAppLog("log", "at pages/login/login.vue:59", "onLoad sRemember", sRemember);
});
const submit = async () => {
formatAppLog("log", "at pages/login/login.vue:68", "formData", formData.value);
if (formData.value.name && formData.value.password && formData.value.remember === true) {
uni.setStorageSync("username", formData.value.name);
uni.setStorageSync("password", formData.value.password);
uni.setStorageSync("remember", formData.value.remember);
uni.setStorageSync("workStatus", formData.value.remember);
}
const params2 = {
username: formData.value.username,
password: formData.value.password,
code: "2"
};
let { data: res } = await login(params2);
formatAppLog("log", "at pages/login/login.vue:82", "res", res.code);
if (res.code === 200 && res.token && res.userId) {
uni.setStorageSync("token", res.token);
uni.setStorageSync("userId", res.userId);
formatAppLog("log", "at pages/login/login.vue:88", "11");
formatAppLog("log", "at pages/login/login.vue:89", "res.token", res.token);
const param = {
token: res.token,
data: JSON.stringify({ pharmacistUserId: res.userId, onlineStatus: 0 })
};
formatAppLog("log", "at pages/login/login.vue:95", "res.param", param);
await updateOnlineStatus(param);
uni.redirectTo({
url: "/pages/index/index"
});
} else {
formatAppLog("log", "at pages/login/login.vue:102", "登录失败");
uni.$showMsg("登录失败", 1500);
}
};
const handleChange = () => {
formData.value.remember = !formData.value.remember;
formatAppLog("log", "at pages/login/login.vue:112", "formData.value.username", formData.value.username);
formatAppLog("log", "at pages/login/login.vue:113", "formData.value.password", formData.value.password);
formatAppLog("log", "at pages/login/login.vue:114", "formData.value.remember", formData.value.remember);
if (formData.value.remember === true) {
uni.setStorageSync("username", formData.value.username);
uni.setStorageSync("password", formData.value.password);
uni.setStorageSync("remember", true);
} else {
uni.removeStorageSync("username");
uni.removeStorageSync("password");
uni.removeStorageSync("remember");
}
};
const changePassword = () => {
showPassword.value = !showPassword.value;
};
vue.onMounted(() => {
const username = uni.getStorageSync("username");
const password = uni.getStorageSync("password");
const remember = uni.getStorageSync("remember");
if (typeof username === typeof password === "string" && remember) {
formData.value.username = username;
formData.value.password = password;
formData.value.remember = remember;
}
});
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
const _component_uni_forms_item = resolveEasycom(vue.resolveDynamicComponent("uni-forms-item"), __easycom_1$2);
const _component_uni_forms = resolveEasycom(vue.resolveDynamicComponent("uni-forms"), __easycom_2$1);
return vue.openBlock(), vue.createElementBlock("view", { class: "main" }, [
vue.createElementVNode("view", { class: "login" }, [
vue.createElementVNode("view", { class: "logo" }, [
vue.createElementVNode("image", {
class: "faceu",
aspectFill: "",
src: "/static/login@2x.png"
})
]),
vue.createElementVNode("view", { class: "title" }, [
vue.createElementVNode("text", { class: "text" }, "中药处方煎配溯源管理")
]),
vue.createVNode(_component_uni_forms, { model: formData.value }, {
default: vue.withCtx(() => [
vue.createVNode(_component_uni_forms_item, { name: "name" }, {
default: vue.withCtx(() => [
vue.createVNode(_component_uni_icons, {
class: "item",
type: "person-filled",
color: "#999999",
size: "30"
}),
vue.createElementVNode("view", { class: "input" }, [
vue.withDirectives(vue.createElementVNode(
"input",
{
type: "text",
class: "item",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => formData.value.username = $event),
placeholder: "请输入账号"
},
null,
512
/* NEED_PATCH */
), [
[vue.vModelText, formData.value.username]
])
])
]),
_: 1
/* STABLE */
}),
vue.createVNode(_component_uni_forms_item, { name: "password" }, {
default: vue.withCtx(() => [
vue.createVNode(_component_uni_icons, {
type: "locked",
class: "item",
color: "#999999",
size: "30"
}),
vue.createElementVNode("view", { class: "input" }, [
vue.withDirectives(vue.createElementVNode("input", {
class: "item",
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => formData.value.password = $event),
password: showPassword.value,
placeholder: "请输入密码"
}, null, 8, ["password"]), [
[vue.vModelText, formData.value.password]
]),
vue.createVNode(_component_uni_icons, {
"custom-prefix": "iconfont",
class: "item",
type: showPassword.value ? "icon-biyanjing" : "icon-yanjing",
color: "#999999",
size: "30",
onClick: changePassword
}, null, 8, ["type"])
])
]),
_: 1
/* STABLE */
}),
vue.createElementVNode("label", {
for: "",
class: "radio"
}, [
vue.createElementVNode("switch", {
checked: formData.value.remember,
style: { "transform": "scale(0.7)" },
onChange: handleChange
}, null, 40, ["checked"]),
vue.createTextVNode(" 记住密码 ")
])
]),
_: 1
/* STABLE */
}, 8, ["model"]),
vue.createElementVNode("button", {
class: "button",
onClick: submit
}, "登录")
])
]);
};
}
});
const PagesLoginLogin = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "/Users/sunwubin/source/pharmacy/pages/login/login.vue"]]);
function obj2strClass(obj) {
let classess = "";
for (let key in obj) {
const val = obj[key];
if (val) {
classess += `${key} `;
}
}
return classess;
}
function obj2strStyle(obj) {
let style = "";
for (let key in obj) {
const val = obj[key];
style += `${key}:${val};`;
}
return style;
}
const _sfc_main$l = {
name: "uni-easyinput",
emits: ["click", "iconClick", "update:modelValue", "input", "focus", "blur", "confirm", "clear", "eyes", "change", "keyboardheightchange"],
model: {
prop: "modelValue",
event: "update:modelValue"
},
options: {
virtualHost: true
},
inject: {
form: {
from: "uniForm",
default: null
},
formItem: {
from: "uniFormItem",
default: null
}
},
props: {
name: String,
value: [Number, String],
modelValue: [Number, String],
type: {
type: String,
default: "text"
},
clearable: {
type: Boolean,
default: true
},
autoHeight: {
type: Boolean,
default: false
},
placeholder: {
type: String,
default: " "
},
placeholderStyle: String,
focus: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
maxlength: {
type: [Number, String],
default: 140
},
confirmType: {
type: String,
default: "done"
},
clearSize: {
type: [Number, String],
default: 24
},
inputBorder: {
type: Boolean,
default: true
},
prefixIcon: {
type: String,
default: ""
},
suffixIcon: {
type: String,
default: ""
},
trim: {
type: [Boolean, String],
default: false
},
cursorSpacing: {
type: Number,
default: 0
},
passwordIcon: {
type: Boolean,
default: true
},
primaryColor: {
type: String,
default: "#2979ff"
},
styles: {
type: Object,
default() {
return {
color: "#333",
backgroundColor: "#fff",
disableColor: "#F7F6F6",
borderColor: "#e5e5e5"
};
}
},
errorMessage: {
type: [String, Boolean],
default: ""
}
},
data() {
return {
focused: false,
val: "",
showMsg: "",
border: false,
isFirstBorder: false,
showClearIcon: false,
showPassword: false,
focusShow: false,
localMsg: "",
isEnter: false
// 用于判断当前是否是使用回车操作
};
},
computed: {
// 输入框内是否有值
isVal() {
const val = this.val;
if (val || val === 0) {
return true;
}
return false;
},
msg() {
return this.localMsg || this.errorMessage;
},
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
inputMaxlength() {
return Number(this.maxlength);
},
// 处理外层样式的style
boxStyle() {
return `color:${this.inputBorder && this.msg ? "#e43d33" : this.styles.color};`;
},
// input 内容的类和样式处理
inputContentClass() {
return obj2strClass({
"is-input-border": this.inputBorder,
"is-input-error-border": this.inputBorder && this.msg,
"is-textarea": this.type === "textarea",
"is-disabled": this.disabled,
"is-focused": this.focusShow
});
},
inputContentStyle() {
const focusColor = this.focusShow ? this.primaryColor : this.styles.borderColor;
const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
return obj2strStyle({
"border-color": borderColor || "#e5e5e5",
"background-color": this.disabled ? this.styles.disableColor : this.styles.backgroundColor
});
},
// input右侧样式
inputStyle() {
const paddingRight = this.type === "password" || this.clearable || this.prefixIcon ? "" : "10px";
return obj2strStyle({
"padding-right": paddingRight,
"padding-left": this.prefixIcon ? "" : "10px"
});
}
},
watch: {
value(newVal) {
this.val = newVal;
},
modelValue(newVal) {
this.val = newVal;
},
focus(newVal) {
this.$nextTick(() => {
this.focused = this.focus;
this.focusShow = this.focus;
});
}
},
created() {
this.init();
if (this.form && this.formItem) {
this.$watch("formItem.errMsg", (newVal) => {
this.localMsg = newVal;
});
}
},
mounted() {
this.$nextTick(() => {
this.focused = this.focus;
this.focusShow = this.focus;
});
},
methods: {
/**
* 初始化变量值
*/
init() {
if (this.value || this.value === 0) {
this.val = this.value;
} else if (this.modelValue || this.modelValue === 0 || this.modelValue === "") {
this.val = this.modelValue;
} else {
this.val = null;
}
},
/**
* 点击图标时触发
* @param {Object} type
*/
onClickIcon(type) {
this.$emit("iconClick", type);
},
/**
* 显示隐藏内容,密码框时生效
*/
onEyes() {
this.showPassword = !this.showPassword;
this.$emit("eyes", this.showPassword);
},
/**
* 输入时触发
* @param {Object} event
*/
onInput(event) {
let value = event.detail.value;
if (this.trim) {
if (typeof this.trim === "boolean" && this.trim) {
value = this.trimStr(value);
}
if (typeof this.trim === "string") {
value = this.trimStr(value, this.trim);
}
}
if (this.errMsg)
this.errMsg = "";
this.val = value;
this.$emit("input", value);
this.$emit("update:modelValue", value);
},
/**
* 外部调用方法
* 获取焦点时触发
* @param {Object} event
*/
onFocus() {
this.$nextTick(() => {
this.focused = true;
});
this.$emit("focus", null);
},
_Focus(event) {
this.focusShow = true;
this.$emit("focus", event);
},
/**
* 外部调用方法
* 失去焦点时触发
* @param {Object} event
*/
onBlur() {
this.focused = false;
this.$emit("focus", null);
},
_Blur(event) {
event.detail.value;
this.focusShow = false;
this.$emit("blur", event);
if (this.isEnter === false) {
this.$emit("change", this.val);
}
if (this.form && this.formItem) {
const { validateTrigger } = this.form;
if (validateTrigger === "blur") {
this.formItem.onFieldChange();
}
}
},
/**
* 按下键盘的发送键
* @param {Object} e
*/
onConfirm(e2) {
this.$emit("confirm", this.val);
this.isEnter = true;
this.$emit("change", this.val);
this.$nextTick(() => {
this.isEnter = false;
});
},
/**
* 清理内容
* @param {Object} event
*/
onClear(event) {
this.val = "";
this.$emit("input", "");
this.$emit("update:modelValue", "");
this.$emit("clear");
},
/**
* 键盘高度发生变化的时候触发此事件
* 兼容性:微信小程序2.7.0+、App 3.1.0+
* @param {Object} event
*/
onkeyboardheightchange(event) {
this.$emit("keyboardheightchange", event);
},
/**
* 去除空格
*/
trimStr(str, pos = "both") {
if (pos === "both") {
return str.trim();
} else if (pos === "left") {
return str.trimLeft();
} else if (pos === "right") {
return str.trimRight();
} else if (pos === "start") {
return str.trimStart();
} else if (pos === "end") {
return str.trimEnd();
} else if (pos === "all") {
return str.replace(/\s+/g, "");
} else if (pos === "none") {
return str;
}
return str;
}
}
};
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["uni-easyinput", { "uni-easyinput-error": $options.msg }]),
style: vue.normalizeStyle($options.boxStyle)
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-easyinput__content", $options.inputContentClass]),
style: vue.normalizeStyle($options.inputContentStyle)
},
[
$props.prefixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: "content-clear-icon",
type: $props.prefixIcon,
color: "#c0c4cc",
onClick: _cache[0] || (_cache[0] = ($event) => $options.onClickIcon("prefix")),
size: "22"
}, null, 8, ["type"])) : vue.createCommentVNode("v-if", true),
$props.type === "textarea" ? (vue.openBlock(), vue.createElementBlock("textarea", {
key: 1,
class: vue.normalizeClass(["uni-easyinput__content-textarea", { "input-padding": $props.inputBorder }]),
name: $props.name,
value: $data.val,
placeholder: $props.placeholder,
placeholderStyle: $props.placeholderStyle,
disabled: $props.disabled,
"placeholder-class": "uni-easyinput__placeholder-class",
maxlength: $options.inputMaxlength,
focus: $data.focused,
autoHeight: $props.autoHeight,
"cursor-spacing": $props.cursorSpacing,
onInput: _cache[1] || (_cache[1] = (...args) => $options.onInput && $options.onInput(...args)),
onBlur: _cache[2] || (_cache[2] = (...args) => $options._Blur && $options._Blur(...args)),
onFocus: _cache[3] || (_cache[3] = (...args) => $options._Focus && $options._Focus(...args)),
onConfirm: _cache[4] || (_cache[4] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
onKeyboardheightchange: _cache[5] || (_cache[5] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
}, null, 42, ["name", "value", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "autoHeight", "cursor-spacing"])) : (vue.openBlock(), vue.createElementBlock("input", {
key: 2,
type: $props.type === "password" ? "text" : $props.type,
class: "uni-easyinput__content-input",
style: vue.normalizeStyle($options.inputStyle),
name: $props.name,
value: $data.val,
password: !$data.showPassword && $props.type === "password",
placeholder: $props.placeholder,
placeholderStyle: $props.placeholderStyle,
"placeholder-class": "uni-easyinput__placeholder-class",
disabled: $props.disabled,
maxlength: $options.inputMaxlength,
focus: $data.focused,
confirmType: $props.confirmType,
"cursor-spacing": $props.cursorSpacing,
onFocus: _cache[6] || (_cache[6] = (...args) => $options._Focus && $options._Focus(...args)),
onBlur: _cache[7] || (_cache[7] = (...args) => $options._Blur && $options._Blur(...args)),
onInput: _cache[8] || (_cache[8] = (...args) => $options.onInput && $options.onInput(...args)),
onConfirm: _cache[9] || (_cache[9] = (...args) => $options.onConfirm && $options.onConfirm(...args)),
onKeyboardheightchange: _cache[10] || (_cache[10] = (...args) => $options.onkeyboardheightchange && $options.onkeyboardheightchange(...args))
}, null, 44, ["type", "name", "value", "password", "placeholder", "placeholderStyle", "disabled", "maxlength", "focus", "confirmType", "cursor-spacing"])),
$props.type === "password" && $props.passwordIcon ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 3 },
[
vue.createCommentVNode(" 开启密码时显示小眼睛 "),
$options.isVal ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
type: $data.showPassword ? "eye-slash-filled" : "eye-filled",
size: 22,
color: $data.focusShow ? $props.primaryColor : "#c0c4cc",
onClick: $options.onEyes
}, null, 8, ["class", "type", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)) : $props.suffixIcon ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 4 },
[
$props.suffixIcon ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: "content-clear-icon",
type: $props.suffixIcon,
color: "#c0c4cc",
onClick: _cache[11] || (_cache[11] = ($event) => $options.onClickIcon("suffix")),
size: "22"
}, null, 8, ["type"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)) : (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 5 },
[
$props.clearable && $options.isVal && !$props.disabled && $props.type !== "textarea" ? (vue.openBlock(), vue.createBlock(_component_uni_icons, {
key: 0,
class: vue.normalizeClass(["content-clear-icon", { "is-textarea-icon": $props.type === "textarea" }]),
type: "clear",
size: $props.clearSize,
color: $options.msg ? "#dd524d" : $data.focusShow ? $props.primaryColor : "#c0c4cc",
onClick: $options.onClear
}, null, 8, ["class", "size", "color", "onClick"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)),
vue.renderSlot(_ctx.$slots, "right", {}, void 0, true)
],
6
/* CLASS, STYLE */
)
],
6
/* CLASS, STYLE */
);
}
const __easycom_0$2 = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$d], ["__scopeId", "data-v-09fd5285"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue"]]);
let Calendar$1 = class Calendar {
constructor({
selected,
startDate,
endDate,
range
} = {}) {
this.date = this.getDateObj(/* @__PURE__ */ new Date());
this.selected = selected || [];
this.startDate = startDate;
this.endDate = endDate;
this.range = range;
this.cleanMultipleStatus();
this.weeks = {};
this.lastHover = false;
}
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
const selectDate = this.getDateObj(date);
this.getWeeks(selectDate.fullDate);
}
/**
* 清理多选状态
*/
cleanMultipleStatus() {
this.multipleStatus = {
before: "",
after: "",
data: []
};
}
setStartDate(startDate) {
this.startDate = startDate;
}
setEndDate(endDate) {
this.endDate = endDate;
}
getPreMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const oldMonth = date.getMonth();
date.setMonth(oldMonth - 1);
const newMonth = date.getMonth();
if (oldMonth !== 0 && newMonth - oldMonth === 0) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
getNextMonthObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const oldMonth = date.getMonth();
date.setMonth(oldMonth + 1);
const newMonth = date.getMonth();
if (newMonth - oldMonth > 1) {
date.setMonth(newMonth - 1);
}
return this.getDateObj(date);
}
/**
* 获取指定格式Date对象
*/
getDateObj(date) {
date = fixIosDateFormat(date);
date = new Date(date);
return {
fullDate: getDate(date),
year: date.getFullYear(),
month: addZero(date.getMonth() + 1),
date: addZero(date.getDate()),
day: date.getDay()
};
}
/**
* 获取上一个月日期集合
*/
getPreMonthDays(amount, dateObj) {
const result = [];
for (let i2 = amount - 1; i2 >= 0; i2--) {
const month = dateObj.month > 1 ? dateObj.month - 1 : 12;
const year = month === 12 ? dateObj.year - 1 : dateObj.year;
const date = new Date(year, month, -i2).getDate();
const fullDate = `${year}-${addZero(month)}-${addZero(date)}`;
let multiples = this.multipleStatus.data;
let multiplesStatus = -1;
if (this.range && multiples) {
multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, fullDate);
});
}
const checked = multiplesStatus !== -1;
const extraInfo = this.selected && this.selected.find((item) => {
if (this.dateEqual(fullDate, item.date)) {
return item;
}
});
result.push({
fullDate,
year,
month,
date,
multiple: this.range ? checked : false,
beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after),
afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after),
disable: this.startDate && !dateCompare(this.startDate, fullDate) || this.endDate && !dateCompare(fullDate, this.endDate),
isToday: fullDate === this.date.fullDate,
userChecked: false,
extraInfo
});
}
return result;
}
/**
* 获取本月日期集合
*/
getCurrentMonthDays(amount, dateObj) {
const result = [];
const fullDate = this.date.fullDate;
for (let i2 = 1; i2 <= amount; i2++) {
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i2)}`;
const isToday = fullDate === currentDate;
const extraInfo = this.selected && this.selected.find((item) => {
if (this.dateEqual(currentDate, item.date)) {
return item;
}
});
if (this.startDate) {
dateCompare(this.startDate, currentDate);
}
if (this.endDate) {
dateCompare(currentDate, this.endDate);
}
let multiples = this.multipleStatus.data;
let multiplesStatus = -1;
if (this.range && multiples) {
multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, currentDate);
});
}
const checked = multiplesStatus !== -1;
result.push({
fullDate: currentDate,
year: dateObj.year,
month: dateObj.month,
date: i2,
multiple: this.range ? checked : false,
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
disable: this.startDate && !dateCompare(this.startDate, currentDate) || this.endDate && !dateCompare(currentDate, this.endDate),
isToday,
userChecked: false,
extraInfo
});
}
return result;
}
/**
* 获取下一个月日期集合
*/
_getNextMonthDays(amount, dateObj) {
const result = [];
dateObj.month + 1;
for (let i2 = 1; i2 <= amount; i2++) {
const month = dateObj.month === 12 ? 1 : dateObj.month * 1 + 1;
const year = month === 1 ? dateObj.year + 1 : dateObj.year;
const fullDate = `${year}-${addZero(month)}-${addZero(i2)}`;
let multiples = this.multipleStatus.data;
let multiplesStatus = -1;
if (this.range && multiples) {
multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, fullDate);
});
}
const checked = multiplesStatus !== -1;
const extraInfo = this.selected && this.selected.find((item) => {
if (this.dateEqual(fullDate, item.date)) {
return item;
}
});
result.push({
fullDate,
year,
date: i2,
month,
multiple: this.range ? checked : false,
beforeMultiple: this.isLogicBefore(fullDate, this.multipleStatus.before, this.multipleStatus.after),
afterMultiple: this.isLogicAfter(fullDate, this.multipleStatus.before, this.multipleStatus.after),
disable: this.startDate && !dateCompare(this.startDate, fullDate) || this.endDate && !dateCompare(fullDate, this.endDate),
isToday: fullDate === this.date.fullDate,
userChecked: false,
extraInfo
});
}
return result;
}
/**
* 获取当前日期详情
* @param {Object} date
*/
getInfo(date) {
if (!date) {
date = /* @__PURE__ */ new Date();
}
return this.calendar.find((item) => item.fullDate === this.getDateObj(date).fullDate);
}
/**
* 比较时间是否相等
*/
dateEqual(before, after) {
before = new Date(fixIosDateFormat(before));
after = new Date(fixIosDateFormat(after));
return before.valueOf() === after.valueOf();
}
/**
* 比较真实起始日期
*/
isLogicBefore(currentDate, before, after) {
let logicBefore = before;
if (before && after) {
logicBefore = dateCompare(before, after) ? before : after;
}
return this.dateEqual(logicBefore, currentDate);
}
isLogicAfter(currentDate, before, after) {
let logicAfter = after;
if (before && after) {
logicAfter = dateCompare(before, after) ? after : before;
}
return this.dateEqual(logicAfter, currentDate);
}
/**
* 获取日期范围内所有日期
* @param {Object} begin
* @param {Object} end
*/
geDateAll(begin, end) {
var arr = [];
var ab = begin.split("-");
var ae2 = end.split("-");
var db = /* @__PURE__ */ new Date();
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
var de2 = /* @__PURE__ */ new Date();
de2.setFullYear(ae2[0], ae2[1] - 1, ae2[2]);
var unixDb = db.getTime() - 24 * 60 * 60 * 1e3;
var unixDe = de2.getTime() - 24 * 60 * 60 * 1e3;
for (var k2 = unixDb; k2 <= unixDe; ) {
k2 = k2 + 24 * 60 * 60 * 1e3;
arr.push(this.getDateObj(new Date(parseInt(k2))).fullDate);
}
return arr;
}
/**
* 获取多选状态
*/
setMultiple(fullDate) {
if (!this.range)
return;
let {
before,
after
} = this.multipleStatus;
if (before && after) {
if (!this.lastHover) {
this.lastHover = true;
return;
}
this.multipleStatus.before = fullDate;
this.multipleStatus.after = "";
this.multipleStatus.data = [];
this.multipleStatus.fulldate = "";
this.lastHover = false;
} else {
if (!before) {
this.multipleStatus.before = fullDate;
this.lastHover = false;
} else {
this.multipleStatus.after = fullDate;
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
this.lastHover = true;
}
}
this.getWeeks(fullDate);
}
/**
* 鼠标 hover 更新多选状态
*/
setHoverMultiple(fullDate) {
if (!this.range || this.lastHover)
return;
const { before } = this.multipleStatus;
if (!before) {
this.multipleStatus.before = fullDate;
} else {
this.multipleStatus.after = fullDate;
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
}
this.getWeeks(fullDate);
}
/**
* 更新默认值多选状态
*/
setDefaultMultiple(before, after) {
this.multipleStatus.before = before;
this.multipleStatus.after = after;
if (before && after) {
if (dateCompare(before, after)) {
this.multipleStatus.data = this.geDateAll(before, after);
this.getWeeks(after);
} else {
this.multipleStatus.data = this.geDateAll(after, before);
this.getWeeks(before);
}
}
}
/**
* 获取每周数据
* @param {Object} dateData
*/
getWeeks(dateData) {
const {
year,
month
} = this.getDateObj(dateData);
const preMonthDayAmount = new Date(year, month - 1, 1).getDay();
const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
const currentMonthDayAmount = new Date(year, month, 0).getDate();
const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays];
const weeks = new Array(6);
for (let i2 = 0; i2 < calendarDays.length; i2++) {
const index = Math.floor(i2 / 7);
if (!weeks[index]) {
weeks[index] = new Array(7);
}
weeks[index][i2 % 7] = calendarDays[i2];
}
this.calendar = calendarDays;
this.weeks = weeks;
}
};
function getDateTime(date, hideSecond) {
return `${getDate(date)} ${getTime(date, hideSecond)}`;
}
function getDate(date) {
date = fixIosDateFormat(date);
date = new Date(date);
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
return `${year}-${addZero(month)}-${addZero(day)}`;
}
function getTime(date, hideSecond) {
date = fixIosDateFormat(date);
date = new Date(date);
const hour = date.getHours();
const minute = date.getMinutes();
const second = date.getSeconds();
return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`;
}
function addZero(num) {
if (num < 10) {
num = `0${num}`;
}
return num;
}
function getDefaultSecond(hideSecond) {
return hideSecond ? "00:00" : "00:00:00";
}
function dateCompare(startDate, endDate) {
startDate = new Date(fixIosDateFormat(startDate));
endDate = new Date(fixIosDateFormat(endDate));
return startDate <= endDate;
}
function checkDate(date) {
const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
return date.match(dateReg);
}
const dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9]:[0-5]?[0-9])?$/;
function fixIosDateFormat(value) {
if (typeof value === "string" && dateTimeReg.test(value)) {
value = value.replace(/-/g, "/");
}
return value;
}
const _sfc_main$k = {
props: {
weeks: {
type: Object,
default() {
return {};
}
},
calendar: {
type: Object,
default: () => {
return {};
}
},
selected: {
type: Array,
default: () => {
return [];
}
},
checkHover: {
type: Boolean,
default: false
}
},
methods: {
choiceDate(weeks) {
this.$emit("change", weeks);
},
handleMousemove(weeks) {
this.$emit("handleMouse", weeks);
}
}
};
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: vue.normalizeClass(["uni-calendar-item__weeks-box", {
"uni-calendar-item--disable": $props.weeks.disable,
"uni-calendar-item--before-checked-x": $props.weeks.beforeMultiple,
"uni-calendar-item--multiple": $props.weeks.multiple,
"uni-calendar-item--after-checked-x": $props.weeks.afterMultiple
}]),
onClick: _cache[0] || (_cache[0] = ($event) => $options.choiceDate($props.weeks)),
onMouseenter: _cache[1] || (_cache[1] = ($event) => $options.handleMousemove($props.weeks))
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-calendar-item__weeks-box-item", {
"uni-calendar-item--checked": $props.calendar.fullDate === $props.weeks.fullDate && ($props.calendar.userChecked || !$props.checkHover),
"uni-calendar-item--checked-range-text": $props.checkHover,
"uni-calendar-item--before-checked": $props.weeks.beforeMultiple,
"uni-calendar-item--multiple": $props.weeks.multiple,
"uni-calendar-item--after-checked": $props.weeks.afterMultiple,
"uni-calendar-item--disable": $props.weeks.disable
}])
},
[
$props.selected && $props.weeks.extraInfo ? (vue.openBlock(), vue.createElementBlock("text", {
key: 0,
class: "uni-calendar-item__weeks-box-circle"
})) : vue.createCommentVNode("v-if", true),
vue.createElementVNode(
"text",
{ class: "uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text" },
vue.toDisplayString($props.weeks.date),
1
/* TEXT */
)
],
2
/* CLASS */
),
vue.createElementVNode(
"view",
{
class: vue.normalizeClass({ "uni-calendar-item--today": $props.weeks.isToday })
},
null,
2
/* CLASS */
)
],
34
/* CLASS, HYDRATE_EVENTS */
);
}
const calendarItem = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$c], ["__scopeId", "data-v-3c762a01"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue"]]);
const isObject = (val) => val !== null && typeof val === "object";
const defaultDelimiters = ["{", "}"];
class BaseFormatter {
constructor() {
this._caches = /* @__PURE__ */ Object.create(null);
}
interpolate(message, values, delimiters = defaultDelimiters) {
if (!values) {
return [message];
}
let tokens = this._caches[message];
if (!tokens) {
tokens = parse(message, delimiters);
this._caches[message] = tokens;
}
return compile(tokens, values);
}
}
const RE_TOKEN_LIST_VALUE = /^(?:\d)+/;
const RE_TOKEN_NAMED_VALUE = /^(?:\w)+/;
function parse(format, [startDelimiter, endDelimiter]) {
const tokens = [];
let position = 0;
let text = "";
while (position < format.length) {
let char = format[position++];
if (char === startDelimiter) {
if (text) {
tokens.push({ type: "text", value: text });
}
text = "";
let sub = "";
char = format[position++];
while (char !== void 0 && char !== endDelimiter) {
sub += char;
char = format[position++];
}
const isClosed = char === endDelimiter;
const type = RE_TOKEN_LIST_VALUE.test(sub) ? "list" : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? "named" : "unknown";
tokens.push({ value: sub, type });
} else {
text += char;
}
}
text && tokens.push({ type: "text", value: text });
return tokens;
}
function compile(tokens, values) {
const compiled = [];
let index = 0;
const mode = Array.isArray(values) ? "list" : isObject(values) ? "named" : "unknown";
if (mode === "unknown") {
return compiled;
}
while (index < tokens.length) {
const token2 = tokens[index];
switch (token2.type) {
case "text":
compiled.push(token2.value);
break;
case "list":
compiled.push(values[parseInt(token2.value, 10)]);
break;
case "named":
if (mode === "named") {
compiled.push(values[token2.value]);
} else {
{
console.warn(`Type of token '${token2.type}' and format of value '${mode}' don't match!`);
}
}
break;
case "unknown":
{
console.warn(`Detect 'unknown' type of token!`);
}
break;
}
index++;
}
return compiled;
}
const LOCALE_ZH_HANS = "zh-Hans";
const LOCALE_ZH_HANT = "zh-Hant";
const LOCALE_EN = "en";
const LOCALE_FR = "fr";
const LOCALE_ES = "es";
const hasOwnProperty = Object.prototype.hasOwnProperty;
const hasOwn = (val, key) => hasOwnProperty.call(val, key);
const defaultFormatter = new BaseFormatter();
function include(str, parts) {
return !!parts.find((part) => str.indexOf(part) !== -1);
}
function startsWith(str, parts) {
return parts.find((part) => str.indexOf(part) === 0);
}
function normalizeLocale(locale, messages2) {
if (!locale) {
return;
}
locale = locale.trim().replace(/_/g, "-");
if (messages2 && messages2[locale]) {
return locale;
}
locale = locale.toLowerCase();
if (locale === "chinese") {
return LOCALE_ZH_HANS;
}
if (locale.indexOf("zh") === 0) {
if (locale.indexOf("-hans") > -1) {
return LOCALE_ZH_HANS;
}
if (locale.indexOf("-hant") > -1) {
return LOCALE_ZH_HANT;
}
if (include(locale, ["-tw", "-hk", "-mo", "-cht"])) {
return LOCALE_ZH_HANT;
}
return LOCALE_ZH_HANS;
}
let locales = [LOCALE_EN, LOCALE_FR, LOCALE_ES];
if (messages2 && Object.keys(messages2).length > 0) {
locales = Object.keys(messages2);
}
const lang = startsWith(locale, locales);
if (lang) {
return lang;
}
}
class I18n {
constructor({ locale, fallbackLocale, messages: messages2, watcher, formater }) {
this.locale = LOCALE_EN;
this.fallbackLocale = LOCALE_EN;
this.message = {};
this.messages = {};
this.watchers = [];
if (fallbackLocale) {
this.fallbackLocale = fallbackLocale;
}
this.formater = formater || defaultFormatter;
this.messages = messages2 || {};
this.setLocale(locale || LOCALE_EN);
if (watcher) {
this.watchLocale(watcher);
}
}
setLocale(locale) {
const oldLocale = this.locale;
this.locale = normalizeLocale(locale, this.messages) || this.fallbackLocale;
if (!this.messages[this.locale]) {
this.messages[this.locale] = {};
}
this.message = this.messages[this.locale];
if (oldLocale !== this.locale) {
this.watchers.forEach((watcher) => {
watcher(this.locale, oldLocale);
});
}
}
getLocale() {
return this.locale;
}
watchLocale(fn) {
const index = this.watchers.push(fn) - 1;
return () => {
this.watchers.splice(index, 1);
};
}
add(locale, message, override = true) {
const curMessages = this.messages[locale];
if (curMessages) {
if (override) {
Object.assign(curMessages, message);
} else {
Object.keys(message).forEach((key) => {
if (!hasOwn(curMessages, key)) {
curMessages[key] = message[key];
}
});
}
} else {
this.messages[locale] = message;
}
}
f(message, values, delimiters) {
return this.formater.interpolate(message, values, delimiters).join("");
}
t(key, locale, values) {
let message = this.message;
if (typeof locale === "string") {
locale = normalizeLocale(locale, this.messages);
locale && (message = this.messages[locale]);
} else {
values = locale;
}
if (!hasOwn(message, key)) {
console.warn(`Cannot translate the value of keypath ${key}. Use the value of keypath as default.`);
return key;
}
return this.formater.interpolate(message[key], values).join("");
}
}
function watchAppLocale(appVm, i18n) {
if (appVm.$watchLocale) {
appVm.$watchLocale((newLocale) => {
i18n.setLocale(newLocale);
});
} else {
appVm.$watch(() => appVm.$locale, (newLocale) => {
i18n.setLocale(newLocale);
});
}
}
function getDefaultLocale() {
if (typeof uni !== "undefined" && uni.getLocale) {
return uni.getLocale();
}
if (typeof global !== "undefined" && global.getLocale) {
return global.getLocale();
}
return LOCALE_EN;
}
function initVueI18n(locale, messages2 = {}, fallbackLocale, watcher) {
if (typeof locale !== "string") {
[locale, messages2] = [
messages2,
locale
];
}
if (typeof locale !== "string") {
locale = getDefaultLocale();
}
if (typeof fallbackLocale !== "string") {
fallbackLocale = typeof __uniConfig !== "undefined" && __uniConfig.fallbackLocale || LOCALE_EN;
}
const i18n = new I18n({
locale,
fallbackLocale,
messages: messages2,
watcher
});
let t2 = (key, values) => {
if (typeof getApp !== "function") {
t2 = function(key2, values2) {
return i18n.t(key2, values2);
};
} else {
let isWatchedAppLocale = false;
t2 = function(key2, values2) {
const appVm = getApp().$vm;
if (appVm) {
appVm.$locale;
if (!isWatchedAppLocale) {
isWatchedAppLocale = true;
watchAppLocale(appVm, i18n);
}
}
return i18n.t(key2, values2);
};
}
return t2(key, values);
};
return {
i18n,
f(message, values, delimiters) {
return i18n.f(message, values, delimiters);
},
t(key, values) {
return t2(key, values);
},
add(locale2, message, override = true) {
return i18n.add(locale2, message, override);
},
watch(fn) {
return i18n.watchLocale(fn);
},
getLocale() {
return i18n.getLocale();
},
setLocale(newLocale) {
return i18n.setLocale(newLocale);
}
};
}
const en$1 = {
"uni-datetime-picker.selectDate": "select date",
"uni-datetime-picker.selectTime": "select time",
"uni-datetime-picker.selectDateTime": "select date and time",
"uni-datetime-picker.startDate": "start date",
"uni-datetime-picker.endDate": "end date",
"uni-datetime-picker.startTime": "start time",
"uni-datetime-picker.endTime": "end time",
"uni-datetime-picker.ok": "ok",
"uni-datetime-picker.clear": "clear",
"uni-datetime-picker.cancel": "cancel",
"uni-datetime-picker.year": "-",
"uni-datetime-picker.month": "",
"uni-calender.MON": "MON",
"uni-calender.TUE": "TUE",
"uni-calender.WED": "WED",
"uni-calender.THU": "THU",
"uni-calender.FRI": "FRI",
"uni-calender.SAT": "SAT",
"uni-calender.SUN": "SUN",
"uni-calender.confirm": "confirm"
};
const zhHans$1 = {
"uni-datetime-picker.selectDate": "选择日期",
"uni-datetime-picker.selectTime": "选择时间",
"uni-datetime-picker.selectDateTime": "选择日期时间",
"uni-datetime-picker.startDate": "开始时间",
"uni-datetime-picker.endDate": "结束时间",
"uni-datetime-picker.startTime": "开始时间",
"uni-datetime-picker.endTime": "结束时间",
"uni-datetime-picker.ok": "确定",
"uni-datetime-picker.clear": "清除",
"uni-datetime-picker.cancel": "取消",
"uni-datetime-picker.year": "年",
"uni-datetime-picker.month": "月",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六",
"uni-calender.confirm": "确认"
};
const zhHant$1 = {
"uni-datetime-picker.selectDate": "選擇日期",
"uni-datetime-picker.selectTime": "選擇時間",
"uni-datetime-picker.selectDateTime": "選擇日期時間",
"uni-datetime-picker.startDate": "開始日期",
"uni-datetime-picker.endDate": "結束日期",
"uni-datetime-picker.startTime": "開始时间",
"uni-datetime-picker.endTime": "結束时间",
"uni-datetime-picker.ok": "確定",
"uni-datetime-picker.clear": "清除",
"uni-datetime-picker.cancel": "取消",
"uni-datetime-picker.year": "年",
"uni-datetime-picker.month": "月",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六",
"uni-calender.confirm": "確認"
};
const i18nMessages = {
en: en$1,
"zh-Hans": zhHans$1,
"zh-Hant": zhHant$1
};
const { t: t$4 } = initVueI18n(i18nMessages);
const _sfc_main$j = {
name: "UniDatetimePicker",
data() {
return {
indicatorStyle: `height: 50px;`,
visible: false,
fixNvueBug: {},
dateShow: true,
timeShow: true,
title: "日期和时间",
// 输入框当前时间
time: "",
// 当前的年月日时分秒
year: 1920,
month: 0,
day: 0,
hour: 0,
minute: 0,
second: 0,
// 起始时间
startYear: 1920,
startMonth: 1,
startDay: 1,
startHour: 0,
startMinute: 0,
startSecond: 0,
// 结束时间
endYear: 2120,
endMonth: 12,
endDay: 31,
endHour: 23,
endMinute: 59,
endSecond: 59
};
},
props: {
type: {
type: String,
default: "datetime"
},
value: {
type: [String, Number],
default: ""
},
modelValue: {
type: [String, Number],
default: ""
},
start: {
type: [Number, String],
default: ""
},
end: {
type: [Number, String],
default: ""
},
returnType: {
type: String,
default: "string"
},
disabled: {
type: [Boolean, String],
default: false
},
border: {
type: [Boolean, String],
default: true
},
hideSecond: {
type: [Boolean, String],
default: false
}
},
watch: {
modelValue: {
handler(newVal) {
if (newVal) {
this.parseValue(fixIosDateFormat(newVal));
this.initTime(false);
} else {
this.time = "";
this.parseValue(Date.now());
}
},
immediate: true
},
type: {
handler(newValue) {
if (newValue === "date") {
this.dateShow = true;
this.timeShow = false;
this.title = "日期";
} else if (newValue === "time") {
this.dateShow = false;
this.timeShow = true;
this.title = "时间";
} else {
this.dateShow = true;
this.timeShow = true;
this.title = "日期和时间";
}
},
immediate: true
},
start: {
handler(newVal) {
this.parseDatetimeRange(fixIosDateFormat(newVal), "start");
},
immediate: true
},
end: {
handler(newVal) {
this.parseDatetimeRange(fixIosDateFormat(newVal), "end");
},
immediate: true
},
// 月、日、时、分、秒可选范围变化后,检查当前值是否在范围内,不在则当前值重置为可选范围第一项
months(newVal) {
this.checkValue("month", this.month, newVal);
},
days(newVal) {
this.checkValue("day", this.day, newVal);
},
hours(newVal) {
this.checkValue("hour", this.hour, newVal);
},
minutes(newVal) {
this.checkValue("minute", this.minute, newVal);
},
seconds(newVal) {
this.checkValue("second", this.second, newVal);
}
},
computed: {
// 当前年、月、日、时、分、秒选择范围
years() {
return this.getCurrentRange("year");
},
months() {
return this.getCurrentRange("month");
},
days() {
return this.getCurrentRange("day");
},
hours() {
return this.getCurrentRange("hour");
},
minutes() {
return this.getCurrentRange("minute");
},
seconds() {
return this.getCurrentRange("second");
},
// picker 当前值数组
ymd() {
return [this.year - this.minYear, this.month - this.minMonth, this.day - this.minDay];
},
hms() {
return [this.hour - this.minHour, this.minute - this.minMinute, this.second - this.minSecond];
},
// 当前 date 是 start
currentDateIsStart() {
return this.year === this.startYear && this.month === this.startMonth && this.day === this.startDay;
},
// 当前 date 是 end
currentDateIsEnd() {
return this.year === this.endYear && this.month === this.endMonth && this.day === this.endDay;
},
// 当前年、月、日、时、分、秒的最小值和最大值
minYear() {
return this.startYear;
},
maxYear() {
return this.endYear;
},
minMonth() {
if (this.year === this.startYear) {
return this.startMonth;
} else {
return 1;
}
},
maxMonth() {
if (this.year === this.endYear) {
return this.endMonth;
} else {
return 12;
}
},
minDay() {
if (this.year === this.startYear && this.month === this.startMonth) {
return this.startDay;
} else {
return 1;
}
},
maxDay() {
if (this.year === this.endYear && this.month === this.endMonth) {
return this.endDay;
} else {
return this.daysInMonth(this.year, this.month);
}
},
minHour() {
if (this.type === "datetime") {
if (this.currentDateIsStart) {
return this.startHour;
} else {
return 0;
}
}
if (this.type === "time") {
return this.startHour;
}
},
maxHour() {
if (this.type === "datetime") {
if (this.currentDateIsEnd) {
return this.endHour;
} else {
return 23;
}
}
if (this.type === "time") {
return this.endHour;
}
},
minMinute() {
if (this.type === "datetime") {
if (this.currentDateIsStart && this.hour === this.startHour) {
return this.startMinute;
} else {
return 0;
}
}
if (this.type === "time") {
if (this.hour === this.startHour) {
return this.startMinute;
} else {
return 0;
}
}
},
maxMinute() {
if (this.type === "datetime") {
if (this.currentDateIsEnd && this.hour === this.endHour) {
return this.endMinute;
} else {
return 59;
}
}
if (this.type === "time") {
if (this.hour === this.endHour) {
return this.endMinute;
} else {
return 59;
}
}
},
minSecond() {
if (this.type === "datetime") {
if (this.currentDateIsStart && this.hour === this.startHour && this.minute === this.startMinute) {
return this.startSecond;
} else {
return 0;
}
}
if (this.type === "time") {
if (this.hour === this.startHour && this.minute === this.startMinute) {
return this.startSecond;
} else {
return 0;
}
}
},
maxSecond() {
if (this.type === "datetime") {
if (this.currentDateIsEnd && this.hour === this.endHour && this.minute === this.endMinute) {
return this.endSecond;
} else {
return 59;
}
}
if (this.type === "time") {
if (this.hour === this.endHour && this.minute === this.endMinute) {
return this.endSecond;
} else {
return 59;
}
}
},
/**
* for i18n
*/
selectTimeText() {
return t$4("uni-datetime-picker.selectTime");
},
okText() {
return t$4("uni-datetime-picker.ok");
},
clearText() {
return t$4("uni-datetime-picker.clear");
},
cancelText() {
return t$4("uni-datetime-picker.cancel");
}
},
mounted() {
},
methods: {
/**
* @param {Object} item
* 小于 10 在前面加个 0
*/
lessThanTen(item) {
return item < 10 ? "0" + item : item;
},
/**
* 解析时分秒字符串,例如:00:00:00
* @param {String} timeString
*/
parseTimeType(timeString) {
if (timeString) {
let timeArr = timeString.split(":");
this.hour = Number(timeArr[0]);
this.minute = Number(timeArr[1]);
this.second = Number(timeArr[2]);
}
},
/**
* 解析选择器初始值,类型可以是字符串、时间戳,例如:2000-10-02、'08:30:00'、 1610695109000
* @param {String | Number} datetime
*/
initPickerValue(datetime) {
let defaultValue = null;
if (datetime) {
defaultValue = this.compareValueWithStartAndEnd(datetime, this.start, this.end);
} else {
defaultValue = Date.now();
defaultValue = this.compareValueWithStartAndEnd(defaultValue, this.start, this.end);
}
this.parseValue(defaultValue);
},
/**
* 初始值规则:
* - 用户设置初始值 value
* - 设置了起始时间 start、终止时间 end,并 start < value < end,初始值为 value, 否则初始值为 start
* - 只设置了起始时间 start,并 start < value,初始值为 value,否则初始值为 start
* - 只设置了终止时间 end,并 value < end,初始值为 value,否则初始值为 end
* - 无起始终止时间,则初始值为 value
* - 无初始值 value,则初始值为当前本地时间 Date.now()
* @param {Object} value
* @param {Object} dateBase
*/
compareValueWithStartAndEnd(value, start, end) {
let winner = null;
value = this.superTimeStamp(value);
start = this.superTimeStamp(start);
end = this.superTimeStamp(end);
if (start && end) {
if (value < start) {
winner = new Date(start);
} else if (value > end) {
winner = new Date(end);
} else {
winner = new Date(value);
}
} else if (start && !end) {
winner = start <= value ? new Date(value) : new Date(start);
} else if (!start && end) {
winner = value <= end ? new Date(value) : new Date(end);
} else {
winner = new Date(value);
}
return winner;
},
/**
* 转换为可比较的时间戳,接受日期、时分秒、时间戳
* @param {Object} value
*/
superTimeStamp(value) {
let dateBase = "";
if (this.type === "time" && value && typeof value === "string") {
const now = /* @__PURE__ */ new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
const day = now.getDate();
dateBase = year + "/" + month + "/" + day + " ";
}
if (Number(value)) {
value = parseInt(value);
dateBase = 0;
}
return this.createTimeStamp(dateBase + value);
},
/**
* 解析默认值 value,字符串、时间戳
* @param {Object} defaultTime
*/
parseValue(value) {
if (!value) {
return;
}
if (this.type === "time" && typeof value === "string") {
this.parseTimeType(value);
} else {
let defaultDate = null;
defaultDate = new Date(value);
if (this.type !== "time") {
this.year = defaultDate.getFullYear();
this.month = defaultDate.getMonth() + 1;
this.day = defaultDate.getDate();
}
if (this.type !== "date") {
this.hour = defaultDate.getHours();
this.minute = defaultDate.getMinutes();
this.second = defaultDate.getSeconds();
}
}
if (this.hideSecond) {
this.second = 0;
}
},
/**
* 解析可选择时间范围 start、end,年月日字符串、时间戳
* @param {Object} defaultTime
*/
parseDatetimeRange(point, pointType) {
if (!point) {
if (pointType === "start") {
this.startYear = 1920;
this.startMonth = 1;
this.startDay = 1;
this.startHour = 0;
this.startMinute = 0;
this.startSecond = 0;
}
if (pointType === "end") {
this.endYear = 2120;
this.endMonth = 12;
this.endDay = 31;
this.endHour = 23;
this.endMinute = 59;
this.endSecond = 59;
}
return;
}
if (this.type === "time") {
const pointArr = point.split(":");
this[pointType + "Hour"] = Number(pointArr[0]);
this[pointType + "Minute"] = Number(pointArr[1]);
this[pointType + "Second"] = Number(pointArr[2]);
} else {
if (!point) {
pointType === "start" ? this.startYear = this.year - 60 : this.endYear = this.year + 60;
return;
}
if (Number(point)) {
point = parseInt(point);
}
const hasTime = /[0-9]:[0-9]/;
if (this.type === "datetime" && pointType === "end" && typeof point === "string" && !hasTime.test(
point
)) {
point = point + " 23:59:59";
}
const pointDate = new Date(point);
this[pointType + "Year"] = pointDate.getFullYear();
this[pointType + "Month"] = pointDate.getMonth() + 1;
this[pointType + "Day"] = pointDate.getDate();
if (this.type === "datetime") {
this[pointType + "Hour"] = pointDate.getHours();
this[pointType + "Minute"] = pointDate.getMinutes();
this[pointType + "Second"] = pointDate.getSeconds();
}
}
},
// 获取 年、月、日、时、分、秒 当前可选范围
getCurrentRange(value) {
const range = [];
for (let i2 = this["min" + this.capitalize(value)]; i2 <= this["max" + this.capitalize(value)]; i2++) {
range.push(i2);
}
return range;
},
// 字符串首字母大写
capitalize(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
},
// 检查当前值是否在范围内,不在则当前值重置为可选范围第一项
checkValue(name, value, values) {
if (values.indexOf(value) === -1) {
this[name] = values[0];
}
},
// 每个月的实际天数
daysInMonth(year, month) {
return new Date(year, month, 0).getDate();
},
//兼容 iOS、safari 日期格式
fixIosDateFormat(value) {
if (typeof value === "string") {
value = value.replace(/-/g, "/");
}
return value;
},
/**
* 生成时间戳
* @param {Object} time
*/
createTimeStamp(time) {
if (!time)
return;
if (typeof time === "number") {
return time;
} else {
time = time.replace(/-/g, "/");
if (this.type === "date") {
time = time + " 00:00:00";
}
return Date.parse(time);
}
},
/**
* 生成日期或时间的字符串
*/
createDomSting() {
const yymmdd = this.year + "-" + this.lessThanTen(this.month) + "-" + this.lessThanTen(this.day);
let hhmmss = this.lessThanTen(this.hour) + ":" + this.lessThanTen(this.minute);
if (!this.hideSecond) {
hhmmss = hhmmss + ":" + this.lessThanTen(this.second);
}
if (this.type === "date") {
return yymmdd;
} else if (this.type === "time") {
return hhmmss;
} else {
return yymmdd + " " + hhmmss;
}
},
/**
* 初始化返回值,并抛出 change 事件
*/
initTime(emit = true) {
this.time = this.createDomSting();
if (!emit)
return;
if (this.returnType === "timestamp" && this.type !== "time") {
this.$emit("change", this.createTimeStamp(this.time));
this.$emit("input", this.createTimeStamp(this.time));
this.$emit("update:modelValue", this.createTimeStamp(this.time));
} else {
this.$emit("change", this.time);
this.$emit("input", this.time);
this.$emit("update:modelValue", this.time);
}
},
/**
* 用户选择日期或时间更新 data
* @param {Object} e
*/
bindDateChange(e2) {
const val = e2.detail.value;
this.year = this.years[val[0]];
this.month = this.months[val[1]];
this.day = this.days[val[2]];
},
bindTimeChange(e2) {
const val = e2.detail.value;
this.hour = this.hours[val[0]];
this.minute = this.minutes[val[1]];
this.second = this.seconds[val[2]];
},
/**
* 初始化弹出层
*/
initTimePicker() {
if (this.disabled)
return;
const value = fixIosDateFormat(this.time);
this.initPickerValue(value);
this.visible = !this.visible;
},
/**
* 触发或关闭弹框
*/
tiggerTimePicker(e2) {
this.visible = !this.visible;
},
/**
* 用户点击“清空”按钮,清空当前值
*/
clearTime() {
this.time = "";
this.$emit("change", this.time);
this.$emit("input", this.time);
this.$emit("update:modelValue", this.time);
this.tiggerTimePicker();
},
/**
* 用户点击“确定”按钮
*/
setTime() {
this.initTime();
this.tiggerTimePicker();
}
}
};
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-datetime-picker" }, [
vue.createElementVNode("view", {
onClick: _cache[0] || (_cache[0] = (...args) => $options.initTimePicker && $options.initTimePicker(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-datetime-picker-timebox-pointer", { "uni-datetime-picker-disabled": $props.disabled, "uni-datetime-picker-timebox": $props.border }])
},
[
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-text" },
vue.toDisplayString($data.time),
1
/* TEXT */
),
!$data.time ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-datetime-picker-time"
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-text" },
vue.toDisplayString($options.selectTimeText),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)
], true)
]),
$data.visible ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
id: "mask",
class: "uni-datetime-picker-mask",
onClick: _cache[1] || (_cache[1] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args))
})) : vue.createCommentVNode("v-if", true),
$data.visible ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: vue.normalizeClass(["uni-datetime-picker-popup", [$data.dateShow && $data.timeShow ? "" : "fix-nvue-height"]]),
style: vue.normalizeStyle($data.fixNvueBug)
},
[
vue.createElementVNode("view", { class: "uni-title" }, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-text" },
vue.toDisplayString($options.selectTimeText),
1
/* TEXT */
)
]),
$data.dateShow ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-datetime-picker__container-box"
}, [
vue.createElementVNode("picker-view", {
class: "uni-datetime-picker-view",
"indicator-style": $data.indicatorStyle,
value: $options.ymd,
onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args))
}, [
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.years, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.months, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.days, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
])
], 40, ["indicator-style", "value"]),
vue.createCommentVNode(" 兼容 nvue 不支持伪类 "),
vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-left" }, "-"),
vue.createElementVNode("text", { class: "uni-datetime-picker-sign sign-right" }, "-")
])) : vue.createCommentVNode("v-if", true),
$data.timeShow ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-datetime-picker__container-box"
}, [
vue.createElementVNode("picker-view", {
class: vue.normalizeClass(["uni-datetime-picker-view", [$props.hideSecond ? "time-hide-second" : ""]]),
"indicator-style": $data.indicatorStyle,
value: $options.hms,
onChange: _cache[3] || (_cache[3] = (...args) => $options.bindTimeChange && $options.bindTimeChange(...args))
}, [
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.hours, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("picker-view-column", null, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.minutes, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
!$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("picker-view-column", { key: 0 }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($options.seconds, (item, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-datetime-picker-item",
key: index
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-item" },
vue.toDisplayString($options.lessThanTen(item)),
1
/* TEXT */
)
]);
}),
128
/* KEYED_FRAGMENT */
))
])) : vue.createCommentVNode("v-if", true)
], 42, ["indicator-style", "value"]),
vue.createCommentVNode(" 兼容 nvue 不支持伪类 "),
vue.createElementVNode(
"text",
{
class: vue.normalizeClass(["uni-datetime-picker-sign", [$props.hideSecond ? "sign-center" : "sign-left"]])
},
":",
2
/* CLASS */
),
!$props.hideSecond ? (vue.openBlock(), vue.createElementBlock("text", {
key: 0,
class: "uni-datetime-picker-sign sign-right"
}, ":")) : vue.createCommentVNode("v-if", true)
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "uni-datetime-picker-btn" }, [
vue.createElementVNode("view", {
onClick: _cache[4] || (_cache[4] = (...args) => $options.clearTime && $options.clearTime(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-btn-text" },
vue.toDisplayString($options.clearText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-datetime-picker-btn-group" }, [
vue.createElementVNode("view", {
class: "uni-datetime-picker-cancel",
onClick: _cache[5] || (_cache[5] = (...args) => $options.tiggerTimePicker && $options.tiggerTimePicker(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-btn-text" },
vue.toDisplayString($options.cancelText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", {
onClick: _cache[6] || (_cache[6] = (...args) => $options.setTime && $options.setTime(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-datetime-picker-btn-text" },
vue.toDisplayString($options.okText),
1
/* TEXT */
)
])
])
])
],
6
/* CLASS, STYLE */
)) : vue.createCommentVNode("v-if", true)
]);
}
const TimePicker = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$b], ["__scopeId", "data-v-1d532b70"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue"]]);
const { t: t$3 } = initVueI18n(i18nMessages);
const _sfc_main$i = {
components: {
calendarItem,
timePicker: TimePicker
},
props: {
date: {
type: String,
default: ""
},
defTime: {
type: [String, Object],
default: ""
},
selectableTimes: {
type: [Object],
default() {
return {};
}
},
selected: {
type: Array,
default() {
return [];
}
},
startDate: {
type: String,
default: ""
},
endDate: {
type: String,
default: ""
},
startPlaceholder: {
type: String,
default: ""
},
endPlaceholder: {
type: String,
default: ""
},
range: {
type: Boolean,
default: false
},
hasTime: {
type: Boolean,
default: false
},
insert: {
type: Boolean,
default: true
},
showMonth: {
type: Boolean,
default: true
},
clearDate: {
type: Boolean,
default: true
},
checkHover: {
type: Boolean,
default: true
},
hideSecond: {
type: [Boolean],
default: false
},
pleStatus: {
type: Object,
default() {
return {
before: "",
after: "",
data: [],
fulldate: ""
};
}
},
defaultValue: {
type: [String, Object, Array],
default: ""
}
},
data() {
return {
show: false,
weeks: [],
calendar: {},
nowDate: {},
aniMaskShow: false,
firstEnter: true,
time: "",
timeRange: {
startTime: "",
endTime: ""
},
tempSingleDate: "",
tempRange: {
before: "",
after: ""
}
};
},
watch: {
date: {
immediate: true,
handler(newVal) {
if (!this.range) {
this.tempSingleDate = newVal;
setTimeout(() => {
this.init(newVal);
}, 100);
}
}
},
defTime: {
immediate: true,
handler(newVal) {
if (!this.range) {
this.time = newVal;
} else {
this.timeRange.startTime = newVal.start;
this.timeRange.endTime = newVal.end;
}
}
},
startDate(val) {
if (!this.cale) {
return;
}
this.cale.setStartDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
endDate(val) {
if (!this.cale) {
return;
}
this.cale.setEndDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
selected(newVal) {
if (!this.cale) {
return;
}
this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
this.weeks = this.cale.weeks;
},
pleStatus: {
immediate: true,
handler(newVal) {
const {
before,
after,
fulldate,
which
} = newVal;
this.tempRange.before = before;
this.tempRange.after = after;
setTimeout(() => {
if (fulldate) {
this.cale.setHoverMultiple(fulldate);
if (before && after) {
this.cale.lastHover = true;
if (this.rangeWithinMonth(after, before))
return;
this.setDate(before);
} else {
this.cale.setMultiple(fulldate);
this.setDate(this.nowDate.fullDate);
this.calendar.fullDate = "";
this.cale.lastHover = false;
}
} else {
if (!this.cale) {
return;
}
this.cale.setDefaultMultiple(before, after);
if (which === "left" && before) {
this.setDate(before);
this.weeks = this.cale.weeks;
} else if (after) {
this.setDate(after);
this.weeks = this.cale.weeks;
}
this.cale.lastHover = true;
}
}, 16);
}
}
},
computed: {
timepickerStartTime() {
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate;
return activeDate === this.startDate ? this.selectableTimes.start : "";
},
timepickerEndTime() {
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate;
return activeDate === this.endDate ? this.selectableTimes.end : "";
},
/**
* for i18n
*/
selectDateText() {
return t$3("uni-datetime-picker.selectDate");
},
startDateText() {
return this.startPlaceholder || t$3("uni-datetime-picker.startDate");
},
endDateText() {
return this.endPlaceholder || t$3("uni-datetime-picker.endDate");
},
okText() {
return t$3("uni-datetime-picker.ok");
},
yearText() {
return t$3("uni-datetime-picker.year");
},
monthText() {
return t$3("uni-datetime-picker.month");
},
MONText() {
return t$3("uni-calender.MON");
},
TUEText() {
return t$3("uni-calender.TUE");
},
WEDText() {
return t$3("uni-calender.WED");
},
THUText() {
return t$3("uni-calender.THU");
},
FRIText() {
return t$3("uni-calender.FRI");
},
SATText() {
return t$3("uni-calender.SAT");
},
SUNText() {
return t$3("uni-calender.SUN");
},
confirmText() {
return t$3("uni-calender.confirm");
}
},
created() {
this.cale = new Calendar$1({
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range
});
this.init(this.date);
},
methods: {
leaveCale() {
this.firstEnter = true;
},
handleMouse(weeks) {
if (weeks.disable)
return;
if (this.cale.lastHover)
return;
let {
before,
after
} = this.cale.multipleStatus;
if (!before)
return;
this.calendar = weeks;
this.cale.setHoverMultiple(this.calendar.fullDate);
this.weeks = this.cale.weeks;
if (this.firstEnter) {
this.$emit("firstEnterCale", this.cale.multipleStatus);
this.firstEnter = false;
}
},
rangeWithinMonth(A2, B2) {
const [yearA, monthA] = A2.split("-");
const [yearB, monthB] = B2.split("-");
return yearA === yearB && monthA === monthB;
},
// 蒙版点击事件
maskClick() {
this.close();
this.$emit("maskClose");
},
clearCalender() {
if (this.range) {
this.timeRange.startTime = "";
this.timeRange.endTime = "";
this.tempRange.before = "";
this.tempRange.after = "";
this.cale.multipleStatus.before = "";
this.cale.multipleStatus.after = "";
this.cale.multipleStatus.data = [];
this.cale.lastHover = false;
} else {
this.time = "";
this.tempSingleDate = "";
}
this.calendar.fullDate = "";
this.setDate(/* @__PURE__ */ new Date());
},
bindDateChange(e2) {
const value = e2.detail.value + "-1";
this.setDate(value);
},
/**
* 初始化日期显示
* @param {Object} date
*/
init(date) {
if (!this.cale) {
return;
}
this.cale.setDate(date || /* @__PURE__ */ new Date());
this.weeks = this.cale.weeks;
this.nowDate = this.cale.getInfo(date);
this.calendar = { ...this.nowDate };
if (!date) {
this.calendar.fullDate = "";
if (this.defaultValue && !this.range) {
const defaultDate = new Date(this.defaultValue);
const fullDate = getDate(defaultDate);
const year = defaultDate.getFullYear();
const month = defaultDate.getMonth() + 1;
const date2 = defaultDate.getDate();
const day = defaultDate.getDay();
this.calendar = {
fullDate,
year,
month,
date: date2,
day
}, this.tempSingleDate = fullDate;
this.time = getTime(defaultDate, this.hideSecond);
}
}
},
/**
* 打开日历弹窗
*/
open() {
if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus();
this.init(this.date);
}
this.show = true;
this.$nextTick(() => {
setTimeout(() => {
this.aniMaskShow = true;
}, 50);
});
},
/**
* 关闭日历弹窗
*/
close() {
this.aniMaskShow = false;
this.$nextTick(() => {
setTimeout(() => {
this.show = false;
this.$emit("close");
}, 300);
});
},
/**
* 确认按钮
*/
confirm() {
this.setEmit("confirm");
this.close();
},
/**
* 变化触发
*/
change() {
if (!this.insert)
return;
this.setEmit("change");
},
/**
* 选择月份触发
*/
monthSwitch() {
let {
year,
month
} = this.nowDate;
this.$emit("monthSwitch", {
year,
month: Number(month)
});
},
/**
* 派发事件
* @param {Object} name
*/
setEmit(name) {
if (!this.range) {
if (!this.calendar.fullDate) {
this.calendar = this.cale.getInfo(/* @__PURE__ */ new Date());
this.tempSingleDate = this.calendar.fullDate;
}
if (this.hasTime && !this.time) {
this.time = getTime(/* @__PURE__ */ new Date(), this.hideSecond);
}
}
let {
year,
month,
date,
fullDate,
extraInfo
} = this.calendar;
this.$emit(name, {
range: this.cale.multipleStatus,
year,
month,
date,
time: this.time,
timeRange: this.timeRange,
fulldate: fullDate,
extraInfo: extraInfo || {}
});
},
/**
* 选择天触发
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable)
return;
this.calendar = weeks;
this.calendar.userChecked = true;
this.cale.setMultiple(this.calendar.fullDate, true);
this.weeks = this.cale.weeks;
this.tempSingleDate = this.calendar.fullDate;
const beforeDate = new Date(this.cale.multipleStatus.before).getTime();
const afterDate = new Date(this.cale.multipleStatus.after).getTime();
if (beforeDate > afterDate && afterDate) {
this.tempRange.before = this.cale.multipleStatus.after;
this.tempRange.after = this.cale.multipleStatus.before;
} else {
this.tempRange.before = this.cale.multipleStatus.before;
this.tempRange.after = this.cale.multipleStatus.after;
}
this.change();
},
changeMonth(type) {
let newDate;
if (type === "pre") {
newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate;
} else if (type === "next") {
newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate;
}
this.setDate(newDate);
this.monthSwitch();
},
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.cale.setDate(date);
this.weeks = this.cale.weeks;
this.nowDate = this.cale.getInfo(date);
}
}
};
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
const _component_calendar_item = vue.resolveComponent("calendar-item");
const _component_time_picker = vue.resolveComponent("time-picker");
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
return vue.openBlock(), vue.createElementBlock(
"view",
{
class: "uni-calendar",
onMouseleave: _cache[9] || (_cache[9] = (...args) => $options.leaveCale && $options.leaveCale(...args))
},
[
!$props.insert && $data.show ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["uni-calendar__mask", { "uni-calendar--mask-show": $data.aniMaskShow }]),
onClick: _cache[0] || (_cache[0] = (...args) => $options.maskClick && $options.maskClick(...args))
},
null,
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true),
$props.insert || $data.show ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: vue.normalizeClass(["uni-calendar__content", { "uni-calendar--fixed": !$props.insert, "uni-calendar--ani-show": $data.aniMaskShow, "uni-calendar__content-mobile": $data.aniMaskShow }])
},
[
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-calendar__header", { "uni-calendar__header-mobile": !$props.insert }])
},
[
vue.createElementVNode("view", {
class: "uni-calendar__header-btn-box",
onClick: _cache[1] || (_cache[1] = vue.withModifiers(($event) => $options.changeMonth("pre"), ["stop"]))
}, [
vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--left" })
]),
vue.createElementVNode("picker", {
mode: "date",
value: $props.date,
fields: "month",
onChange: _cache[2] || (_cache[2] = (...args) => $options.bindDateChange && $options.bindDateChange(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__header-text" },
vue.toDisplayString(($data.nowDate.year || "") + $options.yearText + ($data.nowDate.month || "") + $options.monthText),
1
/* TEXT */
)
], 40, ["value"]),
vue.createElementVNode("view", {
class: "uni-calendar__header-btn-box",
onClick: _cache[3] || (_cache[3] = vue.withModifiers(($event) => $options.changeMonth("next"), ["stop"]))
}, [
vue.createElementVNode("view", { class: "uni-calendar__header-btn uni-calendar--right" })
]),
!$props.insert ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "dialog-close",
onClick: _cache[4] || (_cache[4] = (...args) => $options.close && $options.close(...args))
}, [
vue.createElementVNode("view", {
class: "dialog-close-plus",
"data-id": "close"
}),
vue.createElementVNode("view", {
class: "dialog-close-plus dialog-close-rotate",
"data-id": "close"
})
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
),
vue.createElementVNode("view", { class: "uni-calendar__box" }, [
$props.showMonth ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-calendar__box-bg"
}, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__box-bg-text" },
vue.toDisplayString($data.nowDate.month),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", {
class: "uni-calendar__weeks",
style: { "padding-bottom": "7px" }
}, [
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.SUNText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.MONText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.TUEText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.WEDText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.THUText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.FRIText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "uni-calendar__weeks-day" }, [
vue.createElementVNode(
"text",
{ class: "uni-calendar__weeks-day-text" },
vue.toDisplayString($options.SATText),
1
/* TEXT */
)
])
]),
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList($data.weeks, (item, weekIndex) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-calendar__weeks",
key: weekIndex
}, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(item, (weeks, weeksIndex) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "uni-calendar__weeks-item",
key: weeksIndex
}, [
vue.createVNode(_component_calendar_item, {
class: "uni-calendar-item--hook",
weeks,
calendar: $data.calendar,
selected: $props.selected,
checkHover: $props.range,
onChange: $options.choiceDate,
onHandleMouse: $options.handleMouse
}, null, 8, ["weeks", "calendar", "selected", "checkHover", "onChange", "onHandleMouse"])
]);
}),
128
/* KEYED_FRAGMENT */
))
]);
}),
128
/* KEYED_FRAGMENT */
))
]),
!$props.insert && !$props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-date-changed uni-calendar--fixed-top",
style: { "padding": "0 80px" }
}, [
vue.createElementVNode(
"view",
{ class: "uni-date-changed--time-date" },
vue.toDisplayString($data.tempSingleDate ? $data.tempSingleDate : $options.selectDateText),
1
/* TEXT */
),
vue.createVNode(_component_time_picker, {
type: "time",
start: $options.timepickerStartTime,
end: $options.timepickerEndTime,
modelValue: $data.time,
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.time = $event),
disabled: !$data.tempSingleDate,
border: false,
"hide-second": $props.hideSecond,
class: "time-picker-style"
}, null, 8, ["start", "end", "modelValue", "disabled", "hide-second"])
])) : vue.createCommentVNode("v-if", true),
!$props.insert && $props.range && $props.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-date-changed uni-calendar--fixed-top"
}, [
vue.createElementVNode("view", { class: "uni-date-changed--time-start" }, [
vue.createElementVNode(
"view",
{ class: "uni-date-changed--time-date" },
vue.toDisplayString($data.tempRange.before ? $data.tempRange.before : $options.startDateText),
1
/* TEXT */
),
vue.createVNode(_component_time_picker, {
type: "time",
start: $options.timepickerStartTime,
modelValue: $data.timeRange.startTime,
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => $data.timeRange.startTime = $event),
border: false,
"hide-second": $props.hideSecond,
disabled: !$data.tempRange.before,
class: "time-picker-style"
}, null, 8, ["start", "modelValue", "hide-second", "disabled"])
]),
vue.createElementVNode("view", { style: { "line-height": "50px" } }, [
vue.createVNode(_component_uni_icons, {
type: "arrowthinright",
color: "#999"
})
]),
vue.createElementVNode("view", { class: "uni-date-changed--time-end" }, [
vue.createElementVNode(
"view",
{ class: "uni-date-changed--time-date" },
vue.toDisplayString($data.tempRange.after ? $data.tempRange.after : $options.endDateText),
1
/* TEXT */
),
vue.createVNode(_component_time_picker, {
type: "time",
end: $options.timepickerEndTime,
modelValue: $data.timeRange.endTime,
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.timeRange.endTime = $event),
border: false,
"hide-second": $props.hideSecond,
disabled: !$data.tempRange.after,
class: "time-picker-style"
}, null, 8, ["end", "modelValue", "hide-second", "disabled"])
])
])) : vue.createCommentVNode("v-if", true),
!$props.insert ? (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "uni-date-changed uni-date-btn--ok"
}, [
vue.createElementVNode(
"view",
{
class: "uni-datetime-picker--btn",
onClick: _cache[8] || (_cache[8] = (...args) => $options.confirm && $options.confirm(...args))
},
vue.toDisplayString($options.confirmText),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true)
],
32
/* HYDRATE_EVENTS */
);
}
const Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$a], ["__scopeId", "data-v-1d379219"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue"]]);
const _sfc_main$h = {
name: "UniDatetimePicker",
options: {
virtualHost: true
},
components: {
Calendar,
TimePicker
},
data() {
return {
isRange: false,
hasTime: false,
displayValue: "",
inputDate: "",
calendarDate: "",
pickerTime: "",
calendarRange: {
startDate: "",
startTime: "",
endDate: "",
endTime: ""
},
displayRangeValue: {
startDate: "",
endDate: ""
},
tempRange: {
startDate: "",
startTime: "",
endDate: "",
endTime: ""
},
// 左右日历同步数据
startMultipleStatus: {
before: "",
after: "",
data: [],
fulldate: ""
},
endMultipleStatus: {
before: "",
after: "",
data: [],
fulldate: ""
},
pickerVisible: false,
pickerPositionStyle: null,
isEmitValue: false,
isPhone: false,
isFirstShow: true,
i18nT: () => {
}
};
},
props: {
type: {
type: String,
default: "datetime"
},
value: {
type: [String, Number, Array, Date],
default: ""
},
modelValue: {
type: [String, Number, Array, Date],
default: ""
},
start: {
type: [Number, String],
default: ""
},
end: {
type: [Number, String],
default: ""
},
returnType: {
type: String,
default: "string"
},
placeholder: {
type: String,
default: ""
},
startPlaceholder: {
type: String,
default: ""
},
endPlaceholder: {
type: String,
default: ""
},
rangeSeparator: {
type: String,
default: "-"
},
border: {
type: [Boolean],
default: true
},
disabled: {
type: [Boolean],
default: false
},
clearIcon: {
type: [Boolean],
default: true
},
hideSecond: {
type: [Boolean],
default: false
},
defaultValue: {
type: [String, Object, Array],
default: ""
}
},
watch: {
type: {
immediate: true,
handler(newVal) {
this.hasTime = newVal.indexOf("time") !== -1;
this.isRange = newVal.indexOf("range") !== -1;
}
},
modelValue: {
immediate: true,
handler(newVal) {
if (this.isEmitValue) {
this.isEmitValue = false;
return;
}
this.initPicker(newVal);
}
},
start: {
immediate: true,
handler(newVal) {
if (!newVal)
return;
this.calendarRange.startDate = getDate(newVal);
if (this.hasTime) {
this.calendarRange.startTime = getTime(newVal);
}
}
},
end: {
immediate: true,
handler(newVal) {
if (!newVal)
return;
this.calendarRange.endDate = getDate(newVal);
if (this.hasTime) {
this.calendarRange.endTime = getTime(newVal, this.hideSecond);
}
}
}
},
computed: {
timepickerStartTime() {
const activeDate = this.isRange ? this.tempRange.startDate : this.inputDate;
return activeDate === this.calendarRange.startDate ? this.calendarRange.startTime : "";
},
timepickerEndTime() {
const activeDate = this.isRange ? this.tempRange.endDate : this.inputDate;
return activeDate === this.calendarRange.endDate ? this.calendarRange.endTime : "";
},
mobileCalendarTime() {
const timeRange = {
start: this.tempRange.startTime,
end: this.tempRange.endTime
};
return this.isRange ? timeRange : this.pickerTime;
},
mobSelectableTime() {
return {
start: this.calendarRange.startTime,
end: this.calendarRange.endTime
};
},
datePopupWidth() {
return this.isRange ? 653 : 301;
},
/**
* for i18n
*/
singlePlaceholderText() {
return this.placeholder || (this.type === "date" ? this.selectDateText : this.selectDateTimeText);
},
startPlaceholderText() {
return this.startPlaceholder || this.startDateText;
},
endPlaceholderText() {
return this.endPlaceholder || this.endDateText;
},
selectDateText() {
return this.i18nT("uni-datetime-picker.selectDate");
},
selectDateTimeText() {
return this.i18nT("uni-datetime-picker.selectDateTime");
},
selectTimeText() {
return this.i18nT("uni-datetime-picker.selectTime");
},
startDateText() {
return this.startPlaceholder || this.i18nT("uni-datetime-picker.startDate");
},
startTimeText() {
return this.i18nT("uni-datetime-picker.startTime");
},
endDateText() {
return this.endPlaceholder || this.i18nT("uni-datetime-picker.endDate");
},
endTimeText() {
return this.i18nT("uni-datetime-picker.endTime");
},
okText() {
return this.i18nT("uni-datetime-picker.ok");
},
clearText() {
return this.i18nT("uni-datetime-picker.clear");
},
showClearIcon() {
return this.clearIcon && !this.disabled && (this.displayValue || this.displayRangeValue.startDate && this.displayRangeValue.endDate);
}
},
created() {
this.initI18nT();
this.platform();
},
methods: {
initI18nT() {
const vueI18n = initVueI18n(i18nMessages);
this.i18nT = vueI18n.t;
},
initPicker(newVal) {
if (!newVal && !this.defaultValue || Array.isArray(newVal) && !newVal.length) {
this.$nextTick(() => {
this.clear(false);
});
return;
}
if (!Array.isArray(newVal) && !this.isRange) {
if (newVal) {
this.displayValue = this.inputDate = this.calendarDate = getDate(newVal);
if (this.hasTime) {
this.pickerTime = getTime(newVal, this.hideSecond);
this.displayValue = `${this.displayValue} ${this.pickerTime}`;
}
} else if (this.defaultValue) {
this.inputDate = this.calendarDate = getDate(this.defaultValue);
if (this.hasTime) {
this.pickerTime = getTime(this.defaultValue, this.hideSecond);
}
}
} else {
const [before, after] = newVal;
if (!before && !after)
return;
const beforeDate = getDate(before);
const beforeTime = getTime(before, this.hideSecond);
const afterDate = getDate(after);
const afterTime = getTime(after, this.hideSecond);
const startDate = beforeDate;
const endDate = afterDate;
this.displayRangeValue.startDate = this.tempRange.startDate = startDate;
this.displayRangeValue.endDate = this.tempRange.endDate = endDate;
if (this.hasTime) {
this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`;
this.displayRangeValue.endDate = `${afterDate} ${afterTime}`;
this.tempRange.startTime = beforeTime;
this.tempRange.endTime = afterTime;
}
const defaultRange = {
before: beforeDate,
after: afterDate
};
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, {
which: "right"
});
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, defaultRange, {
which: "left"
});
}
},
updateLeftCale(e2) {
const left = this.$refs.left;
left.cale.setHoverMultiple(e2.after);
left.setDate(this.$refs.left.nowDate.fullDate);
},
updateRightCale(e2) {
const right = this.$refs.right;
right.cale.setHoverMultiple(e2.after);
right.setDate(this.$refs.right.nowDate.fullDate);
},
platform() {
if (typeof navigator !== "undefined") {
this.isPhone = navigator.userAgent.toLowerCase().indexOf("mobile") !== -1;
return;
}
const { windowWidth } = uni.getSystemInfoSync();
this.isPhone = windowWidth <= 500;
this.windowWidth = windowWidth;
},
show() {
if (this.disabled) {
return;
}
this.platform();
if (this.isPhone) {
setTimeout(() => {
this.$refs.mobile.open();
}, 0);
return;
}
this.pickerPositionStyle = {
top: "10px"
};
const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor");
dateEditor.boundingClientRect((rect) => {
if (this.windowWidth - rect.left < this.datePopupWidth) {
this.pickerPositionStyle.right = 0;
}
}).exec();
setTimeout(() => {
this.pickerVisible = !this.pickerVisible;
if (!this.isPhone && this.isRange && this.isFirstShow) {
this.isFirstShow = false;
const {
startDate,
endDate
} = this.calendarRange;
if (startDate && endDate) {
if (this.diffDate(startDate, endDate) < 30) {
this.$refs.right.changeMonth("pre");
}
} else {
this.$refs.right.changeMonth("next");
this.$refs.right.cale.lastHover = false;
}
}
}, 50);
},
close() {
setTimeout(() => {
this.pickerVisible = false;
this.$emit("maskClick", this.value);
this.$refs.mobile && this.$refs.mobile.close();
}, 20);
},
setEmit(value) {
if (this.returnType === "timestamp" || this.returnType === "date") {
if (!Array.isArray(value)) {
if (!this.hasTime) {
value = value + " 00:00:00";
}
value = this.createTimestamp(value);
if (this.returnType === "date") {
value = new Date(value);
}
} else {
if (!this.hasTime) {
value[0] = value[0] + " 00:00:00";
value[1] = value[1] + " 00:00:00";
}
value[0] = this.createTimestamp(value[0]);
value[1] = this.createTimestamp(value[1]);
if (this.returnType === "date") {
value[0] = new Date(value[0]);
value[1] = new Date(value[1]);
}
}
}
this.$emit("update:modelValue", value);
this.$emit("input", value);
this.$emit("change", value);
this.isEmitValue = true;
},
createTimestamp(date) {
date = fixIosDateFormat(date);
return Date.parse(new Date(date));
},
singleChange(e2) {
this.calendarDate = this.inputDate = e2.fulldate;
if (this.hasTime)
return;
this.confirmSingleChange();
},
confirmSingleChange() {
if (!checkDate(this.inputDate)) {
const now = /* @__PURE__ */ new Date();
this.calendarDate = this.inputDate = getDate(now);
this.pickerTime = getTime(now, this.hideSecond);
}
let startLaterInputDate = false;
let startDate, startTime;
if (this.start) {
let startString = this.start;
if (typeof this.start === "number") {
startString = getDateTime(this.start, this.hideSecond);
}
[startDate, startTime] = startString.split(" ");
if (this.start && !dateCompare(startDate, this.inputDate)) {
startLaterInputDate = true;
this.inputDate = startDate;
}
}
let endEarlierInputDate = false;
let endDate, endTime;
if (this.end) {
let endString = this.end;
if (typeof this.end === "number") {
endString = getDateTime(this.end, this.hideSecond);
}
[endDate, endTime] = endString.split(" ");
if (this.end && !dateCompare(this.inputDate, endDate)) {
endEarlierInputDate = true;
this.inputDate = endDate;
}
}
if (this.hasTime) {
if (startLaterInputDate) {
this.pickerTime = startTime || getDefaultSecond(this.hideSecond);
}
if (endEarlierInputDate) {
this.pickerTime = endTime || getDefaultSecond(this.hideSecond);
}
if (!this.pickerTime) {
this.pickerTime = getTime(Date.now(), this.hideSecond);
}
this.displayValue = `${this.inputDate} ${this.pickerTime}`;
} else {
this.displayValue = this.inputDate;
}
this.setEmit(this.displayValue);
this.pickerVisible = false;
},
leftChange(e2) {
const {
before,
after
} = e2.range;
this.rangeChange(before, after);
const obj = {
before: e2.range.before,
after: e2.range.after,
data: e2.range.data,
fulldate: e2.fulldate
};
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj);
},
rightChange(e2) {
const {
before,
after
} = e2.range;
this.rangeChange(before, after);
const obj = {
before: e2.range.before,
after: e2.range.after,
data: e2.range.data,
fulldate: e2.fulldate
};
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj);
},
mobileChange(e2) {
if (this.isRange) {
const { before, after } = e2.range;
if (!before || !after) {
return;
}
this.handleStartAndEnd(before, after, true);
if (this.hasTime) {
const {
startTime,
endTime
} = e2.timeRange;
this.tempRange.startTime = startTime;
this.tempRange.endTime = endTime;
}
this.confirmRangeChange();
} else {
if (this.hasTime) {
this.displayValue = e2.fulldate + " " + e2.time;
} else {
this.displayValue = e2.fulldate;
}
this.setEmit(this.displayValue);
}
this.$refs.mobile.close();
},
rangeChange(before, after) {
if (!(before && after))
return;
this.handleStartAndEnd(before, after, true);
if (this.hasTime)
return;
this.confirmRangeChange();
},
confirmRangeChange() {
if (!this.tempRange.startDate || !this.tempRange.endDate) {
this.pickerVisible = false;
return;
}
if (!checkDate(this.tempRange.startDate)) {
this.tempRange.startDate = getDate(Date.now());
}
if (!checkDate(this.tempRange.endDate)) {
this.tempRange.endDate = getDate(Date.now());
}
let start, end;
let startDateLaterRangeStartDate = false;
let startDateLaterRangeEndDate = false;
let startDate, startTime;
if (this.start) {
let startString = this.start;
if (typeof this.start === "number") {
startString = getDateTime(this.start, this.hideSecond);
}
[startDate, startTime] = startString.split(" ");
if (this.start && !dateCompare(this.start, this.tempRange.startDate)) {
startDateLaterRangeStartDate = true;
this.tempRange.startDate = startDate;
}
if (this.start && !dateCompare(this.start, this.tempRange.endDate)) {
startDateLaterRangeEndDate = true;
this.tempRange.endDate = startDate;
}
}
let endDateEarlierRangeStartDate = false;
let endDateEarlierRangeEndDate = false;
let endDate, endTime;
if (this.end) {
let endString = this.end;
if (typeof this.end === "number") {
endString = getDateTime(this.end, this.hideSecond);
}
[endDate, endTime] = endString.split(" ");
if (this.end && !dateCompare(this.tempRange.startDate, this.end)) {
endDateEarlierRangeStartDate = true;
this.tempRange.startDate = endDate;
}
if (this.end && !dateCompare(this.tempRange.endDate, this.end)) {
endDateEarlierRangeEndDate = true;
this.tempRange.endDate = endDate;
}
}
if (!this.hasTime) {
start = this.displayRangeValue.startDate = this.tempRange.startDate;
end = this.displayRangeValue.endDate = this.tempRange.endDate;
} else {
if (startDateLaterRangeStartDate) {
this.tempRange.startTime = startTime || getDefaultSecond(this.hideSecond);
} else if (endDateEarlierRangeStartDate) {
this.tempRange.startTime = endTime || getDefaultSecond(this.hideSecond);
}
if (!this.tempRange.startTime) {
this.tempRange.startTime = getTime(Date.now(), this.hideSecond);
}
if (startDateLaterRangeEndDate) {
this.tempRange.endTime = startTime || getDefaultSecond(this.hideSecond);
} else if (endDateEarlierRangeEndDate) {
this.tempRange.endTime = endTime || getDefaultSecond(this.hideSecond);
}
if (!this.tempRange.endTime) {
this.tempRange.endTime = getTime(Date.now(), this.hideSecond);
}
start = this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`;
end = this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`;
}
if (!dateCompare(start, end)) {
[start, end] = [end, start];
}
this.displayRangeValue.startDate = start;
this.displayRangeValue.endDate = end;
const displayRange = [start, end];
this.setEmit(displayRange);
this.pickerVisible = false;
},
handleStartAndEnd(before, after, temp = false) {
if (!(before && after))
return;
const type = temp ? "tempRange" : "range";
const isStartEarlierEnd = dateCompare(before, after);
this[type].startDate = isStartEarlierEnd ? before : after;
this[type].endDate = isStartEarlierEnd ? after : before;
},
/**
* 比较时间大小
*/
dateCompare(startDate, endDate) {
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
return startDate <= endDate;
},
/**
* 比较时间差
*/
diffDate(startDate, endDate) {
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
const diff = (endDate - startDate) / (24 * 60 * 60 * 1e3);
return Math.abs(diff);
},
clear(needEmit = true) {
if (!this.isRange) {
this.displayValue = "";
this.inputDate = "";
this.pickerTime = "";
if (this.isPhone) {
this.$refs.mobile && this.$refs.mobile.clearCalender();
} else {
this.$refs.pcSingle && this.$refs.pcSingle.clearCalender();
}
if (needEmit) {
this.$emit("change", "");
this.$emit("input", "");
this.$emit("update:modelValue", "");
}
} else {
this.displayRangeValue.startDate = "";
this.displayRangeValue.endDate = "";
this.tempRange.startDate = "";
this.tempRange.startTime = "";
this.tempRange.endDate = "";
this.tempRange.endTime = "";
if (this.isPhone) {
this.$refs.mobile && this.$refs.mobile.clearCalender();
} else {
this.$refs.left && this.$refs.left.clearCalender();
this.$refs.right && this.$refs.right.clearCalender();
this.$refs.right && this.$refs.right.changeMonth("next");
}
if (needEmit) {
this.$emit("change", []);
this.$emit("input", []);
this.$emit("update:modelValue", []);
}
}
}
}
};
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
const _component_time_picker = vue.resolveComponent("time-picker");
const _component_Calendar = vue.resolveComponent("Calendar");
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-date" }, [
vue.createElementVNode("view", {
class: "uni-date-editor",
onClick: _cache[1] || (_cache[1] = (...args) => $options.show && $options.show(...args))
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-date-editor--x", { "uni-date-editor--x__disabled": $props.disabled, "uni-date-x--border": $props.border }])
},
[
!$data.isRange ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-date-x uni-date-single"
}, [
vue.createVNode(_component_uni_icons, {
class: "icon-calendar",
type: "calendar",
color: "#c0c4cc",
size: "22"
}),
vue.createElementVNode(
"view",
{ class: "uni-date__x-input" },
vue.toDisplayString($data.displayValue || $options.singlePlaceholderText),
1
/* TEXT */
)
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-date-x uni-date-range"
}, [
vue.createVNode(_component_uni_icons, {
class: "icon-calendar",
type: "calendar",
color: "#c0c4cc",
size: "22"
}),
vue.createElementVNode(
"view",
{ class: "uni-date__x-input text-center" },
vue.toDisplayString($data.displayRangeValue.startDate || $options.startPlaceholderText),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "range-separator" },
vue.toDisplayString($props.rangeSeparator),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "uni-date__x-input text-center" },
vue.toDisplayString($data.displayRangeValue.endDate || $options.endPlaceholderText),
1
/* TEXT */
)
])),
$options.showClearIcon ? (vue.openBlock(), vue.createElementBlock("view", {
key: 2,
class: "uni-date__icon-clear",
onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => $options.clear && $options.clear(...args), ["stop"]))
}, [
vue.createVNode(_component_uni_icons, {
type: "clear",
color: "#c0c4cc",
size: "22"
})
])) : vue.createCommentVNode("v-if", true)
],
2
/* CLASS */
)
], true)
]),
vue.withDirectives(vue.createElementVNode(
"view",
{
class: "uni-date-mask--pc",
onClick: _cache[2] || (_cache[2] = (...args) => $options.close && $options.close(...args))
},
null,
512
/* NEED_PATCH */
), [
[vue.vShow, $data.pickerVisible]
]),
!$data.isPhone ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
ref: "datePicker",
class: "uni-date-picker__container"
},
[
!$data.isRange ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: "uni-date-single--x",
style: vue.normalizeStyle($data.pickerPositionStyle)
},
[
vue.createElementVNode("view", { class: "uni-popper__arrow" }),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-date-changed popup-x-header"
}, [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input text-center",
type: "text",
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $data.inputDate = $event),
placeholder: $options.selectDateText
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.inputDate]
]),
vue.createVNode(_component_time_picker, {
type: "time",
modelValue: $data.pickerTime,
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => $data.pickerTime = $event),
border: false,
disabled: !$data.inputDate,
start: $options.timepickerStartTime,
end: $options.timepickerEndTime,
hideSecond: $props.hideSecond,
style: { "width": "100%" }
}, {
default: vue.withCtx(() => [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input text-center",
type: "text",
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => $data.pickerTime = $event),
placeholder: $options.selectTimeText,
disabled: !$data.inputDate
}, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $data.pickerTime]
])
]),
_: 1
/* STABLE */
}, 8, ["modelValue", "disabled", "start", "end", "hideSecond"])
])) : vue.createCommentVNode("v-if", true),
vue.createVNode(_component_Calendar, {
ref: "pcSingle",
showMonth: false,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
date: $data.calendarDate,
onChange: $options.singleChange,
"default-value": $props.defaultValue,
style: { "padding": "0 8px" }
}, null, 8, ["start-date", "end-date", "date", "onChange", "default-value"]),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "popup-x-footer"
}, [
vue.createElementVNode(
"text",
{
class: "confirm-text",
onClick: _cache[6] || (_cache[6] = (...args) => $options.confirmSingleChange && $options.confirmSingleChange(...args))
},
vue.toDisplayString($options.okText),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)) : (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 1,
class: "uni-date-range--x",
style: vue.normalizeStyle($data.pickerPositionStyle)
},
[
vue.createElementVNode("view", { class: "uni-popper__arrow" }),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "popup-x-header uni-date-changed"
}, [
vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => $data.tempRange.startDate = $event),
placeholder: $options.startDateText
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.tempRange.startDate]
]),
vue.createVNode(_component_time_picker, {
type: "time",
modelValue: $data.tempRange.startTime,
"onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => $data.tempRange.startTime = $event),
start: $options.timepickerStartTime,
border: false,
disabled: !$data.tempRange.startDate,
hideSecond: $props.hideSecond
}, {
default: vue.withCtx(() => [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => $data.tempRange.startTime = $event),
placeholder: $options.startTimeText,
disabled: !$data.tempRange.startDate
}, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $data.tempRange.startTime]
])
]),
_: 1
/* STABLE */
}, 8, ["modelValue", "start", "disabled", "hideSecond"])
]),
vue.createVNode(_component_uni_icons, {
type: "arrowthinright",
color: "#999",
style: { "line-height": "40px" }
}),
vue.createElementVNode("view", { class: "popup-x-header--datetime" }, [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.tempRange.endDate = $event),
placeholder: $options.endDateText
}, null, 8, ["placeholder"]), [
[vue.vModelText, $data.tempRange.endDate]
]),
vue.createVNode(_component_time_picker, {
type: "time",
modelValue: $data.tempRange.endTime,
"onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => $data.tempRange.endTime = $event),
end: $options.timepickerEndTime,
border: false,
disabled: !$data.tempRange.endDate,
hideSecond: $props.hideSecond
}, {
default: vue.withCtx(() => [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-date__input uni-date-range__input",
type: "text",
"onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => $data.tempRange.endTime = $event),
placeholder: $options.endTimeText,
disabled: !$data.tempRange.endDate
}, null, 8, ["placeholder", "disabled"]), [
[vue.vModelText, $data.tempRange.endTime]
])
]),
_: 1
/* STABLE */
}, 8, ["modelValue", "end", "disabled", "hideSecond"])
])
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("view", { class: "popup-x-body" }, [
vue.createVNode(_component_Calendar, {
ref: "left",
showMonth: false,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
range: true,
pleStatus: $data.endMultipleStatus,
onChange: $options.leftChange,
onFirstEnterCale: $options.updateRightCale,
style: { "padding": "0 8px" }
}, null, 8, ["start-date", "end-date", "pleStatus", "onChange", "onFirstEnterCale"]),
vue.createVNode(_component_Calendar, {
ref: "right",
showMonth: false,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
range: true,
onChange: $options.rightChange,
pleStatus: $data.startMultipleStatus,
onFirstEnterCale: $options.updateLeftCale,
style: { "padding": "0 8px", "border-left": "1px solid #F1F1F1" }
}, null, 8, ["start-date", "end-date", "onChange", "pleStatus", "onFirstEnterCale"])
]),
$data.hasTime ? (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "popup-x-footer"
}, [
vue.createElementVNode(
"text",
{
onClick: _cache[13] || (_cache[13] = (...args) => $options.clear && $options.clear(...args))
},
vue.toDisplayString($options.clearText),
1
/* TEXT */
),
vue.createElementVNode(
"text",
{
class: "confirm-text",
onClick: _cache[14] || (_cache[14] = (...args) => $options.confirmRangeChange && $options.confirmRangeChange(...args))
},
vue.toDisplayString($options.okText),
1
/* TEXT */
)
])) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
))
],
512
/* NEED_PATCH */
)), [
[vue.vShow, $data.pickerVisible]
]) : vue.createCommentVNode("v-if", true),
$data.isPhone ? (vue.openBlock(), vue.createBlock(_component_Calendar, {
key: 1,
ref: "mobile",
clearDate: false,
date: $data.calendarDate,
defTime: $options.mobileCalendarTime,
"start-date": $data.calendarRange.startDate,
"end-date": $data.calendarRange.endDate,
selectableTimes: $options.mobSelectableTime,
startPlaceholder: $props.startPlaceholder,
endPlaceholder: $props.endPlaceholder,
"default-value": $props.defaultValue,
pleStatus: $data.endMultipleStatus,
showMonth: false,
range: $data.isRange,
hasTime: $data.hasTime,
insert: false,
hideSecond: $props.hideSecond,
onConfirm: $options.mobileChange,
onMaskClose: $options.close
}, null, 8, ["date", "defTime", "start-date", "end-date", "selectableTimes", "startPlaceholder", "endPlaceholder", "default-value", "pleStatus", "range", "hasTime", "hideSecond", "onConfirm", "onMaskClose"])) : vue.createCommentVNode("v-if", true)
]);
}
const __easycom_1$1 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$9], ["__scopeId", "data-v-9802168a"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue"]]);
const _sfc_main$g = {
name: "UniTag",
emits: ["click"],
props: {
type: {
// 标签类型default、primary、success、warning、error、royal
type: String,
default: "default"
},
size: {
// 标签大小 normal, small
type: String,
default: "normal"
},
// 标签内容
text: {
type: String,
default: ""
},
disabled: {
// 是否为禁用状态
type: [Boolean, String],
default: false
},
inverted: {
// 是否为空心
type: [Boolean, String],
default: false
},
circle: {
// 是否为圆角样式
type: [Boolean, String],
default: false
},
mark: {
// 是否为标记样式
type: [Boolean, String],
default: false
},
customStyle: {
type: String,
default: ""
}
},
computed: {
classes() {
const {
type,
disabled,
inverted,
circle,
mark,
size,
isTrue
} = this;
const classArr = [
"uni-tag--" + type,
"uni-tag--" + size,
isTrue(disabled) ? "uni-tag--disabled" : "",
isTrue(inverted) ? "uni-tag--" + type + "--inverted" : "",
isTrue(circle) ? "uni-tag--circle" : "",
isTrue(mark) ? "uni-tag--mark" : "",
// type === 'default' ? 'uni-tag--default' : 'uni-tag-text',
isTrue(inverted) ? "uni-tag--inverted uni-tag-text--" + type : "",
size === "small" ? "uni-tag-text--small" : ""
];
return classArr.join(" ");
}
},
methods: {
isTrue(value) {
return value === true || value === "true";
},
onClick() {
if (this.isTrue(this.disabled))
return;
this.$emit("click");
}
}
};
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
return $props.text ? (vue.openBlock(), vue.createElementBlock(
"text",
{
key: 0,
class: vue.normalizeClass(["uni-tag", $options.classes]),
style: vue.normalizeStyle($props.customStyle),
onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
},
vue.toDisplayString($props.text),
7
/* TEXT, CLASS, STYLE */
)) : vue.createCommentVNode("v-if", true);
}
const __easycom_2 = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$8], ["__scopeId", "data-v-1f94d070"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-tag/components/uni-tag/uni-tag.vue"]]);
const popup = {
data() {
return {};
},
created() {
this.popup = this.getParent();
},
methods: {
/**
* 获取父元素实例
*/
getParent(name = "uniPopup") {
let parent = this.$parent;
let parentName = parent.$options.name;
while (parentName !== name) {
parent = parent.$parent;
if (!parent)
return false;
parentName = parent.$options.name;
}
return parent;
}
}
};
const en = {
"uni-popup.cancel": "cancel",
"uni-popup.ok": "ok",
"uni-popup.placeholder": "pleace enter",
"uni-popup.title": "Hint",
"uni-popup.shareTitle": "Share to"
};
const zhHans = {
"uni-popup.cancel": "取消",
"uni-popup.ok": "确定",
"uni-popup.placeholder": "请输入",
"uni-popup.title": "提示",
"uni-popup.shareTitle": "分享到"
};
const zhHant = {
"uni-popup.cancel": "取消",
"uni-popup.ok": "確定",
"uni-popup.placeholder": "請輸入",
"uni-popup.title": "提示",
"uni-popup.shareTitle": "分享到"
};
const messages = {
en,
"zh-Hans": zhHans,
"zh-Hant": zhHant
};
const { t: t$2 } = initVueI18n(messages);
const _sfc_main$f = {
name: "uniPopupDialog",
mixins: [popup],
emits: ["confirm", "close"],
props: {
inputType: {
type: String,
default: "text"
},
value: {
type: [String, Number],
default: ""
},
placeholder: {
type: [String, Number],
default: ""
},
type: {
type: String,
default: "error"
},
mode: {
type: String,
default: "base"
},
title: {
type: String,
default: ""
},
content: {
type: String,
default: ""
},
beforeClose: {
type: Boolean,
default: false
},
cancelText: {
type: String,
default: ""
},
confirmText: {
type: String,
default: ""
}
},
data() {
return {
dialogType: "error",
focus: false,
val: ""
};
},
computed: {
okText() {
return this.confirmText || t$2("uni-popup.ok");
},
closeText() {
return this.cancelText || t$2("uni-popup.cancel");
},
placeholderText() {
return this.placeholder || t$2("uni-popup.placeholder");
},
titleText() {
return this.title || t$2("uni-popup.title");
}
},
watch: {
type(val) {
this.dialogType = val;
},
mode(val) {
if (val === "input") {
this.dialogType = "info";
}
},
value(val) {
this.val = val;
}
},
created() {
this.popup.disableMask();
if (this.mode === "input") {
this.dialogType = "info";
this.val = this.value;
} else {
this.dialogType = this.type;
}
},
mounted() {
this.focus = true;
},
methods: {
/**
* 点击确认按钮
*/
onOk() {
if (this.mode === "input") {
this.$emit("confirm", this.val);
} else {
this.$emit("confirm");
}
if (this.beforeClose)
return;
this.popup.close();
},
/**
* 点击取消按钮
*/
closeDialog() {
this.$emit("close");
if (this.beforeClose)
return;
this.popup.close();
},
close() {
this.popup.close();
}
}
};
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
return vue.openBlock(), vue.createElementBlock("view", { class: "uni-popup-dialog" }, [
vue.createElementVNode("view", { class: "uni-dialog-title" }, [
vue.createElementVNode(
"text",
{
class: vue.normalizeClass(["uni-dialog-title-text", ["uni-popup__" + $data.dialogType]])
},
vue.toDisplayString($options.titleText),
3
/* TEXT, CLASS */
)
]),
$props.mode === "base" ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "uni-dialog-content"
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.createElementVNode(
"text",
{ class: "uni-dialog-content-text" },
vue.toDisplayString($props.content),
1
/* TEXT */
)
], true)
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "uni-dialog-content"
}, [
vue.renderSlot(_ctx.$slots, "default", {}, () => [
vue.withDirectives(vue.createElementVNode("input", {
class: "uni-dialog-input",
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $data.val = $event),
type: $props.inputType,
placeholder: $options.placeholderText,
focus: $data.focus
}, null, 8, ["type", "placeholder", "focus"]), [
[vue.vModelDynamic, $data.val]
])
], true)
])),
vue.createElementVNode("view", { class: "uni-dialog-button-group" }, [
vue.createElementVNode("view", {
class: "uni-dialog-button",
onClick: _cache[1] || (_cache[1] = (...args) => $options.closeDialog && $options.closeDialog(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-dialog-button-text" },
vue.toDisplayString($options.closeText),
1
/* TEXT */
)
]),
vue.createElementVNode("view", {
class: "uni-dialog-button uni-border-left",
onClick: _cache[2] || (_cache[2] = (...args) => $options.onOk && $options.onOk(...args))
}, [
vue.createElementVNode(
"text",
{ class: "uni-dialog-button-text uni-button-color" },
vue.toDisplayString($options.okText),
1
/* TEXT */
)
])
])
]);
}
const __easycom_4 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$7], ["__scopeId", "data-v-d78c88b7"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue"]]);
class MPAnimation {
constructor(options, _this) {
this.options = options;
this.animation = uni.createAnimation({
...options
});
this.currentStepAnimates = {};
this.next = 0;
this.$ = _this;
}
_nvuePushAnimates(type, args) {
let aniObj = this.currentStepAnimates[this.next];
let styles = {};
if (!aniObj) {
styles = {
styles: {},
config: {}
};
} else {
styles = aniObj;
}
if (animateTypes1.includes(type)) {
if (!styles.styles.transform) {
styles.styles.transform = "";
}
let unit = "";
if (type === "rotate") {
unit = "deg";
}
styles.styles.transform += `${type}(${args + unit}) `;
} else {
styles.styles[type] = `${args}`;
}
this.currentStepAnimates[this.next] = styles;
}
_animateRun(styles = {}, config = {}) {
let ref = this.$.$refs["ani"].ref;
if (!ref)
return;
return new Promise((resolve, reject) => {
nvueAnimation.transition(ref, {
styles,
...config
}, (res) => {
resolve();
});
});
}
_nvueNextAnimate(animates, step = 0, fn) {
let obj = animates[step];
if (obj) {
let {
styles,
config
} = obj;
this._animateRun(styles, config).then(() => {
step += 1;
this._nvueNextAnimate(animates, step, fn);
});
} else {
this.currentStepAnimates = {};
typeof fn === "function" && fn();
this.isEnd = true;
}
}
step(config = {}) {
this.animation.step(config);
return this;
}
run(fn) {
this.$.animationData = this.animation.export();
this.$.timer = setTimeout(() => {
typeof fn === "function" && fn();
}, this.$.durationTime);
}
}
const animateTypes1 = [
"matrix",
"matrix3d",
"rotate",
"rotate3d",
"rotateX",
"rotateY",
"rotateZ",
"scale",
"scale3d",
"scaleX",
"scaleY",
"scaleZ",
"skew",
"skewX",
"skewY",
"translate",
"translate3d",
"translateX",
"translateY",
"translateZ"
];
const animateTypes2 = ["opacity", "backgroundColor"];
const animateTypes3 = ["width", "height", "left", "right", "top", "bottom"];
animateTypes1.concat(animateTypes2, animateTypes3).forEach((type) => {
MPAnimation.prototype[type] = function(...args) {
this.animation[type](...args);
return this;
};
});
function createAnimation(option, _this) {
if (!_this)
return;
clearTimeout(_this.timer);
return new MPAnimation(option, _this);
}
const _sfc_main$e = {
name: "uniTransition",
emits: ["click", "change"],
props: {
show: {
type: Boolean,
default: false
},
modeClass: {
type: [Array, String],
default() {
return "fade";
}
},
duration: {
type: Number,
default: 300
},
styles: {
type: Object,
default() {
return {};
}
},
customClass: {
type: String,
default: ""
},
onceRender: {
type: Boolean,
default: false
}
},
data() {
return {
isShow: false,
transform: "",
opacity: 1,
animationData: {},
durationTime: 300,
config: {}
};
},
watch: {
show: {
handler(newVal) {
if (newVal) {
this.open();
} else {
if (this.isShow) {
this.close();
}
}
},
immediate: true
}
},
computed: {
// 生成样式数据
stylesObject() {
let styles = {
...this.styles,
"transition-duration": this.duration / 1e3 + "s"
};
let transform = "";
for (let i2 in styles) {
let line = this.toLine(i2);
transform += line + ":" + styles[i2] + ";";
}
return transform;
},
// 初始化动画条件
transformStyles() {
return "transform:" + this.transform + ";opacity:" + this.opacity + ";" + this.stylesObject;
}
},
created() {
this.config = {
duration: this.duration,
timingFunction: "ease",
transformOrigin: "50% 50%",
delay: 0
};
this.durationTime = this.duration;
},
methods: {
/**
* ref 触发 初始化动画
*/
init(obj = {}) {
if (obj.duration) {
this.durationTime = obj.duration;
}
this.animation = createAnimation(Object.assign(this.config, obj), this);
},
/**
* 点击组件触发回调
*/
onClick() {
this.$emit("click", {
detail: this.isShow
});
},
/**
* ref 触发 动画分组
* @param {Object} obj
*/
step(obj, config = {}) {
if (!this.animation)
return;
for (let i2 in obj) {
try {
if (typeof obj[i2] === "object") {
this.animation[i2](...obj[i2]);
} else {
this.animation[i2](obj[i2]);
}
} catch (e2) {
formatAppLog("error", "at uni_modules/uni-transition/components/uni-transition/uni-transition.vue:148", `方法 ${i2} 不存在`);
}
}
this.animation.step(config);
return this;
},
/**
* ref 触发 执行动画
*/
run(fn) {
if (!this.animation)
return;
this.animation.run(fn);
},
// 开始过度动画
open() {
clearTimeout(this.timer);
this.transform = "";
this.isShow = true;
let { opacity, transform } = this.styleInit(false);
if (typeof opacity !== "undefined") {
this.opacity = opacity;
}
this.transform = transform;
this.$nextTick(() => {
this.timer = setTimeout(() => {
this.animation = createAnimation(this.config, this);
this.tranfromInit(false).step();
this.animation.run();
this.$emit("change", {
detail: this.isShow
});
}, 20);
});
},
// 关闭过度动画
close(type) {
if (!this.animation)
return;
this.tranfromInit(true).step().run(() => {
this.isShow = false;
this.animationData = null;
this.animation = null;
let { opacity, transform } = this.styleInit(false);
this.opacity = opacity || 1;
this.transform = transform;
this.$emit("change", {
detail: this.isShow
});
});
},
// 处理动画开始前的默认样式
styleInit(type) {
let styles = {
transform: ""
};
let buildStyle = (type2, mode) => {
if (mode === "fade") {
styles.opacity = this.animationType(type2)[mode];
} else {
styles.transform += this.animationType(type2)[mode] + " ";
}
};
if (typeof this.modeClass === "string") {
buildStyle(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildStyle(type, mode);
});
}
return styles;
},
// 处理内置组合动画
tranfromInit(type) {
let buildTranfrom = (type2, mode) => {
let aniNum = null;
if (mode === "fade") {
aniNum = type2 ? 0 : 1;
} else {
aniNum = type2 ? "-100%" : "0";
if (mode === "zoom-in") {
aniNum = type2 ? 0.8 : 1;
}
if (mode === "zoom-out") {
aniNum = type2 ? 1.2 : 1;
}
if (mode === "slide-right") {
aniNum = type2 ? "100%" : "0";
}
if (mode === "slide-bottom") {
aniNum = type2 ? "100%" : "0";
}
}
this.animation[this.animationMode()[mode]](aniNum);
};
if (typeof this.modeClass === "string") {
buildTranfrom(type, this.modeClass);
} else {
this.modeClass.forEach((mode) => {
buildTranfrom(type, mode);
});
}
return this.animation;
},
animationType(type) {
return {
fade: type ? 1 : 0,
"slide-top": `translateY(${type ? "0" : "-100%"})`,
"slide-right": `translateX(${type ? "0" : "100%"})`,
"slide-bottom": `translateY(${type ? "0" : "100%"})`,
"slide-left": `translateX(${type ? "0" : "-100%"})`,
"zoom-in": `scaleX(${type ? 1 : 0.8}) scaleY(${type ? 1 : 0.8})`,
"zoom-out": `scaleX(${type ? 1 : 1.2}) scaleY(${type ? 1 : 1.2})`
};
},
// 内置动画类型与实际动画对应字典
animationMode() {
return {
fade: "opacity",
"slide-top": "translateY",
"slide-right": "translateX",
"slide-bottom": "translateY",
"slide-left": "translateX",
"zoom-in": "scale",
"zoom-out": "scale"
};
},
// 驼峰转中横线
toLine(name) {
return name.replace(/([A-Z])/g, "-$1").toLowerCase();
}
}
};
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
ref: "ani",
animation: $data.animationData,
class: vue.normalizeClass($props.customClass),
style: vue.normalizeStyle($options.transformStyles),
onClick: _cache[0] || (_cache[0] = (...args) => $options.onClick && $options.onClick(...args))
}, [
vue.renderSlot(_ctx.$slots, "default")
], 14, ["animation"])), [
[vue.vShow, $data.isShow]
]);
}
const __easycom_0$1 = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$6], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-transition/components/uni-transition/uni-transition.vue"]]);
const _sfc_main$d = {
name: "uniPopup",
components: {},
emits: ["change", "maskClick"],
props: {
// 开启动画
animation: {
type: Boolean,
default: true
},
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
// message: 消息提示 ; dialog : 对话框
type: {
type: String,
default: "center"
},
// maskClick
isMaskClick: {
type: Boolean,
default: null
},
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
maskClick: {
type: Boolean,
default: null
},
backgroundColor: {
type: String,
default: "none"
},
safeArea: {
type: Boolean,
default: true
},
maskBackgroundColor: {
type: String,
default: "rgba(0, 0, 0, 0.4)"
}
},
watch: {
/**
* 监听type类型
*/
type: {
handler: function(type) {
if (!this.config[type])
return;
this[this.config[type]](true);
},
immediate: true
},
isDesktop: {
handler: function(newVal) {
if (!this.config[newVal])
return;
this[this.config[this.type]](true);
},
immediate: true
},
/**
* 监听遮罩是否可点击
* @param {Object} val
*/
maskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
isMaskClick: {
handler: function(val) {
this.mkclick = val;
},
immediate: true
},
// H5 下禁止底部滚动
showPopup(show) {
}
},
data() {
return {
duration: 300,
ani: [],
showPopup: false,
showTrans: false,
popupWidth: 0,
popupHeight: 0,
config: {
top: "top",
bottom: "bottom",
center: "center",
left: "left",
right: "right",
message: "top",
dialog: "center",
share: "bottom"
},
maskClass: {
position: "fixed",
bottom: 0,
top: 0,
left: 0,
right: 0,
backgroundColor: "rgba(0, 0, 0, 0.4)"
},
transClass: {
position: "fixed",
left: 0,
right: 0
},
maskShow: true,
mkclick: true,
popupstyle: this.isDesktop ? "fixforpc-top" : "top"
};
},
computed: {
isDesktop() {
return this.popupWidth >= 500 && this.popupHeight >= 500;
},
bg() {
if (this.backgroundColor === "" || this.backgroundColor === "none") {
return "transparent";
}
return this.backgroundColor;
}
},
mounted() {
const fixSize = () => {
const {
windowWidth,
windowHeight,
windowTop,
safeArea,
screenHeight,
safeAreaInsets
} = uni.getSystemInfoSync();
this.popupWidth = windowWidth;
this.popupHeight = windowHeight + (windowTop || 0);
if (safeArea && this.safeArea) {
this.safeAreaInsets = safeAreaInsets.bottom;
} else {
this.safeAreaInsets = 0;
}
};
fixSize();
},
// TODO vue3
unmounted() {
this.setH5Visible();
},
created() {
if (this.isMaskClick === null && this.maskClick === null) {
this.mkclick = true;
} else {
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick;
}
if (this.animation) {
this.duration = 300;
} else {
this.duration = 0;
}
this.messageChild = null;
this.clearPropagation = false;
this.maskClass.backgroundColor = this.maskBackgroundColor;
},
methods: {
setH5Visible() {
},
/**
* 公用方法,不显示遮罩层
*/
closeMask() {
this.maskShow = false;
},
/**
* 公用方法,遮罩层禁止点击
*/
disableMask() {
this.mkclick = false;
},
// TODO nvue 取消冒泡
clear(e2) {
e2.stopPropagation();
this.clearPropagation = true;
},
open(direction) {
if (this.showPopup) {
return;
}
let innerType = ["top", "center", "bottom", "left", "right", "message", "dialog", "share"];
if (!(direction && innerType.indexOf(direction) !== -1)) {
direction = this.type;
}
if (!this.config[direction]) {
formatAppLog("error", "at uni_modules/uni-popup/components/uni-popup/uni-popup.vue:279", "缺少类型:", direction);
return;
}
this[this.config[direction]]();
this.$emit("change", {
show: true,
type: direction
});
},
close(type) {
this.showTrans = false;
this.$emit("change", {
show: false,
type: this.type
});
clearTimeout(this.timer);
this.timer = setTimeout(() => {
this.showPopup = false;
}, 300);
},
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
touchstart() {
this.clearPropagation = false;
},
onTap() {
if (this.clearPropagation) {
this.clearPropagation = false;
return;
}
this.$emit("maskClick");
if (!this.mkclick)
return;
this.close();
},
/**
* 顶部弹出样式处理
*/
top(type) {
this.popupstyle = this.isDesktop ? "fixforpc-top" : "top";
this.ani = ["slide-top"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
backgroundColor: this.bg
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
this.$nextTick(() => {
if (this.messageChild && this.type === "message") {
this.messageChild.timerClose();
}
});
},
/**
* 底部弹出样式处理
*/
bottom(type) {
this.popupstyle = "bottom";
this.ani = ["slide-bottom"];
this.transClass = {
position: "fixed",
left: 0,
right: 0,
bottom: 0,
paddingBottom: this.safeAreaInsets + "px",
backgroundColor: this.bg
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
/**
* 中间弹出样式处理
*/
center(type) {
this.popupstyle = "center";
this.ani = ["zoom-out", "fade"];
this.transClass = {
position: "fixed",
display: "flex",
flexDirection: "column",
bottom: 0,
left: 0,
right: 0,
top: 0,
justifyContent: "center",
alignItems: "center"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
left(type) {
this.popupstyle = "left";
this.ani = ["slide-left"];
this.transClass = {
position: "fixed",
left: 0,
bottom: 0,
top: 0,
backgroundColor: this.bg,
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
},
right(type) {
this.popupstyle = "right";
this.ani = ["slide-right"];
this.transClass = {
position: "fixed",
bottom: 0,
right: 0,
top: 0,
backgroundColor: this.bg,
display: "flex",
flexDirection: "column"
};
if (type)
return;
this.showPopup = true;
this.showTrans = true;
}
}
};
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
const _component_uni_transition = resolveEasycom(vue.resolveDynamicComponent("uni-transition"), __easycom_0$1);
return $data.showPopup ? (vue.openBlock(), vue.createElementBlock(
"view",
{
key: 0,
class: vue.normalizeClass(["uni-popup", [$data.popupstyle, $options.isDesktop ? "fixforpc-z-index" : ""]])
},
[
vue.createElementVNode(
"view",
{
onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.touchstart && $options.touchstart(...args))
},
[
$data.maskShow ? (vue.openBlock(), vue.createBlock(_component_uni_transition, {
key: "1",
name: "mask",
"mode-class": "fade",
styles: $data.maskClass,
duration: $data.duration,
show: $data.showTrans,
onClick: $options.onTap
}, null, 8, ["styles", "duration", "show", "onClick"])) : vue.createCommentVNode("v-if", true),
vue.createVNode(_component_uni_transition, {
key: "2",
"mode-class": $data.ani,
name: "content",
styles: $data.transClass,
duration: $data.duration,
show: $data.showTrans,
onClick: $options.onTap
}, {
default: vue.withCtx(() => [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["uni-popup__wrapper", [$data.popupstyle]]),
style: vue.normalizeStyle({ backgroundColor: $options.bg }),
onClick: _cache[0] || (_cache[0] = (...args) => $options.clear && $options.clear(...args))
},
[
vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
],
6
/* CLASS, STYLE */
)
]),
_: 3
/* FORWARDED */
}, 8, ["mode-class", "styles", "duration", "show", "onClick"])
],
32
/* HYDRATE_EVENTS */
)
],
2
/* CLASS */
)) : vue.createCommentVNode("v-if", true);
}
const __easycom_5 = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$5], ["__scopeId", "data-v-4dd3c44b"], ["__file", "/Users/sunwubin/source/pharmacy/uni_modules/uni-popup/components/uni-popup/uni-popup.vue"]]);
const __default__$4 = {
name: "NavBar"
};
const _sfc_main$c = /* @__PURE__ */ Object.assign(__default__$4, {
props: {
userInfo: {
default: function() {
return {};
},
type: Object
}
},
emits: ["updateUser"],
setup(__props, { emit }) {
const props = __props;
const { proxy } = vue.getCurrentInstance();
formatAppLog("log", "at components/nav-bar/nav-bar.vue:54", "props.userInfo.workStatus", props.userInfo.workStatus);
vue.onMounted(() => {
});
const dialogToggle = () => {
proxy.$refs.alertDialog.open();
};
const dialogConfirm = () => {
handleChange();
};
const dialogClose = () => {
formatAppLog("log", "at components/nav-bar/nav-bar.vue:69", "guanbi");
};
const handleChange = async () => {
formatAppLog("log", "at components/nav-bar/nav-bar.vue:74", "props.userInfo.workStatus》》》", props.userInfo.workStatus);
uni.getStorageSync("token");
const userId = uni.getStorageSync("userId");
if (props.userInfo.workStatus) {
const params2 = {
token: uni.getStorageSync("token"),
data: {
pharmacistUserId: userId,
workStatus: props.userInfo.workStatus === "1" ? "0" : "1"
}
};
formatAppLog("log", "at components/nav-bar/nav-bar.vue:85", "params.data.workStatus", params2);
const { data: res } = await updateWorkStatus(params2);
if (res.code === 200) {
uni.setStorageSync("workStatus", params2.data.workStatus);
emit("updateUser", params2.data.workStatus);
}
emit("updateUser", props.userInfo.workStatus);
}
};
const handleScanbara = () => {
uni.scanCode({
scanType: ["barCode"],
success: function(res) {
formatAppLog("log", "at components/nav-bar/nav-bar.vue:101", "条码类型:" + res.scanType);
formatAppLog("log", "at components/nav-bar/nav-bar.vue:102", "条码内容:" + res.result);
if (res.result) {
uni.navigateTo({
url: `/pages/review/review?preNo=${res.result}&depolyStatus=2`
});
}
}
});
};
const handleLogout = async () => {
formatAppLog("log", "at components/nav-bar/nav-bar.vue:113", "handleLogout", 555);
const tokens = uni.getStorageSync("token");
const userId = uni.getStorageSync("userId");
const params2 = {
token: tokens,
data: {
pharmacistUserId: userId,
onlineStatus: 1
}
};
await updateOnlineStatus(params2);
uni.redirectTo({
url: "/pages/login/login"
});
};
return (_ctx, _cache) => {
const _component_uni_icons = resolveEasycom(vue.resolveDynamicComponent("uni-icons"), __easycom_0$3);
const _component_uni_popup_dialog = resolveEasycom(vue.resolveDynamicComponent("uni-popup-dialog"), __easycom_4);
const _component_uni_popup = resolveEasycom(vue.resolveDynamicComponent("uni-popup"), __easycom_5);
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
[
vue.createElementVNode("view", { class: "nav" }, [
vue.createElementVNode("view", { class: "navbar" }, [
vue.createElementVNode("button", {
class: "scanbara",
onClick: handleScanbara
}, "复核扫码"),
vue.createElementVNode(
"view",
{ class: "status" },
vue.toDisplayString(props.userInfo.workStatus === "0" ? "接单中" : "暂停接单"),
1
/* TEXT */
),
vue.createElementVNode("view", { class: "userinfo" }, [
vue.createElementVNode(
"button",
{
class: "lef",
onClick: dialogToggle
},
vue.toDisplayString(props.userInfo.workStatus === "0" ? "暂停接单" : "开始接单"),
1
/* TEXT */
),
vue.createElementVNode("image", {
class: "mid",
aspectFill: "",
src: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/cat-1.png"
}),
vue.createElementVNode("view", { class: "rig" }, [
vue.createElementVNode(
"text",
{ class: "name" },
vue.toDisplayString(props.userInfo.name ? props.userInfo.name : "张三三"),
1
/* TEXT */
),
vue.createElementVNode("view", {
size: "mini",
onClick: handleLogout,
class: "logout"
}, [
vue.createTextVNode("退出"),
vue.createVNode(_component_uni_icons, {
class: "item",
type: "forward",
color: "#ff",
size: "16"
})
])
])
])
])
]),
props.userInfo.workStatus === "0" ? (vue.openBlock(), vue.createElementBlock("view", { key: 0 }, [
vue.createVNode(
_component_uni_popup,
{
ref: "alertDialog",
type: "dialog"
},
{
default: vue.withCtx(() => [
vue.createVNode(_component_uni_popup_dialog, {
type: "center",
cancelText: "取消",
confirmText: "同意",
title: "温馨提示",
content: "你确定要暂停接单吗?",
onConfirm: dialogConfirm,
onClose: dialogClose
})
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
)
])) : (vue.openBlock(), vue.createElementBlock("view", { key: 1 }, [
vue.createVNode(
_component_uni_popup,
{
ref: "alertDialog",
type: "dialog"
},
{
default: vue.withCtx(() => [
vue.createVNode(_component_uni_popup_dialog, {
type: "center",
cancelText: "取消",
confirmText: "同意",
title: "温馨提示",
content: "你确定要开始接单吗?",
onConfirm: dialogConfirm,
onClose: dialogClose
})
]),
_: 1
/* STABLE */
},
512
/* NEED_PATCH */
)
]))
],
64
/* STABLE_FRAGMENT */
);
};
}
});
const NavBar = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-e9345f2e"], ["__file", "/Users/sunwubin/source/pharmacy/components/nav-bar/nav-bar.vue"]]);
const __default__$3 = {
name: "OrderCard"
};
const _sfc_main$b = /* @__PURE__ */ Object.assign(__default__$3, {
props: {
v: {
default: function() {
return {
name: "",
deployState: 0,
preNo: ""
};
},
type: Object
},
// 当前tab
c: {
default: 0,
type: Number
}
},
setup(__props) {
const props = __props;
formatAppLog("log", "at components/order-card/order-card.vue:67", "props.v", props.v);
const deployStateName = vue.computed(() => {
switch (props.v.deployState) {
case "1":
return "抓药";
case "2":
return "复核";
case "3":
return "浸泡";
case "4":
return "煎煮";
case "5":
return "打包";
default:
return "异常状态";
}
});
const handleDetail = () => {
formatAppLog("log", "at components/order-card/order-card.vue:86", "handleDetail", props.v, props.c);
if (props.c === 0) {
uni.navigateTo({
url: `/pages/edit/edit?id=${props.v.id}`
// url:`/pages/review/review?id=&preNo=${props.v.preNo}&deployState=${props.v.deployState}`
});
} else {
uni.navigateTo({
url: `/pages/detail/detail?id=${props.v.id}`
});
}
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: "container",
onClick: handleDetail
}, [
vue.createElementVNode("view", { class: "t" }, [
vue.createElementVNode("view", { class: "d1" }),
vue.createElementVNode("view", { class: "d2" }, [
vue.createElementVNode(
"view",
{ class: "dtim" },
"时间:" + vue.toDisplayString(props.v.prescriptionTime),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "d3" }, [
vue.createElementVNode(
"view",
{ class: "presno" },
"处方号:" + vue.toDisplayString(props.v.preNo),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "d4" }, [
vue.createElementVNode(
"view",
{
class: vue.normalizeClass(["source", { "zy": props.v.preMzZy === "1" }])
},
vue.toDisplayString(props.v.preMzZy === "1" ? "门诊" : "住院"),
3
/* TEXT, CLASS */
)
])
]),
vue.createElementVNode("view", { class: "m" }, [
vue.createElementVNode("image", {
class: "faceu",
aspectFill: "",
src: props.v.sex === "男" ? "/static/hz.png" : "/static/hy.png"
}, null, 8, ["src"]),
vue.createElementVNode("view", { class: "patie" }, [
vue.createElementVNode(
"view",
{ class: "name" },
vue.toDisplayString(props.v.name),
1
/* TEXT */
),
vue.createElementVNode("view", { class: "seage" }, [
vue.createElementVNode("image", {
class: "img",
aspectFill: "",
src: props.v.sex === "男" ? "/static/male.png" : "/static/female.png"
}, null, 8, ["src"]),
vue.createElementVNode(
"view",
{ class: "sex" },
vue.toDisplayString(props.v.sex),
1
/* TEXT */
),
vue.createElementVNode("view", { class: "sep" }, "|"),
vue.createElementVNode(
"view",
{ class: "age" },
vue.toDisplayString(__props.v.age) + "岁",
1
/* TEXT */
)
]),
vue.createElementVNode(
"view",
{ class: "case" },
vue.toDisplayString(props.v.disName) + " - " + vue.toDisplayString(props.v.symName),
1
/* TEXT */
)
]),
vue.createElementVNode("view", { class: "pres" }, [
vue.createElementVNode(
"view",
{ class: "department" },
"就诊科室:" + vue.toDisplayString(props.v.department),
1
/* TEXT */
),
vue.createElementVNode("view", { class: "presInfo" }, [
vue.createTextVNode(" 处方信息: "),
vue.createElementVNode(
"text",
{ class: "tips" },
vue.toDisplayString(props.v.dosageForm) + "," + vue.toDisplayString(props.v.number) + "剂 ",
1
/* TEXT */
)
])
])
]),
vue.createElementVNode("view", { class: "b" }, [
vue.createElementVNode(
"view",
{ class: "zt" },
"当前处方状态: " + vue.toDisplayString(vue.unref(deployStateName)),
1
/* TEXT */
),
vue.createElementVNode(
"view",
{ class: "je" },
"处方金额:" + vue.toDisplayString(props.v.prescriptionSum) + "元",
1
/* TEXT */
)
])
]);
};
}
});
const OrderCard = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-1ab9fcf6"], ["__file", "/Users/sunwubin/source/pharmacy/components/order-card/order-card.vue"]]);
const _sfc_main$a = {
__name: "index",
setup(__props) {
const userInfo = vue.ref({});
const searchVal = vue.ref("");
const tabList = vue.ref([
{ title: "今日待完成", status: 0 },
{ title: "历史处方", status: 1 }
]);
const currentStatus = vue.ref(0);
const tabActive = vue.ref(0);
const tabName = vue.ref("今日待完成");
const orderList = vue.ref([
{ id: 1, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "1" },
{ id: 2, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "1" },
{ id: 3, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "2" },
{ id: 4, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "1" },
{ id: 5, prescriptionTime: "2023-07-06 14:54", faceurl: "/static/hz.png", name: "张三三", sex: "女", age: 23, disName: "胃脘痛病", symName: "脾胃虚寒证", deployState: "调配", preNo: 10230516091026, department: "中医内科", dosageForm: "汤剂", number: 3, prescriptionSum: 135.62, preMzZy: "2" }
]);
const isBottom = vue.ref(false);
const officeArr = vue.ref(["全部", "中医骨伤科门诊一", "中医内科门诊一", "中医儿科门诊"]);
const officeIndex = vue.ref(0);
const typeArr = vue.ref(["姓名:", "处方号:"]);
const typeIndex = vue.ref(0);
const searchTime = vue.ref([]);
const searchDepartment = vue.ref("");
const searchName = vue.ref("");
const searchPreNo = vue.ref("");
const searchSex = vue.ref("");
const searchPreMzZy = vue.ref("");
const searchStatus = vue.ref("");
const searchTags = vue.ref([]);
const tags = vue.ref(["全部", "门诊", "住院", "男", "女", "煎煮", "发药"]);
vue.ref([
{ name: "抓药", id: "1" },
{ name: "复核", id: "2" },
{ name: "浸泡", id: "3" },
{ name: "煎煮", id: "4" },
{ name: "打包", id: "5" }
]);
const page = vue.ref(0);
const total = vue.ref(0);
const pageSize = vue.ref(10);
vue.ref("");
vue.getCurrentInstance();
vue.onMounted(() => {
});
onLoad(async () => {
const token2 = uni.getStorageSync("token");
userInfo.value.name = uni.getStorageSync("username");
userInfo.value.workStatus = uni.getStorageSync("workStatus");
const params2 = {
token: token2,
data: JSON.stringify({
currentUserId: parseInt(uni.getStorageSync("userId")) || 0,
page: page.value,
pageSize: pageSize.value,
status: currentStatus.value
})
};
const { data: res } = await receiveOrderList(params2);
if (res.code === 200) {
total.value = res.total;
orderList.value = res.rows;
}
});
const updateUser = (v2) => {
formatAppLog("log", "at pages/index/index.vue:192", "updateUserStatus", v2);
userInfo.value.workStatus = v2;
};
const updateList = (v2) => {
formatAppLog("log", "at pages/index/index.vue:197", "updateList", v2);
};
const handleSearch = async () => {
const token2 = uni.getStorageSync("token");
formatAppLog("log", "at pages/index/index.vue:202", "handleSearch token", token2);
formatAppLog("log", "at pages/index/index.vue:203", "handleSearch searchVal", searchVal.value);
formatAppLog("log", "at pages/index/index.vue:204", "currentStatus.value", currentStatus.value);
searchVal.value = searchVal.value.trim();
if (currentStatus.value === 0 && searchVal.value) {
const params2 = {
token: token2,
data: JSON.stringify({
currentUserId: parseInt(uni.getStorageSync("userId")) || 0,
name: searchVal.value,
page: page.value,
pageSize: pageSize.value,
status: currentStatus.value
})
};
const { data: res } = await receiveOrderList(params2);
if (res.code === 200) {
total.value = res.total;
orderList.value = res.rows;
}
}
if (currentStatus.value === 1) {
const params2 = {
token: token2,
data: JSON.stringify({
currentUserId: parseInt(uni.getStorageSync("userId")) || 0,
startTime: searchTime.value[0] || "",
endTime: searchTime.value[1] || "",
name: searchVal.value || "",
preNo: searchPreNo.value || "",
prescriptionStatus: searchStatus.value || "",
sex: searchSex.value || "",
preMzZy: searchPreMzZy.value || "",
page: page.value,
pageSize: pageSize.value,
status: currentStatus.value || 0
})
};
formatAppLog("log", "at pages/index/index.vue:240", "params", params2);
const { data: res } = await receiveOrderList(params2);
if (res.code === 200) {
total.value = res.total;
orderList.value = res.rows;
}
}
};
const handleRefresh = async () => {
formatAppLog("log", "at pages/index/index.vue:251", "yijianshifang >orderList>>", orderList.value);
let ids = "";
orderList.value.forEach((v2) => {
if (v2.id) {
ids = ids + v2.id + ",";
formatAppLog("log", "at pages/index/index.vue:255", "yijianshifang >orderList>>", ids);
}
});
formatAppLog("log", "at pages/index/index.vue:258", "yijianshifang >orderList>>666", ids);
const params2 = {
token: uni.getStorageSync("token"),
data: { ids }
};
const { data: res } = await releaseOrder(params2);
if (res.code === 200) {
params2 = {
token,
data: JSON.stringify({
currentUserId: parseInt(uni.getStorageSync("userId")),
page: page.value,
pageSize: pageSize.value,
status: currentStatus.value
})
};
const { data: res2 } = await receiveOrderList(params2);
if (res2.code === 200) {
total.value = res2.total;
orderList.value = res2.rows;
}
}
};
const handleGetOffice = (e2) => {
formatAppLog("log", "at pages/index/index.vue:284", "handleGetOffice", e2.detail.value);
formatAppLog("log", "at pages/index/index.vue:285", "officeIndex", officeIndex);
formatAppLog("log", "at pages/index/index.vue:286", "officeIndex", officeIndex);
officeIndex.value = e2.detail.value;
};
const handleGetType = (e2) => {
formatAppLog("log", "at pages/index/index.vue:291", "handleGetType", e2.detail.value);
formatAppLog("log", "at pages/index/index.vue:292", "typeIndex", typeIndex);
formatAppLog("log", "at pages/index/index.vue:293", "typeArr", typeIndex);
typeIndex.value = e2.detail.value;
if (typeIndex.value === 1) {
searchName.value = "";
} else {
searchPreNo.value = "";
}
};
const handleGetTags = (v2) => {
formatAppLog("log", "at pages/index/index.vue:303", "handleGetTags", v2);
if (!searchTags.value.includes(v2)) {
searchTags.value.push(v2);
} else {
searchTags.value.splice(searchTags.value.indexOf(v2), 1);
}
switch (v2) {
case "全部":
if (searchTags.value.includes(v2)) {
searchTags.value = ["全部"];
searchTime.value = [];
searchDepartment.value = "";
searchName.value = "";
searchPreNo.value = "";
searchSex.value = "";
searchPreMzZy.value = "";
searchStatus.value = "";
}
break;
case "门诊":
if (searchTags.value.includes(v2) && searchTags.value.includes("住院")) {
searchTags.value.splice(searchTags.value.indexOf("住院"), 1);
}
if (searchTags.value.includes("全部")) {
searchTags.value.splice(searchTags.value.indexOf("全部"), 1);
}
searchPreMzZy.value = "1";
break;
case "住院":
if (searchTags.value.includes(v2) && searchTags.value.includes("门诊")) {
searchTags.value.splice(searchTags.value.indexOf("门诊"), 1);
}
if (searchTags.value.includes("全部")) {
searchTags.value.splice(searchTags.value.indexOf("全部"), 1);
}
searchPreMzZy.value = "2";
break;
case "男":
if (searchTags.value.includes(v2) && searchTags.value.includes("女")) {
searchTags.value.splice(searchTags.value.indexOf("女"), 1);
}
if (searchTags.value.includes("全部")) {
searchTags.value.splice(searchTags.value.indexOf("全部"), 1);
}
searchSex.value = "男";
break;
case "女":
if (searchTags.value.includes(v2) && searchTags.value.includes("男")) {
searchTags.value.splice(searchTags.value.indexOf("男"), 1);
}
if (searchTags.value.includes("全部")) {
searchTags.value.splice(searchTags.value.indexOf("全部"), 1);
}
searchSex.value = "女";
break;
case "煎煮":
if (searchTags.value.includes(v2) && searchTags.value.includes("发药")) {
searchTags.value.splice(searchTags.value.indexOf("发药"), 1);
}
if (searchTags.value.includes("全部")) {
searchTags.value.splice(searchTags.value.indexOf("全部"), 1);
}
searchStatus.value = "煎煮";
break;
case "发药":
if (searchTags.value.includes(v2) && searchTags.value.includes("煎煮")) {
searchTags.value.splice(searchTags.value.indexOf("煎煮"), 1);
}
if (searchTags.value.includes("全部")) {
searchTags.value.splice(searchTags.value.indexOf("全部"), 1);
}
searchStatus.value = "发药";
break;
default:
searchTags.value = ["全部"];
}
};
const checkIndex = async (index) => {
tabActive.value = index;
tabName.value = tabList.value[index].title;
currentStatus.value = parseInt(tabList.value[index].status);
const token2 = uni.getStorageSync("token");
const params2 = {
token: token2,
data: {
status: currentStatus.value,
page: page.value,
pageSize: pageSize.value
}
};
formatAppLog("log", "at pages/index/index.vue:395", "checkIndex params", params2);
const { data: res } = await receiveOrderList(params2);
if (res.code === 200) {
total.value = res.total;
orderList.value = res.rows;
}
};
return (_ctx, _cache) => {
const _component_uni_easyinput = resolveEasycom(vue.resolveDynamicComponent("uni-easyinput"), __easycom_0$2);
const _component_uni_datetime_picker = resolveEasycom(vue.resolveDynamicComponent("uni-datetime-picker"), __easycom_1$1);
const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_2);
return vue.openBlock(), vue.createElementBlock("view", { class: "main" }, [
vue.createVNode(NavBar, {
"user-info": userInfo.value,
onUpdateUser: updateUser
}, null, 8, ["user-info"]),
vue.createElementVNode("view", { class: "body" }, [
vue.createElementVNode("view", { class: "tab-box" }, [
vue.createElementVNode("view", { class: "tab-bar" }, [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(tabList.value, (tab, index) => {
return vue.openBlock(), vue.createElementBlock("view", {
class: vue.normalizeClass(["tab_item", { "active": tabActive.value == index }]),
key: index,
onClick: ($event) => checkIndex(index)
}, [
vue.createElementVNode(
"text",
{ class: "text" },
vue.toDisplayString(tab.title) + vue.toDisplayString(index === 0 ? "(" + orderList.value.length + ")" : ""),
1
/* TEXT */
)
], 10, ["onClick"]);
}),
128
/* KEYED_FRAGMENT */
))
]),
vue.createElementVNode("view", { class: "search-bar" }, [
tabActive.value === 0 ? (vue.openBlock(), vue.createElementBlock("view", {
key: 0,
class: "today"
}, [
vue.createElementVNode("view", { class: "search" }, [
vue.createVNode(_component_uni_easyinput, {
prefixIcon: "search",
modelValue: searchVal.value,
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchVal.value = $event),
placeholder: "请输入姓名"
}, null, 8, ["modelValue"])
]),
vue.createElementVNode("button", {
type: "primary",
onClick: handleSearch,
class: "search-button"
}, "搜索"),
vue.createElementVNode("button", {
type: "primary",
disabled: userInfo.value.workStatus === "1" ? false : true,
onClick: handleRefresh,
class: vue.normalizeClass(userInfo.value.workStatus === "1" ? "refresh" : "refresh active")
}, "一键释放", 10, ["disabled"])
])) : (vue.openBlock(), vue.createElementBlock("view", {
key: 1,
class: "history"
}, [
vue.createElementVNode("view", { class: "searchchoice" }, [
vue.createElementVNode("view", { class: "row1" }, [
vue.createElementVNode("view", { class: "timequan" }, [
vue.createElementVNode("text", { class: "time_t" }, "时间区间:"),
vue.createVNode(_component_uni_datetime_picker, {
modelValue: searchTime.value,
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => searchTime.value = $event),
type: "datetimerange",
"hide-second": true,
class: "datepick",
rangeSeparator: " - "
}, null, 8, ["modelValue"]),
vue.createCommentVNode(`