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 a9db4285ab
14 changed files with 405 additions and 366 deletions

View File

@ -7,7 +7,6 @@ const appConfig = {
redirectTo: '/cmdb', // 首页的重定向路径
buildAclToModules: true, // 是否在各个应用下 内联权限管理
ssoLogoutURL: '/api/sso/logout',
useDFC: false,
showDocs: false,
}

View File

@ -26,10 +26,11 @@ 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
})
}

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: '新增资源',

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,21 +16,51 @@
"
></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-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>
<template #action_default="{row}">
</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>
<template #pager>
</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"
@ -38,8 +69,7 @@
@page-change="handlePageChange"
>
</vxe-pager>
</template> </vxe-grid
></a-spin>
</a-spin>
<resourceTypeForm ref="resourceTypeForm" :handleOk="handleOk"> </resourceTypeForm>
</div>
@ -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,13 +66,14 @@
></a-switch>
</a-space>
</div>
<a-spin
:spinning="loading"
><vxe-grid
:columns="tableColumns"
<a-spin :spinning="loading">
<vxe-table
size="mini"
stripe
class="ops-stripe-table"
:data="tableData"
highlight-hover-row
:max-height="`${windowHeight - 245}px`"
:height="`${windowHeight - 280}px`"
:checkbox-config="{ reserve: true }"
@checkbox-change="changeCheckbox"
@checkbox-all="changeCheckbox"
@ -79,11 +81,37 @@
row-id="id"
show-overflow
>
<template #name_header>
{{ isGroup ? '资源组名' : '资源名' }}
<!-- 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>
<template #action_default="{row}">
<span v-show="isGroup">
</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>
@ -103,8 +131,14 @@
<a style="color: red"><a-icon type="delete"/></a>
</a-popconfirm>
</template>
<template #pager>
</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"
@ -113,8 +147,7 @@
@page-change="handlePageChange"
>
</vxe-pager>
</template> </vxe-grid
></a-spin>
</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,16 +30,51 @@
:filter-config="{ remote: true }"
@filter-change="filterTableMethod"
>
<template #is_app_admin_default="{row}">
<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>
<template #inherit_default="{row}">
</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>
<template #isVisualRole_default="{row}">
</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>
<template #action_default="{row}">
</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="资源列表">
@ -62,8 +101,15 @@
</span>
</div>
</template>
<template #pager>
</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"
@ -72,8 +118,6 @@
@page-change="handlePageChange"
>
</vxe-pager>
</template>
</vxe-grid>
</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

@ -53,8 +53,6 @@
<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) {
data[1] = data[1].filter((item) => item['v'] !== '目前所属主体')
data[1] = data[1].filter((item) => item['v'] !== '初始入职日期')
downloadExcel(data, '员工导入模板')
} else {
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.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="目前主体入职日期"
@ -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

@ -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="目前主体入职日期"
@ -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.unsbmitCheckedCols = this.checkedCols
},
beforeDestroy() {