UNPKG

@bskj-cd/titianv2

Version:

## Project setup ``` yarn install ```

1,469 lines (1,344 loc) 3.7 MB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "fb15"); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { /* (ignored) */ /***/ }), /***/ "00bb": /***/ (function(module, exports, __webpack_require__) { ;(function (root, factory, undef) { if (true) { // CommonJS module.exports = exports = factory(__webpack_require__("21bf"), __webpack_require__("38ba")); } else {} }(this, function (CryptoJS) { /** * Cipher Feedback block mode. */ CryptoJS.mode.CFB = (function () { var CFB = CryptoJS.lib.BlockCipherMode.extend(); CFB.Encryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // Remember this block to use with next block this._prevBlock = words.slice(offset, offset + blockSize); } }); CFB.Decryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // Remember this block to use with next block var thisBlock = words.slice(offset, offset + blockSize); generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // This block becomes the previous block this._prevBlock = thisBlock; } }); function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { var keystream; // Shortcut var iv = this._iv; // Generate keystream if (iv) { keystream = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } else { keystream = this._prevBlock; } cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } return CFB; }()); return CryptoJS.mode.CFB; })); /***/ }), /***/ "00ee": /***/ (function(module, exports, __webpack_require__) { var wellKnownSymbol = __webpack_require__("b622"); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var test = {}; test[TO_STRING_TAG] = 'z'; module.exports = String(test) === '[object z]'; /***/ }), /***/ "02e5": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cca6"); /* harmony import */ var core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_assign_js__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("b64b"); /* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var core_js_modules_es_array_sort_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("4e82"); /* harmony import */ var core_js_modules_es_array_sort_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_sort_js__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var core_js_modules_es_object_values_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("07ac"); /* harmony import */ var core_js_modules_es_object_values_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_values_js__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("99af"); /* harmony import */ var core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_concat_js__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("2ef0"); /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _utils_Tools__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("3c5c"); /* harmony default export */ __webpack_exports__["default"] = ({ office: { from: { group: '', name: '', desc: '', type: 'text' }, config: { name: { label: '名称', value: 'name', type: 'InputView', require: false, hideLabel: false, disabled: false, options: { min: 1, max: 20, type: 'text' } }, group: { label: '关联群', value: 'group', type: 'SelectView', require: false, hideLabel: false, disabled: false, data: [], options: {} }, type: { label: '类型', value: 'type', type: 'SelectView', require: false, hideLabel: false, disabled: false, data: [], options: {} }, desc: { label: '描述', value: 'desc', type: 'InputView', require: false, hideLabel: false, disabled: false, options: { autosize: { minRows: 2, maxRows: 6 }, inputType: 'textarea' } } } }, task: { from: { group: '', user: [], title: '', files: [], workLevel: 0, workStatus: 1, plainTime: 0, toDayTime: 0, workProgress: 0 }, config: { title: { label: '标题', value: 'title', type: 'InputView', require: false, hideLabel: false, disabled: false, options: { min: 1, max: 100, type: 'textarea', autosize: { minRows: 2, maxRows: 6 } } }, files: { label: '文件', value: 'files', type: 'FileView', require: false, hideLabel: false, disabled: false, options: { limit: 5, w: 60, h: 60, path: 'task', accept: 'image/*' } }, group: { label: '关联群', value: 'group', type: 'SelectView', require: false, hideLabel: false, disabled: false, data: [], options: {} }, user: { label: '人员', value: 'user', type: 'UserView', require: false, hideLabel: false, disabled: false, data: [], options: { multiple: true, size: 30, border: true } }, workLevel: { label: '优先级', value: 'workLevel', type: 'RadioView', require: false, hideLabel: false, disabled: false, data: [], options: { border: true } }, workStatus: { label: '状态', value: 'workStatus', type: 'RadioView', require: false, hideLabel: false, disabled: false, data: [], options: { border: true } }, plainTime: { label: '计划耗时', value: 'plainTime', type: 'SelectView', require: false, hideLabel: false, disabled: false, data: [], options: { disabledKey: 'user' } }, toDayTime: { label: '今日耗时', value: 'toDayTime', type: 'SelectView', require: false, hideLabel: false, disabled: false, data: [], options: { disabledKey: 'user' } }, workProgress: { label: '进度', value: 'workProgress', type: 'SelectView', require: false, hideLabel: false, disabled: false, data: [], options: { disabledKey: 'user' } } } }, open: function open() { var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'office'; var configData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'app/setFromBox'; var uniqId = window.app.$route.query.uniqId || ''; if (uniqId) { window.parent.postMessage({ client: "openFromBox", type: type, configData: configData }, '*'); } else { var data = { type: type }; Object.assign(data, this.initData(type, configData)); window.app.$store.commit(key, data); } }, initData: function initData() { var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'office'; var configData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var _lodash$cloneDeep = lodash__WEBPACK_IMPORTED_MODULE_5___default.a.cloneDeep(this[type]), config = _lodash$cloneDeep.config, from = _lodash$cloneDeep.from; var _this$getDataAndRules = this.getDataAndRules(lodash__WEBPACK_IMPORTED_MODULE_5___default.a.cloneDeep(config), configData), data = _this$getDataAndRules.data, rules = _this$getDataAndRules.rules; if (lodash__WEBPACK_IMPORTED_MODULE_5___default.a.has(configData, 'from')) Object.assign(from, configData['from']); var options = { title: '弹框', w: '500px', labelWidth: '72px', full: false, size: 'middle', customClass: '', apiType: { add: 'saveOffice' } }; if (lodash__WEBPACK_IMPORTED_MODULE_5___default.a.has(configData, 'options')) Object.assign(options, configData['options']); if (type === 'task' && from.id) Object.assign(options, { copyBubble: true, w: '650px' }); return { show: true, from: from, data: { data: data, rules: rules, options: options } }; }, getDataAndRules: function getDataAndRules() { var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var configData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var keyArr = Object.keys(data); var rules = {}; for (var key in data) { data[key].sort = keyArr.indexOf(key); if (lodash__WEBPACK_IMPORTED_MODULE_5___default.a.has(configData, key)) { Object.assign(data[key], configData[key]); } if (lodash__WEBPACK_IMPORTED_MODULE_5___default.a.has(data[key], 'require') && data[key]['require']) { rules[key] = this.getRules(data[key]); } } data = Object.values(data).sort(_utils_Tools__WEBPACK_IMPORTED_MODULE_6__["default"].compare('sort', 'asc')); return { data: data, rules: rules }; }, getRules: function getRules(_ref) { var label = _ref.label, type = _ref.type, options = _ref.options; if (type === 'InputView') { return [{ required: true, message: "\u8BF7\u8F93\u5165".concat(label), trigger: 'blur' }, { min: options.min || 1, max: options.max || 20, message: "\u957F\u5EA6\u5728 ".concat(options.min || 1, " \u5230 ").concat(options.max || 20, " \u4E2A\u5B57\u7B26"), trigger: 'blur' }]; } else { return [{ required: true, message: "\u8BF7\u9009\u62E9".concat(label), trigger: 'change' }]; } } }); /***/ }), /***/ "0366": /***/ (function(module, exports, __webpack_require__) { var aCallable = __webpack_require__("59ed"); // optional / simple context binding module.exports = function (fn, that, length) { aCallable(fn); if (that === undefined) return fn; switch (length) { case 0: return function () { return fn.call(that); }; case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /***/ "03d6": /***/ (function(module, exports, __webpack_require__) { var has = __webpack_require__("9c0e"); var toIObject = __webpack_require__("6ca1"); var arrayIndexOf = __webpack_require__("39ad")(false); var IE_PROTO = __webpack_require__("5a94")('IE_PROTO'); module.exports = function (object, names) { var O = toIObject(object); var i = 0; var result = []; var key; for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has(O, key = names[i++])) { ~arrayIndexOf(result, key) || result.push(key); } return result; }; /***/ }), /***/ "04d1": /***/ (function(module, exports, __webpack_require__) { var userAgent = __webpack_require__("342f"); var firefox = userAgent.match(/firefox\/(\d+)/i); module.exports = !!firefox && +firefox[1]; /***/ }), /***/ "051b": /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__("1a14"); var createDesc = __webpack_require__("10db"); module.exports = __webpack_require__("0bad") ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /***/ "057f": /***/ (function(module, exports, __webpack_require__) { /* eslint-disable es/no-object-getownpropertynames -- safe */ var toIndexedObject = __webpack_require__("fc6a"); var $getOwnPropertyNames = __webpack_require__("241c").f; var toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return $getOwnPropertyNames(it); } catch (error) { return windowNames.slice(); } }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window module.exports.f = function getOwnPropertyNames(it) { return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it)); }; /***/ }), /***/ "05f5": /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__("7a41"); var document = __webpack_require__("ef08").document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; /***/ }), /***/ "06cf": /***/ (function(module, exports, __webpack_require__) { var DESCRIPTORS = __webpack_require__("83ab"); var propertyIsEnumerableModule = __webpack_require__("d1e7"); var createPropertyDescriptor = __webpack_require__("5c6c"); var toIndexedObject = __webpack_require__("fc6a"); var toPropertyKey = __webpack_require__("a04b"); var has = __webpack_require__("5135"); var IE8_DOM_DEFINE = __webpack_require__("0cfb"); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { O = toIndexedObject(O); P = toPropertyKey(P); if (IE8_DOM_DEFINE) try { return $getOwnPropertyDescriptor(O, P); } catch (error) { /* empty */ } if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); }; /***/ }), /***/ "072d": /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) var DESCRIPTORS = __webpack_require__("0bad"); var getKeys = __webpack_require__("9876"); var gOPS = __webpack_require__("fed5"); var pIE = __webpack_require__("1917"); var toObject = __webpack_require__("0983"); var IObject = __webpack_require__("9fbb"); var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) module.exports = !$assign || __webpack_require__("4b8b")(function () { var A = {}; var B = {}; // eslint-disable-next-line no-undef var S = Symbol(); var K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function (k) { B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars var T = toObject(target); var aLen = arguments.length; var index = 1; var getSymbols = gOPS.f; var isEnum = pIE.f; while (aLen > index) { var S = IObject(arguments[index++]); var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); var length = keys.length; var j = 0; var key; while (length > j) { key = keys[j++]; if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key]; } } return T; } : $assign; /***/ }), /***/ "07ac": /***/ (function(module, exports, __webpack_require__) { var $ = __webpack_require__("23e7"); var $values = __webpack_require__("6f53").values; // `Object.values` method // https://tc39.es/ecma262/#sec-object.values $({ target: 'Object', stat: true }, { values: function values(O) { return $values(O); } }); /***/ }), /***/ "07ba": /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "07eb": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_69465cea_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("30ba"); /* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_69465cea_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_69465cea_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__); /* unused harmony reexport * */ /***/ }), /***/ "0808": /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "097e": /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;;(function(root,factory){ if (true){ !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); }else { var i, o; } })(this,function(){ var ExactDate = (function(){ return { _:function(date,y,m,d){ if(y<100){ date.setFullYear(y); date.setMonth(m-1); date.setDate(d); } date.setMilliseconds(0); return date; }, fromYmd:function(y,m,d){ return this._(new Date(y+'/'+m+'/'+d+' 0:0:0 GMT+0800'),y,m,d); }, fromYmdHms:function(y,m,d,hour,minute,second){ return this._(new Date(y+'/'+m+'/'+d+' '+hour+':'+minute+':'+second+' GMT+0800'),y,m,d); } }; })(); var Solar = (function(){ var _fromDate = function(date){ return _fromYmdHms(date.getFullYear(),date.getMonth()+1,date.getDate(),date.getHours(),date.getMinutes(),date.getSeconds()); }; var _fromJulianDay = function(julianDay){ var d = Math.floor(julianDay + 0.5); var f = julianDay + 0.5 - d; var c; if (d >= 2299161) { c = Math.floor((d - 1867216.25) / 36524.25); d += 1 + c - Math.floor(c / 4); } d += 1524; var year = Math.floor((d - 122.1) / 365.25); d -= Math.floor(365.25 * year); var month = Math.floor(d / 30.601); d -= Math.floor(30.601 * month); var day = d; if (month > 13) { month -= 13; year -= 4715; } else { month -= 1; year -= 4716; } f *= 24; var hour = Math.floor(f); f -= hour; f *= 60; var minute = Math.floor(f); f -= minute; f *= 60; var second = Math.round(f); return _fromYmdHms(year,month,day,hour,minute,second); }; var _fromYmdHms = function(y,m,d,hour,minute,second){ if(y===1582&&m==10){ if(d>=15){ d -= 10; } } return { _p:{ year:y, month:m, day:d, hour:hour, minute:minute, second:second, calendar:ExactDate.fromYmdHms(y,m,d,hour,minute,second) }, getYear:function(){ return this._p.year; }, getMonth:function(){ return this._p.month; }, getDay:function(){ return this._p.day; }, getHour:function(){ return this._p.hour; }, getMinute:function(){ return this._p.minute; }, getSecond:function(){ return this._p.second; }, getWeek:function(){ return this._p.calendar.getDay(); }, getWeekInChinese:function(){ return SolarUtil.WEEK[this.getWeek()]; }, /** * 获取当天的阳历周 * @param start 星期几作为一周的开始,1234560分别代表星期一至星期天 */ getSolarWeek:function(start){ return SolarWeek.fromDate(this._p.calendar,start); }, isLeapYear:function(){ return SolarUtil.isLeapYear(this._p.year); }, getFestivals:function(){ var l = []; var f = SolarUtil.FESTIVAL[this._p.month+'-'+this._p.day]; if(f){ l.push(f); } var weeks = Math.ceil(this._p.day/7); var week = this.getWeek(); f = SolarUtil.WEEK_FESTIVAL[this._p.month+'-'+weeks+'-'+week]; if(f){ l.push(f); } return l; }, getOtherFestivals:function(){ var l = []; var fs = SolarUtil.OTHER_FESTIVAL[this._p.month+'-'+this._p.day]; if(fs){ for(var i=0,j=fs.length;i<j;i++){ l.push(fs[i]); } } return l; }, getXingzuo:function(){ return this.getXingZuo(); }, getXingZuo:function(){ var index = 11; var y = this._p.month*100+this._p.day; if (y >= 321 && y <= 419) { index = 0; } else if (y >= 420 && y <= 520) { index = 1; } else if (y >= 521 && y <= 621) { index = 2; } else if (y >= 622 && y <= 722) { index = 3; } else if (y >= 723 && y <= 822) { index = 4; } else if (y >= 823 && y <= 922) { index = 5; } else if (y >= 923 && y <= 1023) { index = 6; } else if (y >= 1024 && y <= 1122) { index = 7; } else if (y >= 1123 && y <= 1221) { index = 8; } else if (y >= 1222 || y <= 119) { index = 9; } else if (y <= 218) { index = 10; } return SolarUtil.XINGZUO[index]; }, toYmd:function(){ var d = this._p.day; if(this._p.year===1582&&this._p.month==10){ if(d>=5){ d += 10; } } var y = this._p.year + ''; while (y.length < 4) { y = '0' + y; } return [y,(this._p.month<10?'0':'')+this._p.month,(d<10?'0':'')+d].join('-'); }, toYmdHms:function(){ return this.toYmd()+' '+[(this._p.hour<10?'0':'')+this._p.hour,(this._p.minute<10?'0':'')+this._p.minute,(this._p.second<10?'0':'')+this._p.second].join(':'); }, toString:function(){ return this.toYmd(); }, toFullString:function(){ var s = this.toYmdHms(); if(this.isLeapYear()){ s += ' 闰年'; } s += ' 星期'+this.getWeekInChinese(); var festivals = this.getFestivals(); for(var i=0,j=festivals.length;i<j;i++){ s += ' ('+festivals[i]+')'; } s += ' '+this.getXingZuo()+'座'; return s; }, next:function(days, onlyWorkday){ var date = ExactDate.fromYmdHms(this._p.year,this._p.month,this._p.day,this._p.hour,this._p.minute,this._p.second); if(0!=days){ if (!onlyWorkday){ date.setDate(date.getDate() + days); }else{ var rest = Math.abs(days); var add = days < 1 ? -1 : 1; while(rest > 0){ date.setDate(date.getDate() + add); var work = true; var holiday = HolidayUtil.getHoliday(date.getFullYear(), date.getMonth() + 1, date.getDate()); if(!holiday){ var week = date.getDay(); if(0 == week || 6 == week){ work = false; } }else{ work = holiday.isWork(); } if(work){ rest--; } } } } return _fromDate(date); }, getLunar:function(){ return Lunar.fromDate(this._p.calendar); }, getJulianDay:function(){ var y = this._p.year; var m = this._p.month; var d = this._p.day + ((this._p.second / 60 + this._p.minute) / 60 + this._p.hour) / 24; var n = 0; var g = false; if (y * 372 + m * 31 + Math.floor(d) >= 588829) { g = true; } if (m <= 2) { m += 12; y--; } if (g) { n = Math.floor(y / 100); n = 2 - n + Math.floor(n / 4); } return Math.floor(365.25 * (y + 4716)) + Math.floor(30.6001 * (m + 1)) + d + n - 1524.5; }, getCalendar:function(){ return this._p.calendar; } }; }; var _fromBaZi=function(yearGanZhi,monthGanZhi,dayGanZhi,timeGanZhi,sect,baseYear){ sect = (1==sect)?1:2; baseYear = (undefined==baseYear)?1900:baseYear; var l = []; var today = _fromDate(new Date()); var lunar = today.getLunar(); var offsetYear = LunarUtil.getJiaZiIndex(lunar.getYearInGanZhiExact())-LunarUtil.getJiaZiIndex(yearGanZhi); if(offsetYear<0){ offsetYear = offsetYear+60; } var startYear = today.getYear() - offsetYear; var hour = 0; var timeZhi = timeGanZhi.substr(1); for(var i=0,j=LunarUtil.ZHI.length;i<j;i++){ if(LunarUtil.ZHI[i]===timeZhi){ hour = (i-1)*2; } } while(startYear>=baseYear){ var year = startYear-1; var counter = 0; var month = 12; var day; var solar; var found = false; while (counter < 15) { if(year>=baseYear){ day = 1; solar = _fromYmdHms(year, month, day, hour, 0, 0); lunar = solar.getLunar(); if(lunar.getYearInGanZhiExact()===yearGanZhi && lunar.getMonthInGanZhiExact()===monthGanZhi){ found = true; break; } } month++; if(month > 12){ month = 1; year++; } counter++; } if(found){ counter = 0; month--; if(month<1){ month = 12; year--; } day = 1; solar = _fromYmdHms(year, month, day, hour, 0, 0); while (counter < 61) { lunar = solar.getLunar(); var dgz = (2==sect)?lunar.getDayInGanZhiExact2():lunar.getDayInGanZhiExact(); if (lunar.getYearInGanZhiExact()===yearGanZhi && lunar.getMonthInGanZhiExact()===monthGanZhi && dgz===dayGanZhi && lunar.getTimeInGanZhi()===timeGanZhi) { l.push(solar); break; } solar = solar.next(1); counter++; } } startYear -= 60; } return l; }; return { J2000:2451545, fromYmd:function(y,m,d){return _fromYmdHms(y,m,d,0,0,0);}, fromYmdHms:function(y,m,d,hour,minute,second){return _fromYmdHms(y,m,d,hour,minute,second);}, fromDate:function(date){return _fromDate(date);}, fromJulianDay:function(julianDay){return _fromJulianDay(julianDay);}, fromBaZi:function(yearGanZhi,monthGanZhi,dayGanZhi,timeGanZhi){return _fromBaZi(yearGanZhi,monthGanZhi,dayGanZhi,timeGanZhi);} }; })(); var Lunar = (function(){ var MS_PER_DAY = 86400000; var _computeJieQi = function(o,ly) { o['jieQiList'] = []; o['jieQi'] = {}; var julianDays = ly.getJieQiJulianDays(); for (var i = 0, j = Lunar.JIE_QI_IN_USE.length; i < j; i++) { var key = Lunar.JIE_QI_IN_USE[i]; o['jieQiList'].push(key); o['jieQi'][key] = Solar.fromJulianDay(julianDays[i]); } }; var _computeYear = function(o,solar,year){ //以正月初一开始 var offset = year - 4; var yearGanIndex = offset % 10; var yearZhiIndex = offset % 12; if (yearGanIndex < 0) { yearGanIndex += 10; } if (yearZhiIndex < 0) { yearZhiIndex += 12; } //以立春作为新一年的开始的干支纪年 var g = yearGanIndex; var z = yearZhiIndex; //精确的干支纪年,以立春交接时刻为准 var gExact = yearGanIndex; var zExact = yearZhiIndex; var solarYear = solar.getYear(); var solarYmd = solar.toYmd(); var solarYmdHms = solar.toYmdHms(); //获取立春的阳历时刻 var liChun = o['jieQi']['立春']; if (liChun.getYear() != solarYear) { liChun = o['jieQi']['LI_CHUN']; } var liChunYmd = liChun.toYmd(); var liChunYmdHms = liChun.toYmdHms(); //阳历和阴历年份相同代表正月初一及以后 if(year===solarYear){ //立春日期判断 if(solarYmd<liChunYmd) { g--; z--; } //立春交接时刻判断 if(solarYmdHms<liChunYmdHms) { gExact--; zExact--; } }else if (year < solarYear){ if(solarYmd>=liChunYmd) { g++; z++; } if(solarYmdHms>=liChunYmdHms) { gExact++; zExact++; } } o['yearGanIndex'] = yearGanIndex; o['yearZhiIndex'] = yearZhiIndex; o['yearGanIndexByLiChun'] = (g<0?g+10:g)%10; o['yearZhiIndexByLiChun'] = (z<0?z+12:z)%12; o['yearGanIndexExact'] = (gExact<0?gExact+10:gExact)%10; o['yearZhiIndexExact'] = (zExact<0?zExact+12:zExact)%12; }; var _computeMonth = function(o,solar){ var start = null,i; var end; var size = Lunar.JIE_QI_IN_USE.length; //序号:大雪以前-3,大雪到小寒之间-2,小寒到立春之间-1,立春之后0 var index = -3; for(i=0;i<size;i+=2){ end = o.jieQi[Lunar.JIE_QI_IN_USE[i]]; var ymd = solar.toYmd(); var symd = null==start?ymd:start.toYmd(); if(ymd>=symd&&ymd<end.toYmd()){ break; } start = end; index++; } var offset = (((o.yearGanIndexByLiChun+(index<0?1:0)) % 5 + 1) * 2) % 10; o['monthGanIndex'] = ((index<0?index+10:index) + offset) % 10; o['monthZhiIndex'] = ((index<0?index+12:index) + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12; start = null; index = -3; for(i=0;i<size;i+=2){ end = o.jieQi[Lunar.JIE_QI_IN_USE[i]]; var time = solar.toYmdHms(); var stime = null==start?time:start.toYmdHms(); if(time>=stime&&time<end.toYmdHms()){ break; } start = end; index++; } offset = (((o.yearGanIndexExact+(index<0?1:0)) % 5 + 1) * 2) % 10; o['monthGanIndexExact'] = ((index<0?index+10:index) + offset) % 10; o['monthZhiIndexExact'] = ((index<0?index+12:index) + LunarUtil.BASE_MONTH_ZHI_INDEX) % 12; }; var _computeDay = function(o,solar,hour,minute){ var noon = Solar.fromYmdHms(solar.getYear(), solar.getMonth(), solar.getDay(), 12, 0, 0); var offset = Math.floor(noon.getJulianDay()) - 11; var dayGanIndex = offset % 10; var dayZhiIndex = offset % 12; o['dayGanIndex'] = dayGanIndex; o['dayZhiIndex'] = dayZhiIndex; var dayGanExact = dayGanIndex; var dayZhiExact = dayZhiIndex; o['dayGanIndexExact2'] = dayGanExact; o['dayZhiIndexExact2'] = dayZhiExact; var hm = (hour<10?'0':'')+hour+':'+(minute<10?'0':'')+minute; if(hm>='23:00'&&hm<='23:59'){ dayGanExact++; if(dayGanExact>=10){ dayGanExact -= 10; } dayZhiExact++; if(dayZhiExact>=12){ dayZhiExact -= 12; } } o['dayGanIndexExact'] = dayGanExact; o['dayZhiIndexExact'] = dayZhiExact; }; var _computeTime = function(o,hour,minute){ var timeZhiIndex = LunarUtil.getTimeZhiIndex((hour<10?'0':'')+hour+':'+(minute<10?'0':'')+minute); o['timeZhiIndex'] = timeZhiIndex; o['timeGanIndex'] = (o['dayGanIndexExact']%5*2+timeZhiIndex)%10; }; var _computeWeek = function(o,solar){ o['weekIndex'] = solar.getWeek(); }; var _compute = function(year,hour,minute,second,solar,ly){ var o = {}; _computeJieQi(o, ly); _computeYear(o, solar, year); _computeMonth(o, solar); _computeDay(o, solar, hour, minute); _computeTime(o, hour, minute); _computeWeek(o, solar); return o; }; var _fromDate = function(date){ var c = ExactDate.fromYmd(date.getFullYear(),date.getMonth()+1,date.getDate()); var solarTime = c.getTime(); var lunarYear = 0; var lunarMonth = 0; var lunarDay = 0; var y = c.getFullYear(); var ly = LunarYear.fromYear(y); var lms = ly.getMonths(); for (var i = 0, j = lms.length; i < j; i++) { var m = lms[i]; // 初一 var firstDay = Solar.fromJulianDay(m.getFirstJulianDay()).getCalendar(); firstDay.setHours(0); firstDay.setMinutes(0); firstDay.setSeconds(0); firstDay.setMilliseconds(0); var days = Math.floor((solarTime - firstDay.getTime()) / MS_PER_DAY); if (days < m.getDayCount()) { lunarYear = m.getYear(); lunarMonth = m.getMonth(); lunarDay = days + 1; break; } } return _new(lunarYear, lunarMonth, lunarDay, date.getHours(), date.getMinutes(), date.getSeconds(), Solar.fromDate(date), ly); }; var _fromYmdHms = function(lunarYear,lunarMonth,lunarDay,hour,minute,second) { var y = LunarYear.fromYear(lunarYear); var m = y.getMonth(lunarMonth); if (null == m) { throw 'wrong lunar year '+lunarYear+' month '+lunarMonth; } if (lunarDay < 1) { throw 'lunar day must bigger than 0'; } var days = m.getDayCount(); if (lunarDay > days) { throw 'only '+days+' days in lunar year '+lunarYear+' month '+lunarMonth; } var noon = Solar.fromJulianDay(m.getFirstJulianDay() + lunarDay - 1); var solar = Solar.fromYmdHms(noon.getYear(), noon.getMonth(), noon.getDay(), hour, minute, second); return _new(lunarYear, lunarMonth, lunarDay, hour, minute, second, solar, y); }; var _new = function(year,month,day,hour,minute,second,solar,ly){ var gz = _compute(year,hour,minute,second,solar,ly); return { _p:{ year:year, month:month, day:day, hour:hour, minute:minute, second:second, timeGanIndex:gz.timeGanIndex, timeZhiIndex:gz.timeZhiIndex, dayGanIndex:gz.dayGanIndex, dayZhiIndex:gz.dayZhiIndex, dayGanIndexExact:gz.dayGanIndexExact, dayZhiIndexExact:gz.dayZhiIndexExact, dayGanIndexExact2:gz.dayGanIndexExact2, dayZhiIndexExact2:gz.dayZhiIndexExact2, monthGanIndex:gz.monthGanIndex, monthZhiIndex:gz.monthZhiIndex, monthGanIndexExact:gz.monthGanIndexExact, monthZhiIndexExact:gz.monthZhiIndexExact, yearGanIndex:gz.yearGanIndex, yearZhiIndex:gz.yearZhiIndex, yearGanIndexByLiChun:gz.yearGanIndexByLiChun, yearZhiIndexByLiChun:gz.yearZhiIndexByLiChun, yearGanIndexExact:gz.yearGanIndexExact, yearZhiIndexExact:gz.yearZhiIndexExact, weekIndex:gz.weekIndex, jieQi:gz.jieQi, jieQiList:gz.jieQiList, solar:solar, eightChar:null }, getYear:function(){return this._p.year;}, getMonth:function(){return this._p.month;}, getDay:function(){return this._p.day;}, getHour:function(){return this._p.hour;}, getMinute:function(){return this._p.minute;}, getSecond:function(){return this._p.second;}, getTimeGanIndex:function(){return this._p.timeGanIndex;}, getTimeZhiIndex:function(){return this._p.timeZhiIndex;}, getDayGanIndex:function(){return this._p.dayGanIndex;}, getDayGanIndexExact:function(){return this._p.dayGanIndexExact;}, getDayGanIndexExact2:function(){return this._p.dayGanIndexExact2;}, getDayZhiIndex:function(){return this._p.dayZhiIndex;}, getDayZhiIndexExact:function(){return this._p.dayZhiIndexExact;}, getDayZhiIndexExact2:function(){return this._p.dayZhiIndexExact2;}, getMonthGanIndex:function(){return this._p.monthGanIndex;}, getMonthGanIndexExact:function(){return this._p.monthGanIndexExact;}, getMonthZhiIndex:function(){return this._p.monthZhiIndex;}, getMonthZhiIndexExact:function(){return this._p.monthZhiIndexExact;}, getYearGanIndex:function(){return this._p.yearGanIndex;}, getYearGanIndexByLiChun:function(){return this._p.yearGanIndexByLiChun;}, getYearGanIndexExact:function(){return this._p.yearGanIndexExact;}, getYearZhiIndex:function(){return this._p.yearZhiIndex;}, getYearZhiIndexByLiChun:function(){return this._p.yearZhiIndexByLiChun;}, getYearZhiIndexExact:function(){return this._p.yearZhiIndexExact;}, getGan:function(){return this.getYearGan();}, getZhi:function(){return this.getYearZhi();}, getYearGan:function(){return LunarUtil.GAN[this._p.yearGanIndex+1];}, getYearGanByLiChun:function(){return LunarUtil.GAN[this._p.yearGanIndexByLiChun+1];}, getYearGanExact:function(){return LunarUtil.GAN[this._p.yearGanIndexExact+1];}, getYearZhi:function(){return LunarUtil.ZHI[this._p.yearZhiIndex+1];}, getYearZhiByLiChun:function(){return LunarUtil.ZHI[this._p.yearZhiIndexByLiChun+1];}, getYearZhiExact:function(){return LunarUtil.ZHI[this._p.yearZhiIndexExact+1];}, getYearInGanZhi:function(){return this.getYearGan()+this.getYearZhi();}, getYearInGanZhiByLiChun:function(){return this.getYearGanByLiChun()+this.getYearZhiByLiChun();}, getYearInGanZhiExact:function(){return this.getYearGanExact()+this.getYearZhiExact();}, getMonthGan:function(){return LunarUtil.GAN[this._p.monthGanIndex+1];}, getMonthGanExact:function(){return LunarUtil.GAN[this._p.monthGanIndexExact+1];}, getMonthZhi:function(){return LunarUtil.ZHI[this._p.monthZhiIndex+1];}, getMonthZhiExact:function(){return LunarUtil.ZHI[this._p.monthZhiIndexExact+1];}, getMonthInGanZhi:function(){return this.getMonthGan()+this.getMonthZhi();}, getMonthInGanZhiExact:function(){return this.getMonthGanExact()+this.getMonthZhiExact();}, getDayGan:function(){return LunarUtil.GAN[this._p.dayGanIndex+1];}, getDayGanExact:function(){return LunarUtil.GAN[this._p.dayGanIndexExact+1];}, getDayGanExact2:function(){return LunarUtil.GAN[this._p.dayGanIndexExact2+1];}, getDayZhi:function(){return LunarUtil.ZHI[this._p.dayZhiIndex+1];}, getDayZhiExact:function(){return LunarUtil.ZHI[this._p.dayZhiIndexExact+1];}, getDayZhiExact2:function(){return LunarUtil.ZHI[this._p.dayZhiIndexExact2+1];}, getDayInGanZhi:function(){return this.getDayGan()+this.getDayZhi();}, getDayInGanZhiExact:function(){return this.getDayGanExact()+this.getDayZhiExact();}, getDayInGanZhiExact2:function(){return this.getDayGanExact2()+this.getDayZhiExact2();}, getTimeGan:function(){return LunarUtil.GAN[this._p.timeGanIndex+1];}, getTimeZhi:function(){return LunarUtil.ZHI[this._p.timeZhiIndex+1];}, getTimeInGanZhi:function(){return this.getTimeGan()+this.getTimeZhi();}, getShengxiao:function(){return this.getYearShengXiao();}, getYearShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.yearZhiIndex+1];}, getYearShengXiaoByLiChun:function(){return LunarUtil.SHENGXIAO[this._p.yearZhiIndexByLiChun+1];}, getYearShengXiaoExact:function(){return LunarUtil.SHENGXIAO[this._p.yearZhiIndexExact+1];}, getMonthShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.monthZhiIndex+1];}, getMonthShengXiaoExact:function(){return LunarUtil.SHENGXIAO[this._p.monthZhiIndexExact+1];}, getDayShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.dayZhiIndex+1];}, getTimeShengXiao:function(){return LunarUtil.SHENGXIAO[this._p.timeZhiIndex+1];}, getYearInChinese:function(){ var y = (this._p.year+''); var s = ''; var zero = '0'.charCodeAt(0); for(var i=0,j=y.length;i<j;i++){ s+=LunarUtil.NUMBER[y.charCodeAt(i)-zero]; } return s; }, getMonthInChinese:function(){ var month = this._p.month; return (month<0?'闰':'')+LunarUtil.MONTH[Math.abs(month)]; }, getDayInChinese:function(){ return LunarUtil.DAY[this._p.day]; }, getPengZuGan:function(){ return LunarUtil.PENGZU_GAN[this._p.dayGanIndex+1]; }, getPengZuZhi:function(){ return LunarUtil.PENGZU_ZHI[this._p.dayZhiIndex+1]; }, getPositionXi:function(){ return this.getDayPositionXi(); }, getPositionXiDesc:function(){ return this.getDayPositionXiDesc(); }, getPositionYangGui:function(){ return this.getDayPositionYangGui(); }, getPositionYangGuiDesc:function(){ return this.getDayPositionYangGuiDesc(); }, getPositionYinGui:function(){ return this.getDayPositionYinGui(); }, getPositionYinGuiDesc:function(){ return this.getDayPositionYinGuiDesc(); }, getPositionFu:function(){ return this.getDayPositionFu(); }, getPositionFuDesc:function(){ return this.getDayPositionFuDesc(); }, getPositionCai:function(){ return this.getDayPositionCai(); }, getPositionCaiDesc:function(){ return this.getDayPositionCaiDesc(); }, getDayPositionXi:function(){ return LunarUtil.POSITION_XI[this._p.dayGanIndex+1]; }, getDayPositionXiDesc:function(){ return LunarUtil.POSITION_DESC[this.getDayPositionXi()]; }, getDayPositionYangGui:function(){ return LunarUtil.POSITION_YANG_GUI[this._p.dayGanIndex+1]; }, getDayPositionYangGuiDesc:function(){ return LunarUtil.POSITION_DESC[this.getDayPositionYangGui()]; }, getDayPositionYinGui:function(){ return LunarUtil.POSITION_YIN_GUI[this._p.dayGanIndex+1]; }, getDayPositionYinGuiDesc:function(){ return LunarUtil.POSITION_DESC[this.getDayPositionYinGui()]; }, getDayPositionFu:function(){ return LunarUtil.POSITION_FU[this._p.dayGanIndex+1]; }, getDayPositionFuDesc:function(){ return LunarUtil.POSITION_DESC[this.getDayPositionFu()]; }, getDayPositionCai:function(){ return LunarUtil.POSITION_CAI[this._p.dayGanIndex+1];