From 6bacf9e52ac2f0f2cf42c47fb5e31ddae1f2d987 Mon Sep 17 00:00:00 2001 From: wangfei <3597712270@qq.com> Date: 星期四, 04 七月 2024 16:55:34 +0800 Subject: [PATCH] 大理片笼现有全部功能,用户管理、权限管理全部页面功能,角色管理页面 --- UI-Project/src/views/User/permissions.vue | 300 ++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 242 insertions(+), 58 deletions(-) diff --git a/UI-Project/src/views/User/permissions.vue b/UI-Project/src/views/User/permissions.vue index cdaab17..740afff 100644 --- a/UI-Project/src/views/User/permissions.vue +++ b/UI-Project/src/views/User/permissions.vue @@ -5,11 +5,12 @@ const router = useRouter() const add = ref(false) const adda = ref(false) +const addc = ref(false) +const addb = ref(false) import { useI18n } from 'vue-i18n' const { t } = useI18n() let language = ref(localStorage.getItem('lang') || 'zh') -const editingUser = ref({}); // 鐢ㄤ簬瀛樺偍褰撳墠缂栬緫鐨勭敤鎴锋暟鎹� import request from "@/utils/request" import { ref, onMounted } from "vue"; // import { ref } from 'vue' @@ -18,8 +19,9 @@ const selectedProjectNoa = ref(''); // 褰撳墠閫変腑鐨勮鑹� // const options = ref<any[]>([]); // 涓嬫媺閫夐」鍒楄〃 const menuName = ref(''); - const parentId = ref(''); + const listSort = ref(''); const url = ref(''); +const currentRow = reactive({}); // 褰撳墠琛岀殑鏁版嵁 const tableData = ref([]) const slot = ref('') request.get("/loadGlass/sys/menu/nav").then((res) => { @@ -53,7 +55,7 @@ const response = await request.post('/loadGlass/sys/role/queryRole',{ key: '' }); - if (response.code == 200) { + if (response.code === 200) { titleSelectJsona.value.processTypea = response.data; console.log(response.data); @@ -64,20 +66,64 @@ console.error('Error fetching options:', error); } }; -// 娣诲姞 +const handleBindRack = (row) => { + // selectedRow.value = row; // 鏇存柊閫変腑鐨勮鏁版嵁 + currentRow.menuName = row.menuName; // 鐩存帴璁剧疆鍝嶅簲寮忓睘鎬� + currentRow.id = row.id; // 鐩存帴璁剧疆鍝嶅簲寮忓睘鎬� + // currentRow.slot = row.slot; + // window.localStorage.setItem('deviceId', row.deviceId) + // window.localStorage.setItem('slot', row.slot) + addb.value = true; // 鎵撳紑缁戝畾鏋跺瓙瀵硅瘽妗� +}; +// 娣诲姞涓�绾ц彍鍗� const getTableRow = async () => { try { const response = await request.post('/loadGlass/sys/menu/save', { menuName: menuName.value, - parentId: parentId.value, + listSort: listSort.value, url: url.value, }); - if (response.code == 200) { + if (response.code === 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); add.value = false; - // tableData.value = response.data; + tableData.value = response.data; + menuName.value = ''; + listSort.value = ''; + url.value = ''; + } else { + // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� + ElMessage.error(response.msg); + } + } catch (error) { + // 澶勭悊閿欒 + console.error(error); + } +}; +// 娣诲姞浜岀骇鑿滃崟 +const getTableRowb = async () => { + try { + const dataToSend = { + parentId: currentRow.id, + // menuName: currentRow.menuName, + // children: [ + // { + menuName: menuName.value, + listSort: listSort.value, + url: url.value, + // } + // ] + }; + const response = await request.post('/loadGlass/sys/menu/save',dataToSend ); + if (response.code === 200) { + // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 + ElMessage.success(response.message); + addb.value = false; + tableData.value = response.data; + menuName.value = ''; + listSort.value = ''; + url.value = ''; } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -89,23 +135,60 @@ }; // 澶勭悊缂栬緫鎸夐挳鐐瑰嚮 function handleEdit(row) { - editingUser.value = { ...row }; // 浣跨敤灞曞紑杩愮畻绗﹀鍒跺綋鍓嶈鏁版嵁 + listSort.value = row.listSort; + menuName.value = row.menuName; + url.value = row.url; adda.value = true; // 鏄剧ず瀵硅瘽妗� +} +// 淇敼浜岀骇鑿滃崟 +function handleEditc(row) { + listSort.value = row.listSort; + menuName.value = row.menuName; + url.value = row.url; + addc.value = true; // 鏄剧ず瀵硅瘽妗� } // 缂栬緫 const getTableRowa = async () => { try { const response = await request.post('/loadGlass/sys/menu/updateMenu', { + parentId: currentRow.id, menuName: menuName.value, - parentId: parentId.value, + listSort: listSort.value, url: url.value, }); - if (response.code == 200) { + if (response.code === 200) { // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 ElMessage.success(response.message); - editingUser.value = {}; adda.value = false; tableData.value = response.data; + menuName.value = ''; + listSort.value = ''; + url.value = ''; + } else { + // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� + ElMessage.error(response.msg); + } + } catch (error) { + // 澶勭悊閿欒 + console.error(error); + } +}; +// 缂栬緫浜岀骇鑿滃崟 +const getTableRowac = async () => { + try { + const response = await request.post('/loadGlass/sys/menu/updateMenu', { + menuName: menuName.value, + listSort: listSort.value, + url: url.value, + }); + if (response.code === 200) { + // 缁戝畾鎴愬姛锛屽鐞嗛�昏緫 + ElMessage.success(response.message); + addc.value = false; + tableData.value = response.data; + menuName.value = ''; + listSort.value = ''; + url.value = ''; } else { // 璇锋眰澶辫触锛屾樉绀洪敊璇秷鎭� ElMessage.error(response.msg); @@ -172,10 +255,10 @@ > <el-table-column prop="menuName" :label="$t('customer.semenu')" align="center" min-width="140" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"/> <el-table-column prop="url" :label="$t('customer.link')" align="center" min-width="160"/> - <el-table-column prop="id" align="center" :label="$t('customer.sort')" min-width="140"/> + <el-table-column prop="listSort" align="center" :label="$t('customer.sort')" min-width="140"/> <el-table-column fixed="right" :label="$t('customer.operate')" align="center"> <template #default="scope"> - <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">{{ $t('customer.exit') }}</el-button> + <el-button size="mini" type="text" plain @click="handleEditc(scope.row)">{{ $t('customer.exit') }}</el-button> <el-button size="mini" type="text" plain @click="opena(scope.row)">{{ $t('customer.delete') }}</el-button> </template> </el-table-column> @@ -185,9 +268,10 @@ </el-table-column> <el-table-column prop="menuName" :label="$t('customer.firstmenu')" align="center" min-width="120" /> <el-table-column prop="url" :label="$t('customer.link')" align="center" min-width="200"/> - <el-table-column prop="id" align="center" :label="$t('customer.sort')" min-width="180" /> + <el-table-column prop="listSort" align="center" :label="$t('customer.sort')" min-width="180" /> <el-table-column fixed="right" :label="$t('customer.operate')" align="center" width="200"> <template #default="scope"> + <el-button size="mini" type="text" plain @click="handleBindRack(scope.row)">{{ $t('customer.addmenua') }}</el-button> <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">{{ $t('customer.exit') }}</el-button> <el-button size="mini" type="text" plain @click="opena(scope.row)">{{ $t('customer.delete') }}</el-button> </template> @@ -199,6 +283,106 @@ <el-dialog v-model="add" top="23vh" width="37%" :title="$t('customer.addmenu')"> <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> <el-form size="mini" label-width="150px"> + <el-form label-width="150px" label-position="right"> + <el-row style="margin-top: -15px;margin-bottom: -2px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.firstmenuname')" :required="true" style="width: 25vw"> + <el-input v-model="menuName" autocomplete="off" :placeholder="$t('customer.inmenu')"/> + </el-form-item></div></div> + </el-col> + </el-row> + <el-row style="margin-top: 10px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.linka')" :required="true" style="width: 25vw"> + <el-input v-model="url" autocomplete="off" :placeholder="$t('customer.inlink')"/> + </el-form-item></div></div> + </el-col> + </el-row> + <el-row style="margin-top: 10px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.sorta')" :required="true" style="width: 25vw"> + <el-input v-model="listSort" autocomplete="off" :placeholder="$t('customer.insort')"/> + </el-form-item></div></div> + </el-col> + </el-row> + </el-form> + </el-form> + </div> + <template #footer> + <div id="dialog-footer"> + <el-button type="primary" @click="getTableRow"> + {{ $t('customer.sure') }} + </el-button> + <el-button @click="add = false">{{ $t('customer.cancel') }}</el-button> + </div> + </template> + </el-dialog> + <el-dialog v-model="addb" top="23vh" width="37%" :title="$t('customer.addmenua')"> + <div style="margin-bottom: 20px"> + <el-form> + <el-row style="margin-top: -15px;margin-bottom: -2px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <el-form-item :label="$t('customer.firstmenuname')" style="width: 22vw"> + <!-- {{ currentRow.menuName }} --> + <el-input disabled v-model="currentRow.menuName" autocomplete="off"></el-input> + </el-form-item> + </div> + </el-col> + </el-row> + </el-form> + </div> + <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> + <el-form size="mini" label-width="150px"> + <el-form label-width="150px" label-position="right"> + <el-row style="margin-top: -15px;margin-bottom: -2px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.semenuname')" :required="true" style="width: 25vw"> + <el-input v-model="menuName" autocomplete="off" :placeholder="$t('customer.inmenu')"/> + </el-form-item></div></div> + </el-col> + </el-row> + <el-row style="margin-top: 10px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.linka')" :required="true" style="width: 25vw"> + <el-input v-model="url" autocomplete="off" :placeholder="$t('customer.inlink')"/> + </el-form-item></div></div> + </el-col> + </el-row> + <el-row style="margin-top: 10px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.sorta')" :required="true" style="width: 25vw"> + <el-input v-model="listSort" autocomplete="off" :placeholder="$t('customer.insort')"/> + </el-form-item></div></div> + </el-col> + </el-row> + </el-form> + </el-form> + </div> + <template #footer> + <div id="dialog-footer"> + <el-button type="primary" @click="getTableRowb"> + {{ $t('customer.sure') }} + </el-button> + <el-button @click="addb = false">{{ $t('customer.cancel') }}</el-button> + </div> + </template> + </el-dialog> + <el-dialog v-model="adda" top="23vh" width="37%" :title="$t('customer.exmene')"> + <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> + <el-form ref="formRef" size="mini" label-width="150px"> <el-form label-width="100px" label-position="right"> <el-row style="margin-top: -15px;margin-bottom: -2px;"> <el-col :span="6"> @@ -223,50 +407,7 @@ <div id="dt" style="font-size: 15px;"> <div> <el-form-item :label="$t('customer.sorta')" :required="true" style="width: 25vw"> - <el-input v-model="parentId" autocomplete="off" :placeholder="$t('customer.insort')"/> - </el-form-item></div></div> - </el-col> - </el-row> - </el-form> - </el-form> - </div> - <template #footer> - <div id="dialog-footer"> - <el-button type="primary" @click="getTableRow"> - {{ $t('customer.sure') }} - </el-button> - <el-button @click="add = false">{{ $t('customer.cancel') }}</el-button> - </div> - </template> - </el-dialog> - <el-dialog v-model="adda" top="23vh" width="37%" :title="$t('customer.exmene')"> - <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> - <el-form :model="editingUser" ref="formRef" size="mini" label-width="150px"> - <el-form label-width="100px" label-position="right"> - <el-row style="margin-top: -15px;margin-bottom: -2px;"> - <el-col :span="6"> - <div id="dt" style="font-size: 15px;"> - <div> - <el-form-item :label="$t('customer.menu')" :required="true" style="width: 25vw"> - <el-input v-model="editingUser.menuName" autocomplete="off" :placeholder="$t('customer.inmenu')"/> - </el-form-item></div></div> - </el-col> - </el-row> - <el-row style="margin-top: 10px;"> - <el-col :span="6"> - <div id="dt" style="font-size: 15px;"> - <div> - <el-form-item :label="$t('customer.linka')" :required="true" style="width: 25vw"> - <el-input v-model="editingUser.url" autocomplete="off" :placeholder="$t('customer.inlink')"/> - </el-form-item></div></div> - </el-col> - </el-row> - <el-row style="margin-top: 10px;"> - <el-col :span="6"> - <div id="dt" style="font-size: 15px;"> - <div> - <el-form-item :label="$t('customer.sorta')" :required="true" style="width: 25vw"> - <el-input v-model="editingUser.parentId" autocomplete="off" :placeholder="$t('customer.insort')"/> + <el-input v-model="listSort" autocomplete="off" :placeholder="$t('customer.insort')"/> </el-form-item></div></div> </el-col> </el-row> @@ -282,6 +423,49 @@ </div> </template> </el-dialog> + <el-dialog v-model="addc" top="23vh" width="37%" :title="$t('customer.exmenea')"> + <div style="margin-left: -50px;margin-top: 10px;margin-bottom: 10px;"> + <el-form ref="formRef" size="mini" label-width="150px"> + <el-form label-width="100px" label-position="right"> + <el-row style="margin-top: -15px;margin-bottom: -2px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.menu')" :required="true" style="width: 25vw"> + <el-input v-model="menuName" autocomplete="off" :placeholder="$t('customer.inmenu')"/> + </el-form-item></div></div> + </el-col> + </el-row> + <el-row style="margin-top: 10px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.linka')" :required="true" style="width: 25vw"> + <el-input v-model="url" autocomplete="off" :placeholder="$t('customer.inlink')"/> + </el-form-item></div></div> + </el-col> + </el-row> + <el-row style="margin-top: 10px;"> + <el-col :span="6"> + <div id="dt" style="font-size: 15px;"> + <div> + <el-form-item :label="$t('customer.sorta')" :required="true" style="width: 25vw"> + <el-input v-model="listSort" autocomplete="off" :placeholder="$t('customer.insort')"/> + </el-form-item></div></div> + </el-col> + </el-row> + </el-form> + </el-form> + </div> + <template #footer> + <div id="dialog-footer"> + <el-button type="primary" @click="getTableRowac"> + {{ $t('customer.sure') }} + </el-button> + <el-button @click="addc = false">{{ $t('customer.cancel') }}</el-button> + </div> + </template> + </el-dialog> </template> <style scoped> -- Gitblit v1.8.0