| | |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | import { useI18n } from 'vue-i18n' |
| | | const { t } = useI18n() |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const router = useRouter() |
| | | const add = ref(false) |
| | | const adda = ref(false) |
| | |
| | | const opena = async(row) => { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否删除该角色?', |
| | | '提示', |
| | | t('delivery.derole'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | confirmButtonText: t('delivery.yes'), |
| | | cancelButtonText: t('delivery.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ); |
| | |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | 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> |
| | | <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">添加角色</el-button> |
| | | <el-button type="primary" style="margin-top: 10px;margin-left: 10px;" size="mini" id="searchButton" @click="add = true">{{ $t('delivery.addrole') }}</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;"> |
| | | <el-table height="240" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="name" align="center" label="角色" min-width="180" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <el-table-column prop="name" align="center" :label="$t('delivery.role')" min-width="180" /> |
| | | <el-table-column fixed="right" :label="$t('delivery.operate')" align="center" width="200"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">编辑</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">删除</el-button> |
| | | <el-button size="mini" type="text" plain @click="handleEdit(scope.row)">{{ $t('delivery.edit') }}</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">{{ $t('delivery.delete') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </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('delivery.addrole')" > |
| | | <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-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw"> |
| | | <el-input placeholder="请输入角色" v-model="name" autocomplete="off" /> |
| | | <el-form-item :label="$t('delivery.rolea')" :required="true" style="width: 25vw"> |
| | | <el-input :placeholder="$t('delivery.inrole')" v-model="name" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRow"> |
| | | 确认 |
| | | {{ $t('delivery.sure') }} |
| | | </el-button> |
| | | <el-button @click="add = false">取消</el-button> |
| | | <el-button @click="add = false"> {{ $t('delivery.cancel') }}</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog v-model="adda" top="23vh" width="37%" title="修改角色" > |
| | | <el-dialog v-model="adda" top="23vh" width="37%" :title="$t('delivery.editrole')"> |
| | | <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-col :span="6"> |
| | | <div id="dt" style="font-size: 15px;"> |
| | | <div> |
| | | <el-form-item label="角色:" :required="true" style="width: 25vw"> |
| | | <el-input placeholder="请输入角色" v-model="editingUser.name" autocomplete="off" /> |
| | | <el-form-item :label="$t('delivery.rolea')" :required="true" style="width: 25vw"> |
| | | <el-input :placeholder="$t('delivery.inrole')" v-model="editingUser.name" autocomplete="off" /> |
| | | </el-form-item></div></div> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="getTableRowa"> |
| | | 确认 |
| | | {{ $t('delivery.sure') }} |
| | | </el-button> |
| | | <el-button @click="adda = false">取消</el-button> |
| | | <el-button @click="adda = false">{{ $t('delivery.cancel') }}</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |