From 07b0cdcb34db682b51ca972f5c23da653aa5d32d Mon Sep 17 00:00:00 2001 From: wangfei <3597712270@qq.com> Date: 星期一, 21 十月 2024 15:49:01 +0800 Subject: [PATCH] 钢化完整版图样式逻辑更改 --- UI-Project/src/views/User/permissions.vue | 378 ++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 269 insertions(+), 109 deletions(-) diff --git a/UI-Project/src/views/User/permissions.vue b/UI-Project/src/views/User/permissions.vue index b5e4ae6..b2f373d 100644 --- a/UI-Project/src/views/User/permissions.vue +++ b/UI-Project/src/views/User/permissions.vue @@ -5,7 +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') import request from "@/utils/request" import { ref, onMounted } from "vue"; // import { ref } from 'vue' @@ -14,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) => { @@ -49,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); @@ -60,20 +66,56 @@ 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; // 鎵撳紑缁戝畾鏋跺瓙瀵硅瘽妗� +}; +function closeDialog(row) { + add.value = false; + menuName.value = ''; + listSort.value = ''; + url.value = ''; +} +function closeDialoga(row) { + adda.value = false; + menuName.value = ''; + listSort.value = ''; + url.value = ''; +} +function closeDialogb(row) { + addb.value = false; + menuName.value = ''; + listSort.value = ''; + url.value = ''; +} +function closeDialogc(row) { + addc.value = false; + menuName.value = ''; + listSort.value = ''; + url.value = ''; +} +// 娣诲姞涓�绾ц彍鍗� 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); @@ -83,20 +125,94 @@ 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); + } + } catch (error) { + // 澶勭悊閿欒 + console.error(error); + } +}; +// 澶勭悊缂栬緫鎸夐挳鐐瑰嚮 +function handleEdit(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); - add.value = false; + 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); @@ -108,16 +224,16 @@ }; // 鍒犻櫎 const opena = async(row) => { - try { + try { const confirmResult = await ElMessageBox.confirm( - '鏄惁鍒犻櫎璇ョ敤鎴�?', - '鎻愮ず', + t('customer.demenu'), + t('customer.prompt'), { - confirmButtonText: '鏄�', - cancelButtonText: '鍙栨秷', + confirmButtonText: t('customer.yes'), + cancelButtonText: t('customer.cancel'), type: 'warning', - } - ); + } + ); if (confirmResult === 'confirm') { // 鐢ㄦ埛鐐瑰嚮浜嗏�滄槸鈥濓紝鐜板湪璋冪敤鍒犻櫎鎺ュ彛 const response = await request.post("/loadGlass/sys/menu/deleteMenu", { @@ -137,54 +253,16 @@ } }; -// const gridOptions = reactive({ -// border: "full",//琛ㄦ牸鍔犺竟妗� -// keepSource: true,//淇濇寔婧愭暟鎹� -// align: 'center',//鏂囧瓧灞呬腑 -// stripe:true,//鏂戦┈绾� -// rowConfig: {isCurrent: true, isHover: true,height: 50},//榧犳爣绉诲姩鎴栭�夋嫨楂樹寒 -// id: 'OrderList', -// showFooter: true,//鏄剧ず鑴� -// printConfig: {}, -// importConfig: {}, -// exportConfig: {}, -// scrollY:{ enabled: true },//寮�鍚櫄鎷熸粴鍔� -// showOverflow:true, -// columnConfig: { -// resizable: true, -// useKey: true -// }, -// filterConfig: { //绛涢�夐厤缃」 -// remote: true -// }, -// customConfig: { -// storage: true -// }, -// editConfig: { -// trigger: 'click', -// mode: 'row', -// showStatus: true -// }, -// data: [ -// { -// 'id': '1', -// 'long': '5', -// 'wide': '1005', -// 'thick': '183.6', -// } -// ] - -// }) </script> <template> - <div style="height: 700px;"> - <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">娣诲姞鑿滃崟</el-button> + <div style="height: 600px;"> + <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">{{ $t('customer.addmenu') }}</el-button> <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading"> <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 650px;"> <el-table :data="tableData" - height="650" + height="550" @expand-change="handleExpandChange" row-key="id" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" @@ -199,61 +277,43 @@ row-key="id" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}" > - <el-table-column prop="menuName" label="浜岀骇鑿滃崟鏍�" align="center" min-width="140" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"/> - <el-table-column prop="url" label="閾炬帴" align="center" min-width="160"/> - <el-table-column prop="id" align="center" label="鎺掑簭" min-width="140"/> - <el-table-column fixed="right" label="鎿嶄綔" align="center"> + <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="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="adda = true">缂栬緫</el-button> - <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</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> </el-table> </div> </template> </el-table-column> - <el-table-column prop="menuName" label="涓�绾ц彍鍗曟爮" align="center" min-width="120" /> - <el-table-column prop="url" label="閾炬帴" align="center" min-width="200"/> - <el-table-column prop="id" align="center" label="鎺掑簭" min-width="180" /> - <el-table-column fixed="right" label="鎿嶄綔" align="center" width="200"> + <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="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="adda = true">缂栬緫</el-button> - <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</el-button> + <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> </el-table-column> - </el-table> - <!-- <el-table height="240" ref="table" - @selection-change="handleSelectionChange" - :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> - <el-table-column prop="menuName" align="center" label="鑿滃崟鏍�" min-width="180" /> - <el-table-column align="center" label="閾炬帴" min-width="180"> - <template #default="scope"> - <el-tag v-for="role in scope.row.children"> - {{role.url}} - </el-tag> - </template> - </el-table-column> - <el-table-column prop="id" align="center" label="鎺掑簭" min-width="180" /> - <el-table-column fixed="right" label="鎿嶄綔" align="center" width="200"> - <template #default="scope"> - <el-button size="mini" type="text" plain @click="adda = true">缂栬緫</el-button> - <el-button size="mini" type="text" plain @click="opena(scope.row)">鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> --> + </el-table> </div> </el-card> </div> - <el-dialog v-model="add" top="23vh" width="37%" title="娣诲姞鑿滃崟" > + <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="100px" label-position="right"> + <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="鑿滃崟鏍忥細" :required="true" style="width: 25vw"> - <el-input v-model="menuName" autocomplete="off" /> + <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> @@ -261,8 +321,8 @@ <el-col :span="6"> <div id="dt" style="font-size: 15px;"> <div> - <el-form-item label="閾炬帴锛�" :required="true" style="width: 25vw"> - <el-input v-model="url" autocomplete="off" /> + <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> @@ -270,8 +330,8 @@ <el-col :span="6"> <div id="dt" style="font-size: 15px;"> <div> - <el-form-item label="鎺掑簭锛�" :required="true" style="width: 25vw"> - <el-input v-model="parentId" autocomplete="off" /> + <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> @@ -281,22 +341,79 @@ <template #footer> <div id="dialog-footer"> <el-button type="primary" @click="getTableRow"> - 纭 + {{ $t('customer.sure') }} </el-button> - <el-button @click="add = false">鍙栨秷</el-button> + <el-button @click="closeDialog">{{ $t('customer.cancel') }}</el-button> </div> </template> </el-dialog> - <el-dialog v-model="adda" top="23vh" width="37%" title="淇敼鑿滃崟" > + <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="closeDialogb">{{ $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"> <div id="dt" style="font-size: 15px;"> <div> - <el-form-item label="鑿滃崟鏍忥細" :required="true" style="width: 25vw"> - <el-input v-model="menuName" autocomplete="off" /> + <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> @@ -304,8 +421,8 @@ <el-col :span="6"> <div id="dt" style="font-size: 15px;"> <div> - <el-form-item label="閾炬帴锛�" :required="true" style="width: 25vw"> - <el-input v-model="url" autocomplete="off" /> + <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> @@ -313,8 +430,8 @@ <el-col :span="6"> <div id="dt" style="font-size: 15px;"> <div> - <el-form-item label="鎺掑簭锛�" :required="true" style="width: 25vw"> - <el-input v-model="parentId" autocomplete="off" /> + <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> @@ -324,9 +441,52 @@ <template #footer> <div id="dialog-footer"> <el-button type="primary" @click="getTableRowa"> - 纭 + {{ $t('customer.sure') }} </el-button> - <el-button @click="adda = false">鍙栨秷</el-button> + <el-button @click="closeDialoga">{{ $t('customer.cancel') }}</el-button> + </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="closeDialogc">{{ $t('customer.cancel') }}</el-button> </div> </template> </el-dialog> -- Gitblit v1.8.0