Jeecg-Boot 2.1.2版本发布

This commit is contained in:
zhangdaihao
2019-11-21 18:17:25 +08:00
parent f0d372d008
commit 283be0480e
84 changed files with 2284 additions and 33459 deletions

View File

@ -31,6 +31,11 @@
type: Array,
default: () => ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'Jul.', 'Aug.']
},
// 别名,需要的格式:[{field:'name',alias:'姓名'}, {field:'sex',alias:'性别'}]
aliases:{
type: Array,
default: () => []
},
height: {
type: Number,
default: 254
@ -55,13 +60,22 @@
})
// bar 使用不了 - 和 / 所以替换下
return dv.rows.map(row => {
let rows = dv.rows.map(row => {
if (typeof row.x === 'string') {
row.x = row.x.replace(/[-/]/g, '_')
}
return row
})
// 替换别名
rows.forEach(row => {
for (let item of this.aliases) {
if (item.field === row.type) {
row.type = item.alias
break
}
}
})
return rows
}
}
}

View File

@ -42,6 +42,11 @@
type: Array,
default: () => ['jeecg', 'jeebt']
},
// 别名,需要的格式:[{field:'name',alias:'姓名'}, {field:'sex',alias:'性别'}]
aliases:{
type: Array,
default: () => []
},
height: {
type: Number,
default: 254
@ -66,7 +71,17 @@
key: 'x',
value: 'y'
})
return dv.rows
let rows = dv.rows
// 替换别名
rows.forEach(row => {
for (let item of this.aliases) {
if (item.field === row.x) {
row.x = item.alias
break
}
}
})
return rows
}
}
}

View File

@ -28,13 +28,16 @@ export async function initDictOptions(dictCode) {
* @return String
*/
export function filterDictText(dictOptions, text) {
let re = "";
dictOptions.forEach(function (option) {
if (text === option.value) {
re = option.text;
//--update-begin----author:sunjianlei---date:20191025------for:修复字典替换方法在字典没有加载完成之前报错的问题、修复没有找到字典时返回空值的问题---
if (dictOptions instanceof Array) {
for (let dictItem of dictOptions) {
if (text === dictItem.value) {
return dictItem.text
}
}
});
return re;
}
return text
//--update-end----author:sunjianlei---date:20191025------for:修复字典替换方法在字典没有加载完成之前报错的问题、修复没有找到字典时返回空值的问题---
}
/**
@ -58,7 +61,7 @@ export function filterMultiDictText(dictOptions, text) {
}
});
if(re==""){
return "";
return text;
}
return re.substring(0,re.length-1);
}

View File

@ -181,6 +181,7 @@
:options="col.options"
:getPopupContainer="getParentContainer"
:placeholder="replaceProps(col, col.placeholder)"
:filterOption="(i,o)=>handleSelectFilterOption(i,o,col)"
@change="(v)=>handleChangeSelectCommon(v,id,row,col)"
@search="(v)=>handleSearchSelect(v,id,row,col)"
@blur="(v)=>handleBlurSearch(v,id,row,col)"
@ -514,7 +515,7 @@
</div>
<!-- else (normal) -->
<span v-else :key="i" v-bind="buildProps(row,col)" >{{ inputValues[rowIndex][col.key] }}</span>
<span v-else :key="i" v-bind="buildProps(row,col)">{{ inputValues[rowIndex][col.key] }}</span>
</template>
</div>
</div>
@ -657,17 +658,6 @@
created() {
// 当前显示的tr
this.visibleTrEls = []
// 用来存储input表单的值
// 数组里的每项都是一个对象对象里每个key都是input的rowKey值就是input的值其中有个id的字段来区分
// 示例:
// [{
// id: "_jet-4sp0iu-15541771111770"
// dbDefaultVal: "aaa",
// dbFieldName: "bbb",
// dbFieldTxt: "ccc",
// dbLength: 32
// }]
this.inputValues = []
this.disabledRowIds = (this.disabledRowIds || [])
},
// 计算属性
@ -827,15 +817,18 @@
for (let columnKey in this.disabledRows) {
// 判断是否有该属性
if (this.disabledRows.hasOwnProperty(columnKey) && data.hasOwnProperty(columnKey)) {
// row[columnKey] =
if (disabled !== true) {
disabled = this.disabledRows[columnKey] === data[columnKey]
let temp = this.disabledRows[columnKey]
// 禁用规则可以是一个数组
if (temp instanceof Array) {
disabled = temp.includes(data[columnKey])
} else {
disabled = (temp === data[columnKey])
}
if (disabled) {
disabledRowIds.push(row.id)
}
}
}
}
})
@ -870,9 +863,9 @@
column.options = column.options.map(item => {
if (item) {
return {
...item,
text: item.text || item.title,
title: item.text || item.title,
value: item.value
title: item.text || item.title
}
}
return {}
@ -925,10 +918,20 @@
/** 初始化列表 */
initialize() {
// inputValues用来存储input表单的值
// 数组里的每项都是一个对象对象里每个key都是input的rowKey值就是input的值其中有个id的字段来区分
// 示例:
// [{
// id: "_jet-4sp0iu-15541771111770"
// dbDefaultVal: "aaa",
// dbFieldName: "bbb",
// dbFieldTxt: "ccc",
// dbLength: 32
// }]
this.inputValues = []
this.visibleTrEls = []
this.rows = []
this.deleteIds = []
this.inputValues = []
this.selectValues = {}
this.checkboxValues = {}
this.jdateValues = {}
@ -1094,16 +1097,17 @@
}
this.rows = rows
let rowValue = this.getValuesSync({
validate: false,
rowIds: [this.removeCaseId(row.id)]
}).values[0]
this.$nextTick(() => {
this.updateFormValues()
})
// 触发add事件
this.$emit('added', {
row: (() => {
let r = Object.assign({}, row)
r.id = this.removeCaseId(r.id)
return r
})(),
row: rowValue,
target: this
})
// 设置滚动条位置
@ -1600,9 +1604,16 @@
clearSelection() {
this.selectedRowIds = []
},
/** 用于搜索下拉框中的内容 */
handleSelectFilterOption(input, option, column) {
if (column.allowSearch === true) {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
return true
},
/** select 搜索时的事件用于动态添加options */
handleSearchSelect(value, id, row, col) {
if (col.allowInput === true) {
if (col.allowSearch !== true && col.allowInput === true) {
// 是否找到了对应的项,找不到则添加这一项
let flag = false
for (let option of col.options) {
@ -1941,7 +1952,7 @@
}
}
// 判断select是否允许输入
if (col.type === FormTypes.select && col.allowInput === true) {
if (col.type === FormTypes.select && (col.allowInput === true || col.allowSearch === true)) {
props['showSearch'] = true
}
@ -2022,7 +2033,6 @@
this.elemValueChange(FormTypes.list_multi, row, column, value)
},
handleSearchSelectChange(value, id, row, column) {
console.log(value)
this.searchSelectValues = this.bindValuesChange(value, id, 'searchSelectValues')
this.validateOneInput(value, row, column, this.notPassedIds, true, 'change')
this.elemValueChange(FormTypes.sel_search, row, column, value)

View File

@ -61,6 +61,7 @@
toolbar: this.toolbar,
branding: false,
menubar: false,
toolbar_drawer: false,
images_upload_handler: (blobInfo, success) => {
const img = 'data:image/jpeg;base64,' + blobInfo.base64()
success(img)

View File

@ -63,7 +63,33 @@
</a-col>
<a-col :span="8">
<j-dict-select-tag v-if="item.dictCode" v-model="item.val" :dictCode="item.dictCode" placeholder="请选择"/>
<template v-if="item.dictCode">
<template v-if="item.type === 'table-dict'">
<j-popup
v-model="item.val"
:code="item.dictTable"
:field="item.dictCode"
:orgFields="item.dictCode"
:destFields="item.dictCode"
></j-popup>
</template>
<j-dict-select-tag v-else v-model="item.val" :dictCode="item.dictCode" placeholder="请选择"/>
</template>
<j-select-multi-user
v-else-if="item.type === 'select-user'"
v-model="item.val"
:buttons="false"
:multiple="false"
placeholder="请选择用户"
:returnKeys="['id', item.customReturnField || 'username']"
/>
<j-select-depart
v-else-if="item.type === 'select-depart'"
v-model="item.val"
:multi="false"
placeholder="请选择部门"
:customReturnField="item.customReturnField || 'id'"
/>
<j-date v-else-if=" item.type=='date' " v-model="item.val" placeholder="请选择日期" style="width: 100%"></j-date>
<j-date v-else-if=" item.type=='datetime' " v-model="item.val" placeholder="请选择时间" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"></j-date>
<a-input-number v-else-if=" item.type=='int'||item.type=='number' " style="width: 100%" placeholder="请输入数值" v-model="item.val"/>
@ -86,7 +112,10 @@
<div slot="title">
保存的查询
</div>
<a-empty v-if="treeData.length === 0" class="j-super-query-history-empty" description="没有保存任何查询"/>
<a-tree
v-else
class="j-super-query-history-tree"
showIcon
:treeData="treeData"
@ -113,10 +142,12 @@
<script>
import * as utils from '@/utils/util'
import JDate from '@/components/jeecg/JDate.vue'
import JSelectDepart from '@/components/jeecgbiz/JSelectDepart'
import JSelectMultiUser from '@/components/jeecgbiz/JSelectMultiUser'
export default {
name: 'JSuperQuery',
components: { JDate },
components: { JDate, JSelectDepart, JSelectMultiUser },
props: {
/*
fieldList: [{
@ -182,7 +213,6 @@
return item
})
}
console.log({ list })
}
}
},
@ -222,9 +252,12 @@
handleSelected(option, item) {
let index = option.data.attrs['data-idx']
let { type, dictCode } = this.fieldList[index]
let { type, dictCode, dictTable, customReturnField } = this.fieldList[index]
item['type'] = type
item['dictCode'] = dictCode
item['dictTable'] = dictTable
item['customReturnField'] = customReturnField
this.$set(item, 'val', '')
},
handleReset() {
this.queryParamsModel = [{}]
@ -338,6 +371,24 @@
}
}
.j-super-query-history-empty /deep/ {
.ant-empty-image {
height: 80px;
line-height: 80px;
margin-bottom: 0;
}
img {
width: 80px;
height: 65px;
}
.ant-empty-description {
color: #afafaf;
margin: 8px 0;
}
}
.j-super-query-history-tree /deep/ {
.ant-tree-switcher {
display: none;

View File

@ -1,6 +1,6 @@
<template>
<a-row class="j-select-biz-component-box" type="flex" :gutter="8">
<a-col class="left">
<a-col class="left" :class="{'full': !buttons}">
<a-select
mode="multiple"
:placeholder="placeholder"
@ -10,10 +10,11 @@
:disabled="disabled"
:open="false"
style="width: 100%;"
@click.native="visible=(buttons?visible:true)"
/>
</a-col>
<a-col class="right">
<a-col v-if="buttons" class="right">
<a-button type="primary" icon="search" :disabled="disabled" @click="visible=true">{{selectButtonText}}</a-button>
</a-col>
@ -57,6 +58,11 @@
type: Boolean,
default: true
},
// 是否显示按钮,默认 true
buttons: {
type: Boolean,
default: true
},
/* 可复用属性 */
@ -153,5 +159,9 @@
.right {
width: #{$width};
}
.full {
width: 100%;
}
}
</style>

View File

@ -11,7 +11,7 @@
:modal-width="modalWidth"
:multi="multi"
:rootOpened="rootOpened"
:depart-id="value"
:depart-id="departIds"
@ok="handleOK"
@initComp="initComp"/>
</div>
@ -48,6 +48,11 @@
type: Boolean,
required: false,
default: false
},
// 自定义返回字段,默认返回 id
customReturnField: {
type: String,
default: 'id'
}
},
data(){
@ -63,7 +68,9 @@
},
watch:{
value(val){
this.departIds = val
if (this.customReturnField === 'id') {
this.departIds = val
}
}
},
methods:{
@ -73,21 +80,17 @@
openModal(){
this.$refs.innerDepartSelectModal.show()
},
handleOK(rows,idstr){
console.log("当前选中部门",rows)
console.log("当前选中部门ID",idstr)
if(!rows){
handleOK(rows, idstr) {
let value = ''
if (!rows && rows.length <= 0) {
this.departNames = ''
this.departIds=''
}else{
let temp = ''
for(let item of rows){
temp+=','+item.departName
}
this.departNames = temp.substring(1)
this.departIds=idstr
this.departIds = ''
} else {
value = rows.map(row => row[this.customReturnField]).join(',')
this.departNames = rows.map(row => row['departName']).join(',')
this.departIds = idstr
}
this.$emit("change",this.departIds)
this.$emit("change", value)
},
getDepartNames(){
return this.departNames

View File

@ -5,7 +5,6 @@
name="用户"
displayKey="realname"
:returnKeys="returnKeys"
:listUrl="url.list"
:columns="columns"
queryParamText="账号"
@ -24,7 +23,6 @@
props: ['value'],
data() {
return {
returnKeys: ['id', 'username'],
url: { list: '/sys/user/list' },
columns: [
{ title: '姓名', align: 'center', width: 100, dataIndex: 'realname' },
@ -33,6 +31,17 @@
{ title: '出生日期', align: 'center', width: 100, dataIndex: 'birthday' }
]
}
},
watch: {
$attrs: {
deep: true,
immediate: true,
handler(val) {
if (!val.returnKeys) {
val.returnKeys = ['id', 'username']
}
}
}
}
}
</script>

View File

@ -63,7 +63,7 @@
handler() {
if (this.departId) {
this.checkedKeys = this.departId.split(",");
console.log('this.departId', this.departId)
// console.log('this.departId', this.departId)
} else {
this.checkedKeys = [];
}
@ -75,7 +75,6 @@
this.visible=true
this.checkedRows=[]
this.checkedKeys=[]
console.log("this.multi",this.multi)
},
loadDepart(){
queryDepartTreeList().then(res=>{
@ -133,39 +132,29 @@
},
onCheck (checkedKeys,info) {
if(!this.multi){
let arr = checkedKeys.checked.filter(item=>{
return this.checkedKeys.indexOf(item)<0
})
let arr = checkedKeys.checked.filter(item => this.checkedKeys.indexOf(item) < 0)
this.checkedKeys = [...arr]
this.checkedRows=[info.node.dataRef]
this.checkedRows = (this.checkedKeys.length === 0) ? [] : [info.node.dataRef]
}else{
this.checkedKeys = checkedKeys.checked
this.checkedRows.push(info.node.dataRef)
this.checkedRows = this.getCheckedRows(this.checkedKeys)
}
//this.$emit("input",this.checkedKeys.join(","))
//console.log(this.checkedKeys.join(","))
},
onSelect (selectedKeys,info) {
console.log(selectedKeys)
onSelect(selectedKeys,info) {
let keys = []
keys.push(selectedKeys[0])
if(!this.checkedKeys || this.checkedKeys.length==0 || !this.multi){
if(!this.checkedKeys || this.checkedKeys.length===0 || !this.multi){
this.checkedKeys = [...keys]
this.checkedRows=[info.node.dataRef]
}else{
let currKey = info.node.dataRef.key
if(this.checkedKeys.indexOf(currKey)>=0){
this.checkedKeys = this.checkedKeys.filter(item=>{
return item !=currKey
})
this.checkedRows=this.checkedRows.filter(item=>{
return item.key !=currKey
})
this.checkedKeys = this.checkedKeys.filter(item=> item !==currKey)
}else{
this.checkedRows.push(info.node.dataRef)
this.checkedKeys.push(...keys)
}
}
this.checkedRows = this.getCheckedRows(this.checkedKeys)
},
onExpand (expandedKeys) {
this.expandedKeys = expandedKeys
@ -215,6 +204,32 @@
})
},
// 根据 checkedKeys 获取 rows
getCheckedRows(checkedKeys) {
const forChildren = (list, key) => {
for (let item of list) {
if (item.id === key) {
return item
}
if (item.children instanceof Array) {
let value = forChildren(item.children, key)
if (value != null) {
return value
}
}
}
return null
}
let rows = []
for (let key of checkedKeys) {
let row = forChildren(this.treeData, key)
if (row != null) {
rows.push(row)
}
}
return rows
}
}
}

View File

@ -157,8 +157,9 @@
console.log("props userIds: ", this.userIds)
if (this.userIds) {
let currUserIds = this.userIds
let userIdsArr = currUserIds.split(',');
for (let item of this.dataSource) {
if (currUserIds.indexOf(item.username) >= 0) {
if (userIdsArr.includes(item.username)) {
names += "," + item.realname
}
}

View File

@ -51,9 +51,12 @@ export const JeecgListMixin = {
}
},
created() {
this.loadData();
//初始化字典配置 在自己页面定义
this.initDictConfig();
if(!this.disableMixinCreated){
console.log(' -- mixin created -- ')
this.loadData();
//初始化字典配置 在自己页面定义
this.initDictConfig();
}
},
methods:{
loadData(arg) {
@ -149,6 +152,7 @@ export const JeecgListMixin = {
title: "确认删除",
content: "是否删除选中数据?",
onOk: function () {
that.loading = true;
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
that.$message.success(res.message);
@ -157,6 +161,8 @@ export const JeecgListMixin = {
} else {
that.$message.warning(res.message);
}
}).finally(() => {
that.loading = false;
});
}
});

View File

@ -8,7 +8,7 @@ import { ACCESS_TOKEN } from "@/store/mutation-types"
// 创建 axios 实例
const service = axios.create({
baseURL: '/jeecg-boot', // api base_url
timeout: 15000 // 请求超时时间
timeout: 6000 // 请求超时时间
})
const err = (error) => {

View File

@ -1,3 +1,4 @@
import * as api from '@/api/api'
import { isURL } from '@/utils/validate'
export function timeFix() {
@ -254,4 +255,25 @@ export function cssExpand(css, id) {
}
// 应用新样式
document.head.appendChild(style)
}
/**
* 重复值验证工具方法
*
* 使用示例:
* { validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) }
*
* @param tableName 被验证的表名
* @param fieldName 被验证的字段名
* @param fieldVal 被验证的值
* @param dataId 数据ID可空
* @param callback
*/
export function validateDuplicateValue(tableName, fieldName, fieldVal, dataId, callback) {
let params = { tableName, fieldName, fieldVal, dataId }
api.duplicateCheck(params).then(res => {
res['success'] ? callback() : callback(res['message'])
}).catch(err => {
callback(err.message || err)
})
}

View File

@ -39,8 +39,8 @@
<!-- 部门选择控件 -->
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="选择部门">
<j-select-depart v-decorator="['departId']" :trigger-change="true"></j-select-depart>
<a-form-item label="选择部门 自定义返回值">
<j-select-depart v-decorator="['departId']" :trigger-change="true" customReturnField="departName"></j-select-depart>
</a-form-item>
</a-col>
<a-col :span="12">选中的部门ID(v-decorator):{{ getDepartIdValue() }}</a-col>
@ -69,7 +69,7 @@
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="选择用户">
<j-select-multi-user v-model="multiUser"></j-select-multi-user>
<j-select-multi-user v-model="multiUser" ></j-select-multi-user>
</a-form-item>
</a-col>
<a-col :span="12">选中的用户(v-model):{{ multiUser }}</a-col>
@ -217,7 +217,7 @@
<a-row :gutter="24">
<a-col :span="12">
<a-form-item label="树字典">
<j-tree-dict parentCode="A01" />
<j-tree-dict parentCode="B01" />
</a-form-item>
</a-col>
<a-col :span="12"></a-col>

View File

@ -177,13 +177,14 @@
import JDictSelectTag from '../../../../components/dict/JDictSelectTag.vue'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import Clipboard from 'clipboard'
import { filterObj } from '@/utils/util';
export default {
name: 'OnlCgformHeadList',
mixins: [JeecgListMixin],
components: {
JDictSelectTag
JDictSelectTag,
},
data() {
return {

View File

@ -132,6 +132,7 @@
<j-import-modal ref="importModal" :url="getImportUrl()" @ok="importOk"></j-import-modal>
<process-inst-pic-modal ref="processInstPicModal"></process-inst-pic-modal>
</div>
</a-card>
</template>
@ -691,6 +692,12 @@
}
});
},
handlePreviewPic: function(record){
var flowCode = this.flowCodePre+this.currentTableName;
var dataId = record.id;
this.$refs.processInstPicModal.preview(flowCode,dataId);
this.$refs.processInstPicModal.title="流程图";
}
}
}

View File

@ -0,0 +1,187 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-form-item label="规则名称">
<a-input placeholder="请输入规则名称" v-model="queryParam.ruleName"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="规则Code">
<a-input placeholder="请输入规则Code" v-model="queryParam.ruleCode"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</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-button type="primary" icon="import">导入</a-button>
</a-upload>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel">
<a-icon type="delete"/>
删除
</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作
<a-icon type="down"/>
</a-button>
</a-dropdown>
</div>
<!-- table区域-begin -->
<a-alert type="info" showIcon style="margin-bottom: 16px;">
<template slot="message">
<span>已选择</span>
<a style="font-weight: 600;padding: 0 4px;">{{ selectedRowKeys.length }}</a>
<span>项</span>
<template v-if="selectedRowKeys.length>0">
<a-divider type="vertical"/>
<a @click="onClearSelected">清空</a>
</template>
</template>
</a-alert>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical"/>
<a-dropdown>
<a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
<a-menu slot="overlay">
<a-menu-item @click="handleTest(record)">
功能测试
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
<!-- table区域-end -->
<!-- 表单区域 -->
<sys-fill-rule-modal ref="modalForm" @ok="modalFormOk"/>
</a-card>
</template>
<script>
import { getAction } from '@/api/manage'
import SysFillRuleModal from './modules/SysFillRuleModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
name: 'SysFillRuleList',
mixins: [JeecgListMixin],
components: { SysFillRuleModal },
data() {
return {
description: '填值规则管理页面',
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: (t, r, index) => 1 + index
},
{
title: '规则名称',
align: 'center',
dataIndex: 'ruleName'
},
{
title: '规则Code',
align: 'center',
dataIndex: 'ruleCode'
},
{
title: '规则实现类',
align: 'center',
dataIndex: 'ruleClass'
},
{
title: '规则参数',
align: 'center',
dataIndex: 'ruleParams'
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' },
}
],
url: {
list: '/sys/fillRule/list',
test: '/sys/fillRule/testFillRule',
delete: '/sys/fillRule/delete',
deleteBatch: '/sys/fillRule/deleteBatch',
exportXlsUrl: '/sys/fillRule/exportXls',
importExcelUrl: '/sys/fillRule/importExcel',
},
}
},
computed: {
importExcelUrl() {
return `${window._CONFIG['domianURL']}${this.url.importExcelUrl}`
}
},
methods: {
handleTest(record) {
let closeLoading = this.$message.loading('生成中...', 0)
getAction(this.url.test, {
ruleCode: record.ruleCode
}).then(res => {
if (res.success) {
this.$info({
title: '填值规则功能测试',
content: '生成结果:' + res.result
})
} else {
this.$message.warn(res.message)
}
}).finally(() => {
closeLoading()
})
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>

View File

@ -19,7 +19,7 @@
<template v-if="toggleSearchStatus">
<a-col :md="6" :sm="8">
<a-form-item label="职级">
<j-dict-select-tag v-model="queryParam.rank" placeholder="请选择职级" dictCode="position_rank"/>
<j-dict-select-tag v-model="queryParam.postRank" placeholder="请选择职级" dictCode="position_rank"/>
</a-form-item>
</a-col>
@ -143,7 +143,7 @@
{
title: '职级',
align: 'center',
dataIndex: 'rank_dictText'
dataIndex: 'postRank_dictText'
},
// {
// title: '公司id',

View File

@ -65,7 +65,7 @@
<!-- 操作按钮区域 -->
<div class="table-operator" style="border-top: 5px">
<a-button @click="handleAdd" v-has="'user:add'" type="primary" icon="plus">添加用户</a-button>
<a-button @click="handleAdd" type="primary" icon="plus" v-has="'user:add'">添加用户</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-button type="primary" icon="import">导入</a-button>
@ -119,6 +119,7 @@
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical"/>
<a-dropdown>

View File

@ -0,0 +1,158 @@
<template>
<a-modal
:title="title"
:width="800"
:visible="visible"
:maskClosable="false"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="规则名称">
<a-input placeholder="请输入规则名称" v-decorator="['ruleName', validatorRules.ruleName]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="规则Code">
<a-input placeholder="请输入规则Code" :disabled="disabledCode" v-decorator="['ruleCode', validatorRules.ruleCode]"/>
</a-form-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-spin>
</a-modal>
</template>
<script>
import pick from 'lodash.pick'
import { httpAction } from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'SysFillRuleModal',
components: {},
data() {
return {
title: '操作',
visible: false,
model: {},
labelCol: { xs: { span: 24 }, sm: { span: 5 } },
wrapperCol: { xs: { span: 24 }, sm: { span: 16 } },
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
ruleName: { rules: [{ required: true, message: '规则名称不能为空' }] },
ruleCode: {
rules: [
{ required: true, message: '规则Code不能为空' },
{ validator: (rule, value, callback) => validateDuplicateValue('sys_fill_rule', 'rule_code', value, this.model.id, callback) }
]
},
ruleClass: { rules: [{ required: true, message: '规则实现类不能为空' }] },
ruleParams: {
rules: [{
validator: (rule, value, callback) => {
try {
let json = JSON.parse(value)
if (json instanceof Array) {
callback('只能传递JSON对象不能传递JSON数组')
} else if (json instanceof Object) {
callback()
} else {
callback('请输入JSON字符串')
}
} catch {
callback('请输入JSON字符串')
}
}
}]
},
},
url: {
add: '/sys/fillRule/add',
edit: '/sys/fillRule/edit',
},
}
},
computed: {
disabledCode() {
return !!this.model.id
}
},
created() {
},
methods: {
add() {
this.edit({})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'ruleName', 'ruleCode', 'ruleClass', 'ruleParams'))
})
},
close() {
this.$emit('close')
this.visible = false
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let httpUrl = this.url.add, method = 'post'
if (this.model.id) {
httpUrl = this.url.edit
method = 'put'
}
let formData = Object.assign(this.model, values)
httpAction(httpUrl, formData, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
}
})
},
handleCancel() {
this.close()
}
}
}
</script>
<style lang="less" scoped>
</style>

View File

@ -33,7 +33,7 @@
placeholder="请选择职级"
:triggerChange="true"
dictCode="position_rank"
v-decorator="['rank', validatorRules.rank]"
v-decorator="['postRank', validatorRules.postRank]"
/>
</a-form-item>
<!--<a-form-item-->
@ -104,7 +104,7 @@
]
},
name: { rules: [{ required: true, message: '请输入职务名称' }] },
rank: { rules: [{ required: true, message: '请选择职级' }] },
postRank: { rules: [{ required: true, message: '请选择职级' }] },
},
url: {
add: '/sys/position/add',
@ -126,7 +126,7 @@
this.form.setFieldsValue(pick(this.model,
'code',
'name',
'rank',
'postRank',
// 'companyId'
))
})

View File

@ -84,7 +84,7 @@
</a-tabs>
<a-form-item>
<a-checkbox v-model="formLogin.rememberMe">自动登陆</a-checkbox>
<a-checkbox v-decorator="['rememberMe', {initialValue: true, valuePropName: 'checked'}]" >自动登陆</a-checkbox>
<router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">
忘记密码
</router-link>
@ -201,13 +201,6 @@
time: 60,
smsSendBtn: false,
},
formLogin: {
username: "",
password: "",
captcha: "",
mobile: "",
rememberMe: true
},
validatorRules:{
username:{rules: [{ required: true, message: '请输入用户名!',validator: 'click'}]},
password:{rules: [{ required: true, message: '请输入密码!',validator: 'click'}]},
@ -251,19 +244,18 @@
},
handleSubmit () {
let that = this
let loginParams = {
remember_me: that.formLogin.rememberMe
};
let loginParams = {};
that.loginBtn = true;
// 使用账户密码登陆
if (that.customActiveKey === 'tab1') {
that.form.validateFields([ 'username', 'password','inputCode' ], { force: true }, (err, values) => {
that.form.validateFields([ 'username', 'password','inputCode', 'rememberMe' ], { force: true }, (err, values) => {
if (!err) {
loginParams.username = values.username
// update-begin- --- author:scott ------ date:20190805 ---- for:密码加密逻辑暂时注释掉,有点问题
//loginParams.password = md5(values.password)
//loginParams.password = encryption(values.password,that.encryptedString.key,that.encryptedString.iv)
loginParams.password = values.password
loginParams.remember_me = values.rememberMe
// update-begin- --- author:scott ------ date:20190805 ---- for:密码加密逻辑暂时注释掉,有点问题
let checkParams = this.$refs.jgraphicCodeRef.getLoginParam()
loginParams.captcha = checkParams.checkCode
@ -282,10 +274,11 @@
})
// 使用手机号登陆
} else {
that.form.validateFields([ 'mobile', 'captcha' ], { force: true }, (err, values) => {
that.form.validateFields([ 'mobile', 'captcha', 'rememberMe' ], { force: true }, (err, values) => {
if (!err) {
loginParams.mobile = values.mobile
loginParams.captcha = values.captcha
loginParams.remember_me = values.rememberMe
that.PhoneLogin(loginParams).then((res) => {
console.log(res.result);
this.departConfirm(res)