@wocwin/t-ui-plus
Version:
Page level components developed based on Element Plus.
308 lines (303 loc) • 15.2 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var vue = require('vue');
var Icons = require('@element-plus/icons-vue');
require('./renderCol.vue.js');
var renderCol_vue_vue_type_script_setup_true_lang = require('./renderCol.vue2.js');
const _hoisted_1 = { key: 1 };
const _hoisted_2 = { class: "more_dropdown-link" };
const _hoisted_3 = { key: 1 };
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{
name: "Operator"
},
__name: "operator",
props: {
tableData: {
type: Array,
default: () => []
},
table: { type: Object, default: () => {
} },
btnPermissions: {
type: Array,
default: () => []
},
align: {
type: String,
default: "center"
}
},
setup(__props) {
const props = __props;
const checkIsShow = (scope, item) => {
var _a;
let isNoshow = false;
if (item.noshow) {
let nushowFun = JSON.parse(JSON.stringify(item.noshow));
nushowFun.map((rs) => {
rs.isShow = typeof rs.val === "string" ? rs.val === "isHasVal" ? scope.row[rs.key] ? "true" : "false" : "true" : rs.val.includes(scope.row[rs.key]) ? "false" : "true";
});
isNoshow = nushowFun.every((key) => {
return key.isShow === "true";
});
} else {
isNoshow = true;
}
let isShow = !item.show || item.show.val.includes(scope.row[item.show.key]);
let isPermission = item.hasPermi ? (_a = props.btnPermissions) == null ? void 0 : _a.includes(item.hasPermi) : true;
let totalTxt = Object.values(scope.row).every((key) => {
return key !== "\u5F53\u9875\u5408\u8BA1";
});
let totalTxt1 = Object.values(scope.row).every((key) => {
return key !== "\u5168\u90E8\u5408\u8BA1";
});
return isShow && isNoshow && !scope.row[item.field] && (item.isField ? scope.row[item.isField] : true) && totalTxt && totalTxt1 && isPermission;
};
const $attrs = vue.useAttrs();
const hasMoreBind = vue.computed(() => {
const btnBind = { type: "primary", link: true, text: true, size: "small" };
const menuBind = {};
const setBind = {
btnTxt: "\u66F4\u591A",
isShowArrwIcon: true,
// 是否显示下拉箭头
...menuBind,
// 下拉menu属性
...btnBind,
// 按钮属性
...props.table.operatorConfig.dropdownBind
// 下拉属性
};
return { ...$attrs, ...setBind };
});
const hasMoreOper = () => {
return props.table.operator.some((item) => item.isMore === true);
};
return (_ctx, _cache) => {
var _a, _b, _c, _d, _e, _f;
const _component_el_button = vue.resolveComponent("el-button");
const _component_el_icon = vue.resolveComponent("el-icon");
const _component_el_dropdown_item = vue.resolveComponent("el-dropdown-item");
const _component_el_dropdown_menu = vue.resolveComponent("el-dropdown-menu");
const _component_el_dropdown = vue.resolveComponent("el-dropdown");
const _component_el_table_column = vue.resolveComponent("el-table-column");
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
[
vue.createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
__props.table.operator ? (vue.openBlock(), vue.createBlock(
_component_el_table_column,
vue.mergeProps({ key: 0 }, {
fixed: (_a = __props.table.operatorConfig) == null ? void 0 : _a.fixed,
label: ((_b = __props.table.operatorConfig) == null ? void 0 : _b.label) || "\u64CD\u4F5C",
"min-width": (_c = __props.table.operatorConfig) == null ? void 0 : _c.minWidth,
width: (_d = __props.table.operatorConfig) == null ? void 0 : _d.width,
align: ((_e = __props.table.operatorConfig) == null ? void 0 : _e.align) || __props.align,
...(_f = __props.table.operatorConfig) == null ? void 0 : _f.bind
}, { "class-name": "operator" }),
{
default: vue.withCtx((scope) => {
var _a2;
return [
vue.createElementVNode(
"div",
{
class: "operator_btn",
style: vue.normalizeStyle((_a2 = __props.table.operatorConfig) == null ? void 0 : _a2.style)
},
[
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(__props.table.operator, (item, index) => {
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
[
!item.isMore ? (vue.openBlock(), vue.createElementBlock(
vue.Fragment,
{ key: 0 },
[
checkIsShow(scope, item) ? (vue.openBlock(), vue.createBlock(_component_el_button, vue.mergeProps({
key: index,
onClick: ($event) => item.fun && item.fun(scope.row, scope.$index, __props.tableData)
}, {
type: "primary",
link: true,
text: true,
size: "small",
...item.bind
}, {
disabled: item.isDisabled && item.isDisabled(scope.row, item)
}), {
default: vue.withCtx(() => [
item.render ? (vue.openBlock(), vue.createBlock(renderCol_vue_vue_type_script_setup_true_lang.default, {
key: 0,
column: item,
row: scope.row,
render: item.render,
index: scope.$index
}, null, 8, ["column", "row", "render", "index"])) : vue.createCommentVNode("v-if", true),
!item.render ? (vue.openBlock(), vue.createElementBlock(
"span",
_hoisted_1,
vue.toDisplayString(item.text),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
]),
_: 2
/* DYNAMIC */
}, 1040, ["onClick", "disabled"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
)) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
);
}),
256
/* UNKEYED_FRAGMENT */
)),
hasMoreOper() ? (vue.openBlock(), vue.createBlock(
_component_el_dropdown,
vue.mergeProps({ key: 0 }, hasMoreBind.value, { class: "oper_more_dropdown" }),
{
dropdown: vue.withCtx(() => [
vue.createVNode(
_component_el_dropdown_menu,
vue.mergeProps(hasMoreBind.value.menuBind, { class: "oper_more_dropdown_menu" }),
{
default: vue.withCtx(() => [
(vue.openBlock(true), vue.createElementBlock(
vue.Fragment,
null,
vue.renderList(__props.table.operator, (item, index) => {
return vue.openBlock(), vue.createElementBlock(
vue.Fragment,
null,
[
item.isMore ? (vue.openBlock(), vue.createBlock(_component_el_dropdown_item, vue.mergeProps({
onClick: ($event) => item.fun && item.fun(scope.row, scope.$index, __props.tableData),
key: "more_" + index
}, {
disabled: item.isDisabled && item.isDisabled(scope.row, item),
...item.itemBind
}), {
default: vue.withCtx(() => [
checkIsShow(scope, item) ? (vue.openBlock(), vue.createBlock(
_component_el_button,
vue.mergeProps({ key: index }, {
link: true,
text: true,
size: "small",
disabled: item.isDisabled && item.isDisabled(scope.row, item),
...item.bind
}),
{
default: vue.withCtx(() => [
item.render ? (vue.openBlock(), vue.createBlock(renderCol_vue_vue_type_script_setup_true_lang.default, {
key: 0,
column: item,
row: scope.row,
render: item.render,
index: scope.$index
}, null, 8, ["column", "row", "render", "index"])) : vue.createCommentVNode("v-if", true),
!item.render ? (vue.openBlock(), vue.createElementBlock(
"span",
_hoisted_3,
vue.toDisplayString(item.text),
1
/* TEXT */
)) : vue.createCommentVNode("v-if", true)
]),
_: 2
/* DYNAMIC */
},
1040
/* FULL_PROPS, DYNAMIC_SLOTS */
)) : vue.createCommentVNode("v-if", true)
]),
_: 2
/* DYNAMIC */
}, 1040, ["onClick"])) : vue.createCommentVNode("v-if", true)
],
64
/* STABLE_FRAGMENT */
);
}),
256
/* UNKEYED_FRAGMENT */
))
]),
_: 2
/* DYNAMIC */
},
1040
/* FULL_PROPS, DYNAMIC_SLOTS */
)
]),
default: vue.withCtx(() => [
vue.createElementVNode("span", _hoisted_2, [
vue.createVNode(
_component_el_button,
vue.normalizeProps(vue.guardReactiveProps({
type: "primary",
link: true,
text: true,
size: "small",
...hasMoreBind.value.btnBind
})),
{
default: vue.withCtx(() => [
vue.createTextVNode(
vue.toDisplayString(hasMoreBind.value.btnTxt || "\u66F4\u591A") + " ",
1
/* TEXT */
),
hasMoreBind.value.isShowArrwIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
default: vue.withCtx(() => [
vue.createVNode(vue.unref(Icons.ArrowDown))
]),
_: 1
/* STABLE */
})) : vue.createCommentVNode("v-if", true)
]),
_: 1
/* STABLE */
},
16
/* FULL_PROPS */
)
])
]),
_: 2
/* DYNAMIC */
},
1040
/* FULL_PROPS, DYNAMIC_SLOTS */
)) : vue.createCommentVNode("v-if", true)
],
4
/* STYLE */
)
];
}),
_: 1
/* STABLE */
},
16
/* FULL_PROPS */
)) : vue.createCommentVNode("v-if", true)
],
2112
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
);
};
}
});
exports.default = _sfc_main;