lh-chs-ui
Version:
A Component Library for Vue.js.
966 lines (881 loc) • 28.8 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 8);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent(
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */,
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options =
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection(h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 1:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/pagination/src/index.vue?vue&type=template&id=56269a50
var render = function render() {
var _vm = this,
_c = _vm._self._c
return _c("el-pagination", {
attrs: {
small: "",
background: "",
"current-page": _vm.index,
"page-size": _vm.size,
total: _vm.total,
"page-sizes": _vm.pageSize,
"pager-count": 5,
layout: "total, sizes, prev, pager, next, jumper",
},
on: {
"size-change": _vm.handleSizeChange,
"current-change": _vm.handleCurrentChange,
},
})
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/pagination/src/index.vue?vue&type=template&id=56269a50
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/pagination/src/index.vue?vue&type=script&lang=js
/* harmony default export */ var srcvue_type_script_lang_js = ({
name: 'chs-pagination',
props: {
index: {
default: 0
},
size: {
default: 0
},
total: {
default: 0
},
pageSize: {
default: function _default() {
return [5, 10, 20, 30, 40, 50];
}
}
},
methods: {
handleSizeChange: function handleSizeChange(val) {
var index = this.index;
if (Math.ceil(this.total / val) < this.index) {
index = Math.ceil(this.total / val);
}
this.$emit('size-change', {
size: val,
total: this.total
});
this.$emit('change', {
index: index,
size: val,
total: this.total
});
},
handleCurrentChange: function handleCurrentChange(val) {
if (Math.ceil(this.total / this.size) < val) {
return;
}
this.$emit('current-change', {
index: val,
size: this.size,
total: this.total
});
this.$emit('change', {
index: val,
size: this.size,
total: this.total
});
}
}
});
// CONCATENATED MODULE: ./packages/pagination/src/index.vue?vue&type=script&lang=js
/* harmony default export */ var pagination_srcvue_type_script_lang_js = (srcvue_type_script_lang_js);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/pagination/src/index.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
pagination_srcvue_type_script_lang_js,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var src = __webpack_exports__["a"] = (component.exports);
/***/ }),
/***/ 8:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-dialog/src/index.vue?vue&type=template&id=6ef6f452
var render = function render() {
var _vm = this,
_c = _vm._self._c
return _c(
"div",
{ staticClass: "chs-select-dialog-global" },
[
_c(
"el-dialog",
{
attrs: {
title: _vm.title,
"close-on-click-modal": _vm.closeOnClickModal,
"close-on-press-escape": _vm.closeOnPressEscape,
"show-close": _vm.showClose,
visible: _vm.dialogVisible,
width: _vm.width,
},
on: {
closed: _vm.closed,
"update:visible": function ($event) {
_vm.dialogVisible = $event
},
},
},
[
_c(
"div",
{ staticClass: "select-dialog-erp" },
[
_c(
"el-row",
{ class: _vm.$slots.default ? "header-title" : "" },
[_vm._t("default")],
2
),
_vm.$slots.formItem
? _c(
"el-form",
{
ref: "form",
staticClass: "header-form",
attrs: {
model: _vm.form,
rules: _vm.rules,
size: "small",
"label-width": "90px",
},
},
[
_c(
"el-row",
{ staticClass: "dialog-header-form-item" },
[
_vm._t("formItem"),
_c(
"el-col",
{ attrs: { span: _vm.btnCol } },
[
_c(
"el-form-item",
{
staticStyle: { "text-align": "right" },
attrs: { "label-width": "0" },
},
[
_c(
"el-button",
{
attrs: { type: "primary", size: "small" },
on: {
click: function ($event) {
return _vm.handleFormSubmit(true)
},
},
},
[_vm._v("查 询")]
),
_c(
"el-button",
{
attrs: { size: "small" },
on: { click: _vm.handleFormReset },
},
[_vm._v("重 置")]
),
],
1
),
],
1
),
],
2
),
],
1
)
: _vm._e(),
_c(
"el-table",
{
ref: "table",
class:
_vm.selectionRow && _vm.selectionRow.isSingle
? "is-single"
: "",
staticStyle: { width: "100%" },
attrs: {
border: "",
stripe: "",
fit: "",
"highlight-current-row": true,
size: "mini",
height: _vm.tableHeight,
loading: _vm.listLoading,
data: _vm.tableResult.records,
},
on: {
select: _vm.selectionRowChange,
"selection-change": _vm.selectionChange,
},
},
[
_vm.selectionRow
? _c("el-table-column", {
attrs: {
type: "selection",
align: "center",
width: _vm.selectionRow.width,
},
})
: _vm._e(),
_vm._l(_vm.columns, function (item, index) {
return _c("el-table-column", {
key: index,
attrs: {
prop: item.key,
align: "center",
label: item.title,
width: item.width || "",
"min-width": item.minWidth || "",
},
})
}),
],
2
),
],
1
),
_c(
"template",
{ slot: "footer" },
[
_vm.isPaging
? _c("TablePagination", {
staticStyle: { "margin-bottom": "20px" },
attrs: {
index: _vm.tableResult.current,
size: _vm.tableResult.size,
total: _vm.tableResult.total,
"page-size": [10, 20, 50],
},
on: { change: _vm.handlePaginationChange },
})
: _vm._e(),
_vm.showConfirmButton
? _c(
"el-button",
{
attrs: {
type: "primary",
loading: _vm.btnLoading,
size: "small",
},
on: { click: _vm.confirmData },
},
[_vm._v(_vm._s(_vm.confirmButtonText))]
)
: _vm._e(),
_vm.showCancelButton
? _c(
"el-button",
{
attrs: { size: "small", loading: _vm.btnLoading },
on: {
click: function ($event) {
_vm.dialogVisible = false
},
},
},
[_vm._v(_vm._s(_vm.cancelButtonText))]
)
: _vm._e(),
],
1
),
],
2
),
],
1
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/select-dialog/src/index.vue?vue&type=template&id=6ef6f452
// EXTERNAL MODULE: ./packages/pagination/src/index.vue + 4 modules
var src = __webpack_require__(1);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-dialog/src/index.vue?vue&type=script&lang=js
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
/* harmony default export */ var srcvue_type_script_lang_js = ({
name: 'chs-select-dialog',
data: function data() {
return {
tableResult: {
current: 0,
size: 10,
total: 0,
records: []
},
listLoading: false,
btnLoading: false,
defaultSelectionRow: {
title: '',
isSingle: false,
width: 50
},
selectionList: [],
selectionData: {},
baseParams: {
pageIndex: 1,
pageSize: 10
}
};
},
components: {
TablePagination: src["a" /* default */]
},
watch: {
dialogVisible: function dialogVisible(val) {
var _this = this;
if (val && this.defaultQuery) {
this.$nextTick(function () {
_this.handleFormSubmit(true);
});
}
}
},
computed: {
dialogVisible: {
get: function get() {
return this.dialog;
},
set: function set(val) {
this.$emit('update:dialog', val);
}
},
btnCol: function btnCol() {
if (!this.$slots.formItem) {
return 24;
}
var col = this.$slots.formItem.length;
return 24 - col % 3 * 8;
},
// 列表高度
tableHeight: function tableHeight() {
if (this.listHeight) {
return this.listHeight;
}
return this.$slots.formItem ? '250' : '300';
},
selectionRow: function selectionRow() {
if (!this.selection) {
return null;
}
if (_typeof(this.selection) === 'object') {
return Object.assign({}, this.defaultSelectionRow, this.selection);
}
return this.defaultSelectionRow;
}
},
methods: {
handleFormReset: function handleFormReset() {
this.$refs.form && this.$refs.form.resetFields();
this.$emit('formReset');
},
// 关闭dialog初始化数据
closed: function closed() {
this.$refs.form && this.$refs.form.resetFields();
this.tableResult = {
current: 0,
size: 10,
total: 0,
records: []
};
this.baseParams = {
pageIndex: 1,
pageSize: 10
};
this.selectionData = {};
this.selectionList = [];
this.btnLoading = false;
this.$emit('closed');
},
// 单选时触发
selectionRowChange: function selectionRowChange(selection, row) {
if (!this.selectionRow.isSingle) return;
var table = this.$refs.table;
// 清空
table.clearSelection();
if (!selection.length) {
this.selectionData = {};
return;
}
this.selectionData = row;
table.toggleRowSelection(this.selectionData);
},
// 多选时触发
selectionChange: function selectionChange(list, row) {
if (this.selectionRow.isSingle) return;
this.selectionList = list;
},
// 确认按钮点击
confirmData: function confirmData() {
var _this2 = this;
if (!this.selectionRow) {
this.dialogVisible = false;
return;
}
var data = this.selectionRow.isSingle ? this.selectionData : this.selectionList;
var isSelect = this.selectionRow.isSingle ? JSON.stringify(this.selectionData) !== '{}' : !!this.selectionList.length;
if (!isSelect) {
this.$message.error('请选择数据!');
return;
}
this.btnLoading = true;
var done = function done() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
_this2.btnLoading = false;
type && (_this2.dialogVisible = false);
};
this.$emit('result', data, done);
},
handlePaginationChange: function handlePaginationChange(val) {
var _this3 = this;
this.baseParams.pageIndex = val.index;
this.baseParams.pageSize = val.size;
this.$nextTick(function () {
_this3.handleFormSubmit(false);
});
},
// 校验form规则
checkForm: function checkForm() {
var _this4 = this;
return new Promise(function (resolve, reject) {
// 是否传入规则
if (JSON.stringify(_this4.rules) === '{}') {
resolve();
return;
}
if (!_this4.$refs.form) {
resolve();
return;
}
_this4.$refs.form.validate(function (valid) {
if (valid) {
resolve();
} else {
reject(new Error('请输入必填项'));
}
});
});
},
handleFormSubmit: function handleFormSubmit(isRefresh) {
var _this5 = this;
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var params, res;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (_this5.methodsApi) {
_context.next = 2;
break;
}
throw new Error('请传入正确的参数methodsApi');
case 2:
if (!(typeof _this5.methodsApi !== 'function')) {
_context.next = 4;
break;
}
throw new Error('请传入正确的参数methodsApi');
case 4:
_this5.listLoading = true;
_context.prev = 5;
_this5.baseParams.pageIndex = isRefresh ? 1 : _this5.baseParams.pageIndex;
params = _extends({}, _this5.otherParams);
if (_this5.isPaging) {
params = Object.assign({}, params, _this5.baseParams);
}
_context.next = 11;
return _this5.checkForm();
case 11:
if (_this5.$slots.formItem) {
params = Object.assign({}, params, _this5.form);
}
_context.next = 14;
return _this5.methodsApi(params);
case 14:
res = _context.sent;
_this5.selectionData = {};
if (!(res.data && res.data.length)) {
_context.next = 19;
break;
}
_this5.tableResult.records = res.data;
return _context.abrupt('return');
case 19:
if (!(res.data && res.data.records && res.data.records.length)) {
_context.next = 22;
break;
}
_this5.tableResult = res.data;
return _context.abrupt('return');
case 22:
_this5.tableResult = {
current: 0,
size: 10,
total: 0,
records: []
};
_this5.listLoading = false;
_context.next = 29;
break;
case 26:
_context.prev = 26;
_context.t0 = _context['catch'](5);
_this5.listLoading = false;
case 29:
case 'end':
return _context.stop();
}
}
}, _callee, _this5, [[5, 26]]);
}))();
}
},
mounted: function mounted() {},
props: {
dialog: {
type: Boolean,
default: false
},
// 弹框title
title: {
type: String,
default: '详情'
},
listHeight: {
type: String,
default: ''
},
// 是否显示form项
isHeader: {
type: Boolean,
default: false
},
// header绑定数据
form: {
type: Object,
require: true,
default: function _default() {}
},
// header查询校验规则
rules: {
type: Object,
default: function _default() {}
},
// 弹框宽度,默认50%
width: {
type: [String, Number],
default: '50%'
},
// 弹框列表项
columns: {
type: Array,
require: true,
default: function _default() {
return [];
}
},
// 弹框接口API方法
methodsApi: {
type: [Object, Function],
require: true,
default: function _default() {
return null;
}
},
selection: {
type: [Boolean, Object],
default: false
},
/**
* 是否分页
* 默认关闭
*/
isPaging: {
type: Boolean,
default: true
},
// 额外传递的接口参数
otherParams: {
type: Object,
default: function _default() {}
},
/**
* 是否显示确定按钮
* 默认显示
*/
showConfirmButton: {
type: Boolean,
default: true
},
/**
* 是否显示取消按钮
* 默认显示
*/
showCancelButton: {
type: Boolean,
default: true
},
/**
* 取消按钮的文本内容
* 默认取 消
*/
cancelButtonText: {
type: String,
default: '取 消'
},
/**
* 确定按钮的文本内容
* 默认确 定
*/
confirmButtonText: {
type: String,
default: '确 定'
},
// 是否可以通过点击 modal 关闭 Dialog
closeOnClickModal: {
type: Boolean,
default: true
},
// 是否可以通过按下 ESC 关闭 Dialog
closeOnPressEscape: {
type: Boolean,
default: true
},
// 是否显示关闭按钮
showClose: {
type: Boolean,
default: true
},
// 是否默认开启打开就查询
defaultQuery: {
type: Boolean,
default: true
}
}
});
// CONCATENATED MODULE: ./packages/select-dialog/src/index.vue?vue&type=script&lang=js
/* harmony default export */ var select_dialog_srcvue_type_script_lang_js = (srcvue_type_script_lang_js);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/select-dialog/src/index.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
select_dialog_srcvue_type_script_lang_js,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var select_dialog_src = (component.exports);
// CONCATENATED MODULE: ./packages/select-dialog/index.js
/* istanbul ignore next */
select_dialog_src.install = function (Vue) {
Vue.component(select_dialog_src.name, select_dialog_src);
};
/* harmony default export */ var select_dialog = __webpack_exports__["default"] = (select_dialog_src);
/***/ })
/******/ });