Commit 9132db3b authored by 周远喜's avatar 周远喜

saas项目初始化成功!

parent dab32f6c
<template>
<div class="addUser">
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row class="rowTitle100">
<Col :span="12">
<FormItem :label="l('userName')" prop="userName">
<Input v-model="entity.userName"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('cardNo')" prop="cardNo">
<Input v-model="entity.cardNo"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('status')" prop="status">
<Dictionary code="User.base.status" v-model="entity.status" type="radio"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('gender')" prop="gender">
<Dictionary code="User.base.gender" v-model="entity.gender" type="radio"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('birthday')" prop="birthday">
<DatePicker type="date" v-model="entity.birthday" placeholder="请选择"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('degreeId')" prop="degreeId">
<Dictionary code="User.base.degree" v-model="entity.degreeId"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('departmentTitle')" prop="departmentTitle">
<DepartmentSelect v-model="entity.departmentId" @on-change="setDepartmentTitle" />
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('phone')" prop="phone">
<Input v-model="entity.phone" />
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('email')">
<Input v-model="entity.email" />
</FormItem>
</Col>
<!-- <Col :span="12">
<FormItem :label="l('enableEquip')" prop="enableEquip">
<Input v-model="entity.enableEquip"></Input>
</FormItem>
</Col>-->
<Col :span="12">
<FormItem :label="l('positionId')" prop="positionId">
<Dictionary code="User.base.position" v-model="entity.positionId"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('titleId')" prop="titleId">
<Dictionary code="User.base.jobtitle" v-model="entity.titleId"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('licensedToWork')" prop="licensedToWork">
<Dictionary code="User.base.workLicense" v-model="entity.licensedToWork"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="3"></Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</div>
</template>
<script>
import Api from './api'
const valideTel = (rule, value, callback) => {
var re = /^1[3-9]{1}[0-9]{9}/
if (value === '' || value === null) {
callback(new Error('请输入手机号'))
} else if (!re.test(value)) {
callback(new Error('请输入正确手机号'))
} else {
callback()
}
}
export default {
name: 'Add',
components: {},
data() {
const validateCarNo = (rule, value, callback) => {
if (!value) {
return callback(new Error('员工编号不能为空'))
}
Api.list(value).then((r) => {
if (r.result.length > 0) {
return callback(new Error('员工编号已经存在'))
} else {
callback()
}
})
}
return {
disabled: false,
showDeptTree: false,
entity: {
gender: 1,
status: 1
},
rules: {
userName: [{ required: true, message: '必填', trigger: 'blur' }],
cardNo: [
{ required: true, message: '必填', trigger: 'blur' },
{ validator: validateCarNo, trigger: 'blur' }
],
departmentTitle: [
{ required: true, message: '必选', trigger: 'change' }
],
// email: [
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
// ],
phone: [{ validator: valideTel, required: true, trigger: 'blur' }]
// degreeId: [
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
// ],
// phone: [{ required: true, message: '必填', trigger: 'blur' }]
}
}
},
props: {
v: Object
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
Api.create(this.entity)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
//账户同步操作start
let parms = {
userId: r.result.id,
loginName: this.entity.phone, //用户电话
status:this.entity.status,//状态
tanantCode: this.$store.state.userInfo.tanantCode //商户号
}
Api.authAccount(parms).then((res) => {
if (res.success) {
this.$Message.success('账户同步成功')
//修改用户表的accountId start
let parms1 = {
userId: parms.userId,
accountId: res.result
}
Api.updateAccount(parms1).then((res1) => {
if (res1.success) {
this.$Message.success('操作成功')
this.$emit('on-ok')
}
else{
this.$Message.error('同步失败')
}
})
//修改用户表的accountId end
}
})
//账户同步操作end
} else {
this.$Message.error(r.error.message)
}
})
.catch((err) => {
// alert(JSON.stringify(err))
console.warn(err)
this.disabled = false
this.$Message.error(err.error.message)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'user' + '.' + key
return this.$t(key)
},
setDepartmentTitle(v, item) {
this.entity.departmentTitle = item.name
},
selectDepart() {
this.showDeptTree = true
},
getBirthday(value) {
this.entity.birthday = value
}
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
}
}
}
</script>
<style lang="less">
.addUser {
.ivu-radio-wrapper {
vertical-align: top;
}
}
</style>
<template>
<div class="addUser">
<Form ref="form" :model="entity" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('userName')" prop="userName">{{entity.userName}}</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('cardNo')" prop="cardNo">{{entity.cardNo}}</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('gender')" prop="gender">
<state code="User.base.gender" :value="entity.gender" type="text"></state>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('birthday')" prop="birthday">{{entity.birthday}}</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('degreeId')" prop="degreeId">
<state code="User.base.degree" :value="entity.degreeId" type="text"></state>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('departmentTitle')" prop="departmentTitle">{{entity.departmentTitle}}</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('status')" prop="status">
<state code="User.base.status" :value="entity.status" type="text"></state>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('phone')" prop="phone">{{entity.phone}}</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('email')" prop="email">{{entity.email}}</FormItem>
</Col>
<!-- <Col :span="12">
<FormItem :label="l('enableEquip')" prop="enableEquip">{{entity.enableEquip}}</FormItem>
</Col> -->
<Col :span="12">
<FormItem :label="l('positionId')" prop="positionId">
<state code="User.base.position" :value="entity.positionId" type="text"></state>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('titleId')" prop="titleId">
<state code="User.base.jobtitle" :value="entity.titleId" type="text"></state>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('licensedToWork')" prop="licensedToWork">
<state code="User.base.workLicense" :value="entity.licensedToWork" type="text"></state>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">{{entity.remark}}</FormItem>
</Col>
</Row>
</Form>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Add',
data() {
return {
entity: {}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result
this.$emit('on-load')
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'user' + '.' + key
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
<style lang="less">
.addUser {
.ivu-radio-wrapper {
vertical-align: top;
}
}
</style>
<template>
<div class="addUser">
<Form ref="form" :model="entity" :rules="rules" :label-width="100">
<Row class="rowTitle100">
<Col :span="12">
<FormItem :label="l('userName')" prop="userName">
<Input v-model="entity.userName"></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('cardNo')" prop="cardNo">
<span v-text="entity.cardNo"></span>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('status')" prop="status">
<Dictionary code="User.base.status" v-model="entity.status" type="radio"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('gender')" prop="gender">
<Dictionary code="User.base.gender" v-model="entity.gender" type="radio"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('birthday')" prop="birthday">
<DatePicker type="date" v-model="entity.birthday" style="width:100%" placeholder="请选择"></DatePicker>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('degreeId')" prop="degreeId">
<Dictionary code="User.base.degree" v-model="entity.degreeId"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('departmentTitle')" prop="departmentTitle">
<DepartmentSelect v-model="entity.departmentId" @on-change="setDepartmentTitle" />
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('phone')" prop="phone">
<Input v-model="entity.phone" />
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('email')">
<Input v-model="entity.email" />
</FormItem>
</Col>
<!-- <Col :span="12">
<FormItem :label="l('enableEquip')" prop="enableEquip">
<Input v-model="entity.enableEquip"></Input>
</FormItem>
</Col>-->
<Col :span="12">
<FormItem :label="l('positionId')" prop="positionId">
<Dictionary code="User.base.position" v-model="entity.positionId"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('titleId')" prop="titleId">
<Dictionary code="User.base.jobtitle" v-model="entity.titleId"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('licensedToWork')" prop="licensedToWork">
<Dictionary code="User.base.workLicense" v-model="entity.licensedToWork"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="entity.remark" type="textarea" :rows="3"></Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</div>
</template>
<script>
import Api from './api'
const valideTel = (rule, value, callback) => {
var re = /^1[3-9]{1}[0-9]{9}/
if (value === '' || value === null) {
callback(new Error('请输入手机号'))
} else if (!re.test(value)) {
callback(new Error('请输入正确手机号'))
} else {
callback()
}
}
export default {
name: 'Edit',
data() {
return {
disabled: false,
showDeptTree: false,
entity: {},
rules: {
userName: [{ required: true, message: '必填', trigger: 'blur' }],
departmentTitle: [{ required: true, message: '必选', trigger: 'blur' }],
//cardNo: [{ required: true, message: '必填', trigger: 'blur' }],
// birthday: [{ required: true, message: '必填', trigger: 'change' }],
// degreeId: [
// { required: true, message: '必填', trigger: 'blur', type: 'number' }
// ],
// email: [
// { required: true, message: '必填', trigger: 'blur', type: 'email' }
// ],
phone: [{ validator: valideTel, required: true, trigger: 'blur' }]
}
}
},
props: {
eid: Number
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result
this.$emit('on-load')
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true
Api.update(this.entity)
.then((r) => {
this.disabled = false
if (r.success) {
this.$Message.success('保存成功')
//账户同步操作start
if (this.entity.accountId > 0) {
//账户已同步的情况下
let parms2 = {
accountId: this.entity.accountId,
userId: this.entity.id,
loginName: this.entity.phone, //用户电话
status: this.entity.status,
tanantCode: this.$store.state.userInfo.tanantCode //商户号
}
Api.authAccount(parms2).then((res) => {
//同步电话信息等
if (res.success) {
this.$Message.success('账户同步成功')
}
else
{
this.$Message.error('账户同步失败')
}
})
} else {
//账户新建后还未同步成功的情况下
let parms = {
userId: this.entity.id,
loginName: this.entity.phone, //用户电话
status: this.entity.status,
tanantCode: this.$store.state.userInfo.tanantCode //商户号
}
Api.authAccount(parms).then((res1) => {
if (res1.success) {
this.$Message.success('账户同步成功')
//修改用户表的accountId start
let parms1 = {
userId: parms.userId,
accountId: res1.result //账户同步成功后返回的accountId
}
Api.updateAccount(parms1).then((res2) => {
if (res2.success) {
this.$Message.success('操作成功')
} else {
this.$Message.error('操作失败')
}
})
//修改用户表的accountId end
}
})
}
//账户同步操作end
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
})
.catch((err) => {
this.disabled = false
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'user' + '.' + key
return this.$t(key)
},
setDepartmentTitle(v, item) {
if (item) {
this.entity.departmentTitle = item.name
}
},
getBirthday(value) {
this.entity.birthday = value
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v)
}
}
}
}
</script>
<style lang="less">
.addUser {
.ivu-radio-wrapper {
vertical-align: top;
}
}
</style>
This diff is collapsed.
<template>
<div class="addUser">
<Form ref="form" :model="condition" :label-width="100">
<Row class="rowTitle100">
<Col :span="12" v-if="condition.id.show">
<FormItem :label="l('id')" prop="id">
<Input v-model="condition.id.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.userName.show">
<FormItem :label="l('userName')" prop="userName">
<Input v-model="condition.userName.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.cardTypeId.show">
<FormItem :label="l('cardTypeId')" prop="cardTypeId">
<Input v-model="condition.cardTypeId.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.cardNo.show">
<FormItem :label="l('cardNo')" prop="cardNo">
<Input v-model="condition.cardNo.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.status.show">
<FormItem :label="l('status')" prop="status">
<Dictionary code="User.base.status" v-model="condition.status.value" type="radio"></Dictionary>
</FormItem>
</Col>
<Col :span="12" v-if="condition.gender.show">
<FormItem :label="l('gender')" prop="gender">
<Dictionary code="User.base.gender" v-model="condition.gender.value" type="radio"></Dictionary>
</FormItem>
</Col>
<Col :span="12" v-if="condition.birthday.show">
<FormItem :label="l('birthday')" prop="birthday">
<DTSearch v-model="condition.birthday.value" @on-change="setTime" :showFast="false" type="date"></DTSearch>
</FormItem>
</Col>
<Col :span="12" v-if="condition.departmentTitle.show">
<FormItem :label="l('departmentTitle')" prop="departmentTitle">
<DepartmentSelect
v-model="condition.departmentId.value"
@on-change="setDepartmentTitle"
/>
</FormItem>
</Col>
<Col :span="12" v-if="condition.national.show">
<FormItem :label="l('national')" prop="national">
<Input v-model="condition.national.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.creatorUserId.show">
<FormItem :label="l('creatorUserId')" prop="creatorUserId">
<Input v-model="condition.creatorUserId.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.creationTime.show">
<FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker type="daterange" v-model="condition.creationTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" v-if="condition.lastModifierUserId.show">
<FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<Input v-model="condition.lastModifierUserId.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.lastModificationTime.show">
<FormItem :label="l('lastModificationTime')" prop="lastModificationTime">
<DatePicker type="daterange" v-model="condition.lastModificationTime.value"></DatePicker>
</FormItem>
</Col>
<Col :span="12" v-if="condition.accountId.show">
<FormItem :label="l('accountId')" prop="accountId">
<Input v-model="condition.accountId.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.isDeleted.show">
<FormItem :label="l('isDeleted')" prop="isDeleted">
<Dictionary v-model="condition.isDeleted.value"></Dictionary>
</FormItem>
</Col>
<Col :span="12" v-if="condition.userType.show">
<FormItem :label="l('userType')" prop="userType">
<Input v-model="condition.userType.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.phone.show">
<FormItem :label="l('phone')" prop="phone">
<Input v-model="condition.phone.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.email.show">
<FormItem :label="l('email')" prop="email">
<Input v-model="condition.email.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.degreeId.show">
<FormItem :label="l('degreeId')" prop="degreeId">
<Dictionary code="User.base.degree" v-model="condition.degreeId.value"></Dictionary>
</FormItem>
</Col>
<Col :span="12" v-if="condition.avatarUrl.show">
<FormItem :label="l('avatarUrl')" prop="avatarUrl">
<Input v-model="condition.avatarUrl.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.enableEquip.show">
<FormItem :label="l('enableEquip')" prop="enableEquip">
<Input v-model="condition.enableEquip.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.positionId.show">
<FormItem :label="l('positionId')" prop="positionId">
<Dictionary code="User.base.position" v-model="condition.positionId.value"></Dictionary>
</FormItem>
</Col>
<Col :span="12" v-if="condition.titleId.show">
<FormItem :label="l('titleId')" prop="titleId">
<Dictionary code="User.base.jobtitle" v-model="condition.titleId.value"></Dictionary>
</FormItem>
</Col>
<Col :span="12" v-if="condition.licensedToWork.show">
<FormItem :label="l('licensedToWork')" prop="licensedToWork">
<Dictionary code="User.base.workLicense" v-model="condition.licensedToWork.value"></Dictionary>
</FormItem>
</Col>
<Col :span="12" v-if="condition.jobNo.show">
<FormItem :label="l('jobNo')" prop="jobNo">
<Input v-model="condition.jobNo.value"></Input>
</FormItem>
</Col>
<Col :span="24" v-if="condition.remark.show">
<FormItem :label="l('remark')" prop="remark">
<Input v-model="condition.remark.value"></Input>
</FormItem>
</Col>
<Col :span="12" v-if="condition.roleTitles.show">
<FormItem :label="l('roleTitles')" prop="roleTitles">
<Input v-model="condition.roleTitles.value"></Input>
</FormItem>
</Col>
</Row>
</Form>
</div>
</template>
<script>
import Api from './api'
export default {
name: 'Search',
data() {
return {
showDeptTree: false,
values: ['2001-01-01', '2015-12-05'],
condition: {
id: { op: 'Equal', value: null, show: false },
userName: { op: 'Equal', value: null, show: true },
cardTypeId: { op: 'Equal', value: null, show: false },
cardNo: { op: 'Equal', value: null, show: true },
gender: { op: 'Equal', value: null, show: true },
birthday: { op: 'Range', value: null, show: true },
degreeId: { op: 'Equal', value: null, show: true },
departmentId: { op: 'Equal', value: null, show: false },
national: { op: 'Equal', value: null, show: false },
status: { op: 'Equal', value: null, show: true },
creatorUserId: { op: 'Equal', value: null, show: false },
creationTime: { op: 'Range', value: null, show: false },
lastModifierUserId: { op: 'Equal', value: null, show: false },
lastModificationTime: { op: 'Range', value: null, show: false },
accountId: { op: 'Equal', value: null, show: false },
isDeleted: { op: 'Equal', value: null, show: false },
userType: { op: 'Equal', value: null, show: false },
phone: { op: 'Equal', value: null, show: true },
email: { op: 'Equal', value: null, show: true },
avatarUrl: { op: 'Equal', value: null, show: false },
enableEquip: { op: 'Equal', value: null, show: false },
licensedToWork: { op: 'Equal', value: null, show: true },
positionId: { op: 'Equal', value: null, show: true },
titleId: { op: 'Equal', value: null, show: true },
jobNo: { op: 'Equal', value: null, show: false },
remark: { op: 'Equal', value: null, show: false },
departmentTitle: { op: 'Equal', value: null, show: true },
departmentId: { op: 'Equal', value: null, show: false },
roleTitles: { op: 'Equal', value: null, show: true }
}
}
},
methods: {
handleClose() {
this.$emit('on-close')
},
l(key) {
key = 'user' + '.' + key
return this.$t(key)
},
setDepartmentTitle(v, item) {
this.condition.departmentTitle.value = item.name
},
setTime(v) {
this.condition.birthday.value = v
},
},
watch: {}
}
</script>
<style lang="less">
.addUser {
.ivu-radio-wrapper {
vertical-align: top;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment