sd-data-grid
Version:
1,689 lines (1,528 loc) • 471 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-dic-manage", [], factory);
else if(typeof exports === 'object')
exports["sd-dic-manage"] = factory();
else
root["sd-dic-manage"] = 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 = 1);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_sd_data_grid__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_sd_data_grid___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_sd_data_grid__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vue_py_js__ = __webpack_require__(10);
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"); }); }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["a"] = ({
name: 'DicManage',
components: {
sDataGrid: __WEBPACK_IMPORTED_MODULE_0_sd_data_grid__["sDataGrid"],
vPinyin: __WEBPACK_IMPORTED_MODULE_1__vue_py_js__["a" /* default */]
},
props: {
isRefApp: {
type: Boolean,
default: false,
require: false
},
dicNames: {
type: String,
default: ''
}
},
mounted: function mounted() {
this.init();
},
data: function data() {
return {
codeFormData: {
dicId: '',
dicName: '',
dicCname: '',
orderId: 1,
isDisabled: '0'
},
gridParams: {
dicId: ''
},
custom_loading: false,
dicName: '',
dicNameList: [],
dicList: [],
dicId: '',
dicCname: '',
dicMap: {},
isLoadGrid: false,
isDicNameChanged: false,
gridOrderId: 1,
jsLoading: false
};
},
watch: {
'codeFormData.name': function codeFormDataName() {
if (this.codeFormData.name) {
var pinyin = __WEBPACK_IMPORTED_MODULE_1__vue_py_js__["a" /* default */].chineseToPinYin(this.codeFormData.name);
this.$set(this.codeFormData, 'scode', pinyin);
var SX = '';
for (var i = 0; i < pinyin.length; i++) {
var c = pinyin.charAt(i);
if (/^[A-Z0-9]+$/.test(c)) {
SX += c;
}
}
this.$set(this.codeFormData, 'jpCode', SX.toLowerCase());
}
}
},
methods: {
//初始化
init: function init() {
this.dicNameList = this.dicNames.split(',');
if (this.dicNameList.length > 0) {
this.dicName = this.dicNameList[0];
this.loadTargetDic(this.dicName);
}
},
//加载目标字典
loadTargetDic: function loadTargetDic(name) {
var _this2 = this;
this.dicId = '';
this.dicList = [];
var params = {
appId: this.isRefApp ? serverConfig.APP_ID : '',
name: name
};
this.$store.dispatch('getRequest', { url: '/bsp-com/ops/dic/getDicDetailByNameAppId', params: params }).then(function (resp) {
if (resp.success) {
if (resp.data && resp.data.length > 0) {
var firstDic = resp.data[0];
_this2.dicId = firstDic.id;
_this2.dicCname = firstDic.cname;
_this2.dicList = resp.data;
_this2.dicMap = {};
_this2.dicList.forEach(function (e) {
_this2.dicMap[e.id] = e.cname;
});
_this2.loadDataGrid(_this2.dicId);
_this2.isDicNameChanged = false;
}
}
});
},
//加载字典代码列表
loadDataGrid: function loadDataGrid(dicId) {
this.gridParams.dicId = dicId;
if (this.isLoadGrid) {
this.on_refresh_table();
} else {
this.isLoadGrid = true;
}
this.handleAdd();
this.isDicNameChanged = false;
},
//源字典名称切换
sourceChanged: function sourceChanged(obj) {
this.isDicNameChanged = true;
this.loadTargetDic(obj);
},
//目标字典切换
targetChanged: function targetChanged(obj) {
if (this.isDicNameChanged) return;
this.dicId = obj;
this.dicCname = this.dicMap[obj];
this.loadDataGrid(obj);
},
handleReset: function handleReset() {
this.$refs['baseForm'].resetFields();
},
handleAdd: function handleAdd() {
if (this.isLoadGrid) {
this.codeFormData = {};
this.codeFormData.dicId = this.dicId;
this.codeFormData.dicName = this.dicName;
this.codeFormData.dicCname = this.dicCname;
this.codeFormData.isDisabled = '0';
this.codeFormData.orderId = 1;
}
},
handleDeleteBatch: function handleDeleteBatch() {
if (this.$refs.grid.batch_select.length < 0) {
this.$Notice.error({
title: '错误提示',
desc: '请选择要删除的字典代码项!'
});
} else {
var idTemp = [];
this.$refs.grid.batch_select.forEach(function (e) {
idTemp.push(e.id);
});
this.handleDelete(idTemp.join(','));
}
},
handleDelete: function handleDelete(id) {
var _this3 = this;
var _this = this;
this.$Modal.confirm({
title: '是否确认删除选中的代码项?',
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:
_this.submitDel(id);
case 1:
case 'end':
return _context.stop();
}
}
}, _callee, _this3);
}));
return function onOk() {
return _ref.apply(this, arguments);
};
}()
});
},
submitDel: function submitDel(ids) {
var _this4 = this;
var _this = this;
this.$store.dispatch('postRequest', {
url: '/bsp-com/ops/dic/code/deleteDicCode',
params: {
ids: ids
}
}).then(function (data) {
if (data.success) {
_this4.$Notice.success({
title: '成功提示',
desc: data.msg
});
_this.on_refresh_table();
if (_this.codeFormData.id && ids.indexOf(_this.codeFormData.id) != -1) {
_this.handleAdd();
}
_this.$Modal.remove();
} else {
_this4.$Notice.error({
title: '错误提示',
desc: data.msg
});
}
});
},
on_refresh_table: function on_refresh_table() {
this.$refs.grid.query_grid_data(1);
},
handleEdit: function handleEdit(row) {
this.codeFormData = Object.assign({ orderId: 1 }, this.$tools.objToCamel(row));
},
on_show_table: function on_show_table(isRefreshTable) {
this.$emit('on_show_table', isRefreshTable);
},
handleSubmit: function handleSubmit() {
var _this5 = this;
this.$refs['baseForm'].validate(function (valid) {
if (valid) {
_this5.save_code_data();
} else {
_this5.$Notice.error({
title: '错误提示',
desc: '表单验证不通过'
});
}
});
},
save_code_data: function save_code_data() {
var _this6 = this;
this.custom_loading = true;
this.$store.dispatch('postRequest', {
url: '/bsp-com/ops/dic/code/saveDicCode',
params: this.codeFormData
}).then(function (data) {
_this6.custom_loading = false;
if (data.success) {
_this6.$Notice.success({
title: '成功提示',
desc: data.msg
});
_this6.on_refresh_table();
} else {
_this6.$Notice.error({
title: '错误提示',
desc: data.msg
});
}
});
},
buildJsUpdateCache: function buildJsUpdateCache() {
var _this7 = this;
if (this.dicId) {
this.jsLoading = true;
this.$store.dispatch('postRequest', {
url: '/bsp-com/ops/dic/buildDicJs',
params: {
ids: this.dicId
}
}).then(function (data) {
if (data.success) {
_this7.$Notice.success({
title: '成功提示',
desc: data.msg
});
_this7.jsLoading = false;
} else {
_this7.$Notice.error({
title: '错误提示',
desc: data.msg
});
_this7.jsLoading = false;
}
});
} else {
this.$Notice.error({
title: '错误提示',
desc: '未选中任何字典'
});
}
console.log(this.dicId);
console.log(this.dicName);
}
}
});
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__dic_manage_vue__ = __webpack_require__(2);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "dicManage", function() { return __WEBPACK_IMPORTED_MODULE_0__dic_manage_vue__["a"]; });
var Plugin = {
install: function install(Vue) {
Vue.component('dic-manage', __WEBPACK_IMPORTED_MODULE_0__dic_manage_vue__["a" /* default */]);
}
};
/* harmony default export */ __webpack_exports__["default"] = (Plugin);
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_node_modules_iview_loader_index_js_ref_5_dic_manage_vue__ = __webpack_require__(0);
/* unused harmony namespace reexport */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_2a498980_hasScoped_true_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_node_modules_iview_loader_index_js_ref_5_dic_manage_vue__ = __webpack_require__(12);
function injectStyle (ssrContext) {
__webpack_require__(3)
}
var normalizeComponent = __webpack_require__(8)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = "data-v-2a498980"
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_node_modules_iview_loader_index_js_ref_5_dic_manage_vue__["a" /* default */],
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_2a498980_hasScoped_true_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_node_modules_iview_loader_index_js_ref_5_dic_manage_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
/* harmony default export */ __webpack_exports__["a"] = (Component.exports);
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(4);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(6)("74dfae04", content, true);
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(5)(false);
// imports
// module
exports.push([module.i, ".ivu-select-selection[data-v-2a498980]{border-radius:8px!important;height:40px;display:flex;align-items:center}.ivu-select-input[data-v-2a498980]{text-align:center}.ivu-select-arrow[data-v-2a498980]{color:#2d8cf0;transition:transform .3s}.ivu-select-opened .ivu-select-arrow[data-v-2a498980]{transform:rotate(180deg)}.nodata[data-v-2a498980]{display:flex;justify-content:center;align-items:center;height:300px;border:1px solid #ddd;font-size:20px;font-weight:700;color:red;text-align:center;width:100%;height:500px}", ""]);
// exports
/***/ }),
/* 5 */
/***/ (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 + ' */';
}
/***/ }),
/* 6 */
/***/ (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__(7)
/*
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))
}
}
/***/ }),
/* 7 */
/***/ (function(module, exports) {
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
module.exports = function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
/***/ }),
/* 8 */
/***/ (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
}
}
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
(function webpackUniversalModuleDefinition(root, factory) {
if(true)
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: {},
isDefaultTab: this.$route.query && this.$route.query.isDefaultTab ? this.$route.query.isDefaultTab : ''
};
},
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 {
// let groupStatFields = this.comModel.groupStatField.split('|')
// console.log(groupStatFields)
// console.log(this.quickFilter)
// groupStatFields.forEach(field => {
// this.quickFilter[0].forEach(qf => {
// if(qf.groupStatField) {
// if(qf.groupStatField == field && resp.group[field]) {
// qf.groupNum = resp.group[field][qf.groupMatchValue] || 0
// }
// else{
// qf.groupNum = 0
// }
// }
// })
// })
_this.quickFilter[0].forEach(function (qf) {
if (resp.group[qf.groupStatField]) {
if (resp.group[qf.groupStatField][qf.groupMatchValue]) {
qf.groupNum = resp.group[qf.groupStatField][qf.groupMatchValue];
} else {
qf.groupNum = 0;
}
}
});
} catch (e) {
console.log('分组统计异常:', e);
}
}
}
});
},
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.