【modify】使用ESLint格式化代码

This commit is contained in:
zer0Black
2023-03-01 09:33:58 +08:00
parent 694855ae8b
commit 63369b8b87
400 changed files with 42942 additions and 43132 deletions
+20
View File
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
resolve: { resolve: {
extensions: ['.js', '.vue', '.json'], extensions: ['.js', '.vue', '.json'],
alias: { alias: {
'config': resolve('config'), config: resolve('config'),
'@': resolve('src'), '@': resolve('src'),
'@views': resolve('src/views'), '@views': resolve('src/views'),
'@comp': resolve('src/components'), '@comp': resolve('src/components'),
+6 -6
View File
@@ -2,11 +2,11 @@
* 防止打包部署时路径被写死 * 防止打包部署时路径被写死
*/ */
window._CONFIG = {} window._CONFIG = {}
window._CONFIG['domianURL'] = '/jero-boot' // 路由转发 devServer window._CONFIG.domianURL = '/jero-boot' // 路由转发 devServer
window._CONFIG['domianWebSocketURL'] = 'http://localhost:8080' window._CONFIG.domianWebSocketURL = 'http://localhost:8080'
// 单点登录地址 // 单点登录地址
window._CONFIG['staticDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/download' window._CONFIG.staticDomainURL = window._CONFIG.domianURL + '/sys/common/download'
window._CONFIG['pdfDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/pdf/pdfPreviewIframe' window._CONFIG.pdfDomainURL = window._CONFIG.domianURL + '/sys/common/pdf/pdfPreviewIframe'
window._CONFIG['casPrefixUrl'] = 'http://cas.example.org:8443/cas' window._CONFIG.casPrefixUrl = 'http://cas.example.org:8443/cas'
// 预览文件地址 // 预览文件地址
window._CONFIG['onlinePreviewDomainURL'] = 'http://127.0.0.1:8012/onlinePreview' window._CONFIG.onlinePreviewDomainURL = 'http://127.0.0.1:8012/onlinePreview'
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+260 -260
View File
@@ -1,261 +1,261 @@
tinymce.addI18n('zh_CN', { tinymce.addI18n('zh_CN', {
"Redo": "\u91cd\u590d", Redo: '\u91cd\u590d',
"Undo": "\u64a4\u6d88", Undo: '\u64a4\u6d88',
"Cut": "\u526a\u5207", Cut: '\u526a\u5207',
"Copy": "\u590d\u5236", Copy: '\u590d\u5236',
"Paste": "\u7c98\u8d34", Paste: '\u7c98\u8d34',
"Select all": "\u5168\u9009", 'Select all': '\u5168\u9009',
"New document": "\u65b0\u6587\u6863", 'New document': '\u65b0\u6587\u6863',
"Ok": "\u786e\u5b9a", Ok: '\u786e\u5b9a',
"Cancel": "\u53d6\u6d88", Cancel: '\u53d6\u6d88',
"Visual aids": "\u7f51\u683c\u7ebf", 'Visual aids': '\u7f51\u683c\u7ebf',
"Bold": "\u7c97\u4f53", Bold: '\u7c97\u4f53',
"Italic": "\u659c\u4f53", Italic: '\u659c\u4f53',
"Underline": "\u4e0b\u5212\u7ebf", Underline: '\u4e0b\u5212\u7ebf',
"Strikethrough": "\u5220\u9664\u7ebf", Strikethrough: '\u5220\u9664\u7ebf',
"Superscript": "\u4e0a\u6807", Superscript: '\u4e0a\u6807',
"Subscript": "\u4e0b\u6807", Subscript: '\u4e0b\u6807',
"Clear formatting": "\u6e05\u9664\u683c\u5f0f", 'Clear formatting': '\u6e05\u9664\u683c\u5f0f',
"Align left": "\u5de6\u5bf9\u9f50", 'Align left': '\u5de6\u5bf9\u9f50',
"Align center": "\u5c45\u4e2d", 'Align center': '\u5c45\u4e2d',
"Align right": "\u53f3\u5bf9\u9f50", 'Align right': '\u53f3\u5bf9\u9f50',
"Justify": "\u4e24\u7aef\u5bf9\u9f50", Justify: '\u4e24\u7aef\u5bf9\u9f50',
"Bullet list": "\u9879\u76ee\u7b26\u53f7", 'Bullet list': '\u9879\u76ee\u7b26\u53f7',
"Numbered list": "\u7f16\u53f7\u5217\u8868", 'Numbered list': '\u7f16\u53f7\u5217\u8868',
"Decrease indent": "\u51cf\u5c11\u7f29\u8fdb", 'Decrease indent': '\u51cf\u5c11\u7f29\u8fdb',
"Increase indent": "\u589e\u52a0\u7f29\u8fdb", 'Increase indent': '\u589e\u52a0\u7f29\u8fdb',
"Close": "\u5173\u95ed", Close: '\u5173\u95ed',
"Formats": "\u683c\u5f0f", Formats: '\u683c\u5f0f',
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "\u4f60\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u5bf9\u526a\u8d34\u677f\u7684\u8bbf\u95ee\uff0c\u8bf7\u4f7f\u7528Ctrl+X\/C\/V\u952e\u8fdb\u884c\u590d\u5236\u7c98\u8d34\u3002", "Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": '\u4f60\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u5bf9\u526a\u8d34\u677f\u7684\u8bbf\u95ee\uff0c\u8bf7\u4f7f\u7528Ctrl+X\/C\/V\u952e\u8fdb\u884c\u590d\u5236\u7c98\u8d34\u3002',
"Headers": "\u6807\u9898", Headers: '\u6807\u9898',
"Header 1": "\u6807\u98981", 'Header 1': '\u6807\u98981',
"Header 2": "\u6807\u98982", 'Header 2': '\u6807\u98982',
"Header 3": "\u6807\u98983", 'Header 3': '\u6807\u98983',
"Header 4": "\u6807\u98984", 'Header 4': '\u6807\u98984',
"Header 5": "\u6807\u98985", 'Header 5': '\u6807\u98985',
"Header 6": "\u6807\u98986", 'Header 6': '\u6807\u98986',
"Headings": "\u6807\u9898", Headings: '\u6807\u9898',
"Heading 1": "\u6807\u98981", 'Heading 1': '\u6807\u98981',
"Heading 2": "\u6807\u98982", 'Heading 2': '\u6807\u98982',
"Heading 3": "\u6807\u98983", 'Heading 3': '\u6807\u98983',
"Heading 4": "\u6807\u98984", 'Heading 4': '\u6807\u98984',
"Heading 5": "\u6807\u98985", 'Heading 5': '\u6807\u98985',
"Heading 6": "\u6807\u98986", 'Heading 6': '\u6807\u98986',
"Preformatted": "\u9884\u683c\u5f0f\u5316", Preformatted: '\u9884\u683c\u5f0f\u5316',
"Div": "Div\u533a\u5757", Div: 'Div\u533a\u5757',
"Pre": "\u9884\u683c\u5f0f\u6587\u672c", Pre: '\u9884\u683c\u5f0f\u6587\u672c',
"Code": "\u4ee3\u7801", Code: '\u4ee3\u7801',
"Paragraph": "\u6bb5\u843d", Paragraph: '\u6bb5\u843d',
"Blockquote": "\u5f15\u7528", Blockquote: '\u5f15\u7528',
"Inline": "\u6587\u672c", Inline: '\u6587\u672c',
"Blocks": "\u533a\u5757", Blocks: '\u533a\u5757',
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "\u5f53\u524d\u4e3a\u7eaf\u6587\u672c\u7c98\u8d34\u6a21\u5f0f\uff0c\u518d\u6b21\u70b9\u51fb\u53ef\u4ee5\u56de\u5230\u666e\u901a\u7c98\u8d34\u6a21\u5f0f\u3002", 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.': '\u5f53\u524d\u4e3a\u7eaf\u6587\u672c\u7c98\u8d34\u6a21\u5f0f\uff0c\u518d\u6b21\u70b9\u51fb\u53ef\u4ee5\u56de\u5230\u666e\u901a\u7c98\u8d34\u6a21\u5f0f\u3002',
"Font Family": "\u5b57\u4f53", 'Font Family': '\u5b57\u4f53',
"Font Sizes": "\u5b57\u53f7", 'Font Sizes': '\u5b57\u53f7',
"Class": "Class", Class: 'Class',
"Browse for an image": "\u6d4f\u89c8\u56fe\u50cf", 'Browse for an image': '\u6d4f\u89c8\u56fe\u50cf',
"OR": "\u6216", OR: '\u6216',
"Drop an image here": "\u62d6\u653e\u4e00\u5f20\u56fe\u50cf\u81f3\u6b64", 'Drop an image here': '\u62d6\u653e\u4e00\u5f20\u56fe\u50cf\u81f3\u6b64',
"Upload": "\u4e0a\u4f20", Upload: '\u4e0a\u4f20',
"Block": "\u5757", Block: '\u5757',
"Align": "\u5bf9\u9f50", Align: '\u5bf9\u9f50',
"Default": "\u9ed8\u8ba4", Default: '\u9ed8\u8ba4',
"Circle": "\u7a7a\u5fc3\u5706", Circle: '\u7a7a\u5fc3\u5706',
"Disc": "\u5b9e\u5fc3\u5706", Disc: '\u5b9e\u5fc3\u5706',
"Square": "\u65b9\u5757", Square: '\u65b9\u5757',
"Lower Alpha": "\u5c0f\u5199\u82f1\u6587\u5b57\u6bcd", 'Lower Alpha': '\u5c0f\u5199\u82f1\u6587\u5b57\u6bcd',
"Lower Greek": "\u5c0f\u5199\u5e0c\u814a\u5b57\u6bcd", 'Lower Greek': '\u5c0f\u5199\u5e0c\u814a\u5b57\u6bcd',
"Lower Roman": "\u5c0f\u5199\u7f57\u9a6c\u5b57\u6bcd", 'Lower Roman': '\u5c0f\u5199\u7f57\u9a6c\u5b57\u6bcd',
"Upper Alpha": "\u5927\u5199\u82f1\u6587\u5b57\u6bcd", 'Upper Alpha': '\u5927\u5199\u82f1\u6587\u5b57\u6bcd',
"Upper Roman": "\u5927\u5199\u7f57\u9a6c\u5b57\u6bcd", 'Upper Roman': '\u5927\u5199\u7f57\u9a6c\u5b57\u6bcd',
"Anchor": "\u951a\u70b9", Anchor: '\u951a\u70b9',
"Name": "\u540d\u79f0", Name: '\u540d\u79f0',
"Id": "\u6807\u8bc6\u7b26", Id: '\u6807\u8bc6\u7b26',
"Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.": "\u6807\u8bc6\u7b26\u5e94\u8be5\u4ee5\u5b57\u6bcd\u5f00\u5934\uff0c\u540e\u8ddf\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7834\u6298\u53f7\u3001\u70b9\u3001\u5192\u53f7\u6216\u4e0b\u5212\u7ebf\u3002", 'Id should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores.': '\u6807\u8bc6\u7b26\u5e94\u8be5\u4ee5\u5b57\u6bcd\u5f00\u5934\uff0c\u540e\u8ddf\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7834\u6298\u53f7\u3001\u70b9\u3001\u5192\u53f7\u6216\u4e0b\u5212\u7ebf\u3002',
"You have unsaved changes are you sure you want to navigate away?": "\u4f60\u8fd8\u6709\u6587\u6863\u5c1a\u672a\u4fdd\u5b58\uff0c\u786e\u5b9a\u8981\u79bb\u5f00\uff1f", 'You have unsaved changes are you sure you want to navigate away?': '\u4f60\u8fd8\u6709\u6587\u6863\u5c1a\u672a\u4fdd\u5b58\uff0c\u786e\u5b9a\u8981\u79bb\u5f00\uff1f',
"Restore last draft": "\u6062\u590d\u4e0a\u6b21\u7684\u8349\u7a3f", 'Restore last draft': '\u6062\u590d\u4e0a\u6b21\u7684\u8349\u7a3f',
"Special character": "\u7279\u6b8a\u7b26\u53f7", 'Special character': '\u7279\u6b8a\u7b26\u53f7',
"Source code": "\u6e90\u4ee3\u7801", 'Source code': '\u6e90\u4ee3\u7801',
"Insert\/Edit code sample": "\u63d2\u5165\/\u7f16\u8f91\u4ee3\u7801\u793a\u4f8b", 'Insert\/Edit code sample': '\u63d2\u5165\/\u7f16\u8f91\u4ee3\u7801\u793a\u4f8b',
"Language": "\u8bed\u8a00", Language: '\u8bed\u8a00',
"Code sample": "\u4ee3\u7801\u793a\u4f8b", 'Code sample': '\u4ee3\u7801\u793a\u4f8b',
"Color": "\u989c\u8272", Color: '\u989c\u8272',
"R": "R", R: 'R',
"G": "G", G: 'G',
"B": "B", B: 'B',
"Left to right": "\u4ece\u5de6\u5230\u53f3", 'Left to right': '\u4ece\u5de6\u5230\u53f3',
"Right to left": "\u4ece\u53f3\u5230\u5de6", 'Right to left': '\u4ece\u53f3\u5230\u5de6',
"Emoticons": "\u8868\u60c5", Emoticons: '\u8868\u60c5',
"Document properties": "\u6587\u6863\u5c5e\u6027", 'Document properties': '\u6587\u6863\u5c5e\u6027',
"Title": "\u6807\u9898", Title: '\u6807\u9898',
"Keywords": "\u5173\u952e\u8bcd", Keywords: '\u5173\u952e\u8bcd',
"Description": "\u63cf\u8ff0", Description: '\u63cf\u8ff0',
"Robots": "\u673a\u5668\u4eba", Robots: '\u673a\u5668\u4eba',
"Author": "\u4f5c\u8005", Author: '\u4f5c\u8005',
"Encoding": "\u7f16\u7801", Encoding: '\u7f16\u7801',
"Fullscreen": "\u5168\u5c4f", Fullscreen: '\u5168\u5c4f',
"Action": "\u64cd\u4f5c", Action: '\u64cd\u4f5c',
"Shortcut": "\u5feb\u6377\u952e", Shortcut: '\u5feb\u6377\u952e',
"Help": "\u5e2e\u52a9", Help: '\u5e2e\u52a9',
"Address": "\u5730\u5740", Address: '\u5730\u5740',
"Focus to menubar": "\u79fb\u52a8\u7126\u70b9\u5230\u83dc\u5355\u680f", 'Focus to menubar': '\u79fb\u52a8\u7126\u70b9\u5230\u83dc\u5355\u680f',
"Focus to toolbar": "\u79fb\u52a8\u7126\u70b9\u5230\u5de5\u5177\u680f", 'Focus to toolbar': '\u79fb\u52a8\u7126\u70b9\u5230\u5de5\u5177\u680f',
"Focus to element path": "\u79fb\u52a8\u7126\u70b9\u5230\u5143\u7d20\u8def\u5f84", 'Focus to element path': '\u79fb\u52a8\u7126\u70b9\u5230\u5143\u7d20\u8def\u5f84',
"Focus to contextual toolbar": "\u79fb\u52a8\u7126\u70b9\u5230\u4e0a\u4e0b\u6587\u83dc\u5355", 'Focus to contextual toolbar': '\u79fb\u52a8\u7126\u70b9\u5230\u4e0a\u4e0b\u6587\u83dc\u5355',
"Insert link (if link plugin activated)": "\u63d2\u5165\u94fe\u63a5 (\u5982\u679c\u94fe\u63a5\u63d2\u4ef6\u5df2\u6fc0\u6d3b)", 'Insert link (if link plugin activated)': '\u63d2\u5165\u94fe\u63a5 (\u5982\u679c\u94fe\u63a5\u63d2\u4ef6\u5df2\u6fc0\u6d3b)',
"Save (if save plugin activated)": "\u4fdd\u5b58(\u5982\u679c\u4fdd\u5b58\u63d2\u4ef6\u5df2\u6fc0\u6d3b)", 'Save (if save plugin activated)': '\u4fdd\u5b58(\u5982\u679c\u4fdd\u5b58\u63d2\u4ef6\u5df2\u6fc0\u6d3b)',
"Find (if searchreplace plugin activated)": "\u67e5\u627e(\u5982\u679c\u67e5\u627e\u66ff\u6362\u63d2\u4ef6\u5df2\u6fc0\u6d3b)", 'Find (if searchreplace plugin activated)': '\u67e5\u627e(\u5982\u679c\u67e5\u627e\u66ff\u6362\u63d2\u4ef6\u5df2\u6fc0\u6d3b)',
"Plugins installed ({0}):": "\u5df2\u5b89\u88c5\u63d2\u4ef6 ({0}):", 'Plugins installed ({0}):': '\u5df2\u5b89\u88c5\u63d2\u4ef6 ({0}):',
"Premium plugins:": "\u4f18\u79c0\u63d2\u4ef6\uff1a", 'Premium plugins:': '\u4f18\u79c0\u63d2\u4ef6\uff1a',
"Learn more...": "\u4e86\u89e3\u66f4\u591a...", 'Learn more...': '\u4e86\u89e3\u66f4\u591a...',
"You are using {0}": "\u4f60\u6b63\u5728\u4f7f\u7528 {0}", 'You are using {0}': '\u4f60\u6b63\u5728\u4f7f\u7528 {0}',
"Plugins": "\u63d2\u4ef6", Plugins: '\u63d2\u4ef6',
"Handy Shortcuts": "\u5feb\u6377\u952e", 'Handy Shortcuts': '\u5feb\u6377\u952e',
"Horizontal line": "\u6c34\u5e73\u5206\u5272\u7ebf", 'Horizontal line': '\u6c34\u5e73\u5206\u5272\u7ebf',
"Insert\/edit image": "\u63d2\u5165\/\u7f16\u8f91\u56fe\u7247", 'Insert\/edit image': '\u63d2\u5165\/\u7f16\u8f91\u56fe\u7247',
"Image description": "\u56fe\u7247\u63cf\u8ff0", 'Image description': '\u56fe\u7247\u63cf\u8ff0',
"Source": "\u5730\u5740", Source: '\u5730\u5740',
"Dimensions": "\u5927\u5c0f", Dimensions: '\u5927\u5c0f',
"Constrain proportions": "\u4fdd\u6301\u7eb5\u6a2a\u6bd4", 'Constrain proportions': '\u4fdd\u6301\u7eb5\u6a2a\u6bd4',
"General": "\u666e\u901a", General: '\u666e\u901a',
"Advanced": "\u9ad8\u7ea7", Advanced: '\u9ad8\u7ea7',
"Style": "\u6837\u5f0f", Style: '\u6837\u5f0f',
"Vertical space": "\u5782\u76f4\u8fb9\u8ddd", 'Vertical space': '\u5782\u76f4\u8fb9\u8ddd',
"Horizontal space": "\u6c34\u5e73\u8fb9\u8ddd", 'Horizontal space': '\u6c34\u5e73\u8fb9\u8ddd',
"Border": "\u8fb9\u6846", Border: '\u8fb9\u6846',
"Insert image": "\u63d2\u5165\u56fe\u7247", 'Insert image': '\u63d2\u5165\u56fe\u7247',
"Image": "\u56fe\u7247", Image: '\u56fe\u7247',
"Image list": "\u56fe\u7247\u5217\u8868", 'Image list': '\u56fe\u7247\u5217\u8868',
"Rotate counterclockwise": "\u9006\u65f6\u9488\u65cb\u8f6c", 'Rotate counterclockwise': '\u9006\u65f6\u9488\u65cb\u8f6c',
"Rotate clockwise": "\u987a\u65f6\u9488\u65cb\u8f6c", 'Rotate clockwise': '\u987a\u65f6\u9488\u65cb\u8f6c',
"Flip vertically": "\u5782\u76f4\u7ffb\u8f6c", 'Flip vertically': '\u5782\u76f4\u7ffb\u8f6c',
"Flip horizontally": "\u6c34\u5e73\u7ffb\u8f6c", 'Flip horizontally': '\u6c34\u5e73\u7ffb\u8f6c',
"Edit image": "\u7f16\u8f91\u56fe\u7247", 'Edit image': '\u7f16\u8f91\u56fe\u7247',
"Image options": "\u56fe\u7247\u9009\u9879", 'Image options': '\u56fe\u7247\u9009\u9879',
"Zoom in": "\u653e\u5927", 'Zoom in': '\u653e\u5927',
"Zoom out": "\u7f29\u5c0f", 'Zoom out': '\u7f29\u5c0f',
"Crop": "\u88c1\u526a", Crop: '\u88c1\u526a',
"Resize": "\u8c03\u6574\u5927\u5c0f", Resize: '\u8c03\u6574\u5927\u5c0f',
"Orientation": "\u65b9\u5411", Orientation: '\u65b9\u5411',
"Brightness": "\u4eae\u5ea6", Brightness: '\u4eae\u5ea6',
"Sharpen": "\u9510\u5316", Sharpen: '\u9510\u5316',
"Contrast": "\u5bf9\u6bd4\u5ea6", Contrast: '\u5bf9\u6bd4\u5ea6',
"Color levels": "\u989c\u8272\u5c42\u6b21", 'Color levels': '\u989c\u8272\u5c42\u6b21',
"Gamma": "\u4f3d\u9a6c\u503c", Gamma: '\u4f3d\u9a6c\u503c',
"Invert": "\u53cd\u8f6c", Invert: '\u53cd\u8f6c',
"Apply": "\u5e94\u7528", Apply: '\u5e94\u7528',
"Back": "\u540e\u9000", Back: '\u540e\u9000',
"Insert date\/time": "\u63d2\u5165\u65e5\u671f\/\u65f6\u95f4", 'Insert date\/time': '\u63d2\u5165\u65e5\u671f\/\u65f6\u95f4',
"Date\/time": "\u65e5\u671f\/\u65f6\u95f4", 'Date\/time': '\u65e5\u671f\/\u65f6\u95f4',
"Insert link": "\u63d2\u5165\u94fe\u63a5", 'Insert link': '\u63d2\u5165\u94fe\u63a5',
"Insert\/edit link": "\u63d2\u5165\/\u7f16\u8f91\u94fe\u63a5", 'Insert\/edit link': '\u63d2\u5165\/\u7f16\u8f91\u94fe\u63a5',
"Text to display": "\u663e\u793a\u6587\u5b57", 'Text to display': '\u663e\u793a\u6587\u5b57',
"Url": "\u5730\u5740", Url: '\u5730\u5740',
"Target": "\u6253\u5f00\u65b9\u5f0f", Target: '\u6253\u5f00\u65b9\u5f0f',
"None": "\u65e0", None: '\u65e0',
"New window": "\u5728\u65b0\u7a97\u53e3\u6253\u5f00", 'New window': '\u5728\u65b0\u7a97\u53e3\u6253\u5f00',
"Remove link": "\u5220\u9664\u94fe\u63a5", 'Remove link': '\u5220\u9664\u94fe\u63a5',
"Anchors": "\u951a\u70b9", Anchors: '\u951a\u70b9',
"Link": "\u94fe\u63a5", Link: '\u94fe\u63a5',
"Paste or type a link": "\u7c98\u8d34\u6216\u8f93\u5165\u94fe\u63a5", 'Paste or type a link': '\u7c98\u8d34\u6216\u8f93\u5165\u94fe\u63a5',
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u4e3a\u90ae\u4ef6\u5730\u5740\uff0c\u9700\u8981\u52a0\u4e0amailto:\u524d\u7f00\u5417\uff1f", 'The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?': '\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u4e3a\u90ae\u4ef6\u5730\u5740\uff0c\u9700\u8981\u52a0\u4e0amailto:\u524d\u7f00\u5417\uff1f',
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u5c5e\u4e8e\u5916\u90e8\u94fe\u63a5\uff0c\u9700\u8981\u52a0\u4e0ahttp:\/\/:\u524d\u7f00\u5417\uff1f", 'The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?': '\u4f60\u6240\u586b\u5199\u7684URL\u5730\u5740\u5c5e\u4e8e\u5916\u90e8\u94fe\u63a5\uff0c\u9700\u8981\u52a0\u4e0ahttp:\/\/:\u524d\u7f00\u5417\uff1f',
"Link list": "\u94fe\u63a5\u5217\u8868", 'Link list': '\u94fe\u63a5\u5217\u8868',
"Insert video": "\u63d2\u5165\u89c6\u9891", 'Insert video': '\u63d2\u5165\u89c6\u9891',
"Insert\/edit video": "\u63d2\u5165\/\u7f16\u8f91\u89c6\u9891", 'Insert\/edit video': '\u63d2\u5165\/\u7f16\u8f91\u89c6\u9891',
"Insert\/edit media": "\u63d2\u5165\/\u7f16\u8f91\u5a92\u4f53", 'Insert\/edit media': '\u63d2\u5165\/\u7f16\u8f91\u5a92\u4f53',
"Alternative source": "\u955c\u50cf", 'Alternative source': '\u955c\u50cf',
"Poster": "\u5c01\u9762", Poster: '\u5c01\u9762',
"Paste your embed code below:": "\u5c06\u5185\u5d4c\u4ee3\u7801\u7c98\u8d34\u5728\u4e0b\u9762:", 'Paste your embed code below:': '\u5c06\u5185\u5d4c\u4ee3\u7801\u7c98\u8d34\u5728\u4e0b\u9762:',
"Embed": "\u5185\u5d4c", Embed: '\u5185\u5d4c',
"Media": "\u5a92\u4f53", Media: '\u5a92\u4f53',
"Nonbreaking space": "\u4e0d\u95f4\u65ad\u7a7a\u683c", 'Nonbreaking space': '\u4e0d\u95f4\u65ad\u7a7a\u683c',
"Page break": "\u5206\u9875\u7b26", 'Page break': '\u5206\u9875\u7b26',
"Paste as text": "\u7c98\u8d34\u4e3a\u6587\u672c", 'Paste as text': '\u7c98\u8d34\u4e3a\u6587\u672c',
"Preview": "\u9884\u89c8", Preview: '\u9884\u89c8',
"Print": "\u6253\u5370", Print: '\u6253\u5370',
"Save": "\u4fdd\u5b58", Save: '\u4fdd\u5b58',
"Find": "\u67e5\u627e", Find: '\u67e5\u627e',
"Replace with": "\u66ff\u6362\u4e3a", 'Replace with': '\u66ff\u6362\u4e3a',
"Replace": "\u66ff\u6362", Replace: '\u66ff\u6362',
"Replace all": "\u5168\u90e8\u66ff\u6362", 'Replace all': '\u5168\u90e8\u66ff\u6362',
"Prev": "\u4e0a\u4e00\u4e2a", Prev: '\u4e0a\u4e00\u4e2a',
"Next": "\u4e0b\u4e00\u4e2a", Next: '\u4e0b\u4e00\u4e2a',
"Find and replace": "\u67e5\u627e\u548c\u66ff\u6362", 'Find and replace': '\u67e5\u627e\u548c\u66ff\u6362',
"Could not find the specified string.": "\u672a\u627e\u5230\u641c\u7d22\u5185\u5bb9.", 'Could not find the specified string.': '\u672a\u627e\u5230\u641c\u7d22\u5185\u5bb9.',
"Match case": "\u533a\u5206\u5927\u5c0f\u5199", 'Match case': '\u533a\u5206\u5927\u5c0f\u5199',
"Whole words": "\u5168\u5b57\u5339\u914d", 'Whole words': '\u5168\u5b57\u5339\u914d',
"Spellcheck": "\u62fc\u5199\u68c0\u67e5", Spellcheck: '\u62fc\u5199\u68c0\u67e5',
"Ignore": "\u5ffd\u7565", Ignore: '\u5ffd\u7565',
"Ignore all": "\u5168\u90e8\u5ffd\u7565", 'Ignore all': '\u5168\u90e8\u5ffd\u7565',
"Finish": "\u5b8c\u6210", Finish: '\u5b8c\u6210',
"Add to Dictionary": "\u6dfb\u52a0\u5230\u5b57\u5178", 'Add to Dictionary': '\u6dfb\u52a0\u5230\u5b57\u5178',
"Insert table": "\u63d2\u5165\u8868\u683c", 'Insert table': '\u63d2\u5165\u8868\u683c',
"Table properties": "\u8868\u683c\u5c5e\u6027", 'Table properties': '\u8868\u683c\u5c5e\u6027',
"Delete table": "\u5220\u9664\u8868\u683c", 'Delete table': '\u5220\u9664\u8868\u683c',
"Cell": "\u5355\u5143\u683c", Cell: '\u5355\u5143\u683c',
"Row": "\u884c", Row: '\u884c',
"Column": "\u5217", Column: '\u5217',
"Cell properties": "\u5355\u5143\u683c\u5c5e\u6027", 'Cell properties': '\u5355\u5143\u683c\u5c5e\u6027',
"Merge cells": "\u5408\u5e76\u5355\u5143\u683c", 'Merge cells': '\u5408\u5e76\u5355\u5143\u683c',
"Split cell": "\u62c6\u5206\u5355\u5143\u683c", 'Split cell': '\u62c6\u5206\u5355\u5143\u683c',
"Insert row before": "\u5728\u4e0a\u65b9\u63d2\u5165", 'Insert row before': '\u5728\u4e0a\u65b9\u63d2\u5165',
"Insert row after": "\u5728\u4e0b\u65b9\u63d2\u5165", 'Insert row after': '\u5728\u4e0b\u65b9\u63d2\u5165',
"Delete row": "\u5220\u9664\u884c", 'Delete row': '\u5220\u9664\u884c',
"Row properties": "\u884c\u5c5e\u6027", 'Row properties': '\u884c\u5c5e\u6027',
"Cut row": "\u526a\u5207\u884c", 'Cut row': '\u526a\u5207\u884c',
"Copy row": "\u590d\u5236\u884c", 'Copy row': '\u590d\u5236\u884c',
"Paste row before": "\u7c98\u8d34\u5230\u4e0a\u65b9", 'Paste row before': '\u7c98\u8d34\u5230\u4e0a\u65b9',
"Paste row after": "\u7c98\u8d34\u5230\u4e0b\u65b9", 'Paste row after': '\u7c98\u8d34\u5230\u4e0b\u65b9',
"Insert column before": "\u5728\u5de6\u4fa7\u63d2\u5165", 'Insert column before': '\u5728\u5de6\u4fa7\u63d2\u5165',
"Insert column after": "\u5728\u53f3\u4fa7\u63d2\u5165", 'Insert column after': '\u5728\u53f3\u4fa7\u63d2\u5165',
"Delete column": "\u5220\u9664\u5217", 'Delete column': '\u5220\u9664\u5217',
"Cols": "\u5217", Cols: '\u5217',
"Rows": "\u884c", Rows: '\u884c',
"Width": "\u5bbd", Width: '\u5bbd',
"Height": "\u9ad8", Height: '\u9ad8',
"Cell spacing": "\u5355\u5143\u683c\u5916\u95f4\u8ddd", 'Cell spacing': '\u5355\u5143\u683c\u5916\u95f4\u8ddd',
"Cell padding": "\u5355\u5143\u683c\u5185\u8fb9\u8ddd", 'Cell padding': '\u5355\u5143\u683c\u5185\u8fb9\u8ddd',
"Caption": "\u6807\u9898", Caption: '\u6807\u9898',
"Left": "\u5de6\u5bf9\u9f50", Left: '\u5de6\u5bf9\u9f50',
"Center": "\u5c45\u4e2d", Center: '\u5c45\u4e2d',
"Right": "\u53f3\u5bf9\u9f50", Right: '\u53f3\u5bf9\u9f50',
"Cell type": "\u5355\u5143\u683c\u7c7b\u578b", 'Cell type': '\u5355\u5143\u683c\u7c7b\u578b',
"Scope": "\u8303\u56f4", Scope: '\u8303\u56f4',
"Alignment": "\u5bf9\u9f50\u65b9\u5f0f", Alignment: '\u5bf9\u9f50\u65b9\u5f0f',
"H Align": "\u6c34\u5e73\u5bf9\u9f50", 'H Align': '\u6c34\u5e73\u5bf9\u9f50',
"V Align": "\u5782\u76f4\u5bf9\u9f50", 'V Align': '\u5782\u76f4\u5bf9\u9f50',
"Top": "\u9876\u90e8\u5bf9\u9f50", Top: '\u9876\u90e8\u5bf9\u9f50',
"Middle": "\u5782\u76f4\u5c45\u4e2d", Middle: '\u5782\u76f4\u5c45\u4e2d',
"Bottom": "\u5e95\u90e8\u5bf9\u9f50", Bottom: '\u5e95\u90e8\u5bf9\u9f50',
"Header cell": "\u8868\u5934\u5355\u5143\u683c", 'Header cell': '\u8868\u5934\u5355\u5143\u683c',
"Row group": "\u884c\u7ec4", 'Row group': '\u884c\u7ec4',
"Column group": "\u5217\u7ec4", 'Column group': '\u5217\u7ec4',
"Row type": "\u884c\u7c7b\u578b", 'Row type': '\u884c\u7c7b\u578b',
"Header": "\u8868\u5934", Header: '\u8868\u5934',
"Body": "\u8868\u4f53", Body: '\u8868\u4f53',
"Footer": "\u8868\u5c3e", Footer: '\u8868\u5c3e',
"Border color": "\u8fb9\u6846\u989c\u8272", 'Border color': '\u8fb9\u6846\u989c\u8272',
"Insert template": "\u63d2\u5165\u6a21\u677f", 'Insert template': '\u63d2\u5165\u6a21\u677f',
"Templates": "\u6a21\u677f", Templates: '\u6a21\u677f',
"Template": "\u6a21\u677f", Template: '\u6a21\u677f',
"Text color": "\u6587\u5b57\u989c\u8272", 'Text color': '\u6587\u5b57\u989c\u8272',
"Background color": "\u80cc\u666f\u8272", 'Background color': '\u80cc\u666f\u8272',
"Custom...": "\u81ea\u5b9a\u4e49...", 'Custom...': '\u81ea\u5b9a\u4e49...',
"Custom color": "\u81ea\u5b9a\u4e49\u989c\u8272", 'Custom color': '\u81ea\u5b9a\u4e49\u989c\u8272',
"No color": "\u65e0", 'No color': '\u65e0',
"Table of Contents": "\u5185\u5bb9\u5217\u8868", 'Table of Contents': '\u5185\u5bb9\u5217\u8868',
"Show blocks": "\u663e\u793a\u533a\u5757\u8fb9\u6846", 'Show blocks': '\u663e\u793a\u533a\u5757\u8fb9\u6846',
"Show invisible characters": "\u663e\u793a\u4e0d\u53ef\u89c1\u5b57\u7b26", 'Show invisible characters': '\u663e\u793a\u4e0d\u53ef\u89c1\u5b57\u7b26',
"Words: {0}": "\u5b57\u6570\uff1a{0}", 'Words: {0}': '\u5b57\u6570\uff1a{0}',
"{0} words": "{0} \u5b57", '{0} words': '{0} \u5b57',
"File": "\u6587\u4ef6", File: '\u6587\u4ef6',
"Edit": "\u7f16\u8f91", Edit: '\u7f16\u8f91',
"Insert": "\u63d2\u5165", Insert: '\u63d2\u5165',
"View": "\u89c6\u56fe", View: '\u89c6\u56fe',
"Format": "\u683c\u5f0f", Format: '\u683c\u5f0f',
"Table": "\u8868\u683c", Table: '\u8868\u683c',
"Tools": "\u5de5\u5177", Tools: '\u5de5\u5177',
"Powered by {0}": "\u7531{0}\u9a71\u52a8", 'Powered by {0}': '\u7531{0}\u9a71\u52a8',
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "\u5728\u7f16\u8f91\u533a\u6309ALT-F9\u6253\u5f00\u83dc\u5355\uff0c\u6309ALT-F10\u6253\u5f00\u5de5\u5177\u680f\uff0c\u6309ALT-0\u67e5\u770b\u5e2e\u52a9" 'Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help': '\u5728\u7f16\u8f91\u533a\u6309ALT-F9\u6253\u5f00\u83dc\u5355\uff0c\u6309ALT-F10\u6253\u5f00\u5de5\u5177\u680f\uff0c\u6309ALT-0\u67e5\u770b\u5e2e\u52a9'
}); })
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -5
View File
@@ -12,11 +12,11 @@
export default { export default {
data () { data () {
return { return {
locale: zhCN, locale: zhCN
} }
}, },
created () { created () {
let that = this const that = this
enquireScreen(deviceType => { enquireScreen(deviceType => {
// tablet // tablet
if (deviceType === 0) { if (deviceType === 0) {
@@ -27,12 +27,10 @@
else if (deviceType === 1) { else if (deviceType === 1) {
that.$store.commit('TOGGLE_DEVICE', 'mobile') that.$store.commit('TOGGLE_DEVICE', 'mobile')
that.$store.dispatch('setSidebar', false) that.$store.dispatch('setSidebar', false)
} } else {
else {
that.$store.commit('TOGGLE_DEVICE', 'desktop') that.$store.commit('TOGGLE_DEVICE', 'desktop')
that.$store.dispatch('setSidebar', true) that.$store.dispatch('setSidebar', true)
} }
}) })
} }
} }
+6 -8
View File
@@ -9,22 +9,20 @@ import Vue from 'vue'
*/ */
export function httpGroupRequest (getPromise, groupId, expire = 1000 * 30) { export function httpGroupRequest (getPromise, groupId, expire = 1000 * 30) {
if (groupId == null || groupId === '') { if (groupId == null || groupId === '') {
console.log("--------popup----------getFrom DB-------with---no--groupId ") console.log('--------popup----------getFrom DB-------with---no--groupId ')
return getPromise() return getPromise()
} }
if (Vue.ls.get(groupId)) { if (Vue.ls.get(groupId)) {
console.log("---------popup--------getFrom Cache--------groupId = " + groupId) console.log('---------popup--------getFrom Cache--------groupId = ' + groupId)
return Promise.resolve(Vue.ls.get(groupId)); return Promise.resolve(Vue.ls.get(groupId))
} else { } else {
console.log("--------popup----------getFrom DB---------groupId = " + groupId) console.log('--------popup----------getFrom DB---------groupId = ' + groupId)
} }
// 还没有发出请求,就发出第一次的请求 // 还没有发出请求,就发出第一次的请求
return getPromise().then(res => { return getPromise().then(res => {
Vue.ls.set(groupId, res, expire); Vue.ls.set(groupId, res, expire)
return Promise.resolve(res); return Promise.resolve(res)
}) })
} }
+56 -59
View File
@@ -1,101 +1,101 @@
import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage' import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'
import Vue from 'vue' import Vue from 'vue'
import {UI_CACHE_DB_DICT_DATA } from "@/store/mutation-types" import { UI_CACHE_DB_DICT_DATA } from '@/store/mutation-types'
// 角色管理 // 角色管理
const addRole = (params)=>postAction("/sys/role/add",params); const addRole = (params) => postAction('/sys/role/add', params)
const editRole = (params)=>putAction("/sys/role/edit",params); const editRole = (params) => putAction('/sys/role/edit', params)
const checkRoleCode = (params)=>getAction("/sys/role/checkRoleCode",params); const checkRoleCode = (params) => getAction('/sys/role/checkRoleCode', params)
const queryall = (params)=>getAction("/sys/role/queryall",params); const queryall = (params) => getAction('/sys/role/queryall', params)
// 用户管理 // 用户管理
const addUser = (params)=>postAction("/sys/user/add",params); const addUser = (params) => postAction('/sys/user/add', params)
const editUser = (params)=>putAction("/sys/user/edit",params); const editUser = (params) => putAction('/sys/user/edit', params)
const queryUserRole = (params)=>getAction("/sys/user/queryUserRole",params); const queryUserRole = (params) => getAction('/sys/user/queryUserRole', params)
const getUserList = (params)=>getAction("/sys/user/page",params); const getUserList = (params) => getAction('/sys/user/page', params)
const frozenBatch = (params)=>putAction("/sys/user/frozenBatch",params); const frozenBatch = (params) => putAction('/sys/user/frozenBatch', params)
// 验证用户是否存在 // 验证用户是否存在
const checkOnlyUser = (params)=>getAction("/sys/user/checkOnlyUser",params); const checkOnlyUser = (params) => getAction('/sys/user/checkOnlyUser', params)
// 改变密码 // 改变密码
const changePassword = (params)=>putAction("/sys/user/changePassword",params); const changePassword = (params) => putAction('/sys/user/changePassword', params)
// 权限管理 // 权限管理
const addPermission= (params)=>postAction("/sys/permission/add",params); const addPermission = (params) => postAction('/sys/permission/add', params)
const editPermission= (params)=>putAction("/sys/permission/edit",params); const editPermission = (params) => putAction('/sys/permission/edit', params)
const getPermissionList = (params)=>getAction("/sys/permission/page",params); const getPermissionList = (params) => getAction('/sys/permission/page', params)
const getSystemMenuList = (params)=>getAction("/sys/permission/getSystemMenuList",params); const getSystemMenuList = (params) => getAction('/sys/permission/getSystemMenuList', params)
const getSystemSubmenu = (params)=>getAction("/sys/permission/getSystemSubmenu",params); const getSystemSubmenu = (params) => getAction('/sys/permission/getSystemSubmenu', params)
const getSystemSubmenuBatch = (params) => getAction('/sys/permission/getSystemSubmenuBatch', params) const getSystemSubmenuBatch = (params) => getAction('/sys/permission/getSystemSubmenuBatch', params)
const queryTreeList = (params)=>getAction("/sys/permission/queryTreeList",params); const queryTreeList = (params) => getAction('/sys/permission/queryTreeList', params)
const queryTreeListForRole = (params)=>getAction("/sys/role/queryTreeList",params); const queryTreeListForRole = (params) => getAction('/sys/role/queryTreeList', params)
const queryListAsync = (params)=>getAction("/sys/permission/queryListAsync",params); const queryListAsync = (params) => getAction('/sys/permission/queryListAsync', params)
const queryRolePermission = (params)=>getAction("/sys/permission/queryRolePermission",params); const queryRolePermission = (params) => getAction('/sys/permission/queryRolePermission', params)
const saveRolePermission = (params)=>postAction("/sys/permission/saveRolePermission",params); const saveRolePermission = (params) => postAction('/sys/permission/saveRolePermission', params)
const queryPermissionsByUser = ()=>getAction("/sys/permission/getUserPermissionByToken"); const queryPermissionsByUser = () => getAction('/sys/permission/getUserPermissionByToken')
const loadAllRoleIds = (params)=>getAction("/sys/permission/loadAllRoleIds",params); const loadAllRoleIds = (params) => getAction('/sys/permission/loadAllRoleIds', params)
const getPermissionRuleList = (params)=>getAction("/sys/permission/getPermRuleListByPermId",params); const getPermissionRuleList = (params) => getAction('/sys/permission/getPermRuleListByPermId', params)
const queryPermissionRule = (params)=>getAction("/sys/permission/queryPermissionRule",params); const queryPermissionRule = (params) => getAction('/sys/permission/queryPermissionRule', params)
// 部门管理 // 部门管理
const queryDepartTreeList = (params)=>getAction("/sys/sysDepart/queryTreeList",params); const queryDepartTreeList = (params) => getAction('/sys/sysDepart/queryTreeList', params)
const queryDepartTreeSync = (params)=>getAction("/sys/sysDepart/queryDepartTreeSync",params); const queryDepartTreeSync = (params) => getAction('/sys/sysDepart/queryDepartTreeSync', params)
const queryIdTree = (params)=>getAction("/sys/sysDepart/queryIdTree",params); const queryIdTree = (params) => getAction('/sys/sysDepart/queryIdTree', params)
const queryParentName = (params)=>getAction("/sys/sysDepart/queryParentName",params); const queryParentName = (params) => getAction('/sys/sysDepart/queryParentName', params)
const searchByKeywords = (params)=>getAction("/sys/sysDepart/searchBy",params); const searchByKeywords = (params) => getAction('/sys/sysDepart/searchBy', params)
const deleteByDepartId = (params)=>deleteAction("/sys/sysDepart/delete",params); const deleteByDepartId = (params) => deleteAction('/sys/sysDepart/delete', params)
// 二级部门管理 // 二级部门管理
const queryDepartPermission = (params)=>getAction("/sys/permission/queryDepartPermission",params); const queryDepartPermission = (params) => getAction('/sys/permission/queryDepartPermission', params)
const saveDepartPermission = (params)=>postAction("/sys/permission/saveDepartPermission",params); const saveDepartPermission = (params) => postAction('/sys/permission/saveDepartPermission', params)
const queryTreeListForDeptRole = (params)=>getAction("/sys/sysDepartPermission/queryTreeListForDeptRole",params); const queryTreeListForDeptRole = (params) => getAction('/sys/sysDepartPermission/queryTreeListForDeptRole', params)
const queryDeptRolePermission = (params)=>getAction("/sys/sysDepartPermission/queryDeptRolePermission",params); const queryDeptRolePermission = (params) => getAction('/sys/sysDepartPermission/queryDeptRolePermission', params)
const queryMyDepartTreeList = (params)=>getAction("/sys/sysDepart/queryMyDeptTreeList",params); const queryMyDepartTreeList = (params) => getAction('/sys/sysDepart/queryMyDeptTreeList', params)
// 日志管理 // 日志管理
const deleteLog = (params)=>deleteAction("/sys/log/delete",params); const deleteLog = (params) => deleteAction('/sys/log/delete', params)
const deleteLogList = (params)=>deleteAction("/sys/log/deleteBatch",params); const deleteLogList = (params) => deleteAction('/sys/log/deleteBatch', params)
// 数据字典 // 数据字典
const addDict = (params)=>postAction("/sys/dict/add",params); const addDict = (params) => postAction('/sys/dict/add', params)
const editDict = (params)=>putAction("/sys/dict/edit",params); const editDict = (params) => putAction('/sys/dict/edit', params)
const treeList = (params)=>getAction("/sys/dict/treeList",params); const treeList = (params) => getAction('/sys/dict/treeList', params)
const addDictItem = (params)=>postAction("/sys/dictItem/add",params); const addDictItem = (params) => postAction('/sys/dictItem/add', params)
const editDictItem = (params)=>putAction("/sys/dictItem/edit",params); const editDictItem = (params) => putAction('/sys/dictItem/edit', params)
// 字典标签专用(通过code获取字典数组) // 字典标签专用(通过code获取字典数组)
export const ajaxGetDictItems = (code, params)=>getAction(`/sys/dict/getDictItems/${code}`,params); export const ajaxGetDictItems = (code, params) => getAction(`/sys/dict/getDictItems/${code}`, params)
// 从缓存中获取字典配置 // 从缓存中获取字典配置
function getDictItemsFromCache (dictCode) { function getDictItemsFromCache (dictCode) {
if (Vue.ls.get(UI_CACHE_DB_DICT_DATA) && Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]) { if (Vue.ls.get(UI_CACHE_DB_DICT_DATA) && Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]) {
let dictItems = Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]; const dictItems = Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]
return dictItems; return dictItems
} }
} }
// 系统通告 // 系统通告
const doReleaseData = (params)=>getAction("/sys/annountCement/doReleaseData",params); const doReleaseData = (params) => getAction('/sys/annountCement/doReleaseData', params)
const doReovkeData = (params)=>getAction("/sys/annountCement/doReovkeData",params); const doReovkeData = (params) => getAction('/sys/annountCement/doReovkeData', params)
// 获取系统访问量 // 获取系统访问量
const getLoginfo = (params)=>getAction("/sys/loginfo",params); const getLoginfo = (params) => getAction('/sys/loginfo', params)
const getVisitInfo = (params)=>getAction("/sys/visitInfo",params); const getVisitInfo = (params) => getAction('/sys/visitInfo', params)
// 根据部门主键查询用户信息 // 根据部门主键查询用户信息
const queryUserByDepId = (params)=>getAction("/sys/user/queryUserByDepId",params); const queryUserByDepId = (params) => getAction('/sys/user/queryUserByDepId', params)
// 重复校验 // 重复校验
const duplicateCheck = (params)=>getAction("/sys/duplicate/check",params); const duplicateCheck = (params) => getAction('/sys/duplicate/check', params)
// 加载分类字典 // 加载分类字典
const loadCategoryData = (params)=>getAction("/sys/category/loadAllData",params); const loadCategoryData = (params) => getAction('/sys/category/loadAllData', params)
const checkRuleByCode = (params) => getAction('/sys/checkRule/checkByCode', params) const checkRuleByCode = (params) => getAction('/sys/checkRule/checkByCode', params)
// 加载我的通告信息 // 加载我的通告信息
const getUserNoticeInfo= (params)=>getAction("/sys/sysAnnouncementSend/getMyAnnouncementSend",params); const getUserNoticeInfo = (params) => getAction('/sys/sysAnnouncementSend/getMyAnnouncementSend', params)
const getTransitURL = url => `/sys/common/transitRESTful?url=${encodeURIComponent(url)}` const getTransitURL = url => `/sys/common/transitRESTful?url=${encodeURIComponent(url)}`
// 中转HTTP请求 // 中转HTTP请求
export const transitRESTful = { export const transitRESTful = {
get: (url, parameter) => getAction(getTransitURL(url), parameter), get: (url, parameter) => getAction(getTransitURL(url), parameter),
post: (url, parameter) => postAction(getTransitURL(url), parameter), post: (url, parameter) => postAction(getTransitURL(url), parameter),
put: (url, parameter) => putAction(getTransitURL(url), parameter), put: (url, parameter) => putAction(getTransitURL(url), parameter),
http: (url, parameter) => httpAction(getTransitURL(url), parameter), http: (url, parameter) => httpAction(getTransitURL(url), parameter)
} }
export { export {
@@ -154,6 +154,3 @@ export {
getUserNoticeInfo, getUserNoticeInfo,
getDictItemsFromCache getDictItemsFromCache
} }
+16 -16
View File
@@ -1,6 +1,6 @@
import Vue from 'vue' import Vue from 'vue'
import { axios } from '@/utils/request' import { axios } from '@/utils/request'
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from '@/store/mutation-types'
import signMd5Utils from '@/utils/encryption/signMd5Utils' import signMd5Utils from '@/utils/encryption/signMd5Utils'
const api = { const api = {
@@ -15,9 +15,9 @@ export default api
// post // post
export function postAction (url, parameter) { export function postAction (url, parameter) {
let sign = signMd5Utils.getSign(url, parameter); const sign = signMd5Utils.getSign(url, parameter)
// 将签名和时间戳,添加在请求接口 Header // 将签名和时间戳,添加在请求接口 Header
let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getDateTimeToString()}; const signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getDateTimeToString() }
return axios({ return axios({
url: url, url: url,
@@ -29,9 +29,9 @@ export function postAction(url,parameter) {
// post method= {post | put} // post method= {post | put}
export function httpAction (url, parameter, method) { export function httpAction (url, parameter, method) {
let sign = signMd5Utils.getSign(url, parameter); const sign = signMd5Utils.getSign(url, parameter)
// 将签名和时间戳,添加在请求接口 Header // 将签名和时间戳,添加在请求接口 Header
let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getDateTimeToString()}; const signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getDateTimeToString() }
return axios({ return axios({
url: url, url: url,
@@ -52,9 +52,9 @@ export function putAction(url,parameter) {
// get // get
export function getAction (url, parameter) { export function getAction (url, parameter) {
let sign = signMd5Utils.getSign(url, parameter); const sign = signMd5Utils.getSign(url, parameter)
// 将签名和时间戳,添加在请求接口 Header // 将签名和时间戳,添加在请求接口 Header
let signHeader = {"X-Sign": sign,"X-TIMESTAMP": signMd5Utils.getDateTimeToString()}; const signHeader = { 'X-Sign': sign, 'X-TIMESTAMP': signMd5Utils.getDateTimeToString() }
return axios({ return axios({
url: url, url: url,
@@ -140,14 +140,14 @@ export function downFile(url,parameter){
export function downloadFile (url, fileName, parameter) { export function downloadFile (url, fileName, parameter) {
return downFile(url, parameter).then((data) => { return downFile(url, parameter).then((data) => {
if (!data || data.size === 0) { if (!data || data.size === 0) {
Vue.prototype['$message'].warning('文件下载失败') Vue.prototype.$message.warning('文件下载失败')
return return
} }
if (typeof window.navigator.msSaveBlob !== 'undefined') { if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data]), fileName) window.navigator.msSaveBlob(new Blob([data]), fileName)
} else { } else {
let url = window.URL.createObjectURL(new Blob([data])) const url = window.URL.createObjectURL(new Blob([data]))
let link = document.createElement('a') const link = document.createElement('a')
link.style.display = 'none' link.style.display = 'none'
link.href = url link.href = url
link.setAttribute('download', fileName) link.setAttribute('download', fileName)
@@ -171,8 +171,8 @@ export function uploadAction(url,parameter){
data: parameter, data: parameter,
method: 'post', method: 'post',
headers: { headers: {
'Content-Type': 'multipart/form-data', // 文件上传 'Content-Type': 'multipart/form-data' // 文件上传
}, }
}) })
} }
@@ -186,14 +186,14 @@ export function getFileAccessHttpUrl(avatar,subStr) {
if (!subStr) subStr = 'http' if (!subStr) subStr = 'http'
try { try {
if (avatar && avatar.startsWith(subStr)) { if (avatar && avatar.startsWith(subStr)) {
return avatar; return avatar
} else { } else {
if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) { if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) {
let token = Vue.ls.get(ACCESS_TOKEN); const token = Vue.ls.get(ACCESS_TOKEN)
return window._CONFIG['staticDomainURL'] + "/" + avatar + "?token=" + token; return window._CONFIG.staticDomainURL + '/' + avatar + '?token=' + token
} }
} }
} catch (err) { } catch (err) {
return;
} }
} }
+31 -32
View File
@@ -1,77 +1,76 @@
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from '@/store/mutation-types'
import store from '@/store' import store from '@/store'
/** /**
* 单点登录 * 单点登录
*/ */
const init = (callback) => { const init = (callback) => {
if (process.env.VUE_APP_SSO == 'true') { if (process.env.VUE_APP_SSO == 'true') {
console.log("-------单点登录开始-------"); console.log('-------单点登录开始-------')
let token = Vue.ls.get(ACCESS_TOKEN); const token = Vue.ls.get(ACCESS_TOKEN)
let st = getUrlParam("ticket"); const st = getUrlParam('ticket')
let sevice = "http://" + window.location.host + "/"; const sevice = 'http://' + window.location.host + '/'
if (token) { if (token) {
loginSuccess(callback); loginSuccess(callback)
} else { } else {
if (st) { if (st) {
validateSt(st, sevice, callback); validateSt(st, sevice, callback)
} else { } else {
let serviceUrl = encodeURIComponent(sevice); const serviceUrl = encodeURIComponent(sevice)
window.location.href = window._CONFIG['casPrefixUrl'] + "/login?service=" + serviceUrl; window.location.href = window._CONFIG.casPrefixUrl + '/login?service=' + serviceUrl
} }
} }
console.log("-------单点登录结束-------"); console.log('-------单点登录结束-------')
} else { } else {
callback && callback() callback && callback()
} }
}; }
const SSO = { const SSO = {
init: init init: init
}; }
function getUrlParam (paraName) { function getUrlParam (paraName) {
let url = document.location.toString(); const url = document.location.toString()
let arrObj = url.split("?"); const arrObj = url.split('?')
if (arrObj.length > 1) { if (arrObj.length > 1) {
let arrPara = arrObj[1].split("&"); const arrPara = arrObj[1].split('&')
let arr; let arr
for (let i = 0; i < arrPara.length; i++) { for (let i = 0; i < arrPara.length; i++) {
arr = arrPara[i].split("="); arr = arrPara[i].split('=')
if (arr != null && arr[0] == paraName) { if (arr != null && arr[0] == paraName) {
return arr[1]; return arr[1]
} }
} }
return ""; return ''
} } else {
else { return ''
return "";
} }
} }
function validateSt (ticket, service, callback) { function validateSt (ticket, service, callback) {
let params = { const params = {
ticket: ticket, ticket: ticket,
service: service service: service
}; }
store.dispatch('ValidateLogin', params).then(res => { store.dispatch('ValidateLogin', params).then(res => {
// this.departConfirm(res) // this.departConfirm(res)
if (res.success) { if (res.success) {
loginSuccess(callback); loginSuccess(callback)
} else { } else {
let sevice = "http://"+window.location.host+"/"; const sevice = 'http://' + window.location.host + '/'
let serviceUrl = encodeURIComponent(sevice); const serviceUrl = encodeURIComponent(sevice)
window.location.href = window._CONFIG['casPrefixUrl']+"/login?service="+serviceUrl; window.location.href = window._CONFIG.casPrefixUrl + '/login?service=' + serviceUrl
} }
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err)
// that.requestFailed(err); // that.requestFailed(err);
}); })
} }
function loginSuccess (callback) { function loginSuccess (callback) {
callback(); callback()
} }
export default SSO; export default SSO
+1 -2
View File
@@ -5,7 +5,6 @@
<slot></slot> <slot></slot>
<template v-for="item in filterEmpty($slots.default).slice(0, 3)"></template> <template v-for="item in filterEmpty($slots.default).slice(0, 3)"></template>
<template v-if="maxLength > 0 && filterEmpty($slots.default).length > maxLength"> <template v-if="maxLength > 0 && filterEmpty($slots.default).length > maxLength">
<avatar-item :size="size"> <avatar-item :size="size">
<avatar :size="size !== 'mini' && size || 20" :style="excessItemsStyle">{{ `+${maxLength}` }}</avatar> <avatar :size="size !== 'mini' && size || 20" :style="excessItemsStyle">{{ `+${maxLength}` }}</avatar>
@@ -85,7 +84,7 @@
const { prefixCls, size } = this.$props const { prefixCls, size } = this.$props
const classString = { const classString = {
[`${prefixCls}`]: true, [`${prefixCls}`]: true,
[`${size}`]: true, [`${size}`]: true
} }
const items = filterEmpty(this.$slots.default) const items = filterEmpty(this.$slots.default)
const itemsDom = items && items.length ? <ul class={`${prefixCls}-items`}>{ this.getItems(items) }</ul> : null const itemsDom = items && items.length ? <ul class={`${prefixCls}-items`}>{ this.getItems(items) }</ul> : null
+12 -12
View File
@@ -7,11 +7,11 @@
<script> <script>
function fixedZero (val) { function fixedZero (val) {
return val * 1 < 10 ? `0${val}` : val; return val * 1 < 10 ? `0${val}` : val
} }
export default { export default {
name: "CountDown", name: 'CountDown',
props: { props: {
format: { format: {
type: Function, type: Function,
@@ -19,7 +19,7 @@
}, },
target: { target: {
type: [Date, Number], type: [Date, Number],
required: true, required: true
}, },
onEnd: { onEnd: {
type: Function, type: Function,
@@ -38,12 +38,12 @@
}, },
filters: { filters: {
format (time) { format (time) {
const hours = 60 * 60 * 1000; const hours = 60 * 60 * 1000
const minutes = 60 * 1000; const minutes = 60 * 1000
const h = Math.floor(time / hours); const h = Math.floor(time / hours)
const m = Math.floor((time - h * hours) / minutes); const m = Math.floor((time - h * hours) / minutes)
const s = Math.floor((time - h * hours - m * minutes) / 1000); const s = Math.floor((time - h * hours - m * minutes) / 1000)
return `${fixedZero(h)}:${fixedZero(m)}:${fixedZero(s)}` return `${fixedZero(h)}:${fixedZero(m)}:${fixedZero(s)}`
} }
}, },
@@ -53,8 +53,8 @@
}, },
methods: { methods: {
initTime () { initTime () {
let lastTime = 0; let lastTime = 0
let targetTime = 0; let targetTime = 0
this.originTargetTime = this.target this.originTargetTime = this.target
try { try {
if (Object.prototype.toString.call(this.target) === '[object Date]') { if (Object.prototype.toString.call(this.target) === '[object Date]') {
@@ -66,7 +66,7 @@
throw new Error('invalid target prop') throw new Error('invalid target prop')
} }
lastTime = targetTime - new Date().getTime(); lastTime = targetTime - new Date().getTime()
this.lastTime = lastTime < 0 ? 0 : lastTime this.lastTime = lastTime < 0 ? 0 : lastTime
}, },
@@ -78,7 +78,7 @@
clearTimeout(this.timer) clearTimeout(this.timer)
this.lastTime = 0 this.lastTime = 0
if (typeof onEnd === 'function') { if (typeof onEnd === 'function') {
onEnd(); onEnd()
} }
} else { } else {
this.lastTime -= this.interval this.lastTime -= this.interval
@@ -10,11 +10,11 @@
}, },
tooltip: { tooltip: {
type: Boolean, type: Boolean,
default: true, default: true
}, },
length: { length: {
type: Number, type: Number,
default: 25, default: 25
}, },
lines: { lines: {
type: Number, type: Number,
@@ -75,14 +75,14 @@
data () { data () {
return { return {
innerFile: null, innerFile: null,
number:0, number: 0
} }
}, },
computed: { computed: {
/** upload headers */ /** upload headers */
uploadHeaders () { uploadHeaders () {
let {originColumn: col} = this const { originColumn: col } = this
let headers = {} const headers = {}
if (col.token === true) { if (col.token === true) {
headers['X-Access-Token'] = this.$ls.get(ACCESS_TOKEN) headers['X-Access-Token'] = this.$ls.get(ACCESS_TOKEN)
} }
@@ -92,7 +92,7 @@
/** 上传请求地址 */ /** 上传请求地址 */
uploadAction () { uploadAction () {
if (!this.originColumn.action) { if (!this.originColumn.action) {
return window._CONFIG['domianURL'] + '/sys/common/upload' return window._CONFIG.domianURL + '/sys/common/upload'
} else { } else {
return this.originColumn.action return this.originColumn.action
} }
@@ -103,8 +103,8 @@
}, },
ellipsisFileName () { ellipsisFileName () {
let length = 5 const length = 5
let file = this.innerFile const file = this.innerFile
if (!file || !file.name) { if (!file || !file.name) {
return '' return ''
} }
@@ -120,7 +120,7 @@
} else { } else {
return 'message' return 'message'
} }
}, }
}, },
watch: { watch: {
@@ -132,8 +132,8 @@
} else { } else {
this.innerFile = null this.innerFile = null
} }
}, }
}, }
}, },
methods: { methods: {
@@ -147,8 +147,8 @@
} }
// update-end-author:wangshuai date:20201021 for:LOWCOD-969 判断传过来的字段是否存在number,用于控制上传文件 // update-end-author:wangshuai date:20201021 for:LOWCOD-969 判断传过来的字段是否存在number,用于控制上传文件
if (originColumn && originColumn.fieldExtendJson) { if (originColumn && originColumn.fieldExtendJson) {
let json = JSON.parse(originColumn.fieldExtendJson); const json = JSON.parse(originColumn.fieldExtendJson)
this.number = json.uploadnum?json.uploadnum:0; this.number = json.uploadnum ? json.uploadnum : 0
} }
let path = '' let path = ''
if (this.innerFile) { if (this.innerFile) {
@@ -166,9 +166,9 @@
}, },
handleChangeUpload (info) { handleChangeUpload (info) {
let {originColumn: col} = this const { originColumn: col } = this
let {file} = info const { file } = info
let value = { const value = {
name: file.name, name: file.name,
type: file.type, type: file.type,
size: file.size, size: file.size,
@@ -176,24 +176,24 @@
percent: file.percent percent: file.percent
} }
if (file.response) { if (file.response) {
value['responseName'] = file.response[this.responseName] value.responseName = file.response[this.responseName]
} }
if (file.status === 'done') { if (file.status === 'done') {
if (typeof file.response.success === 'boolean') { if (typeof file.response.success === 'boolean') {
if (file.response.success) { if (file.response.success) {
value['path'] = file.response[this.responseName] value.path = file.response[this.responseName]
this.handleChangeCommon(value) this.handleChangeCommon(value)
} else { } else {
value['status'] = 'error' value.status = 'error'
value['message'] = file.response.message || '未知错误' value.message = file.response.message || '未知错误'
} }
} else { } else {
// 考虑到如果设置action上传路径为非jeecg-boot后台,可能不会返回 success 属性的情况,就默认为成功 // 考虑到如果设置action上传路径为非jeecg-boot后台,可能不会返回 success 属性的情况,就默认为成功
value['path'] = file.response[this.responseName] value.path = file.response[this.responseName]
this.handleChangeCommon(value) this.handleChangeCommon(value)
} }
} else if (file.status === 'error') { } else if (file.status === 'error') {
value['message'] = file.response.message || '未知错误' value.message = file.response.message || '未知错误'
} }
this.innerFile = value this.innerFile = value
}, },
@@ -212,14 +212,14 @@
handleClickDeleteFile () { handleClickDeleteFile () {
this.handleChangeCommon(null) this.handleChangeCommon(null)
}, }
}, },
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
switches: { visible: true }, switches: { visible: true },
getValue: value => JVxeUploadCell.enhanced.getValue(value), getValue: value => JVxeUploadCell.enhanced.getValue(value),
setValue: value => JVxeUploadCell.enhanced.setValue(value), setValue: value => JVxeUploadCell.enhanced.setValue(value)
} }
} }
</script> </script>
@@ -78,8 +78,8 @@ export default {
computed: { computed: {
/** upload headers */ /** upload headers */
uploadHeaders () { uploadHeaders () {
let {originColumn: col} = this const { originColumn: col } = this
let headers = {} const headers = {}
if (col.token === true) { if (col.token === true) {
headers['X-Access-Token'] = this.$ls.get(ACCESS_TOKEN) headers['X-Access-Token'] = this.$ls.get(ACCESS_TOKEN)
} }
@@ -89,7 +89,7 @@ export default {
/** 上传请求地址 */ /** 上传请求地址 */
uploadAction () { uploadAction () {
if (!this.originColumn.action) { if (!this.originColumn.action) {
return window._CONFIG['domianURL'] + '/sys/common/upload' return window._CONFIG.domianURL + '/sys/common/upload'
} else { } else {
return this.originColumn.action return this.originColumn.action
} }
@@ -102,10 +102,10 @@ export default {
/** 预览图片地址 */ /** 预览图片地址 */
imgSrc () { imgSrc () {
if (this.innerFile) { if (this.innerFile) {
if (this.innerFile['url']) { if (this.innerFile.url) {
return this.innerFile['url'] return this.innerFile.url
} else if (this.innerFile['path']) { } else if (this.innerFile.path) {
let path = this.innerFile['path'].split(',')[0] const path = this.innerFile.path.split(',')[0]
return getFileAccessHttpUrl(path) return getFileAccessHttpUrl(path)
} }
} }
@@ -118,7 +118,7 @@ export default {
} else { } else {
return 'message' return 'message'
} }
}, }
}, },
watch: { watch: {
@@ -130,8 +130,8 @@ export default {
} else { } else {
this.innerFile = null this.innerFile = null
} }
}, }
}, }
}, },
methods: { methods: {
@@ -145,8 +145,8 @@ export default {
} }
// update-end-author:wangshuai date:20201021 for:LOWCOD-969 判断传过来的字段是否存在number,用于控制上传文件 // update-end-author:wangshuai date:20201021 for:LOWCOD-969 判断传过来的字段是否存在number,用于控制上传文件
if (originColumn && originColumn.fieldExtendJson) { if (originColumn && originColumn.fieldExtendJson) {
let json = JSON.parse(originColumn.fieldExtendJson); const json = JSON.parse(originColumn.fieldExtendJson)
this.number = json.uploadnum?json.uploadnum:0; this.number = json.uploadnum ? json.uploadnum : 0
} }
let path = '' let path = ''
if (this.innerFile) { if (this.innerFile) {
@@ -165,16 +165,16 @@ export default {
// 弹出上传出错详细信息 // 弹出上传出错详细信息
handleClickShowImageError () { handleClickShowImageError () {
let file = this.innerFile || null const file = this.innerFile || null
if (file && file['message']) { if (file && file.message) {
this.$error({title: '上传出错', content: '错误信息:' + file['message'], maskClosable: true}) this.$error({ title: '上传出错', content: '错误信息:' + file.message, maskClosable: true })
} }
}, },
handleChangeUpload (info) { handleChangeUpload (info) {
let {originColumn: col} = this const { originColumn: col } = this
let {file} = info const { file } = info
let value = { const value = {
name: file.name, name: file.name,
type: file.type, type: file.type,
size: file.size, size: file.size,
@@ -182,24 +182,24 @@ export default {
percent: file.percent percent: file.percent
} }
if (file.response) { if (file.response) {
value['responseName'] = file.response[this.responseName] value.responseName = file.response[this.responseName]
} }
if (file.status === 'done') { if (file.status === 'done') {
if (typeof file.response.success === 'boolean') { if (typeof file.response.success === 'boolean') {
if (file.response.success) { if (file.response.success) {
value['path'] = file.response[this.responseName] value.path = file.response[this.responseName]
this.handleChangeCommon(value) this.handleChangeCommon(value)
} else { } else {
value['status'] = 'error' value.status = 'error'
value['message'] = file.response.message || '未知错误' value.message = file.response.message || '未知错误'
} }
} else { } else {
// 考虑到如果设置action上传路径为非jeecg-boot后台,可能不会返回 success 属性的情况,就默认为成功 // 考虑到如果设置action上传路径为非jeecg-boot后台,可能不会返回 success 属性的情况,就默认为成功
value['path'] = file.response[this.responseName] value.path = file.response[this.responseName]
this.handleChangeCommon(value) this.handleChangeCommon(value)
} }
} else if (file.status === 'error') { } else if (file.status === 'error') {
value['message'] = file.response.message || '未知错误' value.message = file.response.message || '未知错误'
} }
this.innerFile = value this.innerFile = value
}, },
@@ -212,14 +212,14 @@ export default {
handleClickDeleteFile () { handleClickDeleteFile () {
this.handleChangeCommon(null) this.handleChangeCommon(null)
}, }
}, },
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
switches: { visible: true }, switches: { visible: true },
getValue: value => JVxeUploadCell.enhanced.getValue(value), getValue: value => JVxeUploadCell.enhanced.getValue(value),
setValue: value => JVxeUploadCell.enhanced.setValue(value), setValue: value => JVxeUploadCell.enhanced.setValue(value)
} }
} }
</script> </script>
@@ -23,9 +23,9 @@
destFields: col.destFields, destFields: col.destFields,
groupId: caseId, groupId: caseId,
param: col.param, param: col.param,
sorter: col.sorter, sorter: col.sorter
}
} }
},
}, },
methods: { methods: {
/** popup回调 */ /** popup回调 */
@@ -35,7 +35,7 @@
let popupValue = value let popupValue = value
if (others && Object.keys(others).length > 0) { if (others && Object.keys(others).length > 0) {
Object.keys(others).forEach(key => { Object.keys(others).forEach(key => {
let currentValue = others[key] const currentValue = others[key]
// 当前列直接赋值,其他列通过vModel赋值 // 当前列直接赋值,其他列通过vModel赋值
if (key === col.key) { if (key === col.key) {
popupValue = currentValue popupValue = currentValue
@@ -45,16 +45,16 @@
}) })
} }
this.handleChangeCommon(popupValue) this.handleChangeCommon(popupValue)
}, }
}, },
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
aopEvents: { aopEvents: {
editActived (event) { editActived (event) {
dispatchEvent.call(this, event, 'ant-input') dispatchEvent.call(this, event, 'ant-input')
}, }
}, }
}, }
} }
</script> </script>
@@ -30,7 +30,7 @@
'j-vxe-radio': true, 'j-vxe-radio': true,
'no-animation': this.scrolling 'no-animation': this.scrolling
} }
}, }
}, },
methods: { methods: {
handleRadioClick (item) { handleRadioClick (item) {
@@ -40,11 +40,11 @@
this.handleChangeCommon(null) this.handleChangeCommon(null)
} }
} }
}, }
}, },
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
switches: {visible: true}, switches: { visible: true }
} }
} }
</script> </script>
@@ -15,7 +15,7 @@ const common = {
return { return {
loading: false, loading: false,
innerSelectValue: null, innerSelectValue: null,
innerOptions: [], innerOptions: []
} }
}, },
/** 公共计算属性 */ /** 公共计算属性 */
@@ -32,9 +32,9 @@ const common = {
}, },
// 是否是异步模式 // 是否是异步模式
isAsync () { isAsync () {
let isAsync = this.originColumn.async const isAsync = this.originColumn.async
return (isAsync != null && isAsync !== '') ? !!isAsync : true return (isAsync != null && isAsync !== '') ? !!isAsync : true
}, }
}, },
/** 公共属性监听 */ /** 公共属性监听 */
watch: { watch: {
@@ -62,7 +62,7 @@ const common = {
if (common.labelMap.has(value)) { if (common.labelMap.has(value)) {
this.innerOptions = cloneObject(common.labelMap.get(value)) this.innerOptions = cloneObject(common.labelMap.get(value))
} else { } else {
let {success, result} = await getAction(`/sys/dict/loadDictItem/${this.dict}`, {key: value}) const { success, result } = await getAction(`/sys/dict/loadDictItem/${this.dict}`, { key: value })
if (success && result && result.length > 0) { if (success && result && result.length > 0) {
this.innerOptions = [{ value: value, text: result[0] }] this.innerOptions = [{ value: value, text: result[0] }]
common.labelMap.set(value, cloneObject(this.innerOptions)) common.labelMap.set(value, cloneObject(this.innerOptions))
@@ -81,31 +81,31 @@ const common = {
// 根据字典Code, 初始化字典数组 // 根据字典Code, 初始化字典数组
let dictStr = '' let dictStr = ''
if (this.dict) { if (this.dict) {
let arr = this.dict.split(',') const arr = this.dict.split(',')
if (arr[0].indexOf('where') > 0) { if (arr[0].indexOf('where') > 0) {
let tbInfo = arr[0].split('where') const tbInfo = arr[0].split('where')
dictStr = tbInfo[0].trim() + ',' + arr[1] + ',' + arr[2] + ',' + encodeURIComponent(tbInfo[1]) dictStr = tbInfo[0].trim() + ',' + arr[1] + ',' + arr[2] + ',' + encodeURIComponent(tbInfo[1])
} else { } else {
dictStr = this.dict dictStr = this.dict
} }
if (this.dict.indexOf(',') === -1) { if (this.dict.indexOf(',') === -1) {
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
let cache = getDictItemsFromCache(this.dict) const cache = getDictItemsFromCache(this.dict)
if (cache) { if (cache) {
this.innerOptions = cache this.innerOptions = cache
return return
} }
} }
let {success, result} = await ajaxGetDictItems(dictStr, null) const { success, result } = await ajaxGetDictItems(dictStr, null)
if (success) { if (success) {
this.innerOptions = result this.innerOptions = result
} }
} }
} }
} }
}, }
}, }
} }
@@ -115,23 +115,23 @@ export const DictSearchSpanCell = {
mixins: [JVxeCellMixins], mixins: [JVxeCellMixins],
data () { data () {
return { return {
...common.data.apply(this), ...common.data.apply(this)
} }
}, },
computed: { computed: {
...common.computed, ...common.computed
}, },
watch: { watch: {
...common.watch, ...common.watch
}, },
methods: { methods: {
...common.methods, ...common.methods
}, },
render (h) { render (h) {
return h('span', {}, [ return h('span', {}, [
filterDictText(this.innerOptions, this.innerSelectValue || this.innerValue) filterDictText(this.innerOptions, this.innerSelectValue || this.innerValue)
]) ])
}, }
} }
// 请求id // 请求id
@@ -169,10 +169,10 @@ export const DictSearchInputCell = {
return null return null
} }
return (input, option) => option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 return (input, option) => option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}, }
}, },
watch: { watch: {
...common.watch, ...common.watch
}, },
created () { created () {
this.loadData = debounce(this.loadData, 300)// 消抖 this.loadData = debounce(this.loadData, 300)// 消抖
@@ -195,7 +195,7 @@ export const DictSearchInputCell = {
if (currentRequestId !== requestId) { if (currentRequestId !== requestId) {
return return
} }
let {success, result, message} = res const { success, result, message } = res
if (success) { if (success) {
this.innerOptions = result this.innerOptions = result
result.forEach((item) => { result.forEach((item) => {
@@ -225,14 +225,14 @@ export const DictSearchInputCell = {
}, },
renderOptionItem () { renderOptionItem () {
let options = [] const options = []
this.options.forEach(({ value, text, label, title, disabled }) => { this.options.forEach(({ value, text, label, title, disabled }) => {
options.push( options.push(
<a-select-option key={value} value={value} disabled={disabled}>{text || label || title}</a-select-option> <a-select-option key={value} value={value} disabled={disabled}>{text || label || title}</a-select-option>
) )
}) })
return options return options
}, }
}, },
render () { render () {
return ( return (
@@ -256,7 +256,7 @@ export const DictSearchInputCell = {
aopEvents: { aopEvents: {
editActived (event) { editActived (event) {
dispatchEvent.call(this, event, 'ant-select') dispatchEvent.call(this, event, 'ant-select')
}, }
}, }
} }
} }
+1 -1
View File
@@ -12,7 +12,7 @@
<script> <script>
export default { export default {
name: "Trend", name: 'Trend',
props: { props: {
prefixCls: { prefixCls: {
type: String, type: String,
+18 -20
View File
@@ -9,37 +9,37 @@ export default class Area {
*/ */
constructor (pcaa) { constructor (pcaa) {
if (!pcaa) { if (!pcaa) {
pcaa = Vue.prototype.$Jpcaa; pcaa = Vue.prototype.$Jpcaa
} }
let arr = [] const arr = []
const province = pcaa['86'] const province = pcaa['86']
Object.keys(province).map(key => { Object.keys(province).map(key => {
arr.push({id:key, text:province[key], pid:'86', index:1}); arr.push({ id: key, text: province[key], pid: '86', index: 1 })
const city = pcaa[key]; const city = pcaa[key]
Object.keys(city).map(key2 => { Object.keys(city).map(key2 => {
arr.push({id:key2, text:city[key2], pid:key, index:2}); arr.push({ id: key2, text: city[key2], pid: key, index: 2 })
const qu = pcaa[key2]; const qu = pcaa[key2]
if (qu) { if (qu) {
Object.keys(qu).map(key3 => { Object.keys(qu).map(key3 => {
arr.push({id:key3, text:qu[key3], pid:key2, index:3}); arr.push({ id: key3, text: qu[key3], pid: key2, index: 3 })
}) })
} }
}) })
}) })
this.all = arr; this.all = arr
} }
get pca () { get pca () {
return this.all; return this.all
} }
getCode (text) { getCode (text) {
if (!text || text.length == 0) { if (!text || text.length == 0) {
return '' return ''
} }
for(let item of this.all){ for (const item of this.all) {
if (item.text === text) { if (item.text === text) {
return item.id; return item.id
} }
} }
} }
@@ -48,19 +48,19 @@ export default class Area {
if (!code || code.length == 0) { if (!code || code.length == 0) {
return '' return ''
} }
let arr = [] const arr = []
this.getAreaBycode(code, arr, 3); this.getAreaBycode(code, arr, 3)
return arr.join('/') return arr.join('/')
} }
getRealCode (code) { getRealCode (code) {
let arr = [] const arr = []
this.getPcode(code, arr, 3) this.getPcode(code, arr, 3)
return arr; return arr
} }
getPcode (id, arr, index) { getPcode (id, arr, index) {
for(let item of this.all){ for (const item of this.all) {
if (item.id === id && item.index == index) { if (item.id === id && item.index == index) {
arr.unshift(id) arr.unshift(id)
if (item.pid != '86') { if (item.pid != '86') {
@@ -71,15 +71,13 @@ export default class Area {
} }
getAreaBycode (code, arr, index) { getAreaBycode (code, arr, index) {
for(let item of this.all){ for (const item of this.all) {
if (item.id === code && item.index == index) { if (item.id === code && item.index == index) {
arr.unshift(item.text); arr.unshift(item.text)
if (item.pid != '86') { if (item.pid != '86') {
this.getAreaBycode(item.pid, arr, --index) this.getAreaBycode(item.pid, arr, --index)
} }
} }
} }
} }
} }
+3 -3
View File
@@ -37,10 +37,10 @@ export const cutStrByFullLength = (str = '', maxLength) => {
// 下划线转换驼峰 // 下划线转换驼峰
export function underLinetoHump (name) { export function underLinetoHump (name) {
return name.replace(/\_(\w)/g, function (all, letter) { return name.replace(/\_(\w)/g, function (all, letter) {
return letter.toUpperCase(); return letter.toUpperCase()
}); })
} }
// 驼峰转换下划线 // 驼峰转换下划线
export function humptoUnderLine (name) { export function humptoUnderLine (name) {
return name.replace(/([A-Z])/g,"_$1").toLowerCase(); return name.replace(/([A-Z])/g, '_$1').toLowerCase()
} }
+4 -4
View File
@@ -25,8 +25,8 @@
dataSource: { dataSource: {
type: Array, type: Array,
default: () => [ default: () => [
{ type: 'JeroOne', 'Jan.': 18.9, 'Feb.': 28.8, 'Mar.': 39.3, 'Apr.': 81.4, 'May': 47, 'Jun.': 20.3, 'Jul.': 24, 'Aug.': 35.6 }, { type: 'JeroOne', 'Jan.': 18.9, 'Feb.': 28.8, 'Mar.': 39.3, 'Apr.': 81.4, May: 47, 'Jun.': 20.3, 'Jul.': 24, 'Aug.': 35.6 },
{ type: 'JeroTwo', 'Jan.': 12.4, 'Feb.': 23.2, 'Mar.': 34.5, 'Apr.': 99.7, 'May': 52.6, 'Jun.': 35.5, 'Jul.': 37.4, 'Aug.': 42.4 } { type: 'JeroTwo', 'Jan.': 12.4, 'Feb.': 23.2, 'Mar.': 34.5, 'Apr.': 99.7, May: 52.6, 'Jun.': 35.5, 'Jul.': 37.4, 'Aug.': 42.4 }
] ]
}, },
fields: { fields: {
@@ -62,7 +62,7 @@
}) })
// bar 使用不了 - 和 / 所以替换下 // bar 使用不了 - 和 / 所以替换下
let rows = dv.rows.map(row => { const rows = dv.rows.map(row => {
if (typeof row.x === 'string') { if (typeof row.x === 'string') {
row.x = row.x.replace(/[-/]/g, '_') row.x = row.x.replace(/[-/]/g, '_')
} }
@@ -70,7 +70,7 @@
}) })
// 替换别名 // 替换别名
rows.forEach(row => { rows.forEach(row => {
for (let item of this.aliases) { for (const item of this.aliases) {
if (item.field === row.type) { if (item.field === row.type) {
row.type = item.alias row.type = item.alias
break break
+30 -30
View File
@@ -45,16 +45,16 @@
</template> </template>
<script> <script>
import { registerShape } from 'viser-vue'; import { registerShape } from 'viser-vue'
registerShape('point', 'pointer', { registerShape('point', 'pointer', {
draw (cfg, container) { draw (cfg, container) {
let point = cfg.points[0]; let point = cfg.points[0]
point = this.parsePoint(point); point = this.parsePoint(point)
const center = this.parsePoint({ const center = this.parsePoint({
x: 0, x: 0,
y: 0, y: 0
}); })
container.addShape('line', { container.addShape('line', {
attrs: { attrs: {
x1: center.x, x1: center.x,
@@ -63,9 +63,9 @@
y2: point.y + 15, y2: point.y + 15,
stroke: cfg.color, stroke: cfg.color,
lineWidth: 5, lineWidth: 5,
lineCap: 'round', lineCap: 'round'
} }
}); })
return container.addShape('circle', { return container.addShape('circle', {
attrs: { attrs: {
x: center.x, x: center.x,
@@ -73,26 +73,26 @@
r: 9.75, r: 9.75,
stroke: cfg.color, stroke: cfg.color,
lineWidth: 4.5, lineWidth: 4.5,
fill: '#fff', fill: '#fff'
} }
}); })
} }
}); })
const scale = [{ const scale = [{
dataKey: 'value', dataKey: 'value',
min: 0, min: 0,
max: 9, max: 9,
tickInterval: 1, tickInterval: 1,
nice: false, nice: false
}]; }]
const data = [ const data = [
{ value: 7.0 }, { value: 7.0 }
]; ]
export default { export default {
name:"DashChartDemo", name: 'DashChartDemo',
props: { props: {
datasource: { datasource: {
type: Number, type: Number,
@@ -105,20 +105,20 @@
}, },
created () { created () {
if (!this.datasource) { if (!this.datasource) {
this.chartData = data; this.chartData = data
} else { } else {
this.chartData = [ this.chartData = [
{ value: this.datasource }, { value: this.datasource }
]; ]
} }
this.getChartData() this.getChartData()
}, },
watch: { watch: {
'datasource': function (val) { datasource: function (val) {
this.chartData = [ this.chartData = [
{ value: val}, { value: val }
]; ]
this.getChartData(); this.getChartData()
} }
}, },
methods: { methods: {
@@ -156,23 +156,23 @@
axisSubTickLine: { axisSubTickLine: {
length: -8, length: -8,
stroke: '#fff', stroke: '#fff',
strokeOpacity: 1, strokeOpacity: 1
}, },
axisTickLine: { axisTickLine: {
length: -17, length: -17,
stroke: '#fff', stroke: '#fff',
strokeOpacity: 1, strokeOpacity: 1
}, },
arcGuide1Start: [0, 0.945], arcGuide1Start: [0, 0.945],
arcGuide1End: [9, 0.945], arcGuide1End: [9, 0.945],
arcGuide1Style: { arcGuide1Style: {
stroke: '#CBCBCB', stroke: '#CBCBCB',
lineWidth: 18, lineWidth: 18
}, },
arcGuide2Start: [0, 0.945], arcGuide2Start: [0, 0.945],
arcGuide2Style: { arcGuide2Style: {
stroke: '#1890FF', stroke: '#1890FF',
lineWidth: 18, lineWidth: 18
}, },
htmlGuidePosition: ['50%', '100%'], htmlGuidePosition: ['50%', '100%'],
htmlGuideHtml: ` htmlGuideHtml: `
@@ -180,8 +180,8 @@
<p style="font-size: 14px;color: #545454;margin: 0;">${this.title}</p> <p style="font-size: 14px;color: #545454;margin: 0;">${this.title}</p>
<p style="font-size: 36px;color: #545454;margin: 0;">${this.abcd}%</p> <p style="font-size: 36px;color: #545454;margin: 0;">${this.abcd}%</p>
</div> </div>
`, `
}; }
}, }
}; }
</script> </script>
+1 -1
View File
@@ -40,7 +40,7 @@
}] }]
export default { export default {
name: "Bar", name: 'Bar',
props: { props: {
title: { title: {
type: String, type: String,
@@ -74,10 +74,10 @@
key: 'x', key: 'x',
value: 'y' value: 'y'
}) })
let rows = dv.rows const rows = dv.rows
// 替换别名 // 替换别名
rows.forEach(row => { rows.forEach(row => {
for (let item of this.aliases) { for (const item of this.aliases) {
if (item.field === row.x) { if (item.field === row.x) {
row.x = item.alias row.x = item.alias
break break
+2 -2
View File
@@ -9,8 +9,8 @@
</template> </template>
<script> <script>
const DataSet = require('@antv/data-set')
import { ChartEventMixins } from './mixins/ChartMixins' import { ChartEventMixins } from './mixins/ChartMixins'
const DataSet = require('@antv/data-set')
export default { export default {
name: 'Pie', name: 'Pie',
@@ -55,7 +55,7 @@
}, },
computed: { computed: {
data () { data () {
let dv = new DataSet.View().source(this.dataSource) const dv = new DataSet.View().source(this.dataSource)
// 计算数据百分比 // 计算数据百分比
dv.transform({ dv.transform({
type: 'percent', type: 'percent',
+1 -1
View File
@@ -13,7 +13,7 @@
<script> <script>
export default { export default {
name: "RankList", name: 'RankList',
// ['title', 'list'] // ['title', 'list']
props: { props: {
title: { title: {
+9 -9
View File
@@ -12,7 +12,7 @@
</template> </template>
<script> <script>
const DataSet = require('@antv/data-set'); const DataSet = require('@antv/data-set')
export default { export default {
name: 'StackBar', name: 'StackBar',
@@ -21,10 +21,10 @@
type: Array, type: Array,
required: true, required: true,
default: () => [ default: () => [
{ 'State': '请假', '流转中': 25, '已归档': 18 }, { State: '请假', 流转中: 25, 已归档: 18 },
{ 'State': '出差', '流转中': 30, '已归档': 20 }, { State: '出差', 流转中: 30, 已归档: 20 },
{ 'State': '加班', '流转中': 38, '已归档': 42}, { State: '加班', 流转中: 38, 已归档: 42 },
{ 'State': '用车', '流转中': 51, '已归档': 67} { State: '用车', 流转中: 51, 已归档: 67 }
] ]
}, },
height: { height: {
@@ -39,15 +39,15 @@
}, },
computed: { computed: {
data () { data () {
const dv = new DataSet.View().source(this.dataSource); const dv = new DataSet.View().source(this.dataSource)
dv.transform({ dv.transform({
type: 'fold', type: 'fold',
fields: ['流转中', '已归档'], fields: ['流转中', '已归档'],
key: '流程状态', key: '流程状态',
value: '流程数量', value: '流程数量',
retains: ['State'], retains: ['State']
}); })
return dv.rows; return dv.rows
} }
} }
} }
+3 -3
View File
@@ -8,7 +8,7 @@
<script> <script>
export default { export default {
name: "Trend", name: 'Trend',
props: { props: {
// 同title // 同title
term: { term: {
@@ -45,8 +45,8 @@
} }
}, },
created () { created () {
let type = this.type === null ? this.value >= this.target : this.type const type = this.type === null ? this.value >= this.target : this.type
this.trend = type ? 'up' : 'down'; this.trend = type ? 'up' : 'down'
this.rate = (this.percentage === null ? Math.abs(this.value - this.target) * 100 / this.target : this.percentage).toFixed(this.fixed) this.rate = (this.percentage === null ? Math.abs(this.value - this.target) * 100 / this.target : this.percentage).toFixed(this.fixed)
} }
} }
@@ -5,6 +5,6 @@ export const ChartEventMixins = {
}, },
handleEvent (eventName, event, chart) { handleEvent (eventName, event, chart) {
this.$emit(eventName, event, chart) this.$emit(eventName, event, chart)
}, }
} }
} }
+13 -13
View File
@@ -21,7 +21,7 @@
import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
export default { export default {
name: "JDictSelectTag", name: 'JDictSelectTag',
props: { props: {
dictCode: String, dictCode: String,
placeholder: String, placeholder: String,
@@ -36,7 +36,7 @@
data () { data () {
return { return {
dictOptions: [], dictOptions: [],
tagType:"" tagType: ''
} }
}, },
watch: { watch: {
@@ -44,12 +44,12 @@
immediate: true, immediate: true,
handler () { handler () {
this.initDictData() this.initDictData()
}, }
} }
}, },
created () { created () {
if(!this.type || this.type==="list"){ if (!this.type || this.type === 'list') {
this.tagType = "select" this.tagType = 'select'
} else { } else {
this.tagType = this.type this.tagType = this.type
} }
@@ -58,36 +58,36 @@
getValueSting () { getValueSting () {
// update-begin author:wangshuai date:20200601 for: 不显示placeholder的文字 ------ // update-begin author:wangshuai date:20200601 for: 不显示placeholder的文字 ------
// 当有null或 placeholder不显示 // 当有null或 placeholder不显示
return this.value != null ? this.value.toString() : undefined; return this.value != null ? this.value.toString() : undefined
// update-end author:wangshuai date:20200601 for: 不显示placeholder的文字 ------ // update-end author:wangshuai date:20200601 for: 不显示placeholder的文字 ------
}, }
}, },
methods: { methods: {
initDictData () { initDictData () {
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
if (getDictItemsFromCache(this.dictCode)) { if (getDictItemsFromCache(this.dictCode)) {
this.dictOptions = getDictItemsFromCache(this.dictCode); this.dictOptions = getDictItemsFromCache(this.dictCode)
return return
} }
// 根据字典Code, 初始化字典数组 // 根据字典Code, 初始化字典数组
ajaxGetDictItems(this.dictCode, null).then((res) => { ajaxGetDictItems(this.dictCode, null).then((res) => {
if (res.success) { if (res.success) {
this.dictOptions = res.result; this.dictOptions = res.result
} }
}) })
}, },
handleInput (e = '') { handleInput (e = '') {
let val; let val
if (Object.keys(e).includes('target')) { if (Object.keys(e).includes('target')) {
val = e.target.value val = e.target.value
} else { } else {
val = e val = e
} }
console.log(val); console.log(val)
this.$emit('change', val); this.$emit('change', val)
// 解决数据规则选择自定义SQL 规则值无法输入空格 // 解决数据规则选择自定义SQL 规则值无法输入空格
this.$emit('input', val); this.$emit('input', val)
}, },
setCurrentDictOptions (dictOptions) { setCurrentDictOptions (dictOptions) {
this.dictOptions = dictOptions this.dictOptions = dictOptions
+27 -27
View File
@@ -14,18 +14,18 @@ import {getAction} from '@/api/manage'
*/ */
export async function initDictOptions (dictCode) { export async function initDictOptions (dictCode) {
if (!dictCode) { if (!dictCode) {
return '字典Code不能为空!'; return '字典Code不能为空!'
} }
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
if (getDictItemsFromCache(dictCode)) { if (getDictItemsFromCache(dictCode)) {
let res = {} const res = {}
res.result = getDictItemsFromCache(dictCode); res.result = getDictItemsFromCache(dictCode)
res.success = true; res.success = true
return res; return res
} }
// 获取字典数组 // 获取字典数组
let res = await ajaxGetDictItems(dictCode); const res = await ajaxGetDictItems(dictCode)
return res; return res
} }
/** /**
@@ -37,7 +37,7 @@ export async function initDictOptions(dictCode) {
export function filterDictText (dictOptions, text) { export function filterDictText (dictOptions, text) {
// --update-begin----author:sunjianlei---date:20200323------for: 字典翻译 text 允许逗号分隔 --- // --update-begin----author:sunjianlei---date:20200323------for: 字典翻译 text 允许逗号分隔 ---
if (text != null && Array.isArray(dictOptions)) { if (text != null && Array.isArray(dictOptions)) {
let result = [] const result = []
// 允许多个逗号分隔允许传数组对象 // 允许多个逗号分隔允许传数组对象
let splitText let splitText
if (Array.isArray(text)) { if (Array.isArray(text)) {
@@ -45,9 +45,9 @@ export function filterDictText(dictOptions, text) {
} else { } else {
splitText = text.toString().trim().split(',') splitText = text.toString().trim().split(',')
} }
for (let txt of splitText) { for (const txt of splitText) {
let dictText = txt let dictText = txt
for (let dictItem of dictOptions) { for (const dictItem of dictOptions) {
if (txt.toString() === dictItem.value.toString()) { if (txt.toString() === dictItem.value.toString()) {
dictText = (dictItem.text || dictItem.title || dictItem.label) dictText = (dictItem.text || dictItem.title || dictItem.label)
break break
@@ -71,7 +71,7 @@ export function filterMultiDictText(dictOptions, text) {
// js !text 认为0为空所以做提前处理 // js !text 认为0为空所以做提前处理
if (text === 0 || text === '0') { if (text === 0 || text === '0') {
if (dictOptions) { if (dictOptions) {
for (let dictItem of dictOptions) { for (const dictItem of dictOptions) {
if (text == dictItem.value) { if (text == dictItem.value) {
return dictItem.text return dictItem.text
} }
@@ -80,25 +80,25 @@ export function filterMultiDictText(dictOptions, text) {
} }
if (!text || text == 'null' || !dictOptions || dictOptions.length == 0) { if (!text || text == 'null' || !dictOptions || dictOptions.length == 0) {
return "" return ''
} }
let re = ""; let re = ''
text = text.toString() text = text.toString()
let arr = text.split(",") const arr = text.split(',')
dictOptions.forEach(function (option) { dictOptions.forEach(function (option) {
if (option) { if (option) {
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
if (arr[i] === option.value) { if (arr[i] === option.value) {
re += option.text+","; re += option.text + ','
break; break
} }
} }
} }
}); })
if(re==""){ if (re == '') {
return text; return text
} }
return re.substring(0,re.length-1); return re.substring(0, re.length - 1)
} }
/** /**
@@ -108,16 +108,16 @@ export function filterMultiDictText(dictOptions, text) {
*/ */
export function filterDictTextByCache (dictCode, key) { export function filterDictTextByCache (dictCode, key) {
if (key == null || key.length == 0) { if (key == null || key.length == 0) {
return; return
} }
if (!dictCode) { if (!dictCode) {
return '字典Code不能为空!'; return '字典Code不能为空!'
} }
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
if (getDictItemsFromCache(dictCode)) { if (getDictItemsFromCache(dictCode)) {
let item = getDictItemsFromCache(dictCode).filter(t => t["value"] == key) const item = getDictItemsFromCache(dictCode).filter(t => t.value == key)
if (item && item.length > 0) { if (item && item.length > 0) {
return item[0]["text"] return item[0].text
} }
} }
} }
@@ -126,14 +126,14 @@ export function filterDictTextByCache(dictCode, key) {
export async function getDictItems (dictCode, params) { export async function getDictItems (dictCode, params) {
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
if (getDictItemsFromCache(dictCode)) { if (getDictItemsFromCache(dictCode)) {
let desformDictItems = getDictItemsFromCache(dictCode).map(item => ({...item, label: item.text})) const desformDictItems = getDictItemsFromCache(dictCode).map(item => ({ ...item, label: item.text }))
return desformDictItems; return desformDictItems
} }
// 缓存中没有就请求后台 // 缓存中没有就请求后台
return await ajaxGetDictItems(dictCode, params).then(({ success, result }) => { return await ajaxGetDictItems(dictCode, params).then(({ success, result }) => {
if (success) { if (success) {
let res = result.map(item => ({...item, label: item.text})) const res = result.map(item => ({ ...item, label: item.text }))
console.log('------- 从DB中获取到了字典-------dictCode : ', dictCode, res) console.log('------- 从DB中获取到了字典-------dictCode : ', dictCode, res)
return Promise.resolve(res) return Promise.resolve(res)
} else { } else {
@@ -39,18 +39,18 @@
type: String, type: String,
default: '', default: '',
required: false required: false
}, }
}, },
data () { data () {
return { return {
dictOptions: [], dictOptions: [],
tagType:"", tagType: '',
arrayValue: !this.value ? [] : this.value.split(this.spliter) arrayValue: !this.value ? [] : this.value.split(this.spliter)
} }
}, },
created () { created () {
if(!this.type || this.type==="list_multi"){ if (!this.type || this.type === 'list_multi') {
this.tagType = "select" this.tagType = 'select'
} else { } else {
this.tagType = this.type this.tagType = this.type
} }
@@ -67,7 +67,7 @@
immediate: true, immediate: true,
handler () { handler () {
this.initDictData() this.initDictData()
}, }
}, },
value (val) { value (val) {
if (!val) { if (!val) {
@@ -83,7 +83,7 @@
this.dictOptions = [...this.options] this.dictOptions = [...this.options]
} else { } else {
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
let cacheOption = getDictItemsFromCache(this.dictCode) const cacheOption = getDictItemsFromCache(this.dictCode)
if (cacheOption && cacheOption.length > 0) { if (cacheOption && cacheOption.length > 0) {
this.dictOptions = cacheOption this.dictOptions = cacheOption
return return
@@ -91,15 +91,14 @@
// 根据字典Code, 初始化字典数组 // 根据字典Code, 初始化字典数组
ajaxGetDictItems(this.dictCode, null).then((res) => { ajaxGetDictItems(this.dictCode, null).then((res) => {
if (res.success) { if (res.success) {
this.dictOptions = res.result; this.dictOptions = res.result
} }
}) })
} }
}, },
onChange (selectedValue) { onChange (selectedValue) {
this.arrayValue = selectedValue; this.arrayValue = selectedValue
this.$emit('change', selectedValue.join(this.spliter)); this.$emit('change', selectedValue.join(this.spliter))
}, },
getParentContainer (node) { getParentContainer (node) {
if (!this.popContainer) { if (!this.popContainer) {
@@ -40,7 +40,7 @@
<script> <script>
import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api' import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
import debounce from 'lodash/debounce'; import debounce from 'lodash/debounce'
import { getAction } from '../../api/manage' import { getAction } from '../../api/manage'
export default { export default {
@@ -53,7 +53,7 @@
async: Boolean, async: Boolean,
placeholder: { placeholder: {
type: String, type: String,
default:"请选择", default: '请选择',
required: false required: false
}, },
popContainer: { popContainer: {
@@ -69,23 +69,23 @@
getPopupContainer: { getPopupContainer: {
type: Function, type: Function,
default: null default: null
}, }
}, },
data () { data () {
this.loadData = debounce(this.loadData, 800);//消抖 this.loadData = debounce(this.loadData, 800)// 消抖
this.lastLoad = 0; this.lastLoad = 0
return { return {
loading: false, loading: false,
selectedValue: [], selectedValue: [],
selectedAsyncValue: [], selectedAsyncValue: [],
options: [], options: []
} }
}, },
created () { created () {
this.initDictData(); this.initDictData()
}, },
watch: { watch: {
"value":{ value: {
immediate: true, immediate: true,
handler (val) { handler (val) {
if (!val) { if (!val) {
@@ -100,12 +100,12 @@
} }
} }
}, },
"dict":{ dict: {
handler () { handler () {
this.initDictData() this.initDictData()
} }
}, },
'dictOptions':{ dictOptions: {
deep: true, deep: true,
handler (val) { handler (val) {
if (val && val.length > 0) { if (val && val.length > 0) {
@@ -118,10 +118,10 @@
initSelectValue () { initSelectValue () {
if (this.async) { if (this.async) {
if (!this.selectedAsyncValue || !this.selectedAsyncValue.key || this.selectedAsyncValue.key != this.value) { if (!this.selectedAsyncValue || !this.selectedAsyncValue.key || this.selectedAsyncValue.key != this.value) {
console.log("这才请求后台") console.log('这才请求后台')
getAction(`/sys/dict/loadDictItem/${this.dict}`, { key: this.value }).then(res => { getAction(`/sys/dict/loadDictItem/${this.dict}`, { key: this.value }).then(res => {
if (res.success) { if (res.success) {
let obj = { const obj = {
key: this.value, key: this.value,
label: res.result label: res.result
} }
@@ -134,7 +134,7 @@
} }
}, },
loadData (value) { loadData (value) {
console.log("数据加载",value) console.log('数据加载', value)
this.lastLoad += 1 this.lastLoad += 1
const currentLoad = this.lastLoad const currentLoad = this.lastLoad
this.options = [] this.options = []
@@ -147,13 +147,11 @@
return return
} }
this.options = res.result this.options = res.result
console.log("我是第一个",res) console.log('我是第一个', res)
} else { } else {
this.$message.warning(res.message) this.$message.warning(res.message)
} }
}) })
}, },
initDictData () { initDictData () {
if (!this.async) { if (!this.async) {
@@ -164,23 +162,23 @@
// 根据字典Code, 初始化字典数组 // 根据字典Code, 初始化字典数组
let dictStr = '' let dictStr = ''
if (this.dict) { if (this.dict) {
let arr = this.dict.split(',') const arr = this.dict.split(',')
if (arr[0].indexOf('where') > 0) { if (arr[0].indexOf('where') > 0) {
let tbInfo = arr[0].split('where') const tbInfo = arr[0].split('where')
dictStr = tbInfo[0].trim() + ',' + arr[1] + ',' + arr[2] + ',' + encodeURIComponent(tbInfo[1]) dictStr = tbInfo[0].trim() + ',' + arr[1] + ',' + arr[2] + ',' + encodeURIComponent(tbInfo[1])
} else { } else {
dictStr = this.dict dictStr = this.dict
} }
if (this.dict.indexOf(",") == -1) { if (this.dict.indexOf(',') == -1) {
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
if (getDictItemsFromCache(this.dictCode)) { if (getDictItemsFromCache(this.dictCode)) {
this.options = getDictItemsFromCache(this.dictCode); this.options = getDictItemsFromCache(this.dictCode)
return return
} }
} }
ajaxGetDictItems(dictStr, null).then((res) => { ajaxGetDictItems(dictStr, null).then((res) => {
if (res.success) { if (res.success) {
this.options = res.result; this.options = res.result
} }
}) })
} }
@@ -202,7 +200,7 @@
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}, },
handleChange (selectedValue) { handleChange (selectedValue) {
console.log("selectedValue",selectedValue) console.log('selectedValue', selectedValue)
this.selectedValue = selectedValue this.selectedValue = selectedValue
this.callback() this.callback()
}, },
@@ -215,13 +213,13 @@
this.selectedAsyncValue = null this.selectedAsyncValue = null
this.selectedValue = null this.selectedValue = null
this.options = null this.options = null
this.loadData("") this.loadData('')
} }
this.callback() this.callback()
// update-end-author:scott date:20201222 for:搜索搜索查询组件删除条件默认下拉还是上次的缓存数据不好 JT-191 // update-end-author:scott date:20201222 for:搜索搜索查询组件删除条件默认下拉还是上次的缓存数据不好 JT-191
}, },
callback () { callback () {
this.$emit('change', this.selectedValue); this.$emit('change', this.selectedValue)
}, },
setCurrentDictOptions (dictOptions) { setCurrentDictOptions (dictOptions) {
this.options = dictOptions this.options = dictOptions
@@ -237,7 +235,7 @@
} else { } else {
return document.querySelector(this.popContainer) return document.querySelector(this.popContainer)
} }
}, }
}, },
model: { model: {
+3 -3
View File
@@ -5,9 +5,9 @@ import { filterMultiDictText,filterDictText,initDictOptions,filterDictTextByCach
export default { export default {
install: function (Vue) { install: function (Vue) {
Vue.component('JDictSelectTag',JDictSelectTag); Vue.component('JDictSelectTag', JDictSelectTag)
Vue.component('JMultiSelectTag',JMultiSelectTag); Vue.component('JMultiSelectTag', JMultiSelectTag)
Vue.component('JSearchSelectTag',JSearchSelectTag); Vue.component('JSearchSelectTag', JSearchSelectTag)
Vue.prototype.$initDictOptions = (dictCode) => initDictOptions(dictCode) Vue.prototype.$initDictOptions = (dictCode) => initDictOptions(dictCode)
Vue.prototype.$filterMultiDictText = (dictOptions, text) => filterMultiDictText(dictOptions, text) Vue.prototype.$filterMultiDictText = (dictOptions, text) => filterMultiDictText(dictOptions, text)
Vue.prototype.$filterDictText = (dictOptions, text) => filterDictText(dictOptions, text) Vue.prototype.$filterDictText = (dictOptions, text) => filterDictText(dictOptions, text)
+14 -14
View File
@@ -64,7 +64,7 @@
}, },
computed: { computed: {
_listeners () { _listeners () {
let listeners = { ...this.$listeners } const listeners = { ...this.$listeners }
// 去掉已使用的事件防止冲突 // 去掉已使用的事件防止冲突
this.usedListeners.forEach(key => { this.usedListeners.forEach(key => {
delete listeners[key] delete listeners[key]
@@ -78,7 +78,7 @@
console.error(`JAreaLinkage的type属性只能接收指定的值${this.enums.type.join('|')}`) console.error(`JAreaLinkage的type属性只能接收指定的值${this.enums.type.join('|')}`)
return this.enums.type[0] return this.enums.type[0]
} }
}, }
}, },
watch: { watch: {
value: { value: {
@@ -86,10 +86,10 @@
handler () { handler () {
this.loadDataByValue(this.value) this.loadDataByValue(this.value)
} }
}, }
}, },
created () { created () {
this.initAreaData(); this.initAreaData()
}, },
methods: { methods: {
@@ -105,19 +105,19 @@
this.innerValue = [] this.innerValue = []
} else { } else {
this.initAreaData() this.initAreaData()
let arr = this.areaData.getRealCode(value) const arr = this.areaData.getRealCode(value)
this.innerValue = arr this.innerValue = arr
} }
this.reload() this.reload()
}, },
/** 通过地区code获取子级 */ /** 通过地区code获取子级 */
loadDataByCode (value) { loadDataByCode (value) {
let options = [] const options = []
let data = this.pcaa[value] const data = this.pcaa[value]
if (data) { if (data) {
for (let key in data) { for (const key in data) {
if (data.hasOwnProperty(key)) { if (data.hasOwnProperty(key)) {
options.push({ value: key, label: data[key], }) options.push({ value: key, label: data[key] })
} }
} }
return options return options
@@ -128,22 +128,22 @@
/** 判断是否有子节点 */ /** 判断是否有子节点 */
hasChildren (options) { hasChildren (options) {
options.forEach(option => { options.forEach(option => {
let data = this.loadDataByCode(option.value) const data = this.loadDataByCode(option.value)
option.isLeaf = data.length === 0 option.isLeaf = data.length === 0
}) })
}, },
handleChange (values) { handleChange (values) {
let value = values[values.length - 1] const value = values[values.length - 1]
this.$emit('change', value) this.$emit('change', value)
}, },
initAreaData () { initAreaData () {
if (!this.areaData) { if (!this.areaData) {
this.areaData = new Area(this.$Jpcaa); this.areaData = new Area(this.$Jpcaa)
}
} }
},
}, },
model: { prop: 'value', event: 'change' }, model: { prop: 'value', event: 'change' }
} }
</script> </script>
@@ -44,7 +44,7 @@
// 是否支持多选 // 是否支持多选
multiple: { multiple: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
loadTriggleChange: { loadTriggleChange: {
type: Boolean, type: Boolean,
@@ -69,13 +69,13 @@
}, },
data () { data () {
return { return {
treeValue:"", treeValue: '',
treeData: [], treeData: [],
url:"/sys/category/loadTreeData", url: '/sys/category/loadTreeData',
view: '/sys/category/loadDictItem/', view: '/sys/category/loadDictItem/',
tableName:"", tableName: '',
text:"", text: '',
code:"", code: ''
} }
}, },
@@ -87,12 +87,12 @@
}, },
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
watch: { watch: {
@@ -100,7 +100,7 @@
this.loadItemByCode() this.loadItemByCode()
}, },
pCode () { pCode () {
this.loadRoot(); this.loadRoot()
} }
}, },
created () { created () {
@@ -112,14 +112,14 @@
methods: { methods: {
/** 加载一级节点 */ /** 加载一级节点 */
loadRoot () { loadRoot () {
let param = { const param = {
pid: this.pid, pid: this.pid,
pcode: !this.pCode ? '0' : this.pCode, pcode: !this.pCode ? '0' : this.pCode,
condition: this.condition condition: this.condition
} }
getAction(this.url, param).then(res => { getAction(this.url, param).then(res => {
if (res.success && res.result) { if (res.success && res.result) {
for(let i of res.result){ for (const i of res.result) {
i.value = i.key i.value = i.key
if (i.leaf == false) { if (i.leaf == false) {
i.isLeaf = false i.isLeaf = false
@@ -129,26 +129,26 @@
} }
this.treeData = [...res.result] this.treeData = [...res.result]
} else { } else {
console.log("树一级节点查询结果-else",res) console.log('树一级节点查询结果-else', res)
} }
}) })
}, },
/** 数据回显 */ /** 数据回显 */
loadItemByCode () { loadItemByCode () {
if(!this.value || this.value=="0"){ if (!this.value || this.value == '0') {
this.treeValue = [] this.treeValue = []
} else { } else {
getAction(this.view, { ids: this.value }).then(res => { getAction(this.view, { ids: this.value }).then(res => {
if (res.success) { if (res.success) {
if (res.result && res.result.length > 0) { if (res.result && res.result.length > 0) {
let values = this.value.split(',') const values = this.value.split(',')
this.treeValue = res.result.map((item, index) => ({ this.treeValue = res.result.map((item, index) => ({
key: values[index], key: values[index],
value: values[index], value: values[index],
label: item label: item
})) }))
this.onLoadTriggleChange(res.result[0]); this.onLoadTriggleChange(res.result[0])
} }
} }
}) })
@@ -161,7 +161,7 @@
} }
}, },
backValue (value, label) { backValue (value, label) {
let obj = {} const obj = {}
if (this.back) { if (this.back) {
obj[this.back] = label obj[this.back] = label
} }
@@ -176,14 +176,14 @@
resolve() resolve()
return return
} }
let pid = treeNode.$vnode.key const pid = treeNode.$vnode.key
let param = { const param = {
pid: pid, pid: pid,
condition: this.condition condition: this.condition
} }
getAction(this.url, param).then(res => { getAction(this.url, param).then(res => {
if (res.success) { if (res.success) {
for(let i of res.result){ for (const i of res.result) {
i.value = i.key i.value = i.key
if (i.leaf == false) { if (i.leaf == false) {
i.isLeaf = false i.isLeaf = false
@@ -200,7 +200,7 @@
}, },
addChildren (pid, children, treeArray) { addChildren (pid, children, treeArray) {
if (treeArray && treeArray.length > 0) { if (treeArray && treeArray.length > 0) {
for(let item of treeArray){ for (const item of treeArray) {
if (item.key == pid) { if (item.key == pid) {
if (!children || children.length == 0) { if (!children || children.length == 0) {
item.isLeaf = true item.isLeaf = true
@@ -220,11 +220,11 @@
/* /*
* 使用$listeners向上暴露事件---和$emit一起使用出现的问题change事件会执行两遍 * 使用$listeners向上暴露事件---和$emit一起使用出现的问题change事件会执行两遍
* 解决办法改变选中时提交的事件名 */ * 解决办法改变选中时提交的事件名 */
this.$emit('change', ''); this.$emit('change', '')
this.treeValue = '' this.treeValue = ''
} else if (Array.isArray(value)) { } else if (Array.isArray(value)) {
let labels = [] const labels = []
let values = value.map(item => { const values = value.map(item => {
labels.push(item.label) labels.push(item.label)
return item.value return item.value
}) })
@@ -239,21 +239,21 @@
return this.treeData return this.treeData
}, },
validateProp () { validateProp () {
let myCondition = this.condition const myCondition = this.condition
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!myCondition) { if (!myCondition) {
resolve();
}else{
try {
let test=JSON.parse(myCondition);
if(typeof test == 'object' && test){
resolve() resolve()
} else { } else {
this.$message.error("组件JTreeSelect-condition传值有误,需要一个json字符串!") try {
const test = JSON.parse(myCondition)
if (typeof test === 'object' && test) {
resolve()
} else {
this.$message.error('组件JTreeSelect-condition传值有误需要一个json字符串!')
reject() reject()
} }
} catch (e) { } catch (e) {
this.$message.error("组件JTreeSelect-condition传值有误需要一个json字符串!") this.$message.error('组件JTreeSelect-condition传值有误需要一个json字符串!')
reject() reject()
} }
} }
+4 -4
View File
@@ -21,7 +21,7 @@
}, },
data () { data () {
return { return {
checkboxArray:!this.value?[]:this.value.split(",") checkboxArray: !this.value ? [] : this.value.split(',')
} }
}, },
watch: { watch: {
@@ -29,14 +29,14 @@
if (!val) { if (!val) {
this.checkboxArray = [] this.checkboxArray = []
} else { } else {
this.checkboxArray = this.value.split(",") this.checkboxArray = this.value.split(',')
} }
} }
}, },
methods: { methods: {
onChange (checkedValues) { onChange (checkedValues) {
this.$emit('change', checkedValues.join(",")); this.$emit('change', checkedValues.join(','))
}, }
}, },
model: { model: {
prop: 'value', prop: 'value',
+9 -9
View File
@@ -196,7 +196,7 @@
// 尝试从父容器获取语法类型 // 尝试从父容器获取语法类型
if (language) { if (language) {
// 获取具体的语法类型对象 // 获取具体的语法类型对象
let modeObj = this._getLanguage(language) const modeObj = this._getLanguage(language)
// 判断父容器传入的语法是否被支持 // 判断父容器传入的语法是否被支持
if (modeObj) { if (modeObj) {
@@ -243,7 +243,7 @@
return autoHeight return autoHeight
}, },
fullScreenParentProps () { fullScreenParentProps () {
let props = { const props = {
class: { class: {
'full-screen-parent': true, 'full-screen-parent': true,
'full-screen': this.fullCoder, 'full-screen': this.fullCoder,
@@ -252,13 +252,13 @@
style: {} style: {}
} }
if (isIE() || isIE11()) { if (isIE() || isIE11()) {
props.style['height'] = '240px' props.style.height = '240px'
} }
if (this.fullCoder) { if (this.fullCoder) {
props.style['z-index'] = this.zIndex props.style['z-index'] = this.zIndex
} }
if (!this.isAutoHeight) { if (!this.isAutoHeight) {
props.style['height'] = (typeof this.height === 'number' ? this.height + 'px' : this.height) props.style.height = (typeof this.height === 'number' ? this.height + 'px' : this.height)
} }
return props return props
} }
@@ -325,16 +325,16 @@
// 在支持的语法类型列表中寻找传入的语法类型 // 在支持的语法类型列表中寻找传入的语法类型
return this.modes.find((mode) => { return this.modes.find((mode) => {
// 所有的值都忽略大小写方便比较 // 所有的值都忽略大小写方便比较
let currentLanguage = language.toLowerCase() const currentLanguage = language.toLowerCase()
let currentLabel = mode.label.toLowerCase() const currentLabel = mode.label.toLowerCase()
let currentValue = mode.value.toLowerCase() const currentValue = mode.value.toLowerCase()
// 由于真实值可能不规范例如 java 的真实值是 x-java 所以讲 value label 同时和传入语法进行比较 // 由于真实值可能不规范例如 java 的真实值是 x-java 所以讲 value label 同时和传入语法进行比较
return currentLabel === currentLanguage || currentValue === currentLanguage return currentLabel === currentLanguage || currentValue === currentLanguage
}) })
}, },
_getCoder () { _getCoder () {
let _this = this const _this = this
return new Promise((resolve) => { return new Promise((resolve) => {
(function get () { (function get () {
if (_this.coder) { if (_this.coder) {
@@ -351,7 +351,7 @@
this.coder.setOption('mode', `text/${val}`) this.coder.setOption('mode', `text/${val}`)
// 获取修改后的语法 // 获取修改后的语法
let label = this._getLanguage(val).label.toLowerCase() const label = this._getLanguage(val).label.toLowerCase()
// 允许父容器通过以下函数监听当前的语法值 // 允许父容器通过以下函数监听当前的语法值
this.$emit('language-change', label) this.$emit('language-change', label)
+6 -6
View File
@@ -8,7 +8,7 @@
</div> </div>
</template> </template>
<script> <script>
import JCronModal from "./modal/JCronModal"; import JCronModal from './modal/JCronModal'
export default { export default {
name: 'JCron', name: 'JCron',
components: { components: {
@@ -17,12 +17,12 @@
props: { props: {
value: { value: {
required: false, required: false,
type: String, type: String
} }
}, },
data () { data () {
return { return {
cron: this.value, cron: this.value
} }
}, },
watch: { watch: {
@@ -32,11 +32,11 @@
}, },
methods: { methods: {
openModal () { openModal () {
this.$refs.innerVueCron.show(); this.$refs.innerVueCron.show()
}, },
handleOK (val) { handleOK (val) {
this.cron = val; this.cron = val
this.$emit("change", this.cron); this.$emit('change', this.cron)
// this.$emit("change", Object.assign({}, this.cron)); // this.$emit("change", Object.assign({}, this.cron));
}, },
handleEmpty () { handleEmpty () {
+9 -9
View File
@@ -97,7 +97,7 @@
} }
}, },
data () { data () {
let dateStr = this.value; const dateStr = this.value
return { return {
yearShowOne: false, // 控制年份模态框的显示与否 yearShowOne: false, // 控制年份模态框的显示与否
year: '', // mode==year 专用 year: '', // mode==year 专用
@@ -107,17 +107,17 @@
computed: { computed: {
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
watch: { watch: {
value (val) { value (val) {
let fm = this.dateFormat const fm = this.dateFormat
moment.prototype.toJSON = function () { moment.prototype.toJSON = function () {
return moment(this).format(fm) return moment(this).format(fm)
} }
@@ -131,7 +131,7 @@
methods: { methods: {
moment, moment,
handleDateChange (mom, dateStr) { handleDateChange (mom, dateStr) {
this.$emit('change', dateStr); this.$emit('change', dateStr)
}, },
handleMonthChange (mom, dateStr) { handleMonthChange (mom, dateStr) {
this.$emit('change', dateStr) this.$emit('change', dateStr)
@@ -146,7 +146,7 @@
// 得到年份选择器的值 // 得到年份选择器的值
panelChangeOne (value) { panelChangeOne (value) {
this.yearShowOne = false this.yearShowOne = false
let year = moment(value,this.dateFormat).year().toString() // 处理成字符串 const year = moment(value, this.dateFormat).year().toString() // 处理成字符串
this.year = value // 组件显示的 this.year = value // 组件显示的
this.$emit('change', year) this.$emit('change', year)
} }
@@ -125,12 +125,12 @@ export default {
week: '?', week: '?',
year: '*', year: '*',
inputValues: { second: '', minute: '', hour: '', day: '', month: '', week: '', year: '', cron: '' }, inputValues: { second: '', minute: '', hour: '', day: '', month: '', week: '', year: '', cron: '' },
preTimeList: '执行预览会忽略年份参数', preTimeList: '执行预览会忽略年份参数'
} }
}, },
computed: { computed: {
cronValue_c () { cronValue_c () {
let result = [] const result = []
if (!this.hideSecond) result.push(this.second ? this.second : '*') if (!this.hideSecond) result.push(this.second ? this.second : '*')
result.push(this.minute ? this.minute : '*') result.push(this.minute ? this.minute : '*')
result.push(this.hour ? this.hour : '*') result.push(this.hour ? this.hour : '*')
@@ -149,7 +149,7 @@ export default {
vs[5] = this.convertQuartzWeekToCParser(vs[5]) vs[5] = this.convertQuartzWeekToCParser(vs[5])
} }
return vs.slice(0, vs.length - 1).join(' ') return vs.slice(0, vs.length - 1).join(' ')
}, }
}, },
watch: { watch: {
cronValue (newVal, oldVal) { cronValue (newVal, oldVal) {
@@ -195,7 +195,7 @@ export default {
if (this.month === '*') { if (this.month === '*') {
this.month = '1' this.month = '1'
} }
}, }
}, },
created () { created () {
this.formatValue() this.formatValue()
@@ -213,7 +213,7 @@ export default {
month: this.month, month: this.month,
week: this.week, week: this.week,
year: this.year, year: this.year,
cron: this.cronValue_c, cron: this.cronValue_c
}) })
}, },
formatValue () { formatValue () {
@@ -263,12 +263,12 @@ export default {
}, },
onInputCronBlur (event) { onInputCronBlur (event) {
this.$emit('change', event.target.value) this.$emit('change', event.target.value)
}, }
}, },
model: { model: {
prop: 'cronValue', prop: 'cronValue',
event: 'change' event: 'change'
}, }
} }
</script> </script>
@@ -66,7 +66,7 @@ export default {
data () { data () {
return { return {
editCronValue: this.cronValue, editCronValue: this.cronValue,
show: false, show: false
} }
}, },
watch: { watch: {
@@ -1,11 +1,11 @@
export const WEEK_MAP_EN = { export const WEEK_MAP_EN = {
'SUN': '1', SUN: '1',
'MON': '2', MON: '2',
'TUE': '3', TUE: '3',
'WED': '4', WED: '4',
'THU': '5', THU: '5',
'FRI': '6', FRI: '6',
'SAT': '7' SAT: '7'
} }
export const replaceWeekName = (c) => { export const replaceWeekName = (c) => {
@@ -68,7 +68,7 @@ export default {
}, },
computed: { computed: {
value_c () { value_c () {
let result = [] const result = []
switch (this.type) { switch (this.type) {
case TYPE_NOT_SET: case TYPE_NOT_SET:
result.push('?') result.push('?')
@@ -102,12 +102,12 @@ export default {
}, },
// 指定值范围区间介于最小值和最大值之间 // 指定值范围区间介于最小值和最大值之间
specifyRange () { specifyRange () {
let range = [] const range = []
for (let i = this.minValue; i <= this.maxValue; i++) { for (let i = this.minValue; i <= this.maxValue; i++) {
range.push(i) range.push(i)
} }
return range return range
}, }
}, },
methods: { methods: {
parseProp (value) { parseProp (value) {
@@ -51,14 +51,14 @@ import mixin from './mixin'
import { replaceWeekName, WEEK_MAP_EN } from './const.js' import { replaceWeekName, WEEK_MAP_EN } from './const.js'
const WEEK_MAP = { const WEEK_MAP = {
'周一': 2, 周一: 2,
'周二': 3, 周二: 3,
'周三': 4, 周三: 4,
'周四': 5, 周四: 5,
'周五': 6, 周五: 6,
'周六': 7, 周六: 7,
// 按照国人习惯将周日放到每周的最后一天 // 按照国人习惯将周日放到每周的最后一天
'周日': 1, 周日: 1
} }
export default { export default {
File diff suppressed because it is too large Load Diff
+12 -12
View File
@@ -69,17 +69,17 @@
menubar: false, menubar: false,
toolbar_drawer: false, toolbar_drawer: false,
images_upload_handler: (blobInfo, success) => { images_upload_handler: (blobInfo, success) => {
let formData = new FormData() const formData = new FormData()
formData.append('file', blobInfo.blob(), blobInfo.filename()); formData.append('file', blobInfo.blob(), blobInfo.filename())
formData.append('biz', "jeditor"); formData.append('biz', 'jeditor')
formData.append("jeditor","1"); formData.append('jeditor', '1')
uploadAction(window._CONFIG['domianURL']+"/sys/common/upload", formData).then((res) => { uploadAction(window._CONFIG.domianURL + '/sys/common/upload', formData).then((res) => {
if (res.success) { if (res.success) {
if (res.message == 'local') { if (res.message == 'local') {
const img = 'data:image/jpeg;base64,' + blobInfo.base64() const img = 'data:image/jpeg;base64,' + blobInfo.base64()
success(img) success(img)
} else { } else {
let img = getFileAccessHttpUrl(res.message) const img = getFileAccessHttpUrl(res.message)
success(img) success(img)
} }
} }
@@ -87,7 +87,7 @@
} }
}, },
myValue: this.value, myValue: this.value,
reloading: false, reloading: false
} }
}, },
mounted () { mounted () {
@@ -116,11 +116,11 @@
*/ */
initATabsChangeAutoReload () { initATabsChangeAutoReload () {
// 获取父级 // 获取父级
let tabs = getVmParentByName(this, 'ATabs') const tabs = getVmParentByName(this, 'ATabs')
let tabPane = getVmParentByName(this, 'ATabPane') const tabPane = getVmParentByName(this, 'ATabPane')
if (tabs && tabPane) { if (tabs && tabPane) {
// 用户自定义的 key // 用户自定义的 key
let currentKey = tabPane.$vnode.key const currentKey = tabPane.$vnode.key
// 添加事件监听 // 添加事件监听
tabs.$on('change', (key) => { tabs.$on('change', (key) => {
// 切换到自己时执行reload // 切换到自己时执行reload
@@ -133,7 +133,7 @@
// update--end--autor:liusq-----date:20210316------for富文本编辑器tab父组件可能导致的赋值问题------ // update--end--autor:liusq-----date:20210316------for富文本编辑器tab父组件可能导致的赋值问题------
} else { } else {
// update--begin--autor:wangshuai-----date:20200724------for富文本编辑器切换tab无法修改------ // update--begin--autor:wangshuai-----date:20200724------for富文本编辑器切换tab无法修改------
let tabLayout = getVmParentByName(this, 'TabLayout') const tabLayout = getVmParentByName(this, 'TabLayout')
// update--begin--autor:liusq-----date:20210713------for处理特殊情况excuteCallback不能使用------ // update--begin--autor:liusq-----date:20210713------for处理特殊情况excuteCallback不能使用------
try { try {
tabLayout.excuteCallback(() => { tabLayout.excuteCallback(() => {
@@ -147,7 +147,7 @@
// update--end--autor:liusq-----date:20210713------for处理特殊情况excuteCallback不能使用------ // update--end--autor:liusq-----date:20210713------for处理特殊情况excuteCallback不能使用------
// update--begin--autor:wangshuai-----date:20200724------for文本编辑器切换tab无法修改------ // update--begin--autor:wangshuai-----date:20200724------for文本编辑器切换tab无法修改------
} }
}, }
}, },
watch: { watch: {
+2 -2
View File
@@ -16,12 +16,12 @@
props: { props: {
value: { value: {
type: String, type: String,
required: false, required: false
}, },
length: { length: {
type: Number, type: Number,
required: false, required: false,
default: 25, default: 25
} }
} }
} }
@@ -30,7 +30,7 @@
} }
}, },
mounted () { mounted () {
console.log("我是表单禁用专用组件,但是我并不支持表单中iframe的内容禁用") console.log('我是表单禁用专用组件,但是我并不支持表单中iframe的内容禁用')
} }
} }
</script> </script>
+42 -42
View File
@@ -28,36 +28,36 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getFileAccessHttpUrl } from '@/api/manage' import { getFileAccessHttpUrl } from '@/api/manage'
const Base64 = require('js-base64').Base64 const Base64 = require('js-base64').Base64
const uidGenerator = () => { const uidGenerator = () => {
return '-'+parseInt(Math.random()*10000+1,10); return '-' + parseInt(Math.random() * 10000 + 1, 10)
} }
export default { export default {
name: 'JImageUpload', name: 'JImageUpload',
data () { data () {
return { return {
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload", uploadAction: window._CONFIG.domianURL + '/sys/common/upload',
uploadLoading: false, uploadLoading: false,
picUrl: false, picUrl: false,
headers: {}, headers: {},
fileList: [], fileList: [],
previewImage:"", previewImage: ''
} }
}, },
props: { props: {
text: { text: {
type: String, type: String,
required: false, required: false,
default:"上传" default: '上传'
}, },
/* 这个属性用于控制文件上传的业务路径 */ /* 这个属性用于控制文件上传的业务路径 */
bizPath: { bizPath: {
type: String, type: String,
required: false, required: false,
default:"temp" default: 'temp'
}, },
value: { value: {
type: [String, Array], type: [String, Array],
@@ -84,12 +84,12 @@
computed: { computed: {
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
watch: { watch: {
@@ -101,7 +101,7 @@
this.initFileList(val) this.initFileList(val)
} }
if (!val || val.length == 0) { if (!val || val.length == 0) {
this.picUrl = false; this.picUrl = false
} }
}, },
// 立刻执行handler // 立刻执行handler
@@ -109,27 +109,27 @@
} }
}, },
created () { created () {
const token = Vue.ls.get(ACCESS_TOKEN); const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = {"X-Access-Token":token} this.headers = { 'X-Access-Token': token }
}, },
methods: { methods: {
initFileList (paths) { initFileList (paths) {
if (!paths || paths.length == 0) { if (!paths || paths.length == 0) {
this.fileList = []; this.fileList = []
return; return
} }
this.picUrl = true; this.picUrl = true
let fileList = []; const fileList = []
let arr = paths.split(",") const arr = paths.split(',')
for (var a = 0; a < arr.length; a++) { for (var a = 0; a < arr.length; a++) {
let url = getFileAccessHttpUrl(arr[a]); const url = getFileAccessHttpUrl(arr[a])
fileList.push({ fileList.push({
uid: uidGenerator(), uid: uidGenerator(),
name: arr[a], name: arr[a],
status: 'done', status: 'done',
url: url, url: url,
response: { response: {
status:"history", status: 'history',
message: arr[a] message: arr[a]
} }
}) })
@@ -138,33 +138,33 @@
this.fileList = fileList this.fileList = fileList
}, },
beforeUpload: function (file) { beforeUpload: function (file) {
var fileType = file.type; var fileType = file.type
if (fileType.indexOf('image') < 0) { if (fileType.indexOf('image') < 0) {
this.$message.warning('请上传图片'); this.$message.warning('请上传图片')
return false; return false
} }
}, },
handleChange (info) { handleChange (info) {
this.picUrl = false; this.picUrl = false
let fileList = info.fileList let fileList = info.fileList
// update-begin-author:wangshuai date:20201022 for:LOWCOD-969 判断number是否大于0和是否多选返回选定的元素 // update-begin-author:wangshuai date:20201022 for:LOWCOD-969 判断number是否大于0和是否多选返回选定的元素
if (this.number > 0) { if (this.number > 0) {
fileList = fileList.slice(-this.number); fileList = fileList.slice(-this.number)
} }
// update-end-author:wangshuai date:20201022 for:LOWCOD-969 判断number是否大于0和是否多选返回选定的元素 // update-end-author:wangshuai date:20201022 for:LOWCOD-969 判断number是否大于0和是否多选返回选定的元素
if (info.file.status === 'done') { if (info.file.status === 'done') {
if (info.file.response.success) { if (info.file.response.success) {
this.picUrl = true; this.picUrl = true
fileList = fileList.map((file) => { fileList = fileList.map((file) => {
if (file.response) { if (file.response) {
file.url = `${file.response.result.id}`; file.url = `${file.response.result.id}`
} }
return file; return file
}); })
} }
// this.$message.success(`${info.file.name} 上传成功!`); // this.$message.success(`${info.file.name} 上传成功!`);
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
this.$message.error(`${info.file.name} 上传失败.`); this.$message.error(`${info.file.name} 上传失败.`)
} else if (info.file.status === 'removed') { } else if (info.file.status === 'removed') {
this.handleDelete(info.file) this.handleDelete(info.file)
} }
@@ -176,24 +176,24 @@
// 预览 // 预览
handlePreview (file) { handlePreview (file) {
if (file && file.url) { if (file && file.url) {
var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/${file.url}` var fileFullUrl = `${window._CONFIG.domianWebSocketURL}/${file.url}`
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url) window.open(url)
} }
}, },
getAvatarView () { getAvatarView () {
if (this.fileList.length > 0) { if (this.fileList.length > 0) {
let url = this.fileList[this.fileList.length-1].url const url = this.fileList[this.fileList.length - 1].url
return getFileAccessHttpUrl(url) return getFileAccessHttpUrl(url)
} }
}, },
handlePathChange () { handlePathChange () {
let uploadFiles = this.fileList const uploadFiles = this.fileList
let path = '' let path = ''
if (!uploadFiles || uploadFiles.length == 0) { if (!uploadFiles || uploadFiles.length == 0) {
path = '' path = ''
} }
let arr = []; const arr = []
if (!this.isMultiple && uploadFiles && uploadFiles.length > 0) { if (!this.isMultiple && uploadFiles && uploadFiles.length > 0) {
arr.push(uploadFiles[uploadFiles.length - 1].url) arr.push(uploadFiles[uploadFiles.length - 1].url)
} else { } else {
@@ -202,26 +202,26 @@
if (uploadFiles[a].status === 'done') { if (uploadFiles[a].status === 'done') {
arr.push(uploadFiles[a].url) arr.push(uploadFiles[a].url)
} else { } else {
return; return
} }
// update-end-author:taoyan date:20200819 for:开源问题z上传图片组件 LOWCOD-783 // update-end-author:taoyan date:20200819 for:开源问题z上传图片组件 LOWCOD-783
} }
} }
if (arr.length > 0) { if (arr.length > 0) {
path = arr.join(",") path = arr.join(',')
} }
this.$emit('change', path); this.$emit('change', path)
}, },
handleDelete (file) { handleDelete (file) {
// 如有需要新增 删除逻辑 // 如有需要新增 删除逻辑
}, },
handleCancel () { handleCancel () {
this.close(); this.close()
this.previewVisible = false; this.previewVisible = false
}, },
close () { close () {
}, }
}, },
model: { model: {
prop: 'value', prop: 'value',
+13 -13
View File
@@ -67,13 +67,13 @@
watch: { watch: {
url (val) { url (val) {
if (val) { if (val) {
this.uploadAction = window._CONFIG['domianURL']+val this.uploadAction = window._CONFIG.domianURL + val
} }
} }
}, },
created () { created () {
console.log(this.$attrs) console.log(this.$attrs)
this.uploadAction = window._CONFIG['domianURL']+this.url this.uploadAction = window._CONFIG.domianURL + this.url
}, },
methods: { methods: {
handleClose () { handleClose () {
@@ -83,30 +83,30 @@
this.fileList = [] this.fileList = []
this.uploading = false this.uploading = false
this.visible = true this.visible = true
this.foreignKeys = arg; this.foreignKeys = arg
}, },
handleRemove (file) { handleRemove (file) {
const index = this.fileList.indexOf(file); const index = this.fileList.indexOf(file)
const newFileList = this.fileList.slice(); const newFileList = this.fileList.slice()
newFileList.splice(index, 1); newFileList.splice(index, 1)
this.fileList = newFileList this.fileList = newFileList
}, },
beforeUpload (file) { beforeUpload (file) {
this.fileList = [...this.fileList, file] this.fileList = [...this.fileList, file]
return false; return false
}, },
handleImport () { handleImport () {
const { fileList } = this; const { fileList } = this
const formData = new FormData(); const formData = new FormData()
if (this.biz) { if (this.biz) {
formData.append('isSingleTableImport',this.biz); formData.append('isSingleTableImport', this.biz)
} }
if (this.foreignKeys && this.foreignKeys.length > 0) { if (this.foreignKeys && this.foreignKeys.length > 0) {
formData.append('foreignKeys',this.foreignKeys); formData.append('foreignKeys', this.foreignKeys)
} }
fileList.forEach((file) => { fileList.forEach((file) => {
formData.append('files[]', file); formData.append('files[]', file)
}); })
this.uploading = true this.uploading = true
postAction(this.uploadAction, formData).then((res) => { postAction(this.uploadAction, formData).then((res) => {
this.uploading = false this.uploading = false
+30 -30
View File
@@ -11,10 +11,10 @@
import { Input } from 'ant-design-vue' import { Input } from 'ant-design-vue'
const JINPUT_QUERY_LIKE = 'like'; const JINPUT_QUERY_LIKE = 'like'
const JINPUT_QUERY_NE = 'ne'; const JINPUT_QUERY_NE = 'ne'
const JINPUT_QUERY_GE = 'ge'; //大于等于 const JINPUT_QUERY_GE = 'ge' // 大于等于
const JINPUT_QUERY_LE = 'le'; //小于等于 const JINPUT_QUERY_LE = 'le' // 小于等于
export default { export default {
name: 'JInput', name: 'JInput',
@@ -38,7 +38,7 @@
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: true
}, }
}, },
data () { data () {
return { return {
@@ -48,25 +48,25 @@
computed: { computed: {
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
watch: { watch: {
value: { value: {
immediate: true, immediate: true,
handler: function () { handler: function () {
this.initVal(); this.initVal()
} }
}, },
// type 变化的时候重新计算值 // type 变化的时候重新计算值
type () { type () {
this.backValue({ target: { value: this.inputVal } }) this.backValue({ target: { value: this.inputVal } })
}, }
}, },
methods: { methods: {
initVal () { initVal () {
@@ -77,19 +77,19 @@
switch (this.type) { switch (this.type) {
case JINPUT_QUERY_LIKE: case JINPUT_QUERY_LIKE:
// 修复路由传参的值传送到jinput框被前后各截取了一位 #1336 // 修复路由传参的值传送到jinput框被前后各截取了一位 #1336
if(text.indexOf("*") != -1){ if (text.indexOf('*') != -1) {
text = text.substring(1,text.length-1); text = text.substring(1, text.length - 1)
} }
break; break
case JINPUT_QUERY_NE: case JINPUT_QUERY_NE:
text = text.substring(1); text = text.substring(1)
break; break
case JINPUT_QUERY_GE: case JINPUT_QUERY_GE:
text = text.substring(2); text = text.substring(2)
break; break
case JINPUT_QUERY_LE: case JINPUT_QUERY_LE:
text = text.substring(2); text = text.substring(2)
break; break
default: default:
} }
this.inputVal = text this.inputVal = text
@@ -102,20 +102,20 @@
} }
switch (this.type) { switch (this.type) {
case JINPUT_QUERY_LIKE: case JINPUT_QUERY_LIKE:
text = "*"+text+"*"; text = '*' + text + '*'
break; break
case JINPUT_QUERY_NE: case JINPUT_QUERY_NE:
text = "!"+text; text = '!' + text
break; break
case JINPUT_QUERY_GE: case JINPUT_QUERY_GE:
text = ">="+text; text = '>=' + text
break; break
case JINPUT_QUERY_LE: case JINPUT_QUERY_LE:
text = "<="+text; text = '<=' + text
break; break
default: default:
} }
this.$emit('change', text); this.$emit('change', text)
} }
}, },
model: { model: {
@@ -27,10 +27,10 @@
<script> <script>
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
import '@toast-ui/editor/dist/toastui-editor.css'; import '@toast-ui/editor/dist/toastui-editor.css'
import '@toast-ui/editor/dist/i18n/zh-cn'; import '@toast-ui/editor/dist/i18n/zh-cn'
import Editor from '@toast-ui/editor'; import Editor from '@toast-ui/editor'
import defaultOptions from './default-options' import defaultOptions from './default-options'
import JUpload from '@/components/jero/JUpload' import JUpload from '@/components/jero/JUpload'
import { getFileAccessHttpUrl } from '@/api/manage' import { getFileAccessHttpUrl } from '@/api/manage'
@@ -38,7 +38,7 @@ import { getFileAccessHttpUrl } from '@/api/manage'
export default { export default {
name: 'JMarkdownEditor', name: 'JMarkdownEditor',
components: { components: {
JUpload, JUpload
}, },
props: { props: {
value: { value: {
@@ -77,14 +77,14 @@ export default {
return { return {
editor: null, editor: null,
isShow: false, isShow: false,
activeIndex:"1", activeIndex: '1',
dialogVisible: false, dialogVisible: false,
index:"1", index: '1',
fileList: [], fileList: [],
remark:"", remark: '',
imageName:"", imageName: '',
imageUrl:"", imageUrl: '',
networkPic:"" networkPic: ''
} }
}, },
computed: { computed: {
@@ -136,14 +136,14 @@ export default {
* 添加自定义按钮 * 添加自定义按钮
*/ */
// 获取编辑器上的功能条 // 获取编辑器上的功能条
let toolbar = this.editor.getUI().getToolbar(); const toolbar = this.editor.getUI().getToolbar()
let fileDom = this.$refs.files; const fileDom = this.$refs.files
// 添加图片点击事件 // 添加图片点击事件
this.editor.eventManager.addEventType('isShowClickEvent'); this.editor.eventManager.addEventType('isShowClickEvent')
this.editor.eventManager.listen('isShowClickEvent', () => { this.editor.eventManager.listen('isShowClickEvent', () => {
this.isShow = true this.isShow = true
this.dialogVisible = true this.dialogVisible = true
}); })
// addImageBlobHook图片上传剪切拖拽都会走此方法 // addImageBlobHook图片上传剪切拖拽都会走此方法
// 删除默认监听事件 // 删除默认监听事件
this.editor.eventManager.removeEventHandler('addImageBlobHook') this.editor.eventManager.removeEventHandler('addImageBlobHook')
@@ -160,10 +160,10 @@ export default {
name: 'customize', name: 'customize',
className: 'tui-image tui-toolbar-icons', className: 'tui-image tui-toolbar-icons',
event: 'isShowClickEvent', event: 'isShowClickEvent',
tooltip: '上传图片', tooltip: '上传图片'
} }
// //
}); })
// --end 添加自定义上传按钮 // --end 添加自定义上传按钮
}, },
destroyEditor () { destroyEditor () {
@@ -189,50 +189,50 @@ export default {
if (this.remark) { if (this.remark) {
this.addImgToMd(this.imageUrl, this.remark) this.addImgToMd(this.imageUrl, this.remark)
} else { } else {
this.addImgToMd(this.imageUrl,"") this.addImgToMd(this.imageUrl, '')
} }
} else { } else {
if (this.remark) { if (this.remark) {
this.addImgToMd(this.networkPic, this.remark) this.addImgToMd(this.networkPic, this.remark)
} else { } else {
this.addImgToMd(this.networkPic,"") this.addImgToMd(this.networkPic, '')
} }
} }
this.index="1" this.index = '1'
this.fileList = [] this.fileList = []
this.imageName=""; this.imageName = ''
this.imageUrl=""; this.imageUrl = ''
this.remark="" this.remark = ''
this.networkPic="" this.networkPic = ''
this.dialogVisible = false this.dialogVisible = false
this.isShow=false; this.isShow = false
}, },
handleClose (done) { handleClose (done) {
done(); done()
}, },
handleChange (val) { handleChange (val) {
this.fileList = [] this.fileList = []
this.remark="" this.remark = ''
this.imageName="" this.imageName = ''
this.imageUrl="" this.imageUrl = ''
this.networkPic="" this.networkPic = ''
this.index = val this.index = val
}, },
// 添加图片到markdown // 添加图片到markdown
addImgToMd (data, name) { addImgToMd (data, name) {
let editor = this.editor.getCodeMirror(); const editor = this.editor.getCodeMirror()
let editorHtml = this.editor.getCurrentModeEditor(); const editorHtml = this.editor.getCurrentModeEditor()
let isMarkdownMode = this.editor.isMarkdownMode(); const isMarkdownMode = this.editor.isMarkdownMode()
if (isMarkdownMode) { if (isMarkdownMode) {
editor.replaceSelection(`![${name}](${data})`); editor.replaceSelection(`![${name}](${data})`)
} else { } else {
let range = editorHtml.getRange(); const range = editorHtml.getRange()
let img = document.createElement('img'); const img = document.createElement('img')
img.src = `${data}`; img.src = `${data}`
img.alt = name; img.alt = name
range.insertNode(img); range.insertNode(img)
}
} }
},
}, },
model: { model: {
prop: 'value', prop: 'value',
+12 -12
View File
@@ -70,39 +70,39 @@ export default {
okClose: { okClose: {
type: Boolean, type: Boolean,
default: true default: true
}, }
}, },
data () { data () {
return { return {
// 内部使用的 slots 不再处理 // 内部使用的 slots 不再处理
usedSlots: ['title'], usedSlots: ['title'],
// 实际控制是否全屏的参数 // 实际控制是否全屏的参数
innerFullscreen: this.fullscreen, innerFullscreen: this.fullscreen
} }
}, },
computed: { computed: {
// 一些未处理的参数或特殊处理的参数绑定到 a-modal // 一些未处理的参数或特殊处理的参数绑定到 a-modal
_attrs () { _attrs () {
let attrs = { ...this.$attrs } const attrs = { ...this.$attrs }
// 如果全屏就将宽度设为 100% // 如果全屏就将宽度设为 100%
if (this.innerFullscreen) { if (this.innerFullscreen) {
attrs['width'] = '100%' attrs.width = '100%'
} }
return attrs return attrs
}, },
modalClass () { modalClass () {
return { return {
'j-modal-box': true, 'j-modal-box': true,
'fullscreen': this.innerFullscreen, fullscreen: this.innerFullscreen,
'no-title': this.isNoTitle, 'no-title': this.isNoTitle,
'no-footer': this.isNoFooter, 'no-footer': this.isNoFooter
} }
}, },
modalStyle () { modalStyle () {
let style = {} const style = {}
// 如果全屏就将top设为 0 // 如果全屏就将top设为 0
if (this.innerFullscreen) { if (this.innerFullscreen) {
style['top'] = '0' style.top = '0'
} }
return style return style
}, },
@@ -110,7 +110,7 @@ export default {
return !this.title && !this.allSlotsKeys.includes('title') return !this.title && !this.allSlotsKeys.includes('title')
}, },
isNoFooter () { isNoFooter () {
return this._attrs['footer'] === null return this._attrs.footer === null
}, },
slotsKeys () { slotsKeys () {
return Object.keys(this.$slots).filter(key => !this.usedSlots.includes(key)) return Object.keys(this.$slots).filter(key => !this.usedSlots.includes(key))
@@ -124,7 +124,7 @@ export default {
// 切换全屏的按钮图标 // 切换全屏的按钮图标
fullscreenButtonIcon () { fullscreenButtonIcon () {
return this.innerFullscreen ? 'fullscreen-exit' : 'fullscreen' return this.innerFullscreen ? 'fullscreen-exit' : 'fullscreen'
}, }
}, },
watch: { watch: {
visible () { visible () {
@@ -134,7 +134,7 @@ export default {
}, },
innerFullscreen (val) { innerFullscreen (val) {
this.$emit('update:fullscreen', val) this.$emit('update:fullscreen', val)
}, }
}, },
methods: { methods: {
@@ -162,7 +162,7 @@ export default {
toggleFullscreen () { toggleFullscreen () {
this.innerFullscreen = !this.innerFullscreen this.innerFullscreen = !this.innerFullscreen
triggerWindowResizeEvent() triggerWindowResizeEvent()
}, }
} }
} }
+10 -10
View File
@@ -23,19 +23,19 @@ export default {
content: '', content: '',
// 弹窗参数 // 弹窗参数
modalProps: { modalProps: {
title: '', title: ''
}, },
inputProps: { inputProps: {
placeholder: '', placeholder: ''
}, },
// form model // form model
model: { model: {
input: '', input: ''
}, },
// 校验 // 校验
rule: [], rule: [],
// 回调函数 // 回调函数
callback: {}, callback: {}
} }
}, },
computed: { computed: {
@@ -43,7 +43,7 @@ export default {
return { return {
input: this.rule input: this.rule
} }
}, }
}, },
methods: { methods: {
show (options) { show (options) {
@@ -55,10 +55,10 @@ export default {
this.model.input = options.defaultValue this.model.input = options.defaultValue
} }
// 取出常用的弹窗参数 // 取出常用的弹窗参数
let pickModalProps = pick(options, 'title', 'centered', 'cancelText', 'closable', 'mask', 'maskClosable', 'okText', 'okType', 'okButtonProps', 'cancelButtonProps', 'width', 'wrapClassName', 'zIndex', 'dialogStyle', 'dialogClass') const pickModalProps = pick(options, 'title', 'centered', 'cancelText', 'closable', 'mask', 'maskClosable', 'okText', 'okType', 'okButtonProps', 'cancelButtonProps', 'width', 'wrapClassName', 'zIndex', 'dialogStyle', 'dialogClass')
this.modalProps = Object.assign({}, pickModalProps, options.modalProps) this.modalProps = Object.assign({}, pickModalProps, options.modalProps)
// 取出常用的input参数 // 取出常用的input参数
let pickInputProps = pick(options, 'placeholder', 'allowClear') const pickInputProps = pick(options, 'placeholder', 'allowClear')
this.inputProps = Object.assign({}, pickInputProps, options.inputProps) this.inputProps = Object.assign({}, pickInputProps, options.inputProps)
// 回调函数 // 回调函数
this.callback = pick(options, 'onOk', 'onOkAsync', 'onCancel') this.callback = pick(options, 'onOk', 'onOkAsync', 'onCancel')
@@ -69,7 +69,7 @@ export default {
onOk () { onOk () {
this.$refs.form.validate((ok, err) => { this.$refs.form.validate((ok, err) => {
if (ok) { if (ok) {
let event = {value: this.model.input, target: this} const event = { value: this.model.input, target: this }
// 异步方法优先级高于同步方法 // 异步方法优先级高于同步方法
if (typeof this.callback.onOkAsync === 'function') { if (typeof this.callback.onOkAsync === 'function') {
this.callback.onOkAsync(event) this.callback.onOkAsync(event)
@@ -113,9 +113,9 @@ export default {
this.modalProps.afterClose(e) this.modalProps.afterClose(e)
} }
this.$emit('after-close', e) this.$emit('after-close', e)
}, }
}, }
} }
</script> </script>
+1 -1
View File
@@ -14,5 +14,5 @@ export default {
vm.$on('after-close', () => vm.$destroy()) vm.$on('after-close', () => vm.$destroy())
return vm return vm
} }
}, }
} }
+12 -12
View File
@@ -70,39 +70,39 @@
okClose: { okClose: {
type: Boolean, type: Boolean,
default: true default: true
}, }
}, },
data () { data () {
return { return {
// 内部使用的 slots 不再处理 // 内部使用的 slots 不再处理
usedSlots: ['title'], usedSlots: ['title'],
// 实际控制是否全屏的参数 // 实际控制是否全屏的参数
innerFullscreen: this.fullscreen, innerFullscreen: this.fullscreen
} }
}, },
computed: { computed: {
// 一些未处理的参数或特殊处理的参数绑定到 a-modal // 一些未处理的参数或特殊处理的参数绑定到 a-modal
_attrs () { _attrs () {
let attrs = { ...this.$attrs } const attrs = { ...this.$attrs }
// 如果全屏就将宽度设为 100% // 如果全屏就将宽度设为 100%
if (this.innerFullscreen) { if (this.innerFullscreen) {
attrs['width'] = '100%' attrs.width = '100%'
} }
return attrs return attrs
}, },
modalClass () { modalClass () {
return { return {
'j-modal-box': true, 'j-modal-box': true,
'fullscreen': this.innerFullscreen, fullscreen: this.innerFullscreen,
'no-title': this.isNoTitle, 'no-title': this.isNoTitle,
'no-footer': this.isNoFooter, 'no-footer': this.isNoFooter
} }
}, },
modalStyle () { modalStyle () {
let style = {} const style = {}
// 如果全屏就将top设为 0 // 如果全屏就将top设为 0
if (this.innerFullscreen) { if (this.innerFullscreen) {
style['top'] = '0' style.top = '0'
} }
return style return style
}, },
@@ -110,7 +110,7 @@
return !this.title && !this.allSlotsKeys.includes('title') return !this.title && !this.allSlotsKeys.includes('title')
}, },
isNoFooter () { isNoFooter () {
return this._attrs['footer'] === null return this._attrs.footer === null
}, },
slotsKeys () { slotsKeys () {
return Object.keys(this.$slots).filter(key => !this.usedSlots.includes(key)) return Object.keys(this.$slots).filter(key => !this.usedSlots.includes(key))
@@ -124,7 +124,7 @@
// 切换全屏的按钮图标 // 切换全屏的按钮图标
fullscreenButtonIcon () { fullscreenButtonIcon () {
return this.innerFullscreen ? 'fullscreen-exit' : 'fullscreen' return this.innerFullscreen ? 'fullscreen-exit' : 'fullscreen'
}, }
}, },
watch: { watch: {
visible () { visible () {
@@ -134,7 +134,7 @@
}, },
innerFullscreen (val) { innerFullscreen (val) {
this.$emit('update:fullscreen', val) this.$emit('update:fullscreen', val)
}, }
}, },
methods: { methods: {
@@ -162,7 +162,7 @@
toggleFullscreen () { toggleFullscreen () {
this.innerFullscreen = !this.innerFullscreen this.innerFullscreen = !this.innerFullscreen
triggerWindowResizeEvent() triggerWindowResizeEvent()
}, }
} }
} }
+15 -15
View File
@@ -107,7 +107,7 @@
computed: { computed: {
uniqGroupId () { uniqGroupId () {
if (this.groupId) { if (this.groupId) {
let { groupId, code, field, orgFields, destFields } = this const { groupId, code, field, orgFields, destFields } = this
return `${groupId}_${code}_${field}_${orgFields}_${destFields}` return `${groupId}_${code}_${field}_${orgFields}_${destFields}`
} }
} }
@@ -144,11 +144,11 @@
}, },
handleEmpty () { handleEmpty () {
this.showText = '' this.showText = ''
let destFieldsArr = this.destFields.split(',') const destFieldsArr = this.destFields.split(',')
if (destFieldsArr.length === 0) { if (destFieldsArr.length === 0) {
return return
} }
let res = {} const res = {}
for (let i = 0; i < destFieldsArr.length; i++) { for (let i = 0; i < destFieldsArr.length; i++) {
res[destFieldsArr[i]] = '' res[destFieldsArr[i]] = ''
} }
@@ -160,38 +160,38 @@
}, },
callBack (rows) { callBack (rows) {
// update--begin--autor:lvdandan-----date:20200630------for多选时未带回多个值------ // update--begin--autor:lvdandan-----date:20200630------for多选时未带回多个值------
let orgFieldsArr = this.orgFields.split(',') const orgFieldsArr = this.orgFields.split(',')
let destFieldsArr = this.destFields.split(',') const destFieldsArr = this.destFields.split(',')
let resetText = false let resetText = false
if (this.field && this.field.length > 0) { if (this.field && this.field.length > 0) {
this.showText = '' this.showText = ''
resetText = true resetText = true
} }
let res = {} const res = {}
if (orgFieldsArr.length > 0) { if (orgFieldsArr.length > 0) {
for (let i = 0; i < orgFieldsArr.length; i++) { for (let i = 0; i < orgFieldsArr.length; i++) {
let tempDestArr = [] const tempDestArr = []
for(let rw of rows){ for (const rw of rows) {
let val = rw[orgFieldsArr[i]] let val = rw[orgFieldsArr[i]]
// update--begin--autor:liusq-----date:20210713------for处理val等于0的情况issues/I3ZL4T------ // update--begin--autor:liusq-----date:20210713------for处理val等于0的情况issues/I3ZL4T------
if(typeof val=='undefined'|| val==null || val.toString()==""){ if (typeof val === 'undefined' || val == null || val.toString() == '') {
val = "" val = ''
} }
// update--end--autor:liusq-----date:20210713------for处理val等于0的情况issues/I3ZL4T------ // update--end--autor:liusq-----date:20210713------for处理val等于0的情况issues/I3ZL4T------
tempDestArr.push(val) tempDestArr.push(val)
} }
res[destFieldsArr[i]] = tempDestArr.join(",") res[destFieldsArr[i]] = tempDestArr.join(',')
} }
if (resetText === true) { if (resetText === true) {
let tempText = [] const tempText = []
for(let rw of rows){ for (const rw of rows) {
let val = rw[orgFieldsArr[destFieldsArr.indexOf(this.field)]] let val = rw[orgFieldsArr[destFieldsArr.indexOf(this.field)]]
if (!val) { if (!val) {
val = "" val = ''
} }
tempText.push(val) tempText.push(val)
} }
this.showText = tempText.join(",") this.showText = tempText.join(',')
} }
// update--end--autor:lvdandan-----date:20200630------for多选时未带回多个值------ // update--end--autor:lvdandan-----date:20200630------for多选时未带回多个值------
} }
@@ -53,7 +53,7 @@
type: String, type: String,
default: '', default: '',
required: false required: false
}, }
}, },
data () { data () {
return { return {
@@ -77,9 +77,9 @@
onChange (selectedValue) { onChange (selectedValue) {
this.newOptions = this.options this.newOptions = this.options
if (this.triggerChange) { if (this.triggerChange) {
this.$emit('change', selectedValue.join(this.spliter)); this.$emit('change', selectedValue.join(this.spliter))
} else { } else {
this.$emit('input', selectedValue.join(this.spliter)); this.$emit('input', selectedValue.join(this.spliter))
} }
}, },
getParentContainer (node) { getParentContainer (node) {
@@ -89,6 +89,6 @@
return document.querySelector(this.popContainer) return document.querySelector(this.popContainer)
} }
} }
}, }
} }
</script> </script>
+20 -20
View File
@@ -8,7 +8,7 @@
<script> <script>
export default { export default {
name:"JSlider", name: 'JSlider',
data () { data () {
return { return {
beginClientX: 0, /* 距离屏幕左端距离 */ beginClientX: 0, /* 距离屏幕左端距离 */
@@ -24,43 +24,43 @@
}, },
mousedownFn: function (e) { mousedownFn: function (e) {
if (!this.confirmSuccess) { if (!this.confirmSuccess) {
e.preventDefault && e.preventDefault(); //阻止文字选中等 浏览器默认事件 e.preventDefault && e.preventDefault() // 阻止文字选中等 浏览器默认事件
this.mouseMoveStata = true; this.mouseMoveStata = true
this.beginClientX = e.clientX; this.beginClientX = e.clientX
} }
}, // mousedoen 事件 }, // mousedoen 事件
successFunction () { successFunction () {
this.confirmSuccess = true this.confirmSuccess = true
this.confirmWords = '验证通过'; this.confirmWords = '验证通过'
if (window.addEventListener) { if (window.addEventListener) {
document.getElementsByTagName('html')[0].removeEventListener('mousemove',this.mouseMoveFn); document.getElementsByTagName('html')[0].removeEventListener('mousemove', this.mouseMoveFn)
document.getElementsByTagName('html')[0].removeEventListener('mouseup',this.moseUpFn); document.getElementsByTagName('html')[0].removeEventListener('mouseup', this.moseUpFn)
} else { } else {
document.getElementsByTagName('html')[0].removeEventListener('mouseup',()=>{}); document.getElementsByTagName('html')[0].removeEventListener('mouseup', () => {})
} }
document.getElementsByClassName('drag_text')[0].style.color = '#fff' document.getElementsByClassName('drag_text')[0].style.color = '#fff'
document.getElementsByClassName('handler')[0].style.left = this.maxwidth + 'px'; document.getElementsByClassName('handler')[0].style.left = this.maxwidth + 'px'
document.getElementsByClassName('drag_bg')[0].style.width = this.maxwidth + 'px'; document.getElementsByClassName('drag_bg')[0].style.width = this.maxwidth + 'px'
this.$emit("onSuccess",true) this.$emit('onSuccess', true)
}, // 验证成功函数 }, // 验证成功函数
mouseMoveFn (e) { mouseMoveFn (e) {
if (this.mouseMoveStata) { if (this.mouseMoveStata) {
let width = e.clientX - this.beginClientX; const width = e.clientX - this.beginClientX
if (width > 0 && width <= this.maxwidth) { if (width > 0 && width <= this.maxwidth) {
document.getElementsByClassName('handler')[0].style.left = width + 'px'; document.getElementsByClassName('handler')[0].style.left = width + 'px'
document.getElementsByClassName('drag_bg')[0].style.width = width + 'px'; document.getElementsByClassName('drag_bg')[0].style.width = width + 'px'
} else if (width > this.maxwidth) { } else if (width > this.maxwidth) {
this.successFunction(); this.successFunction()
} }
} }
}, // mousemove事件 }, // mousemove事件
moseUpFn (e) { moseUpFn (e) {
this.mouseMoveStata = false; this.mouseMoveStata = false
var width = e.clientX - this.beginClientX; var width = e.clientX - this.beginClientX
if (width < this.maxwidth) { if (width < this.maxwidth) {
// ---- update-begin- author:sunjianlei --- date:20191009 --- for: 修复获取不到 handler 的时候报错 ---- // ---- update-begin- author:sunjianlei --- date:20191009 --- for: 修复获取不到 handler 的时候报错 ----
let handler = document.getElementsByClassName('handler')[0] const handler = document.getElementsByClassName('handler')[0]
if (handler) { if (handler) {
handler.style.left = 0 + 'px' handler.style.left = 0 + 'px'
document.getElementsByClassName('drag_bg')[0].style.width = 0 + 'px' document.getElementsByClassName('drag_bg')[0].style.width = 0 + 'px'
@@ -70,8 +70,8 @@
} // mouseup事件 } // mouseup事件
}, },
mounted () { mounted () {
this.maxwidth = this.$refs.dragDiv.clientWidth - this.$refs.moveDiv.clientWidth; this.maxwidth = this.$refs.dragDiv.clientWidth - this.$refs.moveDiv.clientWidth
document.getElementsByTagName('html')[0].addEventListener('mousemove',this.mouseMoveFn); document.getElementsByTagName('html')[0].addEventListener('mousemove', this.mouseMoveFn)
document.getElementsByTagName('html')[0].addEventListener('mouseup', this.moseUpFn) document.getElementsByTagName('html')[0].addEventListener('mouseup', this.moseUpFn)
} }
} }
+36 -38
View File
@@ -201,11 +201,9 @@
</a-tree> </a-tree>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </a-row>
</a-spin> </a-spin>
<a-modal title="请输入保存的名称" :visible="prompt.visible" @cancel="prompt.visible=false" @ok="handlePromptOk"> <a-modal title="请输入保存的名称" :visible="prompt.visible" @cancel="prompt.visible=false" @ok="handlePromptOk">
@@ -286,7 +284,7 @@
saveCodeBefore: 'JSuperQuerySaved_', saveCodeBefore: 'JSuperQuerySaved_',
// 查询类型过滤条件匹配andor // 查询类型过滤条件匹配andor
matchType: 'and', matchType: 'and',
superQueryFlag: false, superQueryFlag: false
} }
}, },
computed: { computed: {
@@ -302,14 +300,14 @@
saveCode = this.$route.fullPath saveCode = this.$route.fullPath
} }
return this.saveCodeBefore + saveCode return this.saveCodeBefore + saveCode
}, }
}, },
watch: { watch: {
// saveCode 变化时重新查询已保存的条件 // saveCode 变化时重新查询已保存的条件
fullSaveCode: { fullSaveCode: {
immediate: true, immediate: true,
handler () { handler () {
let list = this.$ls.get(this.fullSaveCode) const list = this.$ls.get(this.fullSaveCode)
if (list instanceof Array) { if (list instanceof Array) {
this.saveTreeData = list.map(i => this.renderSaveTreeData(i)) this.saveTreeData = list.map(i => this.renderSaveTreeData(i))
} }
@@ -319,16 +317,16 @@
deep: true, deep: true,
immediate: true, immediate: true,
handler (val) { handler (val) {
let mainData = [], subData = [] const mainData = []; const subData = []
val.forEach(item => { val.forEach(item => {
let data = { ...item } const data = { ...item }
data.label = data.label || data.text data.label = data.label || data.text
let hasChildren = (data.children instanceof Array) const hasChildren = (data.children instanceof Array)
data.disabled = hasChildren data.disabled = hasChildren
data.selectable = !hasChildren data.selectable = !hasChildren
if (hasChildren) { if (hasChildren) {
data.children = data.children.map(item2 => { data.children = data.children.map(item2 => {
let child = { ...item2 } const child = { ...item2 }
child.label = child.label || child.text child.label = child.label || child.text
child.label = data.label + '-' + child.label child.label = data.label + '-' + child.label
child.value = data.value + ',' + child.value child.value = data.value + ',' + child.value
@@ -366,7 +364,7 @@
}, },
handleOk () { handleOk () {
if (!this.isNullArray(this.queryParamsModel)) { if (!this.isNullArray(this.queryParamsModel)) {
let event = { const event = {
matchType: this.matchType, matchType: this.matchType,
params: this.removeEmptyObject(this.queryParamsModel) params: this.removeEmptyObject(this.queryParamsModel)
} }
@@ -376,13 +374,13 @@
} }
this.emitCallback(event) this.emitCallback(event)
} else { } else {
this.$message.warn("不能查询空条件") this.$message.warn('不能查询空条件')
} }
}, },
emitCallback (event = {}) { emitCallback (event = {}) {
let { params = [], matchType = this.matchType } = event const { params = [], matchType = this.matchType } = event
this.superQueryFlag = (params && params.length > 0) this.superQueryFlag = (params && params.length > 0)
for (let param of params) { for (const param of params) {
if (Array.isArray(param.val)) { if (Array.isArray(param.val)) {
param.val = param.val.join(',') param.val = param.val.join(',')
} }
@@ -412,16 +410,16 @@
this.queryParamsModel.splice(index, 1) this.queryParamsModel.splice(index, 1)
}, },
handleSelected (node, item) { handleSelected (node, item) {
let { type, dbType, options, dictCode, dictTable, dictText, customReturnField, popup } = node.dataRef const { type, dbType, options, dictCode, dictTable, dictText, customReturnField, popup } = node.dataRef
item['type'] = type item.type = type
item['dbType'] = dbType item.dbType = dbType
item['options'] = options item.options = options
item['dictCode'] = dictCode item.dictCode = dictCode
item['dictTable'] = dictTable item.dictTable = dictTable
item['dictText'] = dictText item.dictText = dictText
item['customReturnField'] = customReturnField item.customReturnField = customReturnField
if (popup) { if (popup) {
item['popup'] = popup item.popup = popup
} }
this.$set(item, 'val', undefined) this.$set(item, 'val', undefined)
}, },
@@ -433,7 +431,7 @@
this.emitCallback() this.emitCallback()
}, },
handleSave () { handleSave () {
let queryParams = this.removeEmptyObject(this.queryParamsModel) const queryParams = this.removeEmptyObject(this.queryParamsModel)
if (this.isNullArray(queryParams)) { if (this.isNullArray(queryParams)) {
this.$message.warning('空条件不能保存') this.$message.warning('空条件不能保存')
} else { } else {
@@ -442,15 +440,15 @@
} }
}, },
handlePromptOk () { handlePromptOk () {
let { value } = this.prompt const { value } = this.prompt
if (!value) { if (!value) {
this.$message.warning('保存名称不能为空') this.$message.warning('保存名称不能为空')
return return
} }
// 取出查询条件 // 取出查询条件
let records = this.removeEmptyObject(this.queryParamsModel) const records = this.removeEmptyObject(this.queryParamsModel)
// 判断有没有重名的 // 判断有没有重名的
let filterList = this.saveTreeData.filter(i => i.originTitle === value) const filterList = this.saveTreeData.filter(i => i.originTitle === value)
if (filterList.length > 0) { if (filterList.length > 0) {
this.$confirm({ this.$confirm({
content: `${value} 已存在是否覆盖`, content: `${value} 已存在是否覆盖`,
@@ -477,7 +475,7 @@
}, },
handleTreeSelect (idx, event) { handleTreeSelect (idx, event) {
if (event.selectedNodes[0]) { if (event.selectedNodes[0]) {
let { matchType, records } = event.selectedNodes[0].data.props const { matchType, records } = event.selectedNodes[0].data.props
// 将保存的matchType取出兼容旧数据如果没有保存就还是使用原来的 // 将保存的matchType取出兼容旧数据如果没有保存就还是使用原来的
this.matchType = matchType || this.matchType this.matchType = matchType || this.matchType
this.queryParamsModel = utils.cloneObject(records) this.queryParamsModel = utils.cloneObject(records)
@@ -490,16 +488,16 @@
this.$confirm({ this.$confirm({
content: '是否删除当前查询', content: '是否删除当前查询',
onOk: () => { onOk: () => {
let { eventKey } = vNode const { eventKey } = vNode
this.saveTreeData.splice(Number.parseInt(eventKey.substring(2)), 1) this.saveTreeData.splice(Number.parseInt(eventKey.substring(2)), 1)
this.saveToLocalStore() this.saveToLocalStore()
}, }
}) })
}, },
// 将查询保存到 LocalStore // 将查询保存到 LocalStore
saveToLocalStore () { saveToLocalStore () {
let saveValue = this.saveTreeData.map(({ originTitle, matchType, records }) => ({ title: originTitle, matchType, records })) const saveValue = this.saveTreeData.map(({ originTitle, matchType, records }) => ({ title: originTitle, matchType, records }))
this.$ls.set(this.fullSaveCode, saveValue) this.$ls.set(this.fullSaveCode, saveValue)
}, },
@@ -509,7 +507,7 @@
return true return true
} }
if (array.length === 1) { if (array.length === 1) {
let obj = array[0] const obj = array[0]
if (!obj.field || (obj.val == null || obj.val === '') || !obj.rule) { if (!obj.field || (obj.val == null || obj.val === '') || !obj.rule) {
return true return true
} }
@@ -518,9 +516,9 @@
}, },
// 去掉数组中的空对象 // 去掉数组中的空对象
removeEmptyObject (arr) { removeEmptyObject (arr) {
let array = utils.cloneObject(arr) const array = utils.cloneObject(arr)
for (let i = 0; i < array.length; i++) { for (let i = 0; i < array.length; i++) {
let item = array[i] const item = array[i]
if (item == null || Object.keys(item).length <= 0) { if (item == null || Object.keys(item).length <= 0) {
array.splice(i--, 1) array.splice(i--, 1)
} else { } else {
@@ -538,7 +536,7 @@
/** 渲染保存查询条件的 title(加个删除按钮) */ /** 渲染保存查询条件的 title(加个删除按钮) */
renderSaveTreeData (item) { renderSaveTreeData (item) {
item.icon = this.treeIcon item.icon = this.treeIcon
item.originTitle = item['title'] item.originTitle = item.title
item.title = (arg1, arg2) => { item.title = (arg1, arg2) => {
let vNode let vNode
// 兼容旧版的Antdv // 兼容旧版的Antdv
@@ -549,7 +547,7 @@
} else { } else {
return <span style="color:red;">Antdv版本不支持</span> return <span style="color:red;">Antdv版本不支持</span>
} }
let {originTitle} = vNode.dataRef const { originTitle } = vNode.dataRef
return ( return (
<div class="j-history-tree-title"> <div class="j-history-tree-title">
<span>{originTitle}</span> <span>{originTitle}</span>
@@ -569,7 +567,7 @@
}, },
handleRuleChange (item, newValue) { handleRuleChange (item, newValue) {
let oldValue = item.rule const oldValue = item.rule
this.$set(item, 'rule', newValue) this.$set(item, 'rule', newValue)
// 上一个规则是否是 in且type是字典或下拉 // 上一个规则是否是 in且type是字典或下拉
if (oldValue === 'in') { if (oldValue === 'in') {
@@ -586,8 +584,8 @@
}, },
handleChangeJPopup (item, e, values) { handleChangeJPopup (item, e, values) {
item.val = values[item.popup['destFields']] item.val = values[item.popup.destFields]
}, }
} }
} }
+11 -12
View File
@@ -50,19 +50,19 @@
}, },
computed: { computed: {
queryOption () { queryOption () {
let arr = [] const arr = []
arr.push({ value: this.options[0], text: '是' }) arr.push({ value: this.options[0], text: '是' })
arr.push({ value: this.options[1], text: '否' }) arr.push({ value: this.options[1], text: '否' })
return arr; return arr
}, },
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
watch: { watch: {
@@ -72,7 +72,7 @@
if (!this.query) { if (!this.query) {
if (!val) { if (!val) {
this.checkStatus = false this.checkStatus = false
this.$emit('change', this.options[1]); this.$emit('change', this.options[1])
} else { } else {
if (this.options[0] == val) { if (this.options[0] == val) {
this.checkStatus = true this.checkStatus = true
@@ -81,17 +81,16 @@
} }
} }
} }
} }
} }
}, },
methods: { methods: {
handleChange (checked) { handleChange (checked) {
let flag = checked===false?this.options[1]:this.options[0]; const flag = checked === false ? this.options[1] : this.options[0]
this.$emit('change', flag); this.$emit('change', flag)
}, },
handleSelectChange (value) { handleSelectChange (value) {
this.$emit('change', value); this.$emit('change', value)
} }
}, },
model: { model: {
+31 -30
View File
@@ -67,9 +67,9 @@
<script> <script>
import get from 'lodash.get' import get from 'lodash.get'
const LEFT_FROZEN = 1; // 1为左侧冻结 const LEFT_FROZEN = 1 // 1为左侧冻结
const RIGHT_FROZEN = 2; // 2为右侧冻结 const RIGHT_FROZEN = 2 // 2为右侧冻结
const NO_FROZEN = 3; // 3为不冻结或解冻 const NO_FROZEN = 3 // 3为不冻结或解冻
export default { export default {
name: 'JTable', name: 'JTable',
@@ -91,27 +91,27 @@ export default {
type: Boolean, type: Boolean,
default () { default () {
return true return true
}, }
}, },
isCheck: { isCheck: {
type: Boolean, type: Boolean,
default () { default () {
return true return true
}, }
}, },
isShowDropdown: { isShowDropdown: {
type: Boolean, type: Boolean,
default () { default () {
return true return true
}, }
}, },
rowSelection: { rowSelection: {
type: Object, type: Object,
default () { default () {
return { return {
type: 'checkbox', type: 'checkbox'
}
} }
},
}, },
pagination: { pagination: {
type: Object, type: Object,
@@ -127,13 +127,13 @@ export default {
return range[0] + '-' + range[1] + ' ' + total + '条' return range[0] + '-' + range[1] + ' ' + total + '条'
} }
} }
}, }
}, }
}, },
data () { data () {
return { return {
key: "customer_cloumns_" + this.$route.path, // 存储当前列表的用户存储信息 key: 'customer_cloumns_' + this.$route.path, // 存储当前列表的用户存储信息
defaultOperationKey: "action", // 操作列dataIndex=action不作相关处理默认去除 defaultOperationKey: 'action', // 操作列dataIndex=action不作相关处理默认去除
usedSlots: [], // 内部使用的 slots 不再处理 usedSlots: [], // 内部使用的 slots 不再处理
needTotalList: [], needTotalList: [],
selectedRows: [], selectedRows: [],
@@ -144,8 +144,8 @@ export default {
radioStyle: { radioStyle: {
display: 'block', display: 'block',
height: '30px', height: '30px',
lineHeight: '30px', lineHeight: '30px'
}, }
} }
}, },
computed: { computed: {
@@ -176,9 +176,9 @@ export default {
}, },
// 需要插槽处理的列的信息 // 需要插槽处理的列的信息
columnsSlot () { columnsSlot () {
let a= this.curTableColumns.filter( const a = this.curTableColumns.filter(
item => item.slots item => item.slots
); )
console.log(a) console.log(a)
return a return a
} }
@@ -187,10 +187,10 @@ export default {
// 遍历出筛选列头的所有选项 // 遍历出筛选列头的所有选项
this.columns.forEach((item) => { this.columns.forEach((item) => {
if (item.slots && item.slots.title) { if (item.slots && item.slots.title) {
let colItem = { const colItem = {
value: item.slots.title, value: item.slots.title,
label: item.slots.title, label: item.slots.title,
disabled: false, disabled: false
} }
this.plainOptions.push(colItem) this.plainOptions.push(colItem)
} }
@@ -233,8 +233,8 @@ export default {
}) })
} }
let trfList = [] //将中文转换为dataIndex const trfList = [] // 将中文转换为dataIndex
let initList = [] //最初始list const initList = [] // 最初始list
let diffList = [] // 两个数组不同 let diffList = [] // 两个数组不同
// 转换为dataIndex // 转换为dataIndex
for (let i = 0; i < e.length; i++) { for (let i = 0; i < e.length; i++) {
@@ -265,12 +265,12 @@ export default {
}, },
// 比较两个数组之间的不同,生成新数组 // 比较两个数组之间的不同,生成新数组
getArrDifference (arr1, arr2) { getArrDifference (arr1, arr2) {
let that = this; const that = this
return arr1.concat(arr2).filter(function (v, i, arr) { return arr1.concat(arr2).filter(function (v, i, arr) {
if (v !== that.defaultOperationKey) { if (v !== that.defaultOperationKey) {
return arr.indexOf(v) === arr.lastIndexOf(v) return arr.indexOf(v) === arr.lastIndexOf(v)
} else { } else {
return false; return false
} }
}) })
}, },
@@ -319,9 +319,9 @@ export default {
}, },
// 列头重新排序 // 列头重新排序
diffColunms () { diffColunms () {
let newColumnsList = [] //没有fixed属性的List const newColumnsList = [] // 没有fixed属性的List
let newFixedLeftList = [] //fixed=left的List const newFixedLeftList = [] // fixed=left的List
let newFixedRightList = [] //fixed=right的List const newFixedRightList = [] // fixed=right的List
this.curTableColumns.forEach((item) => { this.curTableColumns.forEach((item) => {
if (!item.fixed) { if (!item.fixed) {
newColumnsList.push(item) newColumnsList.push(item)
@@ -350,12 +350,12 @@ export default {
}, },
updateSelect (selectedRowKeys, selectedRows) { updateSelect (selectedRowKeys, selectedRows) {
this.selectedRowKeys = selectedRowKeys this.selectedRowKeys = selectedRowKeys
let list = this.needTotalList const list = this.needTotalList
this.needTotalList = list.map(item => { this.needTotalList = list.map(item => {
return { return {
...item, ...item,
total: selectedRows.reduce((sum, val) => { total: selectedRows.reduce((sum, val) => {
let total = sum + get(val, item.dataIndex) const total = sum + get(val, item.dataIndex)
return isNaN(total) ? 0 : total return isNaN(total) ? 0 : total
}, 0) }, 0)
} }
@@ -365,14 +365,15 @@ export default {
const totalList = [] const totalList = []
columns && columns instanceof Array && columns.forEach(column => { columns && columns instanceof Array && columns.forEach(column => {
if (column.needTotal) { if (column.needTotal) {
totalList.push({ ...column, totalList.push({
...column,
total: 0 total: 0
}) })
} }
}) })
return totalList return totalList
}, }
}, }
} }
</script> </script>
+8 -8
View File
@@ -45,21 +45,21 @@
} }
}, },
data () { data () {
let timeStr = this.value; const timeStr = this.value
return { return {
decorator:"", decorator: '',
momVal: !timeStr ? null : moment(timeStr, this.dateFormat) momVal: !timeStr ? null : moment(timeStr, this.dateFormat)
} }
}, },
computed: { computed: {
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
watch: { watch: {
@@ -74,7 +74,7 @@
methods: { methods: {
moment, moment,
handleTimeChange (mom, timeStr) { handleTimeChange (mom, timeStr) {
this.$emit('change', timeStr); this.$emit('change', timeStr)
} }
}, },
// 2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型 这个牛逼 // 2.2新增 在组件内定义 指定父组件调用时候的传值属性和事件类型 这个牛逼
+20 -20
View File
@@ -25,9 +25,9 @@
return { return {
treeData: [], treeData: [],
treeValue: null, treeValue: null,
url_root:"/sys/category/loadTreeRoot", url_root: '/sys/category/loadTreeRoot',
url_children:"/sys/category/loadTreeChildren", url_children: '/sys/category/loadTreeChildren',
url_view:'/sys/category/loadOne', url_view: '/sys/category/loadOne'
} }
}, },
props: { props: {
@@ -73,7 +73,7 @@
watch: { watch: {
root: { root: {
handler (val) { handler (val) {
console.log("root-change",val) console.log('root-change', val)
}, },
deep: true deep: true
}, },
@@ -96,12 +96,12 @@
}, },
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
created () { created () {
@@ -114,10 +114,10 @@
}, },
methods: { methods: {
loadViewInfo () { loadViewInfo () {
if(!this.value || this.value=="0"){ if (!this.value || this.value == '0') {
this.treeValue = null this.treeValue = null
} else { } else {
let param = { const param = {
field: this.field, field: this.field,
val: this.value val: this.value
} }
@@ -132,7 +132,7 @@
} }
}, },
loadRoot () { loadRoot () {
let param = { const param = {
async: this.async, async: this.async,
pcode: this.parentCode pcode: this.parentCode
} }
@@ -155,8 +155,8 @@
resolve() resolve()
return return
} }
let pid = treeNode.$vnode.key const pid = treeNode.$vnode.key
let param = { const param = {
pid: pid pid: pid
} }
getAction(this.url_children, param).then(res => { getAction(this.url_children, param).then(res => {
@@ -171,7 +171,7 @@
}, },
addChildren (pid, children, treeArray) { addChildren (pid, children, treeArray) {
if (treeArray && treeArray.length > 0) { if (treeArray && treeArray.length > 0) {
for(let item of treeArray){ for (const item of treeArray) {
if (item.key == pid) { if (item.key == pid) {
if (!children || children.length == 0) { if (!children || children.length == 0) {
item.leaf = true item.leaf = true
@@ -186,10 +186,10 @@
} }
}, },
handleTreeNodeValue (result) { handleTreeNodeValue (result) {
let storeField = this.field=='code'?'code':'key' const storeField = this.field == 'code' ? 'code' : 'key'
for(let i of result){ for (const i of result) {
i.value = i[storeField] i.value = i[storeField]
i.isLeaf = (!i.leaf)?false:true i.isLeaf = !(!i.leaf)
if (i.children && i.children.length > 0) { if (i.children && i.children.length > 0) {
this.handleTreeNodeValue(i.children) this.handleTreeNodeValue(i.children)
} }
@@ -200,9 +200,9 @@
/* /*
* 使用$listeners向上暴露事件---和$emit一起使用出现的问题change事件会执行两遍 * 使用$listeners向上暴露事件---和$emit一起使用出现的问题change事件会执行两遍
* 解决办法改变选中时提交的事件名 */ * 解决办法改变选中时提交的事件名 */
this.$emit('change', ''); this.$emit('change', '')
} else { } else {
this.$emit('change', value.value); this.$emit('change', value.value)
} }
this.treeValue = value this.treeValue = value
}, },
+32 -32
View File
@@ -95,7 +95,7 @@
// 是否支持多选 // 是否支持多选
multiple: { multiple: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
loadTriggleChange: { loadTriggleChange: {
type: Boolean, type: Boolean,
@@ -107,11 +107,11 @@
return { return {
treeValue: null, // 选中的数据 treeValue: null, // 选中的数据
treeData: [], // 渲染树的数组 treeData: [], // 渲染树的数组
url:"/sys/dict/loadTreeData", url: '/sys/dict/loadTreeData',
view: '/sys/dict/loadDictItem/', view: '/sys/dict/loadDictItem/',
tableName:"", tableName: '',
text:"", text: '',
code:"", code: ''
} }
}, },
watch: { watch: {
@@ -131,12 +131,12 @@
}, },
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
} }
}, },
created () { created () {
@@ -151,16 +151,16 @@
}, },
methods: { methods: {
loadItemByCode () { loadItemByCode () {
if( !this.value || this.value == "0" ){ if (!this.value || this.value == '0') {
this.treeValue = null this.treeValue = null
} else { } else {
getAction(`${this.view}${this.dict}`, { key: this.value }).then(res => { getAction(`${this.view}${this.dict}`, { key: this.value }).then(res => {
if (res.success) { if (res.success) {
let values = this.value.split(',') const values = this.value.split(',')
this.treeValue = values // v-model接收的是string || string[] this.treeValue = values // v-model接收的是string || string[]
// 将节点名称显示在选择框上 // 将节点名称显示在选择框上
this.treeValue = res.result[0] this.treeValue = res.result[0]
this.onLoadTriggleChange(res.result[0]); this.onLoadTriggleChange(res.result[0])
} }
}) })
} }
@@ -172,7 +172,7 @@
} }
}, },
initDictInfo () { // 取出父组件传过来的codetexttableName initDictInfo () { // 取出父组件传过来的codetexttableName
let arr = this.dict.split(",") const arr = this.dict.split(',')
this.tableName = arr[0] this.tableName = arr[0]
this.text = arr[1] this.text = arr[1]
this.code = arr[2] this.code = arr[2]
@@ -184,8 +184,8 @@
resolve() resolve()
return return
} }
let pid = treeNode.$vnode.key const pid = treeNode.$vnode.key
let param = { const param = {
pid: pid, pid: pid,
tableName: this.tableName, tableName: this.tableName,
text: this.text, text: this.text,
@@ -196,7 +196,7 @@
} }
getAction(this.url, param).then(res => { getAction(this.url, param).then(res => {
if (res.success) { if (res.success) {
for(let i of res.result){ for (const i of res.result) {
i.value = i.key i.value = i.key
if (i.leaf == false) { if (i.leaf == false) {
i.isLeaf = false i.isLeaf = false
@@ -213,7 +213,7 @@
}, },
addChildren (pid, children, treeArray) { addChildren (pid, children, treeArray) {
if (treeArray && treeArray.length > 0) { if (treeArray && treeArray.length > 0) {
for(let item of treeArray){ for (const item of treeArray) {
if (item.key == pid) { // 找到当前元素所在的父节点 if (item.key == pid) { // 找到当前元素所在的父节点
if (!children || children.length == 0) { if (!children || children.length == 0) {
item.isLeaf = true item.isLeaf = true
@@ -232,7 +232,7 @@
* isAsynctrue===异步获取 false===同步获取数据 默认异步 */ * isAsynctrue===异步获取 false===同步获取数据 默认异步 */
loadRoot () { loadRoot () {
if (this.isAsync) { if (this.isAsync) {
let param = { const param = {
pid: this.pidValue, pid: this.pidValue,
tableName: this.tableName, tableName: this.tableName,
text: this.text, text: this.text,
@@ -243,7 +243,7 @@
} }
getAction(this.url, param).then(res => { getAction(this.url, param).then(res => {
if (res.success && res.result) { if (res.success && res.result) {
for(let i of res.result){ for (const i of res.result) {
i.value = i.key i.value = i.key
if (i.leaf == false) { if (i.leaf == false) {
i.isLeaf = false i.isLeaf = false
@@ -253,12 +253,12 @@
} }
this.treeData = [...res.result] this.treeData = [...res.result]
} else { } else {
console.log("数根节点查询结果-else",res) console.log('数根节点查询结果-else', res)
} }
}) })
} else { } else {
// 同步 // 同步
let param = { const param = {
code: this.code, code: this.code,
pidField: this.pidField, pidField: this.pidField,
tableName: this.tableName, tableName: this.tableName,
@@ -276,7 +276,7 @@
/* /*
* 使用$listeners向上暴露事件---和$emit一起使用出现的问题change事件会执行两遍 * 使用$listeners向上暴露事件---和$emit一起使用出现的问题change事件会执行两遍
* 解决办法改变选中时提交的事件名 */ * 解决办法改变选中时提交的事件名 */
this.$emit('change', ''); this.$emit('change', '')
this.treeValue = null this.treeValue = null
} else if (value instanceof Array) { } else if (value instanceof Array) {
// 多选 // 多选
@@ -292,21 +292,21 @@
return this.treeData return this.treeData
}, },
validateProp () { validateProp () {
let myCondition = this.condition const myCondition = this.condition
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!myCondition) { if (!myCondition) {
resolve();
}else{
try {
let test=JSON.parse(myCondition);
if(typeof test == 'object' && test){
resolve() resolve()
} else { } else {
this.$message.error("组件JTreeSelect-condition传值有误,需要一个json字符串!") try {
const test = JSON.parse(myCondition)
if (typeof test === 'object' && test) {
resolve()
} else {
this.$message.error('组件JTreeSelect-condition传值有误需要一个json字符串!')
reject() reject()
} }
} catch (e) { } catch (e) {
this.$message.error("组件JTreeSelect-condition传值有误需要一个json字符串!") this.$message.error('组件JTreeSelect-condition传值有误需要一个json字符串!')
reject() reject()
} }
} }
@@ -321,7 +321,7 @@
} }
// 递归整个树判断是否是叶子节点----同步获取数据时用到 // 递归整个树判断是否是叶子节点----同步获取数据时用到
function deepFor (source) { function deepFor (source) {
for(let i of source){ for (const i of source) {
i.value = i.key i.value = i.key
if (i.leaf == false) { if (i.leaf == false) {
+7 -7
View File
@@ -82,8 +82,8 @@
} }
}, },
slots () { slots () {
let slots = [] const slots = []
for (let column of this.columns) { for (const column of this.columns) {
if (column.scopedSlots && column.scopedSlots.customRender) { if (column.scopedSlots && column.scopedSlots.customRender) {
slots.push(column.scopedSlots.customRender) slots.push(column.scopedSlots.customRender)
} }
@@ -115,10 +115,10 @@
this.expandedRowKeys = [] this.expandedRowKeys = []
} }
let params = Object.assign({}, this.queryParams || {}) const params = Object.assign({}, this.queryParams || {})
params[this.queryKey] = id params[this.queryKey] = id
if (this.condition && this.condition.length > 0) { if (this.condition && this.condition.length > 0) {
params['condition'] = this.condition params.condition = this.condition
} }
return getAction(url, params).then(res => { return getAction(url, params).then(res => {
@@ -130,17 +130,17 @@
} else { } else {
throw '返回数据类型不识别' throw '返回数据类型不识别'
} }
let dataSource = list.map(item => { const dataSource = list.map(item => {
// 判断是否标记了带有子级 // 判断是否标记了带有子级
if (item.hasChildren === true) { if (item.hasChildren === true) {
// 查找第一个带有dataIndex的值的列 // 查找第一个带有dataIndex的值的列
let firstColumn let firstColumn
for (let column of this.columns) { for (const column of this.columns) {
firstColumn = column.dataIndex firstColumn = column.dataIndex
if (firstColumn) break if (firstColumn) break
} }
// 定义默认展开时显示的loading子级实际子级数据只在展开时加载 // 定义默认展开时显示的loading子级实际子级数据只在展开时加载
let loadChild = { id: `${item.id}_loadChild`, [firstColumn]: 'loading...', isLoading: true } const loadChild = { id: `${item.id}_loadChild`, [firstColumn]: 'loading...', isLoading: true }
item.children = [loadChild] item.children = [loadChild]
} }
return item return item
+49 -49
View File
@@ -36,32 +36,32 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from '@/store/mutation-types'
import { getFileAccessHttpUrl } from '@/api/manage'; import { getFileAccessHttpUrl } from '@/api/manage'
const Base64 = require('js-base64').Base64 const Base64 = require('js-base64').Base64
const FILE_TYPE_ALL = "all" const FILE_TYPE_ALL = 'all'
const FILE_TYPE_IMG = "image" const FILE_TYPE_IMG = 'image'
const FILE_TYPE_TXT = "file" const FILE_TYPE_TXT = 'file'
const uidGenerator = () => { const uidGenerator = () => {
return '-'+parseInt(Math.random()*10000+1,10); return '-' + parseInt(Math.random() * 10000 + 1, 10)
} }
export default { export default {
name: 'JUpload', name: 'JUpload',
data () { data () {
return { return {
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload", uploadAction: window._CONFIG.domianURL + '/sys/common/upload',
headers: {}, headers: {},
fileList: [], fileList: [],
newFileList: [], newFileList: [],
uploadGoOn:true, uploadGoOn: true
} }
}, },
props: { props: {
text: { text: {
type: String, type: String,
required: false, required: false,
default:"点击上传" default: '点击上传'
}, },
fileType: { fileType: {
type: String, type: String,
@@ -72,7 +72,7 @@
bizPath: { bizPath: {
type: String, type: String,
required: false, required: false,
default:"temp" default: 'temp'
}, },
value: { value: {
type: [String, Array], type: [String, Array],
@@ -127,12 +127,12 @@
value: { value: {
immediate: true, immediate: true,
handler () { handler () {
let val = this.value const val = this.value
if (val instanceof Array) { if (val instanceof Array) {
if (this.returnUrl) { if (this.returnUrl) {
this.initFileList(val.join(',')) this.initFileList(val.join(','))
} else { } else {
this.initFileListArr(val); this.initFileListArr(val)
} }
} else { } else {
this.initFileList(val) this.initFileList(val)
@@ -143,32 +143,32 @@
computed: { computed: {
// 透传给下级组件的事件需要排除本组件使用的change事件 // 透传给下级组件的事件需要排除本组件使用的change事件
childListeners () { childListeners () {
const vm = this; const vm = this
let result = Object.assign({}, const result = Object.assign({},
this.$listeners, this.$listeners
) )
delete result.change; delete result.change
return result; return result
}, },
isImageComp () { isImageComp () {
return this.fileType === FILE_TYPE_IMG return this.fileType === FILE_TYPE_IMG
}, },
complistType () { complistType () {
return this.fileType === FILE_TYPE_IMG ? 'picture-card' : 'text' return this.fileType === FILE_TYPE_IMG ? 'picture-card' : 'text'
}, }
}, },
created () { created () {
const token = Vue.ls.get(ACCESS_TOKEN); const token = Vue.ls.get(ACCESS_TOKEN)
// ---------------------------- begin 图片左右换位置 ------------------------------------- // ---------------------------- begin 图片左右换位置 -------------------------------------
this.headers = {"X-Access-Token":token}; this.headers = { 'X-Access-Token': token }
this.containerId = 'container-ty-'+new Date().getTime(); this.containerId = 'container-ty-' + new Date().getTime()
// ---------------------------- end 图片左右换位置 ------------------------------------- // ---------------------------- end 图片左右换位置 -------------------------------------
}, },
methods: { methods: {
initFileListArr (val) { initFileListArr (val) {
if (!val || val.length == 0) { if (!val || val.length == 0) {
this.fileList = []; this.fileList = []
return; return
} }
for (var a = 0; a < val.length; a++) { for (var a = 0; a < val.length; a++) {
this.fileList.forEach((item) => { this.fileList.forEach((item) => {
@@ -181,10 +181,10 @@
}, },
initFileList (paths) { initFileList (paths) {
if (!paths || paths.length == 0) { if (!paths || paths.length == 0) {
this.fileList = []; this.fileList = []
return; return
} }
let arr = paths.split(",") const arr = paths.split(',')
for (var a = 0; a < arr.length; a++) { for (var a = 0; a < arr.length; a++) {
this.fileList.forEach((item) => { this.fileList.forEach((item) => {
if (item.url === arr[a]) { if (item.url === arr[a]) {
@@ -195,33 +195,33 @@
} }
}, },
handlePathChange () { handlePathChange () {
let uploadFiles = this.fileList const uploadFiles = this.fileList
let path = '' let path = ''
if (!uploadFiles || uploadFiles.length == 0) { if (!uploadFiles || uploadFiles.length == 0) {
path = '' path = ''
} }
let arr = []; const arr = []
for (var a = 0; a < uploadFiles.length; a++) { for (var a = 0; a < uploadFiles.length; a++) {
if (uploadFiles[a].status === 'done') { if (uploadFiles[a].status === 'done') {
arr.push(uploadFiles[a].url) arr.push(uploadFiles[a].url)
} else { } else {
return; return
} }
} }
if (arr.length > 0) { if (arr.length > 0) {
path = arr.join(",") path = arr.join(',')
} }
this.$emit('change', path); this.$emit('change', path)
}, },
doBeforeUpload (file) { doBeforeUpload (file) {
this.uploadGoOn = true this.uploadGoOn = true
var fileType = file.type; var fileType = file.type
if (this.fileType === FILE_TYPE_IMG) { if (this.fileType === FILE_TYPE_IMG) {
if (fileType.indexOf('image') < 0) { if (fileType.indexOf('image') < 0) {
this.$message.warning('请上传图片'); this.$message.warning('请上传图片')
this.uploadGoOn = false this.uploadGoOn = false
return false; return false
} }
} }
// 扩展 beforeUpload 验证 // 扩展 beforeUpload 验证
@@ -232,25 +232,25 @@
}, },
handleChange (info) { handleChange (info) {
if (!info.file.status && this.uploadGoOn === false) { if (!info.file.status && this.uploadGoOn === false) {
info.fileList.pop(); info.fileList.pop()
} }
let fileList = info.fileList let fileList = info.fileList
if (info.file.status === 'done') { if (info.file.status === 'done') {
if (this.number > 0) { if (this.number > 0) {
fileList = fileList.slice(-this.number); fileList = fileList.slice(-this.number)
} }
if (info.file.response.success) { if (info.file.response.success) {
fileList = fileList.map((file) => { fileList = fileList.map((file) => {
if (file.response) { if (file.response) {
let reUrl = `${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.response.result.fileName}`; const reUrl = `${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.response.result.fileName}`
file.url = getFileAccessHttpUrl(reUrl); file.url = getFileAccessHttpUrl(reUrl)
} }
return file; return file
}); })
} }
// this.$message.success(`${info.file.name} 上传成功!`); // this.$message.success(`${info.file.name} 上传成功!`);
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
this.$message.error(`${info.file.name} 上传失败.`); this.$message.error(`${info.file.name} 上传失败.`)
} else if (info.file.status === 'removed') { } else if (info.file.status === 'removed') {
this.handleDelete(info.file) this.handleDelete(info.file)
} }
@@ -261,7 +261,7 @@
this.handlePathChange() this.handlePathChange()
} else { } else {
// returnUrl为false时返回文件名称文件路径及文件大小 // returnUrl为false时返回文件名称文件路径及文件大小
this.newFileList = []; this.newFileList = []
for (var a = 0; a < fileList.length; a++) { for (var a = 0; a < fileList.length; a++) {
// update-begin-author:lvdandan date:20200603 for:TESTA-514开源issue多个文件同时上传时控制台报错 // update-begin-author:lvdandan date:20200603 for:TESTA-514开源issue多个文件同时上传时控制台报错
if (fileList[a].status === 'done') { if (fileList[a].status === 'done') {
@@ -269,14 +269,14 @@
fileName: fileList[a].name, fileName: fileList[a].name,
filePath: fileList[a].url, filePath: fileList[a].url,
fileSize: fileList[a].size fileSize: fileList[a].size
}; }
this.newFileList.push(fileJson); this.newFileList.push(fileJson)
} else { } else {
return; return
} }
// update-end-author:lvdandan date:20200603 for:TESTA-514开源issue多个文件同时上传时控制台报错 // update-end-author:lvdandan date:20200603 for:TESTA-514开源issue多个文件同时上传时控制台报错
} }
this.$emit('change', this.newFileList); this.$emit('change', this.newFileList)
} }
} }
}, },
@@ -286,14 +286,14 @@
}, },
handlePreview (file) { handlePreview (file) {
if (file && file.url) { if (file && file.url) {
var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}` var fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
let url = `${window._CONFIG['onlinePreviewDomainURL']}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}` const url = `${window._CONFIG.onlinePreviewDomainURL}?url=${encodeURIComponent(Base64.encode(fileFullUrl))}`
window.open(url) window.open(url)
} }
}, },
handleDownload (file) { handleDownload (file) {
if (file && file.url) { if (file && file.url) {
var fileFullUrl = `${window._CONFIG['domianWebSocketURL']}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}` var fileFullUrl = `${window._CONFIG.domianWebSocketURL}/sys/common/download/${file.response.result.id}?token=${Vue.ls.get(ACCESS_TOKEN)}&fullfilename=${file.name}`
window.open(fileFullUrl) window.open(fileFullUrl)
} }
} }
@@ -30,7 +30,7 @@
visible: false, visible: false,
fullscreen: false, fullscreen: false,
row: null, row: null,
column: null, column: null
} }
}, },
created () { created () {
@@ -38,7 +38,7 @@
methods: { methods: {
open (event) { open (event) {
let {row, column} = event const { row, column } = event
this.row = cloneObject(row) this.row = cloneObject(row)
this.column = column this.column = column
this.visible = true this.visible = true
@@ -54,11 +54,11 @@
column: this.column, column: this.column,
callback: (success) => { callback: (success) => {
this.visible = !success this.visible = !success
}, }
}) })
}, }
}, }
} }
</script> </script>
<style lang="less"> <style lang="less">
@@ -17,7 +17,7 @@
props: { props: {
size: String, size: String,
disabled: PropTypes.bool, disabled: PropTypes.bool,
pagination: PropTypes.object.def({}), pagination: PropTypes.object.def({})
}, },
data () { data () {
return { return {
@@ -47,7 +47,7 @@
'j-vxe-pagination': true, 'j-vxe-pagination': true,
'show-quick-jumper': !!this.bindProps.showQuickJumper 'show-quick-jumper': !!this.bindProps.showQuickJumper
} }
}, }
}, },
methods: { methods: {
handleChange (current, pageSize) { handleChange (current, pageSize) {
@@ -57,8 +57,8 @@
handleShowSizeChange (current, pageSize) { handleShowSizeChange (current, pageSize) {
this.$set(this.pagination, 'pageSize', pageSize) this.$set(this.pagination, 'pageSize', pageSize)
this.$emit('change', { current, pageSize }) this.$emit('change', { current, pageSize })
}, }
}, }
} }
</script> </script>
@@ -42,7 +42,6 @@
methods: { methods: {
toggle (event) { toggle (event) {
// update-begin-author:taoyan date:20200921 for: 弹出子表时子表会闪一下类似重新计算子表的位置 // update-begin-author:taoyan date:20200921 for: 弹出子表时子表会闪一下类似重新计算子表的位置
if (document.body.clientHeight - event.$event.clientY > 350) { if (document.body.clientHeight - event.$event.clientY > 350) {
this.placement = 'bottom' this.placement = 'bottom'
@@ -64,7 +63,7 @@
return return
} }
let {row, column, $table, $event: {target}} = event const { row, column, $table, $event: { target } } = event
this.row = cloneObject(row) this.row = cloneObject(row)
this.column = column this.column = column
@@ -83,11 +82,11 @@
if (className.includes('vxe-radio--icon') || className.includes('vxe-cell--radio')) { if (className.includes('vxe-radio--icon') || className.includes('vxe-cell--radio')) {
return return
} }
let table = $table.$el const table = $table.$el
let tr = getParentNodeByTagName(target, 'tr') const tr = getParentNodeByTagName(target, 'tr')
if (table && tr) { if (table && tr) {
let clientWidth = table.clientWidth const clientWidth = table.clientWidth
let clientHeight = tr.clientHeight const clientHeight = tr.clientHeight
this.$refs.div.style.width = clientWidth + 'px' this.$refs.div.style.width = clientWidth + 'px'
this.$refs.div.style.height = clientHeight + 'px' this.$refs.div.style.height = clientHeight + 'px'
this.overlayStyle.width = Number.parseInt((clientWidth - clientWidth * 0.04)) + 'px' this.overlayStyle.width = Number.parseInt((clientWidth - clientWidth * 0.04)) + 'px'
@@ -99,13 +98,13 @@
if (h) { if (h) {
h = h - 140 h = h - 140
} }
let toolbar = this.$refs.div.nextSibling const toolbar = this.$refs.div.nextSibling
domAlign(this.$refs.div, toolbar, { domAlign(this.$refs.div, toolbar, {
points: ['tl', 'tl'], points: ['tl', 'tl'],
offset: [0, h], offset: [0, h],
overflow: { overflow: {
alwaysByViewport: true alwaysByViewport: true
}, }
}) })
// update-end-author:taoyan date:20200921 for: 子表弹出位置存在现实位置问题 // update-end-author:taoyan date:20200921 for: 子表弹出位置存在现实位置问题
this.$nextTick(() => { this.$nextTick(() => {
@@ -115,7 +114,7 @@
}) })
}) })
} else { } else {
let num = ++level const num = ++level
console.warn('JVxeSubPopovertable or tr 获取失败正在进行第 ' + num + '次重试', { event, table, tr }) console.warn('JVxeSubPopovertable or tr 获取失败正在进行第 ' + num + '次重试', { event, table, tr })
window.setTimeout(() => this.open(event, num), 100) window.setTimeout(() => this.open(event, num), 100)
} }
@@ -129,8 +128,8 @@
reopen (event) { reopen (event) {
this.close() this.close()
this.open(event) this.open(event)
}, }
}, }
} }
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
@@ -48,7 +48,7 @@ export default {
// prefix 前缀suffix 后缀 // prefix 前缀suffix 后缀
slots: ['prefix', 'suffix'], slots: ['prefix', 'suffix'],
// add 新增按钮remove 删除按钮clearSelection 清空选择按钮collapse 展开收起 // add 新增按钮remove 删除按钮clearSelection 清空选择按钮collapse 展开收起
btns: ['add', 'remove', 'clearSelection'], btns: ['add', 'remove', 'clearSelection']
})), })),
// 是否显示行号 // 是否显示行号
rowNumber: PropTypes.bool.def(false), rowNumber: PropTypes.bool.def(false),
@@ -66,7 +66,7 @@ export default {
// 最大高度 // 最大高度
maxHeight: { maxHeight: {
type: Number, type: Number,
default: () => null, default: () => null
}, },
// 要禁用的行 TODO 未实现 // 要禁用的行 TODO 未实现
disabledRows: PropTypes.object.def(() => ({})), disabledRows: PropTypes.object.def(() => ({})),
@@ -99,7 +99,7 @@ export default {
// 该参数不能动态修改如果行列字段多的情况下会根据机器性能造成不同程度的卡顿 // 该参数不能动态修改如果行列字段多的情况下会根据机器性能造成不同程度的卡顿
alwaysEdit: PropTypes.bool.def(false), alwaysEdit: PropTypes.bool.def(false),
// 联动配置数组详情配置见文档 // 联动配置数组详情配置见文档
linkageConfig: PropTypes.array.def(() => []), linkageConfig: PropTypes.array.def(() => [])
}, },
data () { data () {
return { return {
@@ -138,7 +138,7 @@ export default {
// gt: 15 // gt: 15
// }, // },
'radio-config': { highlight: true }, 'radio-config': { highlight: true },
'checkbox-config': {highlight: true}, 'checkbox-config': { highlight: true }
}, },
// 绑定左侧选择框 // 绑定左侧选择框
selectedRows: [], selectedRows: [],
@@ -148,7 +148,7 @@ export default {
statistics: { statistics: {
has: false, has: false,
sum: [], sum: [],
average: [], average: []
}, },
// 允许执行刷新特效的行ID // 允许执行刷新特效的行ID
reloadEffectRowKeysMap: {}, reloadEffectRowKeysMap: {},
@@ -156,7 +156,7 @@ export default {
excludeCode: [], excludeCode: [],
// 联动下拉选项用于隔离不同的下拉选项 // 联动下拉选项用于隔离不同的下拉选项
// 内部联动配置map // 内部联动配置map
_innerLinkageConfig: null, _innerLinkageConfig: null
} }
}, },
computed: { computed: {
@@ -164,14 +164,14 @@ export default {
// vxe 最终 columns // vxe 最终 columns
vxeColumns () { vxeColumns () {
this._innerColumns.forEach(column => { this._innerColumns.forEach(column => {
let renderOptions = { const renderOptions = {
caseId: this.caseId, caseId: this.caseId,
bordered: this.bordered, bordered: this.bordered,
disabled: this.disabled, disabled: this.disabled,
scrolling: this.scrolling, scrolling: this.scrolling,
reloadEffect: this.reloadEffect, reloadEffect: this.reloadEffect,
reloadEffectRowKeysMap: this.reloadEffectRowKeysMap, reloadEffectRowKeysMap: this.reloadEffectRowKeysMap,
listeners: this.cellListeners, listeners: this.cellListeners
} }
if (column.$type === JVXETypes.rowDragSort) { if (column.$type === JVXETypes.rowDragSort) {
renderOptions.dragSortKey = this.dragSortKey renderOptions.dragSortKey = this.dragSortKey
@@ -191,7 +191,7 @@ export default {
config: this._innerLinkageConfig.get(column.key), config: this._innerLinkageConfig.get(column.key),
getLinkageOptionsSibling: this.getLinkageOptionsSibling, getLinkageOptionsSibling: this.getLinkageOptionsSibling,
getLinkageOptionsAsync: this.getLinkageOptionsAsync, getLinkageOptionsAsync: this.getLinkageOptionsAsync,
linkageSelectChange: this.linkageSelectChange, linkageSelectChange: this.linkageSelectChange
} }
} }
} }
@@ -204,20 +204,20 @@ export default {
// update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 新行编辑列表上带按钮的遮挡问题 // update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 新行编辑列表上带按钮的遮挡问题
if (column.$type === JVXETypes.file || column.$type === JVXETypes.image) { if (column.$type === JVXETypes.file || column.$type === JVXETypes.image) {
if (column.width && column.width.endsWith('px')) { if (column.width && column.width.endsWith('px')) {
column.width = Number.parseInt(column.width.substr(0,column.width.length-2))+Number.parseInt(1)+'px'; column.width = Number.parseInt(column.width.substr(0, column.width.length - 2)) + Number.parseInt(1) + 'px'
} }
} }
// update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 新行编辑列表上带按钮的遮挡问题 // update--begin--autor:lvdandan-----date:20201019------for:LOWCOD-882 新行编辑列表上带按钮的遮挡问题
// update--begin--autor:lvdandan-----date:20201211------for:JT-118 online 日期时间控件长度较小 // update--begin--autor:lvdandan-----date:20201211------for:JT-118 online 日期时间控件长度较小
if (column.$type === JVXETypes.datetime || column.$type === JVXETypes.userSelect || column.$type === JVXETypes.departSelect) { if (column.$type === JVXETypes.datetime || column.$type === JVXETypes.userSelect || column.$type === JVXETypes.departSelect) {
let width = column.width && column.width.endsWith('px')?Number.parseInt(column.width.substr(0,column.width.length-2)):0; const width = column.width && column.width.endsWith('px') ? Number.parseInt(column.width.substr(0, column.width.length - 2)) : 0
if (width <= 190) { if (width <= 190) {
column.width = '190px' column.width = '190px'
} }
} }
if (column.$type === JVXETypes.date) { if (column.$type === JVXETypes.date) {
let width = column.width && column.width.endsWith('px')?Number.parseInt(column.width.substr(0,column.width.length-2)):0; const width = column.width && column.width.endsWith('px') ? Number.parseInt(column.width.substr(0, column.width.length - 2)) : 0
if (width <= 135) { if (width <= 135) {
column.width = '135px' column.width = '135px'
} }
@@ -232,10 +232,10 @@ export default {
}, },
// vxe 最终 props // vxe 最终 props
vxeProps () { vxeProps () {
let expandConfig = Object.assign({}, this.defaultVxeProps['expand-config'], this.expandConfig) const expandConfig = Object.assign({}, this.defaultVxeProps['expand-config'], this.expandConfig)
return Object.assign({}, this.defaultVxeProps, { return Object.assign({}, this.defaultVxeProps, {
showFooter: this.statistics.has, showFooter: this.statistics.has
}, this.$attrs, { }, this.$attrs, {
loading: this.loading, loading: this.loading,
columns: this.vxeColumns, columns: this.vxeColumns,
@@ -245,21 +245,21 @@ export default {
maxHeight: this.maxHeight, maxHeight: this.maxHeight,
border: this.bordered, border: this.bordered,
expandConfig: expandConfig, expandConfig: expandConfig,
footerMethod: this.handleFooterMethod, footerMethod: this.handleFooterMethod
// footerSpanMethod: this.handleFooterSpanMethod, // footerSpanMethod: this.handleFooterSpanMethod,
}) })
}, },
// vxe 最终 events // vxe 最终 events
vxeEvents () { vxeEvents () {
// 内置事件 // 内置事件
let events = { const events = {
'scroll': this.handleVxeScroll, scroll: this.handleVxeScroll,
'cell-click': this.handleCellClick, 'cell-click': this.handleCellClick,
'edit-closed': this.handleEditClosed, 'edit-closed': this.handleEditClosed,
'edit-actived': this.handleEditActived, 'edit-actived': this.handleEditActived,
'radio-change': this.handleVxeRadioChange, 'radio-change': this.handleVxeRadioChange,
'checkbox-all': this.handleVxeCheckboxAll, 'checkbox-all': this.handleVxeCheckboxAll,
'checkbox-change': this.handleVxeCheckboxChange, 'checkbox-change': this.handleVxeCheckboxChange
} }
// 用户传递的事件进行合并操作 // 用户传递的事件进行合并操作
Object.keys(this.$listeners).forEach(key => { Object.keys(this.$listeners).forEach(key => {
@@ -285,16 +285,16 @@ export default {
/** 当前行向下移一位 */ /** 当前行向下移一位 */
rowMoveDown: rowIndex => this.rowResort(rowIndex, rowIndex + 1), rowMoveDown: rowIndex => this.rowResort(rowIndex, rowIndex + 1),
/** 在当前行下面插入一行 */ /** 在当前行下面插入一行 */
rowInsertDown: rowIndex => this.insertRows({}, rowIndex + 1), rowInsertDown: rowIndex => this.insertRows({}, rowIndex + 1)
}
} }
},
}, },
watch: { watch: {
dataSource: { dataSource: {
// deep: true, // deep: true,
immediate: true, immediate: true,
async handler () { async handler () {
let vxe = await getRefPromise(this, 'vxe') const vxe = await getRefPromise(this, 'vxe')
this.dataSource.forEach((data, idx) => { this.dataSource.forEach((data, idx) => {
// 开启了排序就自动计算排序值 // 开启了排序就自动计算排序值
@@ -303,7 +303,7 @@ export default {
} }
// 处理联动回显数据 // 处理联动回显数据
if (this._innerLinkageConfig != null) { if (this._innerLinkageConfig != null) {
for (let configItem of this._innerLinkageConfig.values()) { for (const configItem of this._innerLinkageConfig.values()) {
this.autoSetLinkageOptionsByData(data, '', configItem, 0) this.autoSetLinkageOptionsByData(data, '', configItem, 0)
} }
} }
@@ -334,16 +334,16 @@ export default {
// } // }
// } // }
// }) // })
}, }
}, },
columns: { columns: {
immediate: true, immediate: true,
handler (columns) { handler (columns) {
// 获取不需要显示列 // 获取不需要显示列
this.loadExcludeCode() this.loadExcludeCode()
let _innerColumns = [] const _innerColumns = []
let _innerEditRules = {} const _innerEditRules = {}
let {rowNumber, rowSelection, rowExpand, dragSort} = this const { rowNumber, rowSelection, rowExpand, dragSort } = this
let expandColumn, seqColumn, checkboxColumn, radioColumn, dragSortColumn let expandColumn, seqColumn, checkboxColumn, radioColumn, dragSortColumn
if (Array.isArray(columns)) { if (Array.isArray(columns)) {
this.statistics.has = false this.statistics.has = false
@@ -355,8 +355,8 @@ export default {
if (this.excludeCode.indexOf(column.key) >= 0) { if (this.excludeCode.indexOf(column.key) >= 0) {
return false return false
} }
let col = {...column} const col = { ...column }
let {type} = col const { type } = col
const enhanced = getEnhancedMixins(type) const enhanced = getEnhancedMixins(type)
if (type === JVXETypes.rowNumber) { if (type === JVXETypes.rowNumber) {
seqColumn = col seqColumn = col
@@ -373,7 +373,7 @@ export default {
// 防止和vxeTable自带的type起冲突 // 防止和vxeTable自带的type起冲突
col.$type = col.type col.$type = col.type
delete col.type delete col.type
let renderName = 'cellRender', renderOptions = {name: JVXETypes._prefix + type} let renderName = 'cellRender'; const renderOptions = { name: JVXETypes._prefix + type }
if (type) { if (type) {
// hidden 是特殊的组件 // hidden 是特殊的组件
if (type === JVXETypes.hidden) { if (type === JVXETypes.hidden) {
@@ -392,10 +392,10 @@ export default {
} }
// 处理校验 // 处理校验
if (col.validateRules) { if (col.validateRules) {
let rules = [] const rules = []
if (Array.isArray(col.validateRules)) { if (Array.isArray(col.validateRules)) {
for (let rule of col.validateRules) { for (const rule of col.validateRules) {
let replace = { const replace = {
message: replaceProps(col, rule.message) message: replaceProps(col, rule.message)
} }
if (rule.unique || rule.pattern === 'only') { if (rule.unique || rule.pattern === 'only') {
@@ -408,7 +408,7 @@ export default {
delete rule.pattern delete rule.pattern
} else { } else {
// 兼容Online表单的特殊规则 // 兼容Online表单的特殊规则
for (let foo of fooPatterns) { for (const foo of fooPatterns) {
if (foo.value === rule.pattern) { if (foo.value === rule.pattern) {
rule.pattern = foo.pattern rule.pattern = foo.pattern
break break
@@ -429,7 +429,7 @@ export default {
if (Array.isArray(col.statistics)) { if (Array.isArray(col.statistics)) {
this.statistics.has = true this.statistics.has = true
col.statistics.forEach(item => { col.statistics.forEach(item => {
let arr = this.statistics[item.toLowerCase()] const arr = this.statistics[item.toLowerCase()]
if (Array.isArray(arr)) { if (Array.isArray(arr)) {
pushIfNotExist(arr, col.key) pushIfNotExist(arr, col.key)
} }
@@ -500,8 +500,8 @@ export default {
handler () { handler () {
if (Array.isArray(this.linkageConfig) && this.linkageConfig.length > 0) { if (Array.isArray(this.linkageConfig) && this.linkageConfig.length > 0) {
// 获取联动的key顺序 // 获取联动的key顺序
let getLcKeys = (key, arr) => { const getLcKeys = (key, arr) => {
let col = this._innerColumns.find(col => col.key === key) const col = this._innerColumns.find(col => col.key === key)
if (col) { if (col) {
arr.push(col.key) arr.push(col.key)
if (col.linkageKey) { if (col.linkageKey) {
@@ -510,12 +510,13 @@ export default {
} }
return arr return arr
} }
let configMap = new Map() const configMap = new Map()
this.linkageConfig.forEach(lc => { this.linkageConfig.forEach(lc => {
let keys = getLcKeys(lc.key, []) const keys = getLcKeys(lc.key, [])
// 多个key共享一个引用地址 // 多个key共享一个引用地址
let configItem = { const configItem = {
...lc, keys, ...lc,
keys,
optionsMap: new Map() optionsMap: new Map()
} }
keys.forEach(k => configMap.set(k, configItem)) keys.forEach(k => configMap.set(k, configItem))
@@ -525,7 +526,7 @@ export default {
this._innerLinkageConfig = null this._innerLinkageConfig = null
} }
} }
}, }
}, },
created () { created () {
}, },
@@ -559,7 +560,7 @@ export default {
}, },
handleVxeScroll (event) { handleVxeScroll (event) {
let {$refs, scroll} = this const { $refs, scroll } = this
// 记录滚动条的位置 // 记录滚动条的位置
scroll.top = event.scrollTop scroll.top = event.scrollTop
@@ -571,7 +572,7 @@ export default {
}, },
// 当手动勾选单选时触发的事件 // 当手动勾选单选时触发的事件
handleVxeRadioChange (event) { handleVxeRadioChange (event) {
let row = event.$table.getRadioRecord() const row = event.$table.getRadioRecord()
this.selectedRows = row ? [row] : [] this.selectedRows = row ? [row] : []
this.handleSelectChange('radio', this.selectedRows, event) this.handleSelectChange('radio', this.selectedRows, event)
}, },
@@ -609,8 +610,8 @@ export default {
// 点击单元格时触发的事件 // 点击单元格时触发的事件
handleCellClick (event) { handleCellClick (event) {
let {row, column, $event, $table} = event const { row, column, $event, $table } = event
let {$refs} = this const { $refs } = this
// 点击了可编辑的 // 点击了可编辑的
if (column.editRender) { if (column.editRender) {
@@ -665,7 +666,7 @@ export default {
/** 表尾数据处理方法,用于显示统计信息 */ /** 表尾数据处理方法,用于显示统计信息 */
handleFooterMethod ({ columns, data }) { handleFooterMethod ({ columns, data }) {
const { statistics } = this const { statistics } = this
let footers = [] const footers = []
if (statistics.has) { if (statistics.has) {
if (statistics.sum.length > 0) { if (statistics.sum.length > 0) {
footers.push(this.getFooterStatisticsMap({ footers.push(this.getFooterStatisticsMap({
@@ -723,7 +724,7 @@ export default {
*/ */
async loadNewData (dataSource) { async loadNewData (dataSource) {
if (Array.isArray(dataSource)) { if (Array.isArray(dataSource)) {
let {xTable} = this.$refs.vxe.$refs const { xTable } = this.$refs.vxe.$refs
// issues/2784 // issues/2784
// 先清空所有数据 // 先清空所有数据
xTable.loadData([]) xTable.loadData([])
@@ -735,7 +736,7 @@ export default {
} }
// 处理联动回显数据 // 处理联动回显数据
if (this._innerLinkageConfig != null) { if (this._innerLinkageConfig != null) {
for (let configItem of this._innerLinkageConfig.values()) { for (const configItem of this._innerLinkageConfig.values()) {
this.autoSetLinkageOptionsByData(data, '', configItem, 0) this.autoSetLinkageOptionsByData(data, '', configItem, 0)
} }
} }
@@ -749,12 +750,12 @@ export default {
// 校验table失败返回errMap成功返回null // 校验table失败返回errMap成功返回null
async validateTable () { async validateTable () {
const errMap = await this.validate().catch(errMap => errMap) const errMap = await this.validate().catch(errMap => errMap)
return errMap ? errMap : null return errMap || null
}, },
// 完整校验 // 完整校验
async fullValidateTable () { async fullValidateTable () {
const errMap = await this.fullValidate().catch(errMap => errMap) const errMap = await this.fullValidate().catch(errMap => errMap)
return errMap ? errMap : null return errMap || null
}, },
/** 设置某行某列的值 */ /** 设置某行某列的值 */
@@ -764,16 +765,16 @@ export default {
return return
} }
values.forEach((item, idx) => { values.forEach((item, idx) => {
let {rowKey, values: record} = item const { rowKey, values: record } = item
let {row} = this.getIfRowById(rowKey) const { row } = this.getIfRowById(rowKey)
if (!row) { if (!row) {
return return
} }
Object.keys(record).forEach(colKey => { Object.keys(record).forEach(colKey => {
let column = this.getColumnByKey(colKey) const column = this.getColumnByKey(colKey)
if (column) { if (column) {
let oldValue = row[colKey] const oldValue = row[colKey]
let newValue = record[colKey] const newValue = record[colKey]
if (newValue !== oldValue) { if (newValue !== oldValue) {
this.$set(row, colKey, newValue) this.$set(row, colKey, newValue)
// 触发 valueChange 事件 // 触发 valueChange 事件
@@ -783,7 +784,7 @@ export default {
oldValue: oldValue, oldValue: oldValue,
col: column.own, col: column.own,
column: column, column: column,
isSetValues: true, isSetValues: true
}) })
} }
} else { } else {
@@ -802,18 +803,18 @@ export default {
}, },
/** 获取表格表单里的值 */ /** 获取表格表单里的值 */
getValues (callback, rowIds) { getValues (callback, rowIds) {
let tableData = this.getTableData({rowIds: rowIds}) const tableData = this.getTableData({ rowIds: rowIds })
callback('', tableData) callback('', tableData)
}, },
/** 获取表格数据 */ /** 获取表格数据 */
getTableData (options = {}) { getTableData (options = {}) {
let {rowIds} = options const { rowIds } = options
let tableData let tableData
// 仅查询指定id的行 // 仅查询指定id的行
if (Array.isArray(rowIds) && rowIds.length > 0) { if (Array.isArray(rowIds) && rowIds.length > 0) {
tableData = [] tableData = []
rowIds.forEach(rowId => { rowIds.forEach(rowId => {
let {row} = this.getIfRowById(rowId) const { row } = this.getIfRowById(rowId)
if (row) { if (row) {
tableData.push(row) tableData.push(row)
} }
@@ -826,18 +827,18 @@ export default {
}, },
/** 仅获取新增的数据 */ /** 仅获取新增的数据 */
getNewData () { getNewData () {
let newData = cloneObject(this.$refs.vxe.getInsertRecords()) const newData = cloneObject(this.$refs.vxe.getInsertRecords())
newData.forEach(row => delete row.id) newData.forEach(row => delete row.id)
return newData return newData
}, },
/** 仅获取新增的数据,带有id */ /** 仅获取新增的数据,带有id */
getNewDataWithId () { getNewDataWithId () {
let newData = cloneObject(this.$refs.vxe.getInsertRecords()) const newData = cloneObject(this.$refs.vxe.getInsertRecords())
return newData return newData
}, },
/** 根据ID获取行,新增的行也能查出来 */ /** 根据ID获取行,新增的行也能查出来 */
getIfRowById (id) { getIfRowById (id) {
let row = this.getRowById(id), isNew = false let row = this.getRowById(id); let isNew = false
if (!row) { if (!row) {
row = this.getNewRowById(id) row = this.getNewRowById(id)
if (!row) { if (!row) {
@@ -850,8 +851,8 @@ export default {
}, },
/** 通过临时ID获取新增的行 */ /** 通过临时ID获取新增的行 */
getNewRowById (id) { getNewRowById (id) {
let records = this.getInsertRecords() const records = this.getInsertRecords()
for (let record of records) { for (const record of records) {
if (record.id === id) { if (record.id === id) {
return record return record
} }
@@ -894,13 +895,13 @@ export default {
* @param options.setActive 是否激活最后一行的编辑模式 * @param options.setActive 是否激活最后一行的编辑模式
*/ */
async pushRows (rows = {}, options = {}) { async pushRows (rows = {}, options = {}) {
let {xTable} = this.$refs.vxe.$refs const { xTable } = this.$refs.vxe.$refs
let { setActive, index } = options let { setActive, index } = options
setActive = setActive == null ? false : !!setActive setActive = setActive == null ? false : !!setActive
index = index == null ? -1 : index index = index == null ? -1 : index
index = index === -1 ? index : xTable.tableFullData[index] index = index === -1 ? index : xTable.tableFullData[index]
// 插入行 // 插入行
let result = await xTable.insertAt(rows, index) const result = await xTable.insertAt(rows, index)
if (setActive) { if (setActive) {
// 激活最后一行的编辑模式 // 激活最后一行的编辑模式
xTable.setActiveRow(result.rows[result.rows.length - 1]) xTable.setActiveRow(result.rows[result.rows.length - 1])
@@ -911,7 +912,7 @@ export default {
/** 清空选择行 */ /** 清空选择行 */
clearSelection () { clearSelection () {
let event = {$table: this.$refs.vxe, target: this} const event = { $table: this.$refs.vxe, target: this }
if (this.rowSelectionType === JVXETypes.rowRadio) { if (this.rowSelectionType === JVXETypes.rowRadio) {
this.$refs.vxe.clearRadioRow() this.$refs.vxe.clearRadioRow()
this.handleVxeRadioChange(event) this.handleVxeRadioChange(event)
@@ -936,8 +937,8 @@ export default {
} else { } else {
rowIds = [rowId] rowIds = [rowId]
} }
let rows = rowIds.map((id) => { const rows = rowIds.map((id) => {
let {row} = this.getIfRowById(id) const { row } = this.getIfRowById(id)
if (!row) { if (!row) {
return return
} }
@@ -972,8 +973,8 @@ export default {
let key = '' let key = ''
if (col.key !== config.key) { if (col.key !== config.key) {
// 就找出联动上级列 // 就找出联动上级列
let idx = config.keys.findIndex(k => col.key === k) const idx = config.keys.findIndex(k => col.key === k)
let parentKey = config.keys[idx - 1] const parentKey = config.keys[idx - 1]
key = row[parentKey] key = row[parentKey]
// 如果联动上级列没有选择数据就直接返回空数组 // 如果联动上级列没有选择数据就直接返回空数组
if (key === '' || key == null) { if (key === '' || key == null) {
@@ -985,7 +986,7 @@ export default {
let options = config.optionsMap.get(key) let options = config.optionsMap.get(key)
if (!Array.isArray(options)) { if (!Array.isArray(options)) {
if (request) { if (request) {
let parent = key === 'root' ? '' : key const parent = key === 'root' ? '' : key
return this.getLinkageOptionsAsync(config, parent) return this.getLinkageOptionsAsync(config, parent)
} else { } else {
options = [] options = []
@@ -996,7 +997,7 @@ export default {
/** 【多级联动】获取联动下拉选项(异步) */ /** 【多级联动】获取联动下拉选项(异步) */
getLinkageOptionsAsync (config, parent) { getLinkageOptionsAsync (config, parent) {
return new Promise(resolve => { return new Promise(resolve => {
let key = parent ? parent : 'root' const key = parent || 'root'
let options let options
if (config.optionsMap.has(key)) { if (config.optionsMap.has(key)) {
options = config.optionsMap.get(key) options = config.optionsMap.get(key)
@@ -1010,7 +1011,7 @@ export default {
} }
} else if (typeof config.requestData === 'function') { } else if (typeof config.requestData === 'function') {
// 调用requestData方法通过传入parent来获取子级 // 调用requestData方法通过传入parent来获取子级
let promise = config.requestData(parent) const promise = config.requestData(parent)
config.optionsMap.set(key, promise) config.optionsMap.set(key, promise)
promise.then(opt => { promise.then(opt => {
config.optionsMap.set(key, opt) config.optionsMap.set(key, opt)
@@ -1029,7 +1030,7 @@ export default {
this.getLinkageOptionsAsync(config, parent) this.getLinkageOptionsAsync(config, parent)
} }
if (config.keys.length - 1 > level) { if (config.keys.length - 1 > level) {
let value = data[config.keys[level]] const value = data[config.keys[level]]
if (value) { if (value) {
this.autoSetLinkageOptionsByData(data, value, config, level + 1) this.autoSetLinkageOptionsByData(data, value, config, level + 1)
} }
@@ -1039,8 +1040,8 @@ export default {
linkageSelectChange (row, col, config, value) { linkageSelectChange (row, col, config, value) {
if (col.linkageKey) { if (col.linkageKey) {
this.getLinkageOptionsAsync(config, value) this.getLinkageOptionsAsync(config, value)
let idx = config.keys.findIndex(k => k === col.key) const idx = config.keys.findIndex(k => k === col.key)
let values = {} const values = {}
for (let i = idx; i < config.keys.length; i++) { for (let i = idx; i < config.keys.length; i++) {
values[config.keys[i]] = '' values[config.keys[i]] = ''
} }
@@ -1053,10 +1054,10 @@ export default {
_loadDictConcatToOptions (column) { _loadDictConcatToOptions (column) {
initDictOptions(column.dictCode).then((res) => { initDictOptions(column.dictCode).then((res) => {
if (res.success) { if (res.success) {
let newOptions = (column.options || [])// .concat(res.result) const newOptions = (column.options || [])// .concat(res.result)
res.result.forEach(item => { res.result.forEach(item => {
// 过滤重复数据 // 过滤重复数据
for (let option of newOptions) if (option.value === item.value) return for (const option of newOptions) if (option.value === item.value) return
newOptions.push(item) newOptions.push(item)
}) })
this.$set(column, 'options', newOptions) this.$set(column, 'options', newOptions)
@@ -1084,10 +1085,10 @@ export default {
* @param handler function * @param handler function
*/ */
filterNewRows (rows, remove = true, handler) { filterNewRows (rows, remove = true, handler) {
let insertRecords = this.$refs.vxe.getInsertRecords() const insertRecords = this.$refs.vxe.getInsertRecords()
let records = [] const records = []
for (let row of rows) { for (const row of rows) {
let item = cloneObject(row) const item = cloneObject(row)
if (insertRecords.includes(row)) { if (insertRecords.includes(row)) {
handler ? handler({ item, row, insertRecords }) : null handler ? handler({ item, row, insertRecords }) : null
@@ -1103,7 +1104,7 @@ export default {
// 删除选中的数据 // 删除选中的数据
async removeSelection () { async removeSelection () {
let res = await this._remove(this.selectedRows) const res = await this._remove(this.selectedRows)
this.clearSelection() this.clearSelection()
await this._recalcSortNumber() await this._recalcSortNumber()
return res return res
@@ -1152,7 +1153,7 @@ export default {
} }
// 从keepSource中删除 // 从keepSource中删除
if (xTable.keepSource) { if (xTable.keepSource) {
let rowIdSet = new Set(rows.map(row => row.id)) const rowIdSet = new Set(rows.map(row => row.id))
XEUtils.remove(tableSourceData, row => rowIdSet.has(row.id)) XEUtils.remove(tableSourceData, row => rowIdSet.has(row.id))
} }
@@ -1181,7 +1182,7 @@ export default {
window.xTable = xTable window.xTable = xTable
const sort = (array) => { const sort = (array) => {
// 存储旧数据并删除旧项目 // 存储旧数据并删除旧项目
let row = array.splice(oldIndex, 1)[0] const row = array.splice(oldIndex, 1)[0]
// 向新项目里添加旧数据 // 向新项目里添加旧数据
array.splice(newIndex, 0, row) array.splice(newIndex, 0, row)
} }
@@ -1204,7 +1205,7 @@ export default {
}, },
async _addOrInsert (rows = {}, index, triggerName, isOnlJs) { async _addOrInsert (rows = {}, index, triggerName, isOnlJs) {
let {xTable} = this.$refs.vxe.$refs const { xTable } = this.$refs.vxe.$refs
let records let records
if (Array.isArray(rows)) { if (Array.isArray(rows)) {
records = rows records = rows
@@ -1213,17 +1214,17 @@ export default {
} }
// 遍历添加默认值 // 遍历添加默认值
records.forEach(record => this._createRow(record)) records.forEach(record => this._createRow(record))
let result = await this.pushRows(records, {index: index, setActive: true}) const result = await this.pushRows(records, { index: index, setActive: true })
// 遍历插入的行 // 遍历插入的行
// update--begin--autor:lvdandan-----date:20201117------for:LOWCOD-987 新行编辑js增强附表内置方法调用问题 #1819 // update--begin--autor:lvdandan-----date:20201117------for:LOWCOD-987 新行编辑js增强附表内置方法调用问题 #1819
// online js增强时以传过来值为准不再赋默认值 // online js增强时以传过来值为准不再赋默认值
if (isOnlJs != true) { if (isOnlJs != true) {
for (let i = 0; i < result.rows.length; i++) { for (let i = 0; i < result.rows.length; i++) {
let row = result.rows[i] const row = result.rows[i]
this.trigger(triggerName, { this.trigger(triggerName, {
row: row, row: row,
$table: xTable, $table: xTable,
target: this, target: this
}) })
} }
} }
@@ -1232,20 +1233,20 @@ export default {
}, },
// 创建新行自动添加默认值 // 创建新行自动添加默认值
_createRow (record = {}) { _createRow (record = {}) {
let {xTable} = this.$refs.vxe.$refs const { xTable } = this.$refs.vxe.$refs
// 添加默认值 // 添加默认值
xTable.tableFullColumn.forEach(column => { xTable.tableFullColumn.forEach(column => {
let col = column.own const col = column.own
if (col.key && (record[col.key] == null || record[col.key] === '')) { if (col.key && (record[col.key] == null || record[col.key] === '')) {
// 设置默认值 // 设置默认值
let createValue = getEnhancedMixins(col.$type || col.type, 'createValue') const createValue = getEnhancedMixins(col.$type || col.type, 'createValue')
record[col.key] = createValue({ row: record, column, $table: xTable }) record[col.key] = createValue({ row: record, column, $table: xTable })
} }
// update-begin--author:sunjianlei---date:20210819------for: 处理联动列联动列只能作用于 select 组件 // update-begin--author:sunjianlei---date:20210819------for: 处理联动列联动列只能作用于 select 组件
if (col.$type === JVXETypes.select && this._innerLinkageConfig != null) { if (col.$type === JVXETypes.select && this._innerLinkageConfig != null) {
// 判断当前列是否是联动列 // 判断当前列是否是联动列
if (this._innerLinkageConfig.has(col.key)) { if (this._innerLinkageConfig.has(col.key)) {
let configItem = this._innerLinkageConfig.get(col.key) const configItem = this._innerLinkageConfig.get(col.key)
this.getLinkageOptionsAsync(configItem, '') this.getLinkageOptionsAsync(configItem, '')
} }
} }
@@ -1264,7 +1265,7 @@ export default {
props: this.vxeProps, props: this.vxeProps,
on: this.vxeEvents, on: this.vxeEvents,
// 作用域插槽的格式为 // 作用域插槽的格式为
scopedSlots: this.$scopedSlots, scopedSlots: this.$scopedSlots
}) })
}, },
// 渲染工具栏 // 渲染工具栏
@@ -1277,7 +1278,7 @@ export default {
size: this.size, size: this.size,
disabled: this.disabled, disabled: this.disabled,
disabledRows: this.disabledRows, disabledRows: this.disabledRows,
selectedRowIds: this.selectedRowIds, selectedRowIds: this.selectedRowIds
}, },
on: { on: {
// 新增事件 // 新增事件
@@ -1285,15 +1286,15 @@ export default {
// 保存事件 // 保存事件
save: () => this.trigger('save', { save: () => this.trigger('save', {
$table: this.$refs.vxe, $table: this.$refs.vxe,
target: this, target: this
}), }),
// 删除事件 // 删除事件
remove: () => { remove: () => {
let $table = this.$refs.vxe const $table = this.$refs.vxe
let deleteRows = this.filterNewRows(this.selectedRows) const deleteRows = this.filterNewRows(this.selectedRows)
// 触发删除事件 // 触发删除事件
if (deleteRows.length > 0) { if (deleteRows.length > 0) {
let removeEvent = {deleteRows, $table, target: this} const removeEvent = { deleteRows, $table, target: this }
if (this.asyncRemove) { if (this.asyncRemove) {
// 确认删除只有调用这个方法才会真删除 // 确认删除只有调用这个方法才会真删除
removeEvent.confirmRemove = () => this.removeSelection() removeEvent.confirmRemove = () => this.removeSelection()
@@ -1310,16 +1311,16 @@ export default {
}, },
scopedSlots: { scopedSlots: {
toolbarPrefix: this.$scopedSlots.toolbarPrefix, toolbarPrefix: this.$scopedSlots.toolbarPrefix,
toolbarSuffix: this.$scopedSlots.toolbarSuffix, toolbarSuffix: this.$scopedSlots.toolbarSuffix
}, }
}) })
} }
return null return null
}, },
// 渲染 toolbarAfter 插槽 // 渲染 toolbarAfter 插槽
renderToolbarAfterSlot () { renderToolbarAfterSlot () {
if (this.$scopedSlots['toolbarAfter']) { if (this.$scopedSlots.toolbarAfter) {
return this.$scopedSlots['toolbarAfter']() return this.$scopedSlots.toolbarAfter()
} }
return null return null
}, },
@@ -1329,7 +1330,7 @@ export default {
return h('j-vxe-sub-popover', { return h('j-vxe-sub-popover', {
ref: 'subPopover', ref: 'subPopover',
scopedSlots: { scopedSlots: {
subForm: this.$scopedSlots.subForm, subForm: this.$scopedSlots.subForm
} }
}) })
} }
@@ -1358,7 +1359,7 @@ export default {
}, },
on: { on: {
change: (e) => this.trigger('pageChange', e) change: (e) => this.trigger('pageChange', e)
}, }
}) })
} }
return null return null
@@ -1385,7 +1386,7 @@ export default {
this.renderToolbar(h), this.renderToolbar(h),
this.renderToolbarAfterSlot(), this.renderToolbarAfterSlot(),
this.renderVxeGrid(h), this.renderVxeGrid(h),
this.renderPagination(h), this.renderPagination(h)
]) ])
}, },
beforeDestroy () { beforeDestroy () {
@@ -1406,7 +1407,7 @@ const fooPatterns = [
{ title: '字母', value: 's', pattern: /^[A-Z|a-z]+$/ }, { title: '字母', value: 's', pattern: /^[A-Z|a-z]+$/ },
{ title: '数字', value: 'n', pattern: /^-?\d+(\.?\d+|\d?)$/ }, { title: '数字', value: 'n', pattern: /^-?\d+(\.?\d+|\d?)$/ },
{ title: '整数', value: 'z', pattern: /^-?\d+$/ }, { title: '整数', value: 'z', pattern: /^-?\d+$/ },
{title: '金额', value: 'money', pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/}, { title: '金额', value: 'money', pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/ }
] ]
/** 旧版handler转为新版Validator */ /** 旧版handler转为新版Validator */
@@ -1420,7 +1421,7 @@ function handlerConvertToValidator(event) {
} }
if (flag == null) { if (flag == null) {
resolve(message) resolve(message)
} else if (!!flag) { } else if (flag) {
resolve(message) resolve(message)
} else { } else {
reject(new Error(message)) reject(new Error(message))
@@ -1432,9 +1433,9 @@ function handlerConvertToValidator(event) {
/** 唯一校验器 */ /** 唯一校验器 */
function uniqueValidator (event) { function uniqueValidator (event) {
const { cellValue, column, rule } = event const { cellValue, column, rule } = event
let tableData = this.getTableData() const tableData = this.getTableData()
let findCount = 0 let findCount = 0
for (let rowData of tableData) { for (const rowData of tableData) {
if (rowData[column.own.key] === cellValue) { if (rowData[column.own.key] === cellValue) {
if (++findCount >= 2) { if (++findCount >= 2) {
return Promise.reject(new Error(rule.message)) return Promise.reject(new Error(rule.message))
@@ -37,25 +37,25 @@
size: String, size: String,
disabled: Boolean, disabled: Boolean,
disabledRows: Object, disabledRows: Object,
selectedRowIds: Array, selectedRowIds: Array
}, },
data () { data () {
return { return {
// 是否收起 // 是否收起
collapsed: true, collapsed: true
} }
}, },
computed: { computed: {
boxClass () { boxClass () {
return { return {
'j-vxe-toolbar': true, 'j-vxe-toolbar': true,
'j-vxe-toolbar-collapsed': this.collapsed, 'j-vxe-toolbar-collapsed': this.collapsed
} }
}, },
btns () { btns () {
let arr = this.toolbarConfig.btn || ['add', 'remove', 'clearSelection'] const arr = this.toolbarConfig.btn || ['add', 'remove', 'clearSelection']
let exclude = [...this.excludeCode] const exclude = [...this.excludeCode]
// TODO 需要将remove替换batch_delete // TODO 需要将remove替换batch_delete
// 系统默认的批量删除编码配置为 batch_delete 此处需要转化一下 // 系统默认的批量删除编码配置为 batch_delete 此处需要转化一下
if (exclude.indexOf('batch_delete') >= 0) { if (exclude.indexOf('batch_delete') >= 0) {
@@ -88,7 +88,7 @@
if (this.btns.includes('clearSelection')) { if (this.btns.includes('clearSelection')) {
// 有禁用行时才显示清空选择按钮 // 有禁用行时才显示清空选择按钮
// 因为禁用行会阻止选择行导致无法取消全选 // 因为禁用行会阻止选择行导致无法取消全选
let length = Object.keys(this.disabledRows).length const length = Object.keys(this.disabledRows).length
return length > 0 return length > 0
} }
return false return false
@@ -99,7 +99,7 @@
btnSize () { btnSize () {
return this.size === 'tiny' ? 'small' : null return this.size === 'tiny' ? 'small' : null
}, }
}, },
methods: { methods: {
/** 触发事件 */ /** 触发事件 */
@@ -109,8 +109,8 @@
// 切换展开收起 // 切换展开收起
toggleCollapse () { toggleCollapse () {
this.collapsed = !this.collapsed this.collapsed = !this.collapsed
}, }
}, }
} }
</script> </script>
@@ -37,23 +37,23 @@
style['text-align'] = 'center' style['text-align'] = 'center'
} }
return style return style
}, }
}, },
methods: { methods: {
handleChange (event) { handleChange (event) {
this.handleChangeCommon(event.target.checked) this.handleChangeCommon(event.target.checked)
}, }
}, },
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
enhanced: { enhanced: {
switches: { switches: {
visible: true, visible: true
}, },
getValue (value) { getValue (value) {
let {own: col} = this.column const { own: col } = this.column
// 处理 customValue // 处理 customValue
if (Array.isArray(col.customValue)) { if (Array.isArray(col.customValue)) {
let customValue = getCustomValue(col) const customValue = getCustomValue(col)
if (typeof value === 'boolean') { if (typeof value === 'boolean') {
return value ? customValue[0] : customValue[1] return value ? customValue[0] : customValue[1]
} else { } else {
@@ -64,30 +64,30 @@
} }
}, },
setValue (value) { setValue (value) {
let {own: col} = this.column const { own: col } = this.column
// 判断是否设定了customValue自定义值 // 判断是否设定了customValue自定义值
if (Array.isArray(col.customValue)) { if (Array.isArray(col.customValue)) {
let customValue = getCustomValue(col) const customValue = getCustomValue(col)
return neverNull(value).toString() === customValue[0].toString() return neverNull(value).toString() === customValue[0].toString()
} else { } else {
return !!value return !!value
} }
}, },
createValue ({ column }) { createValue ({ column }) {
let {own: col} = column const { own: col } = column
if (Array.isArray(col.customValue)) { if (Array.isArray(col.customValue)) {
let customValue = getCustomValue(col) const customValue = getCustomValue(col)
return col.defaultChecked ? customValue[0] : customValue[1] return col.defaultChecked ? customValue[0] : customValue[1]
} else { } else {
return !!col.defaultChecked return !!col.defaultChecked
} }
}, }
} }
} }
function getCustomValue (col) { function getCustomValue (col) {
let customTrue = neverNull(col.customValue[0], true) const customTrue = neverNull(col.customValue[0], true)
let customFalse = neverNull(col.customValue[1], false) const customFalse = neverNull(col.customValue[1], false)
return [customTrue, customFalse] return [customTrue, customFalse]
} }
</script> </script>
@@ -23,7 +23,7 @@
props: {}, props: {},
data () { data () {
return { return {
innerDateValue: null, innerDateValue: null
} }
}, },
computed: { computed: {
@@ -31,9 +31,9 @@
return this.$type === JVXETypes.datetime return this.$type === JVXETypes.datetime
}, },
dateFormat () { dateFormat () {
let format = this.originColumn.format const format = this.originColumn.format
return format ? format : (this.isDatetime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD') return format || (this.isDatetime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD')
}, }
}, },
watch: { watch: {
innerValue: { innerValue: {
@@ -57,8 +57,8 @@
aopEvents: { aopEvents: {
editActived (event) { editActived (event) {
dispatchEvent.call(this, event, 'ant-calendar-picker', el => el.children[0].dispatchEvent(event.$event)) dispatchEvent.call(this, event, 'ant-calendar-picker', el => el.children[0].dispatchEvent(event.$event))
}, }
}, }
} }
} }
</script> </script>
@@ -108,7 +108,7 @@
this.departIds = '' this.departIds = ''
} else { } else {
value = rows.map(row => row[this.customReturnField]).join(',') value = rows.map(row => row[this.customReturnField]).join(',')
this.departNames = rows.map(row => row['departName']).join(',') this.departNames = rows.map(row => row.departName).join(',')
this.departIds = idstr this.departIds = idstr
} }
this.handleChangeCommon(this.departIds) this.handleChangeCommon(this.departIds)
@@ -35,7 +35,7 @@
}, },
disabledMoveDown () { disabledMoveDown () {
return this.rowIndex === (this.fullDataLength - 1) return this.rowIndex === (this.fullDataLength - 1)
}, }
}, },
methods: { methods: {
/** 向上移 */ /** 向上移 */
@@ -55,15 +55,15 @@
/** 插入一行 */ /** 插入一行 */
handleRowInsertDown () { handleRowInsertDown () {
this.trigger('rowInsertDown', this.rowIndex) this.trigger('rowInsertDown', this.rowIndex)
}, }
}, },
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
enhanced: { enhanced: {
// 功能开关 // 功能开关
switches: { switches: {
editRender: false editRender: false
}, }
}, }
} }
</script> </script>
@@ -20,8 +20,8 @@
/** 处理change事件 */ /** 处理change事件 */
handleChange (event) { handleChange (event) {
let {$type} = this const { $type } = this
let {target} = event const { target } = event
let { value, selectionStart } = target let { value, selectionStart } = target
let change = true let change = true
if ($type === JVXETypes.inputNumber) { if ($type === JVXETypes.inputNumber) {
@@ -48,8 +48,8 @@
/** 处理blur失去焦点事件 */ /** 处理blur失去焦点事件 */
handleBlur (event) { handleBlur (event) {
let {$type} = this const { $type } = this
let {target} = event const { target } = event
// 判断输入的值是否匹配数字正则表达式不匹配就置空 // 判断输入的值是否匹配数字正则表达式不匹配就置空
if ($type === JVXETypes.inputNumber) { if ($type === JVXETypes.inputNumber) {
if (!NumberRegExp.test(target.value)) { if (!NumberRegExp.test(target.value)) {
@@ -61,14 +61,14 @@
} }
this.handleBlurCommon(target.value) this.handleBlurCommon(target.value)
}, }
}, },
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
enhanced: { enhanced: {
installOptions: { installOptions: {
// 自动聚焦的 class 类名 // 自动聚焦的 class 类名
autofocus: '.ant-input', autofocus: '.ant-input'
}, },
getValue (value) { getValue (value) {
if (this.$type === JVXETypes.inputNumber && typeof value === 'string') { if (this.$type === JVXETypes.inputNumber && typeof value === 'string') {
@@ -77,7 +77,7 @@
} }
} }
return value return value
}, }
} }
} }
</script> </script>
@@ -20,19 +20,19 @@
}, },
reloadEffect () { reloadEffect () {
return (this.renderOptions.reloadEffect && this.reloadEffectRowKeysMap[this.row.id]) === true return (this.renderOptions.reloadEffect && this.reloadEffectRowKeysMap[this.row.id]) === true
}, }
}, },
methods: { methods: {
// 特效结束 // 特效结束
handleEffectEnd () { handleEffectEnd () {
this.$delete(this.reloadEffectRowKeysMap, this.row.id) this.$delete(this.reloadEffectRowKeysMap, this.row.id)
}, }
}, },
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
enhanced: { enhanced: {
switches: { switches: {
editRender: false, editRender: false
}, }
} }
} }
</script> </script>
@@ -26,13 +26,13 @@
}, },
scrolling () { scrolling () {
return !!this.renderOptions.scrolling return !!this.renderOptions.scrolling
}, }
}, },
methods: {}, methods: {},
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
enhanced: { enhanced: {
switches: { switches: {
editRender: false, editRender: false
}, },
setValue (value) { setValue (value) {
try { try {
@@ -44,7 +44,7 @@
} catch { } catch {
return 0 return 0
} }
}, }
} }
} }
</script> </script>
@@ -37,16 +37,16 @@
return { return {
loading: false, loading: false,
// 异步加载的options用于多级联动 // 异步加载的options用于多级联动
asyncOptions: null, asyncOptions: null
} }
}, },
computed: { computed: {
selectProps () { selectProps () {
let props = {...this.cellProps} const props = { ...this.cellProps }
// 判断select是否允许输入 // 判断select是否允许输入
let {allowSearch, allowInput} = this.originColumn const { allowSearch, allowInput } = this.originColumn
if (allowInput === true || allowSearch === true) { if (allowInput === true || allowSearch === true) {
props['showSearch'] = true props.showSearch = true
} }
return props return props
}, },
@@ -55,10 +55,10 @@
if (this.asyncOptions) { if (this.asyncOptions) {
return this.asyncOptions return this.asyncOptions
} }
let {linkage} = this.renderOptions const { linkage } = this.renderOptions
if (linkage) { if (linkage) {
let {getLinkageOptionsSibling, config} = linkage const { getLinkageOptionsSibling, config } = linkage
let res = getLinkageOptionsSibling(this.row, this.originColumn, config, true) const res = getLinkageOptionsSibling(this.row, this.originColumn, config, true)
// 当返回Promise时说明是多级联动 // 当返回Promise时说明是多级联动
if (res instanceof Promise) { if (res instanceof Promise) {
this.loading = true this.loading = true
@@ -75,16 +75,16 @@
} }
} }
return this.originColumn.options return this.originColumn.options
}, }
}, },
created () { created () {
let multiple = [JVXETypes.selectMultiple, JVXETypes.list_multi] const multiple = [JVXETypes.selectMultiple, JVXETypes.list_multi]
let search = [JVXETypes.selectSearch, JVXETypes.sel_search] const search = [JVXETypes.selectSearch, JVXETypes.sel_search]
if (multiple.includes(this.$type)) { if (multiple.includes(this.$type)) {
// 处理多选 // 处理多选
let props = this.originColumn.props || {} const props = this.originColumn.props || {}
props['mode'] = 'multiple' props.mode = 'multiple'
props['maxTagCount'] = 1 props.maxTagCount = 1
this.$set(this.originColumn, 'props', props) this.$set(this.originColumn, 'props', props)
} else if (search.includes(this.$type)) { } else if (search.includes(this.$type)) {
// 处理搜索 // 处理搜索
@@ -94,7 +94,7 @@
methods: { methods: {
handleChange (value) { handleChange (value) {
// 处理下级联动 // 处理下级联动
let linkage = this.renderOptions.linkage const linkage = this.renderOptions.linkage
if (linkage) { if (linkage) {
linkage.linkageSelectChange(this.row, this.originColumn, linkage.config, value) linkage.linkageSelectChange(this.row, this.originColumn, linkage.config, value)
} }
@@ -102,12 +102,12 @@
}, },
/** 处理blur失去焦点事件 */ /** 处理blur失去焦点事件 */
handleBlur (value) { handleBlur (value) {
let {allowInput, options} = this.originColumn const { allowInput, options } = this.originColumn
if (allowInput === true) { if (allowInput === true) {
// 删除无用的因搜索用户输入而创建的项 // 删除无用的因搜索用户输入而创建的项
if (typeof value === 'string') { if (typeof value === 'string') {
let indexes = [] const indexes = []
options.forEach((option, index) => { options.forEach((option, index) => {
if (option.value.toLocaleString() === value.toLocaleString()) { if (option.value.toLocaleString() === value.toLocaleString()) {
delete option.searchAdd delete option.searchAdd
@@ -116,7 +116,7 @@
} }
}) })
// 翻转删除数组中的项 // 翻转删除数组中的项
for (let index of indexes.reverse()) { for (const index of indexes.reverse()) {
options.splice(index, 1) options.splice(index, 1)
} }
} }
@@ -127,7 +127,7 @@
/** 用于搜索下拉框中的内容 */ /** 用于搜索下拉框中的内容 */
handleSelectFilterOption (input, option) { handleSelectFilterOption (input, option) {
let {allowSearch, allowInput} = this.originColumn const { allowSearch, allowInput } = this.originColumn
if (allowSearch === true || allowInput === true) { if (allowSearch === true || allowInput === true) {
// update-begin-author:taoyan date:20200820 for:专项任务大连项目反馈行编辑问题处理 下拉框搜索 // update-begin-author:taoyan date:20200820 for:专项任务大连项目反馈行编辑问题处理 下拉框搜索
return option.componentOptions.children[0].children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 return option.componentOptions.children[0].children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
@@ -138,12 +138,12 @@
/** select 搜索时的事件,用于动态添加options */ /** select 搜索时的事件,用于动态添加options */
handleSearchSelect (value) { handleSearchSelect (value) {
let {allowSearch, allowInput, options} = this.originColumn const { allowSearch, allowInput, options } = this.originColumn
if (allowSearch !== true && allowInput === true) { if (allowSearch !== true && allowInput === true) {
// 是否找到了对应的项找不到则添加这一项 // 是否找到了对应的项找不到则添加这一项
let flag = false let flag = false
for (let option of options) { for (const option of options) {
if (option.value.toLocaleString() === value.toLocaleString()) { if (option.value.toLocaleString() === value.toLocaleString()) {
flag = true flag = true
break break
@@ -154,9 +154,8 @@
// searchAdd 是否是通过搜索添加的 // searchAdd 是否是通过搜索添加的
options.push({ title: value, value: value, searchAdd: true }) options.push({ title: value, value: value, searchAdd: true })
} }
} }
}, }
}, },
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
@@ -164,16 +163,16 @@
aopEvents: { aopEvents: {
editActived (event) { editActived (event) {
dispatchEvent.call(this, event, 'ant-select') dispatchEvent.call(this, event, 'ant-select')
}, }
}, },
translate: { translate: {
enabled: true, enabled: true,
async handler(value,) { async handler (value) {
let options let options
let {linkage} = this.renderOptions const { linkage } = this.renderOptions
// 判断是否是多级联动如果是就通过接口异步翻译 // 判断是否是多级联动如果是就通过接口异步翻译
if (linkage) { if (linkage) {
let {getLinkageOptionsSibling, config} = linkage const { getLinkageOptionsSibling, config } = linkage
options = getLinkageOptionsSibling(this.row, this.originColumn, config, true) options = getLinkageOptionsSibling(this.row, this.originColumn, config, true)
if (options instanceof Promise) { if (options instanceof Promise) {
return new Promise(resolve => { return new Promise(resolve => {
@@ -186,7 +185,7 @@
options = this.column.own.options options = this.column.own.options
} }
return filterDictText(options, value) return filterDictText(options, value)
}, }
}, },
getValue (value) { getValue (value) {
if (Array.isArray(value)) { if (Array.isArray(value)) {
@@ -196,9 +195,9 @@
} }
}, },
setValue (value) { setValue (value) {
let {column: {own: col}, params: {$table}} = this const { column: { own: col }, params: { $table } } = this
// 判断是否是多选 // 判断是否是多选
if ((col.props || {})['mode'] === 'multiple') { if ((col.props || {}).mode === 'multiple') {
$table.$set(col.props, 'maxTagCount', 1) $table.$set(col.props, 'maxTagCount', 1)
} }
if (value != null && value !== '') { if (value != null && value !== '') {
@@ -23,12 +23,12 @@ export default {
scrolling: this.renderOptions.scrolling, scrolling: this.renderOptions.scrolling,
reloadEffect: this.renderOptions.reloadEffect, reloadEffect: this.renderOptions.reloadEffect,
triggerChange: (v) => this.handleChangeCommon(v), triggerChange: (v) => this.handleChangeCommon(v)
}
} }
}, },
},
render (h) { render (h) {
let {slot} = this.renderOptions const { slot } = this.renderOptions
if (slot) { if (slot) {
return h('div', {}, slot(this.slotProps)) return h('div', {}, slot(this.slotProps))
} else { } else {
@@ -39,7 +39,7 @@ export default {
enhanced: { enhanced: {
switches: { switches: {
editRender: false editRender: false
}, }
} }
} }
@@ -6,7 +6,7 @@ export const TagsSpanCell = {
mixins: [JVxeCellMixins], mixins: [JVxeCellMixins],
data () { data () {
return { return {
innerTags: [], innerTags: []
} }
}, },
watch: { watch: {
@@ -14,21 +14,21 @@ export const TagsSpanCell = {
immediate: true, immediate: true,
handler (value) { handler (value) {
if (value !== this.innerTags.join(';')) { if (value !== this.innerTags.join(';')) {
let rv = replaceValue(value) const rv = replaceValue(value)
this.innerTags = rv.split(';') this.innerTags = rv.split(';')
this.handleChangeCommon(rv) this.handleChangeCommon(rv)
} }
}, }
}, }
}, },
methods: { methods: {
renderTags (h) { renderTags (h) {
let tags = [] const tags = []
for (let tag of this.innerTags) { for (const tag of this.innerTags) {
if (tag) { if (tag) {
let tagProps = {} const tagProps = {}
let tagStyle = {} const tagStyle = {}
let setTagColor = this.originColumn.setTagColor const setTagColor = this.originColumn.setTagColor
if (typeof setTagColor === 'function') { if (typeof setTagColor === 'function') {
/** /**
* 设置 tag 颜色 * 设置 tag 颜色
@@ -41,11 +41,11 @@ export const TagsSpanCell = {
* event.column.own 当前列的原始配置 * event.column.own 当前列的原始配置
* @return Array | String 可以返回一个数组数据第一项是tag背景颜色第二项是字体颜色也可以返回一个字符串即tag背景颜色 * @return Array | String 可以返回一个数组数据第一项是tag背景颜色第二项是字体颜色也可以返回一个字符串即tag背景颜色
*/ */
let color = setTagColor({ const color = setTagColor({
tagValue: tag, tagValue: tag,
value: this.innerValue, value: this.innerValue,
row: this.row, row: this.row,
column: this.column, column: this.column
}) })
if (Array.isArray(color)) { if (Array.isArray(color)) {
tagProps.color = color[0] tagProps.color = color[0]
@@ -56,18 +56,18 @@ export const TagsSpanCell = {
} }
tags.push(h('a-tag', { tags.push(h('a-tag', {
props: tagProps, props: tagProps,
style: tagStyle, style: tagStyle
}, [tag])) }, [tag]))
} }
} }
return tags return tags
}, }
}, },
render (h) { render (h) {
return h('div', {}, [ return h('div', {}, [
this.renderTags(h) this.renderTags(h)
]) ])
}, }
} }
// tags 组件的输入框 // tags 组件的输入框
@@ -76,7 +76,7 @@ export const TagsInputCell = {
mixins: [JVxeCellMixins], mixins: [JVxeCellMixins],
data () { data () {
return { return {
innerTagValue: '', innerTagValue: ''
} }
}, },
watch: { watch: {
@@ -86,8 +86,8 @@ export const TagsInputCell = {
if (value !== this.innerTagValue) { if (value !== this.innerTagValue) {
this.handleInputChange(value) this.handleInputChange(value)
} }
}, }
}, }
}, },
methods: { methods: {
@@ -95,7 +95,7 @@ export const TagsInputCell = {
this.innerTagValue = replaceValue(value, event) this.innerTagValue = replaceValue(value, event)
this.handleChangeCommon(this.innerTagValue) this.handleChangeCommon(this.innerTagValue)
return this.innerTagValue return this.innerTagValue
}, }
}, },
render (h) { render (h) {
@@ -106,15 +106,15 @@ export const TagsInputCell = {
}, },
on: { on: {
change: (event) => { change: (event) => {
let {target, target: {value}} = event const { target, target: { value } } = event
let newValue = this.handleInputChange(value, event) const newValue = this.handleInputChange(value, event)
if (newValue !== value) { if (newValue !== value) {
target.value = newValue target.value = newValue
} }
} }
}, }
}) })
}, }
} }
// 将值每隔两位加上一个分号 // 将值每隔两位加上一个分号
@@ -124,18 +124,18 @@ function replaceValue(value, event) {
value = value.replace(/;/g, '') value = value.replace(/;/g, '')
// 然后再遍历添加分号 // 然后再遍历添加分号
let rv = '' let rv = ''
let splitArr = value.split('') const splitArr = value.split('')
let count = 0 let count = 0
splitArr.forEach((val, index) => { splitArr.forEach((val, index) => {
rv += val rv += val
let position = index + 1 const position = index + 1
if (position % 2 === 0 && position < splitArr.length) { if (position % 2 === 0 && position < splitArr.length) {
count++ count++
rv += ';' rv += ';'
} }
}) })
if (event && count > 0) { if (event && count > 0) {
let {target, target: {selectionStart}} = event const { target, target: { selectionStart } } = event
target.selectionStart = selectionStart + count target.selectionStart = selectionStart + count
target.selectionEnd = selectionStart + count target.selectionEnd = selectionStart + count
} }
@@ -20,14 +20,14 @@
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
enhanced: { enhanced: {
installOptions: { installOptions: {
autofocus: '.ant-input', autofocus: '.ant-input'
}, },
aopEvents: { aopEvents: {
editActived (event) { editActived (event) {
dispatchEvent.call(this, event, 'anticon-fullscreen') dispatchEvent.call(this, event, 'anticon-fullscreen')
}, }
}, }
}, }
} }
</script> </script>
@@ -71,14 +71,14 @@
props: {}, props: {},
data () { data () {
return { return {
innerFile: null, innerFile: null
} }
}, },
computed: { computed: {
/** upload headers */ /** upload headers */
uploadHeaders () { uploadHeaders () {
let {originColumn: col} = this const { originColumn: col } = this
let headers = {} const headers = {}
if (col.token === true) { if (col.token === true) {
headers['X-Access-Token'] = this.$ls.get(ACCESS_TOKEN) headers['X-Access-Token'] = this.$ls.get(ACCESS_TOKEN)
} }
@@ -87,7 +87,7 @@
hasFile () { hasFile () {
return this.innerFile != null return this.innerFile != null
}, }
}, },
watch: { watch: {
@@ -99,15 +99,15 @@
} else { } else {
this.innerFile = null this.innerFile = null
} }
}, }
}, }
}, },
methods: { methods: {
handleChangeUpload (info) { handleChangeUpload (info) {
let {row, originColumn: col} = this const { row, originColumn: col } = this
let {file} = info const { file } = info
let value = { const value = {
name: file.name, name: file.name,
type: file.type, type: file.type,
size: file.size, size: file.size,
@@ -115,22 +115,22 @@
percent: file.percent percent: file.percent
} }
if (col.responseName && file.response) { if (col.responseName && file.response) {
value['responseName'] = file.response[col.responseName] value.responseName = file.response[col.responseName]
} }
if (file.status === 'done') { if (file.status === 'done') {
if (typeof file.response.success === 'boolean') { if (typeof file.response.success === 'boolean') {
if (file.response.success) { if (file.response.success) {
value['path'] = file.response[col.responseName] value.path = file.response[col.responseName]
} else { } else {
value['status'] = 'error' value.status = 'error'
value['message'] = file.response.message || '未知错误' value.message = file.response.message || '未知错误'
} }
} else { } else {
// 考虑到如果设置action上传路径为非jeecg-boot后台可能不会返回 success 属性的情况就默认为成功 // 考虑到如果设置action上传路径为非jeecg-boot后台可能不会返回 success 属性的情况就默认为成功
value['path'] = file.response[col.responseName] value.path = file.response[col.responseName]
} }
} else if (file.status === 'error') { } else if (file.status === 'error') {
value['message'] = file.response.message || '未知错误' value.message = file.response.message || '未知错误'
} }
this.innerFile = value this.innerFile = value
}, },
@@ -140,23 +140,23 @@
// }, // },
handleClickDownloadFile (id) { handleClickDownloadFile (id) {
let {path} = this.value || {} const { path } = this.value || {}
if (path) { if (path) {
let url = getFileAccessHttpUrl(path) const url = getFileAccessHttpUrl(path)
window.open(url) window.open(url)
} }
}, },
handleClickDeleteFile () { handleClickDeleteFile () {
this.handleChangeCommon(null) this.handleChangeCommon(null)
}, }
}, },
// 组件增强注释详见JVxeCellMixins.js // 组件增强注释详见JVxeCellMixins.js
enhanced: { enhanced: {
switches: { visible: true }, switches: { visible: true },
getValue: value => fileGetValue(value), getValue: value => fileGetValue(value),
setValue: value => fileSetValue(value), setValue: value => fileSetValue(value)
} }
} }
@@ -169,12 +169,12 @@
function fileSetValue (value) { function fileSetValue (value) {
if (value) { if (value) {
let first = value.split(',')[0] const first = value.split(',')[0]
let name = first.substring(first.lastIndexOf('/') + 1) const name = first.substring(first.lastIndexOf('/') + 1)
return { return {
name: name, name: name,
path: value, path: value,
status: 'done', status: 'done'
} }
} }
return value return value
@@ -96,14 +96,14 @@
this.$refs.selectModal.showModal() this.$refs.selectModal.showModal()
}, },
selectOK (rows, idstr) { selectOK (rows, idstr) {
console.log("当前选中用户", rows) console.log('当前选中用户', rows)
console.log("当前选中用户ID", idstr) console.log('当前选中用户ID', idstr)
if (!rows) { if (!rows) {
this.userNames = '' this.userNames = ''
this.userIds = '' this.userIds = ''
} else { } else {
let temp = '' let temp = ''
for (let item of rows) { for (const item of rows) {
temp += ',' + item.realname temp += ',' + item.realname
} }
this.userNames = temp.substring(1) this.userNames = temp.substring(1)
@@ -116,7 +116,7 @@
}, },
initComp (userNames) { initComp (userNames) {
this.userNames = userNames this.userNames = userNames
}, }
}, },
enhanced: { enhanced: {
switches: { switches: {
@@ -6,7 +6,7 @@ export default {
props: { props: {
vNode: null, vNode: null,
// 是否启用特效 // 是否启用特效
effect: Boolean, effect: Boolean
}, },
data () { data () {
return { return {
@@ -14,7 +14,7 @@ export default {
innerEffect: false, innerEffect: false,
// 应付同时多个特效 // 应付同时多个特效
effectIdx: 0, effectIdx: 0,
effectList: [], effectList: []
} }
}, },
watch: { watch: {
@@ -24,11 +24,11 @@ export default {
handler (vNode, old) { handler (vNode, old) {
this.innerEffect = this.effect this.innerEffect = this.effect
if (this.innerEffect && old != null) { if (this.innerEffect && old != null) {
let topLayer = this.renderSpan(old, 'top') const topLayer = this.renderSpan(old, 'top')
this.effectList.push(topLayer) this.effectList.push(topLayer)
} }
}, }
}, }
}, },
methods: { methods: {
@@ -37,13 +37,13 @@ export default {
if (this.vNode == null) { if (this.vNode == null) {
return null return null
} }
let bottom = this.renderSpan(this.vNode, 'bottom') const bottom = this.renderSpan(this.vNode, 'bottom')
// 启用了特效并且有旧数据就渲染特效顶层 // 启用了特效并且有旧数据就渲染特效顶层
if (this.innerEffect && this.effectList.length > 0) { if (this.innerEffect && this.effectList.length > 0) {
this.$emit('effect-begin') this.$emit('effect-begin')
// 1.4s 以后关闭特效 // 1.4s 以后关闭特效
window.setTimeout(() => { window.setTimeout(() => {
let item = this.effectList[this.effectIdx] const item = this.effectList[this.effectIdx]
if (item && item.elm) { if (item && item.elm) {
// 特效结束后展示先把 display 设为 none而不是直接删掉该元素 // 特效结束后展示先把 display 设为 none而不是直接删掉该元素
// 目的是为了防止页面重新渲染导致动画重置 // 目的是为了防止页面重新渲染导致动画重置
@@ -64,21 +64,21 @@ export default {
}, },
// 渲染内容 span // 渲染内容 span
renderSpan (vNode, layer) { renderSpan (vNode, layer) {
let options = { const options = {
key: layer + this.effectIdx + randomString(6), key: layer + this.effectIdx + randomString(6),
class: ['j-vxe-reload-effect-span', `layer-${layer}`], class: ['j-vxe-reload-effect-span', `layer-${layer}`],
style: {}, style: {}
} }
if (layer === 'top') { if (layer === 'top') {
// 最新渲染的在下面 // 最新渲染的在下面
options.style['z-index'] = (9999 - this.effectIdx) options.style['z-index'] = (9999 - this.effectIdx)
} }
return this.$createElement('span', options, [vNode]) return this.$createElement('span', options, [vNode])
}, }
}, },
render (h) { render (h) {
return h('div', { return h('div', {
class: ['j-vxe-reload-effect-box'], class: ['j-vxe-reload-effect-box']
}, [this.renderVNode()]) }, [this.renderVNode()])
}, }
} }
@@ -43,16 +43,16 @@ installAllCell(VXETable)
// 比如点击了某个组件的弹出层面板之后此时被激活单元格不应该被自动关闭通过返回 false 可以阻止默认的行为 // 比如点击了某个组件的弹出层面板之后此时被激活单元格不应该被自动关闭通过返回 false 可以阻止默认的行为
VXETable.interceptor.add('event.clearActived', function (params, event, target) { VXETable.interceptor.add('event.clearActived', function (params, event, target) {
// 获取组件增强 // 获取组件增强
let col = params.column.own const col = params.column.own
const interceptor = getEnhancedMixins(col.$type, 'interceptor') const interceptor = getEnhancedMixins(col.$type, 'interceptor')
// 执行增强 // 执行增强
let flag = interceptor['event.clearActived'].apply(this, arguments) const flag = interceptor['event.clearActived'].apply(this, arguments)
if (flag === false) { if (flag === false) {
return false return false
} }
let path = getEventPath(event) const path = getEventPath(event)
for (let p of path) { for (const p of path) {
let className = p.className || '' let className = p.className || ''
className = typeof className === 'string' ? className : className.toString() className = typeof className === 'string' ? className : className.toString()
@@ -67,7 +67,7 @@ VXETable.interceptor.add('event.clearActived', function (params, event, target)
return false return false
} }
// 执行增强 // 执行增强
let flag = interceptor['event.clearActived.className'].apply(this, [className, ...arguments]) const flag = interceptor['event.clearActived.className'].apply(this, [className, ...arguments])
if (flag === false) { if (flag === false) {
return false return false
} }
@@ -81,7 +81,7 @@ VXETable.interceptor.add('event.clearActived', function (params, event, target)
* @param span 显示组件可空默认为 JVxeNormalCell 组件 * @param span 显示组件可空默认为 JVxeNormalCell 组件
*/ */
export function mapCell (type, cell, span) { export function mapCell (type, cell, span) {
let cells = {[type]: cell} const cells = { [type]: cell }
if (span) { if (span) {
cells[type + ':span'] = span cells[type + ':span'] = span
} }
@@ -96,7 +96,7 @@ export function mapCell(type, cell, span) {
* @param span 显示组件可空默认为 JVxeNormalCell 组件 * @param span 显示组件可空默认为 JVxeNormalCell 组件
*/ */
export function installCell (type, cell, span) { export function installCell (type, cell, span) {
let exclude = [JVXETypes.rowNumber, JVXETypes.rowCheckbox, JVXETypes.rowRadio, JVXETypes.rowExpand, JVXETypes.rowDragSort] const exclude = [JVXETypes.rowNumber, JVXETypes.rowCheckbox, JVXETypes.rowRadio, JVXETypes.rowExpand, JVXETypes.rowDragSort]
if (exclude.includes(type)) { if (exclude.includes(type)) {
throw new Error(`installCell不能使用"${type}"作为组件的type因为这是关键字`) throw new Error(`installCell不能使用"${type}"作为组件的type因为这是关键字`)
} }
@@ -40,5 +40,5 @@ export const JVXETypes = {
slot: 'slot', slot: 'slot',
normal: 'normal', normal: 'normal',
hidden: 'hidden', hidden: 'hidden'
} }
@@ -5,7 +5,7 @@ import { getEnhancedMixins, JVXERenderType, replaceProps } from '@/components/je
// noinspection JSUnusedLocalSymbols // noinspection JSUnusedLocalSymbols
export default { export default {
inject: { inject: {
getParentContainer: {default: () => ((node) => node.parentNode)}, getParentContainer: { default: () => (node) => node.parentNode }
}, },
props: { props: {
value: PropTypes.any, value: PropTypes.any,
@@ -16,11 +16,11 @@ export default {
// 渲染选项 // 渲染选项
renderOptions: PropTypes.object, renderOptions: PropTypes.object,
// 渲染类型 // 渲染类型
renderType: PropTypes.string.def('default'), renderType: PropTypes.string.def('default')
}, },
data () { data () {
return { return {
innerValue: null, innerValue: null
} }
}, },
computed: { computed: {
@@ -46,12 +46,12 @@ export default {
return this.params.columnIndex return this.params.columnIndex
}, },
cellProps () { cellProps () {
let {originColumn: col, renderOptions} = this const { originColumn: col, renderOptions } = this
let props = {} const props = {}
// 输入占位符 // 输入占位符
props['placeholder'] = replaceProps(col, col.placeholder) props.placeholder = replaceProps(col, col.placeholder)
// 解析props // 解析props
if (typeof col.props === 'object') { if (typeof col.props === 'object') {
@@ -61,7 +61,7 @@ export default {
} }
// 判断是否是禁用的列 // 判断是否是禁用的列
props['disabled'] = (typeof col['disabled'] === 'boolean' ? col['disabled'] : props['disabled']) props.disabled = (typeof col.disabled === 'boolean' ? col.disabled : props.disabled)
// TODO 判断是否是禁用的行 // TODO 判断是否是禁用的行
// if (props['disabled'] !== true) { // if (props['disabled'] !== true) {
@@ -70,11 +70,11 @@ export default {
// 判断是否禁用所有组件 // 判断是否禁用所有组件
if (renderOptions.disabled === true) { if (renderOptions.disabled === true) {
props['disabled'] = true props.disabled = true
} }
return props return props
}, }
}, },
watch: { watch: {
$type: { $type: {
@@ -82,7 +82,7 @@ export default {
handler ($type) { handler ($type) {
this.enhanced = getEnhancedMixins($type) this.enhanced = getEnhancedMixins($type)
this.listeners = getListeners.call(this) this.listeners = getListeners.call(this)
}, }
}, },
value: { value: {
immediate: true, immediate: true,
@@ -90,8 +90,8 @@ export default {
let value = val let value = val
// 验证值格式 // 验证值格式
let originValue = this.row[this.column.property] const originValue = this.row[this.column.property]
let getValue = this.enhanced.getValue.call(this, originValue) const getValue = this.enhanced.getValue.call(this, originValue)
if (originValue !== getValue) { if (originValue !== getValue) {
// 值格式不正确重新赋值 // 值格式不正确重新赋值
value = getValue value = getValue
@@ -102,7 +102,7 @@ export default {
// 判断是否启用翻译 // 判断是否启用翻译
if (this.renderType === JVXERenderType.spaner && this.enhanced.translate.enabled) { if (this.renderType === JVXERenderType.spaner && this.enhanced.translate.enabled) {
let res = this.enhanced.translate.handler.call(this, value) const res = this.enhanced.translate.handler.call(this, value)
// 异步翻译目前仅多级联动使用 // 异步翻译目前仅多级联动使用
if (res instanceof Promise) { if (res instanceof Promise) {
res.then(value => this.innerValue = value) res.then(value => this.innerValue = value)
@@ -110,8 +110,8 @@ export default {
this.innerValue = res this.innerValue = res
} }
} }
}, }
}, }
}, },
created () { created () {
}, },
@@ -119,7 +119,7 @@ export default {
/** 通用处理change事件 */ /** 通用处理change事件 */
handleChangeCommon (value) { handleChangeCommon (value) {
let handle = this.enhanced.getValue.call(this, value) const handle = this.enhanced.getValue.call(this, value)
this.trigger('change', { value: handle }) this.trigger('change', { value: handle })
// 触发valueChange事件 // 触发valueChange事件
this.parentTrigger('valueChange', { this.parentTrigger('valueChange', {
@@ -128,7 +128,7 @@ export default {
oldValue: this.value, oldValue: this.value,
col: this.originColumn, col: this.originColumn,
rowIndex: this.params.rowIndex, rowIndex: this.params.rowIndex,
columnIndex: this.params.columnIndex, columnIndex: this.params.columnIndex
}) })
}, },
/** 通用处理blur事件 */ /** 通用处理blur事件 */
@@ -143,7 +143,7 @@ export default {
* @param args 其他附带参数 * @param args 其他附带参数
*/ */
trigger (name, event, args = []) { trigger (name, event, args = []) {
let listener = this.listeners[name] const listener = this.listeners[name]
if (typeof listener === 'function') { if (typeof listener === 'function') {
if (typeof event === 'object') { if (typeof event === 'object') {
event = this.packageEvent(name, event) event = this.packageEvent(name, event)
@@ -159,7 +159,7 @@ export default {
event.row = this.row event.row = this.row
event.column = this.column event.column = this.column
// online增强参数兼容 // online增强参数兼容
event.column['key'] = this.column['property'] event.column.key = this.column.property
event.cellTarget = this event.cellTarget = this
if (!event.type) { if (!event.type) {
event.type = name event.type = name
@@ -172,7 +172,7 @@ export default {
event.validate = true event.validate = true
} }
return event return event
}, }
}, },
model: { model: {
@@ -190,20 +190,20 @@ export default {
// 注册参数详见https://xuliangzhan_admin.gitee.io/vxe-table/#/table/renderer/edit // 注册参数详见https://xuliangzhan_admin.gitee.io/vxe-table/#/table/renderer/edit
installOptions: { installOptions: {
// 自动聚焦的 class 类名 // 自动聚焦的 class 类名
autofocus: '', autofocus: ''
}, },
// 事件拦截器用于兼容 // 事件拦截器用于兼容
interceptor: { interceptor: {
// 已实现event.clearActived // 已实现event.clearActived
// 说明比如点击了某个组件的弹出层面板之后此时被激活单元格不应该被自动关闭通过返回 false 可以阻止默认的行为 // 说明比如点击了某个组件的弹出层面板之后此时被激活单元格不应该被自动关闭通过返回 false 可以阻止默认的行为
['event.clearActived'](params, event, target) { 'event.clearActived' (params, event, target) {
return true return true
}, },
// 自定义event.clearActived.className // 自定义event.clearActived.className
// 说明比原生的多了一个参数className用于判断点击的元素的样式名递归到顶层 // 说明比原生的多了一个参数className用于判断点击的元素的样式名递归到顶层
['event.clearActived.className'](params, event, target) { 'event.clearActived.className' (params, event, target) {
return true return true
}, }
}, },
// 功能开关 // 功能开关
switches: { switches: {
@@ -211,7 +211,7 @@ export default {
// 如果设为true则表头上方会出现一个可编辑的图标 // 如果设为true则表头上方会出现一个可编辑的图标
editRender: true, editRender: true,
// false = 组件触发后可视true = 组件一直可视 // false = 组件触发后可视true = 组件一直可视
visible: false, visible: false
}, },
// 切面增强切面事件处理一般在某些方法执行后同步执行 // 切面增强切面事件处理一般在某些方法执行后同步执行
aopEvents: { aopEvents: {
@@ -220,7 +220,7 @@ export default {
}, },
// 单元格编辑状态下被关闭时会触发该事件 // 单元格编辑状态下被关闭时会触发该事件
editClosed () { editClosed () {
}, }
}, },
// 翻译增强可以实现例如select组件保存的value但是span模式下需要显示成text // 翻译增强可以实现例如select组件保存的value但是span模式下需要显示成text
translate: { translate: {
@@ -233,10 +233,10 @@ export default {
* @param value 需要翻译的值 * @param value 需要翻译的值
* @returns{*} 返回翻译后的数据 * @returns{*} 返回翻译后的数据
*/ */
handler(value,) { handler (value) {
// 默认翻译方法 // 默认翻译方法
return filterDictText(this.column.own.options, value) return filterDictText(this.column.own.options, value)
}, }
}, },
/** /**
* 获取值增强组件抛出的值 * 获取值增强组件抛出的值
@@ -271,12 +271,12 @@ export default {
*/ */
createValue ({ row, column, $table, renderOptions, params }) { createValue ({ row, column, $table, renderOptions, params }) {
return column.own.defaultValue return column.own.defaultValue
}, }
} }
} }
function getListeners () { function getListeners () {
let listeners = Object.assign({}, (this.renderOptions.listeners || {})) const listeners = Object.assign({}, (this.renderOptions.listeners || {}))
if (!listeners.change) { if (!listeners.change) {
listeners.change = async (event) => { listeners.change = async (event) => {
vModel.call(this, event.value) vModel.call(this, event.value)
@@ -305,7 +305,7 @@ export function dispatchEvent({cell, $event}, className, handler) {
return return
} }
window.setTimeout(() => { window.setTimeout(() => {
let element = cell.getElementsByClassName(className) const element = cell.getElementsByClassName(className)
if (element && element.length > 0) { if (element && element.length > 0) {
if (typeof handler === 'function') { if (typeof handler === 'function') {
handler(element[0]) handler(element[0])
@@ -17,7 +17,7 @@ const vs = {
// 消息类型通用数据传递 // 消息类型通用数据传递
TYPE_CSD: 'common_send_date', TYPE_CSD: 'common_send_date',
// 消息类型更新vxe table数据 // 消息类型更新vxe table数据
TYPE_UVT: 'update_vxe_table', TYPE_UVT: 'update_vxe_table'
}, },
// 心跳检测 // 心跳检测
heartCheck: { heartCheck: {
@@ -42,14 +42,14 @@ const vs = {
back () { back () {
this.clear() this.clear()
window.setTimeout(() => this.start(), this.interval) window.setTimeout(() => this.start(), this.interval)
}, }
}, },
/** 初始化 WebSocket */ /** 初始化 WebSocket */
initialWebSocket () { initialWebSocket () {
if (this.ws === null) { if (this.ws === null) {
const userId = store.getters.userInfo.id const userId = store.getters.userInfo.id
const domain = window._CONFIG['domianURL'].replace('https://', 'wss://').replace('http://', 'ws://') const domain = window._CONFIG.domianURL.replace('https://', 'wss://').replace('http://', 'ws://')
const url = `${domain}/vxeSocket/${userId}/${this.pageId}` const url = `${domain}/vxeSocket/${userId}/${this.pageId}`
this.ws = new WebSocket(url) this.ws = new WebSocket(url)
@@ -65,7 +65,7 @@ const vs = {
// 发送消息 // 发送消息
sendMessage (type, message) { sendMessage (type, message) {
try { try {
let ws = this.ws const ws = this.ws
if (ws != null && ws.readyState === ws.OPEN) { if (ws != null && ws.readyState === ws.OPEN) {
ws.send(JSON.stringify({ ws.send(JSON.stringify({
type: type, type: type,
@@ -82,7 +82,7 @@ const vs = {
CSDMap: new Map(), CSDMap: new Map(),
/** 添加绑定 */ /** 添加绑定 */
addBind (map, key, value) { addBind (map, key, value) {
let binds = map.get(key) const binds = map.get(key)
if (Array.isArray(binds)) { if (Array.isArray(binds)) {
binds.push(value) binds.push(value)
} else { } else {
@@ -91,10 +91,10 @@ const vs = {
}, },
/** 移除绑定 */ /** 移除绑定 */
removeBind (map, key, value) { removeBind (map, key, value) {
let binds = map.get(key) const binds = map.get(key)
if (Array.isArray(binds)) { if (Array.isArray(binds)) {
for (let i = 0; i < binds.length; i++) { for (let i = 0; i < binds.length; i++) {
let bind = binds[i] const bind = binds[i]
if (bind === value) { if (bind === value) {
binds.splice(i, 1) binds.splice(i, 1)
break break
@@ -109,7 +109,7 @@ const vs = {
}, },
// 呼叫绑定的表单 // 呼叫绑定的表单
callBind (map, key, callback) { callBind (map, key, callback) {
let binds = map.get(key) const binds = map.get(key)
if (Array.isArray(binds)) { if (Array.isArray(binds)) {
binds.forEach(callback) binds.forEach(callback)
} }
@@ -149,8 +149,8 @@ const vs = {
console.warn('VXEWebSocket收到无法解析的消息:', e.data) console.warn('VXEWebSocket收到无法解析的消息:', e.data)
return return
} }
let type = json[this.constants.TYPE] const type = json[this.constants.TYPE]
let data = json[this.constants.DATA] const data = json[this.constants.DATA]
switch (type) { switch (type) {
// 心跳检测 // 心跳检测
case this.constants.TYPE_HB: case this.constants.TYPE_HB:
@@ -162,7 +162,7 @@ const vs = {
break break
// 更新form数据 // 更新form数据
case this.constants.TYPE_UVT: case this.constants.TYPE_UVT:
this.callBind(this.tableMap, data.socketKey, (vm) => this.onVM['onUpdateTable'].apply(vm, data.args)) this.callBind(this.tableMap, data.socketKey, (vm) => this.onVM.onUpdateTable.apply(vm, data.args))
break break
default: default:
console.warn('VXEWebSocket收到不识别的消息类型:' + type) console.warn('VXEWebSocket收到不识别的消息类型:' + type)
@@ -172,7 +172,7 @@ const vs = {
close (e) { close (e) {
console.log('VXEWebSocket连接被关闭:', e) console.log('VXEWebSocket连接被关闭:', e)
this.reconnect() this.reconnect()
}, }
}, },
onVM: { onVM: {
@@ -184,8 +184,8 @@ const vs = {
// 局部保更新数据 // 局部保更新数据
if (tableRow) { if (tableRow) {
// 特殊处理拖轮状态 // 特殊处理拖轮状态
if (row['tug_status'] && tableRow['tug_status']) { if (row.tug_status && tableRow.tug_status) {
row['tug_status'] = Object.assign({}, tableRow['tug_status'], row['tug_status']) row.tug_status = Object.assign({}, tableRow.tug_status, row.tug_status)
} }
// 判断是否启用重载特效 // 判断是否启用重载特效
if (this.reloadEffect) { if (this.reloadEffect) {
@@ -199,8 +199,8 @@ const vs = {
this.$refs.vxe.reloadRow(tableRow) this.$refs.vxe.reloadRow(tableRow)
} }
} }
}, }
}, }
} }
@@ -214,7 +214,7 @@ export default {
socketKey: { socketKey: {
type: String, type: String,
default: 'vxe-default' default: 'vxe-default'
}, }
}, },
data () { data () {
return {} return {}
@@ -231,14 +231,14 @@ export default {
socketSendUpdateRow (row) { socketSendUpdateRow (row) {
vs.sendMessage(vs.constants.TYPE_UVT, { vs.sendMessage(vs.constants.TYPE_UVT, {
socketKey: this.socketKey, socketKey: this.socketKey,
args: [row, this.caseId], args: [row, this.caseId]
}) })
}, }
}, },
beforeDestroy () { beforeDestroy () {
vs.removeBind(vs.tableMap, this.socketKey, this) vs.removeBind(vs.tableMap, this.socketKey, this)
}, }
} }
/** /**
@@ -4,7 +4,7 @@ import JVxeCellMixins from '../mixins/JVxeCellMixins'
export const JVXERenderType = { export const JVXERenderType = {
editer: 'editer', editer: 'editer',
spaner: 'spaner', spaner: 'spaner',
default: 'default', default: 'default'
} }
/** 安装所有vxe组件 */ /** 安装所有vxe组件 */
@@ -40,7 +40,7 @@ export function installEditRender(VXETable, type, comp, spanComp) {
// 显示模板 // 显示模板
renderCell: createRender(spanComp, enhanced, JVXERenderType.spaner), renderCell: createRender(spanComp, enhanced, JVXERenderType.spaner),
// 增强注册 // 增强注册
...enhanced.installOptions, ...enhanced.installOptions
}) })
} }
@@ -52,7 +52,7 @@ export function installCellRender(VXETable, type, comp = AllCells[JVXETypes.norm
// 默认显示模板 // 默认显示模板
renderDefault: createRender(comp, enhanced, JVXERenderType.default), renderDefault: createRender(comp, enhanced, JVXERenderType.default),
// 增强注册 // 增强注册
...enhanced.installOptions, ...enhanced.installOptions
}) })
} }
@@ -65,7 +65,7 @@ function createRender(comp, enhanced, renderType) {
column: params.column, column: params.column,
params: params, params: params,
renderOptions: renderOptions, renderOptions: renderOptions,
renderType: renderType, renderType: renderType
} }
})] })]
} }
@@ -76,7 +76,7 @@ const AllCellsMixins = new Map()
/** 获取某个组件的增强 */ /** 获取某个组件的增强 */
export function getEnhanced (type) { export function getEnhanced (type) {
let cell = AllCells[type] const cell = AllCells[type]
if (cell && cell.enhanced) { if (cell && cell.enhanced) {
return cell.enhanced return cell.enhanced
} }
@@ -94,11 +94,11 @@ export function getEnhancedMixins(type, name) {
if (AllCellsMixins.has(type)) { if (AllCellsMixins.has(type)) {
return getByName(AllCellsMixins.get(type)) return getByName(AllCellsMixins.get(type))
} }
let defEnhanced = JVxeCellMixins.enhanced const defEnhanced = JVxeCellMixins.enhanced
let enhanced = getEnhanced(type) const enhanced = getEnhanced(type)
if (enhanced) { if (enhanced) {
Object.keys(defEnhanced).forEach(key => { Object.keys(defEnhanced).forEach(key => {
let def = defEnhanced[key] const def = defEnhanced[key]
if (enhanced.hasOwnProperty(key)) { if (enhanced.hasOwnProperty(key)) {
// 方法如果存在就不覆盖 // 方法如果存在就不覆盖
if (typeof def !== 'function' && typeof def !== 'string') { if (typeof def !== 'function' && typeof def !== 'string') {
@@ -115,7 +115,6 @@ export function getEnhancedMixins(type, name) {
return getByName(defEnhanced) return getByName(defEnhanced)
} }
/** 辅助方法:替换${...}变量 */ /** 辅助方法:替换${...}变量 */
export function replaceProps (col, value) { export function replaceProps (col, value) {
if (value && typeof value === 'string') { if (value && typeof value === 'string') {
@@ -12,7 +12,7 @@ export const VALIDATE_FAILED = Symbol()
export function getRefPromise (vm, name) { export function getRefPromise (vm, name) {
return new Promise((resolve) => { return new Promise((resolve) => {
(function next () { (function next () {
let ref = vm.$refs[name] const ref = vm.$refs[name]
if (ref) { if (ref) {
resolve(ref) resolve(ref)
} else { } else {
@@ -28,7 +28,7 @@ export function getRefPromise(vm, name) {
export function getInputNumberMaxValue (col, rowsValues) { export function getInputNumberMaxValue (col, rowsValues) {
let maxNum = 0 let maxNum = 0
Object.values(rowsValues).forEach((rowValue, index) => { Object.values(rowsValues).forEach((rowValue, index) => {
let val = rowValue[col.key], num const val = rowValue[col.key]; let num
try { try {
num = Number.parseFloat(val) num = Number.parseFloat(val)
} catch { } catch {
@@ -75,10 +75,10 @@ export function getParentNodeByTagName(dom, tagName = 'body') {
export function vxePackageToSuperQuery (columns, handler) { export function vxePackageToSuperQuery (columns, handler) {
if (Array.isArray(columns)) { if (Array.isArray(columns)) {
// 高级查询所需要的参数 // 高级查询所需要的参数
let fieldList = [] const fieldList = []
// 遍历列 // 遍历列
for (let i = 0; i < columns.length; i++) { for (let i = 0; i < columns.length; i++) {
let col = columns[i] const col = columns[i]
if (col.type === JVXETypes.rowCheckbox || if (col.type === JVXETypes.rowCheckbox ||
col.type === JVXETypes.rowRadio || col.type === JVXETypes.rowRadio ||
col.type === JVXETypes.rowExpand || col.type === JVXETypes.rowExpand ||
@@ -86,11 +86,11 @@ export function vxePackageToSuperQuery(columns, handler) {
) { ) {
continue continue
} }
let field = { const field = {
type: 'string', type: 'string',
value: col.key, value: col.key,
text: col.title, text: col.title,
dictCode: col.dictCode || col.dict, dictCode: col.dictCode || col.dict
} }
if (col.type === JVXETypes.date || col.type === JVXETypes.datetime) { if (col.type === JVXETypes.date || col.type === JVXETypes.datetime) {
field.type = col.type field.type = col.type
@@ -127,7 +127,7 @@ export async function validateFormAndTables(form, cases, autoJumpTab) {
throw `form 参数需要的是一个form对象而传入的却是${typeof form}` throw `form 参数需要的是一个form对象而传入的却是${typeof form}`
} }
let dataMap = {} let dataMap = {}
let values = await new Promise((resolve, reject) => { const values = await new Promise((resolve, reject) => {
// 验证主表表单 // 验证主表表单
form.validateFields((err, values) => { form.validateFields((err, values) => {
err ? reject({ error: VALIDATE_FAILED, originError: err }) : resolve(values) err ? reject({ error: VALIDATE_FAILED, originError: err }) : resolve(values)
@@ -135,7 +135,7 @@ export async function validateFormAndTables(form, cases, autoJumpTab) {
}) })
Object.assign(dataMap, { formValue: values }) Object.assign(dataMap, { formValue: values })
// 验证所有子表的表单 // 验证所有子表的表单
let subData = await validateTables(cases, autoJumpTab) const subData = await validateTables(cases, autoJumpTab)
// 合并最终数据 // 合并最终数据
dataMap = Object.assign(dataMap, { tablesValue: subData }) dataMap = Object.assign(dataMap, { tablesValue: subData })
return dataMap return dataMap
@@ -154,7 +154,7 @@ export async function validateFormModelAndTables(form,formData, cases, autoJumpT
throw `form 参数需要的是一个form对象而传入的却是${typeof form}` throw `form 参数需要的是一个form对象而传入的却是${typeof form}`
} }
let dataMap = {} let dataMap = {}
let values = await new Promise((resolve, reject) => { const values = await new Promise((resolve, reject) => {
// 验证主表表单 // 验证主表表单
form.validate((valid, obj) => { form.validate((valid, obj) => {
valid ? resolve(formData) : reject({ error: VALIDATE_FAILED, originError: valid }) valid ? resolve(formData) : reject({ error: VALIDATE_FAILED, originError: valid })
@@ -162,7 +162,7 @@ export async function validateFormModelAndTables(form,formData, cases, autoJumpT
}) })
Object.assign(dataMap, { formValue: values }) Object.assign(dataMap, { formValue: values })
// 验证所有子表的表单 // 验证所有子表的表单
let subData = await validateTables(cases, autoJumpTab) const subData = await validateTables(cases, autoJumpTab)
// 合并最终数据 // 合并最终数据
dataMap = Object.assign(dataMap, { tablesValue: subData }) dataMap = Object.assign(dataMap, { tablesValue: subData })
return dataMap return dataMap
@@ -179,13 +179,13 @@ export function validateTables(cases, autoJumpTab = true) {
throw `'validateTables'函数的'cases'参数需要的是一个数组而传入的却是${typeof cases}` throw `'validateTables'函数的'cases'参数需要的是一个数组而传入的却是${typeof cases}`
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let tablesData = [] const tablesData = []
let index = 0 let index = 0
if (!cases || cases.length === 0) { if (!cases || cases.length === 0) {
resolve() resolve()
} }
(function next () { (function next () {
let vm = cases[index] const vm = cases[index]
vm.validateTable().then(errMap => { vm.validateTable().then(errMap => {
// 校验通过 // 校验通过
if (!errMap) { if (!errMap) {
@@ -193,18 +193,20 @@ export function validateTables(cases, autoJumpTab = true) {
// 判断校验是否全部完成完成返回成功否则继续进行下一步校验 // 判断校验是否全部完成完成返回成功否则继续进行下一步校验
if (++index === cases.length) { if (++index === cases.length) {
resolve(tablesData) resolve(tablesData)
} else ( } else {
(
next() next()
) )
}
} else { } else {
// 尝试获取tabKey如果在ATab组件内即可获取 // 尝试获取tabKey如果在ATab组件内即可获取
let paneKey let paneKey
let tabPane = getVmParentByName(vm, 'ATabPane') const tabPane = getVmParentByName(vm, 'ATabPane')
if (tabPane) { if (tabPane) {
paneKey = tabPane.$vnode.key paneKey = tabPane.$vnode.key
// 自动跳转到该表格 // 自动跳转到该表格
if (autoJumpTab) { if (autoJumpTab) {
let tabs = getVmParentByName(tabPane, 'Tabs') const tabs = getVmParentByName(tabPane, 'Tabs')
tabs && tabs.setActiveKey && tabs.setActiveKey(paneKey) tabs && tabs.setActiveKey && tabs.setActiveKey(paneKey)
} }
} }
+1 -1
View File
@@ -26,7 +26,7 @@ import JSlider from './JSlider.vue'
import JSwitch from './JSwitch.vue' import JSwitch from './JSwitch.vue'
import JTime from './JTime.vue' import JTime from './JTime.vue'
import JTreeTable from './JTreeTable.vue' import JTreeTable from './JTreeTable.vue'
import JEasyCron from "@/components/jero/JEasyCron" import JEasyCron from '@/components/jero/JEasyCron'
// jerobiz // jerobiz
import JSelectDepart from '../jerobiz/JSelectDepart.vue' import JSelectDepart from '../jerobiz/JSelectDepart.vue'
import JSelectMultiUser from '../jerobiz/JSelectMultiUser.vue' import JSelectMultiUser from '../jerobiz/JSelectMultiUser.vue'
@@ -14,14 +14,14 @@
</template> </template>
<script> <script>
import { getFileAccessHttpUrl } from '@/api/manage'; import { getFileAccessHttpUrl } from '@/api/manage'
const getFileName = (path) => { const getFileName = (path) => {
if(path.lastIndexOf("\\")>=0){ if (path.lastIndexOf('\\') >= 0) {
let reg=new RegExp("\\\\","g"); const reg = new RegExp('\\\\', 'g')
path = path.replace(reg,"/"); path = path.replace(reg, '/')
} }
return path.substring(path.lastIndexOf("/")+1); return path.substring(path.lastIndexOf('/') + 1)
} }
export default { export default {
@@ -76,26 +76,25 @@
}, },
methods: { methods: {
handleChange (value) { handleChange (value) {
this.filePath = value; this.filePath = value
}, },
show (id, value, flag) { show (id, value, flag) {
this.id = id; this.id = id
this.filePath = value; this.filePath = value
this.visible = true this.visible = true
if (flag === 'img') { if (flag === 'img') {
this.fileType = 'image' this.fileType = 'image'
} else { } else {
this.fileType = 'file' this.fileType = 'file'
} }
}, },
ok () { ok () {
if (!this.filePath) { if (!this.filePath) {
this.$message.error("未上传任何文件") this.$message.error('未上传任何文件')
return false; return false
} }
let arr = this.filePath.split(",") const arr = this.filePath.split(',')
let obj = { const obj = {
name: getFileName(arr[0]), name: getFileName(arr[0]),
url: getFileAccessHttpUrl(arr[0]), url: getFileAccessHttpUrl(arr[0]),
path: this.filePath, path: this.filePath,
@@ -51,8 +51,8 @@
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false, default: false
}, }
}, },
data () { data () {
@@ -68,10 +68,10 @@
immediate: true, immediate: true,
handler: function () { handler: function () {
if (this.value && this.value.length > 0) { if (this.value && this.value.length > 0) {
this.inputContent = this.value; this.inputContent = this.value
}
} }
} }
},
}, },
model: { model: {
prop: 'value', prop: 'value',
@@ -94,7 +94,6 @@
} else { } else {
return document.getElementById(this.popContainer) return document.getElementById(this.popContainer)
} }
} }
} }
} }
+258 -261
View File
@@ -276,7 +276,7 @@
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 1, rangeStart: 1,
rangeEnd: 0, rangeEnd: 0,
specificSpecific:[], specificSpecific: []
}, },
minute: { minute: {
cronEvery: '', cronEvery: '',
@@ -284,7 +284,7 @@
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 1, rangeStart: 1,
rangeEnd: '0', rangeEnd: '0',
specificSpecific:[], specificSpecific: []
}, },
hour: { hour: {
cronEvery: '', cronEvery: '',
@@ -292,7 +292,7 @@
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: '0', rangeStart: '0',
rangeEnd: '0', rangeEnd: '0',
specificSpecific:[], specificSpecific: []
}, },
day: { day: {
cronEvery: '', cronEvery: '',
@@ -303,7 +303,7 @@
specificSpecific: [], specificSpecific: [],
cronLastSpecificDomDay: 1, cronLastSpecificDomDay: 1,
cronDaysBeforeEomMinus: 1, cronDaysBeforeEomMinus: 1,
cronDaysNearestWeekday:1, cronDaysNearestWeekday: 1
}, },
week: { week: {
cronEvery: '', cronEvery: '',
@@ -311,7 +311,7 @@
incrementIncrement: 1, incrementIncrement: 1,
specificSpecific: [], specificSpecific: [],
cronNthDayDay: 1, cronNthDayDay: 1,
cronNthDayNth:1, cronNthDayNth: 1
}, },
month: { month: {
cronEvery: '', cronEvery: '',
@@ -319,7 +319,7 @@
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 1, rangeStart: 1,
rangeEnd: 1, rangeEnd: 1,
specificSpecific:[], specificSpecific: []
}, },
year: { year: {
cronEvery: '', cronEvery: '',
@@ -327,7 +327,7 @@
incrementIncrement: 1, incrementIncrement: 1,
rangeStart: 2019, rangeStart: 2019,
rangeEnd: 2019, rangeEnd: 2019,
specificSpecific:[], specificSpecific: []
}, },
label: '' label: ''
} }
@@ -335,188 +335,188 @@
}, },
computed: { computed: {
modalWidth () { modalWidth () {
return 608; return 608
}, },
secondsText () { secondsText () {
let seconds = ''; let seconds = ''
let cronEvery=this.result.second.cronEvery||''; const cronEvery = this.result.second.cronEvery || ''
switch (cronEvery.toString()) { switch (cronEvery.toString()) {
case '1': case '1':
seconds = '*'; seconds = '*'
break; break
case '2': case '2':
seconds = this.result.second.incrementStart+'/'+this.result.second.incrementIncrement; seconds = this.result.second.incrementStart + '/' + this.result.second.incrementIncrement
break; break
case '3': case '3':
this.result.second.specificSpecific.map(val=> {seconds += val+','}); this.result.second.specificSpecific.map(val => { seconds += val + ',' })
seconds = seconds.slice(0, -1); seconds = seconds.slice(0, -1)
break; break
case '4': case '4':
seconds = this.result.second.rangeStart+'-'+this.result.second.rangeEnd; seconds = this.result.second.rangeStart + '-' + this.result.second.rangeEnd
break; break
} }
return seconds; return seconds
}, },
minutesText () { minutesText () {
let minutes = ''; let minutes = ''
let cronEvery=this.result.minute.cronEvery||''; const cronEvery = this.result.minute.cronEvery || ''
switch (cronEvery.toString()) { switch (cronEvery.toString()) {
case '1': case '1':
minutes = '*'; minutes = '*'
break; break
case '2': case '2':
minutes = this.result.minute.incrementStart+'/'+this.result.minute.incrementIncrement; minutes = this.result.minute.incrementStart + '/' + this.result.minute.incrementIncrement
break; break
case '3': case '3':
this.result.minute.specificSpecific.map(val => { this.result.minute.specificSpecific.map(val => {
minutes += val + ',' minutes += val + ','
}); })
minutes = minutes.slice(0, -1); minutes = minutes.slice(0, -1)
break; break
case '4': case '4':
minutes = this.result.minute.rangeStart+'-'+this.result.minute.rangeEnd; minutes = this.result.minute.rangeStart + '-' + this.result.minute.rangeEnd
break; break
} }
return minutes; return minutes
}, },
hoursText () { hoursText () {
let hours = ''; let hours = ''
let cronEvery=this.result.hour.cronEvery||''; const cronEvery = this.result.hour.cronEvery || ''
switch (cronEvery.toString()) { switch (cronEvery.toString()) {
case '1': case '1':
hours = '*'; hours = '*'
break; break
case '2': case '2':
hours = this.result.hour.incrementStart+'/'+this.result.hour.incrementIncrement; hours = this.result.hour.incrementStart + '/' + this.result.hour.incrementIncrement
break; break
case '3': case '3':
this.result.hour.specificSpecific.map(val => { this.result.hour.specificSpecific.map(val => {
hours += val + ',' hours += val + ','
}); })
hours = hours.slice(0, -1); hours = hours.slice(0, -1)
break; break
case '4': case '4':
hours = this.result.hour.rangeStart+'-'+this.result.hour.rangeEnd; hours = this.result.hour.rangeStart + '-' + this.result.hour.rangeEnd
break; break
} }
return hours; return hours
}, },
daysText () { daysText () {
let days=''; let days = ''
let cronEvery=this.result.day.cronEvery||''; const cronEvery = this.result.day.cronEvery || ''
switch (cronEvery.toString()) { switch (cronEvery.toString()) {
case '1': case '1':
break; break
case '2': case '2':
case '4': case '4':
case '11': case '11':
days = '?'; days = '?'
break; break
case '3': case '3':
days = this.result.day.incrementStart+'/'+this.result.day.incrementIncrement; days = this.result.day.incrementStart + '/' + this.result.day.incrementIncrement
break; break
case '5': case '5':
this.result.day.specificSpecific.map(val => { this.result.day.specificSpecific.map(val => {
days += val + ',' days += val + ','
}); })
days = days.slice(0, -1); days = days.slice(0, -1)
break; break
case '6': case '6':
days = "L"; days = 'L'
break; break
case '7': case '7':
days = "LW"; days = 'LW'
break; break
case '8': case '8':
days = this.result.day.cronLastSpecificDomDay + 'L'; days = this.result.day.cronLastSpecificDomDay + 'L'
break; break
case '9': case '9':
days = 'L-' + this.result.day.cronDaysBeforeEomMinus; days = 'L-' + this.result.day.cronDaysBeforeEomMinus
break; break
case '10': case '10':
days = this.result.day.cronDaysNearestWeekday+"W"; days = this.result.day.cronDaysNearestWeekday + 'W'
break break
} }
return days; return days
}, },
weeksText () { weeksText () {
let weeks = ''; let weeks = ''
let cronEvery=this.result.day.cronEvery||''; const cronEvery = this.result.day.cronEvery || ''
switch (cronEvery.toString()) { switch (cronEvery.toString()) {
case '1': case '1':
case '3': case '3':
case '5': case '5':
weeks = '?'; weeks = '?'
break; break
case '2': case '2':
weeks = this.result.week.incrementStart+'/'+this.result.week.incrementIncrement; weeks = this.result.week.incrementStart + '/' + this.result.week.incrementIncrement
break; break
case '4': case '4':
this.result.week.specificSpecific.map(val => { this.result.week.specificSpecific.map(val => {
weeks += val + ',' weeks += val + ','
}); })
weeks = weeks.slice(0, -1); weeks = weeks.slice(0, -1)
break; break
case '6': case '6':
case '7': case '7':
case '8': case '8':
case '9': case '9':
case '10': case '10':
weeks = "?"; weeks = '?'
break; break
case '11': case '11':
weeks = this.result.week.cronNthDayDay+"#"+this.result.week.cronNthDayNth; weeks = this.result.week.cronNthDayDay + '#' + this.result.week.cronNthDayNth
break; break
} }
return weeks; return weeks
}, },
monthsText () { monthsText () {
let months = ''; let months = ''
let cronEvery=this.result.month.cronEvery||''; const cronEvery = this.result.month.cronEvery || ''
switch (cronEvery.toString()) { switch (cronEvery.toString()) {
case '1': case '1':
months = '*'; months = '*'
break; break
case '2': case '2':
months = this.result.month.incrementStart+'/'+this.result.month.incrementIncrement; months = this.result.month.incrementStart + '/' + this.result.month.incrementIncrement
break; break
case '3': case '3':
this.result.month.specificSpecific.map(val => { this.result.month.specificSpecific.map(val => {
months += val + ',' months += val + ','
}); })
months = months.slice(0, -1); months = months.slice(0, -1)
break; break
case '4': case '4':
months = this.result.month.rangeStart+'-'+this.result.month.rangeEnd; months = this.result.month.rangeStart + '-' + this.result.month.rangeEnd
break; break
} }
return months; return months
}, },
yearsText () { yearsText () {
let years = ''; let years = ''
let cronEvery=this.result.year.cronEvery||''; const cronEvery = this.result.year.cronEvery || ''
switch (cronEvery.toString()) { switch (cronEvery.toString()) {
case '1': case '1':
years = '*'; years = '*'
break; break
case '2': case '2':
years = this.result.year.incrementStart+'/'+this.result.year.incrementIncrement; years = this.result.year.incrementStart + '/' + this.result.year.incrementIncrement
break; break
case '3': case '3':
this.result.year.specificSpecific.map(val => { this.result.year.specificSpecific.map(val => {
years += val + ',' years += val + ','
}); })
years = years.slice(0, -1); years = years.slice(0, -1)
break; break
case '4': case '4':
years = this.result.year.rangeStart+'-'+this.result.year.rangeEnd; years = this.result.year.rangeStart + '-' + this.result.year.rangeEnd
break; break
} }
return years; return years
}, },
cron () { cron () {
return `${this.secondsText || '*'} ${this.minutesText || '*'} ${this.hoursText || '*'} ${this.daysText || '*'} ${this.monthsText || '*'} ${this.weeksText || '?'} ${this.yearsText || '*'}` return `${this.secondsText || '*'} ${this.minutesText || '*'} ${this.hoursText || '*'} ${this.daysText || '*'} ${this.monthsText || '*'} ${this.weeksText || '?'} ${this.yearsText || '*'}`
}, }
}, },
watch: { watch: {
visible: { visible: {
@@ -531,145 +531,144 @@
// //this.result = clone(this.defaultValue); // //this.result = clone(this.defaultValue);
// this.result = JSON.parse(JSON.stringify(this.defaultValue)); // this.result = JSON.parse(JSON.stringify(this.defaultValue));
// } // }
let label = this.data; const label = this.data
if (label) { if (label) {
this.secondsReverseExp(label) this.secondsReverseExp(label)
this.minutesReverseExp(label); this.minutesReverseExp(label)
this.hoursReverseExp(label); this.hoursReverseExp(label)
this.daysReverseExp(label); this.daysReverseExp(label)
this.daysReverseExp(label); this.daysReverseExp(label)
this.monthsReverseExp(label); this.monthsReverseExp(label)
this.yearReverseExp(label); this.yearReverseExp(label)
JSON.parse(JSON.stringify(label)); JSON.parse(JSON.stringify(label))
} else { } else {
this.result = JSON.parse(JSON.stringify(this.defaultValue)); this.result = JSON.parse(JSON.stringify(this.defaultValue))
} }
} }
} }
}, },
methods: { methods: {
show () { show () {
this.visible = true; this.visible = true
// console.log('secondsReverseExp',this.secondsReverseExp(this.data)); // console.log('secondsReverseExp',this.secondsReverseExp(this.data));
// console.log('minutesReverseExp',this.minutesReverseExp(this.data)); // console.log('minutesReverseExp',this.minutesReverseExp(this.data));
// console.log('hoursReverseExp',this.hoursReverseExp(this.data)); // console.log('hoursReverseExp',this.hoursReverseExp(this.data));
// console.log('daysReverseExp',this.daysReverseExp(this.data)); // console.log('daysReverseExp',this.daysReverseExp(this.data));
// console.log('monthsReverseExp',this.monthsReverseExp(this.data)); // console.log('monthsReverseExp',this.monthsReverseExp(this.data));
// console.log('yearReverseExp',this.yearReverseExp(this.data)); // console.log('yearReverseExp',this.yearReverseExp(this.data));
}, },
handleSubmit () { handleSubmit () {
this.$emit('ok',this.cron); this.$emit('ok', this.cron)
this.close(); this.close()
this.visible = false; this.visible = false
}, },
close () { close () {
this.visible = false; this.visible = false
}, },
secondsReverseExp (seconds) { secondsReverseExp (seconds) {
let val = seconds.split(" ")[0]; const val = seconds.split(' ')[0]
// alert(val); // alert(val);
let second = { const second = {
cronEvery: '', cronEvery: '',
incrementStart: 3, incrementStart: 3,
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 1, rangeStart: 1,
rangeEnd: 0, rangeEnd: 0,
specificSpecific: [] specificSpecific: []
}; }
switch (true) { switch (true) {
case val.includes('*'): case val.includes('*'):
second.cronEvery = '1'; second.cronEvery = '1'
break; break
case val.includes('/'): case val.includes('/'):
second.cronEvery = '2'; second.cronEvery = '2'
second.incrementStart = val.split('/')[0]; second.incrementStart = val.split('/')[0]
second.incrementIncrement = val.split('/')[1]; second.incrementIncrement = val.split('/')[1]
break; break
case val.includes(','): case val.includes(','):
second.cronEvery = '3'; second.cronEvery = '3'
second.specificSpecific = val.split(',').map(Number).sort(); second.specificSpecific = val.split(',').map(Number).sort()
break; break
case val.includes('-'): case val.includes('-'):
second.cronEvery = '4'; second.cronEvery = '4'
second.rangeStart = val.split('-')[0]; second.rangeStart = val.split('-')[0]
second.rangeEnd = val.split('-')[1]; second.rangeEnd = val.split('-')[1]
break; break
default: default:
second.cronEvery = '1'; second.cronEvery = '1'
} }
this.result.second = second; this.result.second = second
}, },
minutesReverseExp (minutes) { minutesReverseExp (minutes) {
let val = minutes.split(" ")[1]; const val = minutes.split(' ')[1]
let minute = { const minute = {
cronEvery: '', cronEvery: '',
incrementStart: 3, incrementStart: 3,
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 1, rangeStart: 1,
rangeEnd: 0, rangeEnd: 0,
specificSpecific:[], specificSpecific: []
} }
switch (true) { switch (true) {
case val.includes('*'): case val.includes('*'):
minute.cronEvery = '1'; minute.cronEvery = '1'
break; break
case val.includes('/'): case val.includes('/'):
minute.cronEvery = '2'; minute.cronEvery = '2'
minute.incrementStart = val.split('/')[0]; minute.incrementStart = val.split('/')[0]
minute.incrementIncrement = val.split('/')[1]; minute.incrementIncrement = val.split('/')[1]
break; break
case val.includes(','): case val.includes(','):
minute.cronEvery = '3'; minute.cronEvery = '3'
minute.specificSpecific = val.split(',').map(Number).sort(); minute.specificSpecific = val.split(',').map(Number).sort()
break; break
case val.includes('-'): case val.includes('-'):
minute.cronEvery = '4'; minute.cronEvery = '4'
minute.rangeStart = val.split('-')[0]; minute.rangeStart = val.split('-')[0]
minute.rangeEnd = val.split('-')[1]; minute.rangeEnd = val.split('-')[1]
break; break
default: default:
minute.cronEvery = '1'; minute.cronEvery = '1'
} }
this.result.minute = minute; this.result.minute = minute
}, },
hoursReverseExp (hours) { hoursReverseExp (hours) {
let val = hours.split(" ")[2]; const val = hours.split(' ')[2]
let hour ={ const hour = {
cronEvery: '', cronEvery: '',
incrementStart: 3, incrementStart: 3,
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 1, rangeStart: 1,
rangeEnd: '0', rangeEnd: '0',
specificSpecific:[], specificSpecific: []
}; }
switch (true) { switch (true) {
case val.includes('*'): case val.includes('*'):
hour.cronEvery = '1'; hour.cronEvery = '1'
break; break
case val.includes('/'): case val.includes('/'):
hour.cronEvery = '2'; hour.cronEvery = '2'
hour.incrementStart = val.split('/')[0]; hour.incrementStart = val.split('/')[0]
hour.incrementIncrement = val.split('/')[1]; hour.incrementIncrement = val.split('/')[1]
break; break
case val.includes(','): case val.includes(','):
hour.cronEvery = '3'; hour.cronEvery = '3'
hour.specificSpecific = val.split(',').map(Number).sort(); hour.specificSpecific = val.split(',').map(Number).sort()
break; break
case val.includes('-'): case val.includes('-'):
hour.cronEvery = '4'; hour.cronEvery = '4'
hour.rangeStart = val.split('-')[0]; hour.rangeStart = val.split('-')[0]
hour.rangeEnd = val.split('-')[1]; hour.rangeEnd = val.split('-')[1]
break; break
default: default:
hour.cronEvery = '1'; hour.cronEvery = '1'
} }
this.result.hour = hour; this.result.hour = hour
}, },
daysReverseExp (cron) { daysReverseExp (cron) {
let days = cron.split(" ")[3]; const days = cron.split(' ')[3]
let weeks = cron.split(" ")[5]; const weeks = cron.split(' ')[5]
let day ={ const day = {
cronEvery: '', cronEvery: '',
incrementStart: 1, incrementStart: 1,
incrementIncrement: 1, incrementIncrement: 1,
@@ -678,152 +677,150 @@
specificSpecific: [], specificSpecific: [],
cronLastSpecificDomDay: 1, cronLastSpecificDomDay: 1,
cronDaysBeforeEomMinus: 1, cronDaysBeforeEomMinus: 1,
cronDaysNearestWeekday:1, cronDaysNearestWeekday: 1
}; }
let week = { const week = {
cronEvery: '', cronEvery: '',
incrementStart: 1, incrementStart: 1,
incrementIncrement: 1, incrementIncrement: 1,
specificSpecific: [], specificSpecific: [],
cronNthDayDay: 1, cronNthDayDay: 1,
cronNthDayNth:'1', cronNthDayNth: '1'
}; }
if (!days.includes('?')) { if (!days.includes('?')) {
switch (true) { switch (true) {
case days.includes('*'): case days.includes('*'):
day.cronEvery = '1'; day.cronEvery = '1'
break; break
case days.includes('?'): case days.includes('?'):
// 2411 // 2411
break; break
case days.includes('/'): case days.includes('/'):
day.cronEvery = '3'; day.cronEvery = '3'
day.incrementStart = days.split('/')[0]; day.incrementStart = days.split('/')[0]
day.incrementIncrement = days.split('/')[1]; day.incrementIncrement = days.split('/')[1]
break; break
case days.includes(','): case days.includes(','):
day.cronEvery = '5'; day.cronEvery = '5'
day.specificSpecific = days.split(',').map(Number).sort(); day.specificSpecific = days.split(',').map(Number).sort()
// day.specificSpecific.forEach(function (value, index) { // day.specificSpecific.forEach(function (value, index) {
// day.specificSpecific[index] = value -1; // day.specificSpecific[index] = value -1;
// }); // });
break; break
case days.includes('LW'): case days.includes('LW'):
day.cronEvery = '7'; day.cronEvery = '7'
break; break
case days.includes('L-'): case days.includes('L-'):
day.cronEvery = '9'; day.cronEvery = '9'
day.cronDaysBeforeEomMinus = days.split('L-')[1]; day.cronDaysBeforeEomMinus = days.split('L-')[1]
break; break
case days.includes('L'): case days.includes('L'):
// alert(days); // alert(days);
if (days.len == 1) { if (days.len == 1) {
day.cronEvery = '6'; day.cronEvery = '6'
day.cronLastSpecificDomDay = '1'; day.cronLastSpecificDomDay = '1'
} else {
day.cronEvery = '8'
day.cronLastSpecificDomDay = Number(days.split('L')[0])
} }
else break
{
day.cronEvery = '8';
day.cronLastSpecificDomDay = Number(days.split('L')[0]);
}
break;
case days.includes('W'): case days.includes('W'):
day.cronEvery = '10'; day.cronEvery = '10'
day.cronDaysNearestWeekday = days.split('W')[0]; day.cronDaysNearestWeekday = days.split('W')[0]
break; break
default: default:
day.cronEvery = '1'; day.cronEvery = '1'
} }
} else { } else {
switch (true) { switch (true) {
case weeks.includes('/'): case weeks.includes('/'):
day.cronEvery = '2'; day.cronEvery = '2'
week.incrementStart = weeks.split("/")[0]; week.incrementStart = weeks.split('/')[0]
week.incrementIncrement = weeks.split("/")[1]; week.incrementIncrement = weeks.split('/')[1]
break; break
case weeks.includes(','): case weeks.includes(','):
day.cronEvery = '4'; day.cronEvery = '4'
week.specificSpecific = weeks.split(',').map(Number).sort(); week.specificSpecific = weeks.split(',').map(Number).sort()
break; break
case '#': case '#':
day.cronEvery = '11'; day.cronEvery = '11'
week.cronNthDayDay = weeks.split("#")[0]; week.cronNthDayDay = weeks.split('#')[0]
week.cronNthDayNth = weeks.split("#")[1]; week.cronNthDayNth = weeks.split('#')[1]
break; break
default: default:
day.cronEvery = '1'; day.cronEvery = '1'
week.cronEvery = '1'; week.cronEvery = '1'
} }
} }
this.result.day = day; this.result.day = day
this.result.week = week; this.result.week = week
}, },
monthsReverseExp (cron) { monthsReverseExp (cron) {
let months = cron.split(" ")[4]; const months = cron.split(' ')[4]
let month = { const month = {
cronEvery: '', cronEvery: '',
incrementStart: 3, incrementStart: 3,
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 1, rangeStart: 1,
rangeEnd: 1, rangeEnd: 1,
specificSpecific:[], specificSpecific: []
}; }
switch (true) { switch (true) {
case months.includes('*'): case months.includes('*'):
month.cronEvery = '1'; month.cronEvery = '1'
break; break
case months.includes('/'): case months.includes('/'):
month.cronEvery = '2'; month.cronEvery = '2'
month.incrementStart = months.split('/')[0]; month.incrementStart = months.split('/')[0]
month.incrementIncrement = months.split('/')[1]; month.incrementIncrement = months.split('/')[1]
break; break
case months.includes(','): case months.includes(','):
month.cronEvery = '3'; month.cronEvery = '3'
month.specificSpecific = months.split(',').map(Number).sort(); month.specificSpecific = months.split(',').map(Number).sort()
break; break
case months.includes('-'): case months.includes('-'):
month.cronEvery = '4'; month.cronEvery = '4'
month.rangeStart = months.split('-')[0]; month.rangeStart = months.split('-')[0]
month.rangeEnd = months.split('-')[1]; month.rangeEnd = months.split('-')[1]
break; break
default: default:
month.cronEvery = '1'; month.cronEvery = '1'
} }
this.result.month = month; this.result.month = month
}, },
yearReverseExp (cron) { yearReverseExp (cron) {
let years = cron.split(" ")[6]; const years = cron.split(' ')[6]
let year = { const year = {
cronEvery: '', cronEvery: '',
incrementStart: 3, incrementStart: 3,
incrementIncrement: 5, incrementIncrement: 5,
rangeStart: 2019, rangeStart: 2019,
rangeEnd: 2019, rangeEnd: 2019,
specificSpecific:[], specificSpecific: []
}; }
switch (true) { switch (true) {
case years.includes('*'): case years.includes('*'):
year.cronEvery = '1'; year.cronEvery = '1'
break; break
case years.includes('/'): case years.includes('/'):
year.cronEvery = '2'; year.cronEvery = '2'
year.incrementStart = years.split('/')[0]; year.incrementStart = years.split('/')[0]
year.incrementIncrement = years.split('/')[1]; year.incrementIncrement = years.split('/')[1]
break; break
case years.includes(','): case years.includes(','):
year.cronEvery = '3'; year.cronEvery = '3'
year.specificSpecific = years.split(',').map(Number).sort(); year.specificSpecific = years.split(',').map(Number).sort()
break; break
case years.includes('-'): case years.includes('-'):
year.cronEvery = '4'; year.cronEvery = '4'
year.rangeStart = years.split('-')[0]; year.rangeStart = years.split('-')[0]
year.rangeEnd = years.split('-')[1]; year.rangeEnd = years.split('-')[1]
break; break
default: default:
year.cronEvery = '1'; year.cronEvery = '1'
} }
this.result.year = year; this.result.year = year
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More