sohelp-ele
Version:
SohelpEle Library
182 lines (181 loc) • 6.92 kB
JavaScript
(function() {
"use strict";
try {
if (typeof document != "undefined") {
var elementStyle = document.createElement("style");
elementStyle.appendChild(document.createTextNode(".sohelp-modals[data-v-1fe02b8c] {\n height: auto !important;\n}\n[data-v-1fe02b8c] .el-input-group__append {\n padding: 0;\n}\n.sohelp-table-input .right-icon[data-v-1fe02b8c] {\n display: inline-block;\n padding: 8px 10px;\n cursor: pointer;\n}\n.mul-box[data-v-1fe02b8c] {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.mul-box .tags[data-v-1fe02b8c] {\n box-sizing: border-box;\n padding: 0 10px;\n position: absolute;\n width: calc(100% - 35px);\n height: 100%;\n top: 0;\n left: 0;\n overflow-y: scroll;\n}"));
document.head.appendChild(elementStyle);
}
} catch (e) {
console.error("vite-plugin-css-injected-by-js", e);
}
})();
var render = function() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c("div", { staticClass: "sohelp-table-input" }, [_c("div", [!_vm.multiple ? _c("div", [_c("el-input", _vm._g({ attrs: { "placeholder": _vm.$attrs.placeholder }, model: { value: _vm.value1, callback: function($$v) {
_vm.value1 = $$v;
}, expression: "value1" } }, _vm.$listeners), [_c("template", { slot: "append" }, [_c("i", { staticClass: "right-icon el-icon-search", on: { "click": _vm.openModal } })])], 2)], 1) : _c("div", { staticClass: "mul-box" }, [_c("el-input", { attrs: { "readonly": true } }, [_c("template", { slot: "append" }, [_c("i", { staticClass: "right-icon el-icon-search", on: { "click": _vm.openModal } })])], 2), _c("div", { staticClass: "tags" }, _vm._l(_vm.value, function(item, idx) {
return _c("el-tag", { key: idx }, [_vm._v(_vm._s(item))]);
}), 1)], 1)]), _c("sohelp-modal", { ref: "sohelpModalRef", attrs: { "visible": _vm.visible, "resizable": true, "title": _vm.title, "append-to-body": true }, on: { "update:visible": function($event) {
_vm.visible = $event;
} } }, [_c("sohelp-table", _vm._g(_vm._b({ ref: "sohelpTabelRef", attrs: { "multiple": _vm.multiple, "selection": _vm.selection }, on: { "update:selection": function($event) {
_vm.selection = $event;
} } }, "sohelp-table", _vm.attrs, false), _vm.$listeners), [_c("template", { slot: "toolbar" }, [_c("el-row", [_c("el-col", { attrs: { "span": 12 } }, [_c("el-input", { attrs: { "placeholder": "\u8BF7\u8F93\u5165\u5173\u952E\u5B57\u641C\u7D22" }, nativeOn: { "keydown": function($event) {
if (!$event.type.indexOf("key") && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
return null;
}
return _vm.search.apply(null, arguments);
} }, model: { value: _vm.keyword, callback: function($$v) {
_vm.keyword = $$v;
}, expression: "keyword" } })], 1)], 1)], 1)], 2), _c("template", { slot: "footer" }, [_c("el-button", { on: { "click": _vm.close } }, [_vm._v("\u53D6 \u6D88")]), _c("el-button", { attrs: { "type": "primary" }, on: { "click": _vm.confirm } }, [_vm._v("\u786E\u5B9A")])], 1)], 2)], 1);
};
var staticRenderFns = [];
var index_vue_vue_type_style_index_0_scoped_true_lang = "";
function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
if (render2) {
options.render = render2;
options.staticRenderFns = staticRenderFns2;
options._compiled = true;
}
if (functionalTemplate) {
options.functional = true;
}
if (scopeId) {
options._scopeId = "data-v-" + scopeId;
}
var hook;
if (moduleIdentifier) {
hook = function(context) {
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
context = __VUE_SSR_CONTEXT__;
}
if (injectStyles) {
injectStyles.call(this, context);
}
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
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) {
options._injectStyles = hook;
var originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
} else {
var existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return {
exports: scriptExports,
options
};
}
const __vue2_script = {
name: "SohelpTableInput",
props: {
title: {
type: String | Number,
default: ""
},
valueKey: {
type: String,
default: "value"
},
multiple: {
type: Boolean,
default: false
},
value: [String, Number, Array]
},
data() {
return {
value1: "",
keyword: "",
visible: false,
selection: [],
autoRead: false,
attrs: this.$attrs
};
},
created() {
},
mounted() {
},
methods: {
close() {
this.$emit("beforeClose", this.selection);
this.visible = false;
},
openModal() {
if (this.$listeners.before) {
this.$emit("before", async (callback) => {
const res = await callback;
if (Object.keys(res).length > 0) {
Object.assign(this.attrs, res);
}
this.autoRead = true;
this.visible = true;
});
} else {
this.autoRead = true;
this.visible = true;
}
},
confirm() {
if (this.selection && this.selection.length > 0) {
if (this.multiple) {
let _values = this.selection.map((item) => item[this.valueKey]);
this.$emit("input", _values);
this.$emit("afterConfirm", this.selection);
} else {
this.value1 = this.selection[0][this.valueKey];
this.$emit("input", this.selection[0][this.valueKey]);
this.$emit("afterConfirm", this.selection[0]);
}
}
this.visible = false;
},
search() {
this.$refs.sohelpTabelRef.load({
keyword: this.keyword
});
}
}
};
const __cssModules = {};
var __component__ = /* @__PURE__ */ normalizeComponent(
__vue2_script,
render,
staticRenderFns,
false,
__vue2_injectStyles,
"1fe02b8c",
null,
null
);
function __vue2_injectStyles(context) {
for (let o in __cssModules) {
this[o] = __cssModules[o];
}
}
var index = /* @__PURE__ */ function() {
return __component__.exports;
}();
export { index as default };