@varonervar/components
Version:
> 基于[Element-UI](https://element.eleme.cn/#/zh-CN/component/quickstart) 封装常用组件,部分组件参考[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)
999 lines (928 loc) • 25.8 kB
JavaScript
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[16],{
/***/ 14:
/***/ (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??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/z-table/body/ZTable.vue?vue&type=template&id=b0f170b6&
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "wl-ztable" },
[
_c(
"el-table",
_vm._g(
_vm._b(
{
ref: "table",
staticStyle: { width: "100%" },
attrs: {
data: _vm.tableData,
"header-row-class-name": "table-header",
},
scopedSlots: _vm._u(
[
{
key: "append",
fn: function () {
return [_vm._t("append")]
},
proxy: true,
},
],
null,
true
),
},
"el-table",
_vm.$attrs,
false
),
_vm.$listeners
),
[
_vm.isShowCheck
? _c("el-table-column", {
attrs: {
"is-show-check": _vm.isShowCheck,
type: "selection",
width: "55",
},
})
: _vm._e(),
_vm.isShowIndex
? _c("el-table-column", {
attrs: { type: "index", width: "55", label: _vm.indexLabel },
})
: _vm._e(),
_vm._l(_vm.showTableFormat, function (column) {
return [
_c(
"el-table-column",
_vm._b(
{
key: column.value,
attrs: {
label: column.label,
prop: column.value,
"show-overflow-tooltip": true,
},
scopedSlots: _vm._u(
[
column.template === "slot"
? {
key: "default",
fn: function (ref) {
var row = ref.row
var col = ref.column
return [
_vm._t(column.slotName, null, {
row: row,
column: col,
}),
]
},
}
: column.template === "enumer"
? {
key: "default",
fn: function (ref) {
var row = ref.row
var col = ref.column
return [
_c("span", [
_vm._v(
_vm._s(
(typeof column.enumer[
row[col.property]
] === "function"
? column.enumer[row[col.property]](
row
)
: column.enumer[row[col.property]]) ||
col.def ||
"-"
)
),
]),
]
},
}
: column.list &&
[
"select",
"radio",
"radioButton",
"checkbox",
].includes(column.template)
? {
key: "default",
fn: function (ref) {
var row = ref.row
var col = ref.column
return _vm._l(
column.list,
function (valueEnumItem, index) {
return _c(
"div",
{ key: index },
[
row[col.property] == valueEnumItem.value
? [
valueEnumItem.status
? _c(
"el-link",
{
attrs: {
underline: false,
type: valueEnumItem.status,
},
},
[
_vm._v(
_vm._s(
valueEnumItem.label
)
),
]
)
: _c("span", [
_vm._v(
_vm._s(
valueEnumItem.label ||
col.def ||
"-"
)
),
]),
]
: _vm._e(),
],
2
)
}
)
},
}
: column.template === "time"
? {
key: "default",
fn: function (ref) {
var row = ref.row
return [
_c("span", [
_vm._v(
_vm._s(
_vm._f("dateFormat")(
(column.value || "")
.split(/,|,/g)
.map(function (v) {
return row[v]
}),
{
def: column.def,
format: column.format,
flag: column.connectFlag,
}
)
)
),
]),
]
},
}
: {
key: "default",
fn: function (ref) {
var row = ref.row
var col = ref.column
return [
column.iconfont
? _c("i", {
class: column.iconfont,
attrs: { classs: "table-item-icon" },
})
: _vm._e(),
_c("span", { staticClass: "span" }, [
_vm._v(
_vm._s(
row[col.property] == null ||
row[col.property] === ""
? col.def || "-"
: row[col.property]
)
),
]),
]
},
},
],
null,
true
),
},
"el-table-column",
Object.assign({}, column.bind, column.config),
false
)
),
]
}),
_vm.isShowOpions
? _c("el-table-column", {
staticClass: "options-col",
attrs: {
label: _vm.optionsLabel,
"header-align": "left",
fixed: _vm.optionsFixed,
width: _vm.optionsWidth,
},
scopedSlots: _vm._u(
[
{
key: "default",
fn: function (scope) {
return [
_vm._t("options", null, {
row: scope.row,
column: scope.column,
$index: scope.$index,
}),
]
},
},
],
null,
true
),
})
: _vm._e(),
],
2
),
_vm.isShowPagination
? _c(
"div",
{ staticClass: "pagination flex-align-center" },
[
_c(
"el-dropdown",
{ on: { command: _vm.sizeChange } },
[
_c("span", { staticClass: "page-info" }, [
_vm._v(
"\n 每页显示 " +
_vm._s(_vm.paginationObj.pageSize) +
" 项"
),
_c("i", {
staticClass: "el-icon-arrow-down el-icon--right",
}),
]),
_c(
"el-dropdown-menu",
{ attrs: { slot: "dropdown" }, slot: "dropdown" },
_vm._l(_vm.pageSizes, function (item) {
return _c(
"el-dropdown-item",
{ key: item, attrs: { command: item } },
[_vm._v("每页显示 " + _vm._s(item) + " 项")]
)
}),
1
),
],
1
),
_c("span", { staticClass: "page-info total" }, [
_vm._v("总计" + _vm._s(_vm.paginationObj.total) + "项"),
]),
_c("el-pagination", {
attrs: {
layout: "prev, pager, next",
"page-size": _vm.paginationObj.pageSize,
"current-page": _vm.paginationObj.pageNum,
"page-sizes": _vm.pageSizes,
total: _vm.paginationObj.total,
},
on: {
"size-change": _vm.sizeChange,
"current-change": _vm.currentChange,
},
}),
_c(
"div",
{
staticClass:
"el-input el-pagination__editor is-in-pagination",
},
[
_c("input", {
ref: "number",
staticClass: "el-input__inner",
attrs: {
type: "number",
autocomplete: "off",
min: "1",
max: "2",
},
domProps: { value: _vm.jumpPage },
on: {
change: _vm.jumpNumberChange,
keyup: function ($event) {
if (
!$event.type.indexOf("key") &&
_vm._k(
$event.keyCode,
"enter",
13,
$event.key,
"Enter"
)
) {
return null
}
return _vm.jumpGo.apply(null, arguments)
},
},
}),
]
),
_c("p", { staticClass: "jumpbtn", on: { click: _vm.jumpGo } }, [
_vm._v("跳转"),
]),
],
1
)
: _vm._e(),
],
1
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/z-table/body/ZTable.vue?vue&type=template&id=b0f170b6&
// EXTERNAL MODULE: external "dayjs"
var external_dayjs_ = __webpack_require__(10);
var external_dayjs_default = /*#__PURE__*/__webpack_require__.n(external_dayjs_);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./packages/z-table/body/ZTable.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
const _pageSize = 30;
const _pageNum = 1;
const _pageTotal = 0;
/* harmony default export */ var ZTablevue_type_script_lang_js_ = ({
name: 'ZTable',
filters: {
dateFormat(arr, _ref) {
let {
def,
format = 'YYYY-MM-DD HH:mm:ss',
flag = '-'
} = _ref;
try {
if (arr.some(v => !v)) return def || '-';
return arr.map(t => external_dayjs_default()(new Date(t)).format(format)).join(flag);
} catch (error) {
return def || '-';
}
}
},
inheritAttrs: false,
props: {
pageSizes: {
type: Array,
default() {
return [10, 20, 30, 40, 50, 100];
}
},
tableData: {
// table数据
type: Array,
required: true
},
// 请求函数
getTableData: {
type: Function,
required: true
},
/**
* label:必需
* value:必需
* template: 决定column的种类
* width:宽度
*/
tableFormat: {
// table格式
type: Array,
required: true
},
// 是否初始调用函数
isInitGetData: {
type: Boolean,
default: true
},
isShowCheck: {
// 是否显示选择行
type: Boolean,
default: false
},
isShowIndex: {
// 是否显示序号
type: Boolean,
default: false
},
indexLabel: {
type: String,
default: '序号'
},
isShowOpions: {
// 是否显示操作列
type: Boolean,
default: true
},
optionsLabel: {
// 操作的label
type: String,
default: '操作'
},
optionsFixed: {
type: [String, Boolean],
default: false
},
optionsWidth: {
// 操作的宽度
type: [String, Number],
default: '160'
},
isShowPagination: {
// 是否显示分页
type: Boolean,
default: true
},
value: {
type: Object,
default() {
return {
pageNum: _pageNum,
pageSize: _pageSize,
total: _pageTotal
};
}
}
},
data() {
return {
jumpPage: '',
paginationObj: {
total: _pageTotal,
pageSize: _pageSize,
pageNum: _pageNum
}
};
},
methods: {
jumpNumberChange(e) {
const eVal = e.target.value;
const {
total,
pageSize
} = this.paginationObj;
const max = Math.ceil(total / pageSize);
if (eVal > max) {
e.target.value = max;
} else if (eVal <= 0) {
this.jumpPage = 1;
e.target.value = 1;
} else {
this.jumpPage = +eVal;
}
},
jumpGo() {
if (!this.jumpPage) return;
this.paginationObj.pageNum = this.jumpPage;
this.$emit('input', { ...this.paginationObj
});
typeof this.getTableData === 'function' && this.getTableData(this._setTotal.bind(this));
},
sizeChange(size) {
this.paginationObj.pageNum = 1;
this.paginationObj.pageSize = size;
this.$emit('input', { ...this.paginationObj
});
typeof this.getTableData === 'function' && this.getTableData(this._setTotal.bind(this));
},
currentChange(page) {
this.paginationObj.pageNum = page;
this.$emit('input', { ...this.paginationObj
});
typeof this.getTableData === 'function' && this.getTableData(this._setTotal.bind(this));
},
toSearch() {
this.paginationObj.pageNum = 1;
this.$emit('input', { ...this.paginationObj
});
typeof this.getTableData === 'function' && this.getTableData(this._setTotal.bind(this));
},
// 设置总数
_setTotal(total) {
if (typeof total !== 'number' || !(+total >= 0)) {
console.error('总条数必须是正整数!');
return;
}
this.paginationObj.total = total;
this.$emit('input', { ...this.paginationObj
});
},
table() {
return this.$refs.table;
},
clearSelection() {
return this.$refs.table.clearSelection();
},
toggleRowSelection(row) {
return this.$refs.table.toggleRowSelection(row);
}
},
mounted() {
if (this.isInitGetData) {
this.$nextTick(() => {
typeof this.getTableData === 'function' && this.getTableData(this._setTotal.bind(this));
});
}
},
computed: {
showTableFormat(_ref2) {
let {
tableFormat
} = _ref2;
return tableFormat.filter(v => !v.hidden);
}
},
watch: {
value: {
handler(v) {
this.paginationObj.pageNum = v.pageNum || _pageNum;
this.paginationObj.pageSize = v.pageSize || _pageSize;
this.paginationObj.total = v.total || _pageTotal;
},
immediate: true,
deep: true
}
}
});
// CONCATENATED MODULE: ./packages/z-table/body/ZTable.vue?vue&type=script&lang=js&
/* harmony default export */ var body_ZTablevue_type_script_lang_js_ = (ZTablevue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/z-table/body/ZTable.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
body_ZTablevue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var ZTable = (component.exports);
// CONCATENATED MODULE: ./packages/z-table/index.js
/* istanbul ignore next */
ZTable.install = function install(Vue) {
Vue.component(ZTable.name, ZTable);
};
/* harmony default export */ var z_table = __webpack_exports__["default"] = (ZTable);
/***/ }),
/***/ 30:
/***/ (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??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/z-object-show/body/ZarrayShow.vue?vue&type=template&id=1709d26c&
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "array-show" },
[
_c("ZTable", {
attrs: {
"table-data": _vm.list,
"options-label": "操作",
"max-height": "670px",
"is-show-pagination": false,
"table-format": _vm.tableFormat,
},
scopedSlots: _vm._u([
{
key: "options",
fn: function (ref) {
var row = ref.row
return [
_c("div", { staticClass: "text-center" }, [
_c(
"span",
{
staticClass: "blue pointer",
on: {
click: function ($event) {
return _vm.checkDetail(row)
},
},
},
[_vm._v("查看详情")]
),
]),
]
},
},
]),
}),
_c(
"el-dialog",
{
attrs: {
visible: _vm.dialogVisible,
"close-on-click-modal": false,
title: _vm.dialogTitle,
"append-to-body": true,
top: "50px",
width: "80vw",
},
on: {
"update:visible": function ($event) {
_vm.dialogVisible = $event
},
},
},
[
_vm.dialogVisible
? _c("ZObjectShow", { attrs: { data: _vm.subData } })
: _vm._e(),
_c(
"footer",
{ staticClass: "dialog-footer text-right" },
[
_c(
"el-button",
{
attrs: { size: "small" },
on: {
click: function ($event) {
_vm.dialogVisible = false
},
},
},
[_vm._v("关 闭")]
),
],
1
),
],
1
),
],
1
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/z-object-show/body/ZarrayShow.vue?vue&type=template&id=1709d26c&
// EXTERNAL MODULE: ./packages/z-table/index.js + 5 modules
var z_table = __webpack_require__(14);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./packages/z-object-show/body/ZarrayShow.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var ZarrayShowvue_type_script_lang_js_ = ({
name: 'ZarrayShow',
inheritAttrs: false,
props: {
list: {
type: Array,
required: true
}
},
data() {
return {
dialogVisible: false,
// 弹窗显隐
subData: {},
// 弹窗数据
tableFormat: [],
dialogTitle: '查看详情'
};
},
methods: {
// 打开弹窗
checkDetail(row) {
this.subData = row;
this.dialogVisible = true;
}
},
created() {
const item = this.list[0];
if (item) {
Object.entries(item).forEach(_ref => {
let [key, value] = _ref;
// 第一个子项中,数据为null算它运气不好,不显示了
if (typeof value !== 'object') {
const obj = {
prop: key,
label: value
};
this.tableFormat.push(obj);
}
});
}
},
components: {
ZTable: z_table["default"],
ZObjectShow: () => Promise.resolve(/* import() */).then(__webpack_require__.bind(null, 13))
}
});
// CONCATENATED MODULE: ./packages/z-object-show/body/ZarrayShow.vue?vue&type=script&lang=js&
/* harmony default export */ var body_ZarrayShowvue_type_script_lang_js_ = (ZarrayShowvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/z-object-show/body/ZarrayShow.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
body_ZarrayShowvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* harmony default export */ var ZarrayShow = __webpack_exports__["default"] = (component.exports);
/***/ })
}]);