{"remainingRequest":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\artfess-module\\src\\components\\HtTable.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\artfess-module\\src\\components\\HtTable.vue","mtime":1675232038590},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\artfess-module\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/es6.object.keys\";\nimport _toConsumableArray from \"D:/jenkins/workspace/artfess-module/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport _typeof from \"D:/jenkins/workspace/artfess-module/node_modules/@babel/runtime/helpers/esm/typeof\";\nimport \"core-js/modules/es6.regexp.search\";\nimport \"core-js/modules/web.dom.iterable\";\nimport _defineProperty from \"D:/jenkins/workspace/artfess-module/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport \"core-js/modules/es6.number.constructor\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport utils from \"@/utils.js\";\nimport _ from \"lodash\";\nexport default {\n name: \"ht-table\",\n props: {\n showAdvancedSearchText: {\n type: String,\n default: \"基础搜索\"\n },\n hideAdvancedSearchText: {\n type: String,\n default: \"高级搜索\"\n },\n searchBtnStyle: {\n type: String\n },\n justShowSearch: {\n //为true时只显示高级搜索中的查询条件\n type: Boolean,\n default: false\n },\n paginationJustify: {\n type: String,\n default: \"end\",\n validator: function validator(value) {\n return [\"start\", \"end\", \"center\", \"space-around\", \"space-between\"].indexOf(value) !== -1;\n }\n },\n data: Array,\n showHeader: {\n type: Boolean,\n default: true\n },\n pageResult: {\n type: Object,\n default: function _default() {\n return {\n page: 1,\n pageSize: 50,\n total: 0\n };\n }\n },\n pageSizes: {\n type: Array,\n default: function _default() {\n return [10, 20, 50, 100, 200, 300, 500];\n }\n },\n pagerCount: {\n type: Number,\n default: 11\n },\n nopagination: {\n type: Boolean,\n default: false\n },\n highlightCurrentRow: {\n type: Boolean,\n default: false\n },\n selectable: {\n type: Boolean,\n default: true\n },\n quickSearchProps: [String, Array],\n headerRowClassName: [String, Function],\n debounce: {\n type: Number,\n default: 1500\n },\n showExport: {\n type: Boolean,\n default: true\n },\n showCustomColumn: {\n type: Boolean,\n default: true\n },\n defaultQuerys: {\n type: Array,\n default: function _default() {\n return [];\n }\n },\n defaultSorter: {\n type: Array,\n default: function _default() {\n return [];\n }\n },\n filterSelectable: {\n type: Function\n }\n },\n data: function data() {\n return {\n querys: [],\n sorter: null,\n quickSearchWord: null,\n quickSearchPlaceholder: \"请输入搜索内容\",\n quickSearchConfig: null,\n hasSearchPanel: false,\n filters: {},\n pagination: _objectSpread({}, this.pageResult),\n tableMaxHeight: 400,\n showAdvancedSearch: false,\n loading: false,\n columns: [],\n customColumns: [],\n customColumnsHashCode: null,\n currentCustomColumns: null,\n customColumnDialogVisible: false,\n selection: []\n };\n },\n created: function created() {\n var _this = this;\n\n // 从插槽中获取到当前表格的所有列\n this.$slots.default.forEach(function (n) {\n if (n && n.componentOptions) {\n var pd = n.componentOptions.propsData; // 将当前表格的列放入一个数组\n\n _this.columns.push(pd); // 将当前有有prop和label的列放入自定义列表项的数组中\n\n\n if (pd.prop && pd.label) {\n _this.customColumns.push({\n key: pd.prop,\n value: pd.label,\n checked: !(pd.hidden === true || pd.hidden === \"\")\n });\n }\n }\n }); // 获取当前自定义列表项的hashCode\n\n this.customColumnsHashCode = utils.hashCode(JSON.stringify(this.customColumns));\n this.quickSearchProps && this.generateQuickSearchConfig();\n this.$on(\"advance-search\", function (data) {\n return _this.advanceSearch(data);\n });\n },\n computed: {\n calDefaultQuerys: function calDefaultQuerys() {\n var calQuerys = [];\n var query = {\n group: \"defaultQueryGroup\",\n operation: \"EQUAL\",\n relation: \"AND\"\n };\n this.defaultQuerys.forEach(function (c) {\n calQuerys.push(_objectSpread(_objectSpread({}, query), c));\n });\n return calQuerys;\n }\n },\n watch: {\n justShowSearch: {\n handler: function handler(val) {\n if (val) {\n this.showAdvancedSearch = true;\n }\n },\n immediate: true\n }\n },\n mounted: function mounted() {\n var _this2 = this;\n\n this.debounceQuickSearch = _.debounce(function () {\n _this2.quickSearch();\n }, this.debounce); // 判断是否有高级搜索面板\n\n this.hasSearchPanel = !!this.$scopedSlots.search;\n this.load();\n this.calcTableHeight();\n this.$watch(\"showAdvancedSearch\", function (n, o) {\n if (n !== o) {\n if (n) {\n _this2.quickSearchWord = null;\n } // 显示或收起搜索面板时,重新计算表格高度\n\n\n _this2.calcTableHeight(500);\n }\n });\n this.$watch(\"pageResult\", function (n, o) {\n if (n !== o) {\n _this2.pagination = _objectSpread({}, n);\n }\n });\n /**\r\n * 统一使用回车查询\r\n this.$watch(\"quickSearchWord\", (n, o) => {\r\n if (n !== o) {\r\n this.debounceQuickSearch();\r\n }\r\n });\r\n */\n\n this.$root.$on(\"resize\", function () {\n _this2.calcTableHeight(500);\n });\n this.initialCustomColumn();\n },\n methods: {\n quickSearch: function quickSearch() {\n var _this3 = this;\n\n // 先删除快速查询的查询条件\n this.clearQueryByGroupName(\"quick\");\n this.clearQueryByGroupName(\"advance\");\n this.quickSearchWord && this.quickSearchConfig.forEach(function (c) {\n var query = {\n property: c.prop,\n value: c.numType ? parseInt(_this3.quickSearchWord.trim()) : _this3.quickSearchWord.trim(),\n group: \"quick\",\n relation: \"OR\",\n operation: c.operation ? c.operation : \"LIKE\"\n };\n\n _this3.querys.push(query);\n });\n this.load();\n },\n advanceSearch: function advanceSearch(data) {\n var _this4 = this;\n\n if (this.loading || !this.showAdvancedSearch) {\n return;\n }\n\n this.clearQueryByGroupName(\"quick\");\n this.clearQueryByGroupName(\"advance\");\n data && data.forEach(function (d) {\n var query = {\n property: d.prop,\n value: d.value,\n group: \"advance\",\n relation: d.relation,\n operation: d.operation\n };\n query.value && _this4.querys.push(query);\n });\n this.load();\n },\n // 加载数据\n load: function load(doNotResetPage) {\n this.loading = true; // 默认重置页码为第一页\n\n if (!doNotResetPage) {\n this.pagination.page = 1;\n }\n\n var param = {\n pageBean: this.pagination\n };\n\n if (this.sorter && this.sorter.length > 0) {\n param.sorter = this.sorter;\n } // 处理排序字段\n\n\n if (this.defaultSorter.length > 0) {\n if (!param.sorter) {\n param.sorter = [];\n }\n\n this.defaultSorter.forEach(function (item) {\n param.sorter.remove(item);\n });\n param.sorter = param.sorter.concat(this.defaultSorter);\n } // 处理过滤条件\n\n\n this.handleFilters();\n\n if (this.querys && this.querys.length > 0) {\n param.querys = this.querys;\n } // 处理查询条件\n\n\n if (this.calDefaultQuerys.length > 0) {\n if (!param.querys) {\n param.querys = [];\n }\n\n this.calDefaultQuerys.forEach(function (item) {\n param.querys.remove(item);\n });\n param.querys = param.querys.concat(this.calDefaultQuerys);\n }\n\n var me = this; // 防止外部没有回调,设置10秒后自动取消加载中的状态\n\n var finalTickCB = setTimeout(function () {\n me.loading = false;\n }, 10000);\n\n if (this.nopagination) {\n param.pageBean = {};\n }\n\n this.$emit(\"load\", _objectSpread({}, param), function () {\n // 外部已经回调的情况下,取消倒计时\n clearTimeout(finalTickCB);\n me.loading = false;\n setTimeout(function () {\n me.$refs.quickSearch && me.$refs.quickSearch.$children[0].$el.children[0].focus();\n });\n });\n },\n // 通过列属性获取列标签\n getColumnLabelByProp: function getColumnLabelByProp(prop) {\n var label = null;\n\n if (!prop) {\n return label;\n }\n\n this.columns.forEach(function (c) {\n if (c.prop && c.prop === prop) {\n label = c.label;\n }\n });\n return label;\n },\n // 构建快速搜索配置项\n generateQuickSearchConfig: function generateQuickSearchConfig() {\n var _this5 = this;\n\n var labelAry = [];\n\n if (typeof this.quickSearchProps == \"string\") {\n var props = utils.stringSplit(this.quickSearchProps, \",\");\n this.quickSearchConfig = [];\n props.forEach(function (prop) {\n var label = _this5.getColumnLabelByProp(prop);\n\n if (label) {\n labelAry.push(label);\n\n _this5.quickSearchConfig.push({\n prop: prop,\n label: label\n });\n }\n });\n }\n\n if (_typeof(this.quickSearchProps) == \"object\") {\n this.quickSearchProps.forEach(function (prop) {\n if (prop && prop.label) {\n labelAry.push(prop.label);\n }\n });\n this.quickSearchConfig = _toConsumableArray(this.quickSearchProps);\n }\n\n this.quickSearchPlaceholder = \"\\u8BF7\\u8F93\\u5165\".concat(labelAry.join(\",\"), \"\\u6765\\u641C\\u7D22\");\n },\n // 通过分组名称清除对应查询条件\n clearQueryByGroupName: function clearQueryByGroupName(groupName) {\n var _this6 = this;\n\n // 待删除的查询条件\n var toDelete = [];\n this.querys && this.querys.forEach(function (query) {\n if (query.group == groupName) {\n toDelete.push(query);\n }\n });\n toDelete.forEach(function (d) {\n _this6.querys.remove(d);\n });\n },\n handleFilters: function handleFilters() {\n var _this7 = this;\n\n this.clearQueryByGroupName(\"filter\"); // 将过滤条件添加查询参数数组中\n\n if (this.filters && Object.keys(this.filters).length > 0) {\n Object.keys(this.filters).forEach(function (k) {\n var filter = _this7.filters[k];\n var query = {\n property: k,\n value: filter[0],\n group: \"filter\",\n relation: \"AND\"\n };\n\n if (filter.length == 1) {\n query.operation = \"EQUAL\";\n\n _this7.querys.push(query);\n } else if (filter.length > 1) {\n query.operation = \"IN\";\n query.value = filter;\n\n _this7.querys.push(query);\n }\n });\n }\n },\n handleSizeChange: function handleSizeChange(pageSize) {\n this.pagination = _objectSpread(_objectSpread({}, this.pagination), {}, {\n pageSize: pageSize\n });\n this.load();\n },\n handleCurrentChange: function handleCurrentChange(page) {\n this.pagination = _objectSpread(_objectSpread({}, this.pagination), {}, {\n page: page\n }); // 翻页时不重置页码\n\n this.load(true);\n },\n handleRowClick: function handleRowClick(row, column, event) {\n this.$emit(\"row-click\", row, column, event);\n },\n handleRowDBClick: function handleRowDBClick(row, column, event) {\n this.$emit(\"row-dblclick\", row, column, event);\n },\n handleTableSelect: function handleTableSelect(selection, row) {\n this.selection = selection;\n\n if (row) {\n this.$emit(\"select\", selection, row);\n } else {\n this.$emit(\"select-all\", selection);\n }\n },\n handleSortChange: function handleSortChange(column) {\n if (!column.order) {\n this.sorter = null;\n } else {\n this.sorter = [{\n property: column.prop,\n direction: column.order == \"ascending\" ? \"ASC\" : \"DESC\"\n }];\n }\n\n this.load();\n this.$emit(\"sort-change\", column);\n },\n handleFilterChange: function handleFilterChange(m) {\n var _this8 = this;\n\n this.filters = _objectSpread(_objectSpread({}, this.filters), m);\n Object.keys(this.filters).forEach(function (k) {\n if (!_this8.filters[k] || _this8.filters[k].length == 0) {\n delete _this8.filters[k];\n }\n });\n this.load();\n this.$emit(\"filter-change\", m);\n },\n // 初始化自定义列表项\n initialCustomColumn: function initialCustomColumn() {\n // 优先获取localStorage中的设置\n if (this.customColumnsHashCode) {\n this.currentCustomColumns = this.getLocalStorage(this.customColumnsHashCode);\n } // 没有localStorage时,根据表格列是否初始化隐藏来获取\n\n\n if (!this.currentCustomColumns) {\n var ccols = [];\n this.customColumns.forEach(function (cs) {\n cs.checked && ccols.push(cs.key);\n });\n this.currentCustomColumns = ccols.join(\",\");\n }\n\n this.applyCustomColumn();\n },\n // 将自定义列表项应用到当前表格、自定义列表项数组中\n applyCustomColumn: function applyCustomColumn() {\n var _this9 = this;\n\n var currentCustomColumnsAry = this.currentCustomColumns.split(\",\"); // 同步选中状态到自定义列表数组中\n\n this.customColumns.forEach(function (cs) {\n cs.checked = currentCustomColumnsAry.some(function (cca) {\n return cca == cs.key;\n });\n }); // 同步选中状态到当前表格\n\n this.$slots.default.forEach(function (v) {\n if (v && v.componentInstance && v.componentInstance.prop && v.componentInstance.label) {\n v.componentInstance.hiddenCol = !currentCustomColumnsAry.some(function (cca) {\n return cca == v.componentInstance.prop;\n });\n }\n });\n this.$nextTick(function () {\n _this9.$refs.htTable.doLayout();\n });\n },\n // 自定义列表项确定按钮\n customColumnDialogSure: function customColumnDialogSure() {\n this.applyCustomColumn(); // 同步选中状态到localStorage中\n\n if (this.customColumnsHashCode) {\n this.setLocalStorage(this.customColumnsHashCode, this.currentCustomColumns);\n }\n\n this.customColumnDialogVisible = false;\n },\n // 自定义列表项取消按钮\n customColumnDialogCancel: function customColumnDialogCancel() {\n // 取消对话框时,可能用户已经勾选或去掉了一些选项,这里需要还原这些勾选操作\n var currentCustomColumnAry = [];\n this.customColumns.forEach(function (cc) {\n cc.checked && currentCustomColumnAry.push(cc.key);\n });\n this.currentCustomColumns = currentCustomColumnAry.join(\",\");\n this.customColumnDialogVisible = false;\n },\n // 从localStorage中获取用于存放自定义列表项的对象\n getObjectFromLocalStorage: function getObjectFromLocalStorage() {\n if (localStorage) {\n var customColumnSetting = localStorage.getItem(\"customColumnSetting\");\n\n if (!customColumnSetting) {\n customColumnSetting = \"{}\";\n }\n\n try {\n customColumnSetting = JSON.parse(customColumnSetting);\n } catch (e) {}\n\n if (!customColumnSetting || _typeof(customColumnSetting) != \"object\") {\n customColumnSetting = {};\n }\n\n return customColumnSetting;\n }\n\n return null;\n },\n setLocalStorage: function setLocalStorage(key, value) {\n var customColumnSetting = this.getObjectFromLocalStorage();\n\n if (customColumnSetting) {\n customColumnSetting[key] = value;\n localStorage.setItem(\"customColumnSetting\", JSON.stringify(customColumnSetting));\n }\n },\n getLocalStorage: function getLocalStorage(key) {\n var customColumnSetting = this.getObjectFromLocalStorage();\n\n if (customColumnSetting) {\n return customColumnSetting[key];\n }\n\n return null;\n },\n calcTableHeight: function calcTableHeight(delay) {\n var _this10 = this;\n\n // 动态计算表格的高度,自适应当前容器\n setTimeout(function () {\n if (!_this10.$refs.tablePanel) {\n return;\n }\n\n var tablePanelHeight = _this10.$refs.tablePanel.$el.clientHeight;\n var toolbarPanelHeight = _this10.$refs.toolbarPanel.clientHeight || 0;\n var searchPanelHeight = _this10.$refs.searchPanel && _this10.$refs.searchPanel.clientHeight ? _this10.$refs.searchPanel.clientHeight : 0;\n var paginationPanelHeight = _this10.$refs.paginationPanel && _this10.$refs.paginationPanel.clientHeight || 0;\n _this10.tableMaxHeight = tablePanelHeight - (searchPanelHeight > 0 ? 20 : 5) - toolbarPanelHeight - searchPanelHeight - (paginationPanelHeight > 0 ? 0 : 10) - paginationPanelHeight;\n }, delay || 0);\n }\n }\n};",null]}