提交 832bc376 编写于 作者: JEECG低代码平台's avatar JEECG低代码平台

JeecgBoot低代码平台 2.4.5 版本发布,钉钉与企业微信集成版本

上级 432385fc
Ant Design Jeecg Vue Ant Design Jeecg Vue
==== ====
当前最新版本: 2.4.3(发布日期:20210322 当前最新版本: 2.4.5(发布日期:20210607
Overview Overview
---- ----
基于 [Ant Design of Vue](https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/) 实现的 Ant Design Pro Vue 版 基于 [Ant Design of Vue](https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/) 实现的 Ant Design Pro Vue 版
Jeecg-boot 的前UI框架,采用前后端分离方案,提供强大代码生成器的低代码平台。 Jeecg-boot 的前UI框架,采用前后端分离方案,提供强大代码生成器的低代码平台。
前端页面代码和后端功能代码一键生成,不需要写任何代码,保持jeecg一贯的强大!! 前端页面代码和后端功能代码一键生成,不需要写任何代码,保持jeecg一贯的强大!!
......
{ {
"name": "vue-antd-jeecg", "name": "vue-antd-jeecg",
"version": "2.4.3", "version": "2.4.5",
"private": true, "private": true,
"scripts": { "scripts": {
"pre": "cnpm install || yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org ", "pre": "cnpm install || yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org ",
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
}, },
"dependencies": { "dependencies": {
"ant-design-vue": "^1.7.2", "ant-design-vue": "^1.7.2",
"@jeecg/antd-online-mini": "2.4.3-RC", "@jeecg/antd-online-mini": "2.4.5-RC",
"@antv/data-set": "^0.11.4", "@antv/data-set": "^0.11.4",
"viser-vue": "^2.4.8", "viser-vue": "^2.4.8",
"axios": "^0.18.0", "axios": "^0.18.0",
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
"dom-align": "1.12.0", "dom-align": "1.12.0",
"xe-utils": "2.4.8", "xe-utils": "2.4.8",
"vxe-table": "2.9.13", "vxe-table": "2.9.13",
"vxe-table-plugin-antd": "1.8.10" "vxe-table-plugin-antd": "1.8.10",
"cron-parser": "^2.10.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/polyfill": "^7.2.5", "@babel/polyfill": "^7.2.5",
...@@ -96,10 +97,7 @@ ...@@ -96,10 +97,7 @@
"vue/html-closing-bracket-newline": 0, "vue/html-closing-bracket-newline": 0,
"vue/no-parsing-error": 0, "vue/no-parsing-error": 0,
"no-tabs": 0, "no-tabs": 0,
"indent": [ "indent": ["off", 2],
"off",
2
],
"no-console": 0, "no-console": 0,
"space-before-function-paren": 0 "space-before-function-paren": 0
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</template> </template>
<script> <script>
import JVxeCellMixins, { vModel, dispatchEvent } from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins' import JVxeCellMixins, { dispatchEvent, vModel } from '@/components/jeecg/JVxeTable/mixins/JVxeCellMixins'
export default { export default {
name: 'JVxePopupCell', name: 'JVxePopupCell',
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
orgFields: col.orgFields, orgFields: col.orgFields,
destFields: col.destFields, destFields: col.destFields,
groupId: caseId, groupId: caseId,
param: col.param,
sorter: col.sorter,
} }
}, },
}, },
...@@ -48,7 +50,9 @@ ...@@ -48,7 +50,9 @@
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
aopEvents: { aopEvents: {
editActived: event => dispatchEvent(event, 'ant-input'), editActived(event) {
dispatchEvent.call(this, event, 'ant-input')
},
}, },
}, },
} }
......
...@@ -254,7 +254,9 @@ export const DictSearchInputCell = { ...@@ -254,7 +254,9 @@ export const DictSearchInputCell = {
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
aopEvents: { aopEvents: {
editActived: event => dispatchEvent(event, 'ant-select'), editActived(event) {
dispatchEvent.call(this, event, 'ant-select')
},
}, },
} }
} }
\ No newline at end of file
...@@ -39,5 +39,5 @@ UserMenu.vue:首页右上侧的内容 ...@@ -39,5 +39,5 @@ UserMenu.vue:首页右上侧的内容
![输入图片说明](https://static.oschina.net/uploads/img/201904/12201226_laQK.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201904/12201226_laQK.png "在这里输入图片标题")
####16.trend包 趋势显示组件(如下图) ####16.trend包 趋势显示组件(如下图)
![输入图片说明](https://static.oschina.net/uploads/img/201904/12201600_Wo8K.png "在这里输入图片标题") ![输入图片说明](https://static.oschina.net/uploads/img/201904/12201600_Wo8K.png "在这里输入图片标题")
![corn表达式](https://oscimg.oschina.net/oscnet/661f9ac09016395f9f49286143af3241623.jpg) ![cron表达式](https://oscimg.oschina.net/oscnet/661f9ac09016395f9f49286143af3241623.jpg)
![corn控件添加清除按钮](https://oscimg.oschina.net/oscnet/15096e49f2e29bd829e304d56770025d03c.jpg) ![cron控件添加清除按钮](https://oscimg.oschina.net/oscnet/15096e49f2e29bd829e304d56770025d03c.jpg)
\ No newline at end of file \ No newline at end of file
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
props: { props: {
dictCode: String, dictCode: String,
placeholder: String, placeholder: String,
triggerChange: Boolean,
disabled: Boolean, disabled: Boolean,
value: [String, Number], value: [String, Number],
type: String, type: String,
...@@ -82,19 +81,15 @@ ...@@ -82,19 +81,15 @@
} }
}) })
}, },
handleInput(e) { handleInput(e='') {
let val; let val;
if(this.tagType=="radio"){ 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);
if(this.triggerChange){ this.$emit('change', val);
this.$emit('change', val);
}else{
this.$emit('input', val);
}
}, },
setCurrentDictOptions(dictOptions){ setCurrentDictOptions(dictOptions){
this.dictOptions = dictOptions this.dictOptions = dictOptions
...@@ -102,6 +97,10 @@ ...@@ -102,6 +97,10 @@
getCurrentDictOptions(){ getCurrentDictOptions(){
return this.dictOptions return this.dictOptions
} }
},
model:{
prop: 'value',
event: 'change'
} }
} }
</script> </script>
......
...@@ -65,7 +65,11 @@ ...@@ -65,7 +65,11 @@
type: Number, type: Number,
default: 10, default: 10,
required: false required: false
} },
getPopupContainer: {
type:Function,
default: null
},
}, },
data(){ data(){
this.loadData = debounce(this.loadData, 800);//消抖 this.loadData = debounce(this.loadData, 800);//消抖
...@@ -226,7 +230,9 @@ ...@@ -226,7 +230,9 @@
return this.options return this.options
}, },
getParentContainer(node){ getParentContainer(node){
if(!this.popContainer){ if(typeof this.getPopupContainer === 'function'){
return this.getPopupContainer(node)
} else if(!this.popContainer){
return node.parentNode return node.parentNode
}else{ }else{
return document.querySelector(this.popContainer) return document.querySelector(this.popContainer)
......
<template> <template>
<div class="components-input-demo-presuffix"> <div class="components-input-demo-presuffix">
<a-input @click="openModal" placeholder="corn表达式" v-model="cron" @change="handleOK"> <a-input @click="openModal" placeholder="cron表达式" v-model="cron" @change="(e)=>handleOK(e.target.value)">
<a-icon slot="prefix" type="schedule" title="corn控件"/> <a-icon slot="prefix" type="schedule" title="cron控件"/>
<a-icon v-if="cron" slot="suffix" type="close-circle" @click="handleEmpty" title="清空"/> <a-icon v-if="cron" slot="suffix" type="close-circle" @click="handleEmpty" title="清空"/>
</a-input> </a-input>
<JCronModal ref="innerVueCron" :data="cron" @ok="handleOK"></JCronModal> <JCronModal ref="innerVueCron" :data="cron" @ok="handleOK"></JCronModal>
......
...@@ -350,7 +350,7 @@ ...@@ -350,7 +350,7 @@
<a-tooltip v-bind="buildTooltipProps(row, col, id)"> <a-tooltip v-bind="buildTooltipProps(row, col, id)">
<a-upload <a-upload
name="file" name="file"
:data="{'isup':1}" :data="{'isup':1, ...(col.data||{})}"
:multiple="false" :multiple="false"
:action="col.action" :action="col.action"
:headers="uploadGetHeaders(row,col)" :headers="uploadGetHeaders(row,col)"
...@@ -381,6 +381,8 @@ ...@@ -381,6 +381,8 @@
:dest-fields="col.destFields" :dest-fields="col.destFields"
:code="col.popupCode" :code="col.popupCode"
:groupId="caseId" :groupId="caseId"
:param="col.param"
:sorter="col.sorter"
@input="(value,others)=>popupCallback(value,others,id,row,col,rowIndex)" @input="(value,others)=>popupCallback(value,others,id,row,col,rowIndex)"
/> />
<span <span
...@@ -595,6 +597,33 @@ ...@@ -595,6 +597,33 @@
</template> </template>
<!-- select搜索 -end --> <!-- select搜索 -end -->
<!-- select异步搜索 -begin -->
<template v-else-if="col.type === formTypes.sel_search_async">
<a-tooltip v-bind="buildTooltipProps(row, col, id)">
<j-search-select-tag
v-if="isEditRow(row, col)"
:id="id"
:key="i"
:value="searchSelectAsyncValues[id]"
:placeholder="replaceProps(col, col.placeholder)"
:dict="col.dict"
:async="true"
:getPopupContainer="getParentContainer"
v-bind="buildProps(row,col)"
style="width: 100%;"
@change="(v)=>handleSearchSelectAsyncChange(v,id,row,col)"
>
</j-search-select-tag>
<span
v-else
class="j-td-span no-edit"
:class="{disabled: buildProps(row,col).disabled}"
@click="handleEditRow(row, col)"
>{{ searchSelectAsyncValues[id] }}</span>
</a-tooltip>
</template>
<!-- select异步搜索 -end -->
<div v-else-if="col.type === formTypes.slot" :key="i"> <div v-else-if="col.type === formTypes.slot" :key="i">
<a-tooltip v-bind="buildTooltipProps(row, col, id)"> <a-tooltip v-bind="buildTooltipProps(row, col, id)">
<slot <slot
...@@ -615,7 +644,7 @@ ...@@ -615,7 +644,7 @@
</div> </div>
<!-- else (normal) --> <!-- else (normal) -->
<span v-else :key="i" v-bind="buildProps(row,col)">{{ inputValues[rowIndex][col.key] }}</span> <span class="comp-normal" v-else :key="i" :title="inputValues[rowIndex][col.key]" v-bind="buildProps(row,col)">{{ inputValues[rowIndex][col.key] }}</span>
</template> </template>
</div> </div>
</div> </div>
...@@ -672,13 +701,13 @@ ...@@ -672,13 +701,13 @@
import Draggable from 'vuedraggable' import Draggable from 'vuedraggable'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { FormTypes, VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil' import { FormTypes, VALIDATE_NO_PASSED } from '@/utils/JEditableTableUtil'
import { cloneObject, randomString, randomNumber, getEventPath } from '@/utils/util' import { cloneObject, getEventPath, randomNumber, randomString } from '@/utils/util'
import JDate from '@/components/jeecg/JDate' import JDate from '@/components/jeecg/JDate'
import { filterDictText, initDictOptions } from '@/components/dict/JDictSelectUtil' import { filterDictText, initDictOptions } from '@/components/dict/JDictSelectUtil'
import { getFileAccessHttpUrl } from '@/api/manage'; import { getFileAccessHttpUrl } from '@/api/manage'
import JInputPop from '@/components/jeecg/minipop/JInputPop' import JInputPop from '@/components/jeecg/minipop/JInputPop'
import JFilePop from '@/components/jeecg/minipop/JFilePop' import JFilePop from '@/components/jeecg/minipop/JFilePop'
import { getNoAuthCols } from "@/utils/authFilter" import { getNoAuthCols } from '@/utils/authFilter'
// 行高,需要在实例加载完成前用到 // 行高,需要在实例加载完成前用到
let rowHeight = 61 let rowHeight = 61
...@@ -814,6 +843,7 @@ ...@@ -814,6 +843,7 @@
metaCheckboxValues: {}, metaCheckboxValues: {},
multiSelectValues: {}, multiSelectValues: {},
searchSelectValues: {}, searchSelectValues: {},
searchSelectAsyncValues: {},
// 绑定左侧选择框已选择的id // 绑定左侧选择框已选择的id
selectedRowIds: [], selectedRowIds: [],
// 存储被删除行的id // 存储被删除行的id
...@@ -1048,6 +1078,10 @@ ...@@ -1048,6 +1078,10 @@
this.inputValues = [] this.inputValues = []
this.rows = [] this.rows = []
this.deleteIds = [] this.deleteIds = []
this.selectedRowIds = []
this.tooltips = {}
this.notPassedIds = []
// 重置values
this.selectValues = {} this.selectValues = {}
this.checkboxValues = {} this.checkboxValues = {}
this.jdateValues = {} this.jdateValues = {}
...@@ -1055,14 +1089,16 @@ ...@@ -1055,14 +1089,16 @@
this.departCompValues = {} this.departCompValues = {}
this.userCompValues = {} this.userCompValues = {}
this.slotValues = {} this.slotValues = {}
this.selectedRowIds = [] //update-begin-author:shunjlei date:20210415 for:类型赋值错误
this.tooltips = {} this.uploadValues = {}
this.notPassedIds = [] this.popupValues = {}
this.uploadValues = [] this.radioValues = {}
this.popupValues = [] this.multiSelectValues = {}
this.radioValues = [] this.searchSelectValues = {}
this.multiSelectValues = [] this.searchSelectAsyncValues = {}
this.searchSelectValues = [] //update-end-author:shunjlei date:20210415 for:类型赋值错误
// 重置滚动条
this.scrollTop = 0 this.scrollTop = 0
this.$nextTick(() => { this.$nextTick(() => {
this.getElement('tbody').scrollTop = 0 this.getElement('tbody').scrollTop = 0
...@@ -1136,6 +1172,7 @@ ...@@ -1136,6 +1172,7 @@
let radioValues = { ...this.radioValues } let radioValues = { ...this.radioValues }
let multiSelectValues = { ...this.multiSelectValues } let multiSelectValues = { ...this.multiSelectValues }
let searchSelectValues = { ...this.searchSelectValues } let searchSelectValues = { ...this.searchSelectValues }
let searchSelectAsyncValues = { ...this.searchSelectAsyncValues }
// 禁用行的id // 禁用行的id
let disabledRowIds = (this.disabledRowIds || []) let disabledRowIds = (this.disabledRowIds || [])
dataSource.forEach((data, newValueIndex) => { dataSource.forEach((data, newValueIndex) => {
...@@ -1225,6 +1262,8 @@ ...@@ -1225,6 +1262,8 @@
radioValues[inputId] = sourceValue radioValues[inputId] = sourceValue
} else if (column.type === FormTypes.sel_search) { } else if (column.type === FormTypes.sel_search) {
searchSelectValues[inputId] = sourceValue searchSelectValues[inputId] = sourceValue
} else if (column.type === FormTypes.sel_search_async) {
searchSelectAsyncValues[inputId] = sourceValue
} else if (column.type === FormTypes.list_multi) { } else if (column.type === FormTypes.list_multi) {
if (typeof sourceValue === 'string' && sourceValue.length > 0) { if (typeof sourceValue === 'string' && sourceValue.length > 0) {
multiSelectValues[inputId] = sourceValue.split(',') multiSelectValues[inputId] = sourceValue.split(',')
...@@ -1245,6 +1284,8 @@ ...@@ -1245,6 +1284,8 @@
status: 'done', status: 'done',
path: sourceValue path: sourceValue
} }
} else {
uploadValues[inputId] = null
} }
} else { } else {
value[column.key] = sourceValue value[column.key] = sourceValue
...@@ -1309,6 +1350,7 @@ ...@@ -1309,6 +1350,7 @@
this.radioValues = radioValues this.radioValues = radioValues
this.multiSelectValues = multiSelectValues this.multiSelectValues = multiSelectValues
this.searchSelectValues = searchSelectValues this.searchSelectValues = searchSelectValues
this.searchSelectAsyncValues = searchSelectAsyncValues
// 重新计算所有统计列 // 重新计算所有统计列
this.recalcAllStatisticsColumns() this.recalcAllStatisticsColumns()
// 更新到 dom // 更新到 dom
...@@ -1543,6 +1585,8 @@ ...@@ -1543,6 +1585,8 @@
value[column.key] = this.radioValues[inputId] value[column.key] = this.radioValues[inputId]
} else if (column.type === FormTypes.sel_search) { } else if (column.type === FormTypes.sel_search) {
value[column.key] = this.searchSelectValues[inputId] value[column.key] = this.searchSelectValues[inputId]
} else if (column.type === FormTypes.sel_search_async) {
value[column.key] = this.searchSelectAsyncValues[inputId]
} else if (column.type === FormTypes.list_multi) { } else if (column.type === FormTypes.list_multi) {
if (!this.multiSelectValues[inputId] || this.multiSelectValues[inputId].length === 0) { if (!this.multiSelectValues[inputId] || this.multiSelectValues[inputId].length === 0) {
value[column.key] = '' value[column.key] = ''
...@@ -1671,6 +1715,7 @@ ...@@ -1671,6 +1715,7 @@
radioValues: this.radioValues, radioValues: this.radioValues,
multiSelectValues: this.multiSelectValues, multiSelectValues: this.multiSelectValues,
searchSelectValues: this.searchSelectValues, searchSelectValues: this.searchSelectValues,
searchSelectAsyncValues: this.searchSelectAsyncValues,
}) })
}, },
/** 设置某行某列的值 */ /** 设置某行某列的值 */
...@@ -1736,6 +1781,8 @@ ...@@ -1736,6 +1781,8 @@
edited = this.setOneValue(this.multiSelectValues, modelKey, newValue, true) edited = this.setOneValue(this.multiSelectValues, modelKey, newValue, true)
} else if (column.type === FormTypes.sel_search) { } else if (column.type === FormTypes.sel_search) {
edited = this.setOneValue(this.searchSelectValues, modelKey, newValue) edited = this.setOneValue(this.searchSelectValues, modelKey, newValue)
} else if (column.type === FormTypes.sel_search_async) {
edited = this.setOneValue(this.searchSelectAsyncValues, modelKey, newValue)
} else { } else {
edited = false edited = false
} }
...@@ -2731,6 +2778,11 @@ ...@@ -2731,6 +2778,11 @@
this.validateOneInput(value, row, column, this.notPassedIds, true, 'change') this.validateOneInput(value, row, column, this.notPassedIds, true, 'change')
this.elemValueChange(FormTypes.sel_search, row, column, value) this.elemValueChange(FormTypes.sel_search, row, column, value)
}, },
handleSearchSelectAsyncChange(value, id, row, column) {
this.searchSelectAsyncValues = this.bindValuesChange(value, id, 'searchSelectAsyncValues')
this.validateOneInput(value, row, column, this.notPassedIds, true, 'change')
this.elemValueChange(FormTypes.sel_search_async, row, column, value)
},
filterOption(input, option) { filterOption(input, option) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}, },
...@@ -2992,6 +3044,8 @@ ...@@ -2992,6 +3044,8 @@
border-bottom: @border; border-bottom: @border;
transition: background-color 300ms; transition: background-color 300ms;
width: 100%; width: 100%;
height: 61px;
overflow: hidden;
position: absolute; position: absolute;
left: 0; left: 0;
z-index: 10; z-index: 10;
...@@ -3101,6 +3155,12 @@ ...@@ -3101,6 +3155,12 @@
} }
} }
.comp-normal {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.j-td-span { .j-td-span {
position: relative; position: relative;
padding: 4px 11px; padding: 4px 11px;
......
...@@ -6,6 +6,13 @@ ...@@ -6,6 +6,13 @@
:confirmLoading="uploading" :confirmLoading="uploading"
@cancel="handleClose"> @cancel="handleClose">
<div style="margin: 0px 0px 5px 1px" v-if="online">
<span style="display: inline-block;height: 32px;line-height: 32px;vertical-align: middle;">是否开启校验:</span>
<span style="display: inline-block;height: 32px;margin-left: 6px">
<a-switch :checked="validateStatus==1" @change="handleChangeValidateStatus" checked-children="是" un-checked-children="否" size="small"/>
</span>
</div>
<a-upload <a-upload
name="file" name="file"
:multiple="true" :multiple="true"
...@@ -47,6 +54,12 @@ ...@@ -47,6 +54,12 @@
type: String, type: String,
default: '', default: '',
required: false required: false
},
//是否online导入
online:{
type: Boolean,
default: false,
required: false
} }
}, },
data(){ data(){
...@@ -55,7 +68,8 @@ ...@@ -55,7 +68,8 @@
uploading:false, uploading:false,
fileList:[], fileList:[],
uploadAction:'', uploadAction:'',
foreignKeys:'' foreignKeys:'',
validateStatus: 0
} }
}, },
watch: { watch: {
...@@ -78,6 +92,7 @@ ...@@ -78,6 +92,7 @@
this.uploading = false this.uploading = false
this.visible = true this.visible = true
this.foreignKeys = arg; this.foreignKeys = arg;
this.validateStatus = 0
}, },
handleRemove(file) { handleRemove(file) {
const index = this.fileList.indexOf(file); const index = this.fileList.indexOf(file);
...@@ -98,6 +113,9 @@ ...@@ -98,6 +113,9 @@
if(this.foreignKeys && this.foreignKeys.length>0){ if(this.foreignKeys && this.foreignKeys.length>0){
formData.append('foreignKeys',this.foreignKeys); formData.append('foreignKeys',this.foreignKeys);
} }
if(this.online==true){
formData.append('validateStatus',this.validateStatus);
}
fileList.forEach((file) => { fileList.forEach((file) => {
formData.append('files[]', file); formData.append('files[]', file);
}); });
...@@ -105,14 +123,41 @@ ...@@ -105,14 +123,41 @@
postAction(this.uploadAction, formData).then((res) => { postAction(this.uploadAction, formData).then((res) => {
this.uploading = false this.uploading = false
if(res.success){ if(res.success){
this.$message.success(res.message) if(res.code == 201){
this.errorTip(res.message, res.result)
}else{
this.$message.success(res.message)
}
this.visible=false this.visible=false
this.$emit('ok') this.$emit('ok')
}else{ }else{
this.$message.warning(res.message) this.$message.warning(res.message)
} }
}) })
} },
// 是否开启校验 开关改变事件
handleChangeValidateStatus(checked){
this.validateStatus = checked==true?1:0
},
// 错误信息提示
errorTip(tipMessage, fileUrl) {
const h = this.$createElement;
let href = window._CONFIG['domianURL'] + fileUrl
this.$warning({
title: '导入成功,但是有错误数据!',
content: h('div', {}, [
h('div', tipMessage),
h('span', '具体详情请 '),
h('a', {
attrs: {
href: href,
target: '_blank'
},
},'点击下载'),
]),
onOk() {},
});
},
} }
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
ref="jPopupOnlReport" ref="jPopupOnlReport"
:code="code" :code="code"
:multi="multi" :multi="multi"
:sorter="sorter"
:groupId="uniqGroupId" :groupId="uniqGroupId"
:param="param" :param="param"
@ok="callBack" @ok="callBack"
...@@ -47,6 +48,11 @@ ...@@ -47,6 +48,11 @@
default: '', default: '',
required: false required: false
}, },
/** 排序列,指定要排序的列,使用方式:列名=desc|asc */
sorter: {
type: String,
default: ''
},
width: { width: {
type: Number, type: Number,
default: 1200, default: 1200,
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<a-upload <a-upload
name="file" name="file"
:multiple="true" :multiple="multiple"
:action="uploadAction" :action="uploadAction"
:headers="headers" :headers="headers"
:data="{'biz':bizPath}" :data="{'biz':bizPath}"
...@@ -135,6 +135,10 @@ ...@@ -135,6 +135,10 @@
required:false, required:false,
default: true default: true
}, },
multiple: {
type: Boolean,
default: true
},
}, },
watch:{ watch:{
value:{ value:{
......
...@@ -13,7 +13,7 @@ import JVxeDetailsModal from './JVxeDetailsModal' ...@@ -13,7 +13,7 @@ import JVxeDetailsModal from './JVxeDetailsModal'
import JVxePagination from './JVxePagination' import JVxePagination from './JVxePagination'
import { cloneObject, getVmParentByName, pushIfNotExist, randomString, simpleDebounce } from '@/utils/util' import { cloneObject, getVmParentByName, pushIfNotExist, randomString, simpleDebounce } from '@/utils/util'
import { UtilTools } from 'vxe-table/packages/tools/src/utils' import { UtilTools } from 'vxe-table/packages/tools/src/utils'
import { getNoAuthCols } from "@/utils/authFilter" import { getNoAuthCols } from '@/utils/authFilter'
export default { export default {
name: 'JVxeTable', name: 'JVxeTable',
...@@ -95,6 +95,9 @@ export default { ...@@ -95,6 +95,9 @@ export default {
// 是否异步删除行,如果你要实现异步删除,那么需要把这个选项开启, // 是否异步删除行,如果你要实现异步删除,那么需要把这个选项开启,
// 在remove事件里调用confirmRemove方法才会真正删除(除非删除的全是新增的行) // 在remove事件里调用confirmRemove方法才会真正删除(除非删除的全是新增的行)
asyncRemove: PropTypes.bool.def(false), asyncRemove: PropTypes.bool.def(false),
// 是否一直显示组件,如果为false则只有点击的时候才出现组件
// 注:该参数不能动态修改;如果行、列字段多的情况下,会根据机器性能造成不同程度的卡顿。
alwaysEdit: PropTypes.bool.def(false),
}, },
data() { data() {
return { return {
...@@ -354,7 +357,7 @@ export default { ...@@ -354,7 +357,7 @@ export default {
col.visible = false col.visible = false
} else if (enhanced.switches.editRender) { } else if (enhanced.switches.editRender) {
renderName = 'editRender' renderName = 'editRender'
renderOptions.type = enhanced.switches.visible ? 'visible' : 'default' renderOptions.type = (enhanced.switches.visible || this.alwaysEdit) ? 'visible' : 'default'
} }
} else { } else {
renderOptions.name = JVXETypes._prefix + JVXETypes.normal renderOptions.name = JVXETypes._prefix + JVXETypes.normal
...@@ -1076,7 +1079,7 @@ export default { ...@@ -1076,7 +1079,7 @@ export default {
// 添加默认值 // 添加默认值
xTable.tableFullColumn.forEach(column => { xTable.tableFullColumn.forEach(column => {
let col = column.own let col = column.own
if (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') let 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})
......
...@@ -55,7 +55,9 @@ ...@@ -55,7 +55,9 @@
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
aopEvents: { aopEvents: {
editActived: event => dispatchEvent(event, 'ant-calendar-picker', el => el.children[0].dispatchEvent(event.$event)), editActived(event) {
dispatchEvent.call(this, event, 'ant-calendar-picker', el => el.children[0].dispatchEvent(event.$event))
},
}, },
} }
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
return this.rowIndex === 0 return this.rowIndex === 0
}, },
disabledMoveDown() { disabledMoveDown() {
return this.rowIndex === (this.rows.length - 1) return this.rowIndex === (this.fullDataLength - 1)
}, },
}, },
methods: { methods: {
......
...@@ -116,7 +116,9 @@ ...@@ -116,7 +116,9 @@
// 【组件增强】注释详见:JVxeCellMixins.js // 【组件增强】注释详见:JVxeCellMixins.js
enhanced: { enhanced: {
aopEvents: { aopEvents: {
editActived: event => dispatchEvent(event, 'ant-select'), editActived(event) {
dispatchEvent.call(this, event, 'ant-select')
},
}, },
translate: {enabled: true}, translate: {enabled: true},
getValue(value) { getValue(value) {
......
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
autofocus: '.ant-input', autofocus: '.ant-input',
}, },
aopEvents: { aopEvents: {
editActived: event => dispatchEvent(event, 'anticon-fullscreen'), editActived(event) {
dispatchEvent.call(this, event, 'anticon-fullscreen')
},
}, },
}, },
} }
......
...@@ -36,6 +36,9 @@ export default { ...@@ -36,6 +36,9 @@ export default {
rows() { rows() {
return this.params.data return this.params.data
}, },
fullDataLength() {
return this.params.$table.tableFullData.length
},
rowIndex() { rowIndex() {
return this.params.rowIndex return this.params.rowIndex
}, },
...@@ -291,6 +294,10 @@ export function vModel(value, row, property) { ...@@ -291,6 +294,10 @@ export function vModel(value, row, property) {
/** 模拟触发事件 */ /** 模拟触发事件 */
export function dispatchEvent({cell, $event}, className, handler) { export function dispatchEvent({cell, $event}, className, handler) {
// alwaysEdit 下不模拟触发事件,否者会导致触发两次
if (this && this.alwaysEdit) {
return
}
window.setTimeout(() => { window.setTimeout(() => {
let element = cell.getElementsByClassName(className) let element = cell.getElementsByClassName(className)
if (element && element.length > 0) { if (element && element.length > 0) {
...@@ -298,9 +305,7 @@ export function dispatchEvent({cell, $event}, className, handler) { ...@@ -298,9 +305,7 @@ export function dispatchEvent({cell, $event}, className, handler) {
handler(element[0]) handler(element[0])
} else { } else {
// 模拟触发点击事件 // 模拟触发点击事件
console.log($event)
if($event){ if($event){
console.log("$event===>",$event)
element[0].dispatchEvent($event) element[0].dispatchEvent($event)
} }
} }
......
...@@ -26,6 +26,7 @@ import JSlider from './JSlider.vue' ...@@ -26,6 +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/jeecg/JEasyCron";
//jeecgbiz //jeecgbiz
import JSelectDepart from '../jeecgbiz/JSelectDepart.vue' import JSelectDepart from '../jeecgbiz/JSelectDepart.vue'
...@@ -71,5 +72,6 @@ export default { ...@@ -71,5 +72,6 @@ export default {
Vue.component('JSelectPosition', JSelectPosition) Vue.component('JSelectPosition', JSelectPosition)
Vue.component('JSelectRole', JSelectRole) Vue.component('JSelectRole', JSelectRole)
Vue.component('JSelectUserByDep', JSelectUserByDep) Vue.component('JSelectUserByDep', JSelectUserByDep)
Vue.component(JEasyCron.name, JEasyCron)
} }
} }
\ No newline at end of file
<template> <template>
<a-modal <a-modal
title="corn表达式" title="cron表达式"
:width="modalWidth" :width="modalWidth"
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
const MODAL_WIDTH = 1200; const MODAL_WIDTH = 1200;
export default { export default {
name: 'JPopupOnlReport', name: 'JPopupOnlReport',
props: ['multi', 'code', 'groupId', 'param'], props: ['multi', 'code', 'sorter', 'groupId', 'param'],
components:{ components:{
}, },
data(){ data(){
...@@ -122,8 +122,9 @@ ...@@ -122,8 +122,9 @@
cgRpConfigId:"", cgRpConfigId:"",
modalWidth:MODAL_WIDTH, modalWidth:MODAL_WIDTH,
tableScroll:{x:true}, tableScroll:{x:true},
dynamicParam:{} dynamicParam:{},
// 排序字段,默认无排序
iSorter: null,
} }
}, },
mounted() { mounted() {
...@@ -139,7 +140,28 @@ ...@@ -139,7 +140,28 @@
this.dynamicParamHandler() this.dynamicParamHandler()
this.loadData(); this.loadData();
}, },
} },
sorter: {
immediate: true,
handler() {
if (this.sorter) {
let arr = this.sorter.split('=')
if (arr.length === 2 && ['asc', 'desc'].includes(arr[1].toLowerCase())) {
this.iSorter = {column: arr[0], order: arr[1].toLowerCase()}
// 排序字段受控
this.table.columns.forEach(col => {
if (col.dataIndex === this.iSorter.column) {
this.$set(col, 'sortOrder', this.iSorter.order === 'asc' ? 'ascend' : 'descend')
} else {
this.$set(col, 'sortOrder', false)
}
})
} else {
console.warn('【JPopup】sorter参数不合法')
}
}
},
},
}, },
computed:{ computed:{
showSearchFlag(){ showSearchFlag(){
...@@ -167,6 +189,10 @@ ...@@ -167,6 +189,10 @@
return filterMultiDictText(this.dictOptions[dictCode], text+""); return filterMultiDictText(this.dictOptions[dictCode], text+"");
} }
} }
// 排序字段受控
if (this.iSorter && currColumns[a].dataIndex === this.iSorter.column) {
currColumns[a].sortOrder = this.iSorter.order === 'asc' ? 'ascend' : 'descend'
}
} }
this.table.columns = [...currColumns] this.table.columns = [...currColumns]
this.initQueryInfo() this.initQueryInfo()
...@@ -253,7 +279,7 @@ ...@@ -253,7 +279,7 @@
paramTarget['self_'+key] = this.dynamicParam[key] paramTarget['self_'+key] = this.dynamicParam[key]
}) })
} }
let param = Object.assign(paramTarget, this.queryParam, this.sorter); let param = Object.assign(paramTarget, this.queryParam, this.iSorter);
param.pageNo = this.table.pagination.current; param.pageNo = this.table.pagination.current;
param.pageSize = this.table.pagination.pageSize; param.pageSize = this.table.pagination.pageSize;
return filterObj(param); return filterObj(param);
...@@ -288,8 +314,18 @@ ...@@ -288,8 +314,18 @@
handleChangeInTable(pagination, filters, sorter) { handleChangeInTable(pagination, filters, sorter) {
//分页、排序、筛选变化时触发 //分页、排序、筛选变化时触发
if (Object.keys(sorter).length > 0) { if (Object.keys(sorter).length > 0) {
this.sorter.column = sorter.field this.iSorter = {
this.sorter.order = 'ascend' == sorter.order ? 'asc' : 'desc' column: sorter.field,
order: 'ascend' === sorter.order ? 'asc' : 'desc'
}
// 排序字段受控
this.table.columns.forEach(col => {
if (col.dataIndex === sorter.field) {
this.$set(col, 'sortOrder',sorter.order)
} else {
this.$set(col, 'sortOrder', false)
}
})
} }
this.table.pagination = pagination this.table.pagination = pagination
this.loadData() this.loadData()
......
...@@ -56,8 +56,9 @@ ...@@ -56,8 +56,9 @@
</template> </template>
<script> <script>
import {filterObj} from '@/utils/util' import { pushIfNotExist, filterObj } from '@/utils/util'
import {queryDepartTreeList, getUserList, queryUserByDepId} from '@/api/api' import {queryDepartTreeList, getUserList, queryUserByDepId} from '@/api/api'
import { getAction } from '@/api/manage'
export default { export default {
name: 'JSelectUserByDepModal', name: 'JSelectUserByDepModal',
...@@ -106,6 +107,7 @@ ...@@ -106,6 +107,7 @@
], ],
scrollTrigger: {}, scrollTrigger: {},
dataSource: [], dataSource: [],
selectionRows: [],
selectedRowKeys: [], selectedRowKeys: [],
selectUserRows: [], selectUserRows: [],
selectUserIds: [], selectUserIds: [],
...@@ -163,11 +165,13 @@ ...@@ -163,11 +165,13 @@
pageSize: values.length pageSize: values.length
}).then((res) => { }).then((res) => {
if (res.success) { if (res.success) {
this.selectionRows = []
let selectedRowKeys = [] let selectedRowKeys = []
let realNames = [] let realNames = []
res.result.records.forEach(user => { res.result.records.forEach(user => {
realNames.push(user['realname']) realNames.push(user['realname'])
selectedRowKeys.push(user['id']) selectedRowKeys.push(user['id'])
this.selectionRows.push(user)
}) })
this.selectedRowKeys = selectedRowKeys this.selectedRowKeys = selectedRowKeys
this.$emit('initComp', realNames.join(',')) this.$emit('initComp', realNames.join(','))
...@@ -182,20 +186,16 @@ ...@@ -182,20 +186,16 @@
if (arg === 1) { if (arg === 1) {
this.ipagination.current = 1; this.ipagination.current = 1;
} }
if (this.selectedDepIds && this.selectedDepIds.length > 0) { let params = this.getQueryParams()//查询条件
await this.initQueryUserByDepId(this.selectedDepIds) this.loading = true
} else { getAction('/sys/user/queryUserComponentData', params).then(res=>{
this.loading = true if (res.success) {
let params = this.getQueryParams()//查询条件 this.dataSource = res.result.records
await getUserList(params).then((res) => { this.ipagination.total = res.result.total
if (res.success) { }
this.dataSource = res.result.records }).finally(() => {
this.ipagination.total = res.result.total this.loading = false
} })
}).finally(() => {
this.loading = false
})
}
}, },
// 触发屏幕自适应 // 触发屏幕自适应
resetScreenSize() { resetScreenSize() {
...@@ -218,6 +218,7 @@ ...@@ -218,6 +218,7 @@
param.field = this.getQueryField(); param.field = this.getQueryField();
param.pageNo = this.ipagination.current; param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize; param.pageSize = this.ipagination.pageSize;
param.departId = this.selectedDepIds.join(',')
return filterObj(param); return filterObj(param);
}, },
getQueryField() { getQueryField() {
...@@ -229,13 +230,13 @@ ...@@ -229,13 +230,13 @@
}, },
searchReset(num) { searchReset(num) {
let that = this; let that = this;
that.selectedRowKeys = [];
that.selectUserIds = [];
that.selectedDepIds = [];
if (num !== 0) { if (num !== 0) {
that.queryParam = {}; that.queryParam = {};
that.loadData(1); that.loadData(1);
} }
that.selectedRowKeys = [];
that.selectUserIds = [];
that.selectedDepIds = [];
}, },
close() { close() {
this.searchReset(0); this.searchReset(0);
...@@ -258,30 +259,27 @@ ...@@ -258,30 +259,27 @@
that.close(); that.close();
}, },
//获取选择用户信息 //获取选择用户信息
getSelectUserRows(rowId) { getSelectUserRows() {
let dataSource = this.dataSource; this.selectUserRows = []
let userIds = ""; for (let row of this.selectionRows) {
this.selectUserRows = []; if (this.selectedRowKeys.includes(row.id)) {
for (let i = 0, len = dataSource.length; i < len; i++) { this.selectUserRows.push(row)
if (this.selectedRowKeys.includes(dataSource[i].id)) {
this.selectUserRows.push(dataSource[i]);
userIds = userIds + "," + dataSource[i].username
} }
} }
this.selectUserIds = userIds.substring(1); this.selectUserIds = this.selectUserRows.map(row => row.username).join(',')
}, },
// 点击树节点,筛选出对应的用户 // 点击树节点,筛选出对应的用户
onDepSelect(selectedDepIds) { onDepSelect(selectedDepIds) {
if (selectedDepIds[0] != null) { if (selectedDepIds[0] != null) {
this.initQueryUserByDepId(selectedDepIds); // 调用方法根据选选择的id查询用户信息
if (this.selectedDepIds[0] !== selectedDepIds[0]) { if (this.selectedDepIds[0] !== selectedDepIds[0]) {
this.selectedDepIds = [selectedDepIds[0]]; this.selectedDepIds = [selectedDepIds[0]];
} }
this.loadData(1);
} }
}, },
onSelectChange(selectedRowKeys, selectionRows) { onSelectChange(selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys; this.selectedRowKeys = selectedRowKeys;
this.selectionRows = selectionRows; selectionRows.forEach(row => pushIfNotExist(this.selectionRows, row, 'id'))
}, },
onSearch() { onSearch() {
this.loadData(1); this.loadData(1);
......
<template>
<span v-if="syncToApp || syncToLocal">
<j-third-app-dropdown v-if="enabledTypes.wechatEnterprise" type="wechatEnterprise" name="企微" v-bind="bindAttrs" v-on="bindEvents"/>
<j-third-app-dropdown v-if="enabledTypes.dingtalk" type="dingtalk" name="钉钉" v-bind="bindAttrs" v-on="bindEvents"/>
</span>
<span v-else>未设置任何同步方向</span>
</template>
<script>
import { getAction } from '@/api/manage'
import { cloneObject } from '@/utils/util'
import JThirdAppDropdown from './JThirdAppDropdown'
const backEndUrl = {
// 获取启用的第三方App
getEnabledType: '/sys/thirdApp/getEnabledType',
// 企业微信
wechatEnterprise: {
user: '/sys/thirdApp/sync/wechatEnterprise/user',
depart: '/sys/thirdApp/sync/wechatEnterprise/depart',
},
// 钉钉
dingtalk: {
user: '/sys/thirdApp/sync/dingtalk/user',
depart: '/sys/thirdApp/sync/dingtalk/depart',
}
}
export default {
name: 'JThirdAppButton',
components: {JThirdAppDropdown},
props: {
// 同步类型,可以是 user、depart
bizType: {
type: String,
required: true,
},
// 是否允许同步到第三方APP
syncToApp: Boolean,
// 是否允许第三方APP同步到本地
syncToLocal: Boolean,
// 选择的行
selectedRowKeys: Array,
},
data() {
return {
enabledTypes: {},
attrs: {
dingtalk: {},
},
}
},
computed: {
bindAttrs() {
return {
syncToApp: this.syncToApp,
syncToLocal: this.syncToLocal
}
},
bindEvents() {
return {
'to-app': this.onToApp,
'to-local': this.onToLocal,
}
},
},
created() {
this.loadEnabledTypes()
},
methods: {
handleMenuClick() {
console.log(arguments)
},
onToApp(e) {
this.doSync(e.type, '/toApp')
},
onToLocal(e) {
this.doSync(e.type, '/toLocal')
},
// 获取启用的第三方App
async loadEnabledTypes() {
this.enabledTypes = await loadEnabledTypes()
},
// 开始同步第三方App
doSync(type, direction) {
let urls = backEndUrl[type]
if (!(urls && urls[this.bizType])) {
console.warn('配置出错')
return
}
let url = urls[this.bizType] + direction
let selectedRowKeys = this.selectedRowKeys
let content = '确定要开始同步全部数据吗?可能花费较长时间!'
if (Array.isArray(selectedRowKeys) && selectedRowKeys.length > 0) {
content = `确定要开始同步这 ${selectedRowKeys.length} 项吗?`
} else {
selectedRowKeys = []
}
return new Promise((resolve, reject) => {
let model = this.$confirm({
title: '同步',
content,
onOk: () => {
model.update({
keyboard: false,
okText: '同步中…',
cancelButtonProps: {props: {disabled: true}}
})
return getAction(url, {
ids: selectedRowKeys.join(',')
}).then(res => {
let options = null
if (res.result) {
options = {
width: 600,
title: res.message,
content: (h) => {
let nodes
let successInfo = [
`成功信息如下:`,
this.renderTextarea(h, res.result.successInfo.map((v, i) => `${i + 1}. ${v}`).join('\n')),
]
if (res.success) {
nodes = [
...successInfo,
h('br'),
`无失败信息!`,
]
} else {
nodes = [
`失败信息如下:`,
this.renderTextarea(h, res.result.failInfo.map((v, i) => `${i + 1}. ${v}`).join('\n')),
h('br'),
...successInfo,
]
}
return nodes
}
}
}
if (res.success) {
if (options != null) {
this.$success(options)
} else {
this.$message.success(res.message)
}
this.$emit('sync-ok')
} else {
if (options != null) {
this.$warning(options)
} else {
this.$message.warning(res.message)
}
this.$emit('sync-error')
}
}).catch(() => model.destroy()).finally(() => {
resolve()
this.$emit('sync-finally', {
type,
direction,
isToApp: direction === '/toApp',
isToLocal: direction === '/toLocal',
})
})
},
onCancel() {
resolve()
},
})
})
},
renderTextarea(h, value) {
return h('a-textarea', {
props: {
value: value,
readOnly: true,
autosize: {minRows: 5, maxRows: 10},
},
style: {
// 关闭textarea的自动换行,使其可以左右滚动
whiteSpace: 'pre',
overflow: 'auto',
}
})
}
},
}
// 启用了哪些第三方App(在此缓存)
let enabledTypes = null
// 获取启用的第三方App
export async function loadEnabledTypes() {
// 获取缓存
if (enabledTypes != null) {
return cloneObject(enabledTypes)
} else {
let {success, result} = await getAction(backEndUrl.getEnabledType)
if (success) {
// 在此缓存
enabledTypes = cloneObject(result)
return result
} else {
console.warn('getEnabledType查询失败:', res)
}
}
return {}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<a-dropdown v-if="syncToApp && syncToLocal">
<a-button type="primary" icon="sync">同步{{name}}</a-button>
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item v-if="syncToApp" key="to-app">同步到{{name}}</a-menu-item>
<a-menu-item v-if="syncToLocal" key="to-local">同步到本地</a-menu-item>
</a-menu>
</a-dropdown>
<a-button v-else-if="syncToApp" type="primary" icon="sync" @click="handleMenuClick({key:'to-app'})">同步{{name}}</a-button>
<a-button v-else type="primary" icon="sync" @click="handleMenuClick({key:'to-local'})">同步{{name}}到本地</a-button>
</template>
<script>
/* JThirdAppButton 的子组件,不可单独使用 */
export default {
name: 'JThirdAppDropdown',
props: {
type: String,
name: String,
syncToApp: Boolean,
syncToLocal: Boolean,
},
methods: {
handleMenuClick(event) {
this.$emit(event.key, {type: this.type})
},
},
}
</script>
<style scoped>
</style>
\ No newline at end of file
...@@ -36,9 +36,10 @@ ...@@ -36,9 +36,10 @@
import Contextmenu from '@/components/menu/Contextmenu' import Contextmenu from '@/components/menu/Contextmenu'
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
import { triggerWindowResizeEvent } from '@/utils/util' import { triggerWindowResizeEvent } from '@/utils/util'
const indexKey = '/dashboard/analysis'
import Vue from 'vue' import Vue from 'vue'
import { CACHE_INCLUDED_ROUTES } from "@/store/mutation-types" import { CACHE_INCLUDED_ROUTES } from '@/store/mutation-types'
const indexKey = '/dashboard/analysis'
export default { export default {
name: 'TabLayout', name: 'TabLayout',
...@@ -86,13 +87,6 @@ ...@@ -86,13 +87,6 @@
// 复制一个route对象出来,不能影响原route // 复制一个route对象出来,不能影响原route
let currentRoute = Object.assign({}, this.$route) let currentRoute = Object.assign({}, this.$route)
currentRoute.meta = Object.assign({}, currentRoute.meta) currentRoute.meta = Object.assign({}, currentRoute.meta)
// update-begin-author:sunjianlei date:20191223 for: 修复刷新后菜单Tab名字显示异常
let storeKey = 'route:title:' + currentRoute.fullPath
let routeTitle = this.$ls.get(storeKey)
if (routeTitle) {
currentRoute.meta.title = routeTitle
}
// update-end-author:sunjianlei date:20191223 for: 修复刷新后菜单Tab名字显示异常
this.pageList.push(currentRoute) this.pageList.push(currentRoute)
this.linkList.push(currentRoute.fullPath) this.linkList.push(currentRoute.fullPath)
this.activePage = currentRoute.fullPath this.activePage = currentRoute.fullPath
......
...@@ -57,7 +57,8 @@ import { ...@@ -57,7 +57,8 @@ import {
Cascader, Cascader,
Slider, Slider,
Transfer, Transfer,
Rate Rate,
Collapse,
} from 'ant-design-vue' } from 'ant-design-vue'
import Viser from 'viser-vue' import Viser from 'viser-vue'
...@@ -112,6 +113,7 @@ Vue.use(Cascader) ...@@ -112,6 +113,7 @@ Vue.use(Cascader)
Vue.use(Slider) Vue.use(Slider)
Vue.use(Transfer) Vue.use(Transfer)
Vue.use(Rate) Vue.use(Rate)
Vue.use(Collapse)
Vue.prototype.$confirm = Modal.confirm Vue.prototype.$confirm = Modal.confirm
Vue.prototype.$message = message Vue.prototype.$message = message
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
:menu="menus" :menu="menus"
:theme="theme" :theme="theme"
@select="onSelect" @select="onSelect"
@updateMenuTitle="onUpdateMenuTitle"
:mode="mode" :mode="mode"
:style="smenuStyle"> :style="smenuStyle">
</s-menu> </s-menu>
...@@ -19,7 +20,7 @@ ...@@ -19,7 +20,7 @@
</template> </template>
<script> <script>
import ALayoutSider from "ant-design-vue/es/layout/Sider" import ALayoutSider from 'ant-design-vue/es/layout/Sider'
import Logo from '../tools/Logo' import Logo from '../tools/Logo'
import SMenu from './index' import SMenu from './index'
import { mixin, mixinDevice } from '@/utils/mixin.js' import { mixin, mixinDevice } from '@/utils/mixin.js'
...@@ -68,6 +69,9 @@ ...@@ -68,6 +69,9 @@
methods: { methods: {
onSelect (obj) { onSelect (obj) {
this.$emit('menuSelect', obj) this.$emit('menuSelect', obj)
},
onUpdateMenuTitle (obj) {
this.$emit('updateMenuTitle', obj)
} }
} }
} }
......
...@@ -82,18 +82,49 @@ export default { ...@@ -82,18 +82,49 @@ export default {
} else { } else {
this.selectedKeys = [routes.pop().path] this.selectedKeys = [routes.pop().path]
} }
const openKeys = [] let openKeys = []
if (this.mode === 'inline') { if (this.mode === 'inline') {
routes.forEach(item => { routes.forEach(item => {
openKeys.push(item.path) openKeys.push(item.path)
}) })
} }
// update-begin-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
// 包含冒号的是动态菜单
if (this.selectedKeys[0].includes(':')) {
let selectedKey = this.$route.fullPath
this.selectedKeys = [selectedKey]
let newOpenKeys = []
this.fullOpenKeys(this.menu, selectedKey, newOpenKeys)
if (newOpenKeys.length > 0) {
openKeys = newOpenKeys.reverse()
}
}
// update-end-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
//update-begin-author:taoyan date:20190510 for:online表单菜单点击展开的一级目录不对 //update-begin-author:taoyan date:20190510 for:online表单菜单点击展开的一级目录不对
if(!this.selectedKeys || this.selectedKeys[0].indexOf(":")<0){ if(!this.selectedKeys || this.selectedKeys[0].indexOf(":")<0){
this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.openKeys = openKeys) this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.openKeys = openKeys)
} }
//update-end-author:taoyan date:20190510 for:online表单菜单点击展开的一级目录不对 //update-end-author:taoyan date:20190510 for:online表单菜单点击展开的一级目录不对
}, },
// update-begin-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
// 递归查找当前选中的菜单和父级菜单,填充openKeys
fullOpenKeys(menus, selectedKey, openKeys) {
for (let item of menus) {
if (item.path === selectedKey) {
openKeys.push(item.path)
this.$emit('updateMenuTitle', item)
return true
} else if (Array.isArray(item.children)) {
if (this.fullOpenKeys(item.children, selectedKey, openKeys)) {
openKeys.push(item.path)
return true
}
}
}
},
// update-end-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
// render // render
renderItem (menu) { renderItem (menu) {
......
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
<s-menu <s-menu
mode="horizontal" mode="horizontal"
:menu="menus" :menu="menus"
:theme="theme"></s-menu> :theme="theme"
@updateMenuTitle="handleUpdateMenuTitle"
></s-menu>
</div> </div>
<a-icon <a-icon
v-else v-else
...@@ -155,8 +157,15 @@ ...@@ -155,8 +157,15 @@
this.topMenuStyle.headerIndexLeft = { 'width': `calc(100% - ${rightWidth})` } this.topMenuStyle.headerIndexLeft = { 'width': `calc(100% - ${rightWidth})` }
} }
} }
} },
//update-begin--author:sunjianlei---date:20190508------for: 顶部导航栏过长时显示更多按钮----- //update-begin--author:sunjianlei---date:20190508------for: 顶部导航栏过长时显示更多按钮-----
// update-begin-author:sunjianlei date:20210508 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
handleUpdateMenuTitle(value) {
this.$emit('updateMenuTitle', value)
},
// update-end-author:sunjianlei date:20210508 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
} }
} }
</script> </script>
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
v-if="device === 'mobile'" v-if="device === 'mobile'"
:menus="menus" :menus="menus"
@menuSelect="menuSelect" @menuSelect="menuSelect"
@updateMenuTitle="handleUpdateMenuTitle"
:theme="navTheme" :theme="navTheme"
:collapsed="false" :collapsed="false"
:collapsible="true"></side-menu> :collapsible="true"></side-menu>
...@@ -26,6 +27,7 @@ ...@@ -26,6 +27,7 @@
mode="inline" mode="inline"
:menus="menus" :menus="menus"
@menuSelect="myMenuSelect" @menuSelect="myMenuSelect"
@updateMenuTitle="handleUpdateMenuTitle"
:theme="navTheme" :theme="navTheme"
:collapsed="collapsed" :collapsed="collapsed"
:collapsible="true"></side-menu> :collapsible="true"></side-menu>
...@@ -45,6 +47,7 @@ ...@@ -45,6 +47,7 @@
mode="inline" mode="inline"
:menus="menus" :menus="menus"
@menuSelect="menuSelect" @menuSelect="menuSelect"
@updateMenuTitle="handleUpdateMenuTitle"
:theme="navTheme" :theme="navTheme"
:collapsed="false" :collapsed="false"
:collapsible="true"></side-menu> :collapsible="true"></side-menu>
...@@ -62,6 +65,7 @@ ...@@ -62,6 +65,7 @@
:collapsed="collapsed" :collapsed="collapsed"
:device="device" :device="device"
@toggle="toggle" @toggle="toggle"
@updateMenuTitle="handleUpdateMenuTitle"
/> />
<!-- layout content --> <!-- layout content -->
...@@ -85,15 +89,14 @@ ...@@ -85,15 +89,14 @@
import SideMenu from '@/components/menu/SideMenu' import SideMenu from '@/components/menu/SideMenu'
import GlobalHeader from '@/components/page/GlobalHeader' import GlobalHeader from '@/components/page/GlobalHeader'
import GlobalFooter from '@/components/page/GlobalFooter' import GlobalFooter from '@/components/page/GlobalFooter'
import { triggerWindowResizeEvent } from '@/utils/util'
import { mapActions, mapState } from 'vuex'
import { mixin, mixinDevice } from '@/utils/mixin.js'
// update-start---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------ // update-start---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------
// import SettingDrawer from '@/components/setting/SettingDrawer' // import SettingDrawer from '@/components/setting/SettingDrawer'
// 注释这个因为在个人设置模块已经加载了SettingDrawer页面 // 注释这个因为在个人设置模块已经加载了SettingDrawer页面
// update-end ---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------ // update-end ---- author:os_chengtgen -- date:20190830 -- for:issues/463 -编译主题颜色已生效,但还一直转圈,显示主题 正在编译 ------
import { triggerWindowResizeEvent } from '@/utils/util'
import { mapState, mapActions } from 'vuex'
import { mixin, mixinDevice } from '@/utils/mixin.js'
export default { export default {
name: 'GlobalLayout', name: 'GlobalLayout',
components: { components: {
...@@ -160,10 +163,6 @@ ...@@ -160,10 +163,6 @@
//此处触发动态路由被点击事件 //此处触发动态路由被点击事件
this.findMenuBykey(this.menus,value.key) this.findMenuBykey(this.menus,value.key)
this.$emit("dynamicRouterShow",value.key,this.activeMenu.meta.title) this.$emit("dynamicRouterShow",value.key,this.activeMenu.meta.title)
// update-begin-author:sunjianlei date:20191223 for: 修复刷新后菜单Tab名字显示异常
let storeKey = 'route:title:' + this.activeMenu.path
this.$ls.set(storeKey, this.activeMenu.meta.title)
// update-end-author:sunjianlei date:20191223 for: 修复刷新后菜单Tab名字显示异常
}, },
findMenuBykey(menus,key){ findMenuBykey(menus,key){
for(let i of menus){ for(let i of menus){
...@@ -173,8 +172,17 @@ ...@@ -173,8 +172,17 @@
this.findMenuBykey(i.children,key) this.findMenuBykey(i.children,key)
} }
} }
} },
//update-end-author:taoyan date:20190430 for:动态路由title显示配置的菜单title而不是其对应路由的title //update-end-author:taoyan date:20190430 for:动态路由title显示配置的菜单title而不是其对应路由的title
// update-begin-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
handleUpdateMenuTitle(value) {
this.findMenuBykey(this.menus, value.path)
this.activeMenu.meta.title = value.meta.title
this.$emit('dynamicRouterShow', value.path, this.activeMenu.meta.title)
},
// update-end-author:sunjianlei date:20210409 for: 修复动态功能测试菜单、带参数菜单标题错误、展开错误的问题
} }
} }
......
...@@ -185,8 +185,8 @@ ...@@ -185,8 +185,8 @@
return that.Logout({}).then(() => { return that.Logout({}).then(() => {
// update-begin author:wangshuai date:20200601 for: 退出登录跳转登录页面 // update-begin author:wangshuai date:20200601 for: 退出登录跳转登录页面
that.$router.push({ path: '/user/login' }); that.$router.push({ path: '/user/login' });
window.location.reload()
// update-end author:wangshuai date:20200601 for: 退出登录跳转登录页面 // update-end author:wangshuai date:20200601 for: 退出登录跳转登录页面
//window.location.reload()
}).catch(err => { }).catch(err => {
that.$message.error({ that.$message.error({
title: '错误', title: '错误',
...@@ -225,11 +225,17 @@ ...@@ -225,11 +225,17 @@
// update_begin author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题 // update_begin author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题
searchMethods(value) { searchMethods(value) {
let route = this.searchMenuOptions.filter(item => item.id === value)[0] let route = this.searchMenuOptions.filter(item => item.id === value)[0]
if (route.meta.internalOrExternal === true || route.component.includes('layouts/IframePageView')) { //update-begin-author:taoyan date:20210528 for: 【菜单问题】配置一个iframe地址的菜单,内部打开,在搜索菜单上打开却新开了一个窗口
if (route.meta.internalOrExternal === true) {
window.open(route.meta.url, '_blank') window.open(route.meta.url, '_blank')
} else { } else {
this.$router.push({ path: route.path }) if(route.component.includes('layouts/IframePageView')){
this.$router.push(route)
}else{
this.$router.push({ path: route.path })
}
} }
//update-end-author:taoyan date:20210528 for: 【菜单问题】配置一个iframe地址的菜单,内部打开,在搜索菜单上打开却新开了一个窗口
this.searchMenuVisible = false this.searchMenuVisible = false
}, },
// update_end author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题 // update_end author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题
......
...@@ -14,6 +14,7 @@ const FormTypes = { ...@@ -14,6 +14,7 @@ const FormTypes = {
popup:'popup', popup:'popup',
list_multi:"list_multi", list_multi:"list_multi",
sel_search:"sel_search", sel_search:"sel_search",
sel_search_async:"sel_search_async",
radio:'radio', radio:'radio',
checkbox_meta:"checkbox_meta", checkbox_meta:"checkbox_meta",
input_pop:'input_pop', input_pop:'input_pop',
......
<template>
<a-card :bordered="false">
<a-spin :spinning="loading">
<a-form-model ref="form" :model="model" :rules="rules">
<a-tabs>
<a-tab-pane tab="消息选项" key="1">
<a-form-model-item label="测试APP" prop="app" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="model.app" placeholder="请选择测试APP" :options="appOptions"/>
</a-form-model-item>
<a-form-model-item label="发送给所有人" prop="sendAll" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="model.sendAll" @change="onSendAllChange"/>
</a-form-model-item>
<a-form-model-item label="接收人" prop="receiver" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-multi-user v-model="model.receiver" :disabled="model.sendAll" placeholder="请选择接收人"/>
</a-form-model-item>
<a-form-model-item label="消息内容" prop="content" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-textarea :rows="5" v-model="model.content" placeholder="请输入消息内容"/>
</a-form-model-item>
<div style="text-align: center;">
<a-button type="primary" size="large" @click="onSend" style="width: 120px;">发送</a-button>
</div>
</a-tab-pane>
</a-tabs>
<a-tabs>
<a-tab-pane tab="测试结果(刷新自动清空)" key="1">
<a-table
rowKey="id"
bordered
size="middle"
:columns="columns"
:dataSource="dataSource"
>
<div slot="action" slot-scope="text, record">
<template v-if="record.app==='DINGTALK'">
<a-popconfirm v-if="!record.recalled" title="确定吗?" @confirm="handleRecall(record)">
<a @click="">撤回</a>
</a-popconfirm>
<span v-else>已撤回</span>
</template>
<template v-else>-</template>
</div>
</a-table>
</a-tab-pane>
</a-tabs>
</a-form-model>
</a-spin>
</a-card>
</template>
<script>
import { loadEnabledTypes } from '@/components/jeecgbiz/thirdApp/JThirdAppButton'
import { postAction } from '@/api/manage'
import { randomUUID } from '@/utils/util'
export default {
name: 'ThirdAppMessageTest',
data() {
return {
loading: false,
labelCol: {span: 6},
wrapperCol: {span: 12},
model: {
sendAll: false,
},
enabledTypes: {},
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, index) => {
return this.dataSource.length - index
}
},
{
title: '测试APP',
align: 'center',
dataIndex: 'app',
customRender: (t, r, index) => {
if (t === 'WECHAT_ENTERPRISE') {
return '企业微信'
}
if (t === 'DINGTALK') {
return '钉钉'
} else {
return t
}
}
},
{
title: '接收人',
align: 'center',
dataIndex: 'receiver',
customRender: (t, r, index) => {
return r.sendAll ? '【全体】' : t
}
},
{
title: '消息内容',
align: 'center',
dataIndex: 'content'
},
{
title: 'response',
align: 'center',
dataIndex: 'response'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: 80,
scopedSlots: {customRender: 'action'}
}
],
dataSource: [],
}
},
computed: {
rules() {
return {
app: [{required: true, message: '请选择测试APP'}],
url: [{required: this.show, message: '请输入菜单路径!'}],
receiver: [{required: !this.model.sendAll, message: '请选择接收人'}],
content: [{required: true, message: '消息内容不能为空'}]
}
},
appOptions() {
return [
{
label: `企业微信${this.enabledTypes.wechatEnterprise ? '' : '(已禁用)'}`,
value: 'WECHAT_ENTERPRISE',
disabled: !this.enabledTypes.wechatEnterprise
},
{
label: `钉钉${this.enabledTypes.dingtalk ? '' : '(已禁用)'}`,
value: 'DINGTALK',
disabled: !this.enabledTypes.dingtalk
},
]
},
},
created() {
this.loadEnabledTypes()
},
methods: {
// 获取启用的第三方App
async loadEnabledTypes() {
this.enabledTypes = await loadEnabledTypes()
},
onSendAllChange() {
this.$refs.form.clearValidate('receiver')
},
onSend() {
this.$refs.form.validate((ok, err) => {
if (ok) {
this.loading = true
postAction('/sys/thirdApp/sendMessageTest', this.model).then(({success, result, message}) => {
if (success) {
let response = ''
try {
response = JSON.stringify(result)
} catch (e) {
response = result
}
this.dataSource.unshift(Object.assign({id: randomUUID()}, this.model, {response}))
} else {
this.$message.warning(message)
}
}).finally(() => this.loading = false)
}
})
},
handleRecall(record) {
try {
let response = JSON.parse(record.response)
postAction('/sys/thirdApp/recallMessageTest', {
app: record.app,
msg_task_id: response.result
}).then(res => {
if (res.success) {
this.$set(record, 'recalled', true)
this.$message.success(res.message)
} else {
this.$message.warning(res.message)
}
}).catch(e => this.$message.warning(e.message || e))
} catch (e) {
this.$message.warning(e.message || e)
}
},
},
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<a-form @submit="handleSubmit" :form="form"> <a-form-model ref="form" :model="model" :rules="rules" @submit="handleSubmit">
<a-row> <a-row>
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-form-item label="Note" :labelCol="{ span: 7 }" :wrapperCol="{ span: 15 }"> <a-form-model-item label="Note" prop="note" :labelCol="{ span: 7 }" :wrapperCol="{ span: 15 }">
<a-input v-decorator="['note',{rules: [{ required: true, message: 'Please input your note!' }]}]"/> <a-input v-model="model.note"/>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-form-item label="Gender" :labelCol="{ span: 7 }" :wrapperCol="{ span: 15 }"> <a-form-model-item label="Gender" prop="gender" :labelCol="{ span: 7 }" :wrapperCol="{ span: 15 }">
<a-select v-decorator="['gender',{rules: [{ required: true, message: 'Please select your gender!' }]}]" placeholder="Select a option and change input text above" @change="this.handleSelectChange"> <a-select v-model="model.gender" placeholder="Select a option and change input text above" @change="handleSelectChange">
<a-select-option value="male">male</a-select-option> <a-select-option value="male">male</a-select-option>
<a-select-option value="female">female</a-select-option> <a-select-option value="female">female</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row> <a-row>
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-form-item label="Gender" :labelCol="{ span: 7 }" :wrapperCol="{ span: 15 }"> <a-form-model-item label="Gender" prop="cascader" :labelCol="{ span: 7 }" :wrapperCol="{ span: 15 }">
<a-cascader :options="areaOptions" @change="onChange" :showSearch="{filter}" placeholder="Please select" /> <a-cascader :options="areaOptions" @change="onChange" :showSearch="{filter}" placeholder="Please select" />
</a-form-item> </a-form-model-item>
</a-col> </a-col>
</a-row> </a-row>
<a-form-item :wrapperCol="{ span: 12, offset: 5 }"> <a-form-model-item :wrapperCol="{ span: 12, offset: 5 }">
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-form-item :wrapperCol="{ span: 12, offset: 5 }"> <a-form-model-item :wrapperCol="{ span: 12, offset: 5 }">
<a-button type="primary" htmlType="submit">Submit</a-button> <a-button type="primary" htmlType="submit">Submit</a-button>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
</a-form-item> </a-form-model-item>
</a-form> </a-form-model>
</a-card> </a-card>
</template> </template>
...@@ -43,24 +43,27 @@ ...@@ -43,24 +43,27 @@
data () { data () {
return { return {
formLayout: 'horizontal', formLayout: 'horizontal',
form: this.$form.createForm(this), model: {},
rules: {
note: [{required: true, message: 'Please input your note!'}],
gender:[{ required: true, message: 'Please select your gender!' }]
},
areaOptions:[] areaOptions:[]
} }
}, },
methods: { methods: {
handleSubmit (e) { handleSubmit (e) {
e.preventDefault() e.preventDefault()
this.form.validateFields((err, values) => { this.$refs.form.validate((ok, err) => {
if (!err) { if (ok) {
console.log('Received values of form: ', values) console.log('Received values of form: ', this.model)
this.$message.success('succeed!')
} }
}) })
}, },
handleSelectChange (value) { handleSelectChange (value) {
console.log(value) console.log(value)
this.form.setFieldsValue({ this.model.note = `Hi, ${value === 'male' ? 'man' : 'lady'}!`
note: `Hi, ${value === 'male' ? 'man' : 'lady'}!`,
})
}, },
onChange(value, selectedOptions) { onChange(value, selectedOptions) {
console.log(value, selectedOptions); console.log(value, selectedOptions);
......
...@@ -99,7 +99,11 @@ ...@@ -99,7 +99,11 @@
placeholder: '点击上传', placeholder: '点击上传',
token: true, token: true,
responseName: 'message', responseName: 'message',
action: window._CONFIG['domianURL'] + '/sys/common/upload' action: window._CONFIG['domianURL'] + '/sys/common/upload',
data: {
biz: 'temp',
// 更多扩展参数
},
}, },
{ {
title: '字段类型', title: '字段类型',
......
<template> <template>
<a-modal <a-modal
title="corn表达式" title="cron表达式"
:width="modalWidth" :width="modalWidth"
:visible="visible" :visible="visible"
:confirmLoading="confirmLoading" :confirmLoading="confirmLoading"
......
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 按钮操作区域 --> <!-- 按钮操作区域 -->
<a-row style="margin-left: 14px"> <a-row style="margin: 0 0 0 14px" class="table-operator">
<a-button @click="handleAdd(1)" type="primary">添加部门</a-button> <a-button @click="handleAdd(1)" type="primary">添加部门</a-button>
<a-button @click="handleAdd(2)" type="primary">添加下级</a-button> <a-button @click="handleAdd(2)" type="primary">添加下级</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('部门信息')">导出</a-button> <a-button type="primary" icon="download" @click="handleExportXls('部门信息')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<j-third-app-button biz-type="depart" :selected-row-keys="selectedRowKeys" syncToApp @sync-finally="onSyncFinally"/>
<a-button title="删除多条数据" @click="batchDel" type="default">批量删除</a-button> <a-button title="删除多条数据" @click="batchDel" type="default">批量删除</a-button>
</a-row> </a-row>
<div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px"> <div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px">
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
<a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus"> <a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">
<span style="user-select: none"> <span style="user-select: none">
<a-tree <a-tree
v-if="loading"
checkable checkable
multiple multiple
@select="onSelect" @select="onSelect"
...@@ -36,11 +38,10 @@ ...@@ -36,11 +38,10 @@
:checkedKeys="checkedKeys" :checkedKeys="checkedKeys"
:treeData="departTree" :treeData="departTree"
:checkStrictly="checkStrictly" :checkStrictly="checkStrictly"
:expandedKeys="iExpandedKeys" :expandedKeys.sync="iExpandedKeys"
:load-data="loadSubTree" :load-data="loadSubTree"
@expand="onExpand"/> @expand="onExpand"/>
</span> </span>
<!--新增右键点击事件,和增加添加和删除功能-->
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item @click="handleAdd(3)" key="1">添加</a-menu-item> <a-menu-item @click="handleAdd(3)" key="1">添加</a-menu-item>
<a-menu-item @click="handleDelete" key="2">删除</a-menu-item> <a-menu-item @click="handleDelete" key="2">删除</a-menu-item>
...@@ -73,42 +74,27 @@ ...@@ -73,42 +74,27 @@
<a-tabs defaultActiveKey="1"> <a-tabs defaultActiveKey="1">
<a-tab-pane tab="基本信息" key="1" > <a-tab-pane tab="基本信息" key="1" >
<a-card :bordered="false" v-if="selectedKeys.length>0"> <a-card :bordered="false" v-if="selectedKeys.length>0">
<a-form :form="form"> <a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="机构名称" prop="departName" >
:labelCol="labelCol" <a-input placeholder="请输入机构/部门名称" v-model="model.departName"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="机构名称"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门" prop="parentId">
<a-input placeholder="请输入机构/部门名称" v-decorator="['departName', validatorRules.departName ]"/> <a-tree-select style="width:100%" :dropdownStyle="{maxHeight:'200px',overflow:'auto'}" :treeData="treeData" :disabled="disable" v-model="model.parentId" placeholder="无">
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
<a-tree-select
style="width:100%"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
:treeData="treeData"
:disabled="disable"
v-model="model.parentId"
placeholder="无">
</a-tree-select> </a-tree-select>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="机构编码" prop="orgCode">
:labelCol="labelCol" <a-input disabled placeholder="请输入机构编码" v-model="model.orgCode"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="机构编码"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="机构类型" prop="orgCategory">
<a-input disabled placeholder="请输入机构编码" v-decorator="['orgCode', validatorRules.orgCode ]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构类型">
<template v-if="orgCategoryDisabled"> <template v-if="orgCategoryDisabled">
<a-radio-group v-decorator="['orgCategory',validatorRules.orgCategory]" placeholder="请选择机构类型"> <a-radio-group v-model="model.orgCategory" placeholder="请选择机构类型">
<a-radio value="1"> <a-radio value="1">
公司 公司
</a-radio> </a-radio>
</a-radio-group> </a-radio-group>
</template> </template>
<template v-else> <template v-else>
<a-radio-group v-decorator="['orgCategory',validatorRules.orgCategory]" placeholder="请选择机构类型"> <a-radio-group v-model="model.orgCategory" placeholder="请选择机构类型">
<a-radio value="2"> <a-radio value="2">
部门 部门
</a-radio> </a-radio>
...@@ -117,32 +103,20 @@ ...@@ -117,32 +103,20 @@
</a-radio> </a-radio>
</a-radio-group> </a-radio-group>
</template> </template>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="排序" prop="departOrder">
:labelCol="labelCol" <a-input-number v-model="model.departOrder"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="排序"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="手机号" prop="mobile">
<a-input-number v-decorator="[ 'departOrder',{'initialValue':0}]"/> <a-input placeholder="请输入手机号" v-model="model.mobile"/>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="地址" prop="address">
:labelCol="labelCol" <a-input placeholder="请输入地址" v-model="model.address"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="手机号"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="备注" prop="memo">
<a-input placeholder="请输入手机号" v-decorator="['mobile', {'initialValue':''}]"/> <a-textarea placeholder="请输入备注" v-model="model.memo"/>
</a-form-item> </a-form-model-item>
<a-form-item </a-form-model>
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="地址">
<a-input placeholder="请输入地址" v-decorator="['address', {'initialValue':''}]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="备注">
<a-textarea placeholder="请输入备注" v-decorator="['memo', {'initialValue':''}]"/>
</a-form-item>
</a-form>
<div class="anty-form-btn"> <div class="anty-form-btn">
<a-button @click="emptyCurrForm" type="default" htmlType="button" icon="sync">重置</a-button> <a-button @click="emptyCurrForm" type="default" htmlType="button" icon="sync">重置</a-button>
<a-button @click="submitCurrForm" type="primary" htmlType="button" icon="form">保存</a-button> <a-button @click="submitCurrForm" type="primary" htmlType="button" icon="form">保存</a-button>
...@@ -165,11 +139,12 @@ ...@@ -165,11 +139,12 @@
</template> </template>
<script> <script>
import DepartModal from './modules/DepartModal' import DepartModal from './modules/DepartModal'
import pick from 'lodash.pick' import { deleteByDepartId, queryDepartTreeSync, searchByKeywords } from '@/api/api'
import {queryDepartTreeSync, searchByKeywords, deleteByDepartId} from '@/api/api' import { deleteAction, httpAction } from '@/api/manage'
import {httpAction, deleteAction} from '@/api/manage' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import DepartAuthModal from './modules/DepartAuthModal' import DepartAuthModal from './modules/DepartAuthModal'
import { cloneObject } from '@/utils/util'
import JThirdAppButton from '@comp/jeecgbiz/thirdApp/JThirdAppButton'
// 表头 // 表头
const columns = [ const columns = [
{ {
...@@ -213,13 +188,14 @@ ...@@ -213,13 +188,14 @@
name: 'DepartList', name: 'DepartList',
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: { components: {
JThirdAppButton,
DepartAuthModal, DepartAuthModal,
DepartModal DepartModal
}, },
data() { data() {
return { return {
iExpandedKeys: [], iExpandedKeys: [],
loading: false, loading: true,
autoExpandParent: false, autoExpandParent: false,
currFlowId: '', currFlowId: '',
currFlowName: '', currFlowName: '',
...@@ -244,9 +220,8 @@ ...@@ -244,9 +220,8 @@
currSelected: {}, currSelected: {},
allTreeKeys:[], allTreeKeys:[],
loadTreeKeys:[],
checkStrictly: true, checkStrictly: true,
form: this.$form.createForm(this),
labelCol: { labelCol: {
xs: {span: 24}, xs: {span: 24},
sm: {span: 5} sm: {span: 5}
...@@ -260,10 +235,10 @@ ...@@ -260,10 +235,10 @@
edges: [] edges: []
}, },
validatorRules: { validatorRules: {
departName: {rules: [{required: true, message: '请输入机构/部门名称!'}]}, departName: [{required: true, message: '请输入机构/部门名称!'}],
orgCode: {rules: [{required: true, message: '请输入机构编码!'}]}, orgCode: [{required: true, message: '请输入机构编码!'}],
orgCategory: {rules: [{required: true, message: '请输入机构类型!'}]}, orgCategory: [{required: true, message: '请输入机构类型!'}],
mobile: {rules: [{validator: this.validateMobile}]} mobile: [{validator: this.validateMobile}]
}, },
url: { url: {
delete: '/sys/sysDepart/delete', delete: '/sys/sysDepart/delete',
...@@ -294,6 +269,10 @@ ...@@ -294,6 +269,10 @@
that.departTree = [] that.departTree = []
//所有的树节点key信息 //所有的树节点key信息
that.allIds = [] that.allIds = []
that.iExpandedKeys = []
that.loading = false
queryDepartTreeSync().then((res) => { queryDepartTreeSync().then((res) => {
if (res.success) { if (res.success) {
this.allTreeKeys = []; this.allTreeKeys = [];
...@@ -304,30 +283,38 @@ ...@@ -304,30 +283,38 @@
that.departTree.push(temp) that.departTree.push(temp)
that.allIds.push(temp.key) that.allIds.push(temp.key)
that.allTreeKeys.push(temp.key) that.allTreeKeys.push(temp.key)
if(that.loadTreeKeys.indexOf(temp.key)>=0){
that.iExpandedKeys.push(temp.key)
}
} }
this.loading = false that.$nextTick(()=>{
that.loading = true
})
} }
}) })
}, },
loadSubTree(treeNode) { loadSubTree(treeNode) {
var that = this; var that = this;
return new Promise(resolve => { return new Promise(resolve => {
queryDepartTreeSync({pid:treeNode.dataRef.id}).then((res) => { queryDepartTreeSync({pid:treeNode.dataRef.id}).then((res) => {
if (res.success) { if (res.success) {
//判断chidlren是否为空,并修改isLeaf属性值 //判断chidlren是否为空,并修改isLeaf属性值
if(res.result.length == 0){ if(res.result.length == 0){
treeNode.dataRef['isLeaf']=true treeNode.dataRef['isLeaf']=true
return; return;
}else{ }else{
treeNode.dataRef['children']= res.result; treeNode.dataRef['children']= res.result;
} }
for (let i = 0; i < res.result.length; i++) { for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i] let temp = res.result[i]
that.allIds.push(temp.key) that.allIds.push(temp.key)
if(that.loadTreeKeys.indexOf(temp.key)>0){
that.iExpandedKeys.push(temp.key)
} }
} }
}) }
resolve(); })
resolve();
}); });
//保存全部部门信息,方便后面搜索使用 //保存全部部门信息,方便后面搜索使用
that.departTreeAll=that.departTree that.departTreeAll=that.departTree
...@@ -340,8 +327,7 @@ ...@@ -340,8 +327,7 @@
rightHandle(node) { rightHandle(node) {
this.dropTrigger = 'contextmenu' this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey) console.log(node.node.eventKey)
//注释:异步书加载key拼接__,以便于每次展开节点会刷新数据 this.rightClickSelectedKey = node.node.eventKey
this.rightClickSelectedKey = node.node.eventKey.split('__')[0]
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
}, },
onExpand(expandedKeys) { onExpand(expandedKeys) {
...@@ -349,6 +335,7 @@ ...@@ -349,6 +335,7 @@
this.iExpandedKeys = expandedKeys this.iExpandedKeys = expandedKeys
this.autoExpandParent = false this.autoExpandParent = false
this.allTreeKeys=expandedKeys this.allTreeKeys=expandedKeys
this.loadTreeKeys=expandedKeys
}, },
backFlowList() { backFlowList() {
this.$router.back(-1) this.$router.back(-1)
...@@ -373,7 +360,7 @@ ...@@ -373,7 +360,7 @@
} else { } else {
var ids = '' var ids = ''
for (var a = 0; a < this.checkedKeys.length; a++) { for (var a = 0; a < this.checkedKeys.length; a++) {
ids += this.checkedKeys[a].split('__')[0] + ',' ids += this.checkedKeys[a]+ ','
} }
var that = this var that = this
this.$confirm({ this.$confirm({
...@@ -453,8 +440,7 @@ ...@@ -453,8 +440,7 @@
this.orgCategoryDisabled = false; this.orgCategoryDisabled = false;
} }
this.$nextTick(() => { this.$nextTick(() => {
this.form.getFieldDecorator('fax', {initialValue: ''}) this.model = cloneObject(record)
this.form.setFieldsValue(pick(record, 'departName','orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
}) })
}, },
getCurrSelectedTitle() { getCurrSelectedTitle() {
...@@ -464,7 +450,7 @@ ...@@ -464,7 +450,7 @@
this.hiding = true this.hiding = true
this.checkedKeys = [] this.checkedKeys = []
this.currSelected = {} this.currSelected = {}
this.form.resetFields() this.model = cloneObject(this.currSelected)
this.selectedKeys = [] this.selectedKeys = []
this.$refs.departAuth.departId = '' this.$refs.departAuth.departId = ''
}, },
...@@ -478,14 +464,14 @@ ...@@ -478,14 +464,14 @@
this.currSelected.receiptTriggerType = value this.currSelected.receiptTriggerType = value
}, },
submitCurrForm() { submitCurrForm() {
this.form.validateFields((err, values) => { this.$refs.form.validate((ok, err) => {
if (!err) { if (ok) {
if (!this.currSelected.id) { if (!this.currSelected.id) {
this.$message.warning('请点击选择要修改部门!') this.$message.warning('请点击选择要修改部门!')
return return
} }
let formData = Object.assign(this.currSelected, values) let formData = Object.assign(this.currSelected, this.model)
console.log('Received values of form: ', formData) console.log('Received values of form: ', formData)
httpAction(this.url.edit, formData, 'put').then((res) => { httpAction(this.url.edit, formData, 'put').then((res) => {
if (res.success) { if (res.success) {
...@@ -499,12 +485,12 @@ ...@@ -499,12 +485,12 @@
}) })
}, },
emptyCurrForm() { emptyCurrForm() {
this.form.resetFields() this.model = this.currSelected
}, },
nodeSettingFormSubmit() { nodeSettingFormSubmit() {
this.form.validateFields((err, values) => { this.$refs.form.validate((ok, err) => {
if (!err) { if (ok) {
console.log('Received values of form: ', values) console.log('Received values of form: ', this.model)
} }
}) })
}, },
...@@ -521,7 +507,7 @@ ...@@ -521,7 +507,7 @@
this.$message.warning('请先点击选中上级部门!') this.$message.warning('请先点击选中上级部门!')
return false return false
} }
this.$refs.departModal.add(this.selectedKeys[0].split('__')[0]) this.$refs.departModal.add(this.selectedKeys[0])
this.$refs.departModal.title = '新增' this.$refs.departModal.title = '新增'
} else { } else {
this.$refs.departModal.add(this.rightClickSelectedKey) this.$refs.departModal.add(this.rightClickSelectedKey)
...@@ -541,7 +527,7 @@ ...@@ -541,7 +527,7 @@
that.$message.success('删除成功!') that.$message.success('删除成功!')
that.loadTree() that.loadTree()
//删除后同步清空右侧基本信息内容 //删除后同步清空右侧基本信息内容
let orgCode=that.form.getFieldValue("orgCode"); let orgCode = that.model.orgCode
if(orgCode && orgCode === that.rightClickSelectedOrgCode){ if(orgCode && orgCode === that.rightClickSelectedOrgCode){
that.onClearSelected() that.onClearSelected()
} }
...@@ -576,6 +562,7 @@ ...@@ -576,6 +562,7 @@
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------> // <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
expandAll () { expandAll () {
this.iExpandedKeys = this.allTreeKeys this.iExpandedKeys = this.allTreeKeys
//this.loadTree()
}, },
closeAll () { closeAll () {
this.iExpandedKeys = [] this.iExpandedKeys = []
...@@ -604,9 +591,24 @@ ...@@ -604,9 +591,24 @@
this.getAllKeys(node.children[a]) this.getAllKeys(node.children[a])
} }
} }
} },
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------> // <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
// 验证手机号
validateMobile(rule,value,callback){
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)){
callback();
}else{
callback("您的手机号码格式不正确!");
}
},
onSyncFinally({isToLocal}) {
// 同步到本地时刷新下数据
if (isToLocal) {
this.loadData()
}
},
}, },
created() { created() {
this.currFlowId = this.$route.params.id this.currFlowId = this.$route.params.id
...@@ -616,6 +618,9 @@ ...@@ -616,6 +618,9 @@
} }
</script> </script>
<style scoped>
@import '~@assets/less/common.less';
</style>
<style scoped> <style scoped>
.ant-card-body .table-operator { .ant-card-body .table-operator {
margin: 15px; margin: 15px;
...@@ -661,10 +666,6 @@ ...@@ -661,10 +666,6 @@
} }
/** Button按钮间距 */ /** Button按钮间距 */
.ant-btn {
margin-left: 3px
}
.drawer-bootom-button { .drawer-bootom-button {
/*position: absolute;*/ /*position: absolute;*/
bottom: 0; bottom: 0;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<div style="margin-top: 24px;" v-else-if="userIdentity === '2' && departTree.length==0"> <div style="margin-top: 24px;" v-else-if="userIdentity === '2' && departTree.length==0">
<h3><span>您的部门下暂无有效部门信息</span></h3> <h3><span>您的部门下暂无有效部门信息</span></h3>
</div> </div>
<div style="margin-top: 24px;" v-else><h3>普通员工暂此权限</h3></div> <div style="margin-top: 24px;" v-else><h3>普通员工暂此权限</h3></div>
</div> </div>
</a-card> </a-card>
</a-col> </a-col>
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
<script> <script>
import DeptBaseInfo from './modules/DeptBaseInfo' import DeptBaseInfo from './modules/DeptBaseInfo'
import DeptUserInfo from './modules/DeptUserInfo' import DeptUserInfo from './modules/DeptUserInfo'
import {queryMyDepartTreeList, searchByKeywords} from '@/api/api' import { queryMyDepartTreeList, searchByKeywords } from '@/api/api'
import {JeecgListMixin} from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import DeptRoleInfo from './modules/DeptRoleInfo' import DeptRoleInfo from './modules/DeptRoleInfo'
export default { export default {
......
...@@ -3,22 +3,22 @@ ...@@ -3,22 +3,22 @@
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form-model layout="inline" :model="queryParam" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="6" :sm="10"> <a-col :md="6" :sm="10">
<a-form-item label="任务类名"> <a-form-model-item label="任务类名" prop="jobClassName">
<a-input placeholder="请输入任务类名" v-model="queryParam.jobClassName"></a-input> <a-input placeholder="请输入任务类名" v-model="queryParam.jobClassName"></a-input>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="6" :sm="10"> <a-col :md="6" :sm="10">
<a-form-item label="任务状态"> <a-form-model-item label="任务状态" prop="status">
<a-select style="width: 220px" v-model="queryParam.status" placeholder="请选择状态"> <a-select style="width: 220px" v-model="queryParam.status" placeholder="请选择状态">
<a-select-option value="">全部</a-select-option> <a-select-option value="">全部</a-select-option>
<a-select-option value="0">正常</a-select-option> <a-select-option value="0">正常</a-select-option>
<a-select-option value="-1">停止</a-select-option> <a-select-option value="-1">停止</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="6" :sm="10" > <a-col :md="6" :sm="10" >
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form-model>
</div> </div>
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
title:"确认暂停", title:"确认暂停",
content:"是否暂停选中任务?", content:"是否暂停选中任务?",
onOk: function(){ onOk: function(){
getAction(that.url.pause,{jobClassName:record.jobClassName}).then((res)=>{ getAction(that.url.pause,{id:record.id}).then((res)=>{
if(res.success){ if(res.success){
that.$message.success(res.message); that.$message.success(res.message);
that.loadData(); that.loadData();
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
title:"确认启动", title:"确认启动",
content:"是否启动选中任务?", content:"是否启动选中任务?",
onOk: function(){ onOk: function(){
getAction(that.url.resume,{jobClassName:record.jobClassName}).then((res)=>{ getAction(that.url.resume,{id:record.id}).then((res)=>{
if(res.success){ if(res.success){
that.$message.success(res.message); that.$message.success(res.message);
that.loadData(); that.loadData();
......
...@@ -102,6 +102,11 @@ ...@@ -102,6 +102,11 @@
<!-- 表单区域 --> <!-- 表单区域 -->
<sysAnnouncement-modal ref="modalForm" @ok="modalFormOk"></sysAnnouncement-modal> <sysAnnouncement-modal ref="modalForm" @ok="modalFormOk"></sysAnnouncement-modal>
<!-- 查看详情 -->
<j-modal class="detail-modal" title="查看详情" :visible.sync="detailModal.visible" :top="50" :width="600" switchFullscreen :footer="null">
<iframe v-if="detailModal.url" class="detail-iframe" :src="detailModal.url"/>
</j-modal>
</a-card> </a-card>
</template> </template>
...@@ -110,6 +115,7 @@ ...@@ -110,6 +115,7 @@
import {doReleaseData, doReovkeData} from '@/api/api' import {doReleaseData, doReovkeData} from '@/api/api'
import {getAction} from '@/api/manage' import {getAction} from '@/api/manage'
import {JeecgListMixin} from '@/mixins/JeecgListMixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default { export default {
name: "SysAnnouncementList", name: "SysAnnouncementList",
...@@ -237,6 +243,7 @@ ...@@ -237,6 +243,7 @@
scopedSlots: {customRender: 'action'}, scopedSlots: {customRender: 'action'},
} }
], ],
detailModal: {visible: false, url: '',},
url: { url: {
list: "/sys/annountCement/list", list: "/sys/annountCement/list",
delete: "/sys/annountCement/delete", delete: "/sys/annountCement/delete",
...@@ -284,14 +291,42 @@ ...@@ -284,14 +291,42 @@
getAction("sys/annountCement/syncNotic",{anntId:anntId}) getAction("sys/annountCement/syncNotic",{anntId:anntId})
}, },
handleDetail:function(record){ handleDetail:function(record){
this.$refs.modalForm.edit(record); const domain = window._CONFIG['domianURL']
this.$refs.modalForm.title="详情"; const token = this.$ls.get(ACCESS_TOKEN)
this.$refs.modalForm.disableSubmit = true; this.detailModal.url = `${domain}/sys/annountCement/show/${record.id}?token=${token}`
this.$refs.modalForm.disabled = true; this.detailModal.visible = true
}, },
} }
} }
</script> </script>
<style scoped> <style scoped lang="less">
@import '~@assets/less/common.less' @import '~@assets/less/common.less';
/** 查看详情弹窗的样式 */
.detail-modal {
.detail-iframe {
border: 0;
width: 100%;
height: 88vh;
min-height: 600px;
}
&.fullscreen .detail-iframe {
height: 100%;
}
}
.detail-modal /deep/ .ant-modal {
top: 30px;
.ant-modal-body {
font-size: 0;
padding: 0;
}
}
.detail-modal.fullscreen /deep/ .ant-modal {
top: 0;
}
</style> </style>
\ No newline at end of file
...@@ -3,18 +3,18 @@ ...@@ -3,18 +3,18 @@
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form-model layout="inline" :model="queryParam" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-item label="规则名称"> <a-form-model-item label="规则名称" prop="ruleName">
<a-input placeholder="请输入规则名称" v-model="queryParam.ruleName"/> <a-input placeholder="请输入规则名称" v-model="queryParam.ruleName"/>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-item label="规则Code"> <a-form-model-item label="规则Code" prop="ruleCode">
<a-input placeholder="请输入规则Code" v-model="queryParam.ruleCode"/> <a-input placeholder="请输入规则Code" v-model="queryParam.ruleCode"/>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<template v-if="toggleSearchStatus"> <template v-if="toggleSearchStatus">
</template> </template>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form-model>
</div> </div>
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
......
...@@ -3,17 +3,17 @@ ...@@ -3,17 +3,17 @@
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form-model layout="inline" :model="queryParam" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-item label="规则名称"> <a-form-model-item label="规则名称" prop="ruleName">
<a-input placeholder="请输入规则名称" v-model="queryParam.ruleName"></a-input> <a-input placeholder="请输入规则名称" v-model="queryParam.ruleName"></a-input>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<a-form-item label="规则Code"> <a-form-model-item label="规则Code" prop="ruleCode">
<a-input placeholder="请输入规则Code" v-model="queryParam.ruleCode"></a-input> <a-input placeholder="请输入规则Code" v-model="queryParam.ruleCode"></a-input>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form-model>
</div> </div>
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
......
...@@ -65,11 +65,12 @@ ...@@ -65,11 +65,12 @@
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator" style="border-top: 5px"> <div class="table-operator" style="border-top: 5px">
<a-button @click="handleAdd" type="primary" icon="plus">添加用户</a-button> <a-button @click="handleAdd" type="primary" icon="plus" >添加用户</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('用户信息')">导出</a-button> <a-button type="primary" icon="download" @click="handleExportXls('用户信息')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button> <a-button type="primary" icon="import">导入</a-button>
</a-upload> </a-upload>
<j-third-app-button biz-type="user" :selected-row-keys="selectedRowKeys" syncToApp syncToLocal @sync-finally="onSyncFinally"/>
<a-button type="primary" icon="hdd" @click="recycleBinVisible=true">回收站</a-button> <a-button type="primary" icon="hdd" @click="recycleBinVisible=true">回收站</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay" @click="handleMenuClick"> <a-menu slot="overlay" @click="handleMenuClick">
...@@ -120,9 +121,9 @@ ...@@ -120,9 +121,9 @@
</template> </template>
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)" >编辑</a>
<a-divider type="vertical"/> <a-divider type="vertical" />
<a-dropdown> <a-dropdown>
<a class="ant-dropdown-link"> <a class="ant-dropdown-link">
...@@ -154,6 +155,11 @@ ...@@ -154,6 +155,11 @@
<a>解冻</a> <a>解冻</a>
</a-popconfirm> </a-popconfirm>
</a-menu-item> </a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="handleAgentSettings(record.username)">代理人</a>
</a-menu-item>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
</span> </span>
...@@ -167,6 +173,8 @@ ...@@ -167,6 +173,8 @@
<password-modal ref="passwordmodal" @ok="passwordModalOk"></password-modal> <password-modal ref="passwordmodal" @ok="passwordModalOk"></password-modal>
<sys-user-agent-modal ref="sysUserAgentModal"></sys-user-agent-modal>
<!-- 用户回收站 --> <!-- 用户回收站 -->
<user-recycle-bin-modal :visible.sync="recycleBinVisible" @ok="modalFormOk"/> <user-recycle-bin-modal :visible.sync="recycleBinVisible" @ok="modalFormOk"/>
...@@ -179,14 +187,18 @@ ...@@ -179,14 +187,18 @@
import {putAction,getFileAccessHttpUrl} from '@/api/manage'; import {putAction,getFileAccessHttpUrl} from '@/api/manage';
import {frozenBatch} from '@/api/api' import {frozenBatch} from '@/api/api'
import {JeecgListMixin} from '@/mixins/JeecgListMixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import SysUserAgentModal from "./modules/SysUserAgentModal";
import JInput from '@/components/jeecg/JInput' import JInput from '@/components/jeecg/JInput'
import UserRecycleBinModal from './modules/UserRecycleBinModal' import UserRecycleBinModal from './modules/UserRecycleBinModal'
import JSuperQuery from '@/components/jeecg/JSuperQuery' import JSuperQuery from '@/components/jeecg/JSuperQuery'
import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton'
export default { export default {
name: "UserList", name: "UserList",
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: { components: {
JThirdAppButton,
SysUserAgentModal,
UserModal, UserModal,
PasswordModal, PasswordModal,
JInput, JInput,
...@@ -366,9 +378,19 @@ ...@@ -366,9 +378,19 @@
handleChangePassword(username) { handleChangePassword(username) {
this.$refs.passwordmodal.show(username); this.$refs.passwordmodal.show(username);
}, },
handleAgentSettings(username){
this.$refs.sysUserAgentModal.agentSettings(username);
this.$refs.sysUserAgentModal.title = "用户代理人设置";
},
passwordModalOk() { passwordModalOk() {
//TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下 //TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下
} },
onSyncFinally({isToLocal}) {
// 同步到本地时刷新下数据
if (isToLocal) {
this.loadData()
}
},
} }
} }
......
<template> <template>
<a-card class="j-address-list-right-card-box" :loading="cardLoading" :bordered="false"> <a-card class="j-address-list-right-card-box" :loading="cardLoading" :bordered="false">
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form-model layout="inline" :model="queryParam">
<a-row :gutter="10"> <a-row :gutter="10">
<a-col :md="6" :sm="12"> <a-col :md="6" :sm="12">
<a-form-item label="姓名" style="margin-left:8px"> <a-form-model-item label="姓名" prop="realname" style="margin-left:8px">
<a-input placeholder="请输入姓名查询" v-model="queryParam.realname"></a-input> <a-input placeholder="请输入姓名查询" v-model="queryParam.realname"></a-input>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<a-col :md="6" :sm="12"> <a-col :md="6" :sm="12">
<a-form-item label="工号" style="margin-left:8px"> <a-form-model-item label="工号" prop="workNo" style="margin-left:8px">
<a-input placeholder="请输入工号查询" v-model="queryParam.workNo"></a-input> <a-input placeholder="请输入工号查询" v-model="queryParam.workNo"></a-input>
</a-form-item> </a-form-model-item>
</a-col> </a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</a-col> </a-col>
</span> </span>
</a-row> </a-row>
</a-form> </a-form-model>
</div> </div>
<a-table <a-table
......
...@@ -109,7 +109,8 @@ ...@@ -109,7 +109,8 @@
visible: false, visible: false,
condition:true, condition:true,
disableSubmit:false, disableSubmit:false,
model: { model: {},
defaultModel:{
departOrder:0, departOrder:0,
orgCategory:'1' orgCategory:'1'
}, },
...@@ -165,6 +166,7 @@ ...@@ -165,6 +166,7 @@
}, },
edit (record) { edit (record) {
this.visible = true; this.visible = true;
this.model = Object.assign({}, this.defaultModel, record)
this.loadTreeData(); this.loadTreeData();
this.model.parentId = record!=null?record.toString():null; this.model.parentId = record!=null?record.toString():null;
if(this.seen){ if(this.seen){
......
<template> <template>
<a-card :visible="visible"> <a-card :visible="visible">
<a-form :form="form"> <a-form-model ref="form" :model="model">
<a-form-item <a-form-model-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
label="机构名称"> label="机构名称">
<a-input style="border:0px;" placeholder="" v-decorator="['departName', {}]"/> <a-input style="border:0;" placeholder="" v-model="model.departName"/>
</a-form-item> </a-form-model-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
<a-tree-select <a-tree-select
disabled disabled
style="width:100%;border: 0px;border: none;outline:none;" style="width:100%;border: 0;border: none;outline:none;"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}" :dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
:treeData="treeData" :treeData="treeData"
v-model="model.parentId" v-model="model.parentId"
placeholder="无"> placeholder="无">
</a-tree-select> </a-tree-select>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
label="机构编码"> label="机构编码">
<a-input style="border:0px;" placeholder="" v-decorator="['orgCode', {}]"/> <a-input style="border:0;" placeholder="" v-model="model.orgCode"/>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
label="机构类型"> label="机构类型">
<a-radio-group :disabled="true" v-decorator="['orgCategory',{}]" placeholder="请选择机构类型"> <a-radio-group :disabled="true" v-model="model.orgCategory" read-only>
<a-radio value="1"> <a-radio value="1">
公司 公司
</a-radio> </a-radio>
...@@ -38,37 +38,36 @@ ...@@ -38,37 +38,36 @@
岗位 岗位
</a-radio> </a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
label="排序"> label="排序">
<a-input-number style="border:0px;" v-decorator="[ 'departOrder',{}]"/> <a-input-number style="border:0;" v-model="model.departOrder"/>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
label="手机号"> label="手机号">
<a-input style="border:0px;" placeholder="" v-decorator="['mobile', {}]"/> <a-input style="border:0;" placeholder="" v-model="model.mobile"/>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
label="地址"> label="地址">
<a-input style="border:0px;" placeholder="" v-decorator="['address', {}]"/> <a-input style="border:0;" placeholder="" v-model="model.address"/>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item
:labelCol="labelCol" :labelCol="labelCol"
:wrapperCol="wrapperCol" :wrapperCol="wrapperCol"
label="备注"> label="备注">
<a-textarea style="border:0px;" placeholder="" v-decorator="['memo', {}]"/> <a-textarea style="border:0;" placeholder="" v-model="model.memo"/>
</a-form-item> </a-form-model-item>
</a-form> </a-form-model>
</a-card> </a-card>
</template> </template>
<script> <script>
import pick from 'lodash.pick' import { queryIdTree } from '@/api/api'
import {queryIdTree} from '@/api/api'
export default { export default {
name: 'DeptBaseInfo', name: 'DeptBaseInfo',
...@@ -81,7 +80,6 @@ ...@@ -81,7 +80,6 @@
visible: false, visible: false,
disable: true, disable: true,
treeData: [], treeData: [],
form: this.$form.createForm(this),
labelCol: { labelCol: {
xs: {span: 24}, xs: {span: 24},
sm: {span: 3} sm: {span: 3}
...@@ -108,17 +106,14 @@ ...@@ -108,17 +106,14 @@
}) })
}, },
open(record) { open(record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true; this.visible = true;
console.log("record:");
console.log(record);
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(record, 'orgCategory','departName', 'parentId', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo')); this.$refs.form.resetFields()
}); this.model = Object.assign({}, record)
})
}, },
clearForm() { clearForm() {
this.form.resetFields(); this.$refs.form.resetFields();
this.treeData = []; this.treeData = [];
}, },
} }
......
...@@ -10,60 +10,38 @@ ...@@ -10,60 +10,38 @@
cancelText="关闭"> cancelText="关闭">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="任务类名" prop="jobClassName" hasFeedback >
:labelCol="labelCol" <a-input placeholder="请输入任务类名" v-model="model.jobClassName" />
:wrapperCol="wrapperCol" </a-form-model-item>
label="任务类名" <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="Cron表达式" prop="cronExpression">
hasFeedback > <!-- <j-cron v-model="model.cronExpression"/>-->
<a-input placeholder="请输入任务类名" v-decorator="['jobClassName', {rules: [{ required: true, message: '请输入任务类名!' }]}]" /> <j-easy-cron v-model="model.cronExpression" />
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="参数" prop="parameter" >
:labelCol="labelCol" <a-textarea placeholder="请输入参数" :rows="5" v-model="model.parameter" />
:wrapperCol="wrapperCol" </a-form-model-item>
label="cron表达式"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="描述" prop="description">
<!-- <a-input placeholder="请输入cron表达式" v-decorator="['cronExpression', {'initialValue':'0/1 * * * * ?',rules: [{ required: true, message: '请输入任务类名!' }]}]" />--> <a-textarea placeholder="请输入描述" :rows="3" v-model="model.description" />
<!-- <a target="_blank" href="http://cron.qqe2.com/">--> </a-form-model-item>
<!-- <a-icon type="share-alt" />--> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="状态" prop="status">
<!-- 在线cron表达式生成--> <j-dict-select-tag type="radioButton" v-model="model.status" dictCode="quartz_status"/>
<!-- </a>--> </a-form-model-item>
<!-- <j-cron ref="innerVueCron" v-decorator="['cronExpression', {'initialValue':'0/1 * * * * ?',rules: [{ required: true, message: '请输入cron表达式!' }]}]" @change="setCorn"></j-cron>--> </a-form-model>
<j-cron ref="innerVueCron" v-decorator="['cronExpression', { initialValue: '* * * * * ? *' }]" @change="setCorn"></j-cron>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="参数">
<a-textarea placeholder="请输入参数" :rows="5" v-decorator="['parameter', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="描述">
<a-textarea placeholder="请输入描述" :rows="3" v-decorator="['description', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="状态">
<j-dict-select-tag type="radioButton" v-decorator="[ 'status', {'initialValue':0}]" :trigger-change="true" dictCode="quartz_status"/>
</a-form-item>
</a-form>
</a-spin> </a-spin>
</a-modal> </a-modal>
</template> </template>
<script> <script>
import { httpAction } from '@/api/manage' import { httpAction } from '@/api/manage'
import JCron from "@/components/jeecg/JCron"; // import JCron from "@/components/jeecg/JCron";
import pick from 'lodash.pick' import cronValidator from "@/components/jeecg/JEasyCron/validator";
// import moment from "moment"
export default { export default {
name: "QuartzJobModal", name: "QuartzJobModal",
components: { components: {
JCron // JCron,
}, },
data () { data () {
return { return {
...@@ -84,13 +62,12 @@ ...@@ -84,13 +62,12 @@
value: '' value: ''
}, },
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: { validatorRules: {
cron: { cronExpression: [
rules: [{ {required: true, message: '请输入cron表达式!'},
required: true, message: '请输入cron表达式!' {validator: cronValidator,}
}] ],
} jobClassName: [{required: true, message: '请输入任务类名!'}]
}, },
url: { url: {
add: "/sys/quartzJob/add", add: "/sys/quartzJob/add",
...@@ -101,19 +78,19 @@ ...@@ -101,19 +78,19 @@
created () { created () {
}, },
methods: { methods: {
add () { add() {
this.edit({}); // 统一设置默认值
this.edit({
cronExpression: '* * * * * ? *',
status: 0,
})
}, },
edit (record) { edit (record) {
let that = this;
that.form.resetFields();
this.model = Object.assign({},record);
console.log(this.model)
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'jobClassName','cronExpression','parameter','description','status')); this.$refs.form.resetFields()
}); this.model = Object.assign({}, record)
})
}, },
close () { close () {
this.$emit('close'); this.$emit('close');
...@@ -122,14 +99,8 @@ ...@@ -122,14 +99,8 @@
handleOk () { handleOk () {
const that = this; const that = this;
// 触发表单验证 // 触发表单验证
this.form.validateFields((err, values) => { this.$refs.form.validate((ok, err) => {
console.log('values',values) if (ok) {
if (!err) {
if (typeof values.cronExpression == "undefined" || Object.keys(values.cronExpression).length==0 ) {
this.$message.warning('请输入cron表达式!');
return false;
}
that.confirmLoading = true; that.confirmLoading = true;
let httpurl = ''; let httpurl = '';
let method = ''; let method = '';
...@@ -140,20 +111,18 @@ ...@@ -140,20 +111,18 @@
httpurl+=this.url.edit; httpurl+=this.url.edit;
method = 'put'; method = 'put';
} }
let formData = Object.assign(this.model, values);
//时间格式化
console.log('提交参数',formData) console.log('提交参数',this.model)
httpAction(httpurl,formData,method).then((res)=>{ httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){ if(res.success){
that.$message.success(res.message); that.$message.success(res.message);
that.$emit('ok'); that.$emit('ok');
that.close();
}else{ }else{
that.$message.warning(res.message); that.$message.warning(res.message);
} }
}).finally(() => { }).finally(() => {
that.confirmLoading = false; that.confirmLoading = false;
that.close();
}) })
} }
...@@ -162,24 +131,6 @@ ...@@ -162,24 +131,6 @@
handleCancel () { handleCancel () {
this.close() this.close()
}, },
setCorn(data){
console.log('data)',data);
this.$nextTick(() => {
this.model.cronExpression = data;
})
// console.log(Object.keys(data).length==0);
if (Object.keys(data).length==0) {
this.$message.warning('请输入cron表达式!');
}
},
validateCron(rule, value, callback){
if(!value){
callback()
}else if (Object.keys(value).length==0) {
callback("请输入cron表达式!");
}
},
} }
} }
......
...@@ -9,41 +9,24 @@ ...@@ -9,41 +9,24 @@
cancelText="关闭"> cancelText="关闭">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则名称" prop="ruleName" >
:labelCol="labelCol" <a-input placeholder="请输入规则名称" v-model="model.ruleName"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="规则名称"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则Code" prop="ruleCode">
<a-input placeholder="请输入规则名称" v-decorator="['ruleName', validatorRules.ruleName]"/> <a-input placeholder="请输入规则Code" v-model="model.ruleCode"/>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则描述" prop="ruleDescription">
:labelCol="labelCol" <a-textarea placeholder="请输入规则描述" v-model="model.ruleDescription"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="规则Code">
<a-input placeholder="请输入规则Code" v-decorator="['ruleCode', validatorRules.ruleCode]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="规则描述">
<a-textarea placeholder="请输入规则描述" v-decorator="['ruleDescription', {}]"/>
</a-form-item>
</a-form> </a-form-model>
<!-- 规则设计 --> <!-- 规则设计 -->
<a-tabs v-model="tabs.activeKey"> <a-tabs v-model="tabs.activeKey">
<a-tab-pane tab="局部规则" :key="tabs.design.key" forceRender> <a-tab-pane tab="局部规则" :key="tabs.design.key" forceRender>
<a-alert type="info" showIcon message="局部规则按照你输入的位数有序的校验。"/> <a-alert type="info" showIcon message="局部规则按照你输入的位数有序的校验。"/>
<j-editable-table <j-editable-table ref="designTable" dragSort rowNumber :maxHeight="240" :columns="tabs.design.columns" :dataSource="tabs.design.dataSource" style="margin-top: 8px;">
ref="designTable"
dragSort
rowNumber
:maxHeight="240"
:columns="tabs.design.columns"
:dataSource="tabs.design.dataSource"
style="margin-top: 8px;"
>
<template #action="props"> <template #action="props">
<my-action-button :rowEvent="props"/> <my-action-button :rowEvent="props"/>
...@@ -51,16 +34,9 @@ ...@@ -51,16 +34,9 @@
</j-editable-table> </j-editable-table>
</a-tab-pane> </a-tab-pane>
<a-tab-pane tab="全局规则" :key="tabs.global.key" forceRender> <a-tab-pane tab="全局规则" :key="tabs.global.key" forceRender>
<j-editable-table <j-editable-table ref="globalTable" dragSort rowNumber actionButton :maxHeight="240" :columns="tabs.global.columns" :dataSource="tabs.global.dataSource">
ref="globalTable"
dragSort
rowNumber
actionButton
:maxHeight="240"
:columns="tabs.global.columns"
:dataSource="tabs.global.dataSource"
>
<template #actionButtonAfter> <template #actionButtonAfter>
<a-alert type="info" showIcon message="全局规则可校验用户输入的所有字符;全局规则的优先级比局部规则的要高。" style="margin-bottom: 8px;"/> <a-alert type="info" showIcon message="全局规则可校验用户输入的所有字符;全局规则的优先级比局部规则的要高。" style="margin-bottom: 8px;"/>
...@@ -146,15 +122,12 @@ ...@@ -146,15 +122,12 @@
sm: { span: 16 }, sm: { span: 16 },
}, },
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: { validatorRules: {
ruleName: { rules: [{ required: true, message: '请输入规则名称!' },] }, ruleName: [{required: true, message: '请输入规则名称!'}],
ruleCode: { ruleCode: [
rules: [ {required: true, message: '请输入规则Code!'},
{ required: true, message: '请输入规则Code!' }, {validator: (rule, value, callback) => validateDuplicateValue('sys_check_rule', 'rule_code', value, this.model.id, callback)}
{ validator: (rule, value, callback) => validateDuplicateValue('sys_check_rule', 'rule_code', value, this.model.id, callback) } ],
]
},
}, },
tabs: { tabs: {
activeKey: 'design', activeKey: 'design',
...@@ -272,14 +245,14 @@ ...@@ -272,14 +245,14 @@
this.edit({}) this.edit({})
}, },
edit(record) { edit(record) {
this.form.resetFields()
this.tabs.activeKey = this.tabs.design.key this.tabs.activeKey = this.tabs.design.key
this.tabs.global.dataSource = [] this.tabs.global.dataSource = []
this.tabs.design.dataSource = [{ digits: '', pattern: '', message: '' }] this.tabs.design.dataSource = [{ digits: '', pattern: '', message: '' }]
this.model = Object.assign({}, record)
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'ruleName', 'ruleCode', 'ruleDescription')) this.$refs.form.resetFields()
this.model = Object.assign({}, record)
// 子表数据 // 子表数据
let ruleJson = this.model.ruleJson let ruleJson = this.model.ruleJson
if (ruleJson) { if (ruleJson) {
...@@ -307,7 +280,7 @@ ...@@ -307,7 +280,7 @@
Promise.all([ Promise.all([
// 主表单校验 // 主表单校验
alwaysResolve(new Promise((resolve, reject) => { alwaysResolve(new Promise((resolve, reject) => {
this.form.validateFields((error, values) => error ? reject(error) : resolve(values)) this.$refs.form.validate((ok, err) => ok ? resolve(this.model) : reject(err))
})), })),
// 局部规则子表校验 // 局部规则子表校验
alwaysResolve(this.$refs.designTable.getValuesPromise), alwaysResolve(this.$refs.designTable.getValuesPromise),
......
...@@ -10,40 +10,27 @@ ...@@ -10,40 +10,27 @@
cancelText="关闭"> cancelText="关闭">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则名称" prop="ruleName">
:labelCol="labelCol" <a-input placeholder="请输入规则名称" v-model="model.ruleName"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="规则名称"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则Code" prop="ruleCode" >
<a-input placeholder="请输入规则名称" v-decorator="['ruleName', validatorRules.ruleName]"/> <a-input placeholder="请输入规则Code" :disabled="disabledCode" v-model="model.ruleCode"/>
</a-form-item> </a-form-model-item>
<a-form-item <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则实现类" prop="ruleClass" >
:labelCol="labelCol" <a-input placeholder="请输入规则实现类" v-model="model.ruleClass"/>
:wrapperCol="wrapperCol" </a-form-model-item>
label="规则Code"> <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="规则参数" prop="ruleParams">
<a-input placeholder="请输入规则Code" :disabled="disabledCode" v-decorator="['ruleCode', validatorRules.ruleCode]"/> <a-textarea placeholder="请输入规则参数" :rows="5" v-model="model.ruleParams"/>
</a-form-item> </a-form-model-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="规则实现类">
<a-input placeholder="请输入规则实现类" v-decorator="['ruleClass', validatorRules.ruleClass]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="规则参数">
<a-textarea placeholder="请输入规则参数" :rows="5" v-decorator="['ruleParams', validatorRules.ruleParams]"/>
</a-form-item>
</a-form> </a-form-model>
</a-spin> </a-spin>
</a-modal> </a-modal>
</template> </template>
<script> <script>
import pick from 'lodash.pick'
import { httpAction } from '@/api/manage' import { httpAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util' import { validateDuplicateValue } from '@/utils/util'
...@@ -59,35 +46,30 @@ ...@@ -59,35 +46,30 @@
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } }, wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: { validatorRules: {
ruleName: { rules: [{ required: true, message: '规则名称不能为空' }] }, ruleName: [{ required: true, message: '规则名称不能为空' }],
ruleCode: { ruleCode: [
rules: [ { required: true, message: '规则Code不能为空' },
{ required: true, message: '规则Code不能为空' }, { validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) }
{ validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) } ],
] ruleClass: [{ required: true, message: '规则实现类不能为空' }],
}, ruleParams: [{
ruleClass: { rules: [{ required: true, message: '规则实现类不能为空' }] }, validator: (rule, value, callback) => {
ruleParams: {
rules: [{
validator: (rule, value, callback) => {
try { try {
let json = JSON.parse(value) let json = JSON.parse(value)
if (json instanceof Array) { if (json instanceof Array) {
callback('只能传递JSON对象,不能传递JSON数组') callback('只能传递JSON对象,不能传递JSON数组')
} else if (json instanceof Object) { } else if (json instanceof Object) {
callback() callback()
} else { } else {
callback('请输入JSON字符串')
}
} catch {
callback('请输入JSON字符串') callback('请输入JSON字符串')
} }
} catch {
callback('请输入JSON字符串')
} }
}] }
}, }],
}, },
url: { url: {
add: '/sys/fillRule/add', add: '/sys/fillRule/add',
...@@ -107,11 +89,10 @@ ...@@ -107,11 +89,10 @@
this.edit({}) this.edit({})
}, },
edit(record) { edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'ruleName', 'ruleCode', 'ruleClass', 'ruleParams')) this.$refs.form.resetFields()
this.model = Object.assign({}, record)
}) })
}, },
close() { close() {
...@@ -121,8 +102,8 @@ ...@@ -121,8 +102,8 @@
handleOk() { handleOk() {
const that = this const that = this
// 触发表单验证 // 触发表单验证
this.form.validateFields((err, values) => { this.$refs.form.validate((ok, err) => {
if (!err) { if (ok) {
that.confirmLoading = true that.confirmLoading = true
let httpUrl = this.url.add, method = 'post' let httpUrl = this.url.add, method = 'post'
if (this.model.id) { if (this.model.id) {
...@@ -130,17 +111,16 @@ ...@@ -130,17 +111,16 @@
method = 'put' method = 'put'
} }
let formData = Object.assign(this.model, values) httpAction(httpUrl, this.model, method).then((res) => {
httpAction(httpUrl, formData, method).then((res) => {
if (res.success) { if (res.success) {
that.$message.success(res.message) that.$message.success(res.message)
that.$emit('ok') that.$emit('ok')
that.close()
} else { } else {
that.$message.warning(res.message) that.$message.warning(res.message)
} }
}).finally(() => { }).finally(() => {
that.confirmLoading = false that.confirmLoading = false
that.close()
}) })
} }
}) })
......
...@@ -168,7 +168,7 @@ ...@@ -168,7 +168,7 @@
confirmpassword: [{required: true, message: '请重新输入登录密码!',}, confirmpassword: [{required: true, message: '请重新输入登录密码!',},
{ validator: this.compareToFirstPassword,}], { validator: this.compareToFirstPassword,}],
realname:[{ required: true, message: '请输入用户名称!' }], realname:[{ required: true, message: '请输入用户名称!' }],
phone: [{validator: this.validatePhone}], phone: [{required: true, message: '请输入手机号!'}, {validator: this.validatePhone}],
email: [{validator: this.validateEmail}], email: [{validator: this.validateEmail}],
roles:{}, roles:{},
workNo:[ { required: true, message: '请输入工号' }, workNo:[ { required: true, message: '请输入工号' },
......
<template> <template>
<div class="main"> <div class="main">
<a-form-model ref="form" :model="model" :rules="validatorRules" class="user-layout-login"> <a-form-model class="user-layout-login" @keyup.enter.native="handleSubmit">
<a-tabs :activeKey="customActiveKey" :tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }" @change="handleTabClick"> <a-tabs :activeKey="customActiveKey" :tabBarStyle="{ textAlign: 'center', borderBottom: 'unset' }" @change="handleTabClick">
<a-tab-pane key="tab1" tab="账号密码登录"> <a-tab-pane key="tab1" tab="账号密码登录">
<a-form-model-item required prop="username"> <login-account ref="alogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-account>
<a-input v-model="model.username" size="large" placeholder="请输入帐户名 / admin">
<a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
<a-form-model-item required prop="password">
<a-input v-model="model.password" size="large" type="password" autocomplete="false" placeholder="请输入密码 / 123456">
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
<a-row :gutter="0">
<a-col :span="16">
<a-form-model-item required prop="inputCode">
<a-input v-model="model.inputCode" size="large" type="text" placeholder="请输入验证码">
<a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
</a-col>
<a-col :span="8" style="text-align: right">
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
</a-col>
</a-row>
</a-tab-pane> </a-tab-pane>
<a-tab-pane key="tab2" tab="手机号登录"> <a-tab-pane key="tab2" tab="手机号登录">
<a-form-model-item required prop="mobile"> <login-phone ref="plogin" @validateFail="validateFail" @success="requestSuccess" @fail="requestFailed"></login-phone>
<a-input v-model="model.mobile" size="large" type="text" placeholder="请输入手机号">
<a-icon slot="prefix" type="mobile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
<a-row :gutter="16">
<a-col class="gutter-row" :span="16">
<a-form-model-item required prop="captcha">
<a-input v-model="model.captcha" size="large" type="text" placeholder="请输入验证码">
<a-icon slot="prefix" type="mail" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
</a-col>
<a-col class="gutter-row" :span="8">
<a-button
class="getCaptcha"
tabindex="-1"
:disabled="state.smsSendBtn"
@click.stop.prevent="getCaptcha"
v-text="!state.smsSendBtn && '获取验证码' || (state.time+' s')"></a-button>
</a-col>
</a-row>
</a-tab-pane> </a-tab-pane>
</a-tabs> </a-tabs>
<a-form-model-item> <a-form-model-item>
...@@ -67,73 +22,45 @@ ...@@ -67,73 +22,45 @@
</a-form-model-item> </a-form-model-item>
<a-form-item style="margin-top:24px"> <a-form-item style="margin-top:24px">
<a-button size="large" type="primary" htmlType="submit" class="login-button" :loading="loginBtn" @click.stop.prevent="handleSubmit" :disabled="loginBtn">确定</a-button> <a-button size="large" type="primary" htmlType="submit" class="login-button" :loading="loginBtn" @click.stop.prevent="handleSubmit" :disabled="loginBtn">确定
</a-button>
</a-form-item> </a-form-item>
</a-form-model> </a-form-model>
<two-step-captcha v-if="requiredTwoStepCaptcha" :visible="stepCaptchaVisible" @success="stepCaptchaSuccess" @cancel="stepCaptchaCancel"></two-step-captcha> <two-step-captcha v-if="requiredTwoStepCaptcha" :visible="stepCaptchaVisible" @success="stepCaptchaSuccess" @cancel="stepCaptchaCancel"></two-step-captcha>
<login-select-tenant ref="loginSelect" @success="loginSelectOk"></login-select-tenant> <login-select-tenant ref="loginSelect" @success="loginSelectOk"></login-select-tenant>
<third-login ref="thirdLogin"></third-login> <third-login ref="thirdLogin"></third-login>
</div> </div>
</template> </template>
<script> <script>
import { postAction, getAction } from '@/api/manage'
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN ,ENCRYPTED_STRING} from "@/store/mutation-types" import { ACCESS_TOKEN ,ENCRYPTED_STRING} from "@/store/mutation-types"
import { mapActions } from "vuex"
import ThirdLogin from './third/ThirdLogin' import ThirdLogin from './third/ThirdLogin'
import LoginSelectTenant from "./LoginSelectTenant" import LoginSelectTenant from "./LoginSelectTenant"
import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha' import TwoStepCaptcha from '@/components/tools/TwoStepCaptcha'
import { encryption , getEncryptedString } from '@/utils/encryption/aesEncrypt' import { encryption , getEncryptedString } from '@/utils/encryption/aesEncrypt'
import { timeFix } from "@/utils/util" import { timeFix } from "@/utils/util"
import LoginAccount from './LoginAccount'
import LoginPhone from './LoginPhone'
export default { export default {
components: { components: {
LoginSelectTenant, LoginSelectTenant,
TwoStepCaptcha, TwoStepCaptcha,
ThirdLogin ThirdLogin,
LoginAccount,
LoginPhone
}, },
data () { data () {
return { return {
model: {
username:'',
password:'',
inputCode: ''
},
loginType: 0,
validatorRules:{
username: [
{ required: true, message: '请输入用户名!' },
{ validator: this.handleUsernameOrEmail }
],
password: [{
required: true, message: '请输入密码!', validator: 'click'
}],
inputCode: [{
required: true, message: '请输入验证码!'
}],
mobile: [
{ required: true, message: '请输入手机号码!' },
{ validator: this.validateMobile }
],
captcha: [{
required: true, message: '请输入验证码!'
}]
},
customActiveKey: 'tab1', customActiveKey: 'tab1',
requestCodeSuccess: false, rememberMe: true,
randCodeImage: '',
currdatetime: '',
loginBtn: false, loginBtn: false,
requiredTwoStepCaptcha: false, requiredTwoStepCaptcha: false,
stepCaptchaVisible: false, stepCaptchaVisible: false,
//手机号登录用
state: {
time: 60,
smsSendBtn: false,
},
encryptedString:{ encryptedString:{
key:"", key:"",
iv:"", iv:"",
...@@ -141,133 +68,45 @@ ...@@ -141,133 +68,45 @@
} }
}, },
created() { created() {
this.currdatetime = new Date().getTime();
this.model.rememberMe = true
Vue.ls.remove(ACCESS_TOKEN) Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData(); this.getRouterData();
this.handleChangeCheckCode(); this.rememberMe = true
}, },
methods:{ methods:{
...mapActions(['Login', 'Logout', 'PhoneLogin']),
handleTabClick(key){ handleTabClick(key){
this.customActiveKey = key this.customActiveKey = key
}, },
handleUsernameOrEmail (rule, value, callback) { handleRememberMeChange(e){
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/; this.rememberMe = e.target.checked
if (regex.test(value)) {
this.loginType = 0
} else {
this.loginType = 1
}
callback()
},
/**刷新验证码*/
handleChangeCheckCode(){
this.currdatetime = new Date().getTime();
this.model.inputCode = ''
getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
if(res.success){
this.randCodeImage = res.result
this.requestCodeSuccess=true
}else{
this.$message.error(res.message)
this.requestCodeSuccess=false
}
}).catch(()=>{
this.requestCodeSuccess=false
})
}, },
/**跳转到登录页面的参数-账号获取*/ /**跳转到登录页面的参数-账号获取*/
getRouterData(){ getRouterData(){
this.$nextTick(() => { this.$nextTick(() => {
let temp = this.$route.params.username || this.$route.query.username || '' let temp = this.$route.params.username || this.$route.query.username || ''
if (temp) { if (temp) {
this.model['username'] = temp this.$refs.alogin.acceptUsername(temp)
} }
}) })
}, },
handleRememberMeChange(e){
this.model.rememberMe = e.target.checked
},
//登录 //登录
handleSubmit () { handleSubmit () {
let that = this this.loginBtn = true;
let loginParams = {}; if (this.customActiveKey === 'tab1') {
that.loginBtn = true; // 使用账户密码登录
// 使用账户密码登录 this.$refs.alogin.handleLogin(this.rememberMe)
if (that.customActiveKey === 'tab1') {
this.loginByUsername();
} else { } else {
this.loginByPhone() //手机号码登录
} this.$refs.plogin.handleLogin(this.rememberMe)
},
/**
* 验证字段
* @param arr
* @param callback
*/
validateFields(arr, callback){
let promiseArray = []
for(let item of arr){
let p = new Promise((resolve, reject) => {
this.$refs['form'].validateField(item, (err)=>{
if(!err){
resolve();
}else{
reject(err);
}
})
});
promiseArray.push(p)
} }
Promise.all(promiseArray).then(()=>{
callback()
}).catch(err=>{
callback(err)
})
}, },
//账号密码登录 // 校验失败
loginByUsername(){ validateFail(){
this.validateFields([ 'username', 'password', 'inputCode' ], (err)=>{ this.loginBtn = false;
if(!err){
let loginParams = {
username: this.model.username,
password: this.model.password,
remember_me: this.model.rememberMe,
captcha: this.model.inputCode,
checkKey: this.currdatetime
}
console.log("登录参数", loginParams)
this.Login(loginParams).then((res) => {
this.$refs.loginSelect.show(res.result)
}).catch((err) => {
this.requestFailed(err);
});
}else{
this.loginBtn = false;
}
})
}, },
//手机号码登录 // 登录后台成功
loginByPhone(){ requestSuccess(loginResult){
this.validateFields([ 'mobile', 'captcha' ], (err) => { this.$refs.loginSelect.show(loginResult)
if (!err) {
let loginParams = {
mobile: this.model.mobile,
captcha: this.model.captcha,
remember_me: this.model.rememberMe
}
console.log("登录参数", loginParams)
this.PhoneLogin(loginParams).then((res) => {
console.log(res.result);
this.$refs.loginSelect.show(res.result)
}).catch((err) => {
this.requestFailed(err);
})
}else{
this.loginBtn = false;
}
})
}, },
//登录后台失败 //登录后台失败
requestFailed (err) { requestFailed (err) {
...@@ -277,9 +116,9 @@ ...@@ -277,9 +116,9 @@
description: description, description: description,
duration: 4, duration: 4,
}); });
//密码错误后更新验证码 //账户密码登录错误后更新验证码
if(description.indexOf('密码错误')>0){ if(this.customActiveKey === 'tab1' && description.indexOf('密码错误')>0){
this.handleChangeCheckCode(); this.$refs.alogin.handleChangeCheckCode()
} }
this.loginBtn = false; this.loginBtn = false;
}, },
...@@ -296,59 +135,7 @@ ...@@ -296,59 +135,7 @@
description: `${timeFix()},欢迎回来`, description: `${timeFix()},欢迎回来`,
}); });
}, },
validateMobile(rule,value,callback){
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)){
callback();
}else{
callback("您的手机号码格式不正确!");
}
},
//获取验证码
getCaptcha (e) {
e.preventDefault();
let that = this;
that.validateFields([ 'mobile' ], (err) => {
if (!err) {
that.state.smsSendBtn = true;
let interval = window.setInterval(() => {
if (that.state.time-- <= 0) {
that.state.time = 60;
that.state.smsSendBtn = false;
window.clearInterval(interval);
}
}, 1000);
const hide = that.$message.loading('验证码发送中..', 0);
let smsParams = {};
smsParams.mobile=that.model.mobile;
smsParams.smsmode="0";
postAction("/sys/sms",smsParams)
.then(res => {
if(!res.success){
setTimeout(hide, 0);
that.cmsFailed(res.message);
}
console.log(res);
setTimeout(hide, 500);
})
.catch(err => {
setTimeout(hide, 1);
clearInterval(interval);
that.state.time = 60;
that.state.smsSendBtn = false;
that.requestFailed(err);
});
}
}
);
},
cmsFailed(err){
this.$notification[ 'error' ]({
message: '登录失败',
description:err,
duration: 4,
});
},
stepCaptchaSuccess () { stepCaptchaSuccess () {
this.loginSuccess() this.loginSuccess()
}, },
......
<template>
<div>
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-model-item required prop="username">
<a-input v-model="model.username" size="large" placeholder="请输入帐户名 / jeecg">
<a-icon slot="prefix" type="user" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
<a-form-model-item required prop="password">
<a-input v-model="model.password" size="large" type="password" autocomplete="false" placeholder="请输入密码 / 123456">
<a-icon slot="prefix" type="lock" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
<a-row :gutter="0">
<a-col :span="16">
<a-form-model-item required prop="inputCode">
<a-input v-model="model.inputCode" size="large" type="text" placeholder="请输入验证码">
<a-icon slot="prefix" type="smile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
</a-col>
<a-col :span="8" style="text-align: right">
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
</a-col>
</a-row>
</a-form-model>
</div>
</template>
<script>
import { getAction } from '@/api/manage'
import Vue from 'vue'
import { mapActions } from 'vuex'
export default {
name: 'LoginAccount',
data(){
return {
requestCodeSuccess: false,
randCodeImage: '',
currdatetime: '',
loginType: 0,
model:{
username: '',
password: '',
inputCode: ''
},
validatorRules:{
username: [
{ required: true, message: '请输入用户名!' },
{ validator: this.handleUsernameOrEmail }
],
password: [{
required: true, message: '请输入密码!', validator: 'click'
}],
inputCode: [{
required: true, message: '请输入验证码!'
}]
}
}
},
created() {
this.handleChangeCheckCode();
},
methods:{
...mapActions(['Login']),
/**刷新验证码*/
handleChangeCheckCode(){
this.currdatetime = new Date().getTime();
this.model.inputCode = ''
getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
if(res.success){
this.randCodeImage = res.result
this.requestCodeSuccess=true
}else{
this.$message.error(res.message)
this.requestCodeSuccess=false
}
}).catch(()=>{
this.requestCodeSuccess=false
})
},
// 判断登录类型
handleUsernameOrEmail (rule, value, callback) {
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
if (regex.test(value)) {
this.loginType = 0
} else {
this.loginType = 1
}
callback()
},
/**
* 验证字段
* @param arr
* @param callback
*/
validateFields(arr, callback){
let promiseArray = []
for(let item of arr){
let p = new Promise((resolve, reject) => {
this.$refs['form'].validateField(item, (err)=>{
if(!err){
resolve();
}else{
reject(err);
}
})
});
promiseArray.push(p)
}
Promise.all(promiseArray).then(()=>{
callback()
}).catch(err=>{
callback(err)
})
},
acceptUsername(username){
this.model['username'] = username
},
//账号密码登录
handleLogin(rememberMe){
this.validateFields([ 'username', 'password', 'inputCode' ], (err)=>{
if(!err){
let loginParams = {
username: this.model.username,
password: this.model.password,
captcha: this.model.inputCode,
checkKey: this.currdatetime,
remember_me: rememberMe,
}
console.log("登录参数", loginParams)
this.Login(loginParams).then((res) => {
this.$emit('success', res.result)
}).catch((err) => {
this.$emit('fail', err)
});
}else{
this.$emit('validateFail')
}
})
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<div>
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-model-item required prop="mobile">
<a-input v-model="model.mobile" size="large" type="text" placeholder="请输入手机号">
<a-icon slot="prefix" type="mobile" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
<a-row :gutter="16">
<a-col class="gutter-row" :span="16">
<a-form-model-item required prop="captcha">
<a-input v-model="model.captcha" size="large" type="text" placeholder="请输入验证码">
<a-icon slot="prefix" type="mail" :style="{ color: 'rgba(0,0,0,.25)' }"/>
</a-input>
</a-form-model-item>
</a-col>
<a-col class="gutter-row" :span="8">
<a-button
class="getCaptcha"
tabindex="-1"
:disabled="state.smsSendBtn"
@click.stop.prevent="getCaptcha"
v-text="!state.smsSendBtn && '获取验证码' || (state.time+' s')"></a-button>
</a-col>
</a-row>
</a-form-model>
</div>
</template>
<script>
import { postAction } from '@/api/manage'
import { mapActions } from 'vuex'
export default {
name: 'LoginPhone',
data(){
return {
model:{
mobile: '',
captcha: ''
},
//手机号登录用
state: {
time: 60,
smsSendBtn: false,
},
validatorRules:{
mobile: [
{ required: true, message: '请输入手机号码!' },
{ validator: this.validateMobile }
],
captcha: [{
required: true, message: '请输入验证码!'
}]
}
}
},
methods:{
...mapActions(['PhoneLogin']),
handleLogin(rememberMe){
this.validateFields([ 'mobile', 'captcha' ], (err) => {
if (!err) {
let loginParams = {
mobile: this.model.mobile,
captcha: this.model.captcha,
remember_me: rememberMe
}
console.log("登录参数", loginParams)
this.PhoneLogin(loginParams).then((res) => {
this.$emit('success', res.result)
}).catch((err) => {
this.$emit('fail', err)
});
}else{
this.$emit('validateFail')
}
})
},
// 校验手机号
validateMobile(rule,value,callback){
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)){
callback();
}else{
callback("您的手机号码格式不正确!");
}
},
//获取验证码
getCaptcha (e) {
e.preventDefault();
let that = this;
that.validateFields([ 'mobile' ], (err) => {
if (!err) {
that.state.smsSendBtn = true;
let interval = window.setInterval(() => {
if (that.state.time-- <= 0) {
that.state.time = 60;
that.state.smsSendBtn = false;
window.clearInterval(interval);
}
}, 1000);
const hide = that.$message.loading('验证码发送中..', 0);
let smsParams = {};
smsParams.mobile=that.model.mobile;
smsParams.smsmode="0";
postAction("/sys/sms",smsParams)
.then(res => {
if(!res.success){
setTimeout(hide, 0);
that.cmsFailed(res.message);
}
console.log(res);
setTimeout(hide, 500);
})
.catch(err => {
setTimeout(hide, 1);
clearInterval(interval);
that.state.time = 60;
that.state.smsSendBtn = false;
that.requestFailed(err);
});
}
}
);
},
cmsFailed(err){
this.$notification[ 'error' ]({
message: '获取验证码失败',
description:err,
duration: 4,
});
},
/**
* 验证字段
* @param arr
* @param callback
*/
validateFields(arr, callback){
let promiseArray = []
for(let item of arr){
let p = new Promise((resolve, reject) => {
this.$refs['form'].validateField(item, (err)=>{
if(!err){
resolve();
}else{
reject(err);
}
})
});
promiseArray.push(p)
}
Promise.all(promiseArray).then(()=>{
callback()
}).catch(err=>{
callback(err)
})
},
}
}
</script>
<style scoped>
.getCaptcha{
display: block;
width: 100%;
height: 40px;
}
</style>
\ No newline at end of file
...@@ -148,7 +148,7 @@ export const JeecgThirdLoginMixin = { ...@@ -148,7 +148,7 @@ export const JeecgThirdLoginMixin = {
const hide = this.$message.loading('验证码发送中..', 0) const hide = this.$message.loading('验证码发送中..', 0)
let smsParams = {} let smsParams = {}
smsParams.mobile = this.thirdPhone smsParams.mobile = this.thirdPhone
smsParams.smsmode = '1' smsParams.smsmode = '0'
postAction('/sys/sms', smsParams).then(res => { postAction('/sys/sms', smsParams).then(res => {
if (!res.success) { if (!res.success) {
setTimeout(hide, 0) setTimeout(hide, 0)
......
...@@ -888,10 +888,10 @@ ...@@ -888,10 +888,10 @@
cssnano-preset-default "^4.0.0" cssnano-preset-default "^4.0.0"
postcss "^7.0.0" postcss "^7.0.0"
"@jeecg/antd-online-mini@2.4.3-RC": "@jeecg/antd-online-mini@2.4.5-RC":
version "2.4.3-RC" version "2.4.5-RC"
resolved "https://registry.npmjs.org/@jeecg/antd-online-mini/-/antd-online-mini-2.4.3-RC.tgz#573f07254b63ffa7549df9dfc23cc8647734c275" resolved "https://registry.npmjs.org/@jeecg/antd-online-mini/-/antd-online-mini-2.4.5-RC.tgz#88740572f352a8baae694a83305f289b54e603c4"
integrity sha512-U/0W++7Og6SmqKqnDc0VFLDeEYmXCH4bMN+tUtAVLqwTxyln12cBSD7zD5zja1dWOxyrvt6pYC5cnGpH7CUVVQ== integrity sha512-2Wxj7wr+j3YGU5W1NtOWGM/qv1bd28UVBAxMCIZ/vY12w8+qnaNK9IKri6oJmqYiB40UA9EUqsxE9iMlRfv3Ww==
"@mrmlnc/readdir-enhanced@^2.2.1": "@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1" version "2.2.1"
...@@ -1659,9 +1659,9 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: ...@@ -1659,9 +1659,9 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
color-convert "^2.0.1" color-convert "^2.0.1"
ant-design-vue@^1.7.2: ant-design-vue@^1.7.2:
version "1.7.4" version "1.7.5"
resolved "https://registry.npmjs.org/ant-design-vue/-/ant-design-vue-1.7.4.tgz#854e90985dc0fa9ccc6d681c104560c00eaaf855" resolved "https://registry.npmjs.org/ant-design-vue/-/ant-design-vue-1.7.5.tgz#e7ed04cb358adc56be02c7453d2db026d2c405e3"
integrity sha512-f9/4I34Yq562X70aspSFzw4BCuKRICzDvIocXpsYCC+B9+kjB8db246fpSMtV/1anqxcmGHf7Vh0XJ+ovHJKMw== integrity sha512-QVrirCz6eetzui+Dv/ujMqUwIr8e/2H+pKr4VC3mpc+cHkw6L9cBRJK7DhfO7GTyK4EWKkEH3lfLWlD/XjUoQQ==
dependencies: dependencies:
"@ant-design/icons" "^2.1.1" "@ant-design/icons" "^2.1.1"
"@ant-design/icons-vue" "^2.0.0" "@ant-design/icons-vue" "^2.0.0"
...@@ -2895,6 +2895,14 @@ cache-loader@^2.0.1: ...@@ -2895,6 +2895,14 @@ cache-loader@^2.0.1:
normalize-path "^3.0.0" normalize-path "^3.0.0"
schema-utils "^1.0.0" schema-utils "^1.0.0"
call-bind@^1.0.0:
version "1.0.2"
resolved "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c"
integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==
dependencies:
function-bind "^1.1.1"
get-intrinsic "^1.0.2"
call-me-maybe@^1.0.1: call-me-maybe@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b" resolved "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz#26d208ea89e37b5cbde60250a15f031c16a4d66b"
...@@ -3660,6 +3668,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: ...@@ -3660,6 +3668,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
safe-buffer "^5.0.1" safe-buffer "^5.0.1"
sha.js "^2.4.8" sha.js "^2.4.8"
cron-parser@^2.10.0:
version "2.18.0"
resolved "https://registry.npmjs.org/cron-parser/-/cron-parser-2.18.0.tgz#de1bb0ad528c815548371993f81a54e5a089edcf"
integrity sha512-s4odpheTyydAbTBQepsqd2rNWGa2iV3cyo8g7zbI2QQYGLVsfbhmwukayS1XHppe02Oy1fg7mg6xoaraVJeEcg==
dependencies:
is-nan "^1.3.0"
moment-timezone "^0.5.31"
cross-env@^5.0.5: cross-env@^5.0.5:
version "5.2.1" version "5.2.1"
resolved "https://registry.npmjs.org/cross-env/-/cross-env-5.2.1.tgz#b2c76c1ca7add66dc874d11798466094f551b34d" resolved "https://registry.npmjs.org/cross-env/-/cross-env-5.2.1.tgz#b2c76c1ca7add66dc874d11798466094f551b34d"
...@@ -5678,6 +5694,15 @@ get-caller-file@^2.0.1: ...@@ -5678,6 +5694,15 @@ get-caller-file@^2.0.1:
resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
get-intrinsic@^1.0.2:
version "1.1.1"
resolved "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6"
integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==
dependencies:
function-bind "^1.1.1"
has "^1.0.3"
has-symbols "^1.0.1"
get-stdin@^4.0.1: get-stdin@^4.0.1:
version "4.0.1" version "4.0.1"
resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe"
...@@ -6591,6 +6616,14 @@ is-mobile@^2.2.1: ...@@ -6591,6 +6616,14 @@ is-mobile@^2.2.1:
resolved "https://registry.npmjs.org/is-mobile/-/is-mobile-2.2.2.tgz#f6c9c5d50ee01254ce05e739bdd835f1ed4e9954" resolved "https://registry.npmjs.org/is-mobile/-/is-mobile-2.2.2.tgz#f6c9c5d50ee01254ce05e739bdd835f1ed4e9954"
integrity sha512-wW/SXnYJkTjs++tVK5b6kVITZpAZPtUrt9SF80vvxGiF/Oywal+COk1jlRkiVq15RFNEQKQY31TkV24/1T5cVg== integrity sha512-wW/SXnYJkTjs++tVK5b6kVITZpAZPtUrt9SF80vvxGiF/Oywal+COk1jlRkiVq15RFNEQKQY31TkV24/1T5cVg==
is-nan@^1.3.0:
version "1.3.2"
resolved "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz#043a54adea31748b55b6cd4e09aadafa69bd9e1d"
integrity sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==
dependencies:
call-bind "^1.0.0"
define-properties "^1.1.3"
is-negative-zero@^2.0.0: is-negative-zero@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz#9553b121b0fac28869da9ed459e20c7543788461" resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz#9553b121b0fac28869da9ed459e20c7543788461"
...@@ -7637,6 +7670,18 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.0, mkdirp@~0.5.1: ...@@ -7637,6 +7670,18 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@~0.5.0, mkdirp@~0.5.1:
dependencies: dependencies:
minimist "^1.2.5" minimist "^1.2.5"
moment-timezone@^0.5.31:
version "0.5.33"
resolved "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.33.tgz#b252fd6bb57f341c9b59a5ab61a8e51a73bbd22c"
integrity sha512-PTc2vcT8K9J5/9rDEPe5czSIKgLoGsH8UNpA4qZTVw0Vd/Uz19geE9abbIOQKaAQFcnQ3v5YEXrbSc5BpshH+w==
dependencies:
moment ">= 2.9.0"
"moment@>= 2.9.0":
version "2.29.1"
resolved "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3"
integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==
moment@^2.21.0: moment@^2.21.0:
version "2.27.0" version "2.27.0"
resolved "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz#8bff4e3e26a236220dfe3e36de756b6ebaa0105d" resolved "https://registry.npmjs.org/moment/-/moment-2.27.0.tgz#8bff4e3e26a236220dfe3e36de756b6ebaa0105d"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册