@panpanzhao/component-ui 0.0.9 → 0.0.10
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/lib/component-ui.common.js +1631 -465
- package/lib/components/crud.js +331 -185
- package/lib/components/dialog.js +10 -10
- package/lib/components/drawer.js +547 -0
- package/lib/components/form-dialog.js +145 -83
- package/lib/components/form-drawer.js +1260 -0
- package/lib/components/form-group.js +94 -53
- package/lib/components/form-input.js +55 -52
- package/lib/components/form-item.js +37 -9
- package/lib/components/form-view-dialog.js +35 -41
- package/lib/components/form-view-group.js +26 -25
- package/lib/components/form-view.js +14 -11
- package/lib/components/form.js +70 -25
- package/lib/components/formula.js +148 -78
- package/lib/components/table-column.js +47 -29
- package/lib/components/table-editable.js +22 -21
- package/lib/components/table-operate.js +2350 -0
- package/lib/components/table-search.js +33 -21
- package/lib/components/table.js +75 -44
- package/lib/index.js +1 -1
- package/lib/styles/component-ui.css +1 -1
- package/lib/styles/drawer.css +1 -0
- package/lib/styles/form-dialog.css +0 -1
- package/lib/styles/form.css +1 -1
- package/lib/styles/index.css +1 -1
- package/lib/styles/table-search.css +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1260 @@
|
|
|
1
|
+
module.exports =
|
|
2
|
+
/******/ (function(modules) { // webpackBootstrap
|
|
3
|
+
/******/ // The module cache
|
|
4
|
+
/******/ var installedModules = {};
|
|
5
|
+
/******/
|
|
6
|
+
/******/ // The require function
|
|
7
|
+
/******/ function __webpack_require__(moduleId) {
|
|
8
|
+
/******/
|
|
9
|
+
/******/ // Check if module is in cache
|
|
10
|
+
/******/ if(installedModules[moduleId]) {
|
|
11
|
+
/******/ return installedModules[moduleId].exports;
|
|
12
|
+
/******/ }
|
|
13
|
+
/******/ // Create a new module (and put it into the cache)
|
|
14
|
+
/******/ var module = installedModules[moduleId] = {
|
|
15
|
+
/******/ i: moduleId,
|
|
16
|
+
/******/ l: false,
|
|
17
|
+
/******/ exports: {}
|
|
18
|
+
/******/ };
|
|
19
|
+
/******/
|
|
20
|
+
/******/ // Execute the module function
|
|
21
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
22
|
+
/******/
|
|
23
|
+
/******/ // Flag the module as loaded
|
|
24
|
+
/******/ module.l = true;
|
|
25
|
+
/******/
|
|
26
|
+
/******/ // Return the exports of the module
|
|
27
|
+
/******/ return module.exports;
|
|
28
|
+
/******/ }
|
|
29
|
+
/******/
|
|
30
|
+
/******/
|
|
31
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
32
|
+
/******/ __webpack_require__.m = modules;
|
|
33
|
+
/******/
|
|
34
|
+
/******/ // expose the module cache
|
|
35
|
+
/******/ __webpack_require__.c = installedModules;
|
|
36
|
+
/******/
|
|
37
|
+
/******/ // define getter function for harmony exports
|
|
38
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
39
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
40
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
41
|
+
/******/ }
|
|
42
|
+
/******/ };
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // define __esModule on exports
|
|
45
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
46
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
/******/ }
|
|
49
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
/******/ };
|
|
51
|
+
/******/
|
|
52
|
+
/******/ // create a fake namespace object
|
|
53
|
+
/******/ // mode & 1: value is a module id, require it
|
|
54
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
55
|
+
/******/ // mode & 4: return value when already ns object
|
|
56
|
+
/******/ // mode & 8|1: behave like require
|
|
57
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
58
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
59
|
+
/******/ if(mode & 8) return value;
|
|
60
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
61
|
+
/******/ var ns = Object.create(null);
|
|
62
|
+
/******/ __webpack_require__.r(ns);
|
|
63
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
64
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
65
|
+
/******/ return ns;
|
|
66
|
+
/******/ };
|
|
67
|
+
/******/
|
|
68
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
69
|
+
/******/ __webpack_require__.n = function(module) {
|
|
70
|
+
/******/ var getter = module && module.__esModule ?
|
|
71
|
+
/******/ function getDefault() { return module['default']; } :
|
|
72
|
+
/******/ function getModuleExports() { return module; };
|
|
73
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
74
|
+
/******/ return getter;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
78
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
79
|
+
/******/
|
|
80
|
+
/******/ // __webpack_public_path__
|
|
81
|
+
/******/ __webpack_require__.p = "/dist/";
|
|
82
|
+
/******/
|
|
83
|
+
/******/
|
|
84
|
+
/******/ // Load entry module and return exports
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 79);
|
|
86
|
+
/******/ })
|
|
87
|
+
/************************************************************************/
|
|
88
|
+
/******/ ({
|
|
89
|
+
|
|
90
|
+
/***/ 0:
|
|
91
|
+
/***/ (function(module, exports) {
|
|
92
|
+
|
|
93
|
+
module.exports = require("@vue/babel-helper-vue-jsx-merge-props");
|
|
94
|
+
|
|
95
|
+
/***/ }),
|
|
96
|
+
|
|
97
|
+
/***/ 1:
|
|
98
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
99
|
+
|
|
100
|
+
"use strict";
|
|
101
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
|
102
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
103
|
+
|
|
104
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
105
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
106
|
+
// be included in the final webpack user bundle.
|
|
107
|
+
|
|
108
|
+
function normalizeComponent(
|
|
109
|
+
scriptExports,
|
|
110
|
+
render,
|
|
111
|
+
staticRenderFns,
|
|
112
|
+
functionalTemplate,
|
|
113
|
+
injectStyles,
|
|
114
|
+
scopeId,
|
|
115
|
+
moduleIdentifier /* server only */,
|
|
116
|
+
shadowMode /* vue-cli only */
|
|
117
|
+
) {
|
|
118
|
+
// Vue.extend constructor export interop
|
|
119
|
+
var options =
|
|
120
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
121
|
+
|
|
122
|
+
// render functions
|
|
123
|
+
if (render) {
|
|
124
|
+
options.render = render
|
|
125
|
+
options.staticRenderFns = staticRenderFns
|
|
126
|
+
options._compiled = true
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// functional template
|
|
130
|
+
if (functionalTemplate) {
|
|
131
|
+
options.functional = true
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// scopedId
|
|
135
|
+
if (scopeId) {
|
|
136
|
+
options._scopeId = 'data-v-' + scopeId
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var hook
|
|
140
|
+
if (moduleIdentifier) {
|
|
141
|
+
// server build
|
|
142
|
+
hook = function (context) {
|
|
143
|
+
// 2.3 injection
|
|
144
|
+
context =
|
|
145
|
+
context || // cached call
|
|
146
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
147
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
148
|
+
// 2.2 with runInNewContext: true
|
|
149
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
150
|
+
context = __VUE_SSR_CONTEXT__
|
|
151
|
+
}
|
|
152
|
+
// inject component styles
|
|
153
|
+
if (injectStyles) {
|
|
154
|
+
injectStyles.call(this, context)
|
|
155
|
+
}
|
|
156
|
+
// register component module identifier for async chunk inferrence
|
|
157
|
+
if (context && context._registeredComponents) {
|
|
158
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// used by ssr in case component is cached and beforeCreate
|
|
162
|
+
// never gets called
|
|
163
|
+
options._ssrRegister = hook
|
|
164
|
+
} else if (injectStyles) {
|
|
165
|
+
hook = shadowMode
|
|
166
|
+
? function () {
|
|
167
|
+
injectStyles.call(
|
|
168
|
+
this,
|
|
169
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
: injectStyles
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (hook) {
|
|
176
|
+
if (options.functional) {
|
|
177
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
178
|
+
// go through the normalizer
|
|
179
|
+
options._injectStyles = hook
|
|
180
|
+
// register for functional component in vue file
|
|
181
|
+
var originalRender = options.render
|
|
182
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
183
|
+
hook.call(context)
|
|
184
|
+
return originalRender(h, context)
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
// inject component registration as beforeCreate hook
|
|
188
|
+
var existing = options.beforeCreate
|
|
189
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return {
|
|
194
|
+
exports: scriptExports,
|
|
195
|
+
options: options
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
/***/ }),
|
|
201
|
+
|
|
202
|
+
/***/ 12:
|
|
203
|
+
/***/ (function(module, exports) {
|
|
204
|
+
|
|
205
|
+
module.exports = require("element-ui/lib/form");
|
|
206
|
+
|
|
207
|
+
/***/ }),
|
|
208
|
+
|
|
209
|
+
/***/ 13:
|
|
210
|
+
/***/ (function(module, exports) {
|
|
211
|
+
|
|
212
|
+
module.exports = require("element-ui/lib/row");
|
|
213
|
+
|
|
214
|
+
/***/ }),
|
|
215
|
+
|
|
216
|
+
/***/ 14:
|
|
217
|
+
/***/ (function(module, exports) {
|
|
218
|
+
|
|
219
|
+
module.exports = require("element-ui/lib/col");
|
|
220
|
+
|
|
221
|
+
/***/ }),
|
|
222
|
+
|
|
223
|
+
/***/ 15:
|
|
224
|
+
/***/ (function(module, exports) {
|
|
225
|
+
|
|
226
|
+
module.exports = require("@panpanzhao/component-ui/lib/components/form-item");
|
|
227
|
+
|
|
228
|
+
/***/ }),
|
|
229
|
+
|
|
230
|
+
/***/ 16:
|
|
231
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
232
|
+
|
|
233
|
+
"use strict";
|
|
234
|
+
// ESM COMPAT FLAG
|
|
235
|
+
__webpack_require__.r(__webpack_exports__);
|
|
236
|
+
|
|
237
|
+
// EXTERNAL MODULE: external "@vue/babel-helper-vue-jsx-merge-props"
|
|
238
|
+
var babel_helper_vue_jsx_merge_props_ = __webpack_require__(0);
|
|
239
|
+
var babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(babel_helper_vue_jsx_merge_props_);
|
|
240
|
+
|
|
241
|
+
// EXTERNAL MODULE: ./src/components/form/index.js + 5 modules
|
|
242
|
+
var components_form = __webpack_require__(4);
|
|
243
|
+
|
|
244
|
+
// CONCATENATED MODULE: ./src/components/form-group/src/content.js
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
/* harmony default export */ var content = ({
|
|
248
|
+
name: "Content",
|
|
249
|
+
inheritAttrs: false,
|
|
250
|
+
components: {
|
|
251
|
+
Form: components_form["default"]
|
|
252
|
+
},
|
|
253
|
+
props: {
|
|
254
|
+
control: String,
|
|
255
|
+
prop: String,
|
|
256
|
+
label: String,
|
|
257
|
+
actions: Array,
|
|
258
|
+
formItems: Array,
|
|
259
|
+
on: Object,
|
|
260
|
+
render: Function,
|
|
261
|
+
slots: Object,
|
|
262
|
+
config: Object,
|
|
263
|
+
show: {
|
|
264
|
+
type: [Boolean, Function],
|
|
265
|
+
default: true
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
data: function data() {
|
|
269
|
+
return {
|
|
270
|
+
formModel: {}
|
|
271
|
+
};
|
|
272
|
+
},
|
|
273
|
+
computed: {
|
|
274
|
+
_formGroup: function _formGroup() {
|
|
275
|
+
var parent = this.$parent;
|
|
276
|
+
while (parent) {
|
|
277
|
+
if (parent.$options.componentName !== 'FormGroup') {
|
|
278
|
+
parent = parent.$parent;
|
|
279
|
+
} else {
|
|
280
|
+
return parent;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
created: function created() {
|
|
287
|
+
if (this.prop && this._formGroup) {
|
|
288
|
+
this._formGroup.formModel[this.prop] = this.formModel;
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
mounted: function mounted() {
|
|
292
|
+
if (this.prop && this._formGroup && this.$refs.form) {
|
|
293
|
+
this._formGroup.formLayout[this.prop] = this.$refs.form.formItemLayout;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
methods: {
|
|
297
|
+
validate: function validate(callback) {
|
|
298
|
+
return this.$refs.form.validate(callback);
|
|
299
|
+
},
|
|
300
|
+
resetForm: function resetForm() {
|
|
301
|
+
this.$refs.form.resetFields();
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
render: function render(h) {
|
|
305
|
+
if (this.slots && this.slots.form) {
|
|
306
|
+
var vForm = typeof this.slots.form === "function" ? this.slots.form.call(this, h) : this.slots.form;
|
|
307
|
+
return vForm;
|
|
308
|
+
}
|
|
309
|
+
var formProp = {
|
|
310
|
+
attrs: Object.assign({
|
|
311
|
+
prop: this.prop,
|
|
312
|
+
formModel: this.formModel,
|
|
313
|
+
actions: this.actions,
|
|
314
|
+
formItems: this.formItems
|
|
315
|
+
}, this.$attrs),
|
|
316
|
+
on: this.on
|
|
317
|
+
};
|
|
318
|
+
return h(components_form["default"], babel_helper_vue_jsx_merge_props_default()([{
|
|
319
|
+
"ref": "form"
|
|
320
|
+
}, formProp]));
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
// EXTERNAL MODULE: external "element-ui/lib/tabs"
|
|
324
|
+
var tabs_ = __webpack_require__(6);
|
|
325
|
+
var tabs_default = /*#__PURE__*/__webpack_require__.n(tabs_);
|
|
326
|
+
|
|
327
|
+
// EXTERNAL MODULE: external "element-ui/lib/tab-pane"
|
|
328
|
+
var tab_pane_ = __webpack_require__(7);
|
|
329
|
+
var tab_pane_default = /*#__PURE__*/__webpack_require__.n(tab_pane_);
|
|
330
|
+
|
|
331
|
+
// EXTERNAL MODULE: external "element-ui/lib/collapse"
|
|
332
|
+
var collapse_ = __webpack_require__(8);
|
|
333
|
+
var collapse_default = /*#__PURE__*/__webpack_require__.n(collapse_);
|
|
334
|
+
|
|
335
|
+
// EXTERNAL MODULE: external "element-ui/lib/collapse-item"
|
|
336
|
+
var collapse_item_ = __webpack_require__(9);
|
|
337
|
+
var collapse_item_default = /*#__PURE__*/__webpack_require__.n(collapse_item_);
|
|
338
|
+
|
|
339
|
+
// CONCATENATED MODULE: ./src/components/form-group/src/index.js
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
/* harmony default export */ var src = ({
|
|
349
|
+
name: "FormGroup",
|
|
350
|
+
componentName: "FormGroup",
|
|
351
|
+
components: {
|
|
352
|
+
elTabs: tabs_default.a,
|
|
353
|
+
elTabPane: tab_pane_default.a,
|
|
354
|
+
elCollapse: collapse_default.a,
|
|
355
|
+
elCollapseItem: collapse_item_default.a
|
|
356
|
+
},
|
|
357
|
+
props: {
|
|
358
|
+
request: Function,
|
|
359
|
+
control: {
|
|
360
|
+
type: String,
|
|
361
|
+
default: "Collapse"
|
|
362
|
+
},
|
|
363
|
+
actions: {
|
|
364
|
+
type: Array,
|
|
365
|
+
default: function _default() {
|
|
366
|
+
return [];
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
items: {
|
|
370
|
+
type: Array,
|
|
371
|
+
default: function _default() {
|
|
372
|
+
return [];
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
formModel: {
|
|
376
|
+
type: Object,
|
|
377
|
+
default: function _default() {
|
|
378
|
+
return {};
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
on: {
|
|
382
|
+
type: Object,
|
|
383
|
+
default: function _default() {
|
|
384
|
+
return {};
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
data: function data() {
|
|
389
|
+
return {
|
|
390
|
+
formLayout: {},
|
|
391
|
+
openedCode: null
|
|
392
|
+
};
|
|
393
|
+
},
|
|
394
|
+
computed: {
|
|
395
|
+
actionFormMap: function actionFormMap() {
|
|
396
|
+
var _this = this;
|
|
397
|
+
var actionForm = {};
|
|
398
|
+
this.actions.forEach(function (action) {
|
|
399
|
+
if (!action.trigger) {
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
var formCode = action.trigger.formCode;
|
|
403
|
+
if (!actionForm[formCode]) {
|
|
404
|
+
actionForm[formCode] = [];
|
|
405
|
+
}
|
|
406
|
+
actionForm[formCode].push({
|
|
407
|
+
trigger: action.trigger.fieldCode,
|
|
408
|
+
event: action.event,
|
|
409
|
+
target: null,
|
|
410
|
+
//action.target
|
|
411
|
+
exec: function exec(config) {
|
|
412
|
+
var _action$exec;
|
|
413
|
+
var targetConfig = {};
|
|
414
|
+
var targetForm = {};
|
|
415
|
+
action.target.forEach(function (formTarget) {
|
|
416
|
+
if (!targetConfig[formTarget.formCode]) {
|
|
417
|
+
targetConfig[formTarget.formCode] = {};
|
|
418
|
+
}
|
|
419
|
+
targetConfig[formTarget.formCode][formTarget.fieldCode] = _this.formLayout[formTarget.formCode][formTarget.fieldCode];
|
|
420
|
+
targetForm[formTarget.formCode] = _this.formModel[formTarget.formCode];
|
|
421
|
+
});
|
|
422
|
+
config.targetConfig = targetConfig;
|
|
423
|
+
config.targetForm = targetForm;
|
|
424
|
+
for (var _len = arguments.length, arg = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
425
|
+
arg[_key - 1] = arguments[_key];
|
|
426
|
+
}
|
|
427
|
+
(_action$exec = action.exec).call.apply(_action$exec, [_this, config].concat(arg));
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
return actionForm;
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
methods: {
|
|
435
|
+
validate: function validate(callback) {
|
|
436
|
+
var _this2 = this;
|
|
437
|
+
var promise;
|
|
438
|
+
// if no callback, return promise
|
|
439
|
+
if (typeof callback !== "function" && Promise) {
|
|
440
|
+
promise = new Promise(function (resolve, reject) {
|
|
441
|
+
callback = function callback(valid, invalidForms) {
|
|
442
|
+
valid ? resolve(valid) : reject(invalidForms);
|
|
443
|
+
};
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
var valid = true;
|
|
447
|
+
var count = 0;
|
|
448
|
+
// 如果需要验证的表格为空,调用验证时立刻返回callback
|
|
449
|
+
if (this.items.length === 0 && callback) {
|
|
450
|
+
callback(true);
|
|
451
|
+
}
|
|
452
|
+
var invalidForms = {};
|
|
453
|
+
this.items.forEach(function (form) {
|
|
454
|
+
var formNode = _this2.$refs[form.prop];
|
|
455
|
+
if (!formNode) {
|
|
456
|
+
if (typeof callback === "function" && ++count === _this2.items.length) {
|
|
457
|
+
callback(valid, invalidForms);
|
|
458
|
+
}
|
|
459
|
+
return true;
|
|
460
|
+
}
|
|
461
|
+
formNode.validate(function (flag, msgObj) {
|
|
462
|
+
if (!flag) {
|
|
463
|
+
valid = false;
|
|
464
|
+
invalidForms[form.prop] = msgObj;
|
|
465
|
+
}
|
|
466
|
+
if (typeof callback === "function" && ++count === _this2.items.length) {
|
|
467
|
+
callback(valid, invalidForms);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
if (promise) {
|
|
472
|
+
return promise;
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
reset: function reset() {
|
|
476
|
+
var _this3 = this;
|
|
477
|
+
this.items.forEach(function (form) {
|
|
478
|
+
var formNode = _this3.$refs[form.prop];
|
|
479
|
+
if (!formNode) {
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
formNode.resetForm();
|
|
483
|
+
});
|
|
484
|
+
},
|
|
485
|
+
formNode: function formNode(form) {
|
|
486
|
+
var h = this.$createElement;
|
|
487
|
+
var formProp = {
|
|
488
|
+
attrs: Object.assign({
|
|
489
|
+
actions: this.actionFormMap[form.prop]
|
|
490
|
+
}, form),
|
|
491
|
+
on: form.on
|
|
492
|
+
};
|
|
493
|
+
return h(content, babel_helper_vue_jsx_merge_props_default()([{
|
|
494
|
+
"ref": form.prop,
|
|
495
|
+
"key": form.prop,
|
|
496
|
+
"attrs": {
|
|
497
|
+
"config": form,
|
|
498
|
+
"control": this.control
|
|
499
|
+
}
|
|
500
|
+
}, formProp]));
|
|
501
|
+
},
|
|
502
|
+
renderTab: function renderTab(h, filterItems) {
|
|
503
|
+
var _this4 = this;
|
|
504
|
+
var itemNode = filterItems.map(function (item) {
|
|
505
|
+
if (typeof item.render === "function") {
|
|
506
|
+
return item.render(h, _this4.formModel, item);
|
|
507
|
+
}
|
|
508
|
+
return h("el-tab-pane", {
|
|
509
|
+
"key": item.prop,
|
|
510
|
+
"attrs": {
|
|
511
|
+
"name": item.prop,
|
|
512
|
+
"label": item.label
|
|
513
|
+
}
|
|
514
|
+
}, [h("template", {
|
|
515
|
+
"slot": "label"
|
|
516
|
+
}, [item.slots && typeof item.slots.title === "function" ? item.slots.title.call(_this4, h) : item.slots && item.slots.title]), _this4.formNode(item)]);
|
|
517
|
+
});
|
|
518
|
+
var tabsProp = {
|
|
519
|
+
attrs: {
|
|
520
|
+
type: "border-card",
|
|
521
|
+
value: this.openedCode
|
|
522
|
+
},
|
|
523
|
+
on: {
|
|
524
|
+
"tab-click": function tabClick(tabNode) {
|
|
525
|
+
_this4.$emit("openedCode", tabNode.name);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
return h("el-tabs", babel_helper_vue_jsx_merge_props_default()([{}, tabsProp]), [itemNode]);
|
|
530
|
+
},
|
|
531
|
+
renderCollapse: function renderCollapse(h, filterItems) {
|
|
532
|
+
var _this5 = this;
|
|
533
|
+
var itemNode = filterItems.map(function (item) {
|
|
534
|
+
if (typeof item.render === "function") {
|
|
535
|
+
return item.render(h, _this5.formModel, item);
|
|
536
|
+
}
|
|
537
|
+
return h("el-collapse-item", {
|
|
538
|
+
"key": item.prop,
|
|
539
|
+
"attrs": {
|
|
540
|
+
"name": item.prop,
|
|
541
|
+
"title": item.label
|
|
542
|
+
}
|
|
543
|
+
}, [h("template", {
|
|
544
|
+
"slot": "title"
|
|
545
|
+
}, [item.slots && typeof item.slots.title === "function" ? item.slots.title.call(_this5, h) : item.slots && item.slots.title]), _this5.formNode(item)]);
|
|
546
|
+
});
|
|
547
|
+
var collapseProp = {
|
|
548
|
+
attrs: {
|
|
549
|
+
value: this.openedCode
|
|
550
|
+
},
|
|
551
|
+
on: {
|
|
552
|
+
change: function change(val) {
|
|
553
|
+
_this5.$emit("openedCode", val);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
return h("el-collapse", babel_helper_vue_jsx_merge_props_default()([{}, collapseProp]), [itemNode]);
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
render: function render(h) {
|
|
561
|
+
var _this6 = this;
|
|
562
|
+
var filterItems = this.items.filter(function (item) {
|
|
563
|
+
if (item.show === false) {
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
if (typeof item.show === "function" && !item.show.call(_this6, {
|
|
567
|
+
config: item
|
|
568
|
+
})) {
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
return true;
|
|
572
|
+
});
|
|
573
|
+
if (!filterItems.length > 0) {
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
this.openedCode = filterItems[0] && filterItems[0].prop;
|
|
577
|
+
return h("div", {
|
|
578
|
+
"class": ["form-group", "is-" + (this.control === "Tab" ? "tab" : "collapse")]
|
|
579
|
+
}, [this.control === "Tab" ? this.renderTab(h, filterItems) : this.renderCollapse(h, filterItems)]);
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
// CONCATENATED MODULE: ./src/components/form-group/index.js
|
|
583
|
+
|
|
584
|
+
src.install = function (Vue) {
|
|
585
|
+
Vue.component(src.name, src);
|
|
586
|
+
};
|
|
587
|
+
/* harmony default export */ var form_group = __webpack_exports__["default"] = (src);
|
|
588
|
+
|
|
589
|
+
/***/ }),
|
|
590
|
+
|
|
591
|
+
/***/ 2:
|
|
592
|
+
/***/ (function(module, exports) {
|
|
593
|
+
|
|
594
|
+
module.exports = require("lodash");
|
|
595
|
+
|
|
596
|
+
/***/ }),
|
|
597
|
+
|
|
598
|
+
/***/ 3:
|
|
599
|
+
/***/ (function(module, exports) {
|
|
600
|
+
|
|
601
|
+
module.exports = require("@panpanzhao/component-ui/lib/utils/formula");
|
|
602
|
+
|
|
603
|
+
/***/ }),
|
|
604
|
+
|
|
605
|
+
/***/ 34:
|
|
606
|
+
/***/ (function(module, exports) {
|
|
607
|
+
|
|
608
|
+
module.exports = require("@panpanzhao/component-ui/lib/components/drawer");
|
|
609
|
+
|
|
610
|
+
/***/ }),
|
|
611
|
+
|
|
612
|
+
/***/ 4:
|
|
613
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
614
|
+
|
|
615
|
+
"use strict";
|
|
616
|
+
// ESM COMPAT FLAG
|
|
617
|
+
__webpack_require__.r(__webpack_exports__);
|
|
618
|
+
|
|
619
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./src/components/form/src/form.vue?vue&type=template&id=26d7095f&
|
|
620
|
+
var render = function render() {
|
|
621
|
+
var _vm = this,
|
|
622
|
+
_c = _vm._self._c
|
|
623
|
+
return _c(
|
|
624
|
+
"div",
|
|
625
|
+
{ class: ["form", { "is-full": _vm.isFull }] },
|
|
626
|
+
[
|
|
627
|
+
_vm._t("default", function () {
|
|
628
|
+
return [
|
|
629
|
+
_c(
|
|
630
|
+
"el-form",
|
|
631
|
+
_vm._g(
|
|
632
|
+
_vm._b({ ref: "form" }, "el-form", _vm.formProps, false),
|
|
633
|
+
_vm.formListeners
|
|
634
|
+
),
|
|
635
|
+
[
|
|
636
|
+
_c(
|
|
637
|
+
"el-row",
|
|
638
|
+
_vm._b({}, "el-row", _vm.rowProps, false),
|
|
639
|
+
[
|
|
640
|
+
_vm._l(_vm.filterFormItems, function (item) {
|
|
641
|
+
return [
|
|
642
|
+
_c(
|
|
643
|
+
"el-col",
|
|
644
|
+
{
|
|
645
|
+
key: item.prop,
|
|
646
|
+
attrs: { span: item.span || _vm.span },
|
|
647
|
+
},
|
|
648
|
+
[
|
|
649
|
+
_c(
|
|
650
|
+
"form-item",
|
|
651
|
+
_vm._g(
|
|
652
|
+
_vm._b(
|
|
653
|
+
{
|
|
654
|
+
key: item.prop,
|
|
655
|
+
attrs: {
|
|
656
|
+
config: item,
|
|
657
|
+
actions: _vm.actionItem[item.prop],
|
|
658
|
+
value: _vm.formModel[item.prop],
|
|
659
|
+
},
|
|
660
|
+
on: { formItemChange: _vm.formItemChange },
|
|
661
|
+
},
|
|
662
|
+
"form-item",
|
|
663
|
+
item,
|
|
664
|
+
false
|
|
665
|
+
),
|
|
666
|
+
item.on
|
|
667
|
+
)
|
|
668
|
+
),
|
|
669
|
+
],
|
|
670
|
+
1
|
|
671
|
+
),
|
|
672
|
+
]
|
|
673
|
+
}),
|
|
674
|
+
],
|
|
675
|
+
2
|
|
676
|
+
),
|
|
677
|
+
],
|
|
678
|
+
1
|
|
679
|
+
),
|
|
680
|
+
]
|
|
681
|
+
}),
|
|
682
|
+
],
|
|
683
|
+
2
|
|
684
|
+
)
|
|
685
|
+
}
|
|
686
|
+
var staticRenderFns = []
|
|
687
|
+
render._withStripped = true
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
// CONCATENATED MODULE: ./src/components/form/src/form.vue?vue&type=template&id=26d7095f&
|
|
691
|
+
|
|
692
|
+
// EXTERNAL MODULE: external "element-ui/lib/form"
|
|
693
|
+
var form_ = __webpack_require__(12);
|
|
694
|
+
var form_default = /*#__PURE__*/__webpack_require__.n(form_);
|
|
695
|
+
|
|
696
|
+
// EXTERNAL MODULE: external "element-ui/lib/row"
|
|
697
|
+
var row_ = __webpack_require__(13);
|
|
698
|
+
var row_default = /*#__PURE__*/__webpack_require__.n(row_);
|
|
699
|
+
|
|
700
|
+
// EXTERNAL MODULE: external "element-ui/lib/col"
|
|
701
|
+
var col_ = __webpack_require__(14);
|
|
702
|
+
var col_default = /*#__PURE__*/__webpack_require__.n(col_);
|
|
703
|
+
|
|
704
|
+
// EXTERNAL MODULE: external "@panpanzhao/component-ui/lib/components/form-item"
|
|
705
|
+
var form_item_ = __webpack_require__(15);
|
|
706
|
+
var form_item_default = /*#__PURE__*/__webpack_require__.n(form_item_);
|
|
707
|
+
|
|
708
|
+
// EXTERNAL MODULE: external "@panpanzhao/component-ui/lib/utils/formula"
|
|
709
|
+
var formula_ = __webpack_require__(3);
|
|
710
|
+
|
|
711
|
+
// EXTERNAL MODULE: external "lodash"
|
|
712
|
+
var external_lodash_ = __webpack_require__(2);
|
|
713
|
+
|
|
714
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/form/src/form.vue?vue&type=script&lang=js&
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
/* harmony default export */ var formvue_type_script_lang_js_ = ({
|
|
722
|
+
name: "Form",
|
|
723
|
+
componentName: "Form",
|
|
724
|
+
components: {
|
|
725
|
+
elForm: form_default.a,
|
|
726
|
+
elRow: row_default.a,
|
|
727
|
+
elCol: col_default.a,
|
|
728
|
+
FormItem: form_item_default.a
|
|
729
|
+
},
|
|
730
|
+
provide: function provide() {
|
|
731
|
+
return {
|
|
732
|
+
form: this
|
|
733
|
+
};
|
|
734
|
+
},
|
|
735
|
+
props: {
|
|
736
|
+
isFull: {
|
|
737
|
+
type: Boolean,
|
|
738
|
+
default: true
|
|
739
|
+
},
|
|
740
|
+
prop: String,
|
|
741
|
+
span: Number,
|
|
742
|
+
formItems: {
|
|
743
|
+
type: Array,
|
|
744
|
+
default: function _default() {
|
|
745
|
+
return [];
|
|
746
|
+
}
|
|
747
|
+
},
|
|
748
|
+
actions: {
|
|
749
|
+
type: Array,
|
|
750
|
+
default: function _default() {
|
|
751
|
+
return [];
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
on: {
|
|
755
|
+
type: Object,
|
|
756
|
+
default: function _default() {
|
|
757
|
+
return {};
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
formModel: {
|
|
761
|
+
type: Object,
|
|
762
|
+
default: function _default() {
|
|
763
|
+
return {};
|
|
764
|
+
}
|
|
765
|
+
},
|
|
766
|
+
request: Function
|
|
767
|
+
},
|
|
768
|
+
computed: {
|
|
769
|
+
formProps: function formProps() {
|
|
770
|
+
return Object.assign({}, this.$attrs, {
|
|
771
|
+
model: this.formModel
|
|
772
|
+
});
|
|
773
|
+
},
|
|
774
|
+
formListeners: function formListeners() {
|
|
775
|
+
return Object.assign({}, this.$listeners);
|
|
776
|
+
},
|
|
777
|
+
rowProps: function rowProps() {
|
|
778
|
+
return Object.assign({}, this.$attrs);
|
|
779
|
+
},
|
|
780
|
+
filterFormItems: function filterFormItems() {
|
|
781
|
+
var _this = this;
|
|
782
|
+
return this.formItems.filter(function (item) {
|
|
783
|
+
if (item.show === false) {
|
|
784
|
+
return false;
|
|
785
|
+
}
|
|
786
|
+
if (typeof item.show === "function" && !item.show.call(_this, {
|
|
787
|
+
form: _this,
|
|
788
|
+
formModel: _this.formModel,
|
|
789
|
+
config: item
|
|
790
|
+
})) {
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
if (typeof item.show === "string" && !Object(formula_["evaluate"])(item.show, _this.formModel, {
|
|
794
|
+
evalMode: true
|
|
795
|
+
})) {
|
|
796
|
+
return false;
|
|
797
|
+
}
|
|
798
|
+
return true;
|
|
799
|
+
});
|
|
800
|
+
},
|
|
801
|
+
actionItem: function actionItem() {
|
|
802
|
+
var relItem = {};
|
|
803
|
+
this.actions.forEach(function (item) {
|
|
804
|
+
if (!relItem[item.trigger]) {
|
|
805
|
+
relItem[item.trigger] = [];
|
|
806
|
+
}
|
|
807
|
+
relItem[item.trigger].push(item);
|
|
808
|
+
});
|
|
809
|
+
return relItem;
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
data: function data() {
|
|
813
|
+
return {
|
|
814
|
+
defaultModel: {},
|
|
815
|
+
//默认值存储
|
|
816
|
+
formItemLayout: {}
|
|
817
|
+
};
|
|
818
|
+
},
|
|
819
|
+
created: function created() {
|
|
820
|
+
var _this2 = this;
|
|
821
|
+
this.formItems.forEach(function (item) {
|
|
822
|
+
_this2.formItemLayout[item.prop] = item;
|
|
823
|
+
_this2.defaultModel[item.prop] = item.value;
|
|
824
|
+
//初始化值处理
|
|
825
|
+
var formVal = Object(external_lodash_["get"])(_this2.formModel, item.prop);
|
|
826
|
+
if (typeof formVal === 'undefined') {
|
|
827
|
+
//初始化数据值
|
|
828
|
+
if (item.prop && item.prop.indexOf(".") != -1) {
|
|
829
|
+
//循环设置值
|
|
830
|
+
var keyArr = item.prop.split('.');
|
|
831
|
+
var tempObj = _this2.formModel;
|
|
832
|
+
keyArr.forEach(function (key, index) {
|
|
833
|
+
if (index < keyArr.length - 1) {
|
|
834
|
+
if (typeof tempObj[key] === 'undefined') {
|
|
835
|
+
_this2.$set(tempObj, key, {});
|
|
836
|
+
}
|
|
837
|
+
tempObj = tempObj[key];
|
|
838
|
+
} else {
|
|
839
|
+
_this2.$set(tempObj, key, item.value || null);
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
} else {
|
|
843
|
+
_this2.$set(_this2.formModel, item.prop, item.value || null);
|
|
844
|
+
}
|
|
845
|
+
} else {
|
|
846
|
+
item.value = formVal;
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
},
|
|
850
|
+
methods: {
|
|
851
|
+
validate: function validate(callback) {
|
|
852
|
+
return this.$refs.form.validate(callback);
|
|
853
|
+
},
|
|
854
|
+
validateField: function validateField(props, callback) {
|
|
855
|
+
return this.$refs.form.validateField(props, callback);
|
|
856
|
+
},
|
|
857
|
+
reset: function reset() {
|
|
858
|
+
this.resetFields();
|
|
859
|
+
},
|
|
860
|
+
resetFields: function resetFields() {
|
|
861
|
+
for (var key in this.defaultModel) {
|
|
862
|
+
if (this.formItemLayout[key]) {
|
|
863
|
+
this.formItemLayout[key].value = this.defaultModel[key];
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
this.$refs.form.resetFields();
|
|
867
|
+
},
|
|
868
|
+
clearValidate: function clearValidate(props) {
|
|
869
|
+
return this.$refs.form.clearValidate(props);
|
|
870
|
+
},
|
|
871
|
+
formItemChange: function formItemChange(config) {
|
|
872
|
+
this.$emit("formChange", {
|
|
873
|
+
formProp: this.prop,
|
|
874
|
+
formModel: this.formModel,
|
|
875
|
+
formConfig: this.formItemLayout,
|
|
876
|
+
itemProp: config.itemProp,
|
|
877
|
+
itemModel: config.itemVal,
|
|
878
|
+
itemConfig: config.itemConfig
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
// CONCATENATED MODULE: ./src/components/form/src/form.vue?vue&type=script&lang=js&
|
|
884
|
+
/* harmony default export */ var src_formvue_type_script_lang_js_ = (formvue_type_script_lang_js_);
|
|
885
|
+
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
886
|
+
var componentNormalizer = __webpack_require__(1);
|
|
887
|
+
|
|
888
|
+
// CONCATENATED MODULE: ./src/components/form/src/form.vue
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
/* normalize component */
|
|
895
|
+
|
|
896
|
+
var component = Object(componentNormalizer["a" /* default */])(
|
|
897
|
+
src_formvue_type_script_lang_js_,
|
|
898
|
+
render,
|
|
899
|
+
staticRenderFns,
|
|
900
|
+
false,
|
|
901
|
+
null,
|
|
902
|
+
null,
|
|
903
|
+
null
|
|
904
|
+
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
/* harmony default export */ var src_form = (component.exports);
|
|
908
|
+
// CONCATENATED MODULE: ./src/components/form/index.js
|
|
909
|
+
|
|
910
|
+
src_form.install = function (Vue) {
|
|
911
|
+
Vue.component(src_form.name, src_form);
|
|
912
|
+
};
|
|
913
|
+
/* harmony default export */ var components_form = __webpack_exports__["default"] = (src_form);
|
|
914
|
+
|
|
915
|
+
/***/ }),
|
|
916
|
+
|
|
917
|
+
/***/ 5:
|
|
918
|
+
/***/ (function(module, exports) {
|
|
919
|
+
|
|
920
|
+
module.exports = require("element-ui/lib/button");
|
|
921
|
+
|
|
922
|
+
/***/ }),
|
|
923
|
+
|
|
924
|
+
/***/ 6:
|
|
925
|
+
/***/ (function(module, exports) {
|
|
926
|
+
|
|
927
|
+
module.exports = require("element-ui/lib/tabs");
|
|
928
|
+
|
|
929
|
+
/***/ }),
|
|
930
|
+
|
|
931
|
+
/***/ 7:
|
|
932
|
+
/***/ (function(module, exports) {
|
|
933
|
+
|
|
934
|
+
module.exports = require("element-ui/lib/tab-pane");
|
|
935
|
+
|
|
936
|
+
/***/ }),
|
|
937
|
+
|
|
938
|
+
/***/ 79:
|
|
939
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
940
|
+
|
|
941
|
+
"use strict";
|
|
942
|
+
// ESM COMPAT FLAG
|
|
943
|
+
__webpack_require__.r(__webpack_exports__);
|
|
944
|
+
|
|
945
|
+
// EXTERNAL MODULE: external "@vue/babel-helper-vue-jsx-merge-props"
|
|
946
|
+
var babel_helper_vue_jsx_merge_props_ = __webpack_require__(0);
|
|
947
|
+
var babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(babel_helper_vue_jsx_merge_props_);
|
|
948
|
+
|
|
949
|
+
// EXTERNAL MODULE: external "@panpanzhao/component-ui/lib/components/drawer"
|
|
950
|
+
var drawer_ = __webpack_require__(34);
|
|
951
|
+
var drawer_default = /*#__PURE__*/__webpack_require__.n(drawer_);
|
|
952
|
+
|
|
953
|
+
// EXTERNAL MODULE: external "element-ui/lib/button"
|
|
954
|
+
var button_ = __webpack_require__(5);
|
|
955
|
+
var button_default = /*#__PURE__*/__webpack_require__.n(button_);
|
|
956
|
+
|
|
957
|
+
// EXTERNAL MODULE: ./src/components/form/index.js + 5 modules
|
|
958
|
+
var components_form = __webpack_require__(4);
|
|
959
|
+
|
|
960
|
+
// EXTERNAL MODULE: ./src/components/form-group/index.js + 2 modules
|
|
961
|
+
var form_group = __webpack_require__(16);
|
|
962
|
+
|
|
963
|
+
// EXTERNAL MODULE: external "@panpanzhao/component-ui/lib/utils/formula"
|
|
964
|
+
var formula_ = __webpack_require__(3);
|
|
965
|
+
|
|
966
|
+
// EXTERNAL MODULE: external "lodash"
|
|
967
|
+
var external_lodash_ = __webpack_require__(2);
|
|
968
|
+
|
|
969
|
+
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/components/form-drawer/src/index.vue?vue&type=script&lang=js&
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
/* harmony default export */ var srcvue_type_script_lang_js_ = ({
|
|
982
|
+
name: "FormDrawer",
|
|
983
|
+
componentName: "FormDrawer",
|
|
984
|
+
components: {
|
|
985
|
+
Form: components_form["default"],
|
|
986
|
+
FormGroup: form_group["default"],
|
|
987
|
+
Drawer: drawer_default.a,
|
|
988
|
+
Tool: {
|
|
989
|
+
components: {
|
|
990
|
+
elButton: button_default.a
|
|
991
|
+
},
|
|
992
|
+
props: {
|
|
993
|
+
label: String,
|
|
994
|
+
show: {
|
|
995
|
+
type: [Boolean, Function],
|
|
996
|
+
default: true
|
|
997
|
+
},
|
|
998
|
+
on: {
|
|
999
|
+
type: Object,
|
|
1000
|
+
default: function _default() {
|
|
1001
|
+
return {};
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
render: Function
|
|
1005
|
+
},
|
|
1006
|
+
computed: {
|
|
1007
|
+
attrs: function attrs() {
|
|
1008
|
+
return Object.assign({
|
|
1009
|
+
size: "mini"
|
|
1010
|
+
}, this.$attrs);
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
data: function data() {
|
|
1014
|
+
return {
|
|
1015
|
+
loading: this.$attrs.loading
|
|
1016
|
+
};
|
|
1017
|
+
},
|
|
1018
|
+
render: function render(h) {
|
|
1019
|
+
var _this = this;
|
|
1020
|
+
if (this.show === false) {
|
|
1021
|
+
return null;
|
|
1022
|
+
}
|
|
1023
|
+
if (typeof this.render === "function") {
|
|
1024
|
+
return this.render(h, this);
|
|
1025
|
+
}
|
|
1026
|
+
var param = {
|
|
1027
|
+
attrs: this.attrs,
|
|
1028
|
+
on: {
|
|
1029
|
+
click: function click(event) {
|
|
1030
|
+
if (typeof _this.$listeners.click === "function") {
|
|
1031
|
+
_this.$listeners.click.call(event, _this);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
return h("el-button", babel_helper_vue_jsx_merge_props_default()([{}, param, {
|
|
1037
|
+
"attrs": {
|
|
1038
|
+
"loading": this.loading
|
|
1039
|
+
}
|
|
1040
|
+
}]), [this.label]);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
props: {
|
|
1045
|
+
drawer: {
|
|
1046
|
+
type: Object,
|
|
1047
|
+
default: function _default() {
|
|
1048
|
+
return {
|
|
1049
|
+
confirmButtonText: "确认",
|
|
1050
|
+
confirmButtonType: "Primary",
|
|
1051
|
+
cancelButtonText: "取消",
|
|
1052
|
+
cancelButtonType: "Primary"
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
},
|
|
1056
|
+
formMode: String,
|
|
1057
|
+
api: {
|
|
1058
|
+
type: Object,
|
|
1059
|
+
default: function _default() {
|
|
1060
|
+
return {};
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1063
|
+
form: {
|
|
1064
|
+
type: Object,
|
|
1065
|
+
default: function _default() {
|
|
1066
|
+
return {};
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
tools: Array,
|
|
1070
|
+
on: {
|
|
1071
|
+
type: Object,
|
|
1072
|
+
default: function _default() {
|
|
1073
|
+
return {};
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
slots: {
|
|
1077
|
+
type: Object,
|
|
1078
|
+
default: function _default() {
|
|
1079
|
+
return {};
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
data: function data() {
|
|
1084
|
+
return {
|
|
1085
|
+
show: false,
|
|
1086
|
+
formModel: {},
|
|
1087
|
+
defaultTools: [{
|
|
1088
|
+
label: this.drawer.cancelButtonText || "取消",
|
|
1089
|
+
type: this.confirmButtonType,
|
|
1090
|
+
loading: false,
|
|
1091
|
+
on: {
|
|
1092
|
+
click: this.close
|
|
1093
|
+
}
|
|
1094
|
+
}, {
|
|
1095
|
+
label: this.drawer.confirmButtonText || "确认",
|
|
1096
|
+
type: this.confirmButtonType || "primary",
|
|
1097
|
+
loading: false,
|
|
1098
|
+
on: {
|
|
1099
|
+
click: this.submit
|
|
1100
|
+
}
|
|
1101
|
+
}]
|
|
1102
|
+
};
|
|
1103
|
+
},
|
|
1104
|
+
computed: {
|
|
1105
|
+
request: function request() {
|
|
1106
|
+
return this.api.request || (this.$COMPONENT || {}).request;
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
methods: {
|
|
1110
|
+
open: function open(model) {
|
|
1111
|
+
this.show = true;
|
|
1112
|
+
if (model) {
|
|
1113
|
+
this.setFormModel(model);
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
close: function close() {
|
|
1117
|
+
this.show = false;
|
|
1118
|
+
this.$emit("close");
|
|
1119
|
+
},
|
|
1120
|
+
setFormModel: function setFormModel(model) {
|
|
1121
|
+
Object(external_lodash_["merge"])(this.formModel, model);
|
|
1122
|
+
},
|
|
1123
|
+
reset: function reset() {
|
|
1124
|
+
this.$refs.form && this.$refs.form.reset();
|
|
1125
|
+
},
|
|
1126
|
+
submit: function submit(button) {
|
|
1127
|
+
var _this2 = this;
|
|
1128
|
+
this.$refs.form.validate(function (isValidate, errorMessage) {
|
|
1129
|
+
if (!isValidate) {
|
|
1130
|
+
return false;
|
|
1131
|
+
}
|
|
1132
|
+
var reqData = Object(external_lodash_["merge"])(_this2.api.data || {}, _this2.formModel);
|
|
1133
|
+
if (!(_this2.api.url && _this2.request)) {
|
|
1134
|
+
_this2.$emit("success", null, reqData);
|
|
1135
|
+
_this2.reset();
|
|
1136
|
+
_this2.close();
|
|
1137
|
+
return false;
|
|
1138
|
+
}
|
|
1139
|
+
button.loading = true;
|
|
1140
|
+
_this2.request({
|
|
1141
|
+
url: Object(formula_["evaluate"])(_this2.api.url, reqData),
|
|
1142
|
+
method: _this2.api.method || "POST",
|
|
1143
|
+
data: reqData
|
|
1144
|
+
}).then(function (res) {
|
|
1145
|
+
button.loading = false;
|
|
1146
|
+
_this2.$emit("success", res, reqData);
|
|
1147
|
+
_this2.reset();
|
|
1148
|
+
_this2.close();
|
|
1149
|
+
}).catch(function (error) {
|
|
1150
|
+
button.loading = false;
|
|
1151
|
+
_this2.$emit("error", error, reqData);
|
|
1152
|
+
});
|
|
1153
|
+
});
|
|
1154
|
+
},
|
|
1155
|
+
renderForm: function renderForm(h) {
|
|
1156
|
+
var param = {
|
|
1157
|
+
attrs: Object.assign({
|
|
1158
|
+
formModel: this.formModel
|
|
1159
|
+
}, this.form)
|
|
1160
|
+
};
|
|
1161
|
+
if (this.formMode === "group") {
|
|
1162
|
+
return h(form_group["default"], babel_helper_vue_jsx_merge_props_default()([{
|
|
1163
|
+
"ref": "form"
|
|
1164
|
+
}, param]));
|
|
1165
|
+
}
|
|
1166
|
+
return h(components_form["default"], babel_helper_vue_jsx_merge_props_default()([{
|
|
1167
|
+
"ref": "form"
|
|
1168
|
+
}, param]));
|
|
1169
|
+
},
|
|
1170
|
+
renderTitle: function renderTitle(h) {
|
|
1171
|
+
if (typeof this.slots.title === "function") {
|
|
1172
|
+
return this.slots.title.call(this, this.formModel);
|
|
1173
|
+
}
|
|
1174
|
+
return this.slots.title || this.drawer.title;
|
|
1175
|
+
},
|
|
1176
|
+
renderTools: function renderTools(h) {
|
|
1177
|
+
if (typeof this.slots.footer === "function") {
|
|
1178
|
+
return this.slots.footer.call(this, this.formModel);
|
|
1179
|
+
}
|
|
1180
|
+
return h("div", [(this.tools || this.defaultTools).map(function (item) {
|
|
1181
|
+
var toolParam = {
|
|
1182
|
+
attrs: Object.assign({}, item),
|
|
1183
|
+
on: item.on
|
|
1184
|
+
};
|
|
1185
|
+
return h("Tool", babel_helper_vue_jsx_merge_props_default()([{}, toolParam]));
|
|
1186
|
+
})]);
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
render: function render(h) {
|
|
1190
|
+
var _this3 = this;
|
|
1191
|
+
var param = {
|
|
1192
|
+
attrs: Object.assign({
|
|
1193
|
+
visible: this.show,
|
|
1194
|
+
closeOnClickModal: false,
|
|
1195
|
+
"customClass": "form-drawer"
|
|
1196
|
+
}, this.drawer),
|
|
1197
|
+
on: Object.assign(this.on, {
|
|
1198
|
+
close: function close() {
|
|
1199
|
+
_this3.close();
|
|
1200
|
+
}
|
|
1201
|
+
})
|
|
1202
|
+
};
|
|
1203
|
+
return h(drawer_default.a, babel_helper_vue_jsx_merge_props_default()([{}, param]), [h("template", {
|
|
1204
|
+
"slot": "title",
|
|
1205
|
+
"class": "drawer-title"
|
|
1206
|
+
}, [h("span", [this.renderTitle(h)])]), h("template", {
|
|
1207
|
+
"slot": "footer",
|
|
1208
|
+
"class": "drawer-footer"
|
|
1209
|
+
}, [this.renderTools(h)]), this.renderForm(h)]);
|
|
1210
|
+
}
|
|
1211
|
+
});
|
|
1212
|
+
// CONCATENATED MODULE: ./src/components/form-drawer/src/index.vue?vue&type=script&lang=js&
|
|
1213
|
+
/* harmony default export */ var form_drawer_srcvue_type_script_lang_js_ = (srcvue_type_script_lang_js_);
|
|
1214
|
+
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
1215
|
+
var componentNormalizer = __webpack_require__(1);
|
|
1216
|
+
|
|
1217
|
+
// CONCATENATED MODULE: ./src/components/form-drawer/src/index.vue
|
|
1218
|
+
var src_render, staticRenderFns
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
|
|
1223
|
+
/* normalize component */
|
|
1224
|
+
|
|
1225
|
+
var component = Object(componentNormalizer["a" /* default */])(
|
|
1226
|
+
form_drawer_srcvue_type_script_lang_js_,
|
|
1227
|
+
src_render,
|
|
1228
|
+
staticRenderFns,
|
|
1229
|
+
false,
|
|
1230
|
+
null,
|
|
1231
|
+
null,
|
|
1232
|
+
null
|
|
1233
|
+
|
|
1234
|
+
)
|
|
1235
|
+
|
|
1236
|
+
/* harmony default export */ var src = (component.exports);
|
|
1237
|
+
// CONCATENATED MODULE: ./src/components/form-drawer/index.js
|
|
1238
|
+
|
|
1239
|
+
src.install = function (Vue) {
|
|
1240
|
+
Vue.component(src.name, src);
|
|
1241
|
+
};
|
|
1242
|
+
/* harmony default export */ var form_drawer = __webpack_exports__["default"] = (src);
|
|
1243
|
+
|
|
1244
|
+
/***/ }),
|
|
1245
|
+
|
|
1246
|
+
/***/ 8:
|
|
1247
|
+
/***/ (function(module, exports) {
|
|
1248
|
+
|
|
1249
|
+
module.exports = require("element-ui/lib/collapse");
|
|
1250
|
+
|
|
1251
|
+
/***/ }),
|
|
1252
|
+
|
|
1253
|
+
/***/ 9:
|
|
1254
|
+
/***/ (function(module, exports) {
|
|
1255
|
+
|
|
1256
|
+
module.exports = require("element-ui/lib/collapse-item");
|
|
1257
|
+
|
|
1258
|
+
/***/ })
|
|
1259
|
+
|
|
1260
|
+
/******/ });
|