Merge pull request #118 from veops/dev_ui

Dev UI
This commit is contained in:
pycook 2023-07-14 18:06:02 +08:00 committed by GitHub
commit 154f84d64e
14 changed files with 405 additions and 366 deletions

View File

@ -1,14 +1,13 @@
const appConfig = {
buildModules: ['cmdb'], // 需要编译的模块
useMessageNotice: false, // 是否启用消息通知
useTodoNotice: false, // 是否启用ticket通知
useClaimNotice: false, // 是否启动ticket claim 通知
useDagReviewNotice: false, // 是否启用dag审核通知
redirectTo: '/cmdb', // 首页的重定向路径
buildAclToModules: true, // 是否在各个应用下 内联权限管理
ssoLogoutURL: '/api/sso/logout',
useDFC: false,
showDocs: false,
buildModules: ['cmdb'], // 需要编译的模块
useMessageNotice: false, // 是否启用消息通知
useTodoNotice: false, // 是否启用ticket通知
useClaimNotice: false, // 是否启动ticket claim 通知
useDagReviewNotice: false, // 是否启用dag审核通知
redirectTo: '/cmdb', // 首页的重定向路径
buildAclToModules: true, // 是否在各个应用下 内联权限管理
ssoLogoutURL: '/api/sso/logout',
showDocs: false,
}
export default appConfig

View File

@ -2,7 +2,7 @@ import { axios } from '@/utils/request'
const urlPrefix = '/v1/acl'
export function searchResource (params) {
export function searchResource(params) {
return axios({
url: urlPrefix + `/resources`,
method: 'GET',
@ -10,7 +10,7 @@ export function searchResource (params) {
})
}
export function addResource (params) {
export function addResource(params) {
return axios({
url: urlPrefix + '/resources',
method: 'POST',
@ -18,7 +18,7 @@ export function addResource (params) {
})
}
export function updateResourceById (id, params) {
export function updateResourceById(id, params) {
return axios({
url: urlPrefix + `/resources/${id}`,
method: 'PUT',
@ -26,14 +26,15 @@ export function updateResourceById (id, params) {
})
}
export function deleteResourceById (id) {
export function deleteResourceById(id, params) {
return axios({
url: urlPrefix + `/resources/${id}`,
method: 'DELETE'
method: 'DELETE',
params
})
}
export function searchResourceType (params) {
export function searchResourceType(params) {
return axios({
url: urlPrefix + `/resource_types`,
method: 'GET',
@ -41,7 +42,7 @@ export function searchResourceType (params) {
})
}
export function addResourceType (params) {
export function addResourceType(params) {
return axios({
url: urlPrefix + '/resource_types',
method: 'POST',
@ -49,7 +50,7 @@ export function addResourceType (params) {
})
}
export function updateResourceTypeById (id, params) {
export function updateResourceTypeById(id, params) {
return axios({
url: urlPrefix + `/resource_types/${id}`,
method: 'PUT',
@ -57,7 +58,7 @@ export function updateResourceTypeById (id, params) {
})
}
export function deleteResourceTypeById (id) {
export function deleteResourceTypeById(id) {
return axios({
url: urlPrefix + `/resource_types/${id}`,
method: 'DELETE'
@ -65,7 +66,7 @@ export function deleteResourceTypeById (id) {
}
// add resource group
export function getResourceGroups (params) {
export function getResourceGroups(params) {
return axios({
url: `${urlPrefix}/resource_groups`,
method: 'GET',
@ -73,7 +74,7 @@ export function getResourceGroups (params) {
})
}
export function addResourceGroup (data) {
export function addResourceGroup(data) {
return axios({
url: `${urlPrefix}/resource_groups`,
method: 'POST',
@ -81,7 +82,7 @@ export function addResourceGroup (data) {
})
}
export function updateResourceGroup (_id, data) {
export function updateResourceGroup(_id, data) {
return axios({
url: `${urlPrefix}/resource_groups/${_id}`,
method: 'PUT',
@ -89,14 +90,14 @@ export function updateResourceGroup (_id, data) {
})
}
export function deleteResourceGroup (_id) {
export function deleteResourceGroup(_id) {
return axios({
url: `${urlPrefix}/resource_groups/${_id}`,
method: 'DELETE'
})
}
export function getResourceGroupItems (_id) {
export function getResourceGroupItems(_id) {
return axios({
url: `${urlPrefix}/resource_groups/${_id}/items`,
method: 'GET'

View File

@ -24,8 +24,12 @@
<a-form-item label="是否组">
<a-radio-group v-model="isGroup">
<a-radio :value="true"> </a-radio>
<a-radio :value="false"> </a-radio>
<a-radio :value="true">
</a-radio>
<a-radio :value="false">
</a-radio>
</a-radio-group>
</a-form-item>
<a-form-item>
@ -40,11 +44,12 @@
</template>
<script>
import { addResource, searchResourceType, addResourceGroup } from '@/modules/acl/api/resource'
/* eslint-disable */
import { addResource, searchResourceType } from '@/modules/acl/api/resource'
import { addResourceGroup } from '@/modules/acl/api/resource'
export default {
name: 'ResourceForm',
components: {},
data() {
return {
drawerTitle: '新增资源',
@ -119,7 +124,7 @@ export default {
// },
},
watch: {
'$route.name': function (newValue, oldValue) {
'$route.name': function(newValue, oldValue) {
this.getAllResourceTypes()
},
},

View File

@ -7,7 +7,14 @@
@close="() => (drawerVisible = false)"
:hasFooter="false"
>
<vxe-table :max-height="`${windowHeight - 150}px`" :data="resPerms" ref="rTable">
<vxe-table
stripe
size="mini"
class="ops-stripe-table"
:max-height="`${windowHeight - 150}px`"
:data="resPerms"
ref="rTable"
>
<vxe-column
field="name"
title="角色名"
@ -57,6 +64,10 @@
</a-button>
</template>
</vxe-column>
<template slot="empty">
<img :src="require(`@/assets/data_empty.png`)" />
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
</template>
</vxe-table>
<!-- <a-table
:columns="columns"

View File

@ -103,7 +103,7 @@ export default {
})
},
updateResourceType(id, data) {
updateResourceTypeById(id, data).then(res => {
updateResourceTypeById(id, data).then((res) => {
this.$message.success(`更新成功`)
this.handleOk()
this.onClose()
@ -112,7 +112,7 @@ export default {
},
createResourceType(data) {
addResourceType(data).then(res => {
addResourceType(data).then((res) => {
this.$message.success(`添加成功`)
this.handleOk()
this.onClose()

View File

@ -12,7 +12,14 @@
<a-select-option v-for="type in resourceTypes" :value="type.id" :key="type.id">{{ type.name }}</a-select-option>
</a-select>
</a-form-item>
<vxe-table :max-height="`${windowHeight - 180}px`" :data="records" ref="rTable">
<vxe-table
size="mini"
stripe
class="ops-stripe-table"
:max-height="`${windowHeight - 180}px`"
:data="records"
ref="rTable"
>
<vxe-column
field="name"
title="资源名"
@ -46,6 +53,10 @@
<a-tag color="cyan" v-for="(r, index) in row.permissions" :key="index">{{ r }}</a-tag>
</template>
</vxe-column>
<template slot="empty">
<img :src="require(`@/assets/data_empty.png`)" />
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
</template>
</vxe-table>
<!-- <a-table
:columns="columns"

View File

@ -10,7 +10,12 @@
}
"
>
<vxe-table :data="tableData" :max-height="`${windowHeight - 110}px`">
<vxe-table
size="mini"
stripe
class="ops-stripe-table"
:data="tableData"
:max-height="`${windowHeight - 110}px`">
<vxe-table-column field="name" title="资源名"></vxe-table-column>
<vxe-table-column field="uid" title="创建人">
<template #default="{row}">
@ -18,6 +23,10 @@
</template>
</vxe-table-column>
<vxe-table-column field="created_at" title="创建时间"></vxe-table-column>
<template slot="empty">
<img :src="require(`@/assets/data_empty.png`)" />
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
</template>
</vxe-table>
</CustomDrawer>
</template>

View File

@ -1,8 +1,9 @@
<template>
<div :style="{ backgroundColor: '#fff', padding: '24px' }">
<div class="resource-types-action-btn">
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem;">{{ btnName }}</a-button>
<a-button @click="handleCreate" type="primary" style="margin-right: 0.3rem">{{ btnName }}</a-button>
<a-input-search
class="ops-input"
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
placeholder="搜索 | 资源类型名"
v-model="searchName"
@ -15,31 +16,60 @@
"
></a-input-search>
</div>
<a-spin
:spinning="loading"
><vxe-grid :columns="tableColumns" :data="groups" :max-height="`${windowHeight - 185}px`" highlight-hover-row>
<template #id_default="{row}">
<a-tag color="cyan" v-for="perm in id2perms[row.id]" :key="perm.id">{{ perm.name }}</a-tag>
</template>
<template #action_default="{row}">
<a @click="handleEdit(row)"><a-icon type="edit"/></a>
<a-divider type="vertical" />
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" okText="是" cancelText="否">
<a style="color: red"><a-icon type="delete"/></a>
</a-popconfirm>
</template>
<template #pager>
<vxe-pager
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
:current-page.sync="tablePage.currentPage"
:page-size.sync="tablePage.pageSize"
:total="tablePage.total"
:page-sizes="pageSizeOptions"
@page-change="handlePageChange"
>
</vxe-pager>
</template> </vxe-grid
></a-spin>
<a-spin :spinning="loading">
<vxe-table
stripe
size="mini"
class="ops-stripe-table"
:data="groups"
:max-height="`${windowHeight - 185}px`"
highlight-hover-row
>
<!-- 1 -->
<vxe-table-column
field="name"
title="资源类型名"
:min-width="175"
fixed="left"
show-overflow
></vxe-table-column>
<!-- 2 -->
<vxe-table-column field="description" title="描述" :min-width="175"></vxe-table-column>
<!-- 3 -->
<vxe-table-column field="id" title="权限" :min-width="300">
<template #default="{ row }">
<a-tag color="cyan" v-for="perm in id2perms[row.id]" :key="perm.id">{{ perm.name }}</a-tag>
</template>
</vxe-table-column>
<!-- 4 -->
<vxe-table-column field="action" title="操作" :min-width="175" fixed="right">
<template #default="{ row }">
<a @click="handleEdit(row)"><a-icon type="edit" /></a>
<a-divider type="vertical" />
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" okText="是" cancelText="否">
<a style="color: red"><a-icon type="delete" /></a>
</a-popconfirm>
</template>
</vxe-table-column>
<template slot="empty">
<img :src="require(`@/assets/data_empty.png`)" />
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
</template>
</vxe-table>
<vxe-pager
size="mini"
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
:current-page.sync="tablePage.currentPage"
:page-size.sync="tablePage.pageSize"
:total="tablePage.total"
:page-sizes="pageSizeOptions"
@page-change="handlePageChange"
>
</vxe-pager>
</a-spin>
<resourceTypeForm ref="resourceTypeForm" :handleOk="handleOk"> </resourceTypeForm>
</div>
@ -110,7 +140,7 @@ export default {
}),
},
watch: {
'$route.name': function(newName, oldName) {
'$route.name': function (newName, oldName) {
this.tablePage = {
total: 0,
currentPage: 1,
@ -141,7 +171,11 @@ export default {
q: this.searchName,
}
searchResourceType(param).then((res) => {
this.tablePage = { ...this.tablePage, total: res.numfound, currentPage: res.page }
this.tablePage = {
...this.tablePage,
total: res.numfound,
currentPage: res.page,
}
this.groups = res.groups
this.id2perms = res.id2perms
this.loading = false

View File

@ -8,6 +8,7 @@
<a-space>
<a-button @click="handleCreate" type="primary">{{ btnName }}</a-button>
<a-input-search
class="ops-input"
placeholder="搜索 | 资源名"
v-model="searchName"
@search="
@ -65,56 +66,88 @@
></a-switch>
</a-space>
</div>
<a-spin
:spinning="loading"
><vxe-grid
:columns="tableColumns"
:data="tableData"
highlight-hover-row
:max-height="`${windowHeight - 245}px`"
:checkbox-config="{ reserve: true }"
@checkbox-change="changeCheckbox"
@checkbox-all="changeCheckbox"
ref="xTable"
row-id="id"
show-overflow
>
<template #name_header>
{{ isGroup ? '资源组名' : '资源名' }}
</template>
<template #action_default="{row}">
<span v-show="isGroup">
<a @click="handleDisplayMember(row)">成员</a>
<a-divider type="vertical" />
<a @click="handleGroupEdit(row)">编辑</a>
<a-divider type="vertical" />
</span>
<a-tooltip title="查看授权">
<a @click="handlePerm(row)"><a-icon type="eye"/></a>
</a-tooltip>
<a-divider type="vertical" />
<a-tooltip title="授权">
<a :style="{ color: '#4bbb13' }" @click="handlePermManage(row)">
<a-icon type="usergroup-add" />
</a>
</a-tooltip>
<a-divider type="vertical" />
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
<a style="color: red"><a-icon type="delete"/></a>
</a-popconfirm>
</template>
<template #pager>
<vxe-pager
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
:current-page.sync="tablePage.currentPage"
:page-size.sync="tablePage.pageSize"
:total="tablePage.total"
:page-sizes="pageSizeOptions"
@page-change="handlePageChange"
>
</vxe-pager>
</template> </vxe-grid
></a-spin>
<a-spin :spinning="loading">
<vxe-table
size="mini"
stripe
class="ops-stripe-table"
:data="tableData"
highlight-hover-row
:height="`${windowHeight - 280}px`"
:checkbox-config="{ reserve: true }"
@checkbox-change="changeCheckbox"
@checkbox-all="changeCheckbox"
ref="xTable"
row-id="id"
show-overflow
>
<!-- 1 -->
<vxe-table-column type="checkbox" fixed="left"></vxe-table-column>
<!-- 2 -->
<vxe-table-column field="name" title="资源名" :min-widh="150" fixed="left" show-overflow>
<template #title="{row}">
{{ row.isGroup ? '资源组名' : '资源名' }}
</template>
</vxe-table-column>
<!-- 3 -->
<vxe-table-column field="user" title="创建者" :min-widh="100"> </vxe-table-column>
<!-- 4 -->
<vxe-table-column field="created_at" title="创建时间" :min-widh="220" align="center"> </vxe-table-column>
<!-- 5 -->
<vxe-table-column field="updated_at" title="最后修改时间" :min-widh="220" fixed="center"> </vxe-table-column>
<!-- 6 -->
<vxe-table-column
field="action"
title="操作"
:min-widh="200"
fixed="right"
align="center"
show-overflow>
<template #default="{row}">
<span v-show="row.isGroup">
<a @click="handleDisplayMember(row)">成员</a>
<a-divider type="vertical" />
<a @click="handleGroupEdit(row)">编辑</a>
<a-divider type="vertical" />
</span>
<a-tooltip title="查看授权">
<a @click="handlePerm(row)"><a-icon type="eye"/></a>
</a-tooltip>
<a-divider type="vertical" />
<a-tooltip title="授权">
<a :style="{ color: '#4bbb13' }" @click="handlePermManage(row)">
<a-icon type="usergroup-add" />
</a>
</a-tooltip>
<a-divider type="vertical" />
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
<a style="color: red"><a-icon type="delete"/></a>
</a-popconfirm>
</template>
</vxe-table-column>
<template slot="empty">
<img :src="require(`@/assets/data_empty.png`)" />
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
</template>
</vxe-table>
<vxe-pager
size="mini"
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
:current-page.sync="tablePage.currentPage"
:page-size.sync="tablePage.pageSize"
:total="tablePage.total"
:page-sizes="pageSizeOptions"
@page-change="handlePageChange"
>
</vxe-pager>
</a-spin>
</div>
<div v-else style="text-align: center">
<a-icon style="font-size:50px; margin-bottom: 20px; color: orange" type="info-circle" />
@ -304,7 +337,7 @@ export default {
},
deleteResource(id) {
if (!this.isGroup) {
deleteResourceById(id).then((res) => {
deleteResourceById(id, { app_id: this.$route.name.split('_')[0] }).then((res) => {
this.$message.success(`删除成功`)
this.handleOk()
})

View File

@ -3,6 +3,7 @@
<div class="roles-action-btn">
<a-button @click="handleCreate" type="primary">{{ btnName }}</a-button>
<a-input-search
class="ops-input"
allowClear
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
placeholder="搜索 | 角色名"
@ -17,8 +18,11 @@
<a-checkbox :checked="is_all" @click="handleClickBoxChange">所有角色</a-checkbox>
</div>
<a-spin :spinning="loading">
<vxe-grid
:columns="tableColumns"
<vxe-table
stripe
class="ops-stripe-table"
size="mini"
resizable
:data="tableData"
:max-height="`${windowHeight - 185}px`"
highlight-hover-row
@ -26,54 +30,94 @@
:filter-config="{ remote: true }"
@filter-change="filterTableMethod"
>
<template #is_app_admin_default="{row}">
<a-icon type="check" v-if="row.is_app_admin" />
</template>
<template #inherit_default="{row}">
<a-tag color="cyan" v-for="role in id2parents[row.id]" :key="role.id">{{ role.name }}</a-tag>
</template>
<template #isVisualRole_default="{row}">
{{ row.uid ? '否' : '是' }}
</template>
<template #action_default="{row}">
<div style="width:300px">
<span>
<a-tooltip title="资源列表">
<a
v-if="$route.name !== 'acl_roles'"
@click="handleDisplayUserResource(row)"
><a-icon
type="file-search"
/></a>
</a-tooltip>
<a-divider type="vertical" />
<div v-if="!row.uid" style="display: inline-block">
<a-tooltip
title="用户列表"
><a @click="handleDisplayUserUnderRole(row)"><a-icon type="team"/></a
></a-tooltip>
<vxe-table-column
field="name"
title="角色名"
:min-width="150"
align="left"
fixed="left"
sortable
show-overflow>
</vxe-table-column>
<!-- 2 -->
<vxe-table-column field="is_app_admin" title="管理员" :min-width="100" align="center">
<template #default="{row}">
<a-icon type="check" v-if="row.is_app_admin" />
</template>
</vxe-table-column>
<vxe-table-column field="id" title="继承自" :min-width="150">
<template #default="{row}">
<a-tag color="cyan" v-for="role in id2parents[row.id]" :key="role.id">{{ role.name }}</a-tag>
</template>
</vxe-table-column>
<vxe-table-column
field="uid"
title="虚拟角色"
:min-width="100"
align="center"
:filters="[
{ label: '是', value: 1 },
{ label: '否', value: 0 },
]"
:filterMultiple="false"
:filter-method="({ value, row }) => {
return value === !row.uid
}">
<template #default="{row}">
{{ row.uid ? '否' : '是' }}
</template>
</vxe-table-column>
<vxe-table-column field="action" title="操作" :min-width="150" fixed="right">
<template #default="{row}">
<div style="width:300px">
<span>
<a-tooltip title="资源列表">
<a
v-if="$route.name !== 'acl_roles'"
@click="handleDisplayUserResource(row)"
><a-icon
type="file-search"
/></a>
</a-tooltip>
<a-divider type="vertical" />
</div>
<a @click="handleEdit(row)"><a-icon type="edit"/></a>
<a-divider type="vertical" />
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
<a style="color: red"><a-icon type="delete"/></a>
</a-popconfirm>
</span>
</div>
<div v-if="!row.uid" style="display: inline-block">
<a-tooltip
title="用户列表"
><a @click="handleDisplayUserUnderRole(row)"><a-icon type="team"/></a
></a-tooltip>
<a-divider type="vertical" />
</div>
<a @click="handleEdit(row)"><a-icon type="edit"/></a>
<a-divider type="vertical" />
<a-popconfirm title="确认删除?" @confirm="handleDelete(row)" @cancel="cancel" okText="是" cancelText="否">
<a style="color: red"><a-icon type="delete"/></a>
</a-popconfirm>
</span>
</div>
</template>
</vxe-table-column>
<template slot="empty">
<img :src="require(`@/assets/data_empty.png`)" />
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
</template>
<template #pager>
<vxe-pager
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
:current-page.sync="tablePage.currentPage"
:page-size.sync="tablePage.pageSize"
:total="tablePage.total"
:page-sizes="pageSizeOptions"
@page-change="handlePageChange"
>
</vxe-pager>
</template>
</vxe-grid>
</vxe-table>
<vxe-pager
size="mini"
:layouts="['Total', 'PrevPage', 'JumpNumber', 'NextPage', 'Sizes']"
:current-page.sync="tablePage.currentPage"
:page-size.sync="tablePage.pageSize"
:total="tablePage.total"
:page-sizes="pageSizeOptions"
@page-change="handlePageChange"
>
</vxe-pager>
</a-spin>
<roleForm ref="roleForm" :allRoles="allRoles" :id2parents="id2parents" :handleOk="handleOk"></roleForm>

View File

@ -3,6 +3,7 @@
<div class="trigger-action-btn">
<a-button type="primary" @click="handleCreateTrigger">新增触发器</a-button>
<a-input-search
class="ops-input"
:style="{ display: 'inline', marginLeft: '10px', width: '200px' }"
placeholder="搜索 | 名称"
v-model="searchName"
@ -12,6 +13,9 @@
</div>
<vxe-grid
stripe
size="mini"
class="ops-stripe-table"
:columns="tableColumns"
:data="filterTriggers"
:max-height="`${windowHeight - 185}px`"
@ -60,6 +64,10 @@
<a @click="handleDeleteTrigger(row)" :style="{ color: 'red' }"><a-icon type="delete"/></a>
</a-space>
</template>
<template slot="empty">
<img :src="require(`@/assets/data_empty.png`)" />
<p style="font-size: 14px; line-height: 17px; color: rgba(0, 0, 0, 0.6)">暂无数据</p>
</template>
</vxe-grid>
<trigger-form
ref="triggerForm"

View File

@ -46,15 +46,13 @@
:column-config="{ resizable: true }"
>
<vxe-column field="email" title="邮箱" min-width="120" fixed="left"></vxe-column>
<vxe-column field="username" title="用户名" min-width="80" ></vxe-column>
<vxe-column field="username" title="用户名" min-width="80"></vxe-column>
<vxe-column field="nickname" title="姓名" min-width="80"></vxe-column>
<vxe-column field="password" title="密码" min-width="80"></vxe-column>
<vxe-column field="sex" title="性别" min-width="60"></vxe-column>
<vxe-column field="mobile" title="手机号" min-width="80"></vxe-column>
<vxe-column field="position_name" title="岗位" min-width="80"></vxe-column>
<vxe-column field="department_name" title="部门" min-width="80"></vxe-column>
<vxe-column field="current_company" v-if="useDFC" title="目前所属主体" min-width="120"></vxe-column>
<vxe-column field="dfc_entry_date" v-if="useDFC" title="初始入职日期" min-width="120"></vxe-column>
<vxe-column field="entry_date" title="目前主体入职日期" min-width="120"></vxe-column>
<vxe-column field="is_internship" title="正式/实习生" min-width="120"></vxe-column>
<vxe-column field="leave_date" title="离职日期" min-width="120"></vxe-column>
@ -94,7 +92,6 @@
<script>
import { downloadExcel, excel2Array } from '@/utils/download'
import { importEmployee } from '@/api/employee'
import appConfig from '@/config/app'
export default {
name: 'BatchUpload',
data() {
@ -189,7 +186,6 @@ export default {
has_error: false,
allCount: 0,
errorCount: 0,
useDFC: appConfig.useDFC,
}
},
methods: {
@ -215,12 +211,14 @@ export default {
rest[key] = rest[key] + ''
}
})
rest.educational_experience = [{
'school': rest.school,
'major': rest.major,
'education': rest.education,
'graduation_year': rest.graduation_year
}]
rest.educational_experience = [
{
school: rest.school,
major: rest.major,
education: rest.education,
graduation_year: rest.graduation_year,
},
]
delete rest.school
delete rest.major
delete rest.education
@ -254,8 +252,7 @@ export default {
const data = [
[
{
v:
'1、表头标“*”的红色字体为必填项\n2、邮箱、用户名不允许重复\n3、登录密码密码由6-20位字母、数字组成\n4、部门上下级部门间用"/"隔开,且从最上级部门开始,例如“深圳分公司/IT部/IT二部”。如出现相同的部门则默认导入组织架构中顺序靠前的部门',
v: '1、表头标“*”的红色字体为必填项\n2、邮箱、用户名不允许重复\n3、登录密码密码由6-20位字母、数字组成\n4、部门上下级部门间用"/"隔开,且从最上级部门开始,例如“深圳分公司/IT部/IT二部”。如出现相同的部门则默认导入组织架构中顺序靠前的部门',
t: 's',
s: {
alignment: {
@ -420,13 +417,9 @@ export default {
},
],
]
if (this.useDFC) {
downloadExcel(data, '员工导入模板')
} else {
data[1] = data[1].filter(item => item['v'] !== '目前所属主体')
data[1] = data[1].filter(item => item['v'] !== '初始入职日期')
downloadExcel(data, '员工导入模板')
}
data[1] = data[1].filter((item) => item['v'] !== '目前所属主体')
data[1] = data[1].filter((item) => item['v'] !== '初始入职日期')
downloadExcel(data, '员工导入模板')
},
customRequest(data) {
this.fileList = [data.file]
@ -435,22 +428,12 @@ export default {
this.importData = res.slice(2).map((item) => {
const obj = {}
//
if (this.useDFC) {
item[9] = this.formatDate(item[9]) //
item[10] = this.formatDate(item[10]) //
item[12] = this.formatDate(item[12]) //
item[30] = this.formatDate(item[30]) //
item.forEach((ele, index) => {
obj[this.dfc_importParamsList[index]] = ele
})
} else {
item[8] = this.formatDate(item[8]) //
item[10] = this.formatDate(item[10]) //
item[28] = this.formatDate(item[28]) //
item[8] = this.formatDate(item[8]) //
item[10] = this.formatDate(item[10]) //
item[28] = this.formatDate(item[28]) //
item.forEach((ele, index) => {
obj[this.common_importParamsList[index]] = ele
})
}
return obj
})
this.currentStep = 2
@ -474,17 +457,17 @@ export default {
month = month > 9 ? month : `0${month}`
day = day > 9 ? day : `0${day}`
const hash = {
'Y': year,
'm': month,
'd': day,
Y: year,
m: month,
d: day,
}
return format.replace(/\w/g, o => {
return format.replace(/\w/g, (o) => {
return hash[o]
})
} else {
return null
}
}
},
},
}
</script>

View File

@ -137,29 +137,6 @@
:formatter="(value) => `${value} 天`"
/>
</a-form-model-item>
<a-form-model-item
v-if="useDFC && attributes.findIndex((v) => v == 'current_company') !== -1"
ref="current_company"
label="目前所属主体"
prop="current_company"
:style="formModalItemStyle"
>
<a-input v-model="employeeFormData.current_company" placeholder="请输入目前所属主体" />
</a-form-model-item>
<a-form-model-item
v-if="useDFC && attributes.findIndex((v) => v == 'dfc_entry_date') !== -1"
ref="dfc_entry_date"
label="初始入职日期"
prop="dfc_entry_date"
:style="formModalItemStyle"
>
<a-date-picker
placeholder="请选择初始入职日期"
v-model="employeeFormData.dfc_entry_date"
:style="{ width: '100%' }"
@change="onChange($event, 'dfc_entry_date')"
></a-date-picker>
</a-form-model-item>
<a-form-model-item
ref="entry_date"
label="目前主体入职日期"
@ -405,9 +382,9 @@
:style="{ display: 'inline-block', width: '98%', margin: '0 7px 24px' }"
v-if="
attributes.findIndex((v) => v == 'bank_card_number') !== -1 ||
attributes.findIndex((v) => v == 'bank_card_name') !== -1 ||
attributes.findIndex((v) => v == 'opening_bank') !== -1 ||
attributes.findIndex((v) => v == 'account_opening_location') !== -1
attributes.findIndex((v) => v == 'bank_card_name') !== -1 ||
attributes.findIndex((v) => v == 'opening_bank') !== -1 ||
attributes.findIndex((v) => v == 'account_opening_location') !== -1
"
>
<a-row :gutter="[8, { xs: 8 }]">
@ -439,7 +416,6 @@ import { postEmployee, putEmployee } from '@/api/employee'
import Bus from './eventBus/bus'
import EmployeeTreeSelect from '../components/employeeTreeSelect.vue'
import DepartmentTreeSelect from '../components/departmentTreeSelect.vue'
import appConfig from '@/config/app'
import moment from 'moment'
import { v4 as uuidv4 } from 'uuid'
export default {
@ -477,7 +453,6 @@ export default {
],
},
type: 'add',
useDFC: appConfig.useDFC,
educational_experience: [],
children_information: [],
file_is_show: true,

View File

@ -179,7 +179,7 @@
sortable
v-if="
checkedCols.findIndex((v) => v == 'department_name') !== -1 &&
attributes.findIndex((v) => v == 'department_name') !== -1
attributes.findIndex((v) => v == 'department_name') !== -1
"
key="department_name"
>
@ -217,7 +217,7 @@
sortable
v-if="
checkedCols.findIndex((v) => v == 'position_name') !== -1 &&
attributes.findIndex((v) => v == 'position_name') !== -1
attributes.findIndex((v) => v == 'position_name') !== -1
"
key="position_name"
>
@ -251,7 +251,7 @@
sortable
v-if="
checkedCols.findIndex((v) => v == 'direct_supervisor_id') !== -1 &&
attributes.findIndex((v) => v == 'direct_supervisor_id') !== -1
attributes.findIndex((v) => v == 'direct_supervisor_id') !== -1
"
key="direct_supervisor_id"
>
@ -290,8 +290,8 @@
min-width="80"
v-if="
checkedCols.findIndex((v) => v == 'annual_leave') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'annual_leave') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'annual_leave') !== -1
"
key="annual_leave"
>
@ -325,8 +325,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'virtual_annual_leave') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'virtual_annual_leave') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'virtual_annual_leave') !== -1
"
key="virtual_annual_leave"
>
@ -360,8 +360,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'parenting_leave') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'parenting_leave') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'parenting_leave') !== -1
"
key="parenting_leave"
>
@ -388,78 +388,6 @@
</span>
</template>
</vxe-column>
<vxe-column
field="current_company"
title="目前所属主体"
sortable
min-width="120"
v-if="
useDFC &&
checkedCols.findIndex((v) => v == 'current_company') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'current_company') !== -1
"
key="current_company"
>
<template #header>
<span class="vxe-handle">
<svg
t="1662694543392"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="2689"
width="17"
height="17"
style="display: none; position: absolute; left: -3px; top: 12px"
>
<path
d="M469.333333 256a85.333333 85.333333 0 1 1-85.333333-85.333333 85.333333 85.333333 0 0 1 85.333333 85.333333z m-85.333333 170.666667a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z m0 256a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z m256-341.333334a85.333333 85.333333 0 1 0-85.333333-85.333333 85.333333 85.333333 0 0 0 85.333333 85.333333z m0 85.333334a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z m0 256a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z"
p-id="2690"
fill="#8a8a8a"
></path>
</svg>
<span>目前所属主体</span>
</span>
</template>
</vxe-column>
<vxe-column
field="dfc_entry_date"
title="初始入职日期"
sortable
min-width="120"
v-if="
useDFC &&
checkedCols.findIndex((v) => v == 'dfc_entry_date') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'dfc_entry_date') !== -1
"
key="dfc_entry_date"
>
<template #header>
<span class="vxe-handle">
<svg
t="1662694543392"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="2689"
width="17"
height="17"
style="display: none; position: absolute; left: -3px; top: 12px"
>
<path
d="M469.333333 256a85.333333 85.333333 0 1 1-85.333333-85.333333 85.333333 85.333333 0 0 1 85.333333 85.333333z m-85.333333 170.666667a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z m0 256a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z m256-341.333334a85.333333 85.333333 0 1 0-85.333333-85.333333 85.333333 85.333333 0 0 0 85.333333 85.333333z m0 85.333334a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z m0 256a85.333333 85.333333 0 1 0 85.333333 85.333333 85.333333 85.333333 0 0 0-85.333333-85.333333z"
p-id="2690"
fill="#8a8a8a"
></path>
</svg>
<span>初始入职日期</span>
</span>
</template>
</vxe-column>
<vxe-column
field="entry_date"
title="目前主体入职日期"
@ -467,8 +395,8 @@
min-width="150"
v-if="
checkedCols.findIndex((v) => v == 'entry_date') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'entry_date') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'entry_date') !== -1
"
key="entry_date"
>
@ -503,8 +431,8 @@
v-bind="tableType === 'structure' ? { filters: internOptions, 'filter-multiple': false } : {}"
v-if="
checkedCols.findIndex((v) => v == 'is_internship') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'is_internship') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'is_internship') !== -1
"
key="is_internship"
>
@ -541,8 +469,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'leave_date') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'leave_date') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'leave_date') !== -1
"
key="leave_date"
>
@ -576,8 +504,8 @@
min-width="120"
v-if="
checkedCols.findIndex((v) => v == 'id_card') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'id_card') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'id_card') !== -1
"
key="id_card"
>
@ -611,8 +539,8 @@
min-width="80"
v-if="
checkedCols.findIndex((v) => v == 'nation') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'nation') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'nation') !== -1
"
key="nation"
>
@ -646,8 +574,8 @@
min-width="120"
v-if="
checkedCols.findIndex((v) => v == 'id_place') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'id_place') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'id_place') !== -1
"
key="id_place"
>
@ -681,8 +609,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'party') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'party') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'party') !== -1
"
key="party"
>
@ -716,8 +644,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'household_registration_type') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'household_registration_type') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'household_registration_type') !== -1
"
key="household_registration_type"
>
@ -751,8 +679,8 @@
min-width="120"
v-if="
checkedCols.findIndex((v) => v == 'hometown') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'hometown') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'hometown') !== -1
"
key="hometown"
>
@ -786,8 +714,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'marry') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'marry') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'marry') !== -1
"
key="marry"
>
@ -821,8 +749,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'max_degree') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'max_degree') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'max_degree') !== -1
"
key="max_degree"
>
@ -856,8 +784,8 @@
min-width="110"
v-if="
checkedCols.findIndex((v) => v == 'emergency_person') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'emergency_person') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'emergency_person') !== -1
"
key="emergency_person"
>
@ -891,8 +819,8 @@
min-width="120"
v-if="
checkedCols.findIndex((v) => v == 'emergency_phone') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'emergency_phone') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'emergency_phone') !== -1
"
key="emergency_phone"
>
@ -926,8 +854,8 @@
min-width="120"
v-if="
checkedCols.findIndex((v) => v == 'bank_card_number') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'bank_card_number') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'bank_card_number') !== -1
"
key="bank_card_number"
>
@ -961,8 +889,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'bank_card_name') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'bank_card_name') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'bank_card_name') !== -1
"
key="bank_card_name"
>
@ -996,8 +924,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'opening_bank') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'opening_bank') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'opening_bank') !== -1
"
key="opening_bank"
>
@ -1031,8 +959,8 @@
min-width="120"
v-if="
checkedCols.findIndex((v) => v == 'account_opening_location') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'account_opening_location') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'account_opening_location') !== -1
"
key="account_opening_location"
>
@ -1065,8 +993,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'school') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'school') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'school') !== -1
"
key="school"
>
@ -1099,8 +1027,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'major') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'major') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'major') !== -1
"
key="major"
>
@ -1133,8 +1061,8 @@
min-width="80"
v-if="
checkedCols.findIndex((v) => v == 'education') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'education') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'education') !== -1
"
key="education"
>
@ -1167,8 +1095,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'graduation_year') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'graduation_year') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'graduation_year') !== -1
"
key="graduation_year"
>
@ -1201,8 +1129,8 @@
min-width="80"
v-if="
checkedCols.findIndex((v) => v == 'name') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'name') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'name') !== -1
"
key="name"
>
@ -1235,8 +1163,8 @@
min-width="80"
v-if="
checkedCols.findIndex((v) => v == 'gender') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'gender') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'gender') !== -1
"
key="gender"
>
@ -1269,8 +1197,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'birthday') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'birthday') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'birthday') !== -1
"
key="birthday"
>
@ -1303,8 +1231,8 @@
min-width="100"
v-if="
checkedCols.findIndex((v) => v == 'parental_leave_left') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'parental_leave_left') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'parental_leave_left') !== -1
"
key="parental_leave_left"
>
@ -1339,8 +1267,8 @@
:formatter="formatDate"
v-if="
checkedCols.findIndex((v) => v == 'last_login') !== -1 &&
tableType == 'structure' &&
attributes.findIndex((v) => v == 'last_login') !== -1
tableType == 'structure' &&
attributes.findIndex((v) => v == 'last_login') !== -1
"
key="last_login"
>
@ -1568,7 +1496,6 @@ export default {
checkedCols,
unsbmitCheckedCols: [],
visible: false,
useDFC: appConfig.useDFC,
tableDragClassName: [], //
attributes: [],
internMap: [
@ -1603,11 +1530,10 @@ export default {
Bus.$on('reqExportSelectEvent', () => {
this.exportExcel()
})
if (!this.useDFC) {
this.options = this.options
.filter((item) => item.label !== '目前所属主体')
.filter((item) => item.label !== '初始入职日期')
}
this.options = this.options
.filter((item) => item.label !== '目前所属主体')
.filter((item) => item.label !== '初始入职日期')
this.unsbmitCheckedCols = this.checkedCols
},
beforeDestroy() {