@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,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,123 +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: true,
|
|
4055
3790
|
deep: true,
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
// 从 modelValue 中提取模块ID和页面ID
|
|
4059
|
-
const moduleId = val.module_id || this.moduleId;
|
|
4060
|
-
const pageId = val.page_id || this.pageId;
|
|
4061
|
-
|
|
4062
|
-
// 如果有模块ID且与当前选中不同,则回显
|
|
4063
|
-
if (moduleId && moduleId !== this.selectedModuleId) {
|
|
4064
|
-
this.selectedModuleId = moduleId;
|
|
4065
|
-
this.selectedModuleName = val.module_name || '';
|
|
4066
|
-
|
|
4067
|
-
// 等待模块列表加载完成
|
|
4068
|
-
if (this.modules.length === 0) {
|
|
4069
|
-
await this.loadModules();
|
|
4070
|
-
}
|
|
4071
|
-
|
|
4072
|
-
// 查找模块名称
|
|
4073
|
-
if (!this.selectedModuleName) {
|
|
4074
|
-
const module = this.modules.find(m => m.id === moduleId);
|
|
4075
|
-
if (module) {
|
|
4076
|
-
this.selectedModuleName = module.name;
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
|
|
4080
|
-
// 加载页面列表
|
|
4081
|
-
await this.loadPages(moduleId);
|
|
4082
|
-
}
|
|
4083
|
-
|
|
4084
|
-
// 如果有页面ID且与当前选中不同,则回显
|
|
4085
|
-
if (pageId && pageId !== this.selectedPageId) {
|
|
4086
|
-
this.selectedPageId = pageId;
|
|
4087
|
-
this.selectedPageName = val.page_name || '';
|
|
4088
|
-
|
|
4089
|
-
// 如果页面列表已加载,查找页面信息
|
|
4090
|
-
if (this.pages.length > 0) {
|
|
4091
|
-
const page = this.pages.find(p => p.id === pageId);
|
|
4092
|
-
if (page) {
|
|
4093
|
-
this.selectedPageName = page.name;
|
|
4094
|
-
this.currentPage = page;
|
|
4095
|
-
this.loadPageConfig(page);
|
|
4096
|
-
|
|
4097
|
-
// 如果有配置数据,回显配置
|
|
4098
|
-
if (val.config) {
|
|
4099
|
-
this.formData = {
|
|
4100
|
-
...val.config
|
|
4101
|
-
};
|
|
4102
|
-
}
|
|
4103
|
-
}
|
|
4104
|
-
}
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
3791
|
+
handler() {
|
|
3792
|
+
this.applyEcho();
|
|
4107
3793
|
}
|
|
4108
3794
|
},
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
immediate: true,
|
|
4112
|
-
async handler(val) {
|
|
4113
|
-
if (val && val !== this.selectedModuleId && !this.modelValue?.module_id) {
|
|
4114
|
-
this.selectedModuleId = val;
|
|
4115
|
-
|
|
4116
|
-
// 等待模块列表加载
|
|
4117
|
-
if (this.modules.length === 0) {
|
|
4118
|
-
await this.loadModules();
|
|
4119
|
-
}
|
|
4120
|
-
|
|
4121
|
-
// 查找模块名称
|
|
4122
|
-
const module = this.modules.find(m => m.id === val);
|
|
4123
|
-
if (module) {
|
|
4124
|
-
this.selectedModuleName = module.name;
|
|
4125
|
-
}
|
|
4126
|
-
await this.loadPages(val);
|
|
4127
|
-
}
|
|
4128
|
-
}
|
|
3795
|
+
moduleId() {
|
|
3796
|
+
this.applyEcho();
|
|
4129
3797
|
},
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
immediate: true,
|
|
4133
|
-
async handler(val) {
|
|
4134
|
-
if (val && val !== this.selectedPageId && !this.modelValue?.page_id) {
|
|
4135
|
-
this.selectedPageId = val;
|
|
4136
|
-
// 如果页面列表已加载,查找页面信息
|
|
4137
|
-
if (this.pages.length > 0) {
|
|
4138
|
-
const page = this.pages.find(p => p.id === val);
|
|
4139
|
-
if (page) {
|
|
4140
|
-
this.selectedPageName = page.name;
|
|
4141
|
-
this.currentPage = page;
|
|
4142
|
-
this.loadPageConfig(page);
|
|
4143
|
-
}
|
|
4144
|
-
}
|
|
4145
|
-
}
|
|
4146
|
-
}
|
|
3798
|
+
pageId() {
|
|
3799
|
+
this.applyEcho();
|
|
4147
3800
|
}
|
|
4148
3801
|
},
|
|
4149
3802
|
mounted() {
|
|
4150
|
-
//
|
|
4151
|
-
|
|
4152
|
-
if (this.modelValue?.module_id || this.moduleId) {
|
|
4153
|
-
this.$nextTick(() => {
|
|
4154
|
-
this.loadModules();
|
|
4155
|
-
});
|
|
4156
|
-
}
|
|
3803
|
+
// 挂载时按已有值回显;无值时不请求接口,等用户 focus 再懒加载
|
|
3804
|
+
this.applyEcho();
|
|
4157
3805
|
},
|
|
4158
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
|
+
},
|
|
4159
3892
|
// 加载模块列表
|
|
4160
3893
|
async loadModules() {
|
|
4161
3894
|
try {
|
|
@@ -4163,32 +3896,24 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4163
3896
|
this.modules = this.moduleCache;
|
|
4164
3897
|
return;
|
|
4165
3898
|
}
|
|
3899
|
+
this.moduleLoading = true;
|
|
4166
3900
|
const moduleList = await this.fetchModulesFromAPI();
|
|
4167
3901
|
this.modules = moduleList;
|
|
4168
3902
|
this.moduleCache = moduleList;
|
|
4169
|
-
|
|
4170
|
-
// 如果有默认模块ID,加载对应页面
|
|
4171
|
-
if (this.moduleId) {
|
|
4172
|
-
this.selectedModuleId = this.moduleId;
|
|
4173
|
-
// 查找模块名称
|
|
4174
|
-
const module = this.modules.find(m => m.id === this.moduleId);
|
|
4175
|
-
if (module) {
|
|
4176
|
-
this.selectedModuleName = module.name;
|
|
4177
|
-
}
|
|
4178
|
-
await this.loadPages(this.moduleId);
|
|
4179
|
-
}
|
|
4180
3903
|
} catch (error) {
|
|
4181
3904
|
console.error('加载模块列表失败:', error);
|
|
4182
3905
|
this.$emit('error', {
|
|
4183
3906
|
type: 'loadModules',
|
|
4184
3907
|
error
|
|
4185
3908
|
});
|
|
3909
|
+
} finally {
|
|
3910
|
+
this.moduleLoading = false;
|
|
4186
3911
|
}
|
|
4187
3912
|
},
|
|
4188
3913
|
// 从 API 获取模块列表(使用模块列表接口)
|
|
4189
3914
|
async fetchModulesFromAPI() {
|
|
4190
3915
|
try {
|
|
4191
|
-
const response = await request({
|
|
3916
|
+
const response = await (0,gateway_request_lib_root_GatewayRequestLib_namespaceObject.request)({
|
|
4192
3917
|
api: '/api/assembly-center.extend_module.list',
|
|
4193
3918
|
params: {
|
|
4194
3919
|
page_no: 1,
|
|
@@ -4206,7 +3931,7 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4206
3931
|
|
|
4207
3932
|
// 将模块列表转换为选项格式
|
|
4208
3933
|
return modules.map(module => ({
|
|
4209
|
-
id: module.id,
|
|
3934
|
+
id: this.normalizeId(module.id),
|
|
4210
3935
|
name: module.name
|
|
4211
3936
|
}));
|
|
4212
3937
|
} catch (error) {
|
|
@@ -4215,9 +3940,16 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4215
3940
|
}
|
|
4216
3941
|
},
|
|
4217
3942
|
// 模块下拉框获得焦点时加载数据
|
|
4218
|
-
handleModuleFocus() {
|
|
3943
|
+
async handleModuleFocus() {
|
|
4219
3944
|
if (this.modules.length === 0) {
|
|
4220
|
-
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);
|
|
4221
3953
|
}
|
|
4222
3954
|
},
|
|
4223
3955
|
// 模块切换
|
|
@@ -4232,34 +3964,35 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4232
3964
|
|
|
4233
3965
|
// 选择改变,显示确认按钮
|
|
4234
3966
|
this.showConfirmButton = true;
|
|
3967
|
+
this.echoPageName = '';
|
|
4235
3968
|
if (this.selectedModuleId) {
|
|
4236
3969
|
// 更新模块名称
|
|
4237
|
-
|
|
4238
|
-
if (module) {
|
|
4239
|
-
this.selectedModuleName = module.name;
|
|
4240
|
-
}
|
|
3970
|
+
this.syncModuleName();
|
|
4241
3971
|
await this.loadPages(this.selectedModuleId);
|
|
4242
3972
|
} else {
|
|
4243
3973
|
this.selectedModuleName = '';
|
|
3974
|
+
this.echoModuleName = '';
|
|
4244
3975
|
}
|
|
4245
3976
|
},
|
|
4246
|
-
//
|
|
4247
|
-
async loadPages(moduleId) {
|
|
3977
|
+
// 加载页面列表;echoPageId 有值时同步回显该页面的名称与配置
|
|
3978
|
+
async loadPages(moduleId, echoPageId = '') {
|
|
3979
|
+
const cacheKey = this.normalizeId(moduleId);
|
|
4248
3980
|
try {
|
|
4249
|
-
if (this.pageCache[
|
|
4250
|
-
this.pages = this.pageCache[
|
|
3981
|
+
if (this.pageCache[cacheKey]) {
|
|
3982
|
+
this.pages = this.pageCache[cacheKey];
|
|
4251
3983
|
} else {
|
|
4252
|
-
|
|
3984
|
+
this.pageLoading = true;
|
|
3985
|
+
const pageList = await this.fetchPagesFromAPI(cacheKey);
|
|
4253
3986
|
this.pages = pageList;
|
|
4254
|
-
this.pageCache[
|
|
3987
|
+
this.pageCache[cacheKey] = pageList;
|
|
4255
3988
|
}
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
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);
|
|
4260
3992
|
if (page) {
|
|
4261
|
-
this.selectedPageId =
|
|
3993
|
+
this.selectedPageId = targetPageId;
|
|
4262
3994
|
this.selectedPageName = page.name;
|
|
3995
|
+
this.echoPageName = page.name;
|
|
4263
3996
|
this.currentPage = page;
|
|
4264
3997
|
this.loadPageConfig(page);
|
|
4265
3998
|
}
|
|
@@ -4270,15 +4003,19 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4270
4003
|
type: 'loadPages',
|
|
4271
4004
|
error
|
|
4272
4005
|
});
|
|
4006
|
+
} finally {
|
|
4007
|
+
this.pageLoading = false;
|
|
4273
4008
|
}
|
|
4274
4009
|
},
|
|
4275
|
-
// 从 API
|
|
4276
|
-
async fetchPagesFromAPI(moduleId) {
|
|
4010
|
+
// 从 API 获取页面列表(moduleId 为空时取全部,用于反查页面所属模块)
|
|
4011
|
+
async fetchPagesFromAPI(moduleId = '') {
|
|
4277
4012
|
try {
|
|
4278
|
-
const response = await request({
|
|
4013
|
+
const response = await (0,gateway_request_lib_root_GatewayRequestLib_namespaceObject.request)({
|
|
4279
4014
|
api: '/api/assembly-center.extend_module.page_list',
|
|
4280
4015
|
params: {
|
|
4281
|
-
|
|
4016
|
+
...(moduleId ? {
|
|
4017
|
+
module_id: moduleId
|
|
4018
|
+
} : {}),
|
|
4282
4019
|
type: this.pageType,
|
|
4283
4020
|
page_no: 1,
|
|
4284
4021
|
page_size: 1000
|
|
@@ -4295,7 +4032,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4295
4032
|
|
|
4296
4033
|
// 转换为选项格式
|
|
4297
4034
|
return pages.map(page => ({
|
|
4298
|
-
id: page.id,
|
|
4035
|
+
id: this.normalizeId(page.id),
|
|
4036
|
+
moduleId: this.normalizeId(page.module_id),
|
|
4299
4037
|
name: page.name,
|
|
4300
4038
|
options: page.options || {}
|
|
4301
4039
|
}));
|
|
@@ -4309,14 +4047,16 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4309
4047
|
// 选择改变,显示确认按钮
|
|
4310
4048
|
this.showConfirmButton = true;
|
|
4311
4049
|
if (this.selectedPageId) {
|
|
4312
|
-
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));
|
|
4313
4051
|
if (page) {
|
|
4314
4052
|
this.selectedPageName = page.name;
|
|
4053
|
+
this.echoPageName = page.name;
|
|
4315
4054
|
this.currentPage = page;
|
|
4316
4055
|
this.loadPageConfig(page);
|
|
4317
4056
|
}
|
|
4318
4057
|
} else {
|
|
4319
4058
|
this.selectedPageName = '';
|
|
4059
|
+
this.echoPageName = '';
|
|
4320
4060
|
this.currentPage = null;
|
|
4321
4061
|
this.showConfigForm = false;
|
|
4322
4062
|
this.formData = {};
|
|
@@ -4385,8 +4125,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4385
4125
|
if (!this.selectedModuleId || !this.selectedPageId) {
|
|
4386
4126
|
return;
|
|
4387
4127
|
}
|
|
4388
|
-
const module = this.modules.find(m => m.id === this.selectedModuleId);
|
|
4389
|
-
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));
|
|
4390
4130
|
if (!module || !page) {
|
|
4391
4131
|
console.error('未找到选中的模块或页面');
|
|
4392
4132
|
return;
|
|
@@ -4408,6 +4148,8 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4408
4148
|
pageId: this.selectedPageId,
|
|
4409
4149
|
config: result.config
|
|
4410
4150
|
});
|
|
4151
|
+
// 同步回显标识,避免父组件回传 modelValue 时重复触发回显逻辑
|
|
4152
|
+
this.appliedEchoKey = JSON.stringify([this.normalizeId(module.id), this.normalizeId(page.id)]);
|
|
4411
4153
|
|
|
4412
4154
|
// 隐藏确认按钮
|
|
4413
4155
|
this.showConfirmButton = false;
|
|
@@ -4418,9 +4160,9 @@ const registerApis = apis.deepMerge.bind(apis);
|
|
|
4418
4160
|
});
|
|
4419
4161
|
;// ./src/components/ModulePageSelect.vue?vue&type=script&lang=js
|
|
4420
4162
|
|
|
4421
|
-
// 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=
|
|
4422
|
-
var
|
|
4423
|
-
;// ./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
|
|
4424
4166
|
|
|
4425
4167
|
// EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
|
|
4426
4168
|
var exportHelper = __webpack_require__(1241);
|
|
@@ -4432,7 +4174,7 @@ var exportHelper = __webpack_require__(1241);
|
|
|
4432
4174
|
;
|
|
4433
4175
|
|
|
4434
4176
|
|
|
4435
|
-
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"]])
|
|
4436
4178
|
|
|
4437
4179
|
/* harmony default export */ var ModulePageSelect = (__exports__);
|
|
4438
4180
|
;// ./src/index.js
|