From dfb7a8a63e87390dc095e81b04f0404697246d9f Mon Sep 17 00:00:00 2001 From: 张涛 <“2538313560@qq.com”> Date: 星期五, 22 十一月 2024 20:20:56 +0800 Subject: [PATCH] 增加跳转的接口 --- src/views/authority/organization/index.vue | 119 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 84 insertions(+), 35 deletions(-) diff --git a/src/views/authority/organization/index.vue b/src/views/authority/organization/index.vue index 03c4f6d..3f5d129 100644 --- a/src/views/authority/organization/index.vue +++ b/src/views/authority/organization/index.vue @@ -7,11 +7,21 @@ <a-card :title="$t('menu.organization.title')" :bordered="false" - style=" 'width': '100%'; height: calc(100vh - 250px);; 'overflow-y': 'auto' " + :header-style="{ textAlign: 'left' }" + style=" 'width': '100%'; height: calc(100vh - 250px); overflow-y:auto " > + <template #title> + <span>{{ $t('menu.organization.title') }}</span> + <a-tooltip content="鐐瑰嚮鍚庡彲閫氳繃鎷栨嫿鏇存敼鏈烘瀯缁撴瀯,鍐嶆鐐瑰嚮鏉ュ叧闂�" background-color="#165DFF"> + <a-button type="outline" style="float: right;" @click="toggleDraggable" :style="{color: buttonColor}" + v-has-permi="'/base/syorganization!update'"> + <component :is="lockIcon" /> + </a-button> + </a-tooltip> + </template> <a-tree class="tree-demo" - draggable + :draggable="draggable" blockNode :data="treeData" :show-line="showLine" @@ -34,16 +44,20 @@ " @click="() => onIconClick(nodeData)" /> - <IconDelete - style=" + <a-popconfirm v-if="nodeData.deptName!='root'" + content="璇风‘璁ゆ槸鍚﹀垹闄わ紵" + type="success" + @ok="() => onIconClickDelete(nodeData)" + > + <IconDelete + style=" position: absolute; right: 40px; font-size: 12px; top: 10px; color: #3370ff; - " - @click="() => onIconClickDelete(nodeData)" - /> + " /> + </a-popconfirm> </template> </a-tree> </a-card> @@ -54,9 +68,9 @@ :bordered="false" :style="{ width: '100%' }" > - <a-form :model="deptform" layout="horizontal"> - <a-form-item field="parentName" label="涓婄骇鏈烘瀯"> - <a-input v-model="deptform.parentId" /> + <a-form :model="deptform" layout="horizontal" ref="formRef"> + <a-form-item field="parentName" label="涓婄骇鏈烘瀯" disabled> + <a-input v-model="deptform.parentName" /> </a-form-item> <a-form-item field="status" label="鏈烘瀯鐘舵��"> <a-switch @@ -65,13 +79,13 @@ v-model="deptform.status" ></a-switch> </a-form-item> - <a-form-item field="deptName" label="鏈烘瀯鍚嶇О"> + <a-form-item field="deptName" label="鏈烘瀯鍚嶇О" :rules="[{required:true,message:'鏈烘瀯鍚嶇О蹇呭~'},{maxLength:50,message:'闀垮害涓嶈秴杩�50'}]"> <a-input v-model="deptform.deptName" /> </a-form-item> - <a-form-item field="leader" label="鑱旂郴浜�"> + <a-form-item field="leader" label="鑱旂郴浜�" :rules="[{required:true,message:'鑱旂郴浜哄繀濉�'},{maxLength:50,message:'闀垮害涓嶈秴杩�50'}]"> <a-input v-model="deptform.leader" /> </a-form-item> - <a-form-item field="phone" label="鑱旂郴鐢佃瘽"> + <a-form-item field="phone" label="鑱旂郴鐢佃瘽" :rules="[{required:true,message:'鑱旂郴鐢佃瘽蹇呭~'},{maxLength:50,message:'闀垮害涓嶈秴杩�50'}]"> <a-input v-model="deptform.phone" /> </a-form-item> <a-form-item field="address" label="鏈烘瀯鍦板潃" style="align: start"> @@ -94,8 +108,8 @@ @cancel="handleCancel" @ok="addDept" > - <a-form :model="deptform" layout="horizontal"> - <a-form-item field="parentName" label="涓婄骇鏈烘瀯"> + <a-form :model="deptform" layout="horizontal" ref="addFormRef"> + <a-form-item field="parentName" label="涓婄骇鏈烘瀯" disabled> <a-input v-model="deptform.parentName" /> </a-form-item> <a-form-item field="status" label="鏈烘瀯鐘舵��"> @@ -105,13 +119,13 @@ v-model="deptform.status" ></a-switch> </a-form-item> - <a-form-item field="deptName" label="鏈烘瀯鍚嶇О"> + <a-form-item field="deptName" label="鏈烘瀯鍚嶇О" :rules="[{required:true,message:'鏈烘瀯鍚嶇О蹇呭~'},{maxLength:50,message:'闀垮害涓嶈秴杩�50'}]"> <a-input v-model="deptform.deptName" /> </a-form-item> - <a-form-item field="leader" label="鑱旂郴浜�"> + <a-form-item field="leader" label="鑱旂郴浜�" :rules="[{required:true,message:'鑱旂郴浜哄繀濉�'},{maxLength:50,message:'闀垮害涓嶈秴杩�50'}]"> <a-input v-model="deptform.leader" /> </a-form-item> - <a-form-item field="phone" label="鑱旂郴鐢佃瘽"> + <a-form-item field="phone" label="鑱旂郴鐢佃瘽" :rules="[{required:true,message:'鑱旂郴鐢佃瘽蹇呭~'},{maxLength:50,message:'闀垮害涓嶈秴杩�50'}]"> <a-input v-model="deptform.phone" /> </a-form-item> <a-form-item field="address" label="鏈烘瀯鍦板潃" style="align: start"> @@ -131,11 +145,13 @@ OrganizationById, OrganizationDelete, OrganizationList, - OrganizationUpdate, - } from '@/api/authority'; + OrganizationUpdate, User, UserAdd, UserEdit + } from "@/api/authority"; import Authheader from '@/views/authority/components/authheader.vue'; import { Modal } from '@arco-design/web-vue'; + let formRef = ref(); + let addFormRef= ref(); let visible = ref(false); let treeData = ref([]); let showLine = ref(true); @@ -152,19 +168,39 @@ address: '', deptId: '', }); - +let draggable = ref(false); +let buttonColor = ref(""); +let lockIcon = ref("IconLock"); const onIconClick = (nodeData) => { + deptform.value.deptName = ""; + deptform.value.email = ""; + deptform.value.leader = ""; + deptform.value.orderNum = "0"; + deptform.value.phone = ""; + deptform.value.status = ""; + deptform.value.address = ""; + deptform.value.deptId = ""; deptform.value.parentName = nodeData.deptName; deptform.value.parentId = nodeData.deptId; + visible.value = true; }; + const addCb = async (err) => { + if (err) { + visible.value=true; + } else { + await OrganizationAdd({ + ...deptform.value, + } as unknown as Organization).then((res) => { + OrganizationData(''); + }); + } + ; + } + const addDept = async () => { - await OrganizationAdd({ - ...deptform.value, - } as unknown as Organization).then((res) => { - OrganizationData(''); - }); + addFormRef.value.validate(addCb); }; const onIconClickDelete = (nodeData) => { @@ -178,16 +214,24 @@ deptform.value = { ...res.data }; }); }; - const editdept = () => { - OrganizationUpdate({ - ...deptform.value, - } as unknown as Organization).then((res) => { - OrganizationData(''); - Modal.success({ - title: '淇濆瓨鎴愬姛', - content: '淇濆瓨鎴愬姛', + const cb = async (err) => { + if (err) { + + } else { + OrganizationUpdate({ + ...deptform.value, + } as unknown as Organization).then((res) => { + OrganizationData(''); + Modal.success({ + title: '淇濆瓨鎴愬姛', + content: '淇濆瓨鎴愬姛', + }); }); - }); + } + ; + } + const editdept = () => { + formRef.value.validate(cb); }; const reset = (id) => { OrganizationById(id).then((res) => { @@ -244,6 +288,11 @@ }; OrganizationData(''); + const toggleDraggable = () =>{ + draggable.value = !draggable.value; + buttonColor.value= draggable.value ? '#575757' : ''; + lockIcon.value = draggable.value ? 'IconUnlock' : 'IconLock'; + }; </script> <style scoped> -- Gitblit v1.8.0