|
@ -5,54 +5,38 @@ |
|
|
<ns-drawer v-bind="addDrawerConfig"> |
|
|
<ns-drawer v-bind="addDrawerConfig"> |
|
|
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="vertical" /> |
|
|
<ns-form ref="formRef" :schemas="formSchema" :model="formData" formLayout="vertical" /> |
|
|
<template #footer> |
|
|
<template #footer> |
|
|
<a-button style="margin-right: 8px" @click="onClose">取消</a-button> |
|
|
<ns-button style="margin-right: 8px" @click="onClose">取消</ns-button> |
|
|
<a-button type="primary" @click="onEdit">确定</a-button> |
|
|
<ns-button type="primary" @click="operateForm" :disabled="!formDisabled">确定</ns-button> |
|
|
</template> |
|
|
</template> |
|
|
</ns-drawer> |
|
|
</ns-drawer> |
|
|
<a-drawer |
|
|
<ns-drawer |
|
|
:width="600" |
|
|
:width="600" |
|
|
:visible="borderVisible" |
|
|
:visible="borderVisible" |
|
|
:body-style="{ paddingBottom: '80px' }" |
|
|
:body-style="{ paddingBottom: '80px' }" |
|
|
:footer-style="{ textAlign: 'right' }" |
|
|
:footer-style="{ textAlign: 'right' }" |
|
|
destroyOnClose |
|
|
destroyOnClose |
|
|
@close="onClose"> |
|
|
@close="onClose"> |
|
|
<a-button type="primary" @click="borderAdd">新增</a-button> |
|
|
<ns-button type="primary" @click="borderAdd">新增</ns-button> |
|
|
<a-button type="primary" style="margin-left: 10px; margin-bottom: 10px" @click="borderAddSon" |
|
|
<ns-button type="primary" style="margin-left: 10px; margin-bottom: 10px" @click="borderAddSon" |
|
|
>新增子集</a-button |
|
|
>新增子集</ns-button |
|
|
> |
|
|
> |
|
|
<a-directory-tree @select="handleSelect" multiple :tree-data="treeData"> |
|
|
<a-directory-tree @select="handleSelect" multiple :tree-data="treeData"> |
|
|
<template #title="{ title, key }"> |
|
|
<template #title="{ title, key }"> |
|
|
{{ title }} |
|
|
{{ title }} |
|
|
<a-button type="link" @click="editTree(title, key)">编辑</a-button> |
|
|
<ns-button type="link" @click="editTree(title, key)">编辑</ns-button> |
|
|
<a-button type="link" danger @click="deleteTree(title, key)">删除</a-button> |
|
|
<ns-button type="link" danger @click="deleteTree(title, key)">删除</ns-button> |
|
|
</template> |
|
|
</template> |
|
|
</a-directory-tree> |
|
|
</a-directory-tree> |
|
|
</a-drawer> |
|
|
</ns-drawer> |
|
|
|
|
|
|
|
|
<a-drawer |
|
|
<ns-drawer v-bind="serverDrawer"> |
|
|
:width="600" |
|
|
<ns-input-search |
|
|
:visible="serviceVisible" |
|
|
|
|
|
:body-style="{ paddingBottom: '80px' }" |
|
|
|
|
|
:footer-style="{ textAlign: 'right' }" |
|
|
|
|
|
destroyOnClose |
|
|
|
|
|
@close="onClose"> |
|
|
|
|
|
<a-input-search |
|
|
|
|
|
placeholder="请选择开通模块" |
|
|
placeholder="请选择开通模块" |
|
|
v-model:value="searchValue" |
|
|
v-model:value="searchValue" |
|
|
style="margin-bottom: 8px" |
|
|
style="margin-bottom: 8px" |
|
|
@search="onSearch" /> |
|
|
@search="onSearch" /> |
|
|
<a-tree |
|
|
<a-tree v-if="treeData?.length" v-model:checkedKeys="checkedKeys" v-bind="serverTree" /> |
|
|
:tree-data="treeData" |
|
|
</ns-drawer> |
|
|
v-model:checkedKeys="checkedKeys" |
|
|
|
|
|
checkable |
|
|
|
|
|
@select="ServiceSelect"> |
|
|
|
|
|
<template #title="{ title }"> |
|
|
|
|
|
{{ title }} |
|
|
|
|
|
</template> |
|
|
|
|
|
</a-tree> |
|
|
|
|
|
<ns-button style="margin: 20px" type="primary" @click="onClose">取消</ns-button> |
|
|
|
|
|
<ns-button type="primary" @click="Sure">确定</ns-button> |
|
|
|
|
|
</a-drawer> |
|
|
|
|
|
|
|
|
|
|
|
<TreeAdd ref="treeAdd" /> |
|
|
<TreeAdd ref="treeAdd" /> |
|
|
</template> |
|
|
</template> |
|
@ -85,52 +69,114 @@ |
|
|
const serviceVisible = ref(false); |
|
|
const serviceVisible = ref(false); |
|
|
const treeAddVisible = ref(false); |
|
|
const treeAddVisible = ref(false); |
|
|
const formSchema = formConfig; |
|
|
const formSchema = formConfig; |
|
|
|
|
|
const opType = ref<string>('add'); |
|
|
|
|
|
const calMap = { |
|
|
|
|
|
add: enterPrise.save, |
|
|
|
|
|
edit: enterPrise.edit, |
|
|
|
|
|
}; |
|
|
|
|
|
const comApi = computed(() => { |
|
|
|
|
|
return calMap[opType.value as keyof typeof calMap]; |
|
|
|
|
|
}); |
|
|
const tableConfig = computed(() => { |
|
|
const tableConfig = computed(() => { |
|
|
return insertConfig(visible); |
|
|
return insertConfig({ |
|
|
|
|
|
visible, |
|
|
|
|
|
formData, |
|
|
|
|
|
opType, |
|
|
|
|
|
getOrgRandomCode, |
|
|
|
|
|
borderVisible, |
|
|
|
|
|
serviceVisible, |
|
|
|
|
|
server: { |
|
|
|
|
|
getTree, |
|
|
|
|
|
}, |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const getOrgRandomCode = () => { |
|
|
const getOrgRandomCode = () => { |
|
|
http.post(enterPrise.getCode).then((res) => { |
|
|
http.post(enterPrise.getCode).then((res) => { |
|
|
formData.value.projectId = res.data; |
|
|
formData.value.orgCode = res.data; |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
getOrgRandomCode(); |
|
|
getOrgRandomCode(); |
|
|
|
|
|
|
|
|
// drawer form |
|
|
const onClose = () => { |
|
|
const opMap: any = { |
|
|
visible.value = false; |
|
|
type: 'add', |
|
|
borderVisible.value = false; |
|
|
fuc: () => {}, |
|
|
serviceVisible.value = false; |
|
|
record: {}, |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
watch(checkedKeys, () => { |
|
|
// 企业表单drawer |
|
|
console.log('checkedKeys', checkedKeys.value); |
|
|
const addDrawerConfig = ref({ |
|
|
|
|
|
width: '520', |
|
|
|
|
|
visible: visible, |
|
|
|
|
|
footerStyle: { textAlign: 'right' }, |
|
|
|
|
|
destroyOnClose: true, |
|
|
|
|
|
onClose: onClose, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
const handleSelect = (selectedKeys: any, info: any) => { |
|
|
const formDisabled = computed(() => { |
|
|
console.log(selectedKeys, 'selectedKeys'); |
|
|
return formRef.value?.validateResult; |
|
|
console.log(info, 'info'); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//企业表单数据操作 |
|
|
|
|
|
const operateForm = () => { |
|
|
|
|
|
formRef.value?.triggerSubmit().then((res) => { |
|
|
|
|
|
console.log(formData.value, 'formData.value'); |
|
|
|
|
|
http.post(comApi.value, res).then(() => { |
|
|
|
|
|
NsMessage.success('操作成功'); |
|
|
|
|
|
visible.value = false; |
|
|
|
|
|
mainRef.value?.nsTableRef.reload(); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 服务操作逻辑区域 |
|
|
|
|
|
const serverOK = () => { |
|
|
|
|
|
serviceVisible.value = false; |
|
|
|
|
|
}; |
|
|
const ServiceSelect = (selectedKeys: any, info: any) => { |
|
|
const ServiceSelect = (selectedKeys: any, info: any) => { |
|
|
console.log(selectedKeys, 'selectedKeys'); |
|
|
console.log(selectedKeys, 'selectedKeys'); |
|
|
console.log(info, 'info'); |
|
|
console.log(info, 'info'); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const onClose = () => { |
|
|
const serverTree = ref({ |
|
|
visible.value = false; |
|
|
checkable: true, |
|
|
borderVisible.value = false; |
|
|
onSelect: ServiceSelect, |
|
|
serviceVisible.value = false; |
|
|
defaultExpandAll: true, |
|
|
|
|
|
treeData: treeData, |
|
|
|
|
|
fieldNames: { children: 'menus', title: 'label', key: 'code' }, |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const getTree = (params) => { |
|
|
|
|
|
http.post(enterPrise.permissionTree, params).then((res) => { |
|
|
|
|
|
treeData.value = res.data.data; |
|
|
|
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const addDrawerConfig = ref({ |
|
|
// 开通服务模块drawer |
|
|
width: '520', |
|
|
const serverDrawer = ref({ |
|
|
visible: visible, |
|
|
width: '450', |
|
|
|
|
|
visible: serviceVisible, |
|
|
footerStyle: { textAlign: 'right' }, |
|
|
footerStyle: { textAlign: 'right' }, |
|
|
destroyOnClose: true, |
|
|
ok: serverOK, |
|
|
onClose: onClose, |
|
|
cancel: onClose, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// drawer form |
|
|
|
|
|
const opMap: any = { |
|
|
|
|
|
type: 'add', |
|
|
|
|
|
fuc: () => {}, |
|
|
|
|
|
record: {}, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
watch(checkedKeys, () => { |
|
|
|
|
|
console.log('checkedKeys', checkedKeys.value); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const handleSelect = (selectedKeys: any, info: any) => { |
|
|
|
|
|
console.log(selectedKeys, 'selectedKeys'); |
|
|
|
|
|
console.log(info, 'info'); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const borderAdd = () => { |
|
|
const borderAdd = () => { |
|
|
treeAddVisible.value = true; |
|
|
treeAddVisible.value = true; |
|
|
treeAdd.value?.toggle(); |
|
|
treeAdd.value?.toggle(); |
|
@ -140,18 +186,6 @@ |
|
|
treeAddVisible.value = true; |
|
|
treeAddVisible.value = true; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const onEdit = () => { |
|
|
|
|
|
formRef.value?.triggerSubmit().then(() => { |
|
|
|
|
|
console.log(formData.value, 'formData.value'); |
|
|
|
|
|
opMap.fuc && opMap.fuc(formData.value); |
|
|
|
|
|
visible.value = false; |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const Sure = () => { |
|
|
|
|
|
serviceVisible.value = false; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const editTree = (title: any, key: any) => { |
|
|
const editTree = (title: any, key: any) => { |
|
|
console.log(title, 'title'); |
|
|
console.log(title, 'title'); |
|
|
console.log(key, 'key'); |
|
|
console.log(key, 'key'); |
|
|