sd-minio-upfile
Version:
2,282 lines (2,098 loc) • 866 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define("sd-data-grid", [], factory);
else if(typeof exports === 'object')
exports["sd-data-grid"] = factory();
else
root["sd-data-grid"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (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, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // 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 = 18);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if(item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
}
// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
throw new Error(
'vue-style-loader cannot be used in a non-browser environment. ' +
"Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
) }
}
var listToStyles = __webpack_require__(22)
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
module.exports = function (parentId, list, _isProduction) {
isProduction = _isProduction
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[data-vue-ssr-id~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/* 2 */
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file.
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 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 = injectStyles
}
if (hook) {
var functional = options.functional
var existing = functional
? options.render
: options.beforeCreate
if (!functional) {
// inject component registration as beforeCreate hook
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
} else {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functioal component in vue file
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return existing(h, context)
}
}
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__methods__ = __webpack_require__(25);
/* eslint-disable no-tabs */
/* eslint-disable no-mixed-spaces-and-tabs */
/* harmony default export */ __webpack_exports__["a"] = ({
data: function data() {
return {
customShowList: [],
showModal: false,
modalStatus: false,
dataGridLoad: false,
comModelProps: null,
comModel: null,
modelShowFields: null,
dataGridColumns: [],
gridData: [],
queryFields: [],
hiddenQueryFields: [],
filterFields: {},
pageNo: 1,
pageSize: 10,
pageSizeOpts: [10, 20, 50, 100],
labelWidth: 120,
totalNum: 0,
// 排序字段
orderKey: [],
// 排序类别(asc,desc)
orderType: [],
quickFilter: [],
batch_select: [],
multiColSetShow: false,
column: [],
slotColumn: [],
// 操作
funcAuth: [],
showOper: true,
hasRowOper: false,
headOper: [],
headOperBatch: [],
rowOper: [],
rowOperBatch: [],
iframeUrl: '',
iframeComponent: '',
gridExportOptStatus: false,
gridExportDataStatus: false,
gridExportDataRequestParams: null,
gridDataRequestParams: null,
gridPrintOptStatus: false,
gridPrintDataStatus: false,
gridPrintDataRequestParams: null,
modalId: '',
modalTitle: '',
modalWidth: 1000,
modalHeight: 600,
searchShow: false,
pageSearch: true,
showCheckbox: false,
loading: true,
dataGridId: '',
clearCache: '',
browsePerm: true,
dataGridWidth: 0,
dataGridHeight: -1,
searchType: '01', // 查询控件 01:普通 02:简单,
errorMsg: '',
dbType: '',
exportMaxCount: 0,
returnParams: {},
showDicManage: false,
openDicModal: false,
dicModalTitle: '字典代码管理',
isDefaultTab: this.$route.query && this.$route.query.isDefaultTab ? this.$route.query.isDefaultTab : '',
currentFilter: '',
asyncExportTotal: 0
};
},
mixins: [__WEBPACK_IMPORTED_MODULE_0__methods__["a" /* default */]],
methods: {
query_grid_data: function query_grid_data(pageNo) {
var _this = this;
this.loading = true;
if (pageNo) {
this.pageNo = pageNo;
}
var params = this.getGridRequestParams();
// console.log(params,'params')
this.$emit('returnParams', params);
this.$store.dispatch('postRequest', {
url: '/bsp-com/com/datagrid/getQueryPageData',
params: params
}).then(function (resp) {
if (resp.success) {
// 回调
_this.$emit('returnParamsSuccess', params, resp, _this.returnParams);
if (_this.beforeRender) {
_this.beforeRender(resp).then(function (data) {
if (data.success) {
_this.initRenderData(data.rows, data.total);
}
});
} else {
_this.initRenderData(resp.rows, resp.total);
}
//分组统计
if (_this.comModel.groupStat && _this.comModel.groupStatField && resp.group && _this.quickFilter) {
try {
_this.quickFilter[0].forEach(function (qf) {
//基于分组字段统计
if (!qf.groupStatType || qf.groupStatType == '0') {
var statFields = qf.groupStatField.split('|');
var statValues = qf.groupMatchValue.split('|');
qf.groupNum = 0;
for (var i = 0; i < statFields.length; i++) {
var statField = statFields[i];
var statValue = statValues[i];
if (resp.group[statField] && resp.group[statField][statValue]) {
qf.groupNum += resp.group[statField][statValue];
}
}
}
//基于过滤脚本统计
else if (qf.groupStatType == '1' && resp.groupFilter) {
var groupMark = qf.mark;
qf.groupNum = resp.groupFilter[groupMark] || 0;
}
});
} catch (e) {
console.log('分组统计异常:', e);
}
}
//异步下载
if (resp.asyncExportTotal) {
_this.asyncExportTotal = resp.asyncExportTotal;
}
}
});
},
getGridRequestParams: function getGridRequestParams() {
var _this2 = this;
var params = {
modelId: this.comModel.mark,
pageNo: this.pageNo,
pageSize: this.pageSize,
browsePerm: this.browsePerm
};
var searchCondis = [];
var condis = this.build_query_condis();
var filterCondis = this.build_filter_condis();
if (filterCondis.length > 0) {
searchCondis = searchCondis.concat(filterCondis);
}
if (condis.length > 0) {
searchCondis = searchCondis.concat(condis);
}
if (searchCondis.length > 0) {
params.condis = JSON.stringify(searchCondis);
}
var quickFilterSql = this.get_quick_filter();
if (quickFilterSql && quickFilterSql !== '') {
params.quickFilterSql = quickFilterSql;
}
var _orderKey = [];
if (this.orderKey.length > 0) {
this.orderKey.forEach(function (item) {
var _key = _this2.chineseSort[item];
if (_key) {
_orderKey.push(_key);
} else {
_orderKey.push(item);
}
});
}
params.sortName = _orderKey.join(',');
params.sortType = this.orderType.join(',');
if (Object.keys(this.extendParams).length > 0) {
params.extendParams = JSON.stringify(this.extendParams);
} else if (Object.keys(this.params).length > 0) {
params.extendParams = JSON.stringify(this.params);
}
return params;
},
initRenderData: function initRenderData(rowData, total) {
this.gridData = rowData;
this.totalNum = total;
var disableFields = this.modelShowFields.filter(function (item) {
return item.attachProps && JSON.parse(item.attachProps) && JSON.parse(item.attachProps)._disabled;
});
if (this.gridData && this.gridData.length > 0) {
this.gridData.forEach(function (item) {
disableFields.forEach(function (obj) {
var props = JSON.parse(obj.attachProps);
if (props._disabledValue == item[obj.name.toLowerCase()]) {
item._disabled = true;
}
});
});
}
this.batch_select = [];
this.loading = false;
},
refreshGrid: function refreshGrid(pageNo) {
this.query_grid_data(pageNo);
},
get_quick_filter: function get_quick_filter() {
var filterSql = [];
this.quickFilter.forEach(function (filters) {
var orSql = [];
filters.forEach(function (item) {
if (item.isDefault === '1') {
if (item.filterSql) {
orSql.push(item.filterSql);
}
}
});
if (orSql.length > 0) {
filterSql.push(orSql.join(' or '));
}
});
return filterSql.join(' and ');
},
// condis参数
build_query_condis: function build_query_condis() {
var queryParams = [];
var queryFields = this.queryFields.concat();
var _that = this;
if (this.hiddenQueryFields.length > 0) {
var hiddenFields = [];
var req = Object.assign({}, this.$route.query, this.params);
var temValue = {
user: this.$store.getters.sessionUser,
req: req
};
this.hiddenQueryFields.forEach(function (field) {
var item = Object.assign({}, field);
var defaultValue = item.defaultValue ? item.defaultValue.trim() : '';
var tem = _that.template(defaultValue, temValue);
if (tem !== '') {
item.searchValue = tem;
}
if (item.startDefault) {
item.start = _that.template(item.startDefault.trim(), temValue);
}
if (item.endDefault) {
item.end = _that.template(item.endDefault.trim(), temValue);
}
hiddenFields.push(item);
});
if (hiddenFields.length > 0) {
queryFields.push(hiddenFields);
}
}
queryFields.forEach(function (fields) {
fields.forEach(function (item) {
if (item.opName === 'between') {
if (item.start) {
var param = {
name: item.name,
op: '>=',
value: item.start,
valueType: item.valueType
};
queryParams.push(param);
}
if (item.end) {
var endDefault = item.end;
if (endDefault.length === 16 && item.valueType === 'datetime') {
endDefault += ':59';
} else if (endDefault.length === 14 && item.valueType === 'datetime') {
endDefault += ':59:59';
}
var _param = {
name: item.name,
op: '<=',
value: endDefault,
valueType: item.valueType
};
queryParams.push(_param);
}
} else if (item.searchValue instanceof Array) {
if (item.searchValue.length > 0) {
var _param2 = {
name: item.name,
op: 'dicmultiple',
value: item.searchValue.join(','),
valueType: item.valueType
};
queryParams.push(_param2);
}
} else if (item.searchValue) {
var _param3 = {
name: item.name,
op: item.opName,
value: item.searchValue,
valueType: item.valueType
};
if (item.isDicMultiple) {
_param3.op = 'dicmultiple';
}
queryParams.push(_param3);
}
});
});
return queryParams;
},
build_filter_condis: function build_filter_condis() {
var filterFields = {};
Object.assign(filterFields, this.filterFields);
var queryParams = [];
for (var key in filterFields) {
var valSize = filterFields[key].length;
if (valSize > 0) {
var op = '=';
if (filterFields[key].length > 1) {
op = 'dicmultiple';
}
var param = {
name: key,
op: op,
value: filterFields[key].join(','),
valueType: 'string'
};
queryParams.push(param);
}
}
return queryParams;
},
on_batch_select: function on_batch_select(data) {
// 批量选择
this.batch_select = data;
},
isAuth: function isAuth(data) {
if (data && data !== '') {
return false;
}
return true;
}
}
});
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return type; });
/*!
* @jsmini/type 0.9.2 (https://github.com/jsmini/type)
* API https://github.com/jsmini/type/blob/master/doc/api.md
* Copyright 2017-2019 jsmini. All Rights Reserved
* Licensed under MIT (https://github.com/jsmini/type/blob/master/LICENSE)
*/
function _typeof(obj) {
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function (obj) {
return typeof obj;
};
} else {
_typeof = function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
var toString = Object.prototype.toString;
function type(x) {
var strict = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
strict = !!strict; // fix typeof null = object
if (x === null) {
return 'null';
}
var t = _typeof(x); // 严格模式 区分NaN和number
if (strict && t === 'number' && isNaN(x)) {
return 'nan';
} // number string boolean undefined symbol
if (t !== 'object') {
return t;
}
var cls;
var clsLow;
try {
cls = toString.call(x).slice(8, -1);
clsLow = cls.toLowerCase();
} catch (e) {
// ie下的 activex对象
return 'object';
}
if (clsLow !== 'object') {
if (strict) {
// 区分NaN和new Number
if (clsLow === 'number' && isNaN(x)) {
return 'NaN';
} // 区分 String() 和 new String()
if (clsLow === 'number' || clsLow === 'boolean' || clsLow === 'string') {
return cls;
}
}
return clsLow;
}
if (x.constructor == Object) {
return clsLow;
} // Object.create(null)
try {
// __proto__ 部分早期firefox浏览器
if (Object.getPrototypeOf(x) === null || x.__proto__ === null) {
return 'object';
}
} catch (e) {} // ie下无Object.getPrototypeOf会报错
// function A() {}; new A
try {
var cname = x.constructor.name;
if (typeof cname === 'string') {
return cname;
}
} catch (e) {} // 无constructor
// function A() {}; A.prototype.constructor = null; new A
return 'unknown';
}
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export assign */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return extend; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return extendDeep; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__jsmini_is__ = __webpack_require__(27);
/*!
* @jsmini/extend 0.3.3 (https://github.com/jsmini/extend)
* API https://github.com/jsmini/extend/blob/master/doc/api.md
* Copyright 2017-2019 jsmini. All Rights Reserved
* Licensed under MIT (https://github.com/jsmini/extend/blob/master/LICENSE)
*/
function hasOwnProp(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
var assign = Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["b" /* isFunction */])(Object.assign) ? Object.assign : function assign(target) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["c" /* isObject */])(target)) {
throw new TypeError('assign first param must is object');
}
for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
var source = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
if (Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["c" /* isObject */])(source)) {
for (var key in source) {
if (hasOwnProp(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
};
function extend() {
return assign.apply(void 0, arguments);
}
function extendDeep(target) {
// 深拷贝
if (!Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["c" /* isObject */])(target) && !Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["a" /* isArray */])(target)) {
throw new TypeError('extend target param must is object');
}
for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
var source = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
for (var name in source) {
var src = target[name];
var copy = source[name]; //避免无限循环
if (target === copy) {
continue;
} // 非可枚举属性
if (!hasOwnProp(source, name)) {
continue;
}
var copyIsArr = void 0;
if (copy && (Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["c" /* isObject */])(copy) || (copyIsArr = Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["a" /* isArray */])(copy)))) {
var clone = void 0;
if (copyIsArr) {
clone = src && Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["a" /* isArray */])(src) ? src : [];
} else {
clone = src && Object(__WEBPACK_IMPORTED_MODULE_0__jsmini_is__["c" /* isObject */])(src) ? src : {};
}
target[name] = extendDeep(clone, copy);
} else if (typeof copy !== 'undefined') {
target[name] = copy;
}
}
}
return target;
}
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var stringify = __webpack_require__(52);
var parse = __webpack_require__(53);
var formats = __webpack_require__(13);
module.exports = {
formats: formats,
parse: parse,
stringify: stringify
};
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__dataGrid__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__iframeComponent_vue__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__grid_export_opt_vue__ = __webpack_require__(49);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__grid_data_opt_vue__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__grid_print_opt_vue__ = __webpack_require__(60);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_sd_dic_manage__ = __webpack_require__(67);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_sd_dic_manage___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_sd_dic_manage__);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// import DicManage from '@/components/dic-manage/dic-manage.vue'
/* harmony default export */ __webpack_exports__["a"] = ({
mixins: [__WEBPACK_IMPORTED_MODULE_0__dataGrid__["a" /* default */]],
components: {
'iframeComponent': __WEBPACK_IMPORTED_MODULE_1__iframeComponent_vue__["a" /* default */],
'gridExportOpt': __WEBPACK_IMPORTED_MODULE_2__grid_export_opt_vue__["a" /* default */],
'gridDataOpt': __WEBPACK_IMPORTED_MODULE_3__grid_data_opt_vue__["a" /* default */],
'gridPrintOpt': __WEBPACK_IMPORTED_MODULE_4__grid_print_opt_vue__["a" /* default */],
'dicManage': __WEBPACK_IMPORTED_MODULE_5_sd_dic_manage__["dicManage"]
},
computed: {
pickerOptions: function pickerOptions() {
var that = this;
return function (condi, type) {
return {
disabledDate: function disabledDate(time) {
if (1 === type) {
if (condi.end) {
var licenseEnd = new Date(condi.end);
licenseEnd.setDate(licenseEnd.getDate());
return time.getTime() >= licenseEnd;
} else {
return false;
}
} else {
if (condi.start) {
var licenseStart = new Date(condi.start);
licenseStart.setDate(licenseStart.getDate() - 1);
return time.getTime() <= licenseStart;
} else {
return false;
}
}
}
};
};
}
}
// beforeDestroy() {
// // 组件销毁前取消所有请求
// this.cancelTokens.forEach(source => {
// source.cancel('组件销毁,取消请求');
// });
// this.cancelTokens = [];
// }
});
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var utils = module.exports = {};
/**
* Loops through the collection and calls the callback for each element. if the callback returns truthy, the loop is broken and returns the same value.
* @public
* @param {*} collection The collection to loop through. Needs to have a length property set and have indices set from 0 to length - 1.
* @param {function} callback The callback to be called for each element. The element will be given as a parameter to the callback. If this callback returns truthy, the loop is broken and the same value is returned.
* @returns {*} The value that a callback has returned (if truthy). Otherwise nothing.
*/
utils.forEach = function(collection, callback) {
for(var i = 0; i < collection.length; i++) {
var result = callback(collection[i]);
if(result) {
return result;
}
}
};
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var detector = module.exports = {};
detector.isIE = function(version) {
function isAnyIeVersion() {
var agent = navigator.userAgent.toLowerCase();
return agent.indexOf("msie") !== -1 || agent.indexOf("trident") !== -1 || agent.indexOf(" edge/") !== -1;
}
if(!isAnyIeVersion()) {
return false;
}
if(!version) {
return true;
}
//Shamelessly stolen from https://gist.github.com/padolsey/527683
var ieVersion = (function(){
var undef,
v = 3,
div = document.createElement("div"),
all = div.getElementsByTagName("i");
do {
div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->";
}
while (all[0]);
return v > 4 ? v : undef;
}());
return version === ieVersion;
};
detector.isLegacyOpera = function() {
return !!window.opera;
};
/***/ }),
/* 10 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["a"] = ({
data: function data() {
return {
modal: true
};
},
props: {
modalId: '',
iframeUrl: '',
title: '',
modalWidth: '',
modalHeight: ''
},
watch: {
iframeUrl: function iframeUrl(val) {
document.getElementById('iframeId').contentWindow.location.reload(true);
}
},
methods: {
handleMessage: function handleMessage(event) {
// 根据上面制定的结构来解析iframe内部发回来的数据
var data = event.data;
if (data.cmd === 'closeGridModal' && data.modalId === this.modalId) {
this.closeModal();
}
},
closeModal: function closeModal() {
var frame = document.getElementById('iframeId');
frame.src = 'about:blank';
this.modal = false;
this.$emit('closeModal');
try {
frame.contentWindow.document.write('');
frame.contentWindow.document.clear();
} catch (e) {}
frame.contentWindow.close();
}
},
mounted: function mounted() {
window.addEventListener('message', this.handleMessage);
}
});
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_qs__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_qs___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_qs__);
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; };
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"); }); }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["a"] = ({
name: 'grid-export-opt',
props: {
modalWidth: {
type: Number,
default: 900
},
modalHeight: {
type: Number,
default: 600
},
gridAllShowFields: {
type: Array,
default: function _default() {
return [];
}
},
selectedRows: {
type: Array,
default: function _default() {
return [];
}
},
rowMark: {
type: String,
default: ''
},
pageSize: {
type: Number,
default: 10
},
gridRequestParams: {
type: Object,
default: function _default() {
return null;
}
},
exportMaxCount: {
type: Number,
default: 2000
},
exportOption: {
type: Object,
default: function _default() {
return {
fileType: '0',
exportFields: [],
pageRange: {
fromPageNo: 1,
toPageNo: 1
}
};
}
}
},
data: function data() {
var validateExportFields = function validateExportFields(rule, value, callback) {
if (!value || value.length <= 0) {
callback(new Error('请选择导出字段'));
} else {
callback();
}
};
return {
modal: true,
title: '导出数据',
totalCount: 0,
modal_loading: false,
ruleValidate: {
fileName: [{ required: true, message: '文件名称不能为空', trigger: 'blur,change' }],
pageRange: [{ validator: this.validatePageRange, trigger: 'blur,change' }],
exportFields: [{ validator: validateExportFields, trigger: 'blur,change' }]
}
};
},
mounted: function mounted() {
// 查询导出数据共有多少页
this.queryExportDataCount();
// 默认选中所有字段
this.defCheckedAllFields();
},
computed: {
allowExportFields: function allowExportFields() {
if (this.gridAllShowFields) {
return this.gridAllShowFields.filter(function (el) {
return el.isExport === '1';
});
} else {
return [];
}
},
pageCount: function pageCount() {
return Math.ceil(this.totalCount / this.pageSize);
}
},
methods: {
queryExportDataCount: function queryExportDataCount() {
var _this = this;
if (!this.gridRequestParams) {
this.$Notice.error({
title: '错误提示',
desc: '查询数据参数为空'
});
} else {
var params = _extends({}, this.gridRequestParams);
params.pageNo = 1;
params.pageSize = 0;
this.$store.dispatch('postRequest', { url: '/bsp-com/com/datagrid/getQueryPageData', params: params }).then(function (resp) {
if (resp.success) {
_this.totalCount = resp.total;
// 设置默认的导出结束页
if (_this.totalCount > _this.exportMaxCount) {
_this.exportOption.pageRange.toPageNo = Math.floor(_this.exportMaxCount / _this.pageSize);
} else {
_this.exportOption.pageRange.toPageNo = Math.ceil(_this.totalCount / _this.pageSize);
}
} else {
_this.$Notice.error({
title: '错误提示',
desc: resp.msg
});
}
});
}
},
defCheckedAllFields: function defCheckedAllFields() {
if (this.allowExportFields) {
var _exportOption$exportF;
var allowExportFieldNames = this.allowExportFields.map(function (e) {
return e.name;
});
(_exportOption$exportF = this.exportOption.exportFields).push.apply(_exportOption$exportF, _toConsumableArray(allowExportFieldNames));
}
},
validatePageRange: function validatePageRange(rule, value, callback) {
if (!value || !value.fromPageNo || !value.toPageNo) {
callback(new Error('请设置导出数据页'));
return;
}
if (value.fromPageNo > value.toPageNo) {
callback(new Error('导出起始页号不能大于结束页号'));
return;
} else {
callback();
}
// 校验数据量不能超过this.exportMaxCount条
// if (this.totalCount <= this.exportMaxCount) {
// callback()
// return
// }
// if ((value.toPageNo - value.fromPageNo + 1) * this.pageSize > this.exportMaxCount) {
// callback(new Error('导出的数据量不能超过' + this.exportMaxCount))
// } else {
// callback()
// }
// callback()
},
closeModal: function closeModal() {
this.modal = false;
this.$emit('closeModal');
},
getExportNum: function getExportNum(toPageNo, fromPageNo) {
// 如果是最后一页 判断最后一页多少条数据
// 不是最后一页直接乘页码 (value.toPageNo - value.fromPageNo + 1) * this.pageSize
var exportTotal = 0;
if (toPageNo == this.pageCount) {
exportTotal = this.totalCount - (fromPageNo - 1) * this.pageSize;
} else {
exportTotal = (toPageNo - fromPageNo + 1) * this.pageSize;
}
console.log(exportTotal, this.pageCount, 'this.pageCount()');
return exportTotal;
},
confirmExport: function confirmExport() {
var _this2 = this;
console.log(121212, this.exportMaxCount, this.pageCount, this.rowMark, 'this.selectedRows.length');
this.$refs['exportOptionForm'].validate(function (valid) {
console.log(valid, 'valid');
if (valid) {
_this2.modal_loading = true;
var opts = _this2.exportOption;
var params = _extends({}, _this2.gridRequestParams);
params.fileType = opts.fileType;
params.fileName = opts.fileName;
params.exportFields = opts.exportFields.join(',');
params.fromPageNo = opts.pageRange.fromPageNo;
params.toPageNo = opts.pageRange.toPageNo;
params.pageSize = _this2.pageSize;
params.exportMaxCount = _this2.exportMaxCount;
delete params.pageNo;
if (_this2.selectedRows && _this2.selectedRows.length > 0 && _this2.rowMark) {
var rowMarkLowerCase = _this2.rowMark.toLowerCase();
var rowMarkValArr = _this2.selectedRows.map(function (row) {
return row[rowMarkLowerCase];
});
params['rowMarkVals'] = rowMarkValArr.join(',');
}
console.log((params.toPageNo - params.fromPageNo + 1) * _this2.pageSize, _this2.exportMaxCount, _this2.pageCount, 'this.selectedRows.length');
var num = _this2.getExportNum(params.toPageNo, params.fromPageNo);
var url = '/bsp-com/com/datagrid/exportGridData';
params.totalPage = Math.ceil(num / _this2.pageSize); // 导出列表数据总页数,
params.totalNum = _this2.totalCount; // 导出列表数据数,
params.totalExportNum = num; //导出数据数
if (num > 2000) {
url = '/bsp-com/com/datagrid/export/exportGridDataTask';
_this2.$Modal.confirm({
title: '导出提示',
content: '导出数量超过2000条,需要创建导出任务,导出任务创建完成后,可通过"导出数据下载"按钮对文件进行下载,是否创建导出任务?',
loading: true,
onOk: function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this2.downFile(params, url, true, opts);
case 1:
case 'end':
return _context.stop();
}
}
}, _callee, _this2);
}));
return function onOk() {
return _ref.apply(this, arguments);
};
}()
});
_this2.modal_loading = false;
} else {
url = '/bsp-com/com/datagrid/exportGridData';
_this2.downFile(params, url, false, opts);
}
} else {
_this2.$Message.error('表单验证失败');
}
});
},
downFile: function downFile(params, url, tag, opts) {
var _this3 = this;
this.$store.dispatch('downloadPostRequest', {
url: url,
params: __WEBPACK_IMPORTED_MODULE_0_qs___default.a.stringify(params),
responseType: 'blob'
}).then(function (resp) {
var data = resp;
console.log(data, 'data');
if (tag) {
_this3.$Message.success('导出任务创建成功!');
_this3.$Modal.remove();
_this3.modal_loading = false;
_this3.closeModal();
} else {
if (data['type'] === 'text/plain' || data['type'] === 'application/json') {
// 导出失败,返回的是错误消息
data.text().then(function (msg) {
_this3.$Notice.error({
title: '错误提示',
desc: msg ? msg : '导出列表数据异常'
});
});
_this3.modal_loading = false;
} else {
// 导出成功,返回的是要导出的文件
var _url = window.URL.createObjectURL(data);
var a = document.createElement('a');
a.href = _url;
a.download = opts.fileName;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(_url);
document.body.removeChild(a);
_this3.modal_loading = false;
_this3.closeModal();
}
}
}).catch(function (error) {
if (error) {
console.log(error);
}
_this3.modal_loading = false;
});
}
}
});
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var has = Object.prototype.hasOwnProperty;
var hexTable = (function () {
var array = [];
for (var i = 0; i < 256; ++i) {
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
}
return array;
}());
var compactQueue = function compactQueue(queue) {
var obj;
while (queue.length) {
var item = queue.pop();
obj = item.obj[item.prop];
if (Array.isArray(obj)) {
var compacted = [];
for (var j = 0; j < obj.length; ++j) {
if (typeof obj[j] !== 'undefined') {
compacted.push(obj[j]);
}
}
item.obj[item.prop] = compacted;
}
}
return obj;
};
var arrayToObject = function arrayToObject(source, options) {