租户模块相关
parent
21c9b78c05
commit
a5804a4355
@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<BasicForm @register="registerForm">
|
||||
<!-- <template #auditStatusSlot="{ model, field }">-->
|
||||
<!-- <canvas id="canvas" width="200" height="200"></canvas>-->
|
||||
<!-- </template>-->
|
||||
</BasicForm>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { defineComponent, onMounted, ref, unref, watch } from 'vue'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
import { formSchema } from './columns'
|
||||
import { getTenantAuditInfo } from './api'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import { propTypes } from '/@/utils/propTypes'
|
||||
|
||||
const { notification, createConfirm } = useMessage()
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['next', 'register'])
|
||||
// 组件接收参数
|
||||
const props = defineProps({
|
||||
applyId: propTypes.string,
|
||||
})
|
||||
watch(
|
||||
() => props.applyId,
|
||||
() => {
|
||||
initData()
|
||||
},
|
||||
{ deep: true },
|
||||
)
|
||||
async function initData() {
|
||||
const res: API.DataResult = await getTenantAuditInfo({ id: props.applyId })
|
||||
if (res.succeeded) {
|
||||
await setFieldsValue(res.data)
|
||||
}
|
||||
}
|
||||
// onMounted(async () => {
|
||||
// console.log(props.applyId)
|
||||
// const res: API.DataResult = await getTenantAuditInfo({ id: props.applyId })
|
||||
// if (res.succeeded) {
|
||||
// await setFieldsValue(res.data)
|
||||
// }
|
||||
// })
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: formSchema,
|
||||
// showActionButtonGroup: false,
|
||||
resetButtonOptions: {
|
||||
text: '驳回',
|
||||
color: 'error',
|
||||
disabled: true,
|
||||
onClick: customSubmitFunc,
|
||||
},
|
||||
showResetButton: true,
|
||||
submitButtonOptions: {
|
||||
text: '下一步',
|
||||
},
|
||||
submitFunc: customSubmitFunc,
|
||||
})
|
||||
const closeClientModal = (data: any) => {
|
||||
console.log('接收值', data)
|
||||
// const records = data.filter((x) => checkedKeys.value.includes(x.gid))
|
||||
setFieldsValue({
|
||||
clientIds: data.clientIds.toString(),
|
||||
clientName: data.clientName,
|
||||
})
|
||||
}
|
||||
async function customSubmitFunc() {
|
||||
try {
|
||||
const values = await validate()
|
||||
emit('next', values)
|
||||
} catch (error) {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
@ -0,0 +1,35 @@
|
||||
<template> <BasicForm @register="registerForm" /> </template>
|
||||
<script lang="ts" setup>
|
||||
import { defineComponent, ref } from 'vue'
|
||||
import { BasicForm, useForm } from '/@/components/Form/index'
|
||||
import { dbFormSchema } from './columns'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
|
||||
const { notification, createConfirm, createMessage } = useMessage()
|
||||
// 声明Emits
|
||||
const emit = defineEmits(['next', 'prev'])
|
||||
const isUpdate = ref(true)
|
||||
const loading = ref(false)
|
||||
const rowId = ref('')
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: dbFormSchema,
|
||||
resetButtonOptions: {
|
||||
text: '上一步',
|
||||
onClick: handlePrev,
|
||||
},
|
||||
showResetButton: true,
|
||||
submitButtonOptions: {
|
||||
text: '下一步',
|
||||
},
|
||||
submitFunc: handleNext,
|
||||
})
|
||||
async function handlePrev() {
|
||||
emit('prev')
|
||||
}
|
||||
async function handleNext() {
|
||||
emit('next')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
@ -0,0 +1,98 @@
|
||||
<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'
|
||||
//树的信息
|
||||
const treeData = ref<TreeItem[]>([])
|
||||
//树的全部节点信息
|
||||
const allTreeKeys = ref([])
|
||||
//树的选择节点信息
|
||||
const checkedKeys = 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 [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: permissionFormSchema,
|
||||
resetButtonOptions: {
|
||||
text: '上一步',
|
||||
onClick: handlePrev,
|
||||
},
|
||||
showResetButton: true,
|
||||
submitButtonOptions: {
|
||||
text: '下一步',
|
||||
},
|
||||
submitFunc: handleNext,
|
||||
})
|
||||
|
||||
async function handlePrev() {
|
||||
emit('prev')
|
||||
}
|
||||
|
||||
async function fetch() {
|
||||
reset()
|
||||
//初始化数据
|
||||
const res = await getClientPermissionTreeList()
|
||||
treeData.value = res.data
|
||||
// allTreeKeys.value = res.data.ids
|
||||
// treeData.value = data
|
||||
}
|
||||
|
||||
async function handleNext() {
|
||||
console.log('permission', checkedKeys.value)
|
||||
//修改密码
|
||||
// emit('permission', checkedKeys.value)
|
||||
emit('next')
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据重置
|
||||
*/
|
||||
function reset() {
|
||||
treeData.value = []
|
||||
allTreeKeys.value = []
|
||||
checkedKeys.value = []
|
||||
defaultCheckedKeys.value = []
|
||||
selectedKeys.value = []
|
||||
// roleId.value = ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击选中
|
||||
*/
|
||||
function onCheck(o) {
|
||||
checkedKeys.value = o.checked ? o.checked : o
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetch()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
@ -0,0 +1,147 @@
|
||||
<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-step title="完成" />
|
||||
</a-steps>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<BaseInfoStep
|
||||
@next="handleStep1Next"
|
||||
v-show="current === 0"
|
||||
v-if="state.initSetp1"
|
||||
:applyId="applyId"
|
||||
/>
|
||||
<PermissionSetStep
|
||||
@prev="handleStepPrev"
|
||||
@next="handleStep2Next"
|
||||
v-show="current === 1"
|
||||
v-if="state.initSetp2"
|
||||
/>
|
||||
<DbSetStep
|
||||
@prev="handleStepPrev"
|
||||
@next="handleStep3Next"
|
||||
v-show="current === 2"
|
||||
v-if="state.initSetp3"
|
||||
/>
|
||||
<DbSetStep
|
||||
v-show="current === 3"
|
||||
@prev="handleStepPrev"
|
||||
@finish="finish"
|
||||
v-if="state.initSetp4"
|
||||
/>
|
||||
</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 } from 'vue'
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal'
|
||||
import { useMessage } from '/@/hooks/web/useMessage'
|
||||
import PermissionSetStep from './PermissionSetStep.vue'
|
||||
import DbSetStep from './DbSetStep.vue'
|
||||
import BaseInfoStep from './BaseInfoStep.vue'
|
||||
|
||||
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 [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
setModalProps({ confirmLoading: false, loading: true })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
if (unref(isUpdate)) {
|
||||
applyId.value = data.record.id
|
||||
console.log(applyId.value)
|
||||
}
|
||||
setModalProps({ loading: false })
|
||||
})
|
||||
function handleStep1Next(step1Values: any) {
|
||||
console.log(step1Values)
|
||||
current.value++
|
||||
state.initSetp1 = false
|
||||
state.initSetp2 = true
|
||||
state.initSetp3 = false
|
||||
state.initSetp4 = false
|
||||
}
|
||||
|
||||
function handleStepPrev() {
|
||||
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 = false
|
||||
state.initSetp3 = true
|
||||
state.initSetp4 = false
|
||||
console.log(step2Values)
|
||||
}
|
||||
function handleStep3Next(step3Values: any) {
|
||||
current.value++
|
||||
state.initSetp1 = false
|
||||
state.initSetp2 = false
|
||||
state.initSetp3 = false
|
||||
state.initSetp4 = true
|
||||
console.log(step3Values)
|
||||
}
|
||||
function finish() {
|
||||
current.value = 0
|
||||
state.initSetp1 = false
|
||||
state.initSetp2 = false
|
||||
state.initSetp3 = false
|
||||
state.initSetp4 = false
|
||||
}
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '' : '企业用户审批'))
|
||||
</script>
|
Loading…
Reference in New Issue