This commit is contained in:
2021-05-21 14:04:32 +08:00
2 changed files with 21 additions and 95 deletions

View File

@@ -30,12 +30,7 @@
<a-input placeholder="请输入昵称" v-model="form.nickName" />
</a-form-model-item>
<a-form-model-item label="生日">
<a-date-picker
@change="(date) => form.birthday = date ? $moment(date).format('YYYY-MM-DD') : null"
class="w-100-p"
placeholder="请选择生日"
v-model="form.birthday"
/>
<a-date-picker @change="(date) => (form.birthday = date ? $moment(date).format('YYYY-MM-DD') : null)" class="w-100-p" placeholder="请选择生日" v-model="form.birthday" />
</a-form-model-item>
<a-form-model-item label="性别" prop="sex">
<a-radio-group v-model="form.sex">
@@ -68,59 +63,29 @@
<h3 class="h3">员工信息</h3>
<div class="yo-form-group">
<a-form-model-item label="所属组织机构" prop="sysEmpParam.orgId">
<a-tree-select
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
:tree-data="orgData"
placeholder="请选择所属组织机构"
tree-default-expand-all
v-model="form.sysEmpParam.orgId"
/>
<a-tree-select :dropdown-style="{ maxHeight: '300px', overflow: 'auto' }" :tree-data="orgData" placeholder="请选择所属组织机构" tree-default-expand-all v-model="form.sysEmpParam.orgId" />
</a-form-model-item>
<a-form-model-item label="工号">
<a-input placeholder="请输入工号" v-model="form.sysEmpParam.jobNum" />
</a-form-model-item>
<a-form-model-item label="职位信息" prop="sysEmpParam.posIdList">
<a-select mode="multiple" placeholder="请选择职位信息" v-model="form.sysEmpParam.posIdList">
<a-select-option
:key="i"
:value="item.id"
v-for="(item, i) in posData"
>{{ item.name }}</a-select-option>
<a-select-option :key="i" :value="item.id" v-for="(item, i) in posData">{{ item.name }}</a-select-option>
</a-select>
</a-form-model-item>
</div>
<h4 class="h4">附加信息</h4>
<div class="pl-md pr-md">
<a-table
:columns="extColumns"
:data-source="form.sysEmpParam.extIds"
:pagination="false"
size="small"
>
<a-table :columns="extColumns" :data-source="form.sysEmpParam.extIds" :pagination="false" size="small">
<template slot="footer">
<a-button @click="onAddExtData" block icon="plus" type="dashed">新增一项</a-button>
</template>
<template slot="orgId" slot-scope="text, record">
<a-tree-select
:default-value="text"
:dropdown-style="{ maxHeight: '300px', overflow: 'auto' }"
:tree-data="orgData"
@change="value => onChangeExtData(value, record, 'orgId')"
placeholder="请选择附加组织机构"
tree-default-expand-all
/>
<a-tree-select :default-value="text" :dropdown-style="{ maxHeight: '300px', overflow: 'auto' }" :tree-data="orgData" @change="(value) => onChangeExtData(value, record, 'orgId')" placeholder="请选择附加组织机构" tree-default-expand-all />
</template>
<template slot="posId" slot-scope="text, record">
<a-select
:default-value="text"
@change="value => onChangeExtData(value, record, 'posId')"
placeholder="请选择附加职位信息"
>
<a-select-option
:key="i"
:value="item.id"
v-for="(item, i) in posData"
>{{ item.name }}</a-select-option>
<a-select :default-value="text" @change="(value) => onChangeExtData(value, record, 'posId')" placeholder="请选择附加职位信息">
<a-select-option :key="i" :value="item.id" v-for="(item, i) in posData">{{ item.name }}</a-select-option>
</a-select>
</template>
<template slot="action" slot-scope="text, record">
@@ -180,9 +145,7 @@ export default {
trigger: 'blur',
},
],
email: [
{ pattern: /^\w{3,}(\.\w+)*@[A-z0-9]+(\.[A-z]{2,5}){1,2}$/, message: '邮箱格式不正确', trigger: 'blur' },
],
email: [{ pattern: /^\w{3,}(\.\w+)*@[A-z0-9]+(\.[A-z]{2,5}){1,2}$/, message: '邮箱格式不正确', trigger: 'blur' }],
'sysEmpParam.orgId': [{ required: true, message: '请选择所属组织机构' }],
'sysEmpParam.posIdList': [{ required: true, message: '请选择职位信息' }],
},
@@ -254,7 +217,7 @@ export default {
}
if (params.orgId) {
form.sysEmpParam.orgId = orgId;
form.sysEmpParam.orgId = params.orgId;
}
/** 将默认数据覆盖到form */

View File

@@ -5,12 +5,7 @@
2021-04-30
Lufthafen
-->
<yo-tree-layout
:load-data="loadTreeData"
@select="onSelect"
default-expanded-keys
ref="tree-layout"
>
<yo-tree-layout :load-data="loadTreeData" @select="onSelect" default-expanded-keys ref="tree-layout">
<container>
<a-card :bordered="false">
<Auth auth="sysUser:page">
@@ -20,17 +15,8 @@
<a-input allow-clear placeholder="请输入姓名、账号、手机号" v-model="query.searchValue" />
</a-form-model-item>
<a-form-model-item label="状态">
<a-select
:style="{ width: '170px' }"
allow-clear
placeholder="请选择状态"
v-model="query.searchStatus"
>
<a-select-option
:key="i"
:value="item.code"
v-for="(item, i) in codes.common_status"
>{{ item.value }}</a-select-option>
<a-select :style="{ width: '170px' }" allow-clear placeholder="请选择状态" v-model="query.searchStatus">
<a-select-option :key="i" :value="item.code" v-for="(item, i) in codes.common_status">{{ item.value }}</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item>
@@ -79,14 +65,7 @@
<a-list-item-meta>
<div slot="title">{{ record.nickName || record.name }}</div>
<div slot="description">{{ record.account }}</div>
<yo-image
:id="record.avatar"
:size="48"
icon="user"
shape="square"
slot="avatar"
type="avatar"
/>
<yo-image :id="record.avatar" :size="48" icon="user" shape="square" slot="avatar" type="avatar" />
</a-list-item-meta>
<div class="yo-list-content--h">
<div class="yo-list-content--h--item">
@@ -103,13 +82,7 @@
</div>
<Auth auth="sysUser:changeStatus">
<div class="yo-list-content--h--item text-center">
<a-switch
:checked="!record.status"
:checked-children="bindCodeValue(0, 'common_status')"
:loading="record.statusChanging"
:un-checked-children="bindCodeValue(1, 'common_status')"
@change="(checked) => onSetUserStatus(record, checked)"
/>
<a-switch :checked="!record.status" :checked-children="bindCodeValue(0, 'common_status')" :loading="record.statusChanging" :un-checked-children="bindCodeValue(1, 'common_status')" @change="(checked) => onSetUserStatus(record, checked)" />
</div>
</Auth>
</div>
@@ -119,24 +92,12 @@
</container>
<!-- 新增表单 -->
<yo-modal-form
:action="$api[api.add]"
:title="'新增' + name"
:width="1024"
@ok="onReloadData"
ref="add-form"
>
<yo-modal-form :action="$api[api.add]" :title="'新增' + name" :width="1024" @ok="onReloadData" ref="add-form">
<form-body mode="add" />
</yo-modal-form>
<!-- 编辑表单 -->
<yo-modal-form
:action="$api[api.edit]"
:title="'编辑' + name"
:width="1024"
@ok="onReloadData"
ref="edit-form"
>
<yo-modal-form :action="$api[api.edit]" :title="'编辑' + name" :width="1024" @ok="onReloadData" ref="edit-form">
<form-body mode="edit" />
</yo-modal-form>
@@ -227,7 +188,9 @@ export default {
onSelect([id]) {
/** 在选择事件中可以对右侧表格添加父节点id的查询条件 */
this.query = {
'sysEmpParam.orgId': id,
sysEmpParam: {
orgId: id,
},
};
this.onQuery();
},
@@ -260,7 +223,7 @@ export default {
onReset() {
/* 与普通查询页不同的是,这里的父节点参数不应该在重置后被清空 */
Object.keys(this.query).forEach((p) => {
if (p !== 'pid') {
if (p !== 'sysEmpParam') {
this.query[p] = undefined;
}
});
@@ -314,7 +277,7 @@ export default {
onOpen(formName, record) {
this.$refs[formName].onOpen({
record,
orgId: this.query['sysEmpParam.orgId'],
orgId: this.query.sysEmpParam.orgId,
/* 按需添加其他参数 */
/* ... */
});