|
@@ -1,6 +1,12 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <a-modal class="modalBox" :title="titleText" v-model="isshow" @cancle="cancel" width="35%">
|
|
|
|
|
|
+ <a-modal
|
|
|
|
+ class="modalBox"
|
|
|
|
+ :title="titleText"
|
|
|
|
+ v-model="isshow"
|
|
|
|
+ @cancle="cancel"
|
|
|
|
+ width="35%"
|
|
|
|
+ :footer="null">
|
|
<a-form :form="form" @submit="handleSubmit">
|
|
<a-form :form="form" @submit="handleSubmit">
|
|
<a-row :gutter="24">
|
|
<a-row :gutter="24">
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
@@ -8,11 +14,12 @@
|
|
<a-form-item label="员工姓名" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
|
|
<a-form-item label="员工姓名" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
|
|
<a-input
|
|
<a-input
|
|
placeholder="请输入员工姓名30个字以内"
|
|
placeholder="请输入员工姓名30个字以内"
|
|
|
|
+ :maxLength="30"
|
|
id="userModal-name"
|
|
id="userModal-name"
|
|
v-decorator="['formData.name', {
|
|
v-decorator="['formData.name', {
|
|
initialValue: formData.name,
|
|
initialValue: formData.name,
|
|
- rules: [{ required: true, message: '请输入员工姓名!' },{pattern:'^[^<|>]{1,30}$',message:'请输入不含<或>的字符,最多30个字符'}] }]"
|
|
|
|
- allowClear/>
|
|
|
|
|
|
+ rules: [{ required: true, message: '请输入员工姓名30个字以内!' },{pattern:'^[^<|>]{1,30}$',message:'请输入不含<或>的字符,最多30个字符'}] }]"
|
|
|
|
+ allowClear />
|
|
</a-form-item>
|
|
</a-form-item>
|
|
</a-col>
|
|
</a-col>
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
@@ -25,7 +32,7 @@
|
|
v-decorator="['formData.phone', {
|
|
v-decorator="['formData.phone', {
|
|
initialValue: formData.phone,
|
|
initialValue: formData.phone,
|
|
rules: [{ required: true, message: '请输入手机号码!' },{pattern:/^[1][0-9]{10}$/, message: '请输入正确的手机号码!'}] }]"
|
|
rules: [{ required: true, message: '请输入手机号码!' },{pattern:/^[1][0-9]{10}$/, message: '请输入正确的手机号码!'}] }]"
|
|
- allowClear/>
|
|
|
|
|
|
+ allowClear />
|
|
</a-form-item>
|
|
</a-form-item>
|
|
</a-col>
|
|
</a-col>
|
|
</a-row>
|
|
</a-row>
|
|
@@ -60,14 +67,8 @@
|
|
]"
|
|
]"
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
placeholder="请选择角色"
|
|
placeholder="请选择角色"
|
|
- mode="multiple"
|
|
|
|
- >
|
|
|
|
- <a-select-option
|
|
|
|
- v-for="item in roleList"
|
|
|
|
- :key="item.id"
|
|
|
|
- :disabled="item.isEnable == '0' ? true : false"
|
|
|
|
- >{{ item.name }}</a-select-option
|
|
|
|
- >
|
|
|
|
|
|
+ mode="multiple">
|
|
|
|
+ <a-select-option v-for="item in roleList" :key="item.id" :disabled="item.isEnable == '0' ? true : false">{{ item.name }}</a-select-option>
|
|
</a-select>
|
|
</a-select>
|
|
|
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
@@ -75,7 +76,7 @@
|
|
</a-row>
|
|
</a-row>
|
|
<a-row :gutter="24">
|
|
<a-row :gutter="24">
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
- <a-form-model-item class="form-label" label="所属机构" prop="orgCode" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
|
|
|
|
|
|
+ <a-form-item class="form-label" label="所属机构" prop="orgCode" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }">
|
|
<a-tree-select
|
|
<a-tree-select
|
|
id="userModal-orgCode"
|
|
id="userModal-orgCode"
|
|
allowClear
|
|
allowClear
|
|
@@ -92,7 +93,7 @@
|
|
rules: [{ required: true, message: '请选择所属机构!' }] },
|
|
rules: [{ required: true, message: '请选择所属机构!' }] },
|
|
]">
|
|
]">
|
|
</a-tree-select>
|
|
</a-tree-select>
|
|
- </a-form-model-item>
|
|
|
|
|
|
+ </a-form-item>
|
|
</a-col>
|
|
</a-col>
|
|
<!-- 状态 -->
|
|
<!-- 状态 -->
|
|
<a-col :span="12">
|
|
<a-col :span="12">
|
|
@@ -106,8 +107,8 @@
|
|
initialValue: formData.loginFlag,
|
|
initialValue: formData.loginFlag,
|
|
rules: [{ required: true, message: '请选择状态!' }] },
|
|
rules: [{ required: true, message: '请选择状态!' }] },
|
|
]">
|
|
]">
|
|
- <a-radio :value="1" id="userModal-loginFlag">是</a-radio>
|
|
|
|
- <a-radio :value="0" id="userModal-loginFlag">否</a-radio>
|
|
|
|
|
|
+ <a-radio :value="1" >是</a-radio>
|
|
|
|
+ <a-radio :value="0" >否</a-radio>
|
|
</a-radio-group>
|
|
</a-radio-group>
|
|
|
|
|
|
</a-form-item>
|
|
</a-form-item>
|
|
@@ -130,12 +131,17 @@
|
|
import {
|
|
import {
|
|
STable,
|
|
STable,
|
|
VSelect,
|
|
VSelect,
|
|
- Tree } from '@/components'
|
|
|
|
|
|
+ Tree
|
|
|
|
+} from '@/components'
|
|
import {
|
|
import {
|
|
saveUserPower
|
|
saveUserPower
|
|
-} from '@/api/card-voucher-user.js'
|
|
|
|
-import { getAllRole } from '@/api/card-voucher-role.js'
|
|
|
|
-import { findOrgTree } from '@/api/atorg.js'
|
|
|
|
|
|
+} from '@/api/supervision-user.js'
|
|
|
|
+import {
|
|
|
|
+ getAllRole
|
|
|
|
+} from '@/api/supervision-role.js'
|
|
|
|
+import {
|
|
|
|
+ findOrgTree
|
|
|
|
+} from '@/api/atorg.js'
|
|
export default {
|
|
export default {
|
|
name: 'UserModal',
|
|
name: 'UserModal',
|
|
components: {
|
|
components: {
|
|
@@ -165,15 +171,15 @@ export default {
|
|
form: this.$form.createForm(this, {
|
|
form: this.$form.createForm(this, {
|
|
name: 'miniForm'
|
|
name: 'miniForm'
|
|
}),
|
|
}),
|
|
- roleList: [], // 角色
|
|
|
|
- parentCodePaths: '', // 组织机构父路径
|
|
|
|
|
|
+ roleList: [], // 角色
|
|
|
|
+ parentCodePaths: '', // 组织机构父路径
|
|
formData: {
|
|
formData: {
|
|
- orgCode: null, // 组织机构
|
|
|
|
- name: '', // 员工姓名
|
|
|
|
|
|
+ orgCode: null, // 组织机构
|
|
|
|
+ name: '', // 员工姓名
|
|
loginFlag: '', // 状态
|
|
loginFlag: '', // 状态
|
|
- phone: '', // 手机号码
|
|
|
|
- sex: '', // 性别
|
|
|
|
- roleNames: undefined // 角色
|
|
|
|
|
|
+ phone: '', // 手机号码
|
|
|
|
+ sex: '', // 性别
|
|
|
|
+ roleNames: undefined // 角色
|
|
},
|
|
},
|
|
treeData: []
|
|
treeData: []
|
|
|
|
|
|
@@ -196,7 +202,7 @@ export default {
|
|
},
|
|
},
|
|
// 组织归属 change
|
|
// 组织归属 change
|
|
treeChange (value, label, extra) {
|
|
treeChange (value, label, extra) {
|
|
- this.parentCodePaths = extra.triggerNode.$options.propsData.dataRef.parentCodePaths
|
|
|
|
|
|
+ this.parentCodePaths = extra.triggerNode.$options.propsData.dataRef.parentCodePaths
|
|
},
|
|
},
|
|
// 递归函数
|
|
// 递归函数
|
|
recursionFun (data) {
|
|
recursionFun (data) {
|
|
@@ -222,10 +228,11 @@ export default {
|
|
this.form.validateFields((err, values) => {
|
|
this.form.validateFields((err, values) => {
|
|
if (!err) {
|
|
if (!err) {
|
|
values.formData.roleNames = values.formData.roleNames.join(',')
|
|
values.formData.roleNames = values.formData.roleNames.join(',')
|
|
- // values.formData.org.id = values.orgCode
|
|
|
|
- const formData = JSON.parse(JSON.stringify(values.formData))
|
|
|
|
- formData.org = { id: formData.orgCode }
|
|
|
|
- delete formData.orgCode
|
|
|
|
|
|
+ const formData = JSON.parse(JSON.stringify(values.formData))
|
|
|
|
+ formData.org = {
|
|
|
|
+ id: formData.orgCode
|
|
|
|
+ }
|
|
|
|
+ delete formData.orgCode
|
|
saveUserPower(Object.assign({
|
|
saveUserPower(Object.assign({
|
|
id: this.data.id ? this.data.id : ''
|
|
id: this.data.id ? this.data.id : ''
|
|
}, formData)).then(res => {
|
|
}, formData)).then(res => {
|
|
@@ -260,11 +267,11 @@ export default {
|
|
this.form.resetFields()
|
|
this.form.resetFields()
|
|
delete this.formData.id
|
|
delete this.formData.id
|
|
this.formData.orgCode = null // 所属机构
|
|
this.formData.orgCode = null // 所属机构
|
|
- this.formData.name = '' // 员工姓名
|
|
|
|
- this.formData.loginFlag = '' // 状态
|
|
|
|
- this.formData.phone = '' // 手机号码
|
|
|
|
- this.formData.sex = '' // 性别
|
|
|
|
- this.formData.roleNames = undefined // 角色
|
|
|
|
|
|
+ this.formData.name = '' // 员工姓名
|
|
|
|
+ this.formData.loginFlag = '' // 状态
|
|
|
|
+ this.formData.phone = '' // 手机号码
|
|
|
|
+ this.formData.sex = '' // 性别
|
|
|
|
+ this.formData.roleNames = undefined // 角色
|
|
},
|
|
},
|
|
// 获取角色列表接口
|
|
// 获取角色列表接口
|
|
getRoleData () {
|
|
getRoleData () {
|
|
@@ -276,14 +283,15 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ // 编辑赋值
|
|
pageInitData () {
|
|
pageInitData () {
|
|
const _this = this
|
|
const _this = this
|
|
this.titleText = '编辑用户'
|
|
this.titleText = '编辑用户'
|
|
- this.formData.orgCode = this.data.org.id // 组织机构
|
|
|
|
- this.formData.name = this.data.name // 员工姓名
|
|
|
|
- this.formData.loginFlag = Number(this.data.loginFlag) // 状态
|
|
|
|
- this.formData.phone = this.data.phone // 手机号码
|
|
|
|
- this.formData.sex = this.data.sex // 性别
|
|
|
|
|
|
+ this.formData.orgCode = this.data.org.id // 组织机构
|
|
|
|
+ this.formData.name = this.data.name // 员工姓名
|
|
|
|
+ this.formData.loginFlag = Number(this.data.loginFlag) // 状态
|
|
|
|
+ this.formData.phone = this.data.phone // 手机号码
|
|
|
|
+ this.formData.sex = this.data.sex // 性别
|
|
let roleNames = this.data.roleNames
|
|
let roleNames = this.data.roleNames
|
|
if (roleNames) {
|
|
if (roleNames) {
|
|
roleNames = roleNames.split(',')
|
|
roleNames = roleNames.split(',')
|
|
@@ -291,8 +299,7 @@ export default {
|
|
const arr = []
|
|
const arr = []
|
|
roleNames.map(item => {
|
|
roleNames.map(item => {
|
|
console.log(item)
|
|
console.log(item)
|
|
- const row = this.roleList.find(a => a.name == item)
|
|
|
|
- console.log(row, '------------juese')
|
|
|
|
|
|
+ const row = _this.roleList.find(a => a.name == item)
|
|
if (row) {
|
|
if (row) {
|
|
arr.push(row.id)
|
|
arr.push(row.id)
|
|
}
|
|
}
|
|
@@ -315,9 +322,8 @@ export default {
|
|
},
|
|
},
|
|
isshow (newValue, oldValue) {
|
|
isshow (newValue, oldValue) {
|
|
if (newValue) {
|
|
if (newValue) {
|
|
- this.getOrgData() // 打开弹窗获取组织机构数据
|
|
|
|
- this.getRoleData() // 打开弹窗获取角色列表数据
|
|
|
|
- console.log(this.data, '===shuju')
|
|
|
|
|
|
+ this.getOrgData() // 打开弹窗获取组织机构数据
|
|
|
|
+ this.getRoleData() // 打开弹窗获取角色列表数据
|
|
if (this.data.id) { // 编辑
|
|
if (this.data.id) { // 编辑
|
|
this.pageInitData()
|
|
this.pageInitData()
|
|
} else {
|
|
} else {
|
|
@@ -331,7 +337,7 @@ export default {
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style >
|
|
|
|
|
|
+<style scoped>
|
|
.ant-modal-footer {
|
|
.ant-modal-footer {
|
|
display: none;
|
|
display: none;
|
|
}
|
|
}
|