JeecgBoot2.4.3版本发布——企业级低代码平台

pull/2341/head
zhangdaiscott 2021-03-17 18:40:08 +08:00
parent 4674097078
commit da5ace3397
63 changed files with 8776 additions and 6589 deletions

View File

@ -1,3 +1,3 @@
NODE_ENV=production
VUE_APP_PLATFORM_NAME=JeecgBoot 企业级快速开发平台
VUE_APP_PLATFORM_NAME=JeecgBoot 企业级低代码平台
VUE_APP_SSO=false

View File

@ -1,13 +1,13 @@
Ant Design Jeecg Vue
====
当前最新版本: 2.4.2发布日期20210126
当前最新版本: 2.4.3发布日期20210322
Overview
----
基于 [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一贯的强大

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "vue-antd-jeecg",
"version": "2.4.2",
"version": "2.4.3",
"private": true,
"scripts": {
"pre": "cnpm install || yarn --registry https://registry.npm.taobao.org || npm install --registry https://registry.npm.taobao.org ",
@ -10,8 +10,8 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"@jeecg/antd-online-mini": "2.4.22-beta",
"ant-design-vue": "^1.7.2",
"@jeecg/antd-online-mini": "2.4.3-RC",
"@antv/data-set": "^0.11.4",
"viser-vue": "^2.4.8",
"axios": "^0.18.0",

View File

@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>JeecgBoot </title>
<title>JeecgBoot </title>
<link rel="icon" href="<%= BASE_URL %>logo.png">
<script src="<%= BASE_URL %>cdn/babel-polyfill/polyfill_7_2_5.js"></script>
<style>
@ -251,7 +251,7 @@
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
<div class="load_title"> JeecgBoot ,
<div class="load_title"> JeecgBoot ,
</div>
</div>

View File

@ -38,6 +38,7 @@ const queryPermissionRule = (params)=>getAction("/sys/permission/queryPermission
// 部门管理
const queryDepartTreeList = (params)=>getAction("/sys/sysDepart/queryTreeList",params);
const queryDepartTreeSync = (params)=>getAction("/sys/sysDepart/queryDepartTreeSync",params);
const queryIdTree = (params)=>getAction("/sys/sysDepart/queryIdTree",params);
const queryParentName = (params)=>getAction("/sys/sysDepart/queryParentName",params);
const searchByKeywords = (params)=>getAction("/sys/sysDepart/searchBy",params);
@ -52,7 +53,6 @@ const saveDeptRolePermission = (params)=>postAction("/sys/sysDepartPermission/sa
const queryMyDepartTreeList = (params)=>getAction("/sys/sysDepart/queryMyDeptTreeList",params);
//日志管理
//const getLogList = (params)=>getAction("/sys/log/list",params);
const deleteLog = (params)=>deleteAction("/sys/log/delete",params);
const deleteLogList = (params)=>deleteAction("/sys/log/deleteBatch",params);
@ -69,7 +69,7 @@ export const ajaxGetDictItems = (code, params)=>getAction(`/sys/dict/getDictItem
function getDictItemsFromCache(dictCode) {
if (Vue.ls.get(UI_CACHE_DB_DICT_DATA) && Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode]) {
let dictItems = Vue.ls.get(UI_CACHE_DB_DICT_DATA)[dictCode];
console.log("-----------getDictItemsFromCache----------dictCode="+dictCode+"---- dictItems=",dictItems)
//console.log("-----------getDictItemsFromCache----------dictCode="+dictCode+"---- dictItems=",dictItems)
return dictItems;
}
}
@ -101,6 +101,8 @@ export const transitRESTful = {
}
export {
// imgView,
// doMian,
addRole,
editRole,
checkRoleCode,
@ -124,6 +126,7 @@ export {
getPermissionRuleList,
queryPermissionRule,
queryDepartTreeList,
queryDepartTreeSync,
queryIdTree,
queryParentName,
searchByKeywords,

View File

@ -12,13 +12,13 @@ export default class Area {
let arr = []
const province = pcaa['86']
Object.keys(province).map(key=>{
arr.push({id:key, text:province[key], pid:'86'});
arr.push({id:key, text:province[key], pid:'86', index:1});
const city = pcaa[key];
Object.keys(city).map(key2=>{
arr.push({id:key2, text:city[key2], pid:key});
arr.push({id:key2, text:city[key2], pid:key, index:2});
const qu = pcaa[key2];
Object.keys(qu).map(key3=>{
arr.push({id:key3, text:qu[key3], pid:key2});
arr.push({id:key3, text:qu[key3], pid:key2, index:3});
})
})
})
@ -45,33 +45,35 @@ export default class Area {
return ''
}
let arr = []
this.getAreaBycode(code,arr);
this.getAreaBycode(code, arr, 3);
return arr.join('/')
}
getRealCode(code){
let arr = []
this.getPcode(code, arr)
this.getPcode(code, arr, 3)
return arr;
}
getPcode(id, arr){
getPcode(id, arr, index){
for(let item of this.all){
if(item.id === id){
if(item.id === id && item.index == index){
arr.unshift(id)
if(item.pid != '86'){
this.getPcode(item.pid,arr)
this.getPcode(item.pid, arr, --index)
}
}
}
}
getAreaBycode(code,arr){
//console.log("this.all.length",this.all)
getAreaBycode(code, arr, index){
for(let item of this.all){
if(item.id === code){
if(item.id === code && item.index == index){
arr.unshift(item.text);
this.getAreaBycode(item.pid,arr)
if(item.pid != '86'){
this.getAreaBycode(item.pid, arr, --index)
}
}
}
}

View File

@ -128,6 +128,9 @@
this.reload()
}
})
//update--begin--autor:liusq-----date:20210316------for富文本编辑器tab父组件可能导致的赋值问题------
this.reload()
//update--end--autor:liusq-----date:20210316------for富文本编辑器tab父组件可能导致的赋值问题------
}else{
//update--begin--autor:wangshuai-----date:20200724------for富文本编辑器切换tab无法修改------
let tabLayout = getVmParentByName(this, 'TabLayout')

View File

@ -8,10 +8,11 @@
v-on="$listeners"
@ok="handleOk"
@cancel="handleCancel"
destroyOnClose
>
<slot></slot>
<!---->
<template v-if="!isNoTitle" slot="title">
<a-row class="j-modal-title-row" type="flex">
<a-col class="left">
@ -22,6 +23,14 @@
</a-col>
</a-row>
</template>
<!---->
<template v-else slot="title">
<a-row class="j-modal-title-row" type="flex">
<a-col v-if="switchFullscreen" class="right" @click="toggleFullscreen">
<a-button class="ant-modal-close ant-modal-close-x" ghost type="link" :icon="fullscreenButtonIcon"/>
</a-col>
</a-row>
</template>
<!-- scopedSlots -->
<template v-for="slotName of scopedSlotsKeys" :slot="slotName">
@ -161,7 +170,6 @@
<style lang="less">
.j-modal-box {
&.fullscreen {
top: 0;
left: 0;
@ -190,7 +198,6 @@
height: calc(100% - 55px);
}
}
&.no-title.no-footer {
.ant-modal-body {
height: 100%;
@ -217,6 +224,12 @@
}
}
}
&.no-title{
.ant-modal-header {
padding: 0px 24px;
border-bottom: 0px !important;
}
}
}
@media (max-width: 767px) {

View File

@ -298,7 +298,11 @@ export function dispatchEvent({cell, $event}, className, handler) {
handler(element[0])
} else {
// 模拟触发点击事件
element[0].dispatchEvent($event)
console.log($event)
if($event){
console.log("$event===>",$event)
element[0].dispatchEvent($event)
}
}
}
}, 10)

View File

@ -141,6 +141,33 @@ export async function validateFormAndTables(form, cases, autoJumpTab) {
return dataMap
}
/**
*
* @param form form
* @param cases JVxeTable
* @param autoJumpTab
* @returns {Promise<any>}
* @author sunjianlei
*/
export async function validateFormModelAndTables(form,formData, cases, autoJumpTab) {
if (!(form && typeof form.validate === 'function')) {
throw `form form${typeof form}`
}
let dataMap = {}
let values = await new Promise((resolve, reject) => {
// 验证主表表单
form.validate((valid,obj) => {
valid ?resolve(formData): reject({error: VALIDATE_FAILED, originError: valid})
})
})
Object.assign(dataMap, {formValue: values})
// 验证所有子表的表单
let subData = await validateTables(cases, autoJumpTab)
// 合并最终数据
dataMap = Object.assign(dataMap, {tablesValue: subData})
return dataMap
}
/**
*
*

View File

@ -342,7 +342,13 @@
combineRowKey(record){
let res = ''
Object.keys(record).forEach(key=>{
res+=record[key]
//update-begin---author:liusq Date:20210203 forpop选择器列主键问题 issues/I29P9Q------------
if(key=='id'){
res=record[key]+res
}else{
res+=record[key]
}
//update-end---author:liusq Date:20210203 forpop选择器列主键问题 issues/I29P9Q------------
})
if(res.length>50){
res = res.substring(0,50)

View File

@ -95,7 +95,6 @@
}).join(',')
}
//update-end-author:lvdandan date:20200513 for:TESTA-438 部门选择组件自定义返回值,数据无法回填
this.backDeparInfo()
},
//返回选中的部门信息
backDeparInfo(){
@ -128,6 +127,7 @@
this.departIds = idstr
}
this.$emit("change", value)
this.backDeparInfo()
},
getDepartNames(){
return this.departNames

View File

@ -167,7 +167,9 @@
if(!this.checkedKeys || this.checkedKeys.length==0){
this.$emit("ok",'')
}else{
this.$emit("ok",this.checkedRows,this.checkedKeys.join(","))
let checkRow = this.getCheckedRows(this.checkedKeys)
let keyStr = this.checkedKeys.join(",")
this.$emit("ok", checkRow, keyStr)
}
this.handleClear()
},

View File

@ -171,7 +171,7 @@
// update-begin-author:sunjianlei date:20200120 for: 动态更改页面标题
changeTitle(title) {
let projectTitle = "Jeecg-Boot 企业级快速开发平台"
let projectTitle = "Jeecg-Boot 企业级低代码平台"
// 首页特殊处理
if (this.$route.path === indexKey) {
document.title = projectTitle

View File

@ -9,7 +9,7 @@
</a>
</div>
<div class="desc">
Jeecg Boot
Jeecg Boot
</div>
</div>

View File

@ -17,7 +17,7 @@
:type="collapsed ? 'menu-unfold' : 'menu-fold'"
@click="toggle"/>
<span v-if="device === 'desktop'"> Jeecg-Boot </span>
<span v-if="device === 'desktop'"> Jeecg-Boot </span>
<span v-else>Jeecg-Boot</span>
<user-menu :theme="theme"/>
@ -50,7 +50,6 @@
import UserMenu from '../tools/UserMenu'
import SMenu from '../menu/'
import Logo from '../tools/Logo'
import { mixin } from '@/utils/mixin.js'
export default {

View File

@ -20,7 +20,6 @@ import 'ant-design-vue/dist/antd.less'; // or 'ant-design-vue/dist/antd.less'
import '@/permission' // permission control
import '@/utils/filter' // base filter
import Print from 'vue-print-nb-jeecg'
/*import '@babel/polyfill'*/
import preview from 'vue-photo-preview'
import 'vue-photo-preview/dist/skin.css'
import SSO from '@/cas/sso.js'
@ -47,7 +46,9 @@ import '@/assets/less/JAreaLinkage.less'
import VueAreaLinkage from 'vue-area-linkage'
import '@/components/jeecg/JVxeTable/install'
import '@/components/JVxeCells/install'
//表单验证
import { rules } from '@/utils/rules'
Vue.prototype.rules = rules
Vue.config.productionTip = false
Vue.use(Storage, config.storageOptions)
Vue.use(Antd)

View File

@ -0,0 +1,190 @@
import JEditableTable from '@/components/jeecg/JEditableTable'
import { VALIDATE_NO_PASSED, getRefPromise,validateFormModelAndTables} from '@/utils/JEditableTableUtil'
import { httpAction, getAction } from '@/api/manage'
export const JEditableTableModelMixin = {
components: {
JEditableTable
},
data() {
return {
title: '',
visible: false,
confirmLoading: false,
model:{},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 }
}
}
},
methods: {
/** 获取所有的editableTable实例 */
getAllTable() {
if (!(this.refKeys instanceof Array)) {
throw this.throwNotArray('refKeys')
}
let values = this.refKeys.map(key => getRefPromise(this, key))
return Promise.all(values)
},
/** 遍历所有的JEditableTable实例 */
eachAllTable(callback) {
// 开始遍历
this.getAllTable().then(tables => {
tables.forEach((item, index) => {
if (typeof callback === 'function') {
callback(item, index)
}
})
})
},
/** 当点击新增按钮时调用此方法 */
add() {
//update-begin-author:lvdandan date:20201113 for:LOWCOD-1049 JEditaTable,子表默认添加一条数据addDefaultRowNum设置无效 #1930
return new Promise((resolve) => {
this.tableReset();
resolve();
}).then(() => {
// 默认新增空数据
let rowNum = this.addDefaultRowNum
if (typeof rowNum !== 'number') {
rowNum = 1
console.warn(' data addDefaultRowNum addDefaultRowNum addDefaultRowNum 0')
}
this.eachAllTable((item) => {
item.add(rowNum)
})
if (typeof this.addAfter === 'function') this.addAfter(this.model)
this.edit(this.model)
})
//update-end-author:lvdandan date:20201113 for:LOWCOD-1049 JEditaTable,子表默认添加一条数据addDefaultRowNum设置无效 #1930
},
/** 当点击了编辑(修改)按钮时调用此方法 */
edit(record) {
if(record && '{}'!=JSON.stringify(record)&&record.id){
this.tableReset();
}
if (typeof this.editBefore === 'function') this.editBefore(record)
this.visible = true
this.activeKey = this.refKeys[0]
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
if (typeof this.editAfter === 'function') this.editAfter(this.model)
},
/** 关闭弹窗并将所有JEditableTable实例回归到初始状态 */
close() {
this.visible = false
this.$emit('close')
},
//清空子表table的数据
tableReset(){
this.eachAllTable((item) => {
item.clearRow()
})
},
/** 查询某个tab的数据 */
requestSubTableData(url, params, tab, success) {
tab.loading = true
getAction(url, params).then(res => {
let { result } = res
let dataSource = []
if (result) {
if (Array.isArray(result)) {
dataSource = result
} else if (Array.isArray(result.records)) {
dataSource = result.records
}
}
tab.dataSource = dataSource
typeof success === 'function' ? success(res) : ''
}).finally(() => {
tab.loading = false
})
},
/** 发起请求,自动判断是执行新增还是修改操作 */
request(formData) {
let url = this.url.add, method = 'post'
if (this.model.id) {
url = this.url.edit
method = 'put'
}
this.confirmLoading = true
httpAction(url, formData, method).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
},
/* --- handle 事件 --- */
/** ATab 选项卡切换事件 */
handleChangeTabs(key) {
// 自动重置scrollTop状态防止出现白屏
getRefPromise(this, key).then(editableTable => {
editableTable.resetScrollTop()
})
},
/** 关闭按钮点击事件 */
handleCancel() {
this.close()
},
/** 确定按钮点击事件 */
handleOk() {
/** 触发表单验证 */
this.getAllTable().then(tables => {
/** 一次性验证主表和所有的次表 */
return validateFormModelAndTables(this.$refs.form,this.model, tables)
}).then(allValues => {
/** 一次性验证一对一的所有子表 */
return this.validateSubForm(allValues)
}).then(allValues => {
if (typeof this.classifyIntoFormData !== 'function') {
throw this.throwNotFunction('classifyIntoFormData')
}
let formData = this.classifyIntoFormData(allValues)
// 发起请求
return this.request(formData)
}).catch(e => {
if (e.error === VALIDATE_NO_PASSED) {
// 如果有未通过表单验证的子表就自动跳转到它所在的tab
//update--begin--autor:liusq-----date:20210316------for未通过表单验证跳转tab问题------
this.activeKey = e.index == null ? this.activeKey : (e.paneKey?e.paneKey:this.refKeys[e.index])
//update--end--autor:liusq-----date:20210316------for未通过表单验证跳转tab问题------
} else {
console.error(e)
}
})
},
//校验所有子表表单
validateSubForm(allValues){
return new Promise((resolve) => {
resolve(allValues)
})
},
/* --- throw --- */
/** not a function */
throwNotFunction(name) {
return `${name} `
},
/** not a array */
throwNotArray(name) {
return `${name} `
}
}
}

View File

@ -52,10 +52,13 @@ export const JVxeTableMixin = {
rowNum = 1
console.warn(' data addDefaultRowNum addDefaultRowNum addDefaultRowNum 0')
}
//update-begin-author:taoyan date:20210315 for: 一对多jvex 默认几行不好使了 LOWCOD-1349
this.eachAllTable((item) => {
item.addRows()
//item.add(rowNum)
setTimeout(()=>{
item.addRows()
}, 30)
})
//update-end-author:taoyan date:20210315 for: 一对多jvex 默认几行不好使了 LOWCOD-1349
if (typeof this.addAfter === 'function') this.addAfter(this.model)
this.edit({})
},

View File

@ -0,0 +1,181 @@
import { VALIDATE_FAILED, getRefPromise, validateFormAndTables,validateFormModelAndTables} from '@/components/jeecg/JVxeTable/utils/vxeUtils.js'
import { httpAction, getAction } from '@/api/manage'
export const JVxeTableModelMixin = {
data() {
return {
title: '',
visible: false,
confirmLoading: false,
scrolling: true,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 18 }
}
}
},
methods: {
/** 获取所有的JVxeTable实例 */
getAllTable() {
if (!(this.refKeys instanceof Array)) {
throw this.throwNotArray('refKeys')
}
let values = this.refKeys.map(key => getRefPromise(this, key))
return Promise.all(values)
},
/** 遍历所有的JVxeTable实例 */
eachAllTable(callback) {
// 开始遍历
this.getAllTable().then(tables => {
console.log("tables",tables)
tables.forEach((item, index) => {
if (typeof callback === 'function') {
callback(item, index)
}
})
})
},
/** 当点击新增按钮时调用此方法 */
add() {
if (typeof this.addBefore === 'function') this.addBefore()
// 默认新增空数据
let rowNum = this.addDefaultRowNum
if (typeof rowNum !== 'number') {
rowNum = 1
console.warn(' data addDefaultRowNum addDefaultRowNum addDefaultRowNum 0')
}
this.eachAllTable((item) => {
//update-begin-author:taoyan date:20210315 for: 一对多jvex 默认几行不好使了 LOWCOD-1349
setTimeout(()=>{
item.addRows()
}, 30)
//update-end-author:taoyan date:20210315 for: 一对多jvex 默认几行不好使了 LOWCOD-1349
})
if (typeof this.addAfter === 'function') this.addAfter(this.model)
this.edit(this.model)
},
/** 当点击了编辑(修改)按钮时调用此方法 */
edit(record) {
if (typeof this.editBefore === 'function') this.editBefore(record)
this.visible = true
this.activeKey = this.refKeys[0]
this.$refs.form.resetFields()
this.model = Object.assign({}, record)
if (typeof this.editAfter === 'function') this.editAfter(this.model)
},
/** 关闭弹窗并将所有JVxeTable实例回归到初始状态 */
close() {
this.visible = false
this.eachAllTable((item) => {
item._remove()
})
this.$emit('close')
},
/** 查询某个tab的数据 */
requestSubTableData(url, params, tab, success) {
tab.loading = true
getAction(url, params).then(res => {
let { result } = res
let dataSource = []
if (result) {
if (Array.isArray(result)) {
dataSource = result
} else if (Array.isArray(result.records)) {
dataSource = result.records
}
}
tab.dataSource = dataSource
typeof success === 'function' ? success(res) : ''
}).finally(() => {
tab.loading = false
})
},
/** 发起请求,自动判断是执行新增还是修改操作 */
request(formData) {
let url = this.url.add, method = 'post'
if (this.model.id) {
url = this.url.edit
method = 'put'
}
this.confirmLoading = true
console.log("formData===>",formData);
httpAction(url, formData, method).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
},
/* --- handle 事件 --- */
/** ATab 选项卡切换事件 */
handleChangeTabs(key) {
// 自动重置scrollTop状态防止出现白屏
getRefPromise(this, key).then(vxeTable => {
vxeTable.resetScrollTop()
})
},
/** 关闭按钮点击事件 */
handleCancel() {
this.close()
},
/** 确定按钮点击事件 */
handleOk() {
/** 触发表单验证 */
this.getAllTable().then(tables => {
/** 一次性验证主表和所有的次表 */
return validateFormModelAndTables(this.$refs.form,this.model, tables)
}).then(allValues => {
/** 一次性验证一对一的所有子表 */
return this.validateSubForm(allValues)
}).then(allValues => {
if (typeof this.classifyIntoFormData !== 'function') {
throw this.throwNotFunction('classifyIntoFormData')
}
let formData = this.classifyIntoFormData(allValues)
// 发起请求
return this.request(formData)
}).catch(e => {
if (e.error === VALIDATE_FAILED) {
// 如果有未通过表单验证的子表就自动跳转到它所在的tab
this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
} else {
console.error(e)
}
})
},
//校验所有子表表单
validateSubForm(allValues){
return new Promise((resolve) => {
resolve(allValues)
})
},
/* --- throw --- */
/** not a function */
throwNotFunction(name) {
return `${name} `
},
/** not a array */
throwNotArray(name) {
return `${name} `
}
}
}

View File

@ -66,7 +66,7 @@ export const JeecgListMixin = {
let head = {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)}
let tenantid = Vue.ls.get(TENANT_ID)
if(tenantid){
head['tenant_id'] = tenantid
head['tenant-id'] = tenantid
}
return head;
}
@ -177,6 +177,8 @@ export const JeecgListMixin = {
that.loading = true;
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
//重新计算分页问题
that.reCalculatePage(that.selectedRowKeys.length)
that.$message.success(res.message);
that.loadData();
that.onClearSelected();
@ -198,6 +200,8 @@ export const JeecgListMixin = {
var that = this;
deleteAction(that.url.delete, {id: id}).then((res) => {
if (res.success) {
//重新计算分页问题
that.reCalculatePage(1)
that.$message.success(res.message);
that.loadData();
} else {
@ -205,6 +209,17 @@ export const JeecgListMixin = {
}
});
},
reCalculatePage(count){
//总数量-count
let total=this.ipagination.total-count;
//获取删除后的分页数
let currentIndex=Math.ceil(total/this.ipagination.pageSize);
//删除后的分页数<所在当前页
if(currentIndex<this.ipagination.current){
this.ipagination.current=currentIndex;
}
console.log('currentIndex',currentIndex)
},
handleEdit: function (record) {
this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "编辑";
@ -218,6 +233,7 @@ export const JeecgListMixin = {
handleTableChange(pagination, filters, sorter) {
//分页、排序、筛选变化时触发
//TODO 筛选
console.log(pagination)
if (Object.keys(sorter).length > 0) {
this.isorter.column = sorter.field;
this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"

View File

@ -76,6 +76,36 @@ export function validateFormAndTables(form, cases) {
return Promise.reject(error)
})
}
/**
* ()
* @param form form
* @param cases JEditableTable
* @returns {Promise<any>}
* @author sunjianlei
*/
export function validateFormModelAndTables(form,values, cases) {
if (!(form && typeof form.validate === 'function')) {
throw `form form${typeof form}`
}
let options = {}
return new Promise((resolve, reject) => {
// 验证主表表单
form.validate((valid,obj) => {
valid ?resolve(values):reject({ error: VALIDATE_NO_PASSED })
})
}).then(values => {
Object.assign(options, { formValue: values })
// 验证所有子表的表单
return validateTables(cases)
}).then(all => {
Object.assign(options, { tablesValue: all })
return Promise.resolve(options)
}).catch(error => {
return Promise.reject(error)
})
}
/**

View File

@ -9,10 +9,10 @@ export function disabledAuthFilter(code,formData) {
}
function nodeDisabledAuth(code,formData){
console.log("页面权限禁用--NODE--开始");
//console.log("页面权限禁用--NODE--开始");
let permissionList = [];
try {
console.log("页面权限禁用--NODE--开始",formData);
//console.log("页面权限禁用--NODE--开始",formData);
if (formData) {
let bpmList = formData.permissionList;
permissionList = bpmList.filter(item=>item.type=='2')
@ -53,7 +53,7 @@ function nodeDisabledAuth(code,formData){
}
function globalDisabledAuth(code){
console.log("全局页面禁用权限--Global--开始");
//console.log("全局页面禁用权限--Global--开始");
let permissionList = [];
let allPermissionList = [];
@ -106,7 +106,7 @@ function globalDisabledAuth(code){
}else{
for (let item2 of permissionList) {
if(code === item2.action){
console.log("全局页面权限解除禁用--Global--生效");
//console.log("全局页面权限解除禁用--Global--生效");
gFlag = false;
}
}

View File

@ -5,7 +5,7 @@ const hasPermission = {
//console.log(options);
Vue.directive('has', {
inserted: (el, binding, vnode)=>{
console.log("页面权限控制----");
//console.log("页面权限控制----");
//console.time()
//节点权限处理,如果命中则不进行全局权限处理
if(!filterNodePermission(el, binding, vnode)){
@ -68,7 +68,7 @@ export function filterNodePermission(el, binding, vnode) {
*
*/
export function filterGlobalPermission(el, binding, vnode) {
console.log("全局页面权限--Global--");
//console.log("全局页面权限--Global--");
let permissionList = [];
let allPermissionList = [];

View File

@ -104,7 +104,7 @@ service.interceptors.request.use(config => {
if (!tenantid) {
tenantid = 0;
}
config.headers[ 'tenant_id' ] = tenantid
config.headers[ 'tenant-id' ] = tenantid
//update-end-author:taoyan date:2020707 for:多租户
if(config.method=='get'){
if(config.url.indexOf("sys/dict/getDictItems")<0){

View File

@ -0,0 +1,110 @@
const validateMobile = (rule, value, callback) => {
let reg = /^1(3|4|5|7|8)\d{9}$/
if (!reg.test(value)) {
callback('')
} else {
callback()
}
}
const validateEn = (rule, value, callback) => {
let reg = /^[_a-zA-Z0-9]+$/
let reg2 = /^.{4,18}$/
// 长度为6到18个字符
if (value !== '' && !reg.test(value)) {
callback('线')
} else if (value !== '' && !reg2.test(value)) {
callback('618')
} else {
callback()
}
}
export const rules = {
mobile: [{
required: true,
message: '',
trigger: 'blur'
}, { validator: validateMobile, trigger: 'blur' }],
userName: [{
required: true, message: '', trigger: 'blur'
}, { validator: validateEn }],
email: [
{ required: false, type: 'email', message: '', trigger: 'blur' }
],
// 验证自然数
naturalNumber: /^(([0-9]*[1-9][0-9]*)|(0+))$/,
naturalNumberMsg: '',
// 英文
english: /^.[A-Za-z]+$/,
englishMsg: '',
// 座机
telephone: /^\d{3}-\d{7,8}|\d{4}-\d{7,8}$/,
telephoneMsg: '',
// 银行卡号码
bankCard: /^[1-9]\d{9,19}$/,
bankCardMsg: '',
// 证件号码
IDNumber: /^[a-z0-9A-Z]{0,50}$/,
IDNumberMsg: '',
// 身份证号码,包括15位和18位的
IDCard: /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{7}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/,
IDCardMsg: '',
// QQ号码
qq: /^[1-9]\d{4,11}$/,
qqMsg: 'QQ',
// 网址, 仅支持http和https开头的
url: /^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-.,@?^=%&:/~+#]*[\w\-@?^=%&/~+#])?$/,
urlMsg: 'httphttps',
// 0到20位的英文字符和数字
enNum0to20: /^[a-z0-9A-Z]{0,20}$/,
enNum0to20Msg: '20',
// 2到100位的中英文字符和空格
cnEnSpace2to100: /^[a-zA-Z\u4E00-\u9FA5\s*]{2,100}$/,
cnEnSpace2to100Msg: '2100',
// 数字和换行符
numLinefeed: /^[0-9\n*]+$/,
numLinefeedMsg: '',
// 255位以内的字符
char0to255: /^.{0,255}$/,
char0to255Msg: '255',
required: function(min, max) {
let rule = [{ required: true, message: '', trigger: 'blur' }]
if (min) {
let r = { min: min, message: '' + min + '' }
rule.push(r)
}
if (max) {
let m = { max: max, message: '' + max + '' }
rule.push(m)
}
return rule
},
select: function() {
let rule = [{ required: true, message: '', trigger: 'change' }]
return rule
},
checked: function(min, max) {
let rule = [{ required: true, type: 'array', message: '', trigger: 'change' }]
if (min) {
let r = { type: 'array', min: min, message: '' + min + '项' }
rule.push(r)
}
if (max) {
let m = { type: 'array', max: max, message: '' + max + '项' }
rule.push(m)
}
return rule
}
}
/**
* @description 255
*/
export const validateOrder = function(rule, value, callback) {
if (parseInt(value) > 255) {
return callback(new Error('255'))
} else {
callback()
}
}

View File

@ -145,7 +145,6 @@ function generateChildRouters (data) {
component: componentPath,
//component: resolve => require(['@/' + component+'.vue'], resolve),
hidden:item.hidden,
//component:()=> import(`@/views/${item.component}.vue`),
meta: {
title:item.meta.title ,
icon: item.meta.icon,

View File

@ -10,6 +10,10 @@
<j-vxe-demo2/>
</a-tab-pane>
<a-tab-pane tab="联动示例" key="3" forceRender>
<j-vxe-demo3/>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
@ -17,10 +21,11 @@
<script>
import JVxeDemo1 from '@views/jeecg/JVxeDemo/JVxeDemo1'
import JVxeDemo2 from '@views/jeecg/JVxeDemo/JVxeDemo2'
import JVxeDemo3 from '@views/jeecg/JVxeDemo/JVxeDemo3'
export default {
name: 'JVXETableDemo',
components: {JVxeDemo2, JVxeDemo1},
components: {JVxeDemo2, JVxeDemo1,JVxeDemo3},
data() {
return {}
},

View File

@ -0,0 +1,132 @@
<template>
<j-vxe-table
ref="vTable"
toolbar
row-number
row-selection
keep-source
:height="484"
:dataSource="dataSource"
:columns="columns"
@valueChange="handleValueChange"
/>
</template>
<script>
import moment from 'moment'
import { randomNumber, randomUUID } from '@/utils/util'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
export default {
name: 'JVxeDemo2',
data() {
return {
columns: [
{
title: '//',
key: 's1',
type: JVXETypes.select,
width: '240px',
options: [],
placeholder: '${title}'
},
{
title: '市',
key: 's2',
type: JVXETypes.select,
width: '240px',
options: [],
placeholder: '${title}'
},
{
title: '/',
key: 's3',
type: JVXETypes.select,
width: '240px',
options: [],
placeholder: '${title}'
}
],
dataSource: [],
mockData: [
{ text: '', value: '110000', parent: null },
{ text: '', value: '120000', parent: null },
{ text: '', value: '130000', parent: null },
{ text: '', value: '310000', parent: null },
{ text: '', value: '110100', parent: '110000' },
{ text: '', value: '120100', parent: '120000' },
{ text: '', value: '130100', parent: '130000' },
{ text: '', value: '130200', parent: '130000' },
{ text: '', value: '130300', parent: '130000' },
{ text: '', value: '310100', parent: '310000' },
{ text: '', value: '110101', parent: '110100' },
{ text: '西', value: '110102', parent: '110100' },
{ text: '', value: '110105', parent: '110100' },
{ text: '', value: '120101', parent: '120100' },
{ text: '', value: '120102', parent: '120100' },
{ text: '西', value: '120103', parent: '120100' },
{ text: '', value: '310101', parent: '310100' },
{ text: '', value: '310104', parent: '310100' },
{ text: '', value: '310105', parent: '310100' },
{ text: '', value: '130102', parent: '130100' },
{ text: '西', value: '130104', parent: '130100' },
{ text: '', value: '130105', parent: '130100' },
{ text: '', value: '130202', parent: '130200' },
{ text: '', value: '130203', parent: '130200' },
{ text: '', value: '130204', parent: '130200' },
{ text: '', value: '130302', parent: '130300' },
{ text: '', value: '130303', parent: '130300' },
{ text: '', value: '130304', parent: '130300' },
]
}
},
created() {
// 初始化数据
this.columns[0].options = this.request(null)
},
methods: {
request(parentId) {
return this.mockData.filter(i => i.parent === parentId)
},
/** 当选项被改变时,联动其他组件 */
handleValueChange(event) {
const { type, row, column, value, target } = event
console.log("event",event)
if (type === JVXETypes.select) {
// 第一列
if (column.key === 's1') {
// 设置第二列的 options
console.log('this.request(value)::',this.request(value))
target.$refs.vxe.columns[3].options = this.request(value)
// 清空后两列的数据
target.setValues([{
rowKey: row.id,
values: { s2: '', s3: '' }
}])
target.$refs.vxe.columns[4].options = []
} else
// 第二列
if (column.key === 's2') {
target.$refs.vxe.columns[4].options = this.request(value)
target.setValues([{
rowKey: row.id,
values: { s3: '' }
}])
}
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,215 @@
<template>
<a-card :bordered="false">
<!-- -->
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="24">
<a-col :md="6" :sm="24">
<a-form-item label="订单号">
<a-input placeholder="请输入订单号" v-model="queryParam.orderCode"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-form-item label="订单类型">
<a-select placeholder="请输入订单类型" v-model="queryParam.ctype">
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<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-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 -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i>
<span></span>
<a style="font-weight: 600">
{{ selectedRowKeys.length }}
</a>
<span></span>
<a style="margin-left: 24px" @click="onClearSelected"></a>
</div>
<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>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a></a>
</a-popconfirm>
</a-menu-item>
</a-menu>
</a-dropdown>
</span>
</a-table>
</div>
<!-- table-end -->
<!-- -->
<jeecg-order-modal-for-j-vextable ref="modalForm" @ok="modalFormOk"></jeecg-order-modal-for-j-vextable>
</a-card>
</template>
<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JeecgOrderModalForJVextable from './modules/JeecgOrderModalForJVexTable'
export default {
name: 'JeecgOrderMainListForJVxeTable',
mixins: [JeecgListMixin],
components: {
JeecgOrderModalForJVextable
},
data() {
return {
description: '',
// 请求参数
url: {
list: '/test/jeecgOrderMain/list',
delete: '/test/jeecgOrderMain/delete',
deleteBatch: '/test/jeecgOrderMain/deleteBatch'
},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key: 'rowIndex',
width: 60,
align: 'center',
customRender: function(t, r, index) {
return parseInt(index) + 1
}
},
{
title: '',
align: 'center',
dataIndex: 'orderCode'
},
{
title: '',
align: 'center',
dataIndex: 'ctype',
customRender: (text) => {
let re = ''
if (text === '1') {
re = ''
} else if (text === '2') {
re = ''
}
return re
}
},
{
title: '',
align: 'center',
dataIndex: 'orderDate'
},
{
title: '',
align: 'center',
dataIndex: 'orderMoney'
},
{
title: '',
align: 'center',
dataIndex: 'content'
},
{
title: '',
dataIndex: 'action',
align: 'center',
scopedSlots: { customRender: 'action' }
}
]
}
},
methods: {
initDictConfig() {
}
}
}
</script>
<style scoped>
.ant-card-body .table-operator {
margin-bottom: 18px;
}
.ant-table-tbody .ant-table-row td {
padding-top: 15px;
padding-bottom: 15px;
}
.anty-row-operator button {
margin: 0 5px
}
.ant-btn-danger {
background-color: #ffffff
}
.ant-modal-cust-warp {
height: 100%
}
.ant-modal-cust-warp .ant-modal-body {
height: calc(100% - 110px) !important;
overflow-y: auto
}
.ant-modal-cust-warp .ant-modal-content {
height: 90% !important;
overflow-y: hidden
}
</style>

View File

@ -7,80 +7,47 @@
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model" :rules="validatorRules">
<a-form-model-item label="姓名" required prop="name" hasFeedback>
<a-input v-model="model.name" placeholder="请输入姓名"/>
</a-form-model-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="姓名"
hasFeedback >
<a-input placeholder="请输入姓名" v-decorator="['name', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="关键词"
hasFeedback >
<a-input placeholder="请输入关键词" v-decorator="['keyWord', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="打卡时间"
hasFeedback >
<a-date-picker showTime format="YYYY-MM-DD HH:mm:ss" v-decorator="[ 'punchTime', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="性别">
<!-- <a-select v-decorator="['sex', {}]" placeholder="请选择性别">
<a-select-option value=""></a-select-option>
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>-->
<j-dict-select-tag type="radio" v-decorator="['sex', {}]" :trigger-change="true" dictCode="sex"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="年龄"
hasFeedback >
<a-input placeholder="请输入年龄" v-decorator="['age', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="生日"
hasFeedback >
<a-date-picker v-decorator="[ 'birthday', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="邮箱"
hasFeedback >
<a-input placeholder="请输入邮箱" v-decorator="['email', {}]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="个人简介"
hasFeedback >
<a-input placeholder="请输入个人简介" v-decorator="['content', {}]" />
</a-form-item>
<a-form-model-item label="关键词" prop="keyWord" hasFeedback>
<a-input v-model="model.keyWord" placeholder="请输入关键词"/>
</a-form-model-item>
</a-form>
<a-form-model-item label="打卡时间" prop="punchTime" hasFeedback>
<a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" v-model="model.punchTime" />
</a-form-model-item>
<a-form-model-item label="性别" prop="sex" hasFeedback>
<j-dict-select-tag type="radio" v-model="model.sex" :trigger-change="true" dictCode="sex"/>
</a-form-model-item>
<a-form-model-item label="年龄" prop="age" hasFeedback>
<a-input placeholder="请输入年龄" v-model="model.age"/>
</a-form-model-item>
<a-form-model-item label="生日" prop="age" hasFeedback>
<a-date-picker valueFormat="YYYY-MM-DD" v-model="model.birthday"/>
</a-form-model-item>
<a-form-model-item label="邮箱" prop="email" hasFeedback >
<a-input placeholder="请输入邮箱" v-model="model.email"/>
</a-form-model-item>
<a-form-model-item label="个人简介" prop="content" hasFeedback>
<a-input type="textarea" placeholder="请输入个人简介" v-model="model.content"/>
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import moment from "moment"
export default {
name: "JeecgDemoModal",
@ -89,18 +56,28 @@
title:"操作",
visible: false,
model: {},
layout: {
labelCol: { span: 3 },
wrapperCol: { span: 14 },
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
sm: { span: 3 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
name: [
{ required: true, message: '!' },
{ min: 2, max: 30, message: ' 2 30 ', trigger: 'blur' }
],
email: [
{ required: false, type: 'email', message: '', trigger: 'blur' }
]
},
url: {
add: "/test/jeecgDemo/add",
@ -115,26 +92,19 @@
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'name','keyWord','sex','age','email','content'))
//时间格式化
this.form.setFieldsValue({punchTime:this.model.punchTime?moment(this.model.punchTime,'YYYY-MM-DD HH:mm:ss'):null})
this.form.setFieldsValue({birthday:this.model.birthday?moment(this.model.birthday):null})
});
},
close () {
this.$refs.form.resetFields();
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -145,13 +115,7 @@
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
//时间格式化
formData.punchTime = formData.punchTime?formData.punchTime.format('YYYY-MM-DD HH:mm:ss'):null;
formData.birthday = formData.birthday?formData.birthday.format():null;
console.log(formData)
httpAction(httpurl,formData,method).then((res)=>{
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
@ -162,17 +126,12 @@
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
}
}
}
</script>

View File

@ -63,7 +63,7 @@
<a-table :columns="columns" :dataSource="data" :pagination="false" size="middle">
<template v-for="(col, i) in ['name', 'workId', 'department']" :slot="col" slot-scope="text, record, index">
<a-tooltip title="必填项" :defaultVisible="false" overlayStyle="{ color: 'red' }">
<a-tooltip title="必填项" :defaultVisible="false" :overlayStyle="{ color: 'red' }">
<a-input :key="col" v-if="record.editable" style="margin: -5px 0" :value="text" :placeholder="columns[i].title" @change="e => handlerRowChange(e.target.value, record.key, col)"/>
<template v-else>{{ text }}</template>
</a-tooltip>

View File

@ -8,53 +8,38 @@
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="orderMainModel" :rules="validatorRules">
<!-- -->
<a-row class="form-row" :gutter="16">
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单号">
<a-input placeholder="请输入订单号" v-decorator="['orderCode', {rules: [{ required: true, message: '请输入订单号!' }]}]" />
</a-form-item>
<a-form-model-item label="订单号" required prop="orderCode">
<a-input v-model="orderMainModel.orderCode" placeholder="请输入订单号"/>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单类型">
<a-select placeholder="请输入订单类型" v-decorator="['ctype',{}]">
<a-form-model-item label="订单类型" prop="ctype">
<a-select placeholder="请选择订单类型" v-model="orderMainModel.ctype" >
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-item>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单日期">
<a-date-picker showTime format="YYYY-MM-DD HH:mm:ss" v-decorator="[ 'orderDate',{}]"/>
</a-form-item>
<a-form-model-item label="订单日期" prop="orderDate">
<a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" v-model="orderMainModel.orderDate"/>
</a-form-model-item>
</a-col>
</a-row>
<a-row class="form-row" :gutter="16">
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单金额">
<a-input-number style="width: 200px" v-decorator="[ 'orderMoney', {}]" />
</a-form-item>
<a-form-model-item label="订单金额" prop="orderMoney">
<a-input-number style="width: 200px" v-model="orderMainModel.orderMoney"/>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单备注">
<a-input placeholder="请输入订单备注" v-decorator="['content', {}]" />
</a-form-item>
<a-form-model-item label="订单备注" prop="content">
<a-input placeholder="请输入订单备注" v-model="orderMainModel.content" />
</a-form-model-item>
</a-col>
</a-row>
@ -65,47 +50,49 @@
<a-row type="flex" style="margin-bottom:10px" :gutter="16">
<a-col :span="5"></a-col>
<a-col :span="5"></a-col>
<a-col :span="5"></a-col>
<a-col :span="5"></a-col>
<a-col :span="4"></a-col>
<a-col :span="6"></a-col>
<a-col :span="6"></a-col>
<a-col :span="2"></a-col>
</a-row>
<a-row type="flex" style="margin-bottom:10px" :gutter="16" v-for="(item, index) in orderMainModel.jeecgOrderCustomerList" :key="index">
<a-col :span="6" style="display: none">
<a-form-item>
<a-input placeholder="id" v-decorator="['jeecgOrderCustomerList['+index+'].id', {'initialValue':item.id}]" />
</a-form-item>
<a-form-model-item>
<a-input placeholder="id" v-model="item.id" />
</a-form-model-item>
</a-col>
<a-col :span="5">
<a-form-item>
<a-input placeholder="客户名" v-decorator="['jeecgOrderCustomerList['+index+'].name', {'initialValue':item.name,rules: [{ required: true, message: '请输入用户名!' }]}]" />
</a-form-item>
<a-form-model-item>
<a-input placeholder="客户名" v-model="item.name" />
</a-form-model-item>
</a-col>
<a-col :span="5">
<a-form-item>
<a-select placeholder="性别" v-decorator="['jeecgOrderCustomerList['+index+'].sex', {'initialValue':item.sex}]">
<a-form-model-item>
<a-select placeholder="性别" v-model="item.sex" >
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-item>
</a-form-model-item>
</a-col>
<a-col :span="5">
<a-form-item>
<a-input placeholder="身份证号" v-decorator="['jeecgOrderCustomerList['+index+'].idcard', {'initialValue':item.idcard,rules: [{ pattern: '^\\d{6}(18|19|20)?\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|[xX])$', message: '身份证号格式不对!' }]}]"/>
</a-form-item>
<a-col :span="6">
<a-form-model-item :prop="'jeecgOrderCustomerList.' + index + '.idcard'" :rules="[{required: true,message: '请输入身份证号',trigger: 'blur'},{ pattern: rules.IDCard, message: '身份证号格式不对!' }]">
<a-input placeholder="身份证号" v-model="item.idcard" />
</a-form-model-item>
</a-col>
<a-col :span="5">
<a-form-item>
<a-input placeholder="手机号" v-decorator="['jeecgOrderCustomerList['+index+'].telphone', {'initialValue':item.telphone,rules: [{ pattern: '^1(3|4|5|7|8)\\d{9}$', message: '手机号格式不对!' }]}]"/>
</a-form-item>
<a-col :span="6">
<a-form-model-item :prop="'jeecgOrderCustomerList.' + index + '.telphone'" :rules="rules.mobile">
<a-input placeholder="手机号" v-model="item.telphone"/>
</a-form-model-item>
</a-col>
<a-col :span="4">
<a-form-item>
<a-button @click="addRowCustom" icon="plus"></a-button>&nbsp;
<a-button @click="delRowCustom(index)" icon="minus"></a-button>
</a-form-item>
<a-col :span="2">
<a-form-model-item>
<a-icon type="minus-circle" @click="delRowCustom(index)" style="fontSize :20px"/>
</a-form-model-item>
</a-col>
</a-row>
<a-button type="dashed" style="width: 98%;margin-top: 10px" @click="addRowCustom">
<a-icon type="plus" />
</a-button>
</div>
</a-tab-pane>
@ -118,32 +105,34 @@
</a-row>
<a-row type="flex" style="margin-bottom:10px" :gutter="16" v-for="(item, index) in orderMainModel.jeecgOrderTicketList" :key="index">
<a-col :span="6" style="display: none">
<a-form-item>
<a-input placeholder="id" v-decorator="['jeecgOrderTicketList['+index+'].id', {'initialValue':item.id}]" />
</a-form-item>
<a-form-model-item>
<a-input placeholder="id" v-model="item.id" />
</a-form-model-item>
</a-col>
<a-col :span="6">
<a-form-item>
<a-input placeholder="航班号" v-decorator="['jeecgOrderTicketList['+index+'].ticketCode', {'initialValue':item.ticketCode,rules: [{ required: true, message: '请输入航班号!' }]}]" />
</a-form-item>
<a-form-model-item :prop="'jeecgOrderTicketList.' + index + '.ticketCode'" :rules="{required: true,message: '请输入航班号',trigger: 'blur'}">
<a-input placeholder="航班号" v-model="item.ticketCode"/>
</a-form-model-item>
</a-col>
<a-col :span="6">
<a-form-item>
<j-date placeholder="航班时间" :trigger-change="true" v-decorator="['jeecgOrderTicketList['+index+'].tickectDate', {'initialValue':item.tickectDate}]"></j-date>
</a-form-item>
<a-form-model-item>
<a-date-picker placeholder="航班时间" valueFormat="YYYY-MM-DD" v-model="item.tickectDate" />
</a-form-model-item>
</a-col>
<a-col :span="6">
<a-form-item>
<a-button @click="addRowTicket" icon="plus"></a-button>&nbsp;
<a-button @click="delRowTicket(index)" icon="minus"></a-button>
</a-form-item>
<a-form-model-item>
<a-icon type="minus-circle" @click="delRowTicket(index)" style="fontSize :20px"/>
</a-form-model-item>
</a-col>
</a-row>
<a-button type="dashed" style="width: 98%;margin-top: 10px" @click="addRowTicket">
<a-icon type="plus" />
</a-button>
</div>
</a-tab-pane>
</a-tabs>
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
@ -151,9 +140,6 @@
<script>
import { httpAction,getAction } from '@/api/manage'
import JDate from '@/components/jeecg/JDate'
import pick from 'lodash.pick'
import moment from "moment"
export default {
name: "JeecgOrderMainModal",
components: {
@ -163,8 +149,10 @@
return {
title:"操作",
visible: false,
orderMainModel: {jeecgOrderCustomerList: [{}],
jeecgOrderTicketList: [{}]},
orderMainModel: {
jeecgOrderCustomerList: [{}],
jeecgOrderTicketList: [{}]
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
@ -173,10 +161,11 @@
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
orderCode: [
{ required: true, message: '', trigger: 'blur' }
]
},
url: {
add: "/test/jeecgOrderMain/add",
@ -193,10 +182,10 @@
this.edit({});
},
edit (record) {
this.form.resetFields();
this.orderMainModel = Object.assign({}, record);
this.orderMainModel.jeecgOrderCustomerList = [{}];
this.orderMainModel.jeecgOrderTicketList = [{}];
this.orderMainModel = Object.assign({
jeecgOrderCustomerList: [{}],
jeecgOrderTicketList: [{}]
}, record);
//--------------------------------------------------------
//初始化明细表数据
console.log(this.orderMainModel.id)
@ -217,12 +206,7 @@
}
})
}
//--------------------------------------------------------
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.orderMainModel,'orderCode','ctype','orderMoney','content'))
this.form.setFieldsValue({orderDate:this.orderMainModel.orderDate?moment(this.orderMainModel.orderDate):null}) //时间格式化
});
},
close () {
this.$emit('close');
@ -231,8 +215,8 @@
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -241,18 +225,9 @@
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
method = 'put';
}
let orderMainData = Object.assign(this.orderMainModel, values);
//时间格式化
orderMainData.orderDate = orderMainData.orderDate?orderMainData.orderDate.format('YYYY-MM-DD HH:mm:ss'):null;
let formData = {
...orderMainData,
jeecgOrderCustomerList: orderMainData.jeecgOrderCustomerList,
jeecgOrderTicketList: orderMainData.jeecgOrderTicketList
}
console.log(formData)
httpAction(httpurl,formData,method).then((res)=>{
httpAction(httpurl,this.orderMainModel,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
@ -276,9 +251,8 @@
},
delRowCustom (index) {
console.log(index)
let all = this.form.getFieldsValue()
let all = this.orderMainModel
all['jeecgOrderCustomerList'].splice(index,1);
this.form.setFieldsValue(all)
this.orderMainModel.jeecgOrderCustomerList.splice(index,1);
this.$forceUpdate();
},
@ -289,9 +263,8 @@
},
delRowTicket (index) {
console.log(index)
let all = this.form.getFieldsValue()
let all = this.orderMainModel
all['jeecgOrderTicketList'].splice(index,1);
this.form.setFieldsValue(all)
this.orderMainModel.jeecgOrderTicketList.splice(index,1);
this.$forceUpdate();
},

View File

@ -9,58 +9,41 @@
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model" >
<!-- -->
<a-row class="form-row" :gutter="0">
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单号">
<a-input
placeholder="请输入订单号"
v-decorator="['orderCode', {rules: [{ required: true, message: '请输入订单号!' }]}]"/>
</a-form-item>
<a-form-model-item label="订单号" prop="orderCode" :rules="[{ required: true, message: '请输入订单号!' }]">
<a-input placeholder="请输入订单号" v-model="model.orderCode"/>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单类型">
<a-select placeholder="请选择订单类型" v-decorator="['ctype',{}]">
<a-form-model-item label="订单类型">
<a-select placeholder="请选择订单类型" v-model="model.ctype">
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-item>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单日期">
<a-date-picker showTime format="YYYY-MM-DD HH:mm:ss" style="width: 100%" v-decorator="[ 'orderDate',{}]"/>
</a-form-item>
<a-form-model-item label="订单日期">
<a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" style="width: 100%" v-model="model.orderDate"/>
</a-form-model-item>
</a-col>
</a-row>
<a-row class="form-row" :gutter="0">
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单金额">
<a-input-number placeholder="请输入订单金额" style="width: 100%" v-decorator="[ 'orderMoney', {}]"/>
</a-form-item>
<a-form-model-item label="订单金额">
<a-input-number placeholder="请输入订单金额" style="width: 100%" v-model="model.orderMoney"/>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单备注">
<a-input placeholder="请输入订单备注" v-decorator="['content', {}]"/>
</a-form-item>
<a-form-model-item label="订单备注">
<a-input placeholder="请输入订单备注" v-model="model.content"/>
</a-form-model-item>
</a-col>
</a-row>
</a-form>
</a-form-model>
<!-- -->
<a-tabs v-model="activeKey" @change="handleChangeTabs">
@ -100,11 +83,9 @@
<script>
import JEditableTable from '@/components/jeecg/JEditableTable'
import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
import { FormTypes, VALIDATE_NO_PASSED, getRefPromise, validateFormModelAndTables } from '@/utils/JEditableTableUtil'
import { httpAction, getAction } from '@/api/manage'
import JDate from '@/components/jeecg/JDate'
import pick from 'lodash.pick'
import moment from 'moment'
export default {
name: 'JeecgOrderModalForJEditableTable',
@ -115,7 +96,6 @@
return {
title: '',
visible: false,
form: this.$form.createForm(this),
confirmLoading: false,
model: {},
labelCol: {
@ -235,15 +215,7 @@
edit(record) {
this.visible = true
this.activeKey = '1'
this.form.resetFields()
this.model = Object.assign({}, record)
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'orderCode', 'ctype', 'orderMoney', 'content'))
//时间格式化
this.form.setFieldsValue({ orderDate: this.model.orderDate ? moment(this.model.orderDate) : null })
})
// 加载子表数据
if (this.model.id) {
let params = { id: this.model.id }
@ -259,6 +231,7 @@
editableTables[1].initialize()
})
this.$emit('close')
this.$refs.form.resetFields();
},
/** 查询某个tab的数据 */
requestTableData(url, params, tab) {
@ -286,7 +259,7 @@
validateFields() {
this.getAllTable().then(tables => {
/** 一次性验证主表和所有的次表 */
return validateFormAndTables(this.form, tables)
return validateFormModelAndTables(this.$refs.form,this.model, tables)
}).then(allValues => {
let formData = this.classifyIntoFormData(allValues)
// 发起请求
@ -303,8 +276,6 @@
/** 整理成formData */
classifyIntoFormData(allValues) {
let orderMain = Object.assign(this.model, allValues.formValue)
//时间格式化
orderMain.orderDate = orderMain.orderDate ? orderMain.orderDate.format('YYYY-MM-DD HH:mm:ss') : null
return {
...orderMain, // 展开
jeecgOrderCustomerList: allValues.tablesValue[0].values,

View File

@ -0,0 +1,312 @@
<template>
<a-modal
:title="title"
:width="1200"
:visible="visible"
:destroyOnClose="true"
:maskClosable="false"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model" >
<!-- -->
<a-row class="form-row" :gutter="0">
<a-col :lg="8">
<a-form-model-item label="订单号" prop="orderCode" :rules="[{ required: true, message: '请输入订单号!' }]">
<a-input placeholder="请输入订单号" v-model="model.orderCode"/>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-model-item label="订单类型">
<a-select placeholder="请选择订单类型" v-model="model.ctype">
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-model-item label="订单日期">
<a-date-picker showTime valueFormat="YYYY-MM-DD HH:mm:ss" style="width: 100%" v-model="model.orderDate"/>
</a-form-model-item>
</a-col>
</a-row>
<a-row class="form-row" :gutter="0">
<a-col :lg="8">
<a-form-model-item label="订单金额">
<a-input-number placeholder="请输入订单金额" style="width: 100%" v-model="model.orderMoney"/>
</a-form-model-item>
</a-col>
<a-col :lg="8">
<a-form-model-item label="订单备注">
<a-input placeholder="请输入订单备注" v-model="model.content"/>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
<!-- -->
<a-tabs v-model="activeKey" @change="handleChangeTabs">
<a-tab-pane tab="客户信息" key="1" :forceRender="true">
<j-vxe-table
ref="editableTable1"
toolbar
row-number
row-selection
keep-source
:height="300"
:loading="table1.loading"
:dataSource="table1.dataSource"
:columns="table1.columns"
style="margin-top: 8px;"/>
</a-tab-pane>
<a-tab-pane tab="机票信息" key="2" :forceRender="true">
<j-vxe-table
ref="editableTable2"
toolbar
row-number
row-selection
keep-source
:height="300"
:loading="table2.loading"
:dataSource="table2.dataSource"
:columns="table2.columns"
style="margin-top: 8px;"/>
</a-tab-pane>
</a-tabs>
</a-spin>
</a-modal>
</template>
<script>
import JEditableTable from '@/components/jeecg/JEditableTable'
import { VALIDATE_FAILED, getRefPromise, validateFormModelAndTables } from '@/components/jeecg/JVxeTable/utils/vxeUtils'
import { httpAction, getAction } from '@/api/manage'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import JDate from '@/components/jeecg/JDate'
export default {
name: 'JeecgOrderModalForJvexTable',
components: {
JDate, JEditableTable
},
data() {
return {
title: '',
visible: false,
confirmLoading: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 24 - 6 }
},
activeKey: '1',
// 客户信息
table1: {
loading: false,
dataSource: [],
columns: [
{
title: '',
key: 'name',
width: '24%',
type: JVXETypes.input,
defaultValue: '',
placeholder: '${title}',
validateRules: [{ required: true, message: '${title}' }]
},
{
title: '',
key: 'sex',
width: '18%',
type: JVXETypes.select,
options: [ // 下拉选项
{ title: '男', value: '1' },
{ title: '女', value: '2' }
],
defaultValue: '',
placeholder: '${title}'
},
{
title: '',
key: 'idcard',
width: '24%',
type: JVXETypes.input,
defaultValue: '',
placeholder: '${title}',
validateRules: [{
pattern: '^\\d{6}(18|19|20)?\\d{2}(0[1-9]|1[012])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|[xX])$',
message: '${title}'
}]
},
{
title: '',
key: 'telphone',
width: '24%',
type: JVXETypes.input,
defaultValue: '',
placeholder: '${title}',
validateRules: [{
pattern: '^1(3|4|5|7|8)\\d{9}$',
message: '${title}'
}]
}
]
},
// 机票信息
table2: {
loading: false,
dataSource: [],
columns: [
{
title: '',
key: 'ticketCode',
width: '40%',
type: JVXETypes.input,
defaultValue: '',
placeholder: '${title}',
validateRules: [{ required: true, message: '${title}' }]
},
{
title: '',
key: 'tickectDate',
width: '30%',
type: JVXETypes.date,
placeholder: '${title}',
defaultValue: ''
}
]
},
url: {
add: '/test/jeecgOrderMain/add',
edit: '/test/jeecgOrderMain/edit',
orderCustomerList: '/test/jeecgOrderMain/queryOrderCustomerListByMainId',
orderTicketList: '/test/jeecgOrderMain/queryOrderTicketListByMainId'
}
}
},
created() {
},
methods: {
// 获取所有的editableTable实例
getAllTable() {
return Promise.all([
getRefPromise(this, 'editableTable1'),
getRefPromise(this, 'editableTable2')
])
},
add() {
// 默认新增一条数据
this.getAllTable().then(editableTables => {
//editableTables[0].add()
//editableTables[1].add()
})
this.edit({})
},
edit(record) {
this.visible = true
this.activeKey = '1'
this.model = Object.assign({}, record)
// 加载子表数据
if (this.model.id) {
let params = { id: this.model.id }
this.requestTableData(this.url.orderCustomerList, params, this.table1)
this.requestTableData(this.url.orderTicketList, params, this.table2)
}
},
close() {
this.visible = false
this.getAllTable().then(editableTables => {
this.table1.dataSource=[];
this.table2.dataSource=[];
})
this.$emit('close')
},
/** 查询某个tab的数据 */
requestTableData(url, params, tab) {
tab.loading = true
getAction(url, params).then(res => {
tab.dataSource = res.result || []
}).finally(() => {
tab.loading = false
})
},
handleOk() {
this.validateFields()
},
handleCancel() {
this.close()
},
/** ATab 选项卡切换事件 */
handleChangeTabs(key) {
getRefPromise(this, `editableTable${key}`).then(editableTable => {
editableTable.resetScrollTop()
})
},
/** 触发表单验证 */
validateFields() {
this.getAllTable().then(tables => {
/** 一次性验证主表和所有的次表 */
return validateFormModelAndTables(this.$refs.form,this.model, tables)
}).then(allValues => {
let formData = this.classifyIntoFormData(allValues)
// 发起请求
return this.requestAddOrEdit(formData)
}).catch(e => {
if (e.error === VALIDATE_FAILED) {
// 如果有未通过表单验证的子表就自动跳转到它所在的tab
this.activeKey = e.index == null ? this.activeKey : (e.index + 1).toString()
} else {
console.error(e)
}
})
},
/** 整理成formData */
classifyIntoFormData(allValues) {
let orderMain = Object.assign(this.model, allValues.formValue)
return {
...orderMain, // 展开
jeecgOrderCustomerList: allValues.tablesValue[0].tableData,
jeecgOrderTicketList: allValues.tablesValue[1].tableData
}
},
/** 发起新增或修改的请求 */
requestAddOrEdit(formData) {
let url = this.url.add, method = 'post'
if (this.model.id) {
url = this.url.edit
method = 'put'
}
this.confirmLoading = true
httpAction(url, formData, method).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.confirmLoading = false
})
}
}
}
</script>
<style scoped>
</style>

View File

@ -11,64 +11,64 @@
<!-- -->
<a-spin :spinning="confirmLoading" v-if="editStatus">
<a-form :form="form">
<a-form-item
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="客户姓名"
prop="name"
required
hasFeedback>
<a-input placeholder="请输入客户姓名" v-decorator="['name', {rules: [{ required: true, message: '请输入客户姓名!' }]}]"
:readOnly="disableSubmit"/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入客户姓名" v-model="model.name" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="性别"
hasFeedback>
<a-select v-decorator="['sex', {}]" placeholder="请选择性别">
<a-select v-model="model.sex" placeholder="请选择性别">
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-item>
<a-form-item
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="身份证号码"
prop="idcard"
hasFeedback>
<a-input placeholder="请输入身份证号码" v-decorator="['idcard', validatorRules.idcard]" :readOnly="disableSubmit"/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入身份证号码" v-model="model.idcard" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="身份证扫描件"
hasFeedback>
<j-image-upload text="上传" v-model="fileList" :isMultiple="true"></j-image-upload>
</a-form-item>
<a-form-item
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="联系方式"
prop="telphone"
hasFeedback>
<a-input v-decorator="[ 'telphone', validatorRules.telphone]" :readOnly="disableSubmit"/>
</a-form-item>
<a-form-item
<a-input v-model="model.telphone" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单号码"
v-model="this.orderId"
:hidden="hiding"
hasFeedback>
<a-input v-decorator="[ 'orderId', {}]" disabled="disabled"/>
</a-form-item>
</a-form>
<a-input v-model="model.orderId" disabled="disabled"/>
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import {httpAction} from '@/api/manage'
import pick from 'lodash.pick'
import Vue from 'vue'
import {ACCESS_TOKEN} from "@/store/mutation-types"
import JImageUpload from '../../../../components/jeecg/JImageUpload'
@ -89,59 +89,6 @@
xs: {span: 24},
sm: {span: 16},
},
// 表头
columns: [
{
title: '',
align: "center",
dataIndex: 'name',
},
{
title: '',
align: "center",
dataIndex: 'sex',
},
{
title: '',
align: "center",
dataIndex: 'idcard',
},
{
title: '',
align: "center",
dataIndex: 'idcardPic',
},
{
title: '',
dataIndex: 'telphone',
align: "center",
},
{
title: '',
dataIndex: 'orderId',
align: "center",
},
{
title: '',
dataIndex: 'createBy',
align: "center",
},
{
title: '',
dataIndex: 'createTime',
align: "center",
},
{
title: '',
dataIndex: 'updateBy',
align: "center",
},
{
title: '',
dataIndex: 'updateTime',
align: "center",
},
],
fileList: [],
disableSubmit: false,
selectedRowKeys: [],
@ -155,7 +102,6 @@
addStatus: false,
editStatus: false,
confirmLoading: false,
form: this.$form.createForm(this),
url: {
add: "/test/order/addCustomer",
edit: "/test/order/editCustomer",
@ -163,8 +109,9 @@
getOrderCustomerList: "/test/order/listOrderCustomerByMainId",
},
validatorRules: {
telphone: {rules: [{validator: this.validateMobile}]},
idcard: {rules: [{validator: this.validateIdCard}]}
name :[{required: true, message: '!'}],
telphone: [{validator: this.validateMobile}],
idcard: [{validator: this.validateIdCard}]
},
}
},
@ -181,7 +128,6 @@
add(orderId) {
this.hiding = true;
if (orderId) {
this.orderId = orderId;
this.edit({orderId}, '');
} else {
this.$message.warning("请选择一个客户信息");
@ -202,16 +148,11 @@
this.disableSubmit = false;
}
this.form.resetFields();
this.orderId = record.orderId;
this.model = Object.assign({}, record);
if (record.id) {
this.hiding = false;
this.addStatus = false;
this.editStatus = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'id', 'name', 'sex', 'idcard','telphone', 'orderId', 'createBy', 'createTime', 'updateBy', 'updateTime'))
});
setTimeout(() => {
this.fileList = record.idcardPic
}, 5)
@ -226,12 +167,13 @@
this.visible = false;
this.picUrl = "";
this.fileList=[];
this.$refs.form.resetFields();
},
handleOk() {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -242,9 +184,7 @@
httpurl += this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
console.log(formData);
formData.orderId = this.orderId;
let formData = Object.assign({}, this.model);
if(this.fileList != '') {
formData.idcardPic = this.fileList;
}else{
@ -261,6 +201,8 @@
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},

View File

@ -8,46 +8,45 @@
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :model="orderMainModel" :rules="validatorRules">
<!-- -->
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="orderCode"
label="订单号"
required
hasFeedback>
<a-input
placeholder="请输入订单号"
v-decorator="['orderCode', {rules: [{ required: true, message: '请输入订单号!' }]}]"
/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入订单号" v-model="orderMainModel.orderCode" />
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单类型">
<a-select placeholder="请输入订单类型" v-decorator="['ctype',{}]">
<a-select placeholder="请输入订单类型" v-model="orderMainModel.ctype">
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-item>
<a-form-item
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单日期">
<a-date-picker showTime format='YYYY-MM-DD HH:mm:ss' v-decorator="[ 'orderDate',{}]"/>
</a-form-item>
<a-form-item
<a-date-picker showTime valueFormat='YYYY-MM-DD HH:mm:ss' v-model="orderMainModel.orderDate"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单金额">
<a-input-number style="width: 200px" v-decorator="[ 'orderMoney', {}]"/>
</a-form-item>
<a-form-item
<a-input-number style="width: 200px" v-model="orderMainModel.orderMoney" />
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单备注">
<a-input placeholder="请输入订单备注" v-decorator="['content', {}]"/>
</a-form-item>
</a-form>
<a-input placeholder="请输入订单备注" v-model="orderMainModel.content"/>
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
@ -80,8 +79,11 @@
sm: {span: 16},
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {},
validatorRules: {
orderCode: [
{ required: true, message: '!' }
]
},
url: {
add: "/test/order/add",
edit: "/test/order/edit",
@ -95,26 +97,21 @@
this.edit({});
},
edit(record) {
this.form.resetFields();
this.orderMainModel = Object.assign({}, record);
//初始化明细表数据
console.log(this.orderMainModel.id)
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.orderMainModel, 'orderCode', 'ctype', 'orderMoney', 'content'))
this.form.setFieldsValue({orderDate: this.orderMainModel.orderDate ? moment(this.orderMainModel.orderDate) : null}) //时间格式化
});
console.log(this.orderMainModel)
//初始化明细表数据
this.visible = true;
},
close() {
this.$emit('close');
this.visible = false;
this.$refs.form.resetFields();
},
handleOk() {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -125,15 +122,8 @@
httpurl += this.url.edit;
method = 'put';
}
let orderMainData = Object.assign(this.orderMainModel, values);
//时间格式化
orderMainData.orderDate = orderMainData.orderDate ? orderMainData.orderDate.format('YYYY-MM-DD HH:mm:ss') : null;
let formData = {
...orderMainData
}
console.log(formData)
httpAction(httpurl, formData, method).then((res) => {
httpAction(httpurl, this.orderMainModel, method).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.$emit('ok');
@ -144,6 +134,8 @@
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},

View File

@ -10,58 +10,56 @@
cancelText="关闭">
<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="ticketCode"
hasFeedback>
<a-input
placeholder="请输入航班号"
:readOnly="disableSubmit"
v-decorator="['ticketCode', {rules:[{ required: true,message: '请输入航班号!'}]}]"/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入航班号" :readOnly="disableSubmit" v-model="model.ticketCode"></a-input>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="航班时间"
prop="tickectDate"
hasFeedback>
<j-date :trigger-change="true" v-decorator="['tickectDate',{rules:[{ required: true,message: '请输入航班号!'}]}]"></j-date>
</a-form-item>
<a-form-item
<j-date v-model="model.tickectDate"></j-date>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="订单号码"
v-model="this.orderId"
:hidden="hiding"
hasFeedback>
<a-input v-decorator="[ 'orderId', {}]" disabled="disabled"/>
</a-form-item>
<a-form-item
<a-input v-model="model.orderId" disabled="disabled"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="创建人"
:hidden="hiding"
hasFeedback>
<a-input v-decorator="[ 'createBy', {}]" :readOnly="disableSubmit"/>
</a-form-item>
<a-form-item
<a-input v-model="model.createBy" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="创建时间"
:hidden="hiding"
hasFeedback>
<a-input v-decorator="[ 'createTime', {}]" :readOnly="disableSubmit"/>
</a-form-item>
</a-form>
<a-input v-model="model.createTime" :readOnly="disableSubmit"/>
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import {httpAction} from '@/api/manage'
import pick from 'lodash.pick'
import moment from 'moment'
import JDate from '@/components/jeecg/JDate'
@ -89,8 +87,10 @@
orderId: '',
hiding: false,
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {},
validatorRules: {
ticketCode:[{required : true, message: '!'}],
tickectDate:[{required : true, message: '!'}]
},
url: {
add: '/test/order/addTicket',
edit: '/test/order/editTicket'
@ -121,23 +121,19 @@
this.hiding = true;
this.disableSubmit = false;
}
this.form.resetFields();
this.orderId = record.orderId;
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'ticketCode', 'tickectDate', 'orderId', 'createBy', 'createTime', 'updateBy', 'updateTime'))
})
},
close() {
this.$emit('close');
this.visible = false;
this.$refs.form.resetFields();
},
handleOk() {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -148,9 +144,8 @@
httpurl += this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
formData.mainId = this.orderId;
httpAction(httpurl, formData, method).then((res) => {
this.model.mainId = this.model.orderId;
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message);
that.$emit('ok')
@ -161,6 +156,8 @@
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},

View File

@ -74,14 +74,11 @@
<a-tabs defaultActiveKey="1">
<a-tab-pane tab="基本信息" key="1" >
<a-card :bordered="false" v-if="selectedKeys.length>0">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构名称">
<a-input placeholder="请输入机构/部门名称" v-decorator="['departName', validatorRules.departName ]"/>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="departName" label="机构名称">
<a-input placeholder="请输入机构/部门名称" v-model="model.departName" />
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
<a-tree-select
style="width:100%"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
@ -90,26 +87,20 @@
v-model="model.parentId"
placeholder="无">
</a-tree-select>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构编码">
<a-input disabled placeholder="请输入机构编码" v-decorator="['orgCode', validatorRules.orgCode ]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构类型">
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orgCode" label="机构编码">
<a-input disabled placeholder="请输入机构编码" v-model="model.orgCode" />
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orgCategory" label="机构类型">
<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>
</a-radio-group>
</template>
<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>
@ -118,32 +109,20 @@
</a-radio>
</a-radio-group>
</template>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="排序">
<a-input-number v-decorator="[ 'departOrder',{'initialValue':0}]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="手机号">
<a-input placeholder="请输入手机号" v-decorator="['mobile', {'initialValue':''}]"/>
</a-form-item>
<a-form-item
: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>
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="排序">
<a-input-number v-model="model.departOrder" />
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="手机号">
<a-input placeholder="请输入手机号" v-model="model.mobile" />
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="地址">
<a-input placeholder="请输入地址" v-model="model.address"/>
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="备注">
<a-textarea placeholder="请输入备注" v-model="model.memo"/>
</a-form-model-item>
</a-form-model>
<div class="anty-form-btn">
<a-button @click="emptyCurrForm" type="default" htmlType="button" icon="sync"></a-button>
<a-button @click="submitCurrForm" type="primary" htmlType="button" icon="form"></a-button>
@ -166,7 +145,6 @@
</template>
<script>
import DepartModal from './modules/DepartModal'
import pick from 'lodash.pick'
import {queryDepartTreeList, searchByKeywords, deleteByDepartId} from '@/api/api'
import {httpAction, deleteAction} from '@/api/manage'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
@ -240,11 +218,8 @@
selectedKeys: [],
autoIncr: 1,
currSelected: {},
allTreeKeys:[],
checkStrictly: true,
form: this.$form.createForm(this),
labelCol: {
xs: {span: 24},
sm: {span: 5}
@ -258,10 +233,10 @@
edges: []
},
validatorRules: {
departName: {rules: [{required: true, message: '/!'}]},
orgCode: {rules: [{required: true, message: '!'}]},
orgCategory: {rules: [{required: true, message: '!'}]},
mobile: {rules: [{validator: this.validateMobile}]}
departName: [{required: true, message: '/!'}],
orgCode: [{required: true, message: '!'}],
orgCategory:[{required: true, message: '!'}],
mobile:[{validator: this.validateMobile}]
},
url: {
delete: '/sys/sysDepart/delete',
@ -323,8 +298,6 @@
},
onExpand(expandedKeys) {
console.log('onExpand', expandedKeys)
// if not set autoExpandParent to false, if children expanded, parent can not collapse.
// or, you can remove all expanded children keys.
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
},
@ -337,7 +310,7 @@
this.dropTrigger = ''
}
},
// 右键店家下拉关闭下拉框
// 右键下拉关闭下拉框
closeDrop() {
this.dropTrigger = ''
},
@ -402,14 +375,13 @@
onCheck(checkedKeys, info) {
console.log('onCheck', checkedKeys, info)
this.hiding = false
//this.checkedKeys = checkedKeys.checked
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
if(this.checkStrictly){
this.checkedKeys = checkedKeys.checked;
}else{
this.checkedKeys = checkedKeys
}
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
},
onSelect(selectedKeys, e) {
console.log('selected', selectedKeys, e)
@ -431,10 +403,6 @@
}else{
this.orgCategoryDisabled = false;
}
this.$nextTick(() => {
this.form.getFieldDecorator('fax', {initialValue: ''})
this.form.setFieldsValue(pick(record, 'departName','orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
})
},
getCurrSelectedTitle() {
return !this.currSelected.title ? '' : this.currSelected.title
@ -443,7 +411,6 @@
this.hiding = true
this.checkedKeys = []
this.currSelected = {}
this.form.resetFields()
this.selectedKeys = []
this.$refs.departAuth.departId = ''
},
@ -457,16 +424,14 @@
this.currSelected.receiptTriggerType = value
},
submitCurrForm() {
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
if (!this.currSelected.id) {
this.$message.warning('!')
return
}
let formData = Object.assign(this.currSelected, values)
console.log('Received values of form: ', formData)
httpAction(this.url.edit, formData, 'put').then((res) => {
httpAction(this.url.edit, this.currSelected, 'put').then((res) => {
if (res.success) {
this.$message.success('!')
this.loadTree()
@ -478,12 +443,13 @@
})
},
emptyCurrForm() {
this.form.resetFields()
this.$refs.form.resetFields();
this.model={}
},
nodeSettingFormSubmit() {
this.form.validateFields((err, values) => {
if (!err) {
console.log('Received values of form: ', values)
this.$refs.form.validate(valid => {
if (valid) {
console.log('Received values of form: ', this.model)
}
})
},
@ -520,7 +486,7 @@
that.$message.success('!')
that.loadTree()
//删除后同步清空右侧基本信息内容
let orgCode=that.form.getFieldValue("orgCode");
let orgCode=that.model.orgCode;
if(orgCode && orgCode === that.rightClickSelectedOrgCode){
that.onClearSelected()
}
@ -552,7 +518,7 @@
}
}
},
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
expandAll () {
this.iExpandedKeys = this.allTreeKeys
},
@ -583,7 +549,7 @@
}
}
}
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
//---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------
},
created() {

View File

@ -0,0 +1,679 @@
<template xmlns:background-color="http://www.w3.org/1999/xhtml">
<a-row :gutter="10">
<a-col :md="12" :sm="24">
<a-card :bordered="false">
<!-- -->
<a-row style="margin-left: 14px">
<a-button @click="handleAdd(1)" type="primary"></a-button>
<a-button @click="handleAdd(2)" type="primary"></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-button title="删除多条数据" @click="batchDel" type="default"></a-button>
</a-row>
<div style="background: #fff;padding-left:16px;height: 100%; margin-top: 5px">
<a-alert type="info" :showIcon="true">
<div slot="message">
<span v-if="this.currSelected.title">{{ getCurrSelectedTitle() }}</span>
<a v-if="this.currSelected.title" style="margin-left: 10px" @click="onClearSelected"></a>
</div>
</a-alert>
<a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入部门名称"/>
<!-- -->
<a-col :md="10" :sm="24">
<template>
<a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">
<span style="user-select: none">
<a-tree
checkable
multiple
@select="onSelect"
@check="onCheck"
@rightClick="rightHandle"
:selectedKeys="selectedKeys"
:checkedKeys="checkedKeys"
:treeData="departTree"
:checkStrictly="checkStrictly"
:expandedKeys="iExpandedKeys"
:load-data="loadSubTree"
@expand="onExpand"/>
</span>
<!--,-->
<a-menu slot="overlay">
<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="closeDrop" key="3"></a-menu-item>
</a-menu>
</a-dropdown>
</template>
</a-col>
</div>
</a-card>
<!---- author:os_chengtgen -- date:20190827 -- for: =======------>
<div class="drawer-bootom-button">
<a-dropdown :trigger="['click']" placement="topCenter">
<a-menu slot="overlay">
<a-menu-item key="1" @click="switchCheckStrictly(1)"></a-menu-item>
<a-menu-item key="2" @click="switchCheckStrictly(2)"></a-menu-item>
<a-menu-item key="3" @click="checkALL"></a-menu-item>
<a-menu-item key="4" @click="cancelCheckALL"></a-menu-item>
<a-menu-item key="5" @click="expandAll"></a-menu-item>
<a-menu-item key="6" @click="closeAll"></a-menu-item>
</a-menu>
<a-button>
<a-icon type="up" />
</a-button>
</a-dropdown>
</div>
<!---- author:os_chengtgen -- date:20190827 -- for: =======------>
</a-col>
<a-col :md="12" :sm="24">
<a-tabs defaultActiveKey="1">
<a-tab-pane tab="基本信息" key="1" >
<a-card :bordered="false" v-if="selectedKeys.length>0">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构名称">
<a-input placeholder="请输入机构/部门名称" v-decorator="['departName', validatorRules.departName ]"/>
</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-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构编码">
<a-input disabled placeholder="请输入机构编码" v-decorator="['orgCode', validatorRules.orgCode ]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构类型">
<template v-if="orgCategoryDisabled">
<a-radio-group v-decorator="['orgCategory',validatorRules.orgCategory]" placeholder="请选择机构类型">
<a-radio value="1">
</a-radio>
</a-radio-group>
</template>
<template v-else>
<a-radio-group v-decorator="['orgCategory',validatorRules.orgCategory]" placeholder="请选择机构类型">
<a-radio value="2">
</a-radio>
<a-radio value="3">
</a-radio>
</a-radio-group>
</template>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="排序">
<a-input-number v-decorator="[ 'departOrder',{'initialValue':0}]"/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="手机号">
<a-input placeholder="请输入手机号" v-decorator="['mobile', {'initialValue':''}]"/>
</a-form-item>
<a-form-item
: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">
<a-button @click="emptyCurrForm" type="default" htmlType="button" icon="sync"></a-button>
<a-button @click="submitCurrForm" type="primary" htmlType="button" icon="form"></a-button>
</div>
</a-card>
<a-card v-else >
<a-empty>
<span slot="description"> ! </span>
</a-empty>
</a-card>
</a-tab-pane>
<a-tab-pane tab="部门权限" key="2" forceRender>
<depart-auth-modal ref="departAuth"/>
</a-tab-pane>
</a-tabs>
</a-col>
<depart-modal ref="departModal" @ok="loadTree"></depart-modal>
</a-row>
</template>
<script>
import DepartModal from './modules/DepartModal'
import pick from 'lodash.pick'
import {queryDepartTreeSync, searchByKeywords, deleteByDepartId} from '@/api/api'
import {httpAction, deleteAction} from '@/api/manage'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import DepartAuthModal from './modules/DepartAuthModal'
// 表头
const columns = [
{
title: '',
dataIndex: 'departName'
},
{
title: '',
align: 'center',
dataIndex: 'orgType'
},
{
title: '',
dataIndex: 'orgCode',
},
{
title: '',
dataIndex: 'mobile'
},
{
title: '',
dataIndex: 'fax'
},
{
title: '',
dataIndex: 'address'
},
{
title: '',
align: 'center',
dataIndex: 'departOrder'
},
{
title: '',
align: 'center',
dataIndex: 'action',
scopedSlots: {customRender: 'action'}
}
]
export default {
name: 'DepartList',
mixins: [JeecgListMixin],
components: {
DepartAuthModal,
DepartModal
},
data() {
return {
iExpandedKeys: [],
loading: false,
autoExpandParent: false,
currFlowId: '',
currFlowName: '',
disable: true,
treeData: [],
visible: false,
departTree: [],
departTreeAll: [],
loadedKeys: [],
allIds: [],
rightClickSelectedKey: '',
rightClickSelectedOrgCode: '',
hiding: true,
model: {},
dropTrigger: '',
depart: {},
columns: columns,
disableSubmit: false,
checkedKeys: [],
selectedKeys: [],
autoIncr: 1,
currSelected: {},
allTreeKeys:[],
checkStrictly: true,
form: this.$form.createForm(this),
labelCol: {
xs: {span: 24},
sm: {span: 5}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 16}
},
graphDatasource: {
nodes: [],
edges: []
},
validatorRules: {
departName: {rules: [{required: true, message: '/!'}]},
orgCode: {rules: [{required: true, message: '!'}]},
orgCategory: {rules: [{required: true, message: '!'}]},
mobile: {rules: [{validator: this.validateMobile}]}
},
url: {
delete: '/sys/sysDepart/delete',
edit: '/sys/sysDepart/edit',
deleteBatch: '/sys/sysDepart/deleteBatch',
exportXlsUrl: "sys/sysDepart/exportXls",
importExcelUrl: "sys/sysDepart/importExcel",
},
orgCategoryDisabled:false,
}
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
}
},
methods: {
loadData() {
this.refresh();
},
loadTree() {
var that = this
//上级部门树信息
that.treeData = []
//保存的树信息,搜索是需要用到
that.departTreeAll = []
//所有的树信息
that.departTree = []
//所有的树节点key信息
that.allIds = []
queryDepartTreeSync().then((res) => {
if (res.success) {
this.allTreeKeys = [];
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.treeData.push(temp)
that.departTreeAll.push(temp)
that.departTree.push(temp)
that.allIds.push(temp.key)
that.allTreeKeys.push(temp.key)
}
this.loading = false
}
})
},
loadSubTree(treeNode) {
var that = this;
return new Promise(resolve => {
queryDepartTreeSync({pid:treeNode.dataRef.id}).then((res) => {
if (res.success) {
//判断chidlren是否为空并修改isLeaf属性值
if(res.result.length == 0){
treeNode.dataRef['isLeaf']=true
return;
}else{
treeNode.dataRef['children']= res.result;
}
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.allIds.push(temp.key)
}
}
})
resolve();
});
//保存全部部门信息,方便后面搜索使用
that.departTreeAll=that.departTree
},
refresh() {
this.loading = true
this.loadTree()
},
// 右键操作方法
rightHandle(node) {
this.dropTrigger = 'contextmenu'
console.log(node.node.eventKey)
//注释异步书加载key拼接__,以便于每次展开节点会刷新数据
this.rightClickSelectedKey = node.node.eventKey.split('__')[0]
this.rightClickSelectedOrgCode = node.node.dataRef.orgCode
},
onExpand(expandedKeys) {
console.log('onExpand', expandedKeys)
this.iExpandedKeys = expandedKeys
this.autoExpandParent = false
this.allTreeKeys=expandedKeys
},
backFlowList() {
this.$router.back(-1)
},
// 右键点击下拉框改变事件
dropStatus(visible) {
if (visible == false) {
this.dropTrigger = ''
}
},
// 右键店家下拉关闭下拉框
closeDrop() {
this.dropTrigger = ''
},
addRootNode() {
this.$refs.nodeModal.add(this.currFlowId, '')
},
batchDel: function () {
console.log(this.checkedKeys)
if (this.checkedKeys.length <= 0) {
this.$message.warning('')
} else {
var ids = ''
for (var a = 0; a < this.checkedKeys.length; a++) {
ids += this.checkedKeys[a].split('__')[0] + ','
}
var that = this
this.$confirm({
title: '',
content: ' ' + this.checkedKeys.length + ' ?',
onOk: function () {
deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.loadTree()
that.onClearSelected()
} else {
that.$message.warning(res.message)
}
})
}
})
}
},
onSearch(value) {
let that = this
if (value) {
searchByKeywords({keyWord: value}).then((res) => {
if (res.success) {
that.departTree = []
for (let i = 0; i < res.result.length; i++) {
let temp = res.result[i]
that.departTree.push(temp)
}
} else {
that.$message.warning(res.message)
}
})
} else {
that.departTree=that.departTreeAll
}
},
nodeModalOk() {
this.loadTree()
},
nodeModalClose() {
},
hide() {
this.visible = false
},
onCheck(checkedKeys, info) {
console.log('onCheck', checkedKeys, info)
this.hiding = false
//this.checkedKeys = checkedKeys.checked
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
if(this.checkStrictly){
this.checkedKeys = checkedKeys.checked;
}else{
this.checkedKeys = checkedKeys
}
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
},
onSelect(selectedKeys, e) {
console.log('selected', selectedKeys, e)
this.hiding = false
let record = e.node.dataRef
console.log('onSelect-record', record)
this.currSelected = Object.assign({}, record)
this.model = this.currSelected
this.selectedKeys = [record.key]
this.model.parentId = record.parentId
this.setValuesToForm(record)
this.$refs.departAuth.show(record.id);
},
// 触发onSelect事件时,为部门树右侧的form表单赋值
setValuesToForm(record) {
if(record.orgCategory == '1'){
this.orgCategoryDisabled = true;
}else{
this.orgCategoryDisabled = false;
}
this.$nextTick(() => {
this.form.getFieldDecorator('fax', {initialValue: ''})
this.form.setFieldsValue(pick(record, 'departName','orgCategory', 'orgCode', 'departOrder', 'mobile', 'fax', 'address', 'memo'))
})
},
getCurrSelectedTitle() {
return !this.currSelected.title ? '' : this.currSelected.title
},
onClearSelected() {
this.hiding = true
this.checkedKeys = []
this.currSelected = {}
this.form.resetFields()
this.selectedKeys = []
this.$refs.departAuth.departId = ''
},
handleNodeTypeChange(val) {
this.currSelected.nodeType = val
},
notifyTriggerTypeChange(value) {
this.currSelected.notifyTriggerType = value
},
receiptTriggerTypeChange(value) {
this.currSelected.receiptTriggerType = value
},
submitCurrForm() {
this.form.validateFields((err, values) => {
if (!err) {
if (!this.currSelected.id) {
this.$message.warning('!')
return
}
let formData = Object.assign(this.currSelected, values)
console.log('Received values of form: ', formData)
httpAction(this.url.edit, formData, 'put').then((res) => {
if (res.success) {
this.$message.success('!')
this.loadTree()
} else {
this.$message.error(res.message)
}
})
}
})
},
emptyCurrForm() {
this.form.resetFields()
},
nodeSettingFormSubmit() {
this.form.validateFields((err, values) => {
if (!err) {
console.log('Received values of form: ', values)
}
})
},
openSelect() {
this.$refs.sysDirectiveModal.show()
},
handleAdd(num) {
if (num == 1) {
this.$refs.departModal.add()
this.$refs.departModal.title = ''
} else if (num == 2) {
let key = this.currSelected.key
if (!key) {
this.$message.warning('')
return false
}
this.$refs.departModal.add(this.selectedKeys[0].split('__')[0])
this.$refs.departModal.title = ''
} else {
this.$refs.departModal.add(this.rightClickSelectedKey)
this.$refs.departModal.title = ''
}
},
handleDelete() {
var that = this
this.$confirm({
title: '',
content: '?',
onOk: function () {
deleteByDepartId({id: that.rightClickSelectedKey}).then((resp) => {
if (resp.success) {
//删除成功后,去除已选中中的数据
that.checkedKeys.splice(that.checkedKeys.findIndex(key => key === that.rightClickSelectedKey), 1);
that.$message.success('!')
that.loadTree()
//删除后同步清空右侧基本信息内容
let orgCode=that.form.getFieldValue("orgCode");
if(orgCode && orgCode === that.rightClickSelectedOrgCode){
that.onClearSelected()
}
} else {
that.$message.warning('!')
}
})
}
})
},
selectDirectiveOk(record) {
console.log('', record)
this.nodeSettingForm.setFieldsValue({directiveCode: record.directiveCode})
this.currSelected.sysCode = record.sysCode
},
getFlowGraphData(node) {
this.graphDatasource.nodes.push({
id: node.id,
text: node.flowNodeName
})
if (node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
let temp = node.children[a]
this.graphDatasource.edges.push({
source: node.id,
target: temp.id
})
this.getFlowGraphData(temp)
}
}
},
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
expandAll () {
this.iExpandedKeys = this.allTreeKeys
},
closeAll () {
this.iExpandedKeys = []
},
checkALL () {
this.checkStriccheckStrictlytly = false
//this.checkedKeys = this.allTreeKeys
this.checkedKeys = this.allIds
},
cancelCheckALL () {
//this.checkedKeys = this.defaultCheckedKeys
this.checkedKeys = []
},
switchCheckStrictly (v) {
if(v==1){
this.checkStrictly = false
}else if(v==2){
this.checkStrictly = true
}
},
getAllKeys(node) {
// console.log('node',node);
this.allTreeKeys.push(node.key)
if (node.children && node.children.length > 0) {
for (let a = 0; a < node.children.length; a++) {
this.getAllKeys(node.children[a])
}
}
}
// <!---- author:os_chengtgen -- date:20190827 -- for:切换父子勾选模式 =======------>
},
created() {
this.currFlowId = this.$route.params.id
this.currFlowName = this.$route.params.name
// this.loadTree()
},
}
</script>
<style scoped>
.ant-card-body .table-operator {
margin: 15px;
}
.anty-form-btn {
width: 100%;
text-align: center;
}
.anty-form-btn button {
margin: 0 5px;
}
.anty-node-layout .ant-layout-header {
padding-right: 0
}
.header {
padding: 0 8px;
}
.header button {
margin: 0 3px
}
.ant-modal-cust-warp {
height: 100%
}
.ant-modal-cust-warp .ant-modal-body {
height: calc(100% - 110px) !important;
overflow-y: auto
}
.ant-modal-cust-warp .ant-modal-content {
height: 90% !important;
overflow-y: hidden
}
#app .desktop {
height: auto !important;
}
/** Button按钮间距 */
.ant-btn {
margin-left: 3px
}
.drawer-bootom-button {
/*position: absolute;*/
bottom: 0;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: left;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
</style>

View File

@ -214,9 +214,8 @@
},
handleAddSub(record) {
this.$refs.modalForm.title = "添加子菜单";
this.$refs.modalForm.localMenuType = 1;
this.$refs.modalForm.disableSubmit = false;
this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id});
this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id,menuType:1});
},
handleExpandedRowsChange(expandedRows) {
this.expandedRowKeys = expandedRows

View File

@ -181,9 +181,8 @@
},
handleAddSub(record) {
this.$refs.modalForm.title = "添加子菜单";
this.$refs.modalForm.localMenuType = 1;
this.$refs.modalForm.disableSubmit = false;
this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id});
this.$refs.modalForm.edit({status:'1',permsType:'1',route:true,'parentId':record.id,menuType:1});
},
handleExpandedRowsChange(expandedRows) {
this.expandedRowKeys = expandedRows

View File

@ -384,11 +384,8 @@
this.$message.error('!')
} else {
this.$refs.modalForm2.roleDisabled = true
this.$refs.modalForm2.selectedRole = [this.currentRoleId]
this.$refs.modalForm2.add()
this.$refs.modalForm2.title = ''
this.$refs.modalForm2.edit({activitiSync:'1',userIdentity:1,selectedroles:this.currentRoleId})
}
},
modalFormOk2() {

View File

@ -150,14 +150,16 @@
})
},
getDataByResult(result){
return result.map(item=>{
//判断是否标记了带有子节点
if(item[this.hasChildrenField]=='1'){
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
item.children = [loadChild]
}
return item
})
if(result && result.length>0){
return result.map(item=>{
//判断是否标记了带有子节点
if(item[this.hasChildrenField]=='1'){
let loadChild = { id: item.id+'_loadChild', name: 'loading...', isLoading: true }
item.children = [loadChild]
}
return item
})
}
},
handleExpand(expanded, record){
// 判断是否是展开状态

View File

@ -65,7 +65,7 @@
<!-- -->
<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-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import"></a-button>
@ -120,7 +120,7 @@
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)" ></a>
<a @click="handleEdit(record)"></a>
<a-divider type="vertical"/>

View File

@ -11,16 +11,17 @@
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构名称"
prop="departName"
:hidden="false"
hasFeedback >
<a-input id="departName" placeholder="请输入机构/部门名称" v-decorator="['departName', validatorRules.departName ]"/>
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :hidden="seen" label="上级部门" hasFeedback>
<a-input id="departName" placeholder="请输入机构/部门名称" v-model="model.departName"/>
</a-form-model-item>
<a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" :hidden="seen" label="上级部门" hasFeedback>
<a-tree-select
style="width:100%"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
@ -29,20 +30,20 @@
placeholder="请选择上级部门"
:disabled="condition">
</a-tree-select>
</a-form-item>
<a-form-item
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="机构类型">
<template v-if="seen">
<a-radio-group v-decorator="['orgCategory',validatorRules.orgCategory]" placeholder="请选择机构类型">
<a-radio value="1">
</a-radio>
</a-radio-group>
<template v-if="seen">
<a-radio-group v-model="model.orgCategory" placeholder="请选择机构类型">
<a-radio value="1">
</a-radio>
</a-radio-group>
</template>
<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>
@ -50,40 +51,41 @@
</a-radio>
</a-radio-group>
</template>
</a-form-item>
<a-form-item
</template>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="mobile"
label="电话">
<a-input placeholder="请输入电话" v-decorator="['mobile',validatorRules.mobile]" />
</a-form-item>
<a-form-item
<a-input placeholder="请输入电话" v-model="model.mobile"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="传真">
<a-input placeholder="请输入传真" v-decorator="['fax', {}]" />
</a-form-item>
<a-form-item
<a-input placeholder="请输入传真" v-model="model.fax"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="地址">
<a-input placeholder="请输入地址" v-decorator="['address', {}]" />
</a-form-item>
<a-form-item
<a-input placeholder="请输入地址" v-model="model.address"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="排序">
<a-input-number v-decorator="[ 'departOrder',{'initialValue':0}]" />
</a-form-item>
<a-form-item
<a-input-number v-model="model.departOrder"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="备注">
<a-textarea placeholder="请输入备注" v-decorator="['memo', {}]" />
</a-form-item>
<a-textarea placeholder="请输入备注" v-model="model.memo"/>
</a-form-model-item>
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
@ -107,7 +109,10 @@
visible: false,
condition:true,
disableSubmit:false,
model: {},
model: {
departOrder:0,
orgCategory:'1'
},
menuhidden:false,
menuusing:true,
labelCol: {
@ -120,11 +125,11 @@
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
departName:{rules: [{ required: true, message: '/!' }]},
orgCode:{rules: [{ required: true, message: '!' }]},
mobile:{rules: [{validator:this.validateMobile}]}
departName:[{ required: true, message: '/!' }],
orgCode:[{ required: true, message: '!' }],
mobile: [{validator:this.validateMobile}],
orgCategory:[{required: true, message: '!'}]
},
url: {
add: "/sys/sysDepart/add",
@ -159,35 +164,28 @@
this.edit(depart);
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, {});
this.visible = true;
this.loadTreeData();
this.model.parentId = record!=null?record.toString():null;
if(this.seen){
this.model.orgCategory = '1';
}else{
this.model.orgCategory = '2';
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'orgCategory','departName','departNameEn','departNameAbbr','departOrder','description','orgType','orgCode','mobile','fax','address','memo','status','delFlag'))
});
if(this.seen){
this.model.orgCategory = '1';
}else{
this.model.orgCategory = '2';
}
},
close () {
this.$emit('close');
this.disableSubmit = false;
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let formData = Object.assign(this.model, values);
//时间格式化
console.log(formData)
httpAction(this.url.add,formData,"post").then((res)=>{
httpAction(this.url.add,this.model,"post").then((res)=>{
if(res.success){
that.$message.success(res.message);
that.loadTreeData();
@ -200,6 +198,8 @@
that.close();
})
}else{
return false;
}
})
},

View File

@ -38,11 +38,9 @@
import pick from 'lodash.pick'
import { getAction } from '@/api/manage'
import { queryIdTree } from '@/api/api'
import userModal from './UserModal'
export default {
name: "DepartWindow",
components: {
userModal,
},
data () {
return {

View File

@ -10,11 +10,6 @@
<a-input placeholder="请输入账号" v-model="queryParam.username"></a-input>
</a-form-item>
</a-col>
<!--<a-col :md="8" :sm="8">-->
<!--<a-form-item label="用户名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">-->
<!--<a-input placeholder="请输入名称查询" v-model="queryParam.realname"></a-input>-->
<!--</a-form-item>-->
<!--</a-col>-->
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px"></a-button>
@ -76,7 +71,7 @@
</a>
<a-menu slot="overlay">
<a-menu-item>
<a href="javascript:;" @click="handleDeptRole(record)"></a>
<a href="javascript:;" @click="handleDeptRole(record)"></a>
</a-menu-item>
<a-menu-item>
@ -294,12 +289,9 @@
} else {
this.$refs.modalForm.departDisabled = true;
//初始化负责部门
this.$refs.modalForm.userDepartModel.departIdList = [this.currentDeptId]; //传入一个部门id
this.$refs.modalForm.add();
//update-begin---author:liusq Date:20210223 forhttps://gitee.com/jeecg/jeecg-boot/issues/I2SDU1------------
this.$refs.modalForm.resultDepartOptions=[{key:this.currentDept.key,title:this.currentDept.title}]
//update-end---author:liusq Date:20210223 forhttps://gitee.com/jeecg/jeecg-boot/issues/I2SDU1------------
this.$refs.modalForm.nextDepartOptions=[{value:this.currentDept.key,label:this.currentDept.title}]
this.$refs.modalForm.title = "新增";
this.$refs.modalForm.edit({activitiSync:'1',userIdentity:1,selecteddeparts:this.currentDeptId})
}
},
selectOK(data) {

View File

@ -9,46 +9,48 @@
cancelText="关闭"
>
<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"
prop="itemText"
label="名称">
<a-input placeholder="请输入名称" v-decorator.trim="['itemText', validatorRules.itemText]"/>
</a-form-item>
<a-input placeholder="请输入名称" v-model="model.itemText"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="itemValue"
label="数据值">
<a-input placeholder="请输入数据值" v-decorator.trim="['itemValue', validatorRules.itemValue]"/>
</a-form-item>
<a-input placeholder="请输入数据值" v-model="model.itemValue" />
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="描述">
<a-input v-decorator="['description']"/>
</a-form-item>
<a-input v-model="model.description" />
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="排序值">
<a-input-number :min="1" v-decorator="['sortOrder',{'initialValue':1}]"/>
</a-form-item>
<a-input-number :min="1" v-model="model.sortOrder" />
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="是否启用"
hasFeedback>
<a-switch checkedChildren="启用" unCheckedChildren="禁用" @change="onChose" v-model="visibleCheck"/>
</a-form-item>
</a-form-model-item>
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
@ -77,10 +79,9 @@
sm: {span: 16},
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
itemText: {rules: [{required: true, message: '!'}]},
itemValue: {rules: [{required: true, message: '!'},{validator: this.validateItemValue}]},
itemText: [{required: true, message: '!'}],
itemValue: [{required: true, message: '!'},{validator: this.validateItemValue}],
},
}
},
@ -89,22 +90,19 @@
methods: {
add(dictId) {
this.dictId = dictId;
this.edit({});
//初始化默认值
this.edit({sortOrder:1,status:1});
},
edit(record) {
if (record.id) {
this.dictId = record.dictId;
this.status = record.status;
this.visibleCheck = (record.status == 1) ? true : false;
}
this.form.resetFields();
this.status = record.status;
this.visibleCheck = (record.status == 1) ? true : false;
this.model = Object.assign({}, record);
this.model.dictId = this.dictId;
this.model.status = this.status;
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'itemText', 'itemValue', 'description', 'sortOrder'))
});
},
onChose(checked) {
if (checked) {
@ -119,19 +117,18 @@
handleOk() {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
values.itemText = (values.itemText || '').trim()
values.itemValue = (values.itemValue || '').trim()
values.description = (values.description || '').trim()
let formData = Object.assign(this.model, values);
formData.status = this.status;
this.model.itemText = (this.model.itemText || '').trim()
this.model.itemValue = (this.model.itemValue || '').trim()
this.model.description = (this.model.description || '').trim()
this.model.status = this.status;
let obj;
if (!this.model.id) {
obj = addDictItem(formData);
obj = addDictItem(this.model);
} else {
obj = editDictItem(formData);
obj = editDictItem(this.model);
}
obj.then((res) => {
if (res.success) {
@ -144,6 +141,8 @@
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},
@ -154,6 +153,7 @@
close() {
this.$emit('close');
this.visible = false;
this.$refs.form.resetFields();
},
validateItemValue(rule, value, callback){
let param = {

View File

@ -9,30 +9,34 @@
cancelText="关闭"
>
<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"
prop="dictName"
required
label="字典名称">
<a-input placeholder="请输入字典名称" v-decorator.trim="[ 'dictName', validatorRules.dictName]"/>
</a-form-item>
<a-input placeholder="请输入字典名称" v-model="model.dictName"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="dictCode"
required
label="字典编码">
<a-input placeholder="请输入字典编码" v-decorator.trim="[ 'dictCode', validatorRules.dictCode]"/>
</a-form-item>
<a-input placeholder="请输入字典编码" v-model="model.dictCode"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="描述">
<a-input v-decorator="[ 'description']"/>
</a-form-item>
<a-input v-model="model.description"/>
</a-form-model-item>
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
@ -58,14 +62,12 @@
sm: { span: 16 }
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
dictName: { rules: [{ required: true, message: '!' }] },
dictCode: {
rules: [{ required: true, message: '!' },
{ validator: this.validateDictCode }]
dictName: [{ required: true, message: '!' }],
dictCode: [
{ required: true, message: '!' },
{ validator: this.validateDictCode }]
}
}
}
},
created() {
@ -99,30 +101,24 @@
} else {
this.visiblekey = false
}
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'dictName', 'dictCode', 'description'))
})
},
// 确定
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
values.dictName = (values.dictName || '').trim()
values.dictCode = (values.dictCode || '').trim()
values.description = (values.description || '').trim()
let formData = Object.assign(this.model, values)
this.model.dictName = (this.model.dictName || '').trim()
this.model.dictCode = (this.model.dictCode || '').trim()
this.model.description = (this.model.description || '').trim()
let obj
console.log(formData)
if (!this.model.id) {
obj = addDict(formData)
obj = addDict(this.model)
} else {
obj = editDict(formData)
obj = editDict(this.model)
}
obj.then((res) => {
if (res.success) {
@ -135,6 +131,8 @@
that.confirmLoading = false
that.close()
})
}else{
return false;
}
})
},
@ -145,6 +143,7 @@
close() {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields();
}
}
}

View File

@ -9,51 +9,54 @@
cancelText="关闭">
<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"
prop="ruleName"
label="规则名称">
<a-input placeholder="请输入规则名称" v-decorator="['ruleName', validatorRules.ruleName]"/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入规则名称" v-model="model.ruleName"/>
</a-form-model-item>
<a-form-model-item
v-show="showRuleColumn"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="ruleColumn"
label="规则字段">
<a-input placeholder="请输入规则字段" v-decorator="['ruleColumn', validatorRules.ruleColumn]"/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入规则字段" v-model.trim="model.ruleColumn"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="ruleConditions"
label="条件规则">
<j-dict-select-tag @change="handleChangeRuleCondition" v-decorator="['ruleConditions', validatorRules.ruleConditions]" placeholder="请输入条件规则" :triggerChange="true" dictCode="rule_conditions"/>
</a-form-item>
<a-form-item
<j-dict-select-tag @input="handleChangeRuleCondition" v-model="model.ruleConditions" placeholder="请输入条件规则" dictCode="rule_conditions"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="ruleValue"
label="规则值">
<a-input placeholder="请输入规则值" v-decorator="['ruleValue', validatorRules.ruleValue]"/>
</a-form-item>
<a-input placeholder="请输入规则值" v-model.trim="model.ruleValue"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="状态">
<a-radio-group buttonStyle="solid" v-decorator="['status',{initialValue:'1'}]">
<a-radio-group buttonStyle="solid" v-model="model.status">
<a-radio-button value="1"></a-radio-button>
<a-radio-button value="0"></a-radio-button>
</a-radio-group>
</a-form-item>
</a-form-model-item>
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
export default {
name: 'PermissionDataRuleModal',
@ -73,13 +76,12 @@
sm: {span: 16}
},
confirmLoading: false,
form: this.$form.createForm(this),
permissionId: '',
validatorRules: {
ruleConditions: {rules: [{required: true, message: '!'}]},
ruleName: {rules: [{required: true, message: '!'}]},
ruleValue: {rules: [{required: true, message: '!'}]},
ruleColumn: {rules: []}
ruleConditions: [{required: true, message: '!'}],
ruleName:[{required: true, message: '!'}],
ruleValue: [{required: true, message: '!'}],
ruleColumn: []
},
url: {
list: '/sys/dictItem/list',
@ -94,10 +96,10 @@
methods: {
add(permId) {
this.permissionId = permId
this.edit({})
//初始化默认值
this.edit({status:'1'})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
if (record.permissionId) {
this.model.permissionId = record.permissionId
@ -106,19 +108,17 @@
}
this.visible = true
this.initRuleCondition()
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'status','ruleName', 'ruleColumn', 'ruleConditions', 'ruleValue'))
})
},
close() {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields()
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
@ -129,14 +129,7 @@
httpurl += this.url.edit
method = 'put'
}
let formData = Object.assign(this.model, values)
if(formData.ruleColumn && formData.ruleColumn.length>0){
formData.ruleColumn = formData.ruleColumn.trim()
}
if(formData.ruleValue && formData.ruleValue.length>0){
formData.ruleValue = formData.ruleValue.trim()
}
httpAction(httpurl, formData, method).then((res) => {
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
@ -147,6 +140,8 @@
that.confirmLoading = false
that.close()
})
}else{
return false;
}
})
},
@ -162,9 +157,7 @@
},
handleChangeRuleCondition(val){
if(val=='USE_SQL_RULES'){
this.form.setFieldsValue({
ruleColumn:''
})
this.model.ruleColumn=''
this.showRuleColumn = false
}else{
this.showRuleColumn = true

View File

@ -8,27 +8,28 @@
<div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-item label="菜单类型" :labelCol="labelCol" :wrapperCol="wrapperCol" >
<a-radio-group @change="onChangeMenuType" v-decorator="['menuType',{'initialValue':localMenuType}]">
<a-form-model-item label="菜单类型" :labelCol="labelCol" :wrapperCol="wrapperCol" >
<a-radio-group @change="onChangeMenuType" v-model="model.menuType">
<a-radio :value="0"></a-radio>
<a-radio :value="1"></a-radio>
<a-radio :value="2">/</a-radio>
</a-radio-group>
</a-form-item>
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
:label="menuLabel"
prop="name"
hasFeedback >
<a-input placeholder="请输入菜单名称" v-decorator="[ 'name', validatorRules.name]" :readOnly="disableSubmit"/>
</a-form-item>
<a-input placeholder="请输入菜单名称" v-model="model.name" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-item
v-show="localMenuType!=0"
<a-form-model-item
v-show="model.menuType!=0"
label="上级菜单"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
@ -45,58 +46,61 @@
:disabled="disableSubmit"
@change="handleParentIdChange">
</a-tree-select>
</a-form-item>
</a-form-model-item>
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="url"
label="菜单路径">
<a-input placeholder="请输入菜单路径" v-decorator="[ 'url',validatorRules.url]" :readOnly="disableSubmit"/>
</a-form-item>
<a-input placeholder="请输入菜单路径" v-model="model.url" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="component"
label="前端组件">
<a-input placeholder="请输入前端组件" v-decorator="[ 'component',validatorRules.component]" :readOnly="disableSubmit"/>
</a-form-item>
<a-input placeholder="请输入前端组件" v-model="model.component" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-item
v-show="localMenuType==0"
<a-form-model-item
v-show="model.menuType==0"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="默认跳转地址">
<a-input placeholder="请输入路由参数 redirect" v-decorator="[ 'redirect',{}]" :readOnly="disableSubmit"/>
</a-form-item>
<a-input placeholder="请输入路由参数 redirect" v-model="model.redirect" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="!show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="perms"
label="授权标识">
<a-input placeholder="请输入授权标识, 如: user:list" v-decorator="[ 'perms', {rules:[{ required: false, message: '请输入授权标识!' },{validator: this.validatePerms }]}]" :readOnly="disableSubmit"/>
</a-form-item>
<a-input placeholder="请输入授权标识, 如: user:list" v-model="model.perms" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="!show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="授权策略">
<j-dict-select-tag v-decorator="['permsType', {}]" placeholder="请选择授权策略" :type="'radio'" :triggerChange="true" dictCode="global_perms_type"/>
<j-dict-select-tag v-model="model.permsType" placeholder="请选择授权策略" :type="'radio'" dictCode="global_perms_type"/>
</a-form-item>
<a-form-item
</a-form-model-item>
<a-form-model-item
v-show="!show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="状态">
<j-dict-select-tag v-decorator="['status', {}]" placeholder="请选择状态" :type="'radio'" :triggerChange="true" dictCode="valid_status"/>
<j-dict-select-tag v-model="model.status" placeholder="请选择状态" :type="'radio'" dictCode="valid_status"/>
</a-form-item>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
@ -104,61 +108,59 @@
<a-input placeholder="点击选择图标" v-model="model.icon" :readOnly="disableSubmit">
<a-icon slot="addonAfter" type="setting" @click="selectIcons" />
</a-input>
</a-form-item>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="sortNo"
label="排序">
<a-input-number placeholder="请输入菜单排序" style="width: 200px" v-decorator="[ 'sortNo',validatorRules.sortNo]" :readOnly="disableSubmit"/>
</a-form-item>
<a-input-number placeholder="请输入菜单排序" v-model="model.sortNo" style="width: 200px" :readOnly="disableSubmit"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="是否路由菜单">
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="routeSwitch"/>
</a-form-item>
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="model.route"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="隐藏路由">
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="menuHidden"/>
</a-form-item>
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="model.hidden"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="是否缓存路由">
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="isKeepalive"/>
</a-form-item>
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="model.keepAlive"/>
</a-form-model-item>
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="聚合路由">
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="alwaysShow"/>
</a-form-item>
<a-switch checkedChildren="是" unCheckedChildren="否" v-model="model.alwaysShow"/>
</a-form-model-item>
<!--update_begin author:wuxianquan date:20190908 for: -->
<a-form-item
<a-form-model-item
v-show="show"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="打开方式">
<a-switch checkedChildren="外部" unCheckedChildren="内部" v-model="internalOrExternal"/>
</a-form-item>
<!--update_end author:wuxianquan date:20190908 for: -->
<a-switch checkedChildren="外部" unCheckedChildren="内部" v-model="model.internalOrExternal"/>
</a-form-model-item>
</a-form>
</a-form-model>
<!-- -->
<icons @choose="handleIconChoose" @close="handleIconCancel" :iconChooseVisible="iconChooseVisible"></icons>
@ -176,7 +178,6 @@
<script>
import {addPermission,editPermission,queryTreeList, duplicateCheck} from '@/api/api'
import Icons from './icon/Icons'
import pick from 'lodash.pick'
export default {
name: "PermissionModal",
@ -185,22 +186,12 @@
return {
drawerWidth:700,
treeData:[],
treeValue: '0-0-4',
title:"操作",
visible: false,
disableSubmit:false,
model: {},
localMenuType:0,
alwaysShow:false,//表单元素-聚合路由
menuHidden:false,//表单元素-隐藏路由
routeSwitch:true, //是否路由菜单
/*update_begin author:wuxianquan date:20190908 for:定义变量,初始值代表内部打开*/
internalOrExternal:false,//菜单打开方式
/*update_end author:wuxianquan date:20190908 for:定义变量,初始值代表内部打开*/
isKeepalive:true, //是否缓存路由
show:true,//根据菜单类型,动态显示隐藏表单元素
menuLabel:'',
isRequrie:true, // 是否需要验证
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
@ -209,10 +200,7 @@
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
iconChooseVisible: false,
validateStatus:""
}
@ -220,23 +208,21 @@
computed:{
validatorRules:function() {
return {
name:{rules: [{ required: true, message: '!' }]},
component:{rules: [{ required: this.show, message: '!' }]},
url:{rules: [{ required: this.show, message: '!' }]},
permsType:{rules: [{ required: true, message: '!' }]},
sortNo:{initialValue:1.0},
name:[{ required: true, message: '!' }],
component:[{ required: this.show, message: '!' }],
url: [{ required: this.show, message: '!' }],
permsType: [{ required: true, message: '!' }],
perms:[{ required: false, message: '!' },{validator: this.validatePerms }]
}
}
},
created () {
this.initDictConfig();
},
methods: {
loadTree(){
var that = this;
queryTreeList().then((res)=>{
if(res.success){
console.log('----queryTreeList---')
console.log(res)
that.treeData = [];
let treeList = res.result.treeList
@ -249,76 +235,33 @@
});
},
add () {
// 默认值
this.edit({status:'1',permsType:'1',route:true});
//初始化默认值
this.edit({status:'1', permsType:'1', sortNo:1.0, route:true, menuType:0 });
},
edit (record) {
this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
this.form.resetFields();
this.model = Object.assign({}, record);
//--------------------------------------------------------------------------------------------------
//根据菜单类型,动态展示页面字段
console.log(record)
this.alwaysShow = !record.alwaysShow?false:true;
this.menuHidden = !record.hidden?false:true;
if(record.route!=null){
this.routeSwitch = record.route?true:false;
}
if(record.keepAlive!=null){
this.isKeepalive = record.keepAlive?true:false;
}else{
this.isKeepalive = false; // 升级兼容 如果没有后台没有传过来、或者是新建默认为false
}
/*update_begin author:wuxianquan date:20190908 for:编辑初始化数据*/
if(record.internalOrExternal!=null){
this.internalOrExternal = record.internalOrExternal?true:false;
}else{
this.internalOrExternal = false;
}
/*update_end author:wuxianquan date:20190908 for:编辑初始化数据*/
//console.log('record.menuType', record.menuType);
console.log('record: ',record)
this.show = record.menuType==2?false:true;
this.menuLabel = record.menuType==2?'/':'';
if(this.model.parentId){
this.localMenuType = 1;
}else{
this.localMenuType = 0;
}
//----------------------------------------------------------------------------------------------
this.visible = true;
this.loadTree();
let fieldsVal = pick(this.model,'name','perms','permsType','component','redirect','url','sortNo','menuType','status');
this.$nextTick(() => {
this.form.setFieldsValue(fieldsVal)
});
},
close () {
this.$emit('close');
this.disableSubmit = false;
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.model.alwaysShow = this.alwaysShow;
this.model.hidden = this.menuHidden;
this.model.route = this.routeSwitch;
this.model.keepAlive = this.isKeepalive;
/*update_begin author:wuxianquan date:20190908 for:获取值*/
this.model.internalOrExternal = this.internalOrExternal;
/*update_end author:wuxianquan date:20190908 for:获取值*/
let formData = Object.assign(this.model, values);
if ((formData.menuType == 1 || formData.menuType == 2) && !formData.parentId) {
this.$refs.form.validate(valid => {
if (valid) {
if ((this.model.menuType == 1 || this.model.menuType == 2) && !this.model.parentId) {
that.validateStatus = 'error';
that.$message.error("请检查你填的类型以及信息是否正确!");
return;
@ -326,12 +269,11 @@
that.validateStatus = 'success';
}
that.confirmLoading = true;
console.log(formData);
let obj;
if (!this.model.id) {
obj = addPermission(formData);
obj = addPermission(this.model);
} else {
obj = editPermission(formData);
obj = editPermission(this.model);
}
obj.then((res) => {
if (res.success) {
@ -344,6 +286,8 @@
that.confirmLoading = false;
that.close();
});
}else{
return false;
}
})
},
@ -378,9 +322,7 @@
}
},
onChangeMenuType(e) {
//console.log('localMenuType checked', e.target.value)
this.localMenuType=e.target.value
if(e.target.value == 2){
if(this.model.menuType == 2){
this.show = false;
this.menuLabel = '/';
}else{
@ -388,7 +330,7 @@
this.menuLabel = '';
}
this.$nextTick(() => {
this.form.validateFields(['url','component'], { force: true });
this.$refs.form.validateField(['url','component']);
});
},
selectIcons(){
@ -400,7 +342,6 @@
handleIconChoose (value) {
console.log(value)
this.model.icon = value
this.form.icon = value
this.iconChooseVisible = false
},
// 根据屏幕变化,设置抽屉尺寸
@ -412,8 +353,6 @@
this.drawerWidth = 700;
}
},
initDictConfig() {
},
handleParentIdChange(value){
if(!value){
this.validateStatus="error"

View File

@ -11,38 +11,23 @@
style="top:5%;height: 85%;overflow-y: hidden">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="角色名称">
<a-input placeholder="请输入角色名称" v-decorator="[ 'roleName', validatorRules.roleName]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="角色编码">
<a-input placeholder="请输入角色编码" :disabled="roleDisabled" v-decorator="[ 'roleCode', validatorRules.roleCode]" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="描述">
<a-textarea :rows="5" placeholder="..." v-decorator="[ 'description', validatorRules.description ]" />
</a-form-item>
</a-form>
<a-form-model ref="form" v-bind="layout" :model="model" :rules="validatorRules">
<a-form-model-item label="角色编码" required prop="roleCode">
<a-input v-model="model.roleCode" :disabled="roleDisabled" placeholder="请输入角色编码"/>
</a-form-model-item>
<a-form-model-item label="角色名称" required prop="roleName">
<a-input v-model="model.roleName" placeholder="请输入角色名称"/>
</a-form-model-item>
<a-form-model-item label="描述" prop="description">
<a-textarea :rows="5" v-model="model.description" placeholder="请输入角色描述"/>
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import pick from 'lodash.pick'
import {addRole,editRole,duplicateCheck } from '@/api/api'
export default {
name: "RoleModal",
data () {
@ -51,76 +36,61 @@
visible: false,
roleDisabled: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
layout: {
labelCol: { span: 3 },
wrapperCol: { span: 14 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
roleName:{
rules: [
{ required: true, message: '!' },
{ min: 2, max: 30, message: ' 2 30 ', trigger: 'blur' }
]},
roleCode:{
rules: [
{ required: true, message: '!'},
{ min: 0, max: 64, message: ' 64 ', trigger: 'blur' },
{ validator: this.validateRoleCode}
]},
description:{
rules: [
{ min: 0, max: 126, message: ' 126 ', trigger: 'blur' }
]}
roleName: [
{ required: true, message: '!' },
{ min: 2, max: 30, message: ' 2 30 ', trigger: 'blur' }
],
roleCode: [
{ required: true, message: '!'},
{ min: 0, max: 64, message: ' 64 ', trigger: 'blur' },
{ validator: this.validateRoleCode}
],
description: [
{ min: 0, max: 126, message: ' 126 ', trigger: 'blur' }
]
},
}
},
created () {
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
methods: {
add () {
this.edit({});
this.edit(this.modelDefault);
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
//编辑页面禁止修改角色编码
if(this.model.id){
this.roleDisabled = true;
}else{
this.roleDisabled = false;
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'roleName', 'description','roleCode'))
});
},
close () {
this.$refs.form.clearValidate();
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
values.roleName = (values.roleName || '').trim()
values.roleCode = (values.roleCode || '').trim()
let formData = Object.assign(this.model, values);
let obj;
console.log(formData)
if(!this.model.id){
obj=addRole(formData);
obj=addRole(this.model);
}else{
obj=editRole(formData);
obj=editRole(this.model);
}
obj.then((res)=>{
if(res.success){
@ -133,6 +103,8 @@
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},
@ -143,7 +115,7 @@
if(/[\u4E00-\u9FA5]/g.test(value)){
callback("角色编码不可输入汉字!");
}else{
var params = {
let params = {
tableName: "sys_role",
fieldName: "role_code",
fieldVal: value,
@ -158,7 +130,6 @@
});
}
}
}
}
</script>

View File

@ -1,7 +1,6 @@
<template>
<a-modal
:title="title"
:width="900"
:visible="visible"
:confirmLoading="confirmLoading"
@ -11,59 +10,63 @@
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-row style="width: 100%;">
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="titile"
label="标题">
<a-input placeholder="请输入标题" v-decorator="['titile', validatorRules.title]" :readOnly="disableSubmit"/>
</a-form-item>
<a-input placeholder="请输入标题" v-model="model.titile" :readOnly="disableSubmit"/>
</a-form-model-item>
</a-col>
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="msgCategory"
label="消息类型">
<a-select
v-decorator="[ 'msgCategory', validatorRules.msgCategory]"
v-model="model.msgCategory"
placeholder="请选择消息类型"
:disabled="disableSubmit"
:getPopupContainer = "(target) => target.parentNode">
<a-select-option value="1"></a-select-option>
<a-select-option value="2"></a-select-option>
</a-select>
</a-form-item>
</a-form-model-item>
</a-col>
</a-row>
<a-row style="width: 100%;">
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="startTime"
label="开始时间:">
<j-date style="width: 100%" :getCalendarContainer="node => node.parentNode" v-decorator="[ 'startTime', validatorRules.startTime]" placeholder="请选择开始时间" showTime dateFormat="YYYY-MM-DD HH:mm:ss" ></j-date>
</a-form-item>
<j-date style="width: 100%" :getCalendarContainer="node => node.parentNode" v-model="model.startTime" placeholder="请选择开始时间" showTime dateFormat="YYYY-MM-DD HH:mm:ss" ></j-date>
</a-form-model-item>
</a-col>
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="endTime"
label="结束时间"
class="endTime">
<j-date style="width: 100%" :getCalendarContainer="node => node.parentNode" v-decorator="[ 'endTime', validatorRules.endTime]" placeholder="请选择结束时间" showTime dateFormat="YYYY-MM-DD HH:mm:ss"></j-date>
</a-form-item>
<j-date style="width: 100%" :getCalendarContainer="node => node.parentNode" v-model="model.endTime" placeholder="请选择结束时间" showTime dateFormat="YYYY-MM-DD HH:mm:ss"></j-date>
</a-form-model-item>
</a-col>
</a-row>
<a-row style="width: 100%;">
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="优先级">
<a-select
v-decorator="[ 'priority', {}]"
v-model="model.priority"
placeholder="请选择优先级"
:disabled="disableSubmit"
:getPopupContainer = "(target) => target.parentNode">
@ -71,15 +74,16 @@
<a-select-option value="M"></a-select-option>
<a-select-option value="H"></a-select-option>
</a-select>
</a-form-item>
</a-form-model-item>
</a-col>
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="msgType"
label="通告类型">
<a-select
v-decorator="[ 'msgType', validatorRules.msgType]"
v-model="model.msgType"
placeholder="请选择通告类型"
:disabled="disableSubmit"
@change="chooseMsgType"
@ -87,20 +91,21 @@
<a-select-option value="USER"></a-select-option>
<a-select-option value="ALL"></a-select-option>
</a-select>
</a-form-item>
</a-form-model-item>
</a-col>
</a-row>
<a-row style="width: 100%;">
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="msgAbstract"
label="摘要">
<a-textarea placeholder="请输入摘要" v-decorator="['msgAbstract',validatorRules.msgAbstract]" />
</a-form-item>
<a-textarea placeholder="请输入摘要" v-model="model.msgAbstract" />
</a-form-model-item>
</a-col>
<a-col :span="24/2">
<a-form-item
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="指定用户"
@ -114,21 +119,21 @@
@change="handleChange"
>
</a-select>
</a-form-item>
</a-form-model-item>
</a-col>
</a-row>
<a-row style="width: 100%;">
<a-col :span="24">
<a-form-item
<a-form-model-item
:labelCol="labelColX1"
:wrapperCol="wrapperColX1"
label="内容"
class="j-field-content">
<j-editor v-decorator="[ 'msgContent', {} ]" triggerChange></j-editor>
</a-form-item>
<j-editor v-model="model.msgContent"></j-editor>
</a-form-model-item>
</a-col>
</a-row>
</a-form>
</a-form-model>
</a-spin>
<select-user-list-modal ref="UserListModal" @choseUser="choseUser"></select-user-list-modal>
</a-modal>
@ -169,14 +174,13 @@
sm: { span: 21 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
title:{rules: [{ required: true, message: '!' }]},
msgCategory:{rules: [{ required: true, message: '!' }]},
msgType:{rules: [{ required: true, message: '!' }]},
endTime:{rules:[{ required: true, message: '!'} ,{validator: this.endTimeValidate}]},
startTime:{rules:[{required: true, message: '!'},{validator: this.startTimeValidate}]},
msgAbstract:{rules: [{ required: true, message: '!' }]},
titile: [{ required: true, message: '!' }],
msgCategory: [{ required: true, message: '!' }],
msgType:[{ required: true, message: '!' }],
endTime:[{ required: true, message: '!'} ,{validator: this.endTimeValidate}],
startTime:[{required: true, message: '!'},{validator: this.startTimeValidate}],
msgAbstract: [{ required: true, message: '!' }],
},
url: {
queryByIds: "/sys/user/queryByIds",
@ -198,7 +202,6 @@
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = {}
this.disable = false;
this.visible = true;
@ -226,14 +229,12 @@
}
});
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'endTime','startTime','titile','msgContent','priority','msgCategory','msgType','sendStatus','msgAbstract'))
});
},
close () {
this.$emit('close');
this.selectedUser = [];
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
@ -243,8 +244,8 @@
return;
}
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -255,12 +256,10 @@
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
if(this.userType){
formData.userIds = this.userIds;
this.model.userIds = this.userIds;
}
console.log(formData)
httpAction(httpurl,formData,method).then((res)=>{
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
@ -273,14 +272,15 @@
that.close();
})
}else{
return false;
}
})
},
handleCancel () {
this.visible = false;
this.$emit('close');
this.$refs.form.resetFields();
this.resetUser();
},
resetUser (){
@ -317,7 +317,7 @@
}
},
startTimeValidate(rule,value,callback){
let endTime = this.form.getFieldValue("endTime")
let endTime = this.model.endTime
if(!value || !endTime){
callback()
}else if(moment(value).isBefore(endTime)){
@ -327,7 +327,7 @@
}
},
endTimeValidate(rule,value,callback){
let startTime = this.form.getFieldValue("startTime")
let startTime = this.model.startTime;
if(!value || !startTime){
callback()
}else if(moment(startTime).isBefore(value)){

View File

@ -9,36 +9,25 @@
:destroyOnClose="true"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-item label="父级节点" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-form-model-item label="父级节点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pid">
<j-tree-select
ref="treeSelect"
placeholder="请选择父级节点"
v-decorator="['pid', validatorRules.pid]"
v-model="model.pid"
dict="sys_category,name,id"
pidField="pid"
pidValue="0">
pidValue="0"
:disabled="disabled">
</j-tree-select>
</a-form-item>
</a-form-model-item>
<a-form-item label="分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="[ 'name', validatorRules.name]" placeholder="请输入分类名称"></a-input>
</a-form-item>
<a-form-model-item label="分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name">
<a-input v-model="model.name" placeholder="请输入分类名称"></a-input>
</a-form-model-item>
<!--<a-form-item label="类型编码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="[ 'code', validatorRules.code]" placeholder="请输入类型编码"></a-input>
</a-form-item>-->
<!--<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol">
<span style="font-size: 12px;color:red" slot="label">()</span>
<span style="font-size: 12px;color:red">
,A01A01
</span>
</a-form-item>-->
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
@ -46,7 +35,6 @@
<script>
import { httpAction,getAction } from '@/api/manage'
import pick from 'lodash.pick'
import JTreeSelect from '@/components/jeecg/JTreeSelect'
export default {
@ -56,7 +44,6 @@
},
data () {
return {
form: this.$form.createForm(this),
title:"操作",
width:800,
visible: false,
@ -72,15 +59,8 @@
confirmLoading: false,
validatorRules:{
code:{
rules: [{
required: true, message: '!'
},{
validator: this.validateMyCode
}]
},
pid:{},
name:{rules: [{ required: true, message: '!' }]}
name: [{ required: true, message: '!' }]
},
url: {
add: "/sys/category/add",
@ -95,27 +75,29 @@
},
created () {
},
computed : {
disabled() {
return this.model.id?true : false;
}
},
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,'pid','name','code'))
})
},
close () {
this.$emit('close');
this.visible = false;
this.$refs.form.resetFields();
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -126,12 +108,10 @@
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
console.log("表单提交数据",formData)
httpAction(httpurl,formData,method).then((res)=>{
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.submitSuccess(formData)
that.submitSuccess(this.model)
}else{
that.$message.warning(res.message);
}
@ -139,6 +119,8 @@
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
@ -146,9 +128,6 @@
handleCancel () {
this.close()
},
popupCallback(row){
this.form.setFieldsValue(pick(row,'pid','name','code'))
},
submitSuccess(formData){
if(!formData.id){
let treeData = this.$refs.treeSelect.getCurrTreeData()
@ -174,20 +153,6 @@
}
}
},
validateMyCode(rule, value, callback){
let params = {
pid: this.form.getFieldValue('pid'),
code: value
}
getAction(this.url.checkCode,params).then((res) => {
if (res.success) {
callback()
} else {
callback(res.message)
}
})
},
}
}

View File

@ -9,35 +9,37 @@
cancelText="关闭">
<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"
prop="roleName"
label="部门角色名称">
<a-input placeholder="请输入部门角色名称" v-decorator="['roleName', validatorRules.roleName]" />
</a-form-item>
<a-form-item
<a-input placeholder="请输入部门角色名称" v-model="model.roleName"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="roleCode"
label="部门角色编码">
<a-input placeholder="请输入部门角色编码" v-decorator="['roleCode', validatorRules.roleCode]" />
</a-form-item>
<a-form-item
<a-input placeholder="请输入部门角色编码" v-model="model.roleCode"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="description"
label="描述">
<a-input placeholder="请输入描述" v-decorator="['description', validatorRules.description]" />
</a-form-item>
<a-input placeholder="请输入描述" v-model="model.description"/>
</a-form-model-item>
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
import pick from 'lodash.pick'
import {duplicateCheck } from '@/api/api'
export default {
@ -55,25 +57,20 @@
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
roleName:{
rules: [
roleName:[
{ required: true, message: '!' },
{ min: 2, max: 30, message: ' 2 30 ', trigger: 'blur' }
]},
roleCode:{
rules: [
],
roleCode: [
{ required: true, message: '!'},
{ min: 0, max: 64, message: ' 64 ', trigger: 'blur' },
{ validator: this.validateRoleCode}
]},
description:{
rules: [
],
description: [
{ min: 0, max: 126, message: ' 126 ', trigger: 'blur' }
]}
]
},
url: {
add: "/sys/sysDepartRole/add",
@ -89,22 +86,19 @@
},
edit (record,departId) {
this.departId = departId;
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'roleName','roleCode','description'))
});
},
close () {
this.$emit('close');
this.visible = false;
this.$refs.form.resetFields()
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
@ -115,9 +109,8 @@
httpurl+=this.url.edit;
method = 'put';
}
let formData = Object.assign(this.model, values);
formData.departId = this.departId;
httpAction(httpurl,formData,method).then((res)=>{
this.model.departId = this.departId;
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
@ -128,6 +121,8 @@
that.confirmLoading = false;
that.close();
})
}else{
return false;
}
})
},

View File

@ -10,40 +10,39 @@
cancelText="关闭">
<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"
prop="code"
required
label="职务编码">
<a-input placeholder="请输入职务编码" v-decorator="['code', validatorRules.code]" :read-only="readOnly"/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入职务编码" v-model="model.code" :read-only="readOnly"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="name"
required
label="职务名称">
<a-input placeholder="请输入职务名称" v-decorator="['name', validatorRules.name]"/>
</a-form-item>
<a-form-item
<a-input placeholder="请输入职务名称" v-model="model.name"/>
</a-form-model-item>
<a-form-model-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
prop="postRank"
required
label="职级"
>
<j-dict-select-tag
placeholder="请选择职级"
:triggerChange="true"
dictCode="position_rank"
v-decorator="['postRank', validatorRules.postRank]"
v-model="model.postRank"
/>
</a-form-item>
<!--<a-form-item-->
<!-- :labelCol="labelCol"-->
<!-- :wrapperCol="wrapperCol"-->
<!-- label="公司id">-->
<!-- <a-input placeholder="请输入公司id" v-decorator="['companyId', {}]"/>-->
<!--</a-form-item>-->
</a-form-model-item>
</a-form>
</a-form-model>
</a-spin>
</a-modal>
</template>
@ -73,10 +72,8 @@
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules: {
code: {
rules: [
code: [
{ required: true, message: '' },
{
validator: (rule, value, callback) => {
@ -101,10 +98,9 @@
}, 300)
}
}
]
},
name: { rules: [{ required: true, message: '' }] },
postRank: { rules: [{ required: true, message: '' }] },
],
name: [{ required: true, message: '' }] ,
postRank: [{ required: true, message: '' }] ,
},
url: {
add: '/sys/position/add',
@ -120,7 +116,6 @@
this.edit({})
},
edit(record) {
this.form.resetFields()
this.model = Object.assign({}, record)
this.visible = true
if(record.id){
@ -128,24 +123,17 @@
}else{
this.readOnly=false
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,
'code',
'name',
'postRank',
// 'companyId'
))
})
},
close() {
this.$emit('close')
this.visible = false
this.$refs.form.resetFields();
},
handleOk() {
const that = this
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true
let httpurl = ''
let method = ''
@ -157,8 +145,7 @@
method = 'put'
}
let formData = Object.assign(this.model, values)
httpAction(httpurl, formData, method).then((res) => {
httpAction(httpurl, this.model, method).then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
@ -169,6 +156,8 @@
that.confirmLoading = false
that.close()
})
}else{
return false;
}
})
},

View File

@ -1,51 +1,49 @@
<template>
<a-spin :spinning="confirmLoading">
<j-form-container :disabled="formDisabled">
<a-form :form="form" slot="detail">
<a-form-model ref="form" :model="model" slot="detail" :rules="validatorRules">
<a-row>
<a-col :span="24">
<a-form-item label="租户名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['name']" placeholder="请输入租户名称"></a-input>
</a-form-item>
<a-form-model-item label="租户名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-model="model.name" placeholder="请输入租户名称"></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-item label="租户编号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number style="width: 100%" :min="1" v-decorator="['id',{rules: [{ required: true, message: '请输入租户编号'}]}]" placeholder="请输入租户编号"></a-input-number>
</a-form-item>
<a-form-model-item label="租户编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="id">
<a-input-number style="width: 100%" :min="1" v-model="model.id" placeholder="请输入租户编号" :disabled="disabledId"></a-input-number>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择开始时间" v-decorator="['beginDate']" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
</a-form-item>
<a-form-model-item label="开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择开始时间" v-model="model.beginDate" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择结束时间" v-decorator="['endDate']" :trigger-change="true" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
</a-form-item>
<a-form-model-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-date placeholder="请选择结束时间" v-model="model.endDate" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group name="tenantStatus" v-decorator="[ 'status', {initialValue:1}]">
<a-form-model-item label="状态" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group name="tenantStatus" v-model="model.status">
<a-radio :value="1"></a-radio>
<a-radio :value="0"></a-radio>
</a-radio-group>
</a-form-item>
</a-form-model-item>
</a-col>
<a-col v-if="showFlowSubmitButton" :span="24" style="text-align: center">
<a-button @click="submitForm"> </a-button>
</a-col>
</a-row>
</a-form>
</a-form-model>
</j-form-container>
</a-spin>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import pick from 'lodash.pick'
import { validateDuplicateValue } from '@/utils/util'
import JFormContainer from '@/components/jeecg/JFormContainer'
import JDate from '@/components/jeecg/JDate'
@ -77,8 +75,8 @@
},
data () {
return {
form: this.$form.createForm(this),
model: {},
model: {status:1},
id:'',
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
@ -89,6 +87,7 @@
},
confirmLoading: false,
validatorRules: {
id:[ { required: true, message: '!' },]
},
url: {
add: "/sys/tenant/add",
@ -108,6 +107,9 @@
}
return this.disabled
},
disabledId(){
return this.id?true : false;
},
showFlowSubmitButton(){
if(this.normal===false){
if(this.formData.disabled===false){
@ -124,16 +126,10 @@
this.showFlowData();
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
show (record) {
this.model = record?Object.assign({}, record):this.model;
this.id = record?record.id:'';
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'id','name','beginDate','endDate','status'))
})
},
showFlowData(){
if(this.normal === false){
@ -148,21 +144,19 @@
submitForm () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
if(!this.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
method = 'put';
}
let formData = Object.assign(this.model, values);
console.log("表单提交数据",formData)
httpAction(httpurl,formData,method).then((res)=>{
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
@ -175,12 +169,14 @@
}).finally(() => {
that.confirmLoading = false;
})
}else{
return false;
}
})
},
popupCallback(row){
this.form.setFieldsValue(pick(row, 'id', 'name','beginDate','endDate','status'))
this.model = Object.assign(this.model, row);
},
}
}

View File

@ -13,7 +13,6 @@
</template>
<script>
import TenantForm from './TenantForm'
export default {
name: "TenantModal",
@ -32,13 +31,13 @@
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
this.$refs.realForm.show();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
this.$refs.realForm.show(record);
})
},
close () {

View File

@ -20,138 +20,112 @@
</template>
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-model ref="form" :model="model" :rules="validatorRules">
<a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入用户账号" v-decorator.trim="[ 'username', validatorRules.username]" :readOnly="!!model.id"/>
</a-form-item>
<a-form-model-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="username">
<a-input placeholder="请输入用户账号" v-model="model.username" :readOnly="!!model.id"/>
</a-form-model-item>
<template v-if="!model.id">
<a-form-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol" >
<a-input type="password" placeholder="请输入登录密码" v-decorator="[ 'password',validatorRules.password]" />
</a-form-item>
<a-form-model-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="password" >
<a-input type="password" placeholder="请输入登录密码" v-model="model.password" />
</a-form-model-item>
<a-form-item label="确认密码" :labelCol="labelCol" :wrapperCol="wrapperCol" >
<a-input type="password" @blur="handleConfirmBlur" placeholder="请重新输入登录密码" v-decorator="[ 'confirmpassword', validatorRules.confirmpassword]"/>
</a-form-item>
<a-form-model-item label="确认密码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="confirmpassword" >
<a-input type="password" @blur="handleConfirmBlur" placeholder="请重新输入登录密码" v-model="model.confirmpassword"/>
</a-form-model-item>
</template>
<a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" >
<a-input placeholder="请输入用户姓名" v-decorator.trim="[ 'realname', validatorRules.realname]" />
</a-form-item>
<a-form-model-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="realname">
<a-input placeholder="请输入用户姓名" v-model="model.realname" />
</a-form-model-item>
<a-form-item label="工号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入工号" v-decorator.trim="[ 'workNo', validatorRules.workNo]" />
</a-form-item>
<a-form-model-item label="工号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workNo">
<a-input placeholder="请输入工号" v-model="model.workNo" />
</a-form-model-item>
<a-form-item label="职务" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-position placeholder="请选择职务" :multiple="false" v-decorator="['post', {}]"/>
</a-form-item>
<a-form-model-item label="职务" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-select-position placeholder="请选择职务" :multiple="false" v-model="model.post"/>
</a-form-model-item>
<a-form-item label="角色分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!roleDisabled" >
<a-select
mode="multiple"
:disabled="departDisabled"
style="width: 100%"
placeholder="请选择用户角色"
optionFilterProp = "children"
v-model="selectedRole"
:getPopupContainer= "(target) => target.parentNode">
<a-select-option v-for="(role,roleindex) in roleList" :key="roleindex.toString()" :value="role.id">
{{ role.roleName }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-model-item label="角色分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!roleDisabled" >
<j-multi-select-tag
:disabled="disableSubmit"
v-model="model.selectedroles"
:options="rolesOptions"
placeholder="请选择角色">
</j-multi-select-tag>
</a-form-model-item>
<!---->
<a-form-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
<a-input-search
placeholder="点击选择部门"
v-model="checkedDepartNameString"
readOnly
@search="onSearch">
<a-button slot="enterButton" icon="search"></a-button>
</a-input-search>
</a-form-item>
<a-form-model-item label="部门分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
<j-select-depart v-model="model.selecteddeparts" :multi="true" @back="backDepartInfo" :backDepart="true"></j-select-depart>
</a-form-model-item>
<!---->
<a-form-item label="租户分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
<a-select
mode="multiple"
style="width: 100%"
placeholder="请选择租户分配"
<a-form-model-item label="租户分配" :labelCol="labelCol" :wrapperCol="wrapperCol" v-show="!departDisabled">
<j-multi-select-tag
:disabled="disableSubmit"
v-model="currentTenant">
<a-select-option v-for="(item, index) in tenantList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
v-model="model.relTenantIds"
:options="tenantsOptions"
placeholder="请选择租户">
</j-multi-select-tag>
</a-form-model-item>
<!-- update--begin--autor:wangshuai-----date:20200108------for------ -->
<a-form-item label="身份" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group
v-model="identity"
@change="identityChange">
<a-radio value="1"></a-radio>
<a-radio value="2"></a-radio>
<a-form-model-item label="身份" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-radio-group v-model="model.userIdentity" @change="identityChange">
<a-radio :value="1"></a-radio>
<a-radio :value="2"></a-radio>
</a-radio-group>
</a-form-item>
<a-form-item label="负责部门" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="departIdShow==true">
<a-select
mode="multiple"
style="width: 100%"
placeholder="请选择负责部门"
v-model="departIds"
optionFilterProp = "children"
:getPopupContainer = "(target) => target.parentNode"
:dropdownStyle="{maxHeight:'200px',overflow:'auto'}"
>
<a-select-option v-for="item in resultDepartOptions" :key="item.key" :value="item.key"
>{{item.title}}</a-select-option
>
</a-select>
</a-form-item>
<!-- update--end--autor:wangshuai-----date:20200108------for------ -->
<a-form-item label="头像" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-image-upload class="avatar-uploader" text="上传" v-model="fileList" ></j-image-upload>
</a-form-item>
</a-form-model-item>
<a-form-model-item label="负责部门" :labelCol="labelCol" :wrapperCol="wrapperCol" v-if="departIdShow==true">
<j-multi-select-tag
:disabled="disableSubmit"
v-model="model.departIds"
:options="nextDepartOptions"
placeholder="请选择负责部门">
</j-multi-select-tag>
</a-form-model-item>
<a-form-item label="生日" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-form-model-item label="头像" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-image-upload class="avatar-uploader" text="上传" v-model="model.avatar" ></j-image-upload>
</a-form-model-item>
<a-form-model-item label="生日" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-date-picker
style="width: 100%"
placeholder="请选择生日"
v-decorator="['birthday', {initialValue:!model.birthday?null:moment(model.birthday,dateFormat)}]"
v-model="model.birthday"
:format="dateFormat"
:getCalendarContainer="node => node.parentNode"/>
</a-form-item>
</a-form-model-item>
<a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-decorator="[ 'sex', {}]" placeholder="请选择性别" :getPopupContainer= "(target) => target.parentNode">
<a-form-model-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select v-model="model.sex" placeholder="请选择性别" :getPopupContainer= "(target) => target.parentNode">
<a-select-option :value="1"></a-select-option>
<a-select-option :value="2"></a-select-option>
</a-select>
</a-form-item>
</a-form-model-item>
<a-form-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入邮箱" v-decorator="[ 'email', validatorRules.email]" />
</a-form-item>
<a-form-model-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="email">
<a-input placeholder="请输入邮箱" v-model="model.email" />
</a-form-model-item>
<a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入手机号码" :disabled="isDisabledAuth('user:form:phone')" v-decorator="[ 'phone', validatorRules.phone]" />
</a-form-item>
<a-form-model-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="phone">
<a-input placeholder="请输入手机号码" :disabled="isDisabledAuth('user:form:phone')" v-model="model.phone" />
</a-form-model-item>
<a-form-item label="座机" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入座机" v-decorator="[ 'telephone', validatorRules.telephone]"/>
</a-form-item>
<a-form-model-item label="座机" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="telephone">
<a-input placeholder="请输入座机" v-model="model.telephone" />
</a-form-model-item>
<a-form-item label="工作流引擎" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag v-decorator="['activitiSync', {}]" placeholder="请选择是否同步工作流引擎" :type="'radio'" :triggerChange="true" dictCode="activiti_sync"/>
</a-form-item>
<a-form-model-item label="工作流引擎" :labelCol="labelCol" :wrapperCol="wrapperCol">
<j-dict-select-tag v-model="model.activitiSync" placeholder="请选择是否同步工作流引擎" :type="'radio'" dictCode="activiti_sync"/>
</a-form-model-item>
</a-form>
</a-form-model>
</a-spin>
<depart-window ref="departWindow" @ok="modalFormOk"></depart-window>
<div class="drawer-bootom-button" v-show="!disableSubmit">
<a-popconfirm title="确定放弃编辑?" @confirm="handleCancel" okText="确定" cancelText="取消">
@ -163,25 +137,17 @@
</template>
<script>
import pick from 'lodash.pick'
import moment from 'moment'
import Vue from 'vue'
// 引入搜索部门弹出框的组件
import departWindow from './DepartWindow'
import JSelectPosition from '@/components/jeecgbiz/JSelectPosition'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { getAction } from '@/api/manage'
import {addUser,editUser,queryUserRole,queryall } from '@/api/api'
import { addUser,editUser,queryUserRole,queryall } from '@/api/api'
import { disabledAuthFilter } from "@/utils/authFilter"
import {duplicateCheck } from '@/api/api'
import JImageUpload from '../../../components/jeecg/JImageUpload'
import { duplicateCheck } from '@/api/api'
export default {
name: "UserModal",
components: {
JImageUpload,
departWindow,
JSelectPosition
},
data () {
return {
@ -191,67 +157,28 @@
drawerWidth:700,
modaltoggleFlag:true,
confirmDirty: false,
selectedDepartKeys:[], //保存用户选择部门id
checkedDepartKeys:[],
checkedDepartNames:[], // 保存部门的名称 =>title
checkedDepartNameString:"", // 保存部门的名称 =>title
resultDepartOptions:[],
userId:"", //保存用户id
disableSubmit:false,
userDepartModel:{userId:'',departIdList:[]}, // 保存SysUserDepart的用户部门中间表数据需要的对象
dateFormat:"YYYY-MM-DD",
validatorRules:{
username:{
rules: [{
required: true, message: '!'
},{
validator: this.validateUsername,
}]
},
password:{
rules: [{
required: true,
pattern:/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
message: '8!'
}, {
validator: this.validateToNextPassword,
}],
},
confirmpassword:{
rules: [{
required: true, message: '!',
}, {
validator: this.compareToFirstPassword,
}],
},
realname:{rules: [{ required: true, message: '!' }]},
phone:{rules: [{validator: this.validatePhone}]},
email:{
rules: [{
validator: this.validateEmail
}],
},
username:[{required: true, message: '!'},
{validator: this.validateUsername,}],
password: [{required: true,pattern:/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,message: '8!'},
{validator: this.validateToNextPassword,trigger: 'change'}],
confirmpassword: [{required: true, message: '!',},
{ validator: this.compareToFirstPassword,}],
realname:[{ required: true, message: '!' }],
phone: [{validator: this.validatePhone}],
email: [{validator: this.validateEmail}],
roles:{},
// sex:{initialValue:((!this.model.sex)?"": (this.model.sex+""))}
workNo: {
rules: [
{ required: true, message: '' },
{ validator: this.validateWorkNo }
]
},
telephone: {
rules: [
{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '' },
]
}
workNo:[ { required: true, message: '' },
{ validator: this.validateWorkNo }],
telephone: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '' },]
},
departIdShow:false,
departIds:[], //负责部门id
title:"操作",
visible: false,
model: {},
roleList:[],
selectedRole:[],
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
@ -263,8 +190,6 @@
uploadLoading:false,
confirmLoading: false,
headers:{},
form:this.$form.createForm(this),
picUrl: "",
url: {
fileUpload: window._CONFIG['domianURL']+"/sys/common/upload",
userWithDepart: "/sys/user/userDepartList", // 引入为指定用户查看部门信息需要的url
@ -272,17 +197,16 @@
syncUserByUserName:"/act/process/extActProcess/doSyncUserByUserName",//同步用户到工作流
queryTenantList: '/sys/tenant/queryList'
},
identity:"1",
fileList:[],
tenantList: [],
currentTenant:[]
tenantsOptions: [],
rolesOptions:[],
nextDepartOptions:[],
}
},
created () {
const token = Vue.ls.get(ACCESS_TOKEN);
this.headers = {"X-Access-Token":token}
this.initRoleList()
this.initTenantList()
},
computed:{
uploadAction:function () {
@ -290,16 +214,33 @@
}
},
methods: {
add () {
this.refresh();
this.edit({activitiSync:'1',userIdentity:1});
},
edit (record) {
let that = this;
that.visible = true;
//根据屏幕宽度自适应抽屉宽度
this.resetScreenSize();
that.userId = record.id;
that.model = Object.assign({},{selectedroles:'',selecteddeparts:''}, record);
//身份为上级显示负责部门,否则不显示
if(this.model.userIdentity==2){
this.departIdShow=true;
}else{
this.departIdShow=false;
}
if(record.hasOwnProperty("id")){
that.getUserRoles(record.id);
that.getUserDeparts(record.id);
}
console.log('that.model=',that.model)
},
isDisabledAuth(code){
return disabledAuthFilter(code);
},
initTenantList(){
getAction(this.url.queryTenantList).then(res=>{
if(res.success){
this.tenantList = res.result
}
})
},
//窗口最大化切换
toggleScreen(){
if(this.modaltoggleFlag){
@ -309,165 +250,104 @@
}
this.modaltoggleFlag = !this.modaltoggleFlag;
},
initialRoleList(){
queryall().then((res)=>{
if(res.success){
this.roleList = res.result;
}else{
console.log(res.message);
}
});
},
loadUserRoles(userid){
queryUserRole({userid:userid}).then((res)=>{
if(res.success){
this.selectedRole = res.result;
}else{
console.log(res.message);
}
});
},
refresh () {
this.selectedDepartKeys=[];
this.checkedDepartKeys=[];
this.checkedDepartNames=[];
this.checkedDepartNameString = "";
this.userId=""
this.resultDepartOptions=[];
this.departId=[];
this.departIdShow=false;
this.currentTenant = []
},
add () {
this.picUrl = "";
this.refresh();
this.edit({activitiSync:'1'});
},
edit (record) {
this.resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
let that = this;
that.initialRoleList();
that.checkedDepartNameString = "";
that.form.resetFields();
if(record.hasOwnProperty("id")){
that.loadUserRoles(record.id);
setTimeout(() => {
this.fileList = record.avatar;
}, 5)
}
that.userId = record.id;
that.visible = true;
that.model = Object.assign({}, record);
that.$nextTick(() => {
that.form.setFieldsValue(pick(this.model,'username','sex','realname','email','phone','activitiSync','workNo','telephone','post'))
});
//身份为上级显示负责部门,否则不显示
if(this.model.userIdentity=="2"){
this.identity="2";
this.departIdShow=true;
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize(){
let screenWidth = document.body.clientWidth;
if(screenWidth < 500){
this.drawerWidth = screenWidth;
}else{
this.identity="1";
this.departIdShow=false;
this.drawerWidth = 700;
}
// 调用查询用户对应的部门信息的方法
that.checkedDepartKeys = [];
that.loadCheckedDeparts();
//update-begin-author:taoyan date:2020710 for:多租户配置
if(!record.relTenantIds || record.relTenantIds.length==0){
this.currentTenant = []
}else{
this.currentTenant = record.relTenantIds.split(',').map(Number);
}
//update-end-author:taoyan date:2020710 for:多租户配置
},
//
loadCheckedDeparts(){
let that = this;
if(!that.userId){return}
getAction(that.url.userWithDepart,{userId:that.userId}).then((res)=>{
that.checkedDepartNames = [];
//初始化租户字典
initTenantList(){
getAction(this.url.queryTenantList).then(res=>{
if(res.success){
var depart=[];
var departId=[];
for (let i = 0; i < res.result.length; i++) {
that.checkedDepartNames.push(res.result[i].title);
this.checkedDepartNameString = this.checkedDepartNames.join(",");
that.checkedDepartKeys.push(res.result[i].key);
//新增负责部门选择下拉框
depart.push({
key:res.result[i].key,
title:res.result[i].title
})
departId.push(res.result[i].key)
}
that.resultDepartOptions=depart;
//判断部门id是否存在不存在择直接默认当前所在部门
if(this.model.departIds){
this.departIds=this.model.departIds.split(",");
}else{
this.departIds=departId;
}
that.userDepartModel.departIdList = that.checkedDepartKeys
}else{
console.log(res.message);
this.tenantsOptions = res.result.map((item,index,arr)=>{
let c = {label:item.name, value: item.id+""}
return c;
})
console.log('this.tenantsOptions: ',this.tenantsOptions)
}
})
},
//初始化角色字典
initRoleList(){
queryall().then((res)=>{
if(res.success){
this.rolesOptions = res.result.map((item,index,arr)=>{
let c = {label:item.roleName, value:item.id}
return c;
})
console.log('this.rolesOptions: ',this.rolesOptions)
}
});
},
getUserRoles(userid){
queryUserRole({userid:userid}).then((res)=>{
if(res.success){
this.model.selectedroles = res.result.join(",");
console.log('that.model.selectedroles=',this.model.selectedroles)
}
});
},
getUserDeparts(userid){
let that = this;
getAction(that.url.userWithDepart,{userId:userid}).then((res)=>{
if(res.success){
let departOptions=[];
let selectDepartKeys=[]
for (let i = 0; i < res.result.length; i++) {
selectDepartKeys.push(res.result[i].key);
//新增负责部门选择下拉框
departOptions.push({
value: res.result[i].key,
label: res.result[i].title
})
}
that.model.selecteddeparts = selectDepartKeys.join(",")
that.nextDepartOptions=departOptions;
console.log('that.nextDepartOptions=',that.nextDepartOptions)
}
})
},
backDepartInfo(info) {
this.model.departIds = this.model.selecteddeparts;
this.nextDepartOptions = info.map((item,index,arr)=>{
let c = {label:item.text, value: item.value+""}
return c;
})
},
refresh () {
this.userId=""
this.nextDepartOptions=[];
this.departIdShow=false;
},
close () {
this.$emit('close');
this.visible = false;
this.disableSubmit = false;
this.selectedRole = [];
this.userDepartModel = {userId:'',departIdList:[]};
this.checkedDepartNames = [];
this.checkedDepartNameString='';
this.checkedDepartKeys = [];
this.selectedDepartKeys = [];
this.resultDepartOptions=[];
this.departIds=[];
this.nextDepartOptions=[];
this.departIdShow=false;
this.identity="1";
this.fileList=[];
this.$refs.form.resetFields();
},
moment,
handleSubmit () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
if(!values.birthday){
values.birthday = '';
}else{
values.birthday = values.birthday.format(this.dateFormat);
}
let formData = Object.assign(this.model, values);
if(that.fileList != ''){
formData.avatar = that.fileList;
}else{
formData.avatar = null;
}
//update-begin-author:taoyan date:2020710 for:多租户配置
formData.relTenantIds = this.currentTenant.length>0?this.currentTenant.join(','):''
//update-end-author:taoyan date:2020710 for:多租户配置
formData.selectedroles = this.selectedRole.length>0?this.selectedRole.join(","):'';
formData.selecteddeparts = this.userDepartModel.departIdList.length>0?this.userDepartModel.departIdList.join(","):'';
formData.userIdentity=this.identity;
//如果是上级择传入departIds,否则为空
if(this.identity==="2"){
formData.departIds=this.departIds.join(",");
}else{
formData.departIds="";
if(this.model.userIdentity!==2){
this.model.departIds="";
}
// that.addDepartsToUser(that,formData); // 调用根据当前用户添加部门信息的方法
let obj;
if(!this.model.id){
formData.id = this.userId;
obj=addUser(formData);
this.model.id = this.userId;
obj=addUser(this.model);
}else{
obj=editUser(formData);
obj=editUser(this.model);
}
obj.then((res)=>{
if(res.success){
@ -478,32 +358,28 @@
}
}).finally(() => {
that.confirmLoading = false;
that.checkedDepartNames = [];
that.userDepartModel.departIdList = {userId:'',departIdList:[]};
that.close();
})
}else{
return false;
}
})
},
handleCancel () {
this.close()
},
validateToNextPassword (rule, value, callback) {
const form = this.form;
const confirmpassword=form.getFieldValue('confirmpassword');
validateToNextPassword (rule, value, callback) {
const confirmpassword=this.model.confirmpassword;
if (value && confirmpassword && value !== confirmpassword) {
callback('');
}
if (value && this.confirmDirty) {
form.validateFields(['confirm'], { force: true })
this.$refs.form.validateField(['confirmpassword']);
}
callback();
},
compareToFirstPassword (rule, value, callback) {
const form = this.form;
if (value && value !== form.getFieldValue('password')) {
compareToFirstPassword (rule, value, callback) {
if (value && value !== this.model.password) {
callback('');
} else {
callback()
@ -513,10 +389,7 @@
if(!value){
callback()
}else{
//update-begin--Author:kangxiaolin Date:20190826 for[05] 手机号不支持199号码段--------------------
if(new RegExp(/^1[3|4|5|7|8|9][0-9]\d{8}$/).test(value)){
//update-end--Author:kangxiaolin Date:20190826 for[05] 手机号不支持199号码段--------------------
var params = {
tableName: 'sys_user',
fieldName: 'phone',
@ -589,18 +462,10 @@
}
})
},
handleConfirmBlur (e) {
handleConfirmBlur(e) {
const value = e.target.value;
this.confirmDirty = this.confirmDirty || !!value
},
normFile (e) {
console.log('Upload event:', e);
if (Array.isArray(e)) {
return e
}
return e && e.fileList
},
beforeUpload: function(file){
var fileType = file.type;
if(fileType.indexOf('image')<0){
@ -609,65 +474,8 @@
}
//TODO 验证文件大小
},
handleChange (info) {
this.picUrl = "";
if (info.file.status === 'uploading') {
this.uploadLoading = true;
return
}
if (info.file.status === 'done') {
var response = info.file.response;
this.uploadLoading = false;
console.log(response);
if(response.success){
this.model.avatar = response.message;
this.picUrl = "Has no pic url yet";
}else{
this.$message.warning(response.message);
}
}
},
// 搜索用户对应的部门API
onSearch(){
this.$refs.departWindow.add(this.checkedDepartKeys,this.userId);
},
// 获取用户对应部门弹出框提交给返回的数据
modalFormOk (formData) {
this.checkedDepartNames = [];
this.selectedDepartKeys = [];
this.checkedDepartNameString = '';
this.userId = formData.userId;
this.userDepartModel.userId = formData.userId;
this.departIds=[];
this.resultDepartOptions=[];
var depart=[];
for (let i = 0; i < formData.departIdList.length; i++) {
this.selectedDepartKeys.push(formData.departIdList[i].key);
this.checkedDepartNames.push(formData.departIdList[i].title);
this.checkedDepartNameString = this.checkedDepartNames.join(",");
//新增部门选择,如果上面部门选择后不为空直接付给负责部门
depart.push({
key:formData.departIdList[i].key,
title:formData.departIdList[i].title
})
this.departIds.push(formData.departIdList[i].key)
}
this.resultDepartOptions=depart;
this.userDepartModel.departIdList = this.selectedDepartKeys;
this.checkedDepartKeys = this.selectedDepartKeys //更新当前的选择keys
},
// 根据屏幕变化,设置抽屉尺寸
resetScreenSize(){
let screenWidth = document.body.clientWidth;
if(screenWidth < 500){
this.drawerWidth = screenWidth;
}else{
this.drawerWidth = 700;
}
},
identityChange(e){
if(e.target.value==="1"){
if(e.target.value===1){
this.departIdShow=false;
}else{
this.departIdShow=true;

View File

@ -291,6 +291,7 @@
})
},
handleChangeCheckCode(){
this.form.setFieldsValue({inputCode: ''});
this.currdatetime = new Date().getTime();
getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
if(res.success){
@ -321,11 +322,16 @@
});
},
requestFailed (err) {
let errMsg=((err.response || {}).data || {}).message || err.message || "请求出现错误,请稍后再试";
this.$notification[ 'error' ]({
message: '',
description: ((err.response || {}).data || {}).message || err.message || "请求出现错误,请稍后再试",
description: errMsg,
duration: 4,
});
//密码错误后更新验证码
if(errMsg.indexOf('')>0){
this.handleChangeCheckCode();
}
this.loginBtn = false;
},
validateMobile(rule,value,callback){

File diff suppressed because it is too large Load Diff