@tuoyuan/module-page-select 1.0.5 → 1.0.7
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 -482
- package/dist/module-page-select.common.js.map +1 -1
- package/dist/module-page-select.umd.js +239 -487
- 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 +11 -4
- package/src/index.d.ts +32 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******/ (function() { // webpackBootstrap
|
|
2
2
|
/******/ var __webpack_modules__ = ({
|
|
3
3
|
|
|
4
|
-
/***/
|
|
4
|
+
/***/ 8451:
|
|
5
5
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
@@ -15,7 +15,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15
15
|
|
|
16
16
|
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()));
|
|
17
17
|
// Module
|
|
18
|
-
___CSS_LOADER_EXPORT___.push([module.id, ".module-page-select[data-v-
|
|
18
|
+
___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}", ""]);
|
|
19
19
|
// Exports
|
|
20
20
|
/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
|
|
21
21
|
|
|
@@ -148,19 +148,19 @@ exports.A = (sfc, props) => {
|
|
|
148
148
|
|
|
149
149
|
/***/ }),
|
|
150
150
|
|
|
151
|
-
/***/
|
|
151
|
+
/***/ 4986:
|
|
152
152
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
153
153
|
|
|
154
154
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
|
155
155
|
|
|
156
156
|
// load the styles
|
|
157
|
-
var content = __webpack_require__(
|
|
157
|
+
var content = __webpack_require__(8451);
|
|
158
158
|
if(content.__esModule) content = content.default;
|
|
159
159
|
if(typeof content === 'string') content = [[module.id, content, '']];
|
|
160
160
|
if(content.locals) module.exports = content.locals;
|
|
161
161
|
// add the styles to the DOM
|
|
162
162
|
var add = (__webpack_require__(8459)/* ["default"] */ .A)
|
|
163
|
-
var update = add("
|
|
163
|
+
var update = add("b7267380", content, true, {"sourceMap":false,"shadowMode":false});
|
|
164
164
|
|
|
165
165
|
/***/ }),
|
|
166
166
|
|
|
@@ -452,35 +452,6 @@ module.exports = function (argument) {
|
|
|
452
452
|
};
|
|
453
453
|
|
|
454
454
|
|
|
455
|
-
/***/ }),
|
|
456
|
-
|
|
457
|
-
/***/ 6469:
|
|
458
|
-
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
459
|
-
|
|
460
|
-
"use strict";
|
|
461
|
-
|
|
462
|
-
var wellKnownSymbol = __webpack_require__(8227);
|
|
463
|
-
var create = __webpack_require__(2360);
|
|
464
|
-
var defineProperty = (__webpack_require__(4913).f);
|
|
465
|
-
|
|
466
|
-
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
467
|
-
var ArrayPrototype = Array.prototype;
|
|
468
|
-
|
|
469
|
-
// Array.prototype[@@unscopables]
|
|
470
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
471
|
-
if (ArrayPrototype[UNSCOPABLES] === undefined) {
|
|
472
|
-
defineProperty(ArrayPrototype, UNSCOPABLES, {
|
|
473
|
-
configurable: true,
|
|
474
|
-
value: create(null)
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// add a key to Array.prototype[@@unscopables]
|
|
479
|
-
module.exports = function (key) {
|
|
480
|
-
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
|
|
484
455
|
/***/ }),
|
|
485
456
|
|
|
486
457
|
/***/ 679:
|
|
@@ -3013,42 +2984,6 @@ module.exports = function (name) {
|
|
|
3013
2984
|
};
|
|
3014
2985
|
|
|
3015
2986
|
|
|
3016
|
-
/***/ }),
|
|
3017
|
-
|
|
3018
|
-
/***/ 4423:
|
|
3019
|
-
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
3020
|
-
|
|
3021
|
-
"use strict";
|
|
3022
|
-
|
|
3023
|
-
var $ = __webpack_require__(6518);
|
|
3024
|
-
var $includes = (__webpack_require__(9617).includes);
|
|
3025
|
-
var fails = __webpack_require__(9039);
|
|
3026
|
-
var addToUnscopables = __webpack_require__(6469);
|
|
3027
|
-
|
|
3028
|
-
// FF99+ bug
|
|
3029
|
-
var BROKEN_ON_SPARSE = fails(function () {
|
|
3030
|
-
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
3031
|
-
return !Array(1).includes();
|
|
3032
|
-
});
|
|
3033
|
-
|
|
3034
|
-
// Safari 26.4- bug
|
|
3035
|
-
var BROKEN_ON_SPARSE_WITH_FROM_INDEX = fails(function () {
|
|
3036
|
-
// eslint-disable-next-line no-sparse-arrays, es/no-array-prototype-includes -- detection
|
|
3037
|
-
return [, 1].includes(undefined, 1);
|
|
3038
|
-
});
|
|
3039
|
-
|
|
3040
|
-
// `Array.prototype.includes` method
|
|
3041
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
3042
|
-
$({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE || BROKEN_ON_SPARSE_WITH_FROM_INDEX }, {
|
|
3043
|
-
includes: function includes(el /* , fromIndex = 0 */) {
|
|
3044
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
3045
|
-
}
|
|
3046
|
-
});
|
|
3047
|
-
|
|
3048
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
3049
|
-
addToUnscopables('includes');
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
2987
|
/***/ }),
|
|
3053
2988
|
|
|
3054
2989
|
/***/ 4114:
|
|
@@ -3304,6 +3239,46 @@ $({ target: 'Iterator', proto: true, real: true, forced: FORCED }, {
|
|
|
3304
3239
|
});
|
|
3305
3240
|
|
|
3306
3241
|
|
|
3242
|
+
/***/ }),
|
|
3243
|
+
|
|
3244
|
+
/***/ 3579:
|
|
3245
|
+
/***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
3246
|
+
|
|
3247
|
+
"use strict";
|
|
3248
|
+
|
|
3249
|
+
var $ = __webpack_require__(6518);
|
|
3250
|
+
var call = __webpack_require__(9565);
|
|
3251
|
+
var iterate = __webpack_require__(2652);
|
|
3252
|
+
var aCallable = __webpack_require__(9306);
|
|
3253
|
+
var anObject = __webpack_require__(8551);
|
|
3254
|
+
var getIteratorDirect = __webpack_require__(1767);
|
|
3255
|
+
var iteratorClose = __webpack_require__(9539);
|
|
3256
|
+
var iteratorHelperWithoutClosingOnEarlyError = __webpack_require__(4549);
|
|
3257
|
+
|
|
3258
|
+
var someWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError('some', TypeError);
|
|
3259
|
+
|
|
3260
|
+
// `Iterator.prototype.some` method
|
|
3261
|
+
// https://tc39.es/ecma262/#sec-iterator.prototype.some
|
|
3262
|
+
$({ target: 'Iterator', proto: true, real: true, forced: someWithoutClosingOnEarlyError }, {
|
|
3263
|
+
some: function some(predicate) {
|
|
3264
|
+
anObject(this);
|
|
3265
|
+
try {
|
|
3266
|
+
aCallable(predicate);
|
|
3267
|
+
} catch (error) {
|
|
3268
|
+
iteratorClose(this, 'throw', error);
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
if (someWithoutClosingOnEarlyError) return call(someWithoutClosingOnEarlyError, this, predicate);
|
|
3272
|
+
|
|
3273
|
+
var record = getIteratorDirect(this);
|
|
3274
|
+
var counter = 0;
|
|
3275
|
+
return iterate(record, function (value, stop) {
|
|
3276
|
+
if (predicate(value, counter++)) return stop();
|
|
3277
|
+
}, { IS_RECORD: true, INTERRUPTED: true }).stopped;
|
|
3278
|
+
}
|
|
3279
|
+
});
|
|
3280
|
+
|
|
3281
|
+
|
|
3307
3282
|
/***/ }),
|
|
3308
3283
|
|
|
3309
3284
|
/***/ 3110:
|
|
@@ -3566,7 +3541,7 @@ if (typeof window !== 'undefined') {
|
|
|
3566
3541
|
|
|
3567
3542
|
;// external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
|
|
3568
3543
|
var external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject = require("vue");
|
|
3569
|
-
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.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=
|
|
3544
|
+
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.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
|
|
3570
3545
|
|
|
3571
3546
|
const _hoisted_1 = {
|
|
3572
3547
|
class: "module-page-select"
|
|
@@ -3601,11 +3576,12 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3601
3576
|
onChange: $options.handleModuleChange,
|
|
3602
3577
|
onFocus: $options.handleModuleFocus,
|
|
3603
3578
|
placeholder: "请选择模块",
|
|
3579
|
+
loading: $data.moduleLoading,
|
|
3604
3580
|
"allow-clear": "",
|
|
3605
3581
|
"allow-search": "",
|
|
3606
3582
|
size: "small"
|
|
3607
3583
|
}, {
|
|
3608
|
-
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.renderList)($
|
|
3584
|
+
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.renderList)($options.moduleOptions, module => {
|
|
3609
3585
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createBlock)(_component_a_option, {
|
|
3610
3586
|
key: module.id,
|
|
3611
3587
|
value: module.id
|
|
@@ -3615,7 +3591,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3615
3591
|
}, 1032, ["value"]);
|
|
3616
3592
|
}), 128))]),
|
|
3617
3593
|
_: 1
|
|
3618
|
-
}, 8, ["modelValue", "onChange", "onFocus"])]),
|
|
3594
|
+
}, 8, ["modelValue", "onChange", "onFocus", "loading"])]),
|
|
3619
3595
|
_: 1
|
|
3620
3596
|
}), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createVNode)(_component_a_form_item, {
|
|
3621
3597
|
label: "选择页面"
|
|
@@ -3624,13 +3600,15 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3624
3600
|
modelValue: $data.selectedPageId,
|
|
3625
3601
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = $event => $data.selectedPageId = $event),
|
|
3626
3602
|
onChange: $options.handlePageChange,
|
|
3603
|
+
onFocus: $options.handlePageFocus,
|
|
3627
3604
|
placeholder: "请选择页面",
|
|
3628
3605
|
disabled: !$data.selectedModuleId,
|
|
3606
|
+
loading: $data.pageLoading,
|
|
3629
3607
|
"allow-clear": "",
|
|
3630
3608
|
"allow-search": "",
|
|
3631
3609
|
size: "small"
|
|
3632
3610
|
}, {
|
|
3633
|
-
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.renderList)($
|
|
3611
|
+
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.renderList)($options.pageOptions, page => {
|
|
3634
3612
|
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createBlock)(_component_a_option, {
|
|
3635
3613
|
key: page.id,
|
|
3636
3614
|
value: page.id
|
|
@@ -3640,7 +3618,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3640
3618
|
}, 1032, ["value"]);
|
|
3641
3619
|
}), 128))]),
|
|
3642
3620
|
_: 1
|
|
3643
|
-
}, 8, ["modelValue", "onChange", "disabled"])]),
|
|
3621
|
+
}, 8, ["modelValue", "onChange", "onFocus", "disabled", "loading"])]),
|
|
3644
3622
|
_: 1
|
|
3645
3623
|
}), $data.selectedModuleName && $data.selectedPageName ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", _hoisted_2, [_cache[2] || (_cache[2] = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
|
|
3646
3624
|
class: "preview-label"
|
|
@@ -3714,7 +3692,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3714
3692
|
_: 1
|
|
3715
3693
|
})]);
|
|
3716
3694
|
}
|
|
3717
|
-
;// ./src/components/ModulePageSelect.vue?vue&type=template&id=
|
|
3695
|
+
;// ./src/components/ModulePageSelect.vue?vue&type=template&id=0b2fc41a&scoped=true
|
|
3718
3696
|
|
|
3719
3697
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.constructor.js
|
|
3720
3698
|
var es_iterator_constructor = __webpack_require__(8111);
|
|
@@ -3724,276 +3702,12 @@ var es_iterator_find = __webpack_require__(116);
|
|
|
3724
3702
|
var es_iterator_for_each = __webpack_require__(7588);
|
|
3725
3703
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.map.js
|
|
3726
3704
|
var es_iterator_map = __webpack_require__(1701);
|
|
3705
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.iterator.some.js
|
|
3706
|
+
var es_iterator_some = __webpack_require__(3579);
|
|
3727
3707
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.json.stringify.js
|
|
3728
3708
|
var es_json_stringify = __webpack_require__(3110);
|
|
3729
|
-
|
|
3730
|
-
var
|
|
3731
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/utils/throw-error.js
|
|
3732
|
-
function throwError(msg) {
|
|
3733
|
-
const err = new Error(msg);
|
|
3734
|
-
err.name = '[gateway-request]';
|
|
3735
|
-
throw err;
|
|
3736
|
-
}
|
|
3737
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/utils/request.js
|
|
3738
|
-
/* unused harmony import specifier */ var axios;
|
|
3739
|
-
/* unused harmony import specifier */ var request_throwError;
|
|
3740
|
-
|
|
3741
|
-
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
3742
|
-
function adopt(value) {
|
|
3743
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
3744
|
-
resolve(value);
|
|
3745
|
-
});
|
|
3746
|
-
}
|
|
3747
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
3748
|
-
function fulfilled(value) {
|
|
3749
|
-
try {
|
|
3750
|
-
step(generator.next(value));
|
|
3751
|
-
} catch (e) {
|
|
3752
|
-
reject(e);
|
|
3753
|
-
}
|
|
3754
|
-
}
|
|
3755
|
-
function rejected(value) {
|
|
3756
|
-
try {
|
|
3757
|
-
step(generator["throw"](value));
|
|
3758
|
-
} catch (e) {
|
|
3759
|
-
reject(e);
|
|
3760
|
-
}
|
|
3761
|
-
}
|
|
3762
|
-
function step(result) {
|
|
3763
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
3764
|
-
}
|
|
3765
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3766
|
-
});
|
|
3767
|
-
};
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
class GatewayRequest {
|
|
3771
|
-
constructor(config) {
|
|
3772
|
-
this.globalMessage = {
|
|
3773
|
-
success: true,
|
|
3774
|
-
fail: true
|
|
3775
|
-
};
|
|
3776
|
-
const gateway_config = config;
|
|
3777
|
-
this.gateway_config = gateway_config;
|
|
3778
|
-
if (!['null', 'undefined'].includes(typeof config.globalMessage)) {
|
|
3779
|
-
if (typeof config.globalMessage === 'object') {
|
|
3780
|
-
if (typeof config.globalMessage.success === 'boolean') {
|
|
3781
|
-
this.globalMessage.success = config.globalMessage.success;
|
|
3782
|
-
}
|
|
3783
|
-
if (typeof config.globalMessage.fail === 'boolean') {
|
|
3784
|
-
this.globalMessage.fail = config.globalMessage.fail;
|
|
3785
|
-
}
|
|
3786
|
-
}
|
|
3787
|
-
}
|
|
3788
|
-
}
|
|
3789
|
-
getConfig(key) {
|
|
3790
|
-
return this.gateway_config[key];
|
|
3791
|
-
}
|
|
3792
|
-
getAccessToken() {
|
|
3793
|
-
if (!this.gateway_config.getToken) {
|
|
3794
|
-
request_throwError('未设置`getToken`方法。');
|
|
3795
|
-
}
|
|
3796
|
-
const access_token = this.gateway_config.getToken();
|
|
3797
|
-
return access_token;
|
|
3798
|
-
}
|
|
3799
|
-
openMessage(res, options) {
|
|
3800
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3801
|
-
if ((_a = this.gateway_config.globalMessage) === null || _a === void 0 ? void 0 : _a.silent) return;
|
|
3802
|
-
const {
|
|
3803
|
-
type,
|
|
3804
|
-
message
|
|
3805
|
-
} = (_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 : {};
|
|
3806
|
-
if (!message) return;
|
|
3807
|
-
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)) {
|
|
3808
|
-
(_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);
|
|
3809
|
-
}
|
|
3810
|
-
}
|
|
3811
|
-
baseRequest(api, params, config) {
|
|
3812
|
-
const url = `${this.gateway_config.base_url}${api}`;
|
|
3813
|
-
const publicParams = {
|
|
3814
|
-
app_id: this.gateway_config.app_id,
|
|
3815
|
-
app_key: this.gateway_config.app_key,
|
|
3816
|
-
timestamp: Math.floor(+new Date() / 1000)
|
|
3817
|
-
};
|
|
3818
|
-
const _params = Object.assign(Object.assign({}, publicParams), (config === null || config === void 0 ? void 0 : config.plat) ? params : {
|
|
3819
|
-
data: params
|
|
3820
|
-
});
|
|
3821
|
-
if (config === null || config === void 0 ? void 0 : config.access_token) {
|
|
3822
|
-
if (!this.gateway_config.getToken) {
|
|
3823
|
-
request_throwError('未设置`getToken`方法。');
|
|
3824
|
-
}
|
|
3825
|
-
_params.access_token = this.gateway_config.getToken();
|
|
3826
|
-
}
|
|
3827
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
3828
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3829
|
-
try {
|
|
3830
|
-
(_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, {
|
|
3831
|
-
fullpath: url,
|
|
3832
|
-
api,
|
|
3833
|
-
params: _params
|
|
3834
|
-
});
|
|
3835
|
-
const axiosConfig = {
|
|
3836
|
-
timeout: (_d = config === null || config === void 0 ? void 0 : config.timeout) !== null && _d !== void 0 ? _d : this.gateway_config.timeout,
|
|
3837
|
-
adapter: this.gateway_config.adapter
|
|
3838
|
-
};
|
|
3839
|
-
const res = yield axios.post(url, _params, axiosConfig);
|
|
3840
|
-
// 打开全局消息提示
|
|
3841
|
-
this.openMessage(res, config === null || config === void 0 ? void 0 : config.globalMessage);
|
|
3842
|
-
(_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);
|
|
3843
|
-
resolve(res);
|
|
3844
|
-
} catch (error) {
|
|
3845
|
-
(_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);
|
|
3846
|
-
reject(error);
|
|
3847
|
-
}
|
|
3848
|
-
}));
|
|
3849
|
-
}
|
|
3850
|
-
}
|
|
3851
|
-
let gatewayRequest;
|
|
3852
|
-
function init(config) {
|
|
3853
|
-
if (!gatewayRequest) {
|
|
3854
|
-
gatewayRequest = new GatewayRequest(config);
|
|
3855
|
-
} else {
|
|
3856
|
-
console.warn(`[gateway-request]: Instance already exists.`);
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
const request = options => {
|
|
3860
|
-
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
3861
|
-
var _a, _b, _c, _d, _e;
|
|
3862
|
-
try {
|
|
3863
|
-
if (!gatewayRequest) {
|
|
3864
|
-
throwError('未初始化。');
|
|
3865
|
-
}
|
|
3866
|
-
const config = {
|
|
3867
|
-
plat: (_a = options.config) === null || _a === void 0 ? void 0 : _a.plat,
|
|
3868
|
-
access_token: (_b = options.config) === null || _b === void 0 ? void 0 : _b.access_token
|
|
3869
|
-
};
|
|
3870
|
-
// 处理是否打开全局消息
|
|
3871
|
-
if (!['null', 'undefined'].includes(typeof ((_c = options.config) === null || _c === void 0 ? void 0 : _c.globalMessage))) {
|
|
3872
|
-
config.globalMessage = {};
|
|
3873
|
-
if (typeof options.config.globalMessage === 'boolean') {
|
|
3874
|
-
config.globalMessage.success = config.globalMessage.fail = options.config.globalMessage;
|
|
3875
|
-
}
|
|
3876
|
-
if (typeof options.config.globalMessage === 'object') {
|
|
3877
|
-
if (typeof options.config.globalMessage.success === 'boolean') {
|
|
3878
|
-
config.globalMessage.success = options.config.globalMessage.success;
|
|
3879
|
-
}
|
|
3880
|
-
if (typeof options.config.globalMessage.fail === 'boolean') {
|
|
3881
|
-
config.globalMessage.fail = options.config.globalMessage.fail;
|
|
3882
|
-
}
|
|
3883
|
-
}
|
|
3884
|
-
}
|
|
3885
|
-
// 处理请求参数
|
|
3886
|
-
const params = (data => {
|
|
3887
|
-
if (typeof data === 'object') return data;
|
|
3888
|
-
if (typeof data === 'function') {
|
|
3889
|
-
return data();
|
|
3890
|
-
}
|
|
3891
|
-
return {};
|
|
3892
|
-
})(options.params);
|
|
3893
|
-
/** 默认响应数据转换法方法 */
|
|
3894
|
-
const defaultTransformResponse = response => {
|
|
3895
|
-
if (response.code === 10000) {
|
|
3896
|
-
return Promise.resolve(response.data);
|
|
3897
|
-
} else {
|
|
3898
|
-
return Promise.reject(response);
|
|
3899
|
-
}
|
|
3900
|
-
};
|
|
3901
|
-
/** 响应数据 */
|
|
3902
|
-
const response = yield options.requester ? (options => {
|
|
3903
|
-
const _this = {
|
|
3904
|
-
base_url: gatewayRequest.getConfig('base_url'),
|
|
3905
|
-
app_id: gatewayRequest.getConfig('app_id'),
|
|
3906
|
-
app_key: gatewayRequest.getConfig('app_key'),
|
|
3907
|
-
getToken: gatewayRequest.getConfig('getToken'),
|
|
3908
|
-
hooks: {
|
|
3909
|
-
beforeRequest: config => {
|
|
3910
|
-
var _a, _b;
|
|
3911
|
-
(_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);
|
|
3912
|
-
},
|
|
3913
|
-
afterResponse: res => {
|
|
3914
|
-
var _a, _b;
|
|
3915
|
-
(_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);
|
|
3916
|
-
},
|
|
3917
|
-
error: e => {
|
|
3918
|
-
var _a, _b;
|
|
3919
|
-
(_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);
|
|
3920
|
-
}
|
|
3921
|
-
},
|
|
3922
|
-
openMessage: gatewayRequest.openMessage.bind(gatewayRequest)
|
|
3923
|
-
};
|
|
3924
|
-
const requester = options.requester;
|
|
3925
|
-
return requester.call(_this, options.api, params, options.config);
|
|
3926
|
-
})(options) : gatewayRequest.baseRequest(options.api, params, options.config);
|
|
3927
|
-
/** 响应数据转换结果 */
|
|
3928
|
-
const transformResponse = (_d = options === null || options === void 0 ? void 0 : options.transformResponse) !== null && _d !== void 0 ? _d : defaultTransformResponse;
|
|
3929
|
-
const transformResponseData = yield transformResponse((_e = response === null || response === void 0 ? void 0 : response.data) !== null && _e !== void 0 ? _e : {}, response);
|
|
3930
|
-
resolve({
|
|
3931
|
-
axiosResponse: response,
|
|
3932
|
-
response: response.data,
|
|
3933
|
-
data: transformResponseData
|
|
3934
|
-
});
|
|
3935
|
-
} catch (error) {
|
|
3936
|
-
reject(error);
|
|
3937
|
-
}
|
|
3938
|
-
}));
|
|
3939
|
-
};
|
|
3940
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/utils/deep-merge.js
|
|
3941
|
-
/** 深度合并对象 */
|
|
3942
|
-
const deepMerge = (target, source) => {
|
|
3943
|
-
var _a;
|
|
3944
|
-
if (typeof target !== 'object' || target === null) {
|
|
3945
|
-
return target;
|
|
3946
|
-
}
|
|
3947
|
-
if (typeof source !== 'object' || source === null) {
|
|
3948
|
-
return target;
|
|
3949
|
-
}
|
|
3950
|
-
for (const key in source) {
|
|
3951
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3952
|
-
if (typeof source[key] === 'object' && source[key] !== null) {
|
|
3953
|
-
// Recursively merge nested objects
|
|
3954
|
-
const defaultObj = deepMerge(Array.isArray(source[key]) ? [] : {}, target[key]);
|
|
3955
|
-
target[key] = deepMerge(defaultObj, source[key]);
|
|
3956
|
-
} else {
|
|
3957
|
-
target[key] = (_a = source[key]) !== null && _a !== void 0 ? _a : target[key];
|
|
3958
|
-
}
|
|
3959
|
-
}
|
|
3960
|
-
}
|
|
3961
|
-
return target;
|
|
3962
|
-
};
|
|
3963
|
-
;// ./node_modules/@tuoyuan/gateway-request-lib/dist/main.js
|
|
3964
|
-
/* unused harmony import specifier */ var main_init;
|
|
3965
|
-
/* unused harmony import specifier */ var main_request;
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
const apis = new Proxy({
|
|
3969
|
-
value: {},
|
|
3970
|
-
deepMerge(newApis) {
|
|
3971
|
-
return deepMerge(this.value, newApis);
|
|
3972
|
-
}
|
|
3973
|
-
}, {
|
|
3974
|
-
get(target, key) {
|
|
3975
|
-
if (key === 'deepMerge') {
|
|
3976
|
-
return target.deepMerge.bind(target);
|
|
3977
|
-
}
|
|
3978
|
-
if (key in target.value) {
|
|
3979
|
-
return target.value[key];
|
|
3980
|
-
}
|
|
3981
|
-
}
|
|
3982
|
-
});
|
|
3983
|
-
const originalInit = (/* unused pure expression or super */ null && (main_init));
|
|
3984
|
-
function wrappedInit(...args) {
|
|
3985
|
-
const result = originalInit(...args);
|
|
3986
|
-
if (typeof window !== 'undefined') {
|
|
3987
|
-
window.gatewayRequest = {
|
|
3988
|
-
request: main_request,
|
|
3989
|
-
apis,
|
|
3990
|
-
registerApis
|
|
3991
|
-
};
|
|
3992
|
-
}
|
|
3993
|
-
return result;
|
|
3994
|
-
}
|
|
3995
|
-
const registerApis = apis.deepMerge.bind(apis);
|
|
3996
|
-
|
|
3709
|
+
;// external {"commonjs":"@tuoyuan/gateway-request-lib","commonjs2":"@tuoyuan/gateway-request-lib","root":"GatewayRequestLib"}
|
|
3710
|
+
var gateway_request_lib_root_GatewayRequestLib_namespaceObject = require("@tuoyuan/gateway-request-lib");
|
|
3997
3711
|
;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/ModulePageSelect.vue?vue&type=script&lang=js
|
|
3998
3712
|
|
|
3999
3713
|
|
|
@@ -4001,6 +3715,7 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4001
3715
|
|
|
4002
3716
|
|
|
4003
3717
|
|
|
3718
|
+
|
|
4004
3719
|
/* harmony default export */ var ModulePageSelectvue_type_script_lang_js = ({
|
|
4005
3720
|
name: 'ModulePageSelect',
|
|
4006
3721
|
props: {
|
|
@@ -4018,6 +3733,11 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4018
3733
|
pageId: {
|
|
4019
3734
|
type: String,
|
|
4020
3735
|
default: ''
|
|
3736
|
+
},
|
|
3737
|
+
// 是否在挂载时按已有值自动回显(拉取模块/页面列表补全名称)
|
|
3738
|
+
autoEcho: {
|
|
3739
|
+
type: Boolean,
|
|
3740
|
+
default: true
|
|
4021
3741
|
}
|
|
4022
3742
|
},
|
|
4023
3743
|
emits: ['update:modelValue', 'change', 'error'],
|
|
@@ -4039,121 +3759,136 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4039
3759
|
// 控制确认按钮显示
|
|
4040
3760
|
showConfirmButton: true,
|
|
4041
3761
|
// 记录上次确认的状态
|
|
4042
|
-
lastConfirmedState: null
|
|
3762
|
+
lastConfirmedState: null,
|
|
3763
|
+
// 加载状态
|
|
3764
|
+
moduleLoading: false,
|
|
3765
|
+
pageLoading: false,
|
|
3766
|
+
// 回显兜底名称(列表未加载时先占位显示)
|
|
3767
|
+
echoModuleName: '',
|
|
3768
|
+
echoPageName: '',
|
|
3769
|
+
// 已处理过的回显标识,避免 modelValue 深度监听重复触发
|
|
3770
|
+
appliedEchoKey: ''
|
|
4043
3771
|
};
|
|
4044
3772
|
},
|
|
4045
3773
|
computed: {
|
|
4046
3774
|
pageType() {
|
|
4047
3775
|
const type = this.modelValue?.type || 'mobile';
|
|
4048
3776
|
return type === 'mobile' ? 2 : 1;
|
|
3777
|
+
},
|
|
3778
|
+
// 模块下拉项:列表 + 回显兜底项(选中值不在列表里时补一项,保证有回显)
|
|
3779
|
+
moduleOptions() {
|
|
3780
|
+
return this.withFallbackOption(this.modules, this.selectedModuleId, this.echoModuleName, '模块');
|
|
3781
|
+
},
|
|
3782
|
+
// 页面下拉项:同上
|
|
3783
|
+
pageOptions() {
|
|
3784
|
+
return this.withFallbackOption(this.pages, this.selectedPageId, this.echoPageName, '页面');
|
|
4049
3785
|
}
|
|
4050
3786
|
},
|
|
4051
3787
|
watch: {
|
|
4052
|
-
//
|
|
3788
|
+
// 监听外部值变化(用于回显)。只比对回显相关字段,避免深度监听重复执行
|
|
4053
3789
|
modelValue: {
|
|
4054
|
-
immediate: false,
|
|
4055
|
-
// 不立即执行,等待组件完全挂载
|
|
4056
3790
|
deep: true,
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
// 从 modelValue 中提取模块ID和页面ID
|
|
4060
|
-
const moduleId = val.module_id || this.moduleId;
|
|
4061
|
-
const pageId = val.page_id || this.pageId;
|
|
4062
|
-
|
|
4063
|
-
// 如果有模块ID且与当前选中不同,则回显
|
|
4064
|
-
if (moduleId && moduleId !== this.selectedModuleId) {
|
|
4065
|
-
this.selectedModuleId = moduleId;
|
|
4066
|
-
this.selectedModuleName = val.module_name || '';
|
|
4067
|
-
|
|
4068
|
-
// 等待模块列表加载完成
|
|
4069
|
-
if (this.modules.length === 0) {
|
|
4070
|
-
await this.loadModules();
|
|
4071
|
-
}
|
|
4072
|
-
|
|
4073
|
-
// 查找模块名称
|
|
4074
|
-
if (!this.selectedModuleName) {
|
|
4075
|
-
const module = this.modules.find(m => m.id === moduleId);
|
|
4076
|
-
if (module) {
|
|
4077
|
-
this.selectedModuleName = module.name;
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
|
|
4081
|
-
// 加载页面列表
|
|
4082
|
-
await this.loadPages(moduleId);
|
|
4083
|
-
}
|
|
4084
|
-
|
|
4085
|
-
// 如果有页面ID且与当前选中不同,则回显
|
|
4086
|
-
if (pageId && pageId !== this.selectedPageId) {
|
|
4087
|
-
this.selectedPageId = pageId;
|
|
4088
|
-
this.selectedPageName = val.page_name || '';
|
|
4089
|
-
|
|
4090
|
-
// 如果页面列表已加载,查找页面信息
|
|
4091
|
-
if (this.pages.length > 0) {
|
|
4092
|
-
const page = this.pages.find(p => p.id === pageId);
|
|
4093
|
-
if (page) {
|
|
4094
|
-
this.selectedPageName = page.name;
|
|
4095
|
-
this.currentPage = page;
|
|
4096
|
-
this.loadPageConfig(page);
|
|
4097
|
-
|
|
4098
|
-
// 如果有配置数据,回显配置
|
|
4099
|
-
if (val.config) {
|
|
4100
|
-
this.formData = {
|
|
4101
|
-
...val.config
|
|
4102
|
-
};
|
|
4103
|
-
}
|
|
4104
|
-
}
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
}
|
|
3791
|
+
handler() {
|
|
3792
|
+
this.applyEcho();
|
|
4108
3793
|
}
|
|
4109
3794
|
},
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
immediate: false,
|
|
4113
|
-
// 不立即执行
|
|
4114
|
-
async handler(val) {
|
|
4115
|
-
if (val && val !== this.selectedModuleId && !this.modelValue?.module_id) {
|
|
4116
|
-
this.selectedModuleId = val;
|
|
4117
|
-
|
|
4118
|
-
// 等待模块列表加载
|
|
4119
|
-
if (this.modules.length === 0) {
|
|
4120
|
-
await this.loadModules();
|
|
4121
|
-
}
|
|
4122
|
-
|
|
4123
|
-
// 查找模块名称
|
|
4124
|
-
const module = this.modules.find(m => m.id === val);
|
|
4125
|
-
if (module) {
|
|
4126
|
-
this.selectedModuleName = module.name;
|
|
4127
|
-
}
|
|
4128
|
-
await this.loadPages(val);
|
|
4129
|
-
}
|
|
4130
|
-
}
|
|
3795
|
+
moduleId() {
|
|
3796
|
+
this.applyEcho();
|
|
4131
3797
|
},
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
immediate: false,
|
|
4135
|
-
// 不立即执行
|
|
4136
|
-
async handler(val) {
|
|
4137
|
-
if (val && val !== this.selectedPageId && !this.modelValue?.page_id) {
|
|
4138
|
-
this.selectedPageId = val;
|
|
4139
|
-
// 如果页面列表已加载,查找页面信息
|
|
4140
|
-
if (this.pages.length > 0) {
|
|
4141
|
-
const page = this.pages.find(p => p.id === val);
|
|
4142
|
-
if (page) {
|
|
4143
|
-
this.selectedPageName = page.name;
|
|
4144
|
-
this.currentPage = page;
|
|
4145
|
-
this.loadPageConfig(page);
|
|
4146
|
-
}
|
|
4147
|
-
}
|
|
4148
|
-
}
|
|
4149
|
-
}
|
|
3798
|
+
pageId() {
|
|
3799
|
+
this.applyEcho();
|
|
4150
3800
|
}
|
|
4151
3801
|
},
|
|
4152
3802
|
mounted() {
|
|
4153
|
-
//
|
|
4154
|
-
|
|
3803
|
+
// 挂载时按已有值回显;无值时不请求接口,等用户 focus 再懒加载
|
|
3804
|
+
this.applyEcho();
|
|
4155
3805
|
},
|
|
4156
3806
|
methods: {
|
|
3807
|
+
// 统一的字符串化,规避接口返回数字ID与保存的字符串ID类型不一致
|
|
3808
|
+
normalizeId(value) {
|
|
3809
|
+
return value === null || value === undefined ? '' : String(value);
|
|
3810
|
+
},
|
|
3811
|
+
// 从外部值中取出回显所需字段
|
|
3812
|
+
resolveEchoSource() {
|
|
3813
|
+
const val = this.modelValue && typeof this.modelValue === 'object' ? this.modelValue : {};
|
|
3814
|
+
return {
|
|
3815
|
+
moduleId: this.normalizeId(val.module_id || this.moduleId),
|
|
3816
|
+
pageId: this.normalizeId(val.page_id || this.pageId),
|
|
3817
|
+
moduleName: val.module_name || '',
|
|
3818
|
+
pageName: val.page_name || '',
|
|
3819
|
+
config: val.config
|
|
3820
|
+
};
|
|
3821
|
+
},
|
|
3822
|
+
// 下拉项兜底:选中值不在列表中时补一项,保证刷新后能看到已选内容
|
|
3823
|
+
withFallbackOption(list, selectedId, echoName, typeLabel) {
|
|
3824
|
+
const options = Array.isArray(list) ? list : [];
|
|
3825
|
+
if (!selectedId) return options;
|
|
3826
|
+
if (options.some(item => this.normalizeId(item.id) === selectedId)) return options;
|
|
3827
|
+
return [{
|
|
3828
|
+
id: selectedId,
|
|
3829
|
+
name: echoName || `${typeLabel}(${selectedId})`
|
|
3830
|
+
}, ...options];
|
|
3831
|
+
},
|
|
3832
|
+
// 回显入口:把外部值同步到内部选中态,并按需补全名称与页面配置
|
|
3833
|
+
async applyEcho() {
|
|
3834
|
+
const source = this.resolveEchoSource();
|
|
3835
|
+
if (!source.moduleId && !source.pageId) return;
|
|
3836
|
+
const echoKey = JSON.stringify([source.moduleId, source.pageId]);
|
|
3837
|
+
if (echoKey === this.appliedEchoKey) return;
|
|
3838
|
+
this.appliedEchoKey = echoKey;
|
|
3839
|
+
this.selectedModuleId = source.moduleId;
|
|
3840
|
+
this.selectedPageId = source.pageId;
|
|
3841
|
+
this.echoModuleName = source.moduleName;
|
|
3842
|
+
this.echoPageName = source.pageName;
|
|
3843
|
+
this.selectedModuleName = source.moduleName;
|
|
3844
|
+
this.selectedPageName = source.pageName;
|
|
3845
|
+
if (source.config && typeof source.config === 'object') {
|
|
3846
|
+
this.formData = {
|
|
3847
|
+
...source.config
|
|
3848
|
+
};
|
|
3849
|
+
}
|
|
3850
|
+
// 已是保存过的值,未改动前不需要再次确认
|
|
3851
|
+
this.showConfirmButton = false;
|
|
3852
|
+
this.lastConfirmedState = JSON.stringify({
|
|
3853
|
+
moduleId: source.moduleId,
|
|
3854
|
+
pageId: source.pageId,
|
|
3855
|
+
config: source.config
|
|
3856
|
+
});
|
|
3857
|
+
if (!this.autoEcho) return;
|
|
3858
|
+
|
|
3859
|
+
// 只有页面ID没有模块ID时,反查页面所属模块
|
|
3860
|
+
if (!this.selectedModuleId && this.selectedPageId) {
|
|
3861
|
+
const moduleId = await this.lookupModuleIdByPage(this.selectedPageId);
|
|
3862
|
+
if (moduleId) {
|
|
3863
|
+
this.selectedModuleId = moduleId;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
await this.loadModules();
|
|
3867
|
+
this.syncModuleName();
|
|
3868
|
+
if (this.selectedModuleId) {
|
|
3869
|
+
await this.loadPages(this.selectedModuleId, this.selectedPageId);
|
|
3870
|
+
}
|
|
3871
|
+
},
|
|
3872
|
+
// 用已加载的模块列表补全模块名称
|
|
3873
|
+
syncModuleName() {
|
|
3874
|
+
if (!this.selectedModuleId) return;
|
|
3875
|
+
const module = this.modules.find(m => this.normalizeId(m.id) === this.selectedModuleId);
|
|
3876
|
+
if (module) {
|
|
3877
|
+
this.selectedModuleName = module.name;
|
|
3878
|
+
this.echoModuleName = module.name;
|
|
3879
|
+
}
|
|
3880
|
+
},
|
|
3881
|
+
// 通过页面列表接口反查页面所属模块(兼容只保存了 page_id 的历史数据)
|
|
3882
|
+
async lookupModuleIdByPage(pageId) {
|
|
3883
|
+
try {
|
|
3884
|
+
const pages = await this.fetchPagesFromAPI();
|
|
3885
|
+
const page = pages.find(p => this.normalizeId(p.id) === this.normalizeId(pageId));
|
|
3886
|
+
return page ? this.normalizeId(page.moduleId) : '';
|
|
3887
|
+
} catch (error) {
|
|
3888
|
+
console.error('反查页面所属模块失败:', error);
|
|
3889
|
+
return '';
|
|
3890
|
+
}
|
|
3891
|
+
},
|
|
4157
3892
|
// 加载模块列表
|
|
4158
3893
|
async loadModules() {
|
|
4159
3894
|
try {
|
|
@@ -4161,32 +3896,24 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4161
3896
|
this.modules = this.moduleCache;
|
|
4162
3897
|
return;
|
|
4163
3898
|
}
|
|
3899
|
+
this.moduleLoading = true;
|
|
4164
3900
|
const moduleList = await this.fetchModulesFromAPI();
|
|
4165
3901
|
this.modules = moduleList;
|
|
4166
3902
|
this.moduleCache = moduleList;
|
|
4167
|
-
|
|
4168
|
-
// 如果有默认模块ID,加载对应页面
|
|
4169
|
-
if (this.moduleId) {
|
|
4170
|
-
this.selectedModuleId = this.moduleId;
|
|
4171
|
-
// 查找模块名称
|
|
4172
|
-
const module = this.modules.find(m => m.id === this.moduleId);
|
|
4173
|
-
if (module) {
|
|
4174
|
-
this.selectedModuleName = module.name;
|
|
4175
|
-
}
|
|
4176
|
-
await this.loadPages(this.moduleId);
|
|
4177
|
-
}
|
|
4178
3903
|
} catch (error) {
|
|
4179
3904
|
console.error('加载模块列表失败:', error);
|
|
4180
3905
|
this.$emit('error', {
|
|
4181
3906
|
type: 'loadModules',
|
|
4182
3907
|
error
|
|
4183
3908
|
});
|
|
3909
|
+
} finally {
|
|
3910
|
+
this.moduleLoading = false;
|
|
4184
3911
|
}
|
|
4185
3912
|
},
|
|
4186
3913
|
// 从 API 获取模块列表(使用模块列表接口)
|
|
4187
3914
|
async fetchModulesFromAPI() {
|
|
4188
3915
|
try {
|
|
4189
|
-
const response = await request({
|
|
3916
|
+
const response = await (0,gateway_request_lib_root_GatewayRequestLib_namespaceObject.request)({
|
|
4190
3917
|
api: '/api/assembly-center.extend_module.list',
|
|
4191
3918
|
params: {
|
|
4192
3919
|
page_no: 1,
|
|
@@ -4204,7 +3931,7 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4204
3931
|
|
|
4205
3932
|
// 将模块列表转换为选项格式
|
|
4206
3933
|
return modules.map(module => ({
|
|
4207
|
-
id: module.id,
|
|
3934
|
+
id: this.normalizeId(module.id),
|
|
4208
3935
|
name: module.name
|
|
4209
3936
|
}));
|
|
4210
3937
|
} catch (error) {
|
|
@@ -4213,9 +3940,16 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4213
3940
|
}
|
|
4214
3941
|
},
|
|
4215
3942
|
// 模块下拉框获得焦点时加载数据
|
|
4216
|
-
handleModuleFocus() {
|
|
3943
|
+
async handleModuleFocus() {
|
|
4217
3944
|
if (this.modules.length === 0) {
|
|
4218
|
-
this.loadModules();
|
|
3945
|
+
await this.loadModules();
|
|
3946
|
+
this.syncModuleName();
|
|
3947
|
+
}
|
|
3948
|
+
},
|
|
3949
|
+
// 页面下拉框获得焦点时按需加载(回显失败时给用户补救机会)
|
|
3950
|
+
async handlePageFocus() {
|
|
3951
|
+
if (this.selectedModuleId && this.pages.length === 0) {
|
|
3952
|
+
await this.loadPages(this.selectedModuleId, this.selectedPageId);
|
|
4219
3953
|
}
|
|
4220
3954
|
},
|
|
4221
3955
|
// 模块切换
|
|
@@ -4230,34 +3964,35 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4230
3964
|
|
|
4231
3965
|
// 选择改变,显示确认按钮
|
|
4232
3966
|
this.showConfirmButton = true;
|
|
3967
|
+
this.echoPageName = '';
|
|
4233
3968
|
if (this.selectedModuleId) {
|
|
4234
3969
|
// 更新模块名称
|
|
4235
|
-
|
|
4236
|
-
if (module) {
|
|
4237
|
-
this.selectedModuleName = module.name;
|
|
4238
|
-
}
|
|
3970
|
+
this.syncModuleName();
|
|
4239
3971
|
await this.loadPages(this.selectedModuleId);
|
|
4240
3972
|
} else {
|
|
4241
3973
|
this.selectedModuleName = '';
|
|
3974
|
+
this.echoModuleName = '';
|
|
4242
3975
|
}
|
|
4243
3976
|
},
|
|
4244
|
-
//
|
|
4245
|
-
async loadPages(moduleId) {
|
|
3977
|
+
// 加载页面列表;echoPageId 有值时同步回显该页面的名称与配置
|
|
3978
|
+
async loadPages(moduleId, echoPageId = '') {
|
|
3979
|
+
const cacheKey = this.normalizeId(moduleId);
|
|
4246
3980
|
try {
|
|
4247
|
-
if (this.pageCache[
|
|
4248
|
-
this.pages = this.pageCache[
|
|
3981
|
+
if (this.pageCache[cacheKey]) {
|
|
3982
|
+
this.pages = this.pageCache[cacheKey];
|
|
4249
3983
|
} else {
|
|
4250
|
-
|
|
3984
|
+
this.pageLoading = true;
|
|
3985
|
+
const pageList = await this.fetchPagesFromAPI(cacheKey);
|
|
4251
3986
|
this.pages = pageList;
|
|
4252
|
-
this.pageCache[
|
|
3987
|
+
this.pageCache[cacheKey] = pageList;
|
|
4253
3988
|
}
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
const page = this.pages.find(p => p.id === this.pageId);
|
|
3989
|
+
const targetPageId = this.normalizeId(echoPageId || this.pageId);
|
|
3990
|
+
if (targetPageId && this.pages.length > 0) {
|
|
3991
|
+
const page = this.pages.find(p => this.normalizeId(p.id) === targetPageId);
|
|
4258
3992
|
if (page) {
|
|
4259
|
-
this.selectedPageId =
|
|
3993
|
+
this.selectedPageId = targetPageId;
|
|
4260
3994
|
this.selectedPageName = page.name;
|
|
3995
|
+
this.echoPageName = page.name;
|
|
4261
3996
|
this.currentPage = page;
|
|
4262
3997
|
this.loadPageConfig(page);
|
|
4263
3998
|
}
|
|
@@ -4268,15 +4003,19 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4268
4003
|
type: 'loadPages',
|
|
4269
4004
|
error
|
|
4270
4005
|
});
|
|
4006
|
+
} finally {
|
|
4007
|
+
this.pageLoading = false;
|
|
4271
4008
|
}
|
|
4272
4009
|
},
|
|
4273
|
-
// 从 API
|
|
4274
|
-
async fetchPagesFromAPI(moduleId) {
|
|
4010
|
+
// 从 API 获取页面列表(moduleId 为空时取全部,用于反查页面所属模块)
|
|
4011
|
+
async fetchPagesFromAPI(moduleId = '') {
|
|
4275
4012
|
try {
|
|
4276
|
-
const response = await request({
|
|
4013
|
+
const response = await (0,gateway_request_lib_root_GatewayRequestLib_namespaceObject.request)({
|
|
4277
4014
|
api: '/api/assembly-center.extend_module.page_list',
|
|
4278
4015
|
params: {
|
|
4279
|
-
|
|
4016
|
+
...(moduleId ? {
|
|
4017
|
+
module_id: moduleId
|
|
4018
|
+
} : {}),
|
|
4280
4019
|
type: this.pageType,
|
|
4281
4020
|
page_no: 1,
|
|
4282
4021
|
page_size: 1000
|
|
@@ -4293,7 +4032,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4293
4032
|
|
|
4294
4033
|
// 转换为选项格式
|
|
4295
4034
|
return pages.map(page => ({
|
|
4296
|
-
id: page.id,
|
|
4035
|
+
id: this.normalizeId(page.id),
|
|
4036
|
+
moduleId: this.normalizeId(page.module_id),
|
|
4297
4037
|
name: page.name,
|
|
4298
4038
|
options: page.options || {}
|
|
4299
4039
|
}));
|
|
@@ -4307,14 +4047,16 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4307
4047
|
// 选择改变,显示确认按钮
|
|
4308
4048
|
this.showConfirmButton = true;
|
|
4309
4049
|
if (this.selectedPageId) {
|
|
4310
|
-
const page = this.pages.find(p => p.id === this.selectedPageId);
|
|
4050
|
+
const page = this.pages.find(p => this.normalizeId(p.id) === this.normalizeId(this.selectedPageId));
|
|
4311
4051
|
if (page) {
|
|
4312
4052
|
this.selectedPageName = page.name;
|
|
4053
|
+
this.echoPageName = page.name;
|
|
4313
4054
|
this.currentPage = page;
|
|
4314
4055
|
this.loadPageConfig(page);
|
|
4315
4056
|
}
|
|
4316
4057
|
} else {
|
|
4317
4058
|
this.selectedPageName = '';
|
|
4059
|
+
this.echoPageName = '';
|
|
4318
4060
|
this.currentPage = null;
|
|
4319
4061
|
this.showConfigForm = false;
|
|
4320
4062
|
this.formData = {};
|
|
@@ -4383,8 +4125,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4383
4125
|
if (!this.selectedModuleId || !this.selectedPageId) {
|
|
4384
4126
|
return;
|
|
4385
4127
|
}
|
|
4386
|
-
const module = this.modules.find(m => m.id === this.selectedModuleId);
|
|
4387
|
-
const page = this.pages.find(p => p.id === this.selectedPageId);
|
|
4128
|
+
const module = this.modules.find(m => this.normalizeId(m.id) === this.normalizeId(this.selectedModuleId));
|
|
4129
|
+
const page = this.pages.find(p => this.normalizeId(p.id) === this.normalizeId(this.selectedPageId));
|
|
4388
4130
|
if (!module || !page) {
|
|
4389
4131
|
console.error('未找到选中的模块或页面');
|
|
4390
4132
|
return;
|
|
@@ -4406,6 +4148,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4406
4148
|
pageId: this.selectedPageId,
|
|
4407
4149
|
config: result.config
|
|
4408
4150
|
});
|
|
4151
|
+
// 同步回显标识,避免父组件回传 modelValue 时重复触发回显逻辑
|
|
4152
|
+
this.appliedEchoKey = JSON.stringify([this.normalizeId(module.id), this.normalizeId(page.id)]);
|
|
4409
4153
|
|
|
4410
4154
|
// 隐藏确认按钮
|
|
4411
4155
|
this.showConfirmButton = false;
|
|
@@ -4416,9 +4160,9 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4416
4160
|
});
|
|
4417
4161
|
;// ./src/components/ModulePageSelect.vue?vue&type=script&lang=js
|
|
4418
4162
|
|
|
4419
|
-
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/components/ModulePageSelect.vue?vue&type=style&index=0&id=
|
|
4420
|
-
var
|
|
4421
|
-
;// ./src/components/ModulePageSelect.vue?vue&type=style&index=0&id=
|
|
4163
|
+
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.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
|
|
4164
|
+
var ModulePageSelectvue_type_style_index_0_id_0b2fc41a_scoped_true_lang_css = __webpack_require__(4986);
|
|
4165
|
+
;// ./src/components/ModulePageSelect.vue?vue&type=style&index=0&id=0b2fc41a&scoped=true&lang=css
|
|
4422
4166
|
|
|
4423
4167
|
// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
|
|
4424
4168
|
var exportHelper = __webpack_require__(1241);
|
|
@@ -4430,7 +4174,7 @@ var exportHelper = __webpack_require__(1241);
|
|
|
4430
4174
|
;
|
|
4431
4175
|
|
|
4432
4176
|
|
|
4433
|
-
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(ModulePageSelectvue_type_script_lang_js, [['render',render],['__scopeId',"data-v-
|
|
4177
|
+
const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.A)(ModulePageSelectvue_type_script_lang_js, [['render',render],['__scopeId',"data-v-0b2fc41a"]])
|
|
4434
4178
|
|
|
4435
4179
|
/* harmony default export */ var ModulePageSelect = (__exports__);
|
|
4436
4180
|
;// ./src/index.js
|