@tuoyuan/module-page-select 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module-page-select.common.js +226 -484
- package/dist/module-page-select.common.js.map +1 -1
- package/dist/module-page-select.umd.js +239 -489
- package/dist/module-page-select.umd.js.map +1 -1
- package/dist/module-page-select.umd.min.js +1 -1
- package/dist/module-page-select.umd.min.js.map +1 -1
- package/package.json +8 -3
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("vue"));
|
|
3
|
+
module.exports = factory(require("vue"), require("@tuoyuan/gateway-request-lib"));
|
|
4
4
|
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define([], factory);
|
|
5
|
+
define([, ], factory);
|
|
6
6
|
else if(typeof exports === 'object')
|
|
7
|
-
exports["module-page-select"] = factory(require("vue"));
|
|
7
|
+
exports["module-page-select"] = factory(require("vue"), require("@tuoyuan/gateway-request-lib"));
|
|
8
8
|
else
|
|
9
|
-
root["module-page-select"] = factory(root["Vue"]);
|
|
10
|
-
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__9274__) {
|
|
9
|
+
root["module-page-select"] = factory(root["Vue"], root["GatewayRequestLib"]);
|
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__9274__, __WEBPACK_EXTERNAL_MODULE__3092__) {
|
|
11
11
|
return /******/ (function() { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/
|
|
14
|
+
/***/ 3081:
|
|
15
15
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
16
16
|
|
|
17
17
|
"use strict";
|
|
@@ -25,7 +25,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
25
25
|
|
|
26
26
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
|
27
27
|
// Module
|
|
28
|
-
___CSS_LOADER_EXPORT___.push([module.id, ".module-page-select[data-v-
|
|
28
|
+
___CSS_LOADER_EXPORT___.push([module.id, ".module-page-select[data-v-0b2fc41a]{width:100%}.selection-preview[data-v-0b2fc41a]{margin-top:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #91d5ff;border-radius:4px;font-size:13px}.preview-label[data-v-0b2fc41a]{color:#666;font-size:12px;margin-bottom:4px}.preview-value[data-v-0b2fc41a]{color:#1890ff;font-weight:500}.config-form[data-v-0b2fc41a]{margin-top:16px}", ""]);
|
|
29
29
|
// Exports
|
|
30
30
|
/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
|
|
31
31
|
|
|
@@ -158,19 +158,19 @@ exports.A = (sfc, props) => {
|
|
|
158
158
|
|
|
159
159
|
/***/ }),
|
|
160
160
|
|
|
161
|
-
/***/
|
|
161
|
+
/***/ 7650:
|
|
162
162
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
163
163
|
|
|
164
164
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
|
165
165
|
|
|
166
166
|
// load the styles
|
|
167
|
-
var content = __webpack_require__(
|
|
167
|
+
var content = __webpack_require__(3081);
|
|
168
168
|
if(content.__esModule) content = content.default;
|
|
169
169
|
if(typeof content === 'string') content = [[module.id, content, '']];
|
|
170
170
|
if(content.locals) module.exports = content.locals;
|
|
171
171
|
// add the styles to the DOM
|
|
172
172
|
var add = (__webpack_require__(258)/* ["default"] */ .A)
|
|
173
|
-
var update = add("
|
|
173
|
+
var update = add("43b2dec2", content, true, {"sourceMap":false,"shadowMode":false});
|
|
174
174
|
|
|
175
175
|
/***/ }),
|
|
176
176
|
|
|
@@ -443,6 +443,14 @@ function applyToTag (styleElement, obj) {
|
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
|
|
446
|
+
/***/ }),
|
|
447
|
+
|
|
448
|
+
/***/ 3092:
|
|
449
|
+
/***/ (function(module) {
|
|
450
|
+
|
|
451
|
+
"use strict";
|
|
452
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__3092__;
|
|
453
|
+
|
|
446
454
|
/***/ }),
|
|
447
455
|
|
|
448
456
|
/***/ 9274:
|
|
@@ -470,35 +478,6 @@ module.exports = function (argument) {
|
|
|
470
478
|
};
|
|
471
479
|
|
|
472
480
|
|
|
473
|
-
/***/ }),
|
|
474
|
-
|
|
475
|
-
/***/ 6469:
|
|
476
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
477
|
-
|
|
478
|
-
"use strict";
|
|
479
|
-
|
|
480
|
-
var wellKnownSymbol = __webpack_require__(8227);
|
|
481
|
-
var create = __webpack_require__(2360);
|
|
482
|
-
var defineProperty = (__webpack_require__(4913).f);
|
|
483
|
-
|
|
484
|
-
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
485
|
-
var ArrayPrototype = Array.prototype;
|
|
486
|
-
|
|
487
|
-
// Array.prototype[@@unscopables]
|
|
488
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
489
|
-
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
490
|
-
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
491
|
-
configurable: true,
|
|
492
|
-
value: create(null)
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
// add a key to Array.prototype[@@unscopables]
|
|
497
|
-
module.exports = function (key) {
|
|
498
|
-
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
499
|
-
};
|
|
500
|
-
|
|
501
|
-
|
|
502
481
|
/***/ }),
|
|
503
482
|
|
|
504
483
|
/***/ 679:
|
|
@@ -3031,42 +3010,6 @@ module.exports = function (name) {
|
|
|
3031
3010
|
};
|
|
3032
3011
|
|
|
3033
3012
|
|
|
3034
|
-
/***/ }),
|
|
3035
|
-
|
|
3036
|
-
/***/ 4423:
|
|
3037
|
-
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
3038
|
-
|
|
3039
|
-
"use strict";
|
|
3040
|
-
|
|
3041
|
-
var $ = __webpack_require__(6518);
|
|
3042
|
-
var $includes = (__webpack_require__(9617).includes);
|
|
3043
|
-
var fails = __webpack_require__(9039);
|
|
3044
|
-
var addToUnscopables = __webpack_require__(6469);
|
|
3045
|
-
|
|
3046
|
-
// FF99+ bug
|
|
3047
|
-
var BROKEN_ON_SPARSE = fails(function () {
|
|
3048
|
-
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
3049
|
-
return !Array(1).includes();
|
|
3050
|
-
});
|
|
3051
|
-
|
|
3052
|
-
// Safari 26.4- bug
|
|
3053
|
-
var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
|
|
3054
|
-
// eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
|
|
3055
|
-
return [, 1].includes(undefined, 1);
|
|
3056
|
-
});
|
|
3057
|
-
|
|
3058
|
-
// `Array.prototype.includes` method
|
|
3059
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
3060
|
-
$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
|
|
3061
|
-
includes: function includes(el /* , fromIndex = 0 */) {
|
|
3062
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
3063
|
-
}
|
|
3064
|
-
});
|
|
3065
|
-
|
|
3066
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
3067
|
-
addToUnscopables('includes');
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
3013
|
/***/ }),
|
|
3071
3014
|
|
|
3072
3015
|
/***/ 4114:
|
|
@@ -3322,6 +3265,46 @@ $({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
|
|
|
3322
3265
|
});
|
|
3323
3266
|
|
|
3324
3267
|
|
|
3268
|
+
/***/ }),
|
|
3269
|
+
|
|
3270
|
+
/***/ 3579:
|
|
3271
|
+
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
3272
|
+
|
|
3273
|
+
"use strict";
|
|
3274
|
+
|
|
3275
|
+
var $ = __webpack_require__(6518);
|
|
3276
|
+
var call = __webpack_require__(9565);
|
|
3277
|
+
var iterate = __webpack_require__(2652);
|
|
3278
|
+
var aCallable = __webpack_require__(9306);
|
|
3279
|
+
var anObject = __webpack_require__(8551);
|
|
3280
|
+
var getIteratorDirect = __webpack_require__(1767);
|
|
3281
|
+
var iteratorClose = __webpack_require__(9539);
|
|
3282
|
+
var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
|
|
3283
|
+
|
|
3284
|
+
var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError);
|
|
3285
|
+
|
|
3286
|
+
// `Iterator.prototype.some` method
|
|
3287
|
+
// https://tc39.es/ecma262/#sec-iterator.prototype.some
|
|
3288
|
+
$({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {
|
|
3289
|
+
some: function some(predicate) {
|
|
3290
|
+
anObject(this);
|
|
3291
|
+
try {
|
|
3292
|
+
aCallable(predicate);
|
|
3293
|
+
} catch (error) {
|
|
3294
|
+
iteratorClose(this, 'throw', error);
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3297
|
+
if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);
|
|
3298
|
+
|
|
3299
|
+
var record = getIteratorDirect(this);
|
|
3300
|
+
var counter = 0;
|
|
3301
|
+
return iterate(record, function (value, stop) {
|
|
3302
|
+
if (predicate(value, counter++)) return stop();
|
|
3303
|
+
}, { IS_RECORD: true, INTERRUPTED: true }).stopped;
|
|
3304
|
+
}
|
|
3305
|
+
});
|
|
3306
|
+
|
|
3307
|
+
|
|
3325
3308
|
/***/ }),
|
|
3326
3309
|
|
|
3327
3310
|
/***/ 3110:
|
|
@@ -3584,7 +3567,7 @@ if (typeof window !== 'undefined') {
|
|
|
3584
3567
|
|
|
3585
3568
|
// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
|
3586
3569
|
var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(9274);
|
|
3587
|
-
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/ModulePageSelect.vue?vue&type=template&id=
|
|
3570
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/ModulePageSelect.vue?vue&type=template&id=0b2fc41a&scoped=true
|
|
3588
3571
|
|
|
3589
3572
|
const _hoisted_1 = {
|
|
3590
3573
|
class: "module-page-select"
|
|
@@ -3619,11 +3602,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3619
3602
|
onChange: $options.handleModuleChange,
|
|
3620
3603
|
onFocus: $options.handleModuleFocus,
|
|
3621
3604
|
placeholder: "请选择模块",
|
|
3605
|
+
loading: $data.moduleLoading,
|
|
3622
3606
|
"allow-clear": "",
|
|
3623
3607
|
"allow-search": "",
|
|
3624
3608
|
size: "small"
|
|
3625
3609
|
}, {
|
|
3626
|
-
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderList)($
|
|
3610
|
+
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderList)($options.moduleOptions, module => {
|
|
3627
3611
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createBlock)(_component_a_option, {
|
|
3628
3612
|
key: module.id,
|
|
3629
3613
|
value: module.id
|
|
@@ -3633,7 +3617,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3633
3617
|
}, 1032, ["value"]);
|
|
3634
3618
|
}), 128))]),
|
|
3635
3619
|
_: 1
|
|
3636
|
-
}, 8, ["modelValue", "onChange", "onFocus"])]),
|
|
3620
|
+
}, 8, ["modelValue", "onChange", "onFocus", "loading"])]),
|
|
3637
3621
|
_: 1
|
|
3638
3622
|
}), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createVNode)(_component_a_form_item, {
|
|
3639
3623
|
label: "选择页面"
|
|
@@ -3642,13 +3626,15 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3642
3626
|
modelValue: $data.selectedPageId,
|
|
3643
3627
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = $event => $data.selectedPageId = $event),
|
|
3644
3628
|
onChange: $options.handlePageChange,
|
|
3629
|
+
onFocus: $options.handlePageFocus,
|
|
3645
3630
|
placeholder: "请选择页面",
|
|
3646
3631
|
disabled: !$data.selectedModuleId,
|
|
3632
|
+
loading: $data.pageLoading,
|
|
3647
3633
|
"allow-clear": "",
|
|
3648
3634
|
"allow-search": "",
|
|
3649
3635
|
size: "small"
|
|
3650
3636
|
}, {
|
|
3651
|
-
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderList)($
|
|
3637
|
+
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderList)($options.pageOptions, page => {
|
|
3652
3638
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createBlock)(_component_a_option, {
|
|
3653
3639
|
key: page.id,
|
|
3654
3640
|
value: page.id
|
|
@@ -3658,7 +3644,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3658
3644
|
}, 1032, ["value"]);
|
|
3659
3645
|
}), 128))]),
|
|
3660
3646
|
_: 1
|
|
3661
|
-
}, 8, ["modelValue", "onChange", "disabled"])]),
|
|
3647
|
+
}, 8, ["modelValue", "onChange", "onFocus", "disabled", "loading"])]),
|
|
3662
3648
|
_: 1
|
|
3663
3649
|
}), $data.selectedModuleName && $data.selectedPageName ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)("div", _hoisted_2, [_cache[2] || (_cache[2] = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("div", {
|
|
3664
3650
|
class: "preview-label"
|
|
@@ -3732,7 +3718,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3732
3718
|
_: 1
|
|
3733
3719
|
})]);
|
|
3734
3720
|
}
|
|
3735
|
-
;// ./src/components/ModulePageSelect.vue?vue&type=template&id=
|
|
3721
|
+
;// ./src/components/ModulePageSelect.vue?vue&type=template&id=0b2fc41a&scoped=true
|
|
3736
3722
|
|
|
3737
3723
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
|
|
3738
3724
|
var es_iterator_constructor = __webpack_require__(8111);
|
|
@@ -3742,276 +3728,12 @@ var es_iterator_find = __webpack_require__(116);
|
|
|
3742
3728
|
var es_iterator_for_each = __webpack_require__(7588);
|
|
3743
3729
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
|
|
3744
3730
|
var es_iterator_map = __webpack_require__(1701);
|
|
3731
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
3732
|
+
var es_iterator_some = __webpack_require__(3579);
|
|
3745
3733
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.json.stringify.js
|
|
3746
3734
|
var es_json_stringify = __webpack_require__(3110);
|
|
3747
|
-
// EXTERNAL MODULE:
|
|
3748
|
-
var
|
|
3749
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/utils/throw-error.js
|
|
3750
|
-
function throwError(msg) {
|
|
3751
|
-
const err = new Error(msg);
|
|
3752
|
-
err.name = '[gateway-request]';
|
|
3753
|
-
throw err;
|
|
3754
|
-
}
|
|
3755
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/utils/request.js
|
|
3756
|
-
/* unused harmony import specifier */ var axios;
|
|
3757
|
-
/* unused harmony import specifier */ var request_throwError;
|
|
3758
|
-
|
|
3759
|
-
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
3760
|
-
function adopt(value) {
|
|
3761
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
3762
|
-
resolve(value);
|
|
3763
|
-
});
|
|
3764
|
-
}
|
|
3765
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3766
|
-
function fulfilled(value) {
|
|
3767
|
-
try {
|
|
3768
|
-
step(generator.next(value));
|
|
3769
|
-
} catch (e) {
|
|
3770
|
-
reject(e);
|
|
3771
|
-
}
|
|
3772
|
-
}
|
|
3773
|
-
function rejected(value) {
|
|
3774
|
-
try {
|
|
3775
|
-
step(generator["throw"](value));
|
|
3776
|
-
} catch (e) {
|
|
3777
|
-
reject(e);
|
|
3778
|
-
}
|
|
3779
|
-
}
|
|
3780
|
-
function step(result) {
|
|
3781
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
3782
|
-
}
|
|
3783
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3784
|
-
});
|
|
3785
|
-
};
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
class GatewayRequest {
|
|
3789
|
-
constructor(config) {
|
|
3790
|
-
this.globalMessage = {
|
|
3791
|
-
success: true,
|
|
3792
|
-
fail: true
|
|
3793
|
-
};
|
|
3794
|
-
const gateway_config = config;
|
|
3795
|
-
this.gateway_config = gateway_config;
|
|
3796
|
-
if (!['null', 'undefined'].includes(typeof config.globalMessage)) {
|
|
3797
|
-
if (typeof config.globalMessage === 'object') {
|
|
3798
|
-
if (typeof config.globalMessage.success === 'boolean') {
|
|
3799
|
-
this.globalMessage.success = config.globalMessage.success;
|
|
3800
|
-
}
|
|
3801
|
-
if (typeof config.globalMessage.fail === 'boolean') {
|
|
3802
|
-
this.globalMessage.fail = config.globalMessage.fail;
|
|
3803
|
-
}
|
|
3804
|
-
}
|
|
3805
|
-
}
|
|
3806
|
-
}
|
|
3807
|
-
getConfig(key) {
|
|
3808
|
-
return this.gateway_config[key];
|
|
3809
|
-
}
|
|
3810
|
-
getAccessToken() {
|
|
3811
|
-
if (!this.gateway_config.getToken) {
|
|
3812
|
-
request_throwError('未设置`getToken`方法。');
|
|
3813
|
-
}
|
|
3814
|
-
const access_token = this.gateway_config.getToken();
|
|
3815
|
-
return access_token;
|
|
3816
|
-
}
|
|
3817
|
-
openMessage(res, options) {
|
|
3818
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3819
|
-
if ((_a = this.gateway_config.globalMessage) === null || _a === void 0 ? void 0 : _a.silent) return;
|
|
3820
|
-
const {
|
|
3821
|
-
type,
|
|
3822
|
-
message
|
|
3823
|
-
} = (_e = (_d = (_c = (_b = this.gateway_config) === null || _b === void 0 ? void 0 : _b.globalMessage) === null || _c === void 0 ? void 0 : _c.getMessage) === null || _d === void 0 ? void 0 : _d.call(_c, res)) !== null && _e !== void 0 ? _e : {};
|
|
3824
|
-
if (!message) return;
|
|
3825
|
-
if (type === 'success' && ((_f = options === null || options === void 0 ? void 0 : options.success) !== null && _f !== void 0 ? _f : this.globalMessage.success) || type === 'fail' && ((_g = options === null || options === void 0 ? void 0 : options.fail) !== null && _g !== void 0 ? _g : this.globalMessage.fail)) {
|
|
3826
|
-
(_j = (_h = this.gateway_config.globalMessage) === null || _h === void 0 ? void 0 : _h.openMessage) === null || _j === void 0 ? void 0 : _j.call(_h, message, type);
|
|
3827
|
-
}
|
|
3828
|
-
}
|
|
3829
|
-
baseRequest(api, params, config) {
|
|
3830
|
-
const url = `${this.gateway_config.base_url}${api}`;
|
|
3831
|
-
const publicParams = {
|
|
3832
|
-
app_id: this.gateway_config.app_id,
|
|
3833
|
-
app_key: this.gateway_config.app_key,
|
|
3834
|
-
timestamp: Math.floor(+new Date() / 1000)
|
|
3835
|
-
};
|
|
3836
|
-
const _params = Object.assign(Object.assign({}, publicParams), (config === null || config === void 0 ? void 0 : config.plat) ? params : {
|
|
3837
|
-
data: params
|
|
3838
|
-
});
|
|
3839
|
-
if (config === null || config === void 0 ? void 0 : config.access_token) {
|
|
3840
|
-
if (!this.gateway_config.getToken) {
|
|
3841
|
-
request_throwError('未设置`getToken`方法。');
|
|
3842
|
-
}
|
|
3843
|
-
_params.access_token = this.gateway_config.getToken();
|
|
3844
|
-
}
|
|
3845
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
3846
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3847
|
-
try {
|
|
3848
|
-
(_c = (_b = (_a = this.gateway_config) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.beforeRequest) === null || _c === void 0 ? void 0 : _c.call(_b, {
|
|
3849
|
-
fullpath: url,
|
|
3850
|
-
api,
|
|
3851
|
-
params: _params
|
|
3852
|
-
});
|
|
3853
|
-
const axiosConfig = {
|
|
3854
|
-
timeout: (_d = config === null || config === void 0 ? void 0 : config.timeout) !== null && _d !== void 0 ? _d : this.gateway_config.timeout,
|
|
3855
|
-
adapter: this.gateway_config.adapter
|
|
3856
|
-
};
|
|
3857
|
-
const res = yield axios.post(url, _params, axiosConfig);
|
|
3858
|
-
// 打开全局消息提示
|
|
3859
|
-
this.openMessage(res, config === null || config === void 0 ? void 0 : config.globalMessage);
|
|
3860
|
-
(_g = (_f = (_e = this.gateway_config) === null || _e === void 0 ? void 0 : _e.hooks) === null || _f === void 0 ? void 0 : _f.afterResponse) === null || _g === void 0 ? void 0 : _g.call(_f, res);
|
|
3861
|
-
resolve(res);
|
|
3862
|
-
} catch (error) {
|
|
3863
|
-
(_k = (_j = (_h = this.gateway_config) === null || _h === void 0 ? void 0 : _h.hooks) === null || _j === void 0 ? void 0 : _j.error) === null || _k === void 0 ? void 0 : _k.call(_j, error);
|
|
3864
|
-
reject(error);
|
|
3865
|
-
}
|
|
3866
|
-
}));
|
|
3867
|
-
}
|
|
3868
|
-
}
|
|
3869
|
-
let gatewayRequest;
|
|
3870
|
-
function init(config) {
|
|
3871
|
-
if (!gatewayRequest) {
|
|
3872
|
-
gatewayRequest = new GatewayRequest(config);
|
|
3873
|
-
} else {
|
|
3874
|
-
console.warn(`[gateway-request]: Instance already exists.`);
|
|
3875
|
-
}
|
|
3876
|
-
}
|
|
3877
|
-
const request = options => {
|
|
3878
|
-
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3879
|
-
var _a, _b, _c, _d, _e;
|
|
3880
|
-
try {
|
|
3881
|
-
if (!gatewayRequest) {
|
|
3882
|
-
throwError('未初始化。');
|
|
3883
|
-
}
|
|
3884
|
-
const config = {
|
|
3885
|
-
plat: (_a = options.config) === null || _a === void 0 ? void 0 : _a.plat,
|
|
3886
|
-
access_token: (_b = options.config) === null || _b === void 0 ? void 0 : _b.access_token
|
|
3887
|
-
};
|
|
3888
|
-
// 处理是否打开全局消息
|
|
3889
|
-
if (!['null', 'undefined'].includes(typeof ((_c = options.config) === null || _c === void 0 ? void 0 : _c.globalMessage))) {
|
|
3890
|
-
config.globalMessage = {};
|
|
3891
|
-
if (typeof options.config.globalMessage === 'boolean') {
|
|
3892
|
-
config.globalMessage.success = config.globalMessage.fail = options.config.globalMessage;
|
|
3893
|
-
}
|
|
3894
|
-
if (typeof options.config.globalMessage === 'object') {
|
|
3895
|
-
if (typeof options.config.globalMessage.success === 'boolean') {
|
|
3896
|
-
config.globalMessage.success = options.config.globalMessage.success;
|
|
3897
|
-
}
|
|
3898
|
-
if (typeof options.config.globalMessage.fail === 'boolean') {
|
|
3899
|
-
config.globalMessage.fail = options.config.globalMessage.fail;
|
|
3900
|
-
}
|
|
3901
|
-
}
|
|
3902
|
-
}
|
|
3903
|
-
// 处理请求参数
|
|
3904
|
-
const params = (data => {
|
|
3905
|
-
if (typeof data === 'object') return data;
|
|
3906
|
-
if (typeof data === 'function') {
|
|
3907
|
-
return data();
|
|
3908
|
-
}
|
|
3909
|
-
return {};
|
|
3910
|
-
})(options.params);
|
|
3911
|
-
/** 默认响应数据转换法方法 */
|
|
3912
|
-
const defaultTransformResponse = response => {
|
|
3913
|
-
if (response.code === 10000) {
|
|
3914
|
-
return Promise.resolve(response.data);
|
|
3915
|
-
} else {
|
|
3916
|
-
return Promise.reject(response);
|
|
3917
|
-
}
|
|
3918
|
-
};
|
|
3919
|
-
/** 响应数据 */
|
|
3920
|
-
const response = yield options.requester ? (options => {
|
|
3921
|
-
const _this = {
|
|
3922
|
-
base_url: gatewayRequest.getConfig('base_url'),
|
|
3923
|
-
app_id: gatewayRequest.getConfig('app_id'),
|
|
3924
|
-
app_key: gatewayRequest.getConfig('app_key'),
|
|
3925
|
-
getToken: gatewayRequest.getConfig('getToken'),
|
|
3926
|
-
hooks: {
|
|
3927
|
-
beforeRequest: config => {
|
|
3928
|
-
var _a, _b;
|
|
3929
|
-
(_b = (_a = gatewayRequest === null || gatewayRequest === void 0 ? void 0 : gatewayRequest.getConfig('hooks')) === null || _a === void 0 ? void 0 : _a.beforeRequest) === null || _b === void 0 ? void 0 : _b.call(_a, config);
|
|
3930
|
-
},
|
|
3931
|
-
afterResponse: res => {
|
|
3932
|
-
var _a, _b;
|
|
3933
|
-
(_b = (_a = gatewayRequest === null || gatewayRequest === void 0 ? void 0 : gatewayRequest.getConfig('hooks')) === null || _a === void 0 ? void 0 : _a.afterResponse) === null || _b === void 0 ? void 0 : _b.call(_a, res);
|
|
3934
|
-
},
|
|
3935
|
-
error: e => {
|
|
3936
|
-
var _a, _b;
|
|
3937
|
-
(_b = (_a = gatewayRequest === null || gatewayRequest === void 0 ? void 0 : gatewayRequest.getConfig('hooks')) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
3938
|
-
}
|
|
3939
|
-
},
|
|
3940
|
-
openMessage: gatewayRequest.openMessage.bind(gatewayRequest)
|
|
3941
|
-
};
|
|
3942
|
-
const requester = options.requester;
|
|
3943
|
-
return requester.call(_this, options.api, params, options.config);
|
|
3944
|
-
})(options) : gatewayRequest.baseRequest(options.api, params, options.config);
|
|
3945
|
-
/** 响应数据转换结果 */
|
|
3946
|
-
const transformResponse = (_d = options === null || options === void 0 ? void 0 : options.transformResponse) !== null && _d !== void 0 ? _d : defaultTransformResponse;
|
|
3947
|
-
const transformResponseData = yield transformResponse((_e = response === null || response === void 0 ? void 0 : response.data) !== null && _e !== void 0 ? _e : {}, response);
|
|
3948
|
-
resolve({
|
|
3949
|
-
axiosResponse: response,
|
|
3950
|
-
response: response.data,
|
|
3951
|
-
data: transformResponseData
|
|
3952
|
-
});
|
|
3953
|
-
} catch (error) {
|
|
3954
|
-
reject(error);
|
|
3955
|
-
}
|
|
3956
|
-
}));
|
|
3957
|
-
};
|
|
3958
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/utils/deep-merge.js
|
|
3959
|
-
/** 深度合并对象 */
|
|
3960
|
-
const deepMerge = (target, source) => {
|
|
3961
|
-
var _a;
|
|
3962
|
-
if (typeof target !== 'object' || target === null) {
|
|
3963
|
-
return target;
|
|
3964
|
-
}
|
|
3965
|
-
if (typeof source !== 'object' || source === null) {
|
|
3966
|
-
return target;
|
|
3967
|
-
}
|
|
3968
|
-
for (const key in source) {
|
|
3969
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3970
|
-
if (typeof source[key] === 'object' && source[key] !== null) {
|
|
3971
|
-
// Recursively merge nested objects
|
|
3972
|
-
const defaultObj = deepMerge(Array.isArray(source[key]) ? [] : {}, target[key]);
|
|
3973
|
-
target[key] = deepMerge(defaultObj, source[key]);
|
|
3974
|
-
} else {
|
|
3975
|
-
target[key] = (_a = source[key]) !== null && _a !== void 0 ? _a : target[key];
|
|
3976
|
-
}
|
|
3977
|
-
}
|
|
3978
|
-
}
|
|
3979
|
-
return target;
|
|
3980
|
-
};
|
|
3981
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/main.js
|
|
3982
|
-
/* unused harmony import specifier */ var main_init;
|
|
3983
|
-
/* unused harmony import specifier */ var main_request;
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
const apis = new Proxy({
|
|
3987
|
-
value: {},
|
|
3988
|
-
deepMerge(newApis) {
|
|
3989
|
-
return deepMerge(this.value, newApis);
|
|
3990
|
-
}
|
|
3991
|
-
}, {
|
|
3992
|
-
get(target, key) {
|
|
3993
|
-
if (key === 'deepMerge') {
|
|
3994
|
-
return target.deepMerge.bind(target);
|
|
3995
|
-
}
|
|
3996
|
-
if (key in target.value) {
|
|
3997
|
-
return target.value[key];
|
|
3998
|
-
}
|
|
3999
|
-
}
|
|
4000
|
-
});
|
|
4001
|
-
const originalInit = (/* unused pure expression or super */ null && (main_init));
|
|
4002
|
-
function wrappedInit(...args) {
|
|
4003
|
-
const result = originalInit(...args);
|
|
4004
|
-
if (typeof window !== 'undefined') {
|
|
4005
|
-
window.gatewayRequest = {
|
|
4006
|
-
request: main_request,
|
|
4007
|
-
apis,
|
|
4008
|
-
registerApis
|
|
4009
|
-
};
|
|
4010
|
-
}
|
|
4011
|
-
return result;
|
|
4012
|
-
}
|
|
4013
|
-
const registerApis = apis.deepMerge.bind(apis);
|
|
4014
|
-
|
|
3735
|
+
// EXTERNAL MODULE: external {"commonjs":"@tuoyuan/gateway-request-lib","commonjs2":"@tuoyuan/gateway-request-lib","root":"GatewayRequestLib"}
|
|
3736
|
+
var gateway_request_lib_root_GatewayRequestLib_ = __webpack_require__(3092);
|
|
4015
3737
|
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/ModulePageSelect.vue?vue&type=script&lang=js
|
|
4016
3738
|
|
|
4017
3739
|
|
|
@@ -4019,6 +3741,7 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4019
3741
|
|
|
4020
3742
|
|
|
4021
3743
|
|
|
3744
|
+
|
|
4022
3745
|
/* harmony default export */ var ModulePageSelectvue_type_script_lang_js = ({
|
|
4023
3746
|
name: 'ModulePageSelect',
|
|
4024
3747
|
props: {
|
|
@@ -4036,6 +3759,11 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4036
3759
|
pageId: {
|
|
4037
3760
|
type: String,
|
|
4038
3761
|
default: ''
|
|
3762
|
+
},
|
|
3763
|
+
// 是否在挂载时按已有值自动回显(拉取模块/页面列表补全名称)
|
|
3764
|
+
autoEcho: {
|
|
3765
|
+
type: Boolean,
|
|
3766
|
+
default: true
|
|
4039
3767
|
}
|
|
4040
3768
|
},
|
|
4041
3769
|
emits: ['update:modelValue', 'change', 'error'],
|
|
@@ -4057,123 +3785,136 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4057
3785
|
// 控制确认按钮显示
|
|
4058
3786
|
showConfirmButton: true,
|
|
4059
3787
|
// 记录上次确认的状态
|
|
4060
|
-
lastConfirmedState: null
|
|
3788
|
+
lastConfirmedState: null,
|
|
3789
|
+
// 加载状态
|
|
3790
|
+
moduleLoading: false,
|
|
3791
|
+
pageLoading: false,
|
|
3792
|
+
// 回显兜底名称(列表未加载时先占位显示)
|
|
3793
|
+
echoModuleName: '',
|
|
3794
|
+
echoPageName: '',
|
|
3795
|
+
// 已处理过的回显标识,避免 modelValue 深度监听重复触发
|
|
3796
|
+
appliedEchoKey: ''
|
|
4061
3797
|
};
|
|
4062
3798
|
},
|
|
4063
3799
|
computed: {
|
|
4064
3800
|
pageType() {
|
|
4065
3801
|
const type = this.modelValue?.type || 'mobile';
|
|
4066
3802
|
return type === 'mobile' ? 2 : 1;
|
|
3803
|
+
},
|
|
3804
|
+
// 模块下拉项:列表 + 回显兜底项(选中值不在列表里时补一项,保证有回显)
|
|
3805
|
+
moduleOptions() {
|
|
3806
|
+
return this.withFallbackOption(this.modules, this.selectedModuleId, this.echoModuleName, '模块');
|
|
3807
|
+
},
|
|
3808
|
+
// 页面下拉项:同上
|
|
3809
|
+
pageOptions() {
|
|
3810
|
+
return this.withFallbackOption(this.pages, this.selectedPageId, this.echoPageName, '页面');
|
|
4067
3811
|
}
|
|
4068
3812
|
},
|
|
4069
3813
|
watch: {
|
|
4070
|
-
//
|
|
3814
|
+
// 监听外部值变化(用于回显)。只比对回显相关字段,避免深度监听重复执行
|
|
4071
3815
|
modelValue: {
|
|
4072
|
-
immediate: true,
|
|
4073
3816
|
deep: true,
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
// 从 modelValue 中提取模块ID和页面ID
|
|
4077
|
-
const moduleId = val.module_id || this.moduleId;
|
|
4078
|
-
const pageId = val.page_id || this.pageId;
|
|
4079
|
-
|
|
4080
|
-
// 如果有模块ID且与当前选中不同,则回显
|
|
4081
|
-
if (moduleId && moduleId !== this.selectedModuleId) {
|
|
4082
|
-
this.selectedModuleId = moduleId;
|
|
4083
|
-
this.selectedModuleName = val.module_name || '';
|
|
4084
|
-
|
|
4085
|
-
// 等待模块列表加载完成
|
|
4086
|
-
if (this.modules.length === 0) {
|
|
4087
|
-
await this.loadModules();
|
|
4088
|
-
}
|
|
4089
|
-
|
|
4090
|
-
// 查找模块名称
|
|
4091
|
-
if (!this.selectedModuleName) {
|
|
4092
|
-
const module = this.modules.find(m => m.id === moduleId);
|
|
4093
|
-
if (module) {
|
|
4094
|
-
this.selectedModuleName = module.name;
|
|
4095
|
-
}
|
|
4096
|
-
}
|
|
4097
|
-
|
|
4098
|
-
// 加载页面列表
|
|
4099
|
-
await this.loadPages(moduleId);
|
|
4100
|
-
}
|
|
4101
|
-
|
|
4102
|
-
// 如果有页面ID且与当前选中不同,则回显
|
|
4103
|
-
if (pageId && pageId !== this.selectedPageId) {
|
|
4104
|
-
this.selectedPageId = pageId;
|
|
4105
|
-
this.selectedPageName = val.page_name || '';
|
|
4106
|
-
|
|
4107
|
-
// 如果页面列表已加载,查找页面信息
|
|
4108
|
-
if (this.pages.length > 0) {
|
|
4109
|
-
const page = this.pages.find(p => p.id === pageId);
|
|
4110
|
-
if (page) {
|
|
4111
|
-
this.selectedPageName = page.name;
|
|
4112
|
-
this.currentPage = page;
|
|
4113
|
-
this.loadPageConfig(page);
|
|
4114
|
-
|
|
4115
|
-
// 如果有配置数据,回显配置
|
|
4116
|
-
if (val.config) {
|
|
4117
|
-
this.formData = {
|
|
4118
|
-
...val.config
|
|
4119
|
-
};
|
|
4120
|
-
}
|
|
4121
|
-
}
|
|
4122
|
-
}
|
|
4123
|
-
}
|
|
4124
|
-
}
|
|
3817
|
+
handler() {
|
|
3818
|
+
this.applyEcho();
|
|
4125
3819
|
}
|
|
4126
3820
|
},
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
immediate: true,
|
|
4130
|
-
async handler(val) {
|
|
4131
|
-
if (val && val !== this.selectedModuleId && !this.modelValue?.module_id) {
|
|
4132
|
-
this.selectedModuleId = val;
|
|
4133
|
-
|
|
4134
|
-
// 等待模块列表加载
|
|
4135
|
-
if (this.modules.length === 0) {
|
|
4136
|
-
await this.loadModules();
|
|
4137
|
-
}
|
|
4138
|
-
|
|
4139
|
-
// 查找模块名称
|
|
4140
|
-
const module = this.modules.find(m => m.id === val);
|
|
4141
|
-
if (module) {
|
|
4142
|
-
this.selectedModuleName = module.name;
|
|
4143
|
-
}
|
|
4144
|
-
await this.loadPages(val);
|
|
4145
|
-
}
|
|
4146
|
-
}
|
|
3821
|
+
moduleId() {
|
|
3822
|
+
this.applyEcho();
|
|
4147
3823
|
},
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
immediate: true,
|
|
4151
|
-
async handler(val) {
|
|
4152
|
-
if (val && val !== this.selectedPageId && !this.modelValue?.page_id) {
|
|
4153
|
-
this.selectedPageId = val;
|
|
4154
|
-
// 如果页面列表已加载,查找页面信息
|
|
4155
|
-
if (this.pages.length > 0) {
|
|
4156
|
-
const page = this.pages.find(p => p.id === val);
|
|
4157
|
-
if (page) {
|
|
4158
|
-
this.selectedPageName = page.name;
|
|
4159
|
-
this.currentPage = page;
|
|
4160
|
-
this.loadPageConfig(page);
|
|
4161
|
-
}
|
|
4162
|
-
}
|
|
4163
|
-
}
|
|
4164
|
-
}
|
|
3824
|
+
pageId() {
|
|
3825
|
+
this.applyEcho();
|
|
4165
3826
|
}
|
|
4166
3827
|
},
|
|
4167
3828
|
mounted() {
|
|
4168
|
-
//
|
|
4169
|
-
|
|
4170
|
-
if (this.modelValue?.module_id || this.moduleId) {
|
|
4171
|
-
this.$nextTick(() => {
|
|
4172
|
-
this.loadModules();
|
|
4173
|
-
});
|
|
4174
|
-
}
|
|
3829
|
+
// 挂载时按已有值回显;无值时不请求接口,等用户 focus 再懒加载
|
|
3830
|
+
this.applyEcho();
|
|
4175
3831
|
},
|
|
4176
3832
|
methods: {
|
|
3833
|
+
// 统一的字符串化,规避接口返回数字ID与保存的字符串ID类型不一致
|
|
3834
|
+
normalizeId(value) {
|
|
3835
|
+
return value === null || value === undefined ? '' : String(value);
|
|
3836
|
+
},
|
|
3837
|
+
// 从外部值中取出回显所需字段
|
|
3838
|
+
resolveEchoSource() {
|
|
3839
|
+
const val = this.modelValue && typeof this.modelValue === 'object' ? this.modelValue : {};
|
|
3840
|
+
return {
|
|
3841
|
+
moduleId: this.normalizeId(val.module_id || this.moduleId),
|
|
3842
|
+
pageId: this.normalizeId(val.page_id || this.pageId),
|
|
3843
|
+
moduleName: val.module_name || '',
|
|
3844
|
+
pageName: val.page_name || '',
|
|
3845
|
+
config: val.config
|
|
3846
|
+
};
|
|
3847
|
+
},
|
|
3848
|
+
// 下拉项兜底:选中值不在列表中时补一项,保证刷新后能看到已选内容
|
|
3849
|
+
withFallbackOption(list, selectedId, echoName, typeLabel) {
|
|
3850
|
+
const options = Array.isArray(list) ? list : [];
|
|
3851
|
+
if (!selectedId) return options;
|
|
3852
|
+
if (options.some(item => this.normalizeId(item.id) === selectedId)) return options;
|
|
3853
|
+
return [{
|
|
3854
|
+
id: selectedId,
|
|
3855
|
+
name: echoName || `${typeLabel}(${selectedId})`
|
|
3856
|
+
}, ...options];
|
|
3857
|
+
},
|
|
3858
|
+
// 回显入口:把外部值同步到内部选中态,并按需补全名称与页面配置
|
|
3859
|
+
async applyEcho() {
|
|
3860
|
+
const source = this.resolveEchoSource();
|
|
3861
|
+
if (!source.moduleId && !source.pageId) return;
|
|
3862
|
+
const echoKey = JSON.stringify([source.moduleId, source.pageId]);
|
|
3863
|
+
if (echoKey === this.appliedEchoKey) return;
|
|
3864
|
+
this.appliedEchoKey = echoKey;
|
|
3865
|
+
this.selectedModuleId = source.moduleId;
|
|
3866
|
+
this.selectedPageId = source.pageId;
|
|
3867
|
+
this.echoModuleName = source.moduleName;
|
|
3868
|
+
this.echoPageName = source.pageName;
|
|
3869
|
+
this.selectedModuleName = source.moduleName;
|
|
3870
|
+
this.selectedPageName = source.pageName;
|
|
3871
|
+
if (source.config && typeof source.config === 'object') {
|
|
3872
|
+
this.formData = {
|
|
3873
|
+
...source.config
|
|
3874
|
+
};
|
|
3875
|
+
}
|
|
3876
|
+
// 已是保存过的值,未改动前不需要再次确认
|
|
3877
|
+
this.showConfirmButton = false;
|
|
3878
|
+
this.lastConfirmedState = JSON.stringify({
|
|
3879
|
+
moduleId: source.moduleId,
|
|
3880
|
+
pageId: source.pageId,
|
|
3881
|
+
config: source.config
|
|
3882
|
+
});
|
|
3883
|
+
if (!this.autoEcho) return;
|
|
3884
|
+
|
|
3885
|
+
// 只有页面ID没有模块ID时,反查页面所属模块
|
|
3886
|
+
if (!this.selectedModuleId && this.selectedPageId) {
|
|
3887
|
+
const moduleId = await this.lookupModuleIdByPage(this.selectedPageId);
|
|
3888
|
+
if (moduleId) {
|
|
3889
|
+
this.selectedModuleId = moduleId;
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
await this.loadModules();
|
|
3893
|
+
this.syncModuleName();
|
|
3894
|
+
if (this.selectedModuleId) {
|
|
3895
|
+
await this.loadPages(this.selectedModuleId, this.selectedPageId);
|
|
3896
|
+
}
|
|
3897
|
+
},
|
|
3898
|
+
// 用已加载的模块列表补全模块名称
|
|
3899
|
+
syncModuleName() {
|
|
3900
|
+
if (!this.selectedModuleId) return;
|
|
3901
|
+
const module = this.modules.find(m => this.normalizeId(m.id) === this.selectedModuleId);
|
|
3902
|
+
if (module) {
|
|
3903
|
+
this.selectedModuleName = module.name;
|
|
3904
|
+
this.echoModuleName = module.name;
|
|
3905
|
+
}
|
|
3906
|
+
},
|
|
3907
|
+
// 通过页面列表接口反查页面所属模块(兼容只保存了 page_id 的历史数据)
|
|
3908
|
+
async lookupModuleIdByPage(pageId) {
|
|
3909
|
+
try {
|
|
3910
|
+
const pages = await this.fetchPagesFromAPI();
|
|
3911
|
+
const page = pages.find(p => this.normalizeId(p.id) === this.normalizeId(pageId));
|
|
3912
|
+
return page ? this.normalizeId(page.moduleId) : '';
|
|
3913
|
+
} catch (error) {
|
|
3914
|
+
console.error('反查页面所属模块失败:', error);
|
|
3915
|
+
return '';
|
|
3916
|
+
}
|
|
3917
|
+
},
|
|
4177
3918
|
// 加载模块列表
|
|
4178
3919
|
async loadModules() {
|
|
4179
3920
|
try {
|
|
@@ -4181,32 +3922,24 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4181
3922
|
this.modules = this.moduleCache;
|
|
4182
3923
|
return;
|
|
4183
3924
|
}
|
|
3925
|
+
this.moduleLoading = true;
|
|
4184
3926
|
const moduleList = await this.fetchModulesFromAPI();
|
|
4185
3927
|
this.modules = moduleList;
|
|
4186
3928
|
this.moduleCache = moduleList;
|
|
4187
|
-
|
|
4188
|
-
// 如果有默认模块ID,加载对应页面
|
|
4189
|
-
if (this.moduleId) {
|
|
4190
|
-
this.selectedModuleId = this.moduleId;
|
|
4191
|
-
// 查找模块名称
|
|
4192
|
-
const module = this.modules.find(m => m.id === this.moduleId);
|
|
4193
|
-
if (module) {
|
|
4194
|
-
this.selectedModuleName = module.name;
|
|
4195
|
-
}
|
|
4196
|
-
await this.loadPages(this.moduleId);
|
|
4197
|
-
}
|
|
4198
3929
|
} catch (error) {
|
|
4199
3930
|
console.error('加载模块列表失败:', error);
|
|
4200
3931
|
this.$emit('error', {
|
|
4201
3932
|
type: 'loadModules',
|
|
4202
3933
|
error
|
|
4203
3934
|
});
|
|
3935
|
+
} finally {
|
|
3936
|
+
this.moduleLoading = false;
|
|
4204
3937
|
}
|
|
4205
3938
|
},
|
|
4206
3939
|
// 从 API 获取模块列表(使用模块列表接口)
|
|
4207
3940
|
async fetchModulesFromAPI() {
|
|
4208
3941
|
try {
|
|
4209
|
-
const response = await request({
|
|
3942
|
+
const response = await (0,gateway_request_lib_root_GatewayRequestLib_.request)({
|
|
4210
3943
|
api: '/api/assembly-center.extend_module.list',
|
|
4211
3944
|
params: {
|
|
4212
3945
|
page_no: 1,
|
|
@@ -4224,7 +3957,7 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4224
3957
|
|
|
4225
3958
|
// 将模块列表转换为选项格式
|
|
4226
3959
|
return modules.map(module => ({
|
|
4227
|
-
id: module.id,
|
|
3960
|
+
id: this.normalizeId(module.id),
|
|
4228
3961
|
name: module.name
|
|
4229
3962
|
}));
|
|
4230
3963
|
} catch (error) {
|
|
@@ -4233,9 +3966,16 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4233
3966
|
}
|
|
4234
3967
|
},
|
|
4235
3968
|
// 模块下拉框获得焦点时加载数据
|
|
4236
|
-
handleModuleFocus() {
|
|
3969
|
+
async handleModuleFocus() {
|
|
4237
3970
|
if (this.modules.length === 0) {
|
|
4238
|
-
this.loadModules();
|
|
3971
|
+
await this.loadModules();
|
|
3972
|
+
this.syncModuleName();
|
|
3973
|
+
}
|
|
3974
|
+
},
|
|
3975
|
+
// 页面下拉框获得焦点时按需加载(回显失败时给用户补救机会)
|
|
3976
|
+
async handlePageFocus() {
|
|
3977
|
+
if (this.selectedModuleId && this.pages.length === 0) {
|
|
3978
|
+
await this.loadPages(this.selectedModuleId, this.selectedPageId);
|
|
4239
3979
|
}
|
|
4240
3980
|
},
|
|
4241
3981
|
// 模块切换
|
|
@@ -4250,34 +3990,35 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4250
3990
|
|
|
4251
3991
|
// 选择改变,显示确认按钮
|
|
4252
3992
|
this.showConfirmButton = true;
|
|
3993
|
+
this.echoPageName = '';
|
|
4253
3994
|
if (this.selectedModuleId) {
|
|
4254
3995
|
// 更新模块名称
|
|
4255
|
-
|
|
4256
|
-
if (module) {
|
|
4257
|
-
this.selectedModuleName = module.name;
|
|
4258
|
-
}
|
|
3996
|
+
this.syncModuleName();
|
|
4259
3997
|
await this.loadPages(this.selectedModuleId);
|
|
4260
3998
|
} else {
|
|
4261
3999
|
this.selectedModuleName = '';
|
|
4000
|
+
this.echoModuleName = '';
|
|
4262
4001
|
}
|
|
4263
4002
|
},
|
|
4264
|
-
//
|
|
4265
|
-
async loadPages(moduleId) {
|
|
4003
|
+
// 加载页面列表;echoPageId 有值时同步回显该页面的名称与配置
|
|
4004
|
+
async loadPages(moduleId, echoPageId = '') {
|
|
4005
|
+
const cacheKey = this.normalizeId(moduleId);
|
|
4266
4006
|
try {
|
|
4267
|
-
if (this.pageCache[
|
|
4268
|
-
this.pages = this.pageCache[
|
|
4007
|
+
if (this.pageCache[cacheKey]) {
|
|
4008
|
+
this.pages = this.pageCache[cacheKey];
|
|
4269
4009
|
} else {
|
|
4270
|
-
|
|
4010
|
+
this.pageLoading = true;
|
|
4011
|
+
const pageList = await this.fetchPagesFromAPI(cacheKey);
|
|
4271
4012
|
this.pages = pageList;
|
|
4272
|
-
this.pageCache[
|
|
4013
|
+
this.pageCache[cacheKey] = pageList;
|
|
4273
4014
|
}
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
const page = this.pages.find(p => p.id === this.pageId);
|
|
4015
|
+
const targetPageId = this.normalizeId(echoPageId || this.pageId);
|
|
4016
|
+
if (targetPageId && this.pages.length > 0) {
|
|
4017
|
+
const page = this.pages.find(p => this.normalizeId(p.id) === targetPageId);
|
|
4278
4018
|
if (page) {
|
|
4279
|
-
this.selectedPageId =
|
|
4019
|
+
this.selectedPageId = targetPageId;
|
|
4280
4020
|
this.selectedPageName = page.name;
|
|
4021
|
+
this.echoPageName = page.name;
|
|
4281
4022
|
this.currentPage = page;
|
|
4282
4023
|
this.loadPageConfig(page);
|
|
4283
4024
|
}
|
|
@@ -4288,15 +4029,19 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4288
4029
|
type: 'loadPages',
|
|
4289
4030
|
error
|
|
4290
4031
|
});
|
|
4032
|
+
} finally {
|
|
4033
|
+
this.pageLoading = false;
|
|
4291
4034
|
}
|
|
4292
4035
|
},
|
|
4293
|
-
// 从 API
|
|
4294
|
-
async fetchPagesFromAPI(moduleId) {
|
|
4036
|
+
// 从 API 获取页面列表(moduleId 为空时取全部,用于反查页面所属模块)
|
|
4037
|
+
async fetchPagesFromAPI(moduleId = '') {
|
|
4295
4038
|
try {
|
|
4296
|
-
const response = await request({
|
|
4039
|
+
const response = await (0,gateway_request_lib_root_GatewayRequestLib_.request)({
|
|
4297
4040
|
api: '/api/assembly-center.extend_module.page_list',
|
|
4298
4041
|
params: {
|
|
4299
|
-
|
|
4042
|
+
...(moduleId ? {
|
|
4043
|
+
module_id: moduleId
|
|
4044
|
+
} : {}),
|
|
4300
4045
|
type: this.pageType,
|
|
4301
4046
|
page_no: 1,
|
|
4302
4047
|
page_size: 1000
|
|
@@ -4313,7 +4058,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4313
4058
|
|
|
4314
4059
|
// 转换为选项格式
|
|
4315
4060
|
return pages.map(page => ({
|
|
4316
|
-
id: page.id,
|
|
4061
|
+
id: this.normalizeId(page.id),
|
|
4062
|
+
moduleId: this.normalizeId(page.module_id),
|
|
4317
4063
|
name: page.name,
|
|
4318
4064
|
options: page.options || {}
|
|
4319
4065
|
}));
|
|
@@ -4327,14 +4073,16 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4327
4073
|
// 选择改变,显示确认按钮
|
|
4328
4074
|
this.showConfirmButton = true;
|
|
4329
4075
|
if (this.selectedPageId) {
|
|
4330
|
-
const page = this.pages.find(p => p.id === this.selectedPageId);
|
|
4076
|
+
const page = this.pages.find(p => this.normalizeId(p.id) === this.normalizeId(this.selectedPageId));
|
|
4331
4077
|
if (page) {
|
|
4332
4078
|
this.selectedPageName = page.name;
|
|
4079
|
+
this.echoPageName = page.name;
|
|
4333
4080
|
this.currentPage = page;
|
|
4334
4081
|
this.loadPageConfig(page);
|
|
4335
4082
|
}
|
|
4336
4083
|
} else {
|
|
4337
4084
|
this.selectedPageName = '';
|
|
4085
|
+
this.echoPageName = '';
|
|
4338
4086
|
this.currentPage = null;
|
|
4339
4087
|
this.showConfigForm = false;
|
|
4340
4088
|
this.formData = {};
|
|
@@ -4403,8 +4151,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4403
4151
|
if (!this.selectedModuleId || !this.selectedPageId) {
|
|
4404
4152
|
return;
|
|
4405
4153
|
}
|
|
4406
|
-
const module = this.modules.find(m => m.id === this.selectedModuleId);
|
|
4407
|
-
const page = this.pages.find(p => p.id === this.selectedPageId);
|
|
4154
|
+
const module = this.modules.find(m => this.normalizeId(m.id) === this.normalizeId(this.selectedModuleId));
|
|
4155
|
+
const page = this.pages.find(p => this.normalizeId(p.id) === this.normalizeId(this.selectedPageId));
|
|
4408
4156
|
if (!module || !page) {
|
|
4409
4157
|
console.error('未找到选中的模块或页面');
|
|
4410
4158
|
return;
|
|
@@ -4426,6 +4174,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4426
4174
|
pageId: this.selectedPageId,
|
|
4427
4175
|
config: result.config
|
|
4428
4176
|
});
|
|
4177
|
+
// 同步回显标识,避免父组件回传 modelValue 时重复触发回显逻辑
|
|
4178
|
+
this.appliedEchoKey = JSON.stringify([this.normalizeId(module.id), this.normalizeId(page.id)]);
|
|
4429
4179
|
|
|
4430
4180
|
// 隐藏确认按钮
|
|
4431
4181
|
this.showConfirmButton = false;
|
|
@@ -4436,9 +4186,9 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4436
4186
|
});
|
|
4437
4187
|
;// ./src/components/ModulePageSelect.vue?vue&type=script&lang=js
|
|
4438
4188
|
|
|
4439
|
-
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/ModulePageSelect.vue?vue&type=style&index=0&id=
|
|
4440
|
-
var
|
|
4441
|
-
;// ./src/components/ModulePageSelect.vue?vue&type=style&index=0&id=
|
|
4189
|
+
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-54.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-54.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-54.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/ModulePageSelect.vue?vue&type=style&index=0&id=0b2fc41a&scoped=true&lang=css
|
|
4190
|
+
var ModulePageSelectvue_type_style_index_0_id_0b2fc41a_scoped_true_lang_css = __webpack_require__(7650);
|
|
4191
|
+
;// ./src/components/ModulePageSelect.vue?vue&type=style&index=0&id=0b2fc41a&scoped=true&lang=css
|
|
4442
4192
|
|
|
4443
4193
|
// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
|
|
4444
4194
|
var exportHelper = __webpack_require__(5907);
|
|
@@ -4450,7 +4200,7 @@ var exportHelper = __webpack_require__(5907);
|
|
|
4450
4200
|
;
|
|
4451
4201
|
|
|
4452
4202
|
|
|
4453
|
-
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(ModulePageSelectvue_type_script_lang_js, [['render',render],['__scopeId',"data-v-
|
|
4203
|
+
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(ModulePageSelectvue_type_script_lang_js, [['render',render],['__scopeId',"data-v-0b2fc41a"]])
|
|
4454
4204
|
|
|
4455
4205
|
/* harmony default export */ var ModulePageSelect = (__exports__);
|
|
4456
4206
|
;// ./src/index.js
|