master
张同海 9 months ago
parent 482b8347ed
commit f136fc5c49

@ -0,0 +1,56 @@
// @ts-ignore
import { DataResult, PageRequest } from '../model/baseModel'
import { request } from '/@/utils/request'
enum Api {
list = '/adminApi/Tenant/GetTenantList',
GetTenantPermission = '/adminApi/Tenant/GetTenantPermission',
GetTenantInfo = '/adminApi/Tenant/GetTenantInfo',
UpdateTenantPermission = '/adminApi/Tenant/UpdateTenantPermission',
editUser = '/adminApi/User/EditUser',
getUser = '/adminApi/User/GetUserInfo',
}
export function GetTenantList(data: PageRequest) {
return request<DataResult>({
url: Api.list,
method: 'post',
data,
})
}
export function getPermission(query: { id: string }) {
return request<DataResult>({
url: Api.GetTenantPermission,
method: 'get',
params: query,
})
}
export function getInfo(query: { id: string }) {
return request<DataResult>({
url: Api.GetTenantInfo,
method: 'get',
params: query,
})
}
export function UpdatePermission(data: any) {
return request<DataResult>({
url: Api.UpdateTenantPermission,
method: 'post',
data,
})
}
export function editUser(data: any) {
return request<DataResult>({
url: Api.editUser,
method: 'post',
data,
})
}
export function getUser(query: { id: string }) {
return request<DataResult>({
url: Api.getUser,
method: 'get',
params: query,
})
}

@ -2,17 +2,11 @@
<el-config-provider namespace="el" :locale="zhCn"> <el-config-provider namespace="el" :locale="zhCn">
<FlowDesign :process="process" :fields="fields" /> <FlowDesign :process="process" :fields="fields" />
</el-config-provider> </el-config-provider>
<!-- <a-divider orientation="left">流程操作历史</a-divider> -->
<el-collapse accordion style="margin: 0 0 15px 30px">
<el-collapse-item name="1">
<template #title> 流程操作历史 </template>
<el-timeline> <el-timeline>
<!-- <el-timeline-item
timestamp="2018/4/12"
placement="top"
v-for="item in FlowInstanceHistory"
:key="item.id"
>
<el-card>
<h4>{{ item }}</h4>
</el-card>
</el-timeline-item> -->
<el-timeline-item <el-timeline-item
:timestamp="item.createTime" :timestamp="item.createTime"
placement="top" placement="top"
@ -24,6 +18,9 @@
</el-card> </el-card>
</el-timeline-item> </el-timeline-item>
</el-timeline> </el-timeline>
</el-collapse-item>
</el-collapse>
<BasicForm @register="registerForm" /> <BasicForm @register="registerForm" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

@ -0,0 +1,136 @@
<template> <BasicForm @register="registerForm" /> </template>
<script lang="ts" setup>
import { defineComponent, ref, watch, onMounted } from 'vue'
import { BasicForm, useForm } from '/@/components/Form/index'
// import { authorization } from './columns'
import { useMessage } from '/@/hooks/web/useMessage'
import { propTypes } from '/@/utils/propTypes'
const { notification, createConfirm, createMessage } = useMessage()
// Emits
const emit = defineEmits(['next', 'prev'])
const props = defineProps({
checkedKeys: propTypes.array,
ApiData: propTypes.object,
})
watch(
() => props.ApiData,
() => {
initData()
},
{ deep: true },
)
async function initData() {
let Rdata = {
authUserNum: props.ApiData.authUserNum,
}
props.ApiData.permissionAuthList.forEach((item) => {
Rdata[`${item.permissionId}--authNum`] = item.authNum
})
console.log(Rdata, 111)
setFieldsValue(Rdata)
// setFieldsValue(props.ShowData)
}
const isUpdate = ref(true)
const loading = ref(false)
const rowId = ref('')
const authorization = ref([
// {
// field: 'divider-selects',
// component: 'Divider',
// label: '',
// colProps: { span: 24 },
// },
// {
// field: 'authUserNum',
// label: '',
// component: 'InputNumber',
// labelWidth: '200px',
// componentProps: {
// min: 0,
// placeholder: '',
// },
// colProps: { span: 8 },
// },
])
console.log(props.checkedKeys, 'props.checkedKeys')
// const ASD = () => {
props.checkedKeys.forEach((item, index) => {
if (index == 0) {
authorization.value.push({
field: 'divider-selects',
component: 'Divider',
label: '权限模块授权',
colProps: { span: 24 },
})
}
authorization.value.push({
field: `${item.key}--authNum`,
label: `${item.title} 授权数`,
component: 'InputNumber',
labelWidth: '200px',
componentProps: {
min: 0,
},
colProps: { span: 8 },
})
})
authorization.value.push({
field: 'divider-selects',
component: 'Divider',
label: '审批步骤',
colProps: { span: 24 },
})
// }
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
labelWidth: 100,
schemas: authorization.value,
resetButtonOptions: {
text: '上一步',
// onClick: handlePrev,
},
resetFunc: handlePrev,
showResetButton: true,
submitButtonOptions: {
text: '下一步',
},
submitFunc: handleNext,
})
// watch(
// () => props.checkedKeys,
// (newData, oldData) => {
// ASD()
// console.log(newData, oldData, authorization.value)
// setProps({
// labelWidth: 100,
// schemas: authorization.value,
// resetButtonOptions: {
// text: '',
// onClick: handlePrev,
// },
// showResetButton: true,
// submitButtonOptions: {
// text: '',
// },
// submitFunc: handleNext,
// })
// },
// { deep: true },
// )
async function handlePrev() {
emit('prev')
}
async function handleNext() {
try {
const values = await validate()
emit('next', values)
} catch (error) {}
}
onMounted(() => {
initData()
})
</script>
<style scoped lang="less"></style>

@ -0,0 +1,128 @@
<template>
<div class="m-4 mr-0 overflow-hidden bg-white">
<BasicTree
ref="treeRef"
title="所拥有的的权限"
:treeData="treeData"
:checkable="true"
:checkedKeys="checkedKeys"
:selectedKeys="selectedKeys"
defaultExpandAll
@check="onCheck"
/>
</div>
<BasicForm @register="registerForm" />
</template>
<script lang="ts" setup>
import { defineComponent, onMounted, ref, unref } from 'vue'
import { BasicForm, useForm } from '/@/components/Form/index'
import { permissionFormSchema } from './columns'
import { getTenantAuditInfo, auditInfo } from './api'
import { useMessage } from '/@/hooks/web/useMessage'
import { BasicTree, TreeItem } from '/@/components/Tree'
import { getClientPermissionTreeList } from './api'
import { propTypes } from '/@/utils/propTypes'
//
const treeData = ref<TreeItem[]>([])
//
const allTreeKeys = ref([])
//
const checkedKeys = ref([])
const WebcheckedKeys = ref([])
const defaultCheckedKeys = ref([])
//
const selectedKeys = ref([])
const roleId = ref('')
//
const treeRef = ref(null)
const loading = ref(false)
const { notification, createConfirm, createMessage } = useMessage()
// Emits
const emit = defineEmits(['next', 'prev', 'permission'])
const props = defineProps({
ApiData: propTypes.object,
})
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
labelWidth: 100,
schemas: permissionFormSchema,
showResetButton: false,
submitButtonOptions: {
text: '下一步',
},
submitFunc: handleNext,
})
async function handleNext() {
console.log('permission', checkedKeys.value)
let Rdata = []
treeData.value.forEach((item) => {
console.log(item)
item.children.forEach((item2) => {
console.log(item2)
checkedKeys.value.forEach((e) => {
console.log(e)
if (e == item2.key) {
Rdata.push(item2)
}
})
})
})
emit('next', {
WebcheckedKeys: WebcheckedKeys.value,
checkedKeys: Rdata,
})
}
async function fetch() {
reset()
//
const res = await getClientPermissionTreeList()
treeData.value = res.data
initData()
// allTreeKeys.value = res.data.ids
// treeData.value = data
}
async function initData() {
console.log(props.ApiData)
let Arr = []
props.ApiData.forEach((item) => {
Arr.push(item.key)
})
// setFieldsValue({
// ...props.ShowData,
// ...props.ApiData.auditInfo,
// })
checkedKeys.value = Arr
}
/**
* 数据重置
*/
function reset() {
treeData.value = []
allTreeKeys.value = []
checkedKeys.value = []
defaultCheckedKeys.value = []
selectedKeys.value = []
// roleId.value = ''
}
/**
* 点击选中
*/
function onCheck(o, info) {
console.log(o, info)
checkedKeys.value = o.checked ? o.checked : o
WebcheckedKeys.value = o.concat(info.halfCheckedKeys)
console.log(WebcheckedKeys.value, checkedKeys.value)
// checkedKeys.value = o.concat(info.halfCheckedKeys)
}
onMounted(() => {
fetch()
})
</script>
<style scoped lang="less"></style>

@ -0,0 +1,236 @@
<template>
<BasicModal
v-bind="$attrs"
@register="registerModal"
:useWrapper="true"
:title="getTitle"
width="80%"
>
<!-- @ok="handleSave" -->
<div class="step-form-form">
<a-steps :current="current">
<a-step title="权限模块" />
<a-step title="授权信息" />
<!-- <a-step title="完成" /> -->
</a-steps>
</div>
<div class="mt-5">
<PermissionSetStep
@prev="handleStepPrev"
@next="handleStep2Next"
v-show="current === 0"
v-if="state.initSetp1"
:ApiData="checkedKeys"
/>
<Authorization
@prev="handleStepPrev"
@next="handleStep3Next"
v-show="current === 1"
v-if="state.initSetp2"
:checkedKeys="checkedKeys"
:ApiData="ApiData"
/>
</div>
<!--右下角按钮-->
<template #footer>
<a-button
@click="closeModal"
preIcon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
>取消
</a-button>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref, h, reactive, onMounted } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { useMessage } from '/@/hooks/web/useMessage'
import PermissionSetStep from './PermissionSetStep.vue'
import Authorization from './Authorization.vue'
import { RejectTenantApply } from './api'
import { getPermission, getInfo } from '/@/api/system/tenant'
import { useUserStore } from '/@/store/modules/user'
import { UpdatePermission } from '/@/api/system/tenant'
const userStore = useUserStore()
onMounted(() => {
// tenantId
tenantId.value = userStore.getUserInfo?.tenantId
console.log('Mounted', userStore.getUserInfo)
})
const tenantId = ref('')
const { notification, createConfirm, createMessage } = useMessage()
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
// const rowId = ref('')
const current = ref(0)
const applyId = ref('')
const state = reactive({
initSetp1: true,
initSetp2: false,
initSetp3: false,
initSetp4: false,
})
const checkedKeys = ref([])
const ApiData = reactive({
tenantId: 0,
permissionIds: [],
permissionAuthList: [],
})
const ShowData = reactive({
address: '',
adminUserCode: '',
auditNote: '',
auditStatus: '',
auditTime: '',
chief: '',
contractBeginDate: '',
contractEndDate: '',
email: '',
id: '',
name: '',
phone: '',
pinYinCode: '',
taxNo: '',
tel: '',
})
async function initData() {
console.log('initData')
const res: API.DataResult = await getInfo({ id: applyId.value })
if (res.succeeded) {
ShowData.address = res.data.address
ShowData.adminUserCode = res.data.adminUserCode
ShowData.auditNote = res.data.auditNote
ShowData.auditStatus = res.data.auditStatus
ShowData.auditTime = res.data.auditTime
ShowData.chief = res.data.chief
ShowData.contractBeginDate = res.data.contractBeginDate
ShowData.contractEndDate = res.data.contractEndDate
ShowData.email = res.data.email
ShowData.id = res.data.id
ShowData.name = res.data.name
ShowData.phone = res.data.phone
ShowData.pinYinCode = res.data.pinYinCode
ShowData.taxNo = res.data.taxNo
ShowData.tel = res.data.tel
}
console.log(tenantId)
const res2: API.DataResult = await getPermission({ id: tenantId.value })
if (res2.succeeded) {
console.log(res2)
}
}
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
console.log('closeModal')
ApiData.tenantId = tenantId.value
ApiData.permissionIds = []
ApiData.permissionAuthList = []
checkedKeys.value = []
current.value = 0
state.initSetp1 = true
state.initSetp2 = false
state.initSetp3 = false
state.initSetp4 = false
setModalProps({ confirmLoading: false, loading: true })
console.log(!!data?.isUpdate, data)
isUpdate.value = !!data?.isUpdate
console.log(unref(isUpdate), 'unref(isUpdate)')
if (unref(isUpdate)) {
applyId.value = data.record.id
}
initData()
setModalProps({ loading: false })
})
function handleStepPrev(stepValues) {
current.value--
console.log(current.value)
if (current.value == 0) {
state.initSetp1 = true
state.initSetp2 = false
state.initSetp3 = false
state.initSetp4 = false
} else if (current.value == 1) {
state.initSetp1 = false
state.initSetp2 = true
state.initSetp3 = false
state.initSetp4 = false
} else if (current.value == 2) {
state.initSetp1 = false
state.initSetp2 = false
state.initSetp3 = true
state.initSetp4 = false
} else if (current.value == 3) {
state.initSetp1 = false
state.initSetp2 = false
state.initSetp3 = false
state.initSetp4 = true
}
}
function handleStep2Next(step2Values: any) {
current.value++
state.initSetp1 = false
state.initSetp2 = true
ApiData.permissionIds = step2Values.WebcheckedKeys
checkedKeys.value = step2Values.checkedKeys
}
async function handleStep3Next(step3Values: any) {
console.log(step3Values)
ApiData.permissionAuthList = []
Object.keys(step3Values).forEach((item) => {
let ArrItem = item.split('--')
if (ArrItem.length == 2) {
ApiData.permissionAuthList.push({
permissionId: ArrItem[0],
authNum: step3Values[item],
})
}
})
console.log(ApiData)
const res: API.DataResult = await UpdatePermission(ApiData)
if (res.succeeded) {
current.value = 0
state.initSetp1 = true
state.initSetp2 = false
closeModal()
ApiData.tenantId = 0
ApiData.permissionIds = []
ApiData.permissionAuthList = []
}
}
// async function handleStep4Next(step4Values: any) {
// console.log(step4Values)
// ApiData.dbInfo = {
// dbType: step4Values.dbType,
// connection: step4Values.connection,
// }
// const res: API.DataResult = await TenantApplyAudit(ApiData)
// if (res.succeeded) {
// current.value = 0
// state.initSetp1 = true
// state.initSetp2 = false
// state.initSetp3 = false
// state.initSetp4 = false
// closeModal()
// ApiData.auditInfo = {}
// ApiData.authUserNum = ''
// ApiData.permissionIds = []
// ApiData.permissionAuthList = []
// ApiData.dbInfo = {}
// }
// }
const getTitle = computed(() => (!unref(isUpdate) ? '' : '企业用户审批'))
</script>

@ -0,0 +1,56 @@
// @ts-ignore
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/adminApi/TenantApply/GetTenantApplyList',
getTenantAuditInfo = '/adminApi/TenantApply/GetTenantAuditInfo',
auditInfo = '/adminApi/TenantApply/AuditTenantApply',
getClientPermissionTreeList = '/adminApi/Common/GetClientPermissionTreeList',
RejectTenantApply = '/adminApi/TenantApply/RejectTenantApply',
TenantApplyAudit = '/adminApi/TenantApply/TenantApplyAudit',
}
export function getTenantApplyList(data: PageRequest) {
return request<DataResult>({
url: Api.list,
method: 'post',
data,
})
}
export function getTenantAuditInfo(query: { id: string }) {
return request<DataResult>({
url: Api.getTenantAuditInfo,
method: 'get',
params: query,
})
}
export function auditInfo(data: any) {
return request<DataResult>({
url: Api.auditInfo,
method: 'post',
data,
})
}
export function getClientPermissionTreeList() {
return request<DataResult>({
url: Api.getClientPermissionTreeList,
method: 'get',
})
}
// 企业用户审批-驳回 (Auth)
export function RejectTenantApply(data: any) {
return request<DataResult>({
url: Api.RejectTenantApply,
method: 'post',
data,
})
}
// 企业用户审批-审核通过 (Auth)
export function TenantApplyAudit(data: any) {
return request<DataResult>({
url: Api.TenantApplyAudit,
method: 'post',
data,
})
}

@ -0,0 +1,263 @@
// import { filterDictTextByCache } from '/@/utils/dictUtil'
import { BasicColumn, FormSchema } from '/@/components/Table'
// import { getDictDropDown } from '/@/api/common/index';
import { getRoleList } from '/@/api/common'
import { Tag } from 'ant-design-vue'
export const columns: BasicColumn[] = [
{
title: '公司名称',
dataIndex: 'name',
width: 100,
},
{
title: '助记码',
dataIndex: 'pinYinCode',
width: 200,
},
{
title: '公司地址',
dataIndex: 'address',
width: 200,
},
{
title: '租户管理员手机',
dataIndex: 'phone',
width: 150,
},
{
title: '公司电话',
dataIndex: 'tel',
width: 150,
},
{
title: '邮箱',
dataIndex: 'email',
width: 150,
},
{
title: '企业法人',
dataIndex: 'chief',
width: 150,
},
{
title: '企业税号',
dataIndex: 'taxNo',
width: 150,
},
{
title: '租户类型',
dataIndex: 'tenantType',
width: 200,
customRender: ({ text }) => {
if (text === 1) {
return <Tag color="success"></Tag>
} else if (text === 0) {
return <Tag color="blue"></Tag>
}
return text
},
},
// {
// title: '性别',
// dataIndex: 'sex',
// width: 200,
// customRender: ({ text }) => {
// if (text === 1) {
// return <Tag color="success">男</Tag>
// } else if (text === 2) {
// return <Tag color="blue">女</Tag>
// }
// return text
// },
// },
]
export const permissionFormSchema: FormSchema[] = [
{
field: 'divider-selects',
component: 'Divider',
label: '审批步骤',
colProps: { span: 24 },
},
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false,
},
]
export const searchFormSchema: FormSchema[] = [
{
field: 'UserName',
label: '用户名称',
component: 'Input',
colProps: { span: 8 },
},
{
field: 'UserCode',
label: '用户唯一编码',
component: 'Input',
colProps: { span: 8 },
},
]
export const formSchema: FormSchema[] = [
{
field: 'divider-selects',
component: 'Divider',
label: '基本用户信息',
colProps: {
span: 24,
},
},
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false,
},
{
label: '',
field: 'permissionIdentity',
component: 'Input',
defaultValue: '',
show: false,
},
{
field: 'userCode',
label: '用户唯一码',
component: 'Input',
required: true,
colProps: { span: 12 },
dynamicDisabled: ({ values }) => {
return !!values.id
},
},
{
field: 'sex',
component: 'RadioButtonGroup',
label: '性别',
required: true,
componentProps: {
options: [
{ label: '男', value: 1 },
{ label: '女', value: 2 },
],
},
defaultValue: 1,
colProps: {
span: 8,
},
},
{
field: 'userName',
label: '用户名称',
component: 'Input',
required: true,
colProps: { span: 12 },
},
{
field: 'userType',
label: '用户类型',
component: 'RadioButtonGroup',
required: true,
colProps: {
span: 12,
},
defaultValue: 2,
componentProps: {
options: [
// { label: '超级管理员', value: 0, disabled: true },
{ label: '管理员', value: 1 },
{ label: '普通用户', value: 2 },
],
},
},
{
field: 'pinYinCode',
label: '助记码',
component: 'Input',
colProps: { span: 12 },
dynamicDisabled: () => {
return true
},
},
{
field: 'password',
label: '密码',
component: 'Input',
colProps: { span: 12 },
defaultValue: '0000',
dynamicDisabled: () => {
return true
},
itemProps: {
extra: '请及时重置初始密码!',
},
},
{
field: 'birthday',
label: '出生日期',
component: 'DatePicker',
// required: true,
colProps: {
span: 12,
},
componentProps: {},
},
{
field: 'nickName',
label: '用户昵称',
component: 'Input',
required: true,
colProps: { span: 12 },
},
{
field: 'phone',
label: '手机号',
component: 'Input',
colProps: { span: 12 },
},
{
field: 'email',
label: '邮箱',
component: 'Input',
colProps: { span: 12 },
},
{
field: 'duty',
label: '职位',
component: 'Input',
colProps: { span: 12 },
},
{
field: 'note',
label: '备注',
component: 'InputTextArea',
colProps: { span: 24 },
// ifShow: ({ values }) => !isButton(values.menuType),
},
{
field: 'divider-selects',
component: 'Divider',
label: '附属信息',
componentProps: {},
colProps: {
span: 24,
},
},
{
field: 'roleIds',
label: '所属角色',
component: 'ApiSelect',
// required: true,
defaultValue: [],
colProps: { span: 12 },
componentProps: {
// mode: 'multiple',
api: getRoleList,
resultField: 'data',
},
},
]

@ -0,0 +1,121 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'userName'">
<span style="color: #0d84ff" @click="handleEdit(record)">{{ record.userName }}</span>
</template>
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'ant-design:solution-outlined',
tooltip: '授权',
onClick: handleEdit.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<UserModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { defineComponent, onMounted, ref } from 'vue'
import { BasicTable, useTable, TableAction } from '/@/components/Table'
import { GetTenantList } from '/@/api/system/tenant'
import { useModal } from '/@/components/Modal'
import UserModal from './UserModal.vue'
import { columns, searchFormSchema } from './columns'
const dictOptions = ref<any[]>([])
const [registerModal, { openModal }] = useModal()
const [registerPermissionModal, { openModal: openPermissionModal }] = useModal()
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '租户列表',
// api: getSysDictTypeList,
api: async (p) => {
const res: API.DataResult = await GetTenantList(p)
// console.log(items);
return new Promise((resolve) => {
resolve({ data: [...res.data], total: res.count })
})
},
beforeFetch: () => {
var currentPageInfo: any = getPaginationRef()
var data = getForm().getFieldsValue()
const postParam: API.PageRequest = {
queryCondition: '',
pageCondition: {
pageIndex: currentPageInfo.current,
pageSize: currentPageInfo.pageSize,
sortConditions: [],
},
}
let condition: API.ConditionItem[] = []
if (!!data.UserName) {
condition.push({
FieldName: 'UserName',
FieldValue: data.UserName,
ConditionalType: 1,
})
}
if (!!data.UserCode) {
condition.push({
FieldName: 'UserCode',
FieldValue: data.UserCode,
ConditionalType: 1,
})
}
postParam.queryCondition = JSON.stringify(condition)
// console.log(postParam);
return postParam
},
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
isTreeTable: false,
pagination: true,
striped: true,
useSearchForm: true,
showTableSetting: true,
bordered: true,
showIndexColumn: true,
canResize: false,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
fixed: undefined,
},
})
function handleCreate() {
openModal(true, {
isParent: false,
isUpdate: false,
})
}
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
})
}
function handleDelete(record: Recordable) {
console.log(record)
}
onMounted(() => {
//
})
function handleSuccess() {
reload()
}
</script>
Loading…
Cancel
Save