修改前端分页i18n配置以及添加chief管理员的修改功能-liyuchen

This commit is contained in:
李宇辰 2023-04-14 18:31:30 +08:00
parent 47701783c3
commit ea416a68fc
17 changed files with 191 additions and 58 deletions

View File

@ -32,7 +32,24 @@ export const addAdmin = (data) => {
});
};
/**
* 更新chief管理员用户
* @param data
* @returns {Promise<AxiosResponse<any>>}
*/
export const updateAdmin = (data) => {
return request({
url: '/api/' + moduleName + '/ui/administrator/update',
method: 'put',
data: data
});
};
/**
* 删除chief管理员用户
* @param ids
* @returns {Promise<AxiosResponse<any>>}
*/
export const remove = (ids) => {
return request({
url: '/api/' + moduleName + '/ui/administrator/delete',

View File

@ -73,10 +73,6 @@ const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -93,7 +93,7 @@
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="del(scope.row)">delete</el-button>
<el-button size="small" text type="primary" @click="del(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog title="upload" v-model="state.isShowDialog" width="700px" close-on-click-modal="false">
<el-dialog title="edit picture" v-model="state.isShowDialog" width="700px" close-on-click-modal="false">
<el-form :model="state.ruleForm" size="default" label-width="150px" :rules="rules" ref="adminAddFormRef">
<el-form-item label="upload picture" prop="img">
<el-upload

View File

@ -103,8 +103,8 @@
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="editData(scope.row)">edit</el-button>
<el-button size="small" text type="primary" @click="del(scope.row)">delete</el-button>
<el-button size="small" text type="primary" @click="editData(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="del(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog title="upload" v-model="state.isShowDialog" width="700px">
<el-dialog title="edit hotspot" v-model="state.isShowDialog" width="700px">
<el-form :model="state.ruleForm" size="default" label-width="120px" :rules="rules" ref="adminAddFormRef">
<el-form-item label="area cn" prop="areaCn">
<el-input v-model="state.ruleForm.areaCn" placeholder="please enter area cn" style="width: 300px"/>
@ -45,10 +45,6 @@ const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -1,5 +1,5 @@
<template>
<el-dialog title="upload" v-model="state.isShowDialog" width="700px">
<el-dialog title="edit wordclouds" v-model="state.isShowDialog" width="700px">
<el-form :model="state.ruleForm" size="default" label-width="120px" :rules="rules" ref="adminAddFormRef">
<el-form-item label="time" prop="time">
<el-date-picker
@ -51,10 +51,6 @@ const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -45,10 +45,6 @@ const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -51,10 +51,6 @@ const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -82,8 +82,8 @@
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="editWordCloud(scope.row)">edit</el-button>
<el-button size="small" text type="primary" @click="delWordCloud(scope.row)">delete</el-button>
<el-button size="small" text type="primary" @click="editWordCloud(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="delWordCloud(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>
@ -121,8 +121,8 @@
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="editHotspot(scope.row)">edit</el-button>
<el-button size="small" text type="primary" @click="delHotspot(scope.row)">delete</el-button>
<el-button size="small" text type="primary" @click="editHotspot(scope.row)">Edit</el-button>
<el-button size="small" text type="primary" @click="delHotspot(scope.row)">Delete</el-button>
</template>
</el-table-column>
</el-table>

View File

@ -28,10 +28,6 @@ const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -1,5 +1,6 @@
<template>
<div class="system-role-container layout-padding">
<el-config-provider :locale="en">
<el-row :gutter="22">
<el-col :span="10">
<div class="system-role-padding layout-padding-auto layout-padding-view">
@ -93,6 +94,7 @@
</div>
</el-col>
</el-row>
</el-config-provider>
<RoleDialog ref="roleDialogRef"
@refresh="getTableData()" />
<Audit ref="auditRef" @callback="getTableData"/>
@ -100,6 +102,7 @@
</template>
<script lang="ts" setup name="systemRole">
import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus';
import {getDataUploadPage,getDisasterPage} from '/@/api/response/dataUpload.js'
const activeName = ref('first');

View File

@ -28,10 +28,6 @@ const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -1,6 +1,7 @@
<template>
<div class="system-role-container layout-padding">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<el-config-provider :locale="en">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<el-input size="default" placeholder="please enter manager name" style="max-width: 200px" v-model="state.searchName"
clearable></el-input>
@ -66,6 +67,7 @@
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</el-config-provider>
</div>
<RoleDialog ref="roleDialogRef"
@refresh="getTableData()" />
@ -74,6 +76,7 @@
</template>
<script lang="ts" setup name="systemRole">
import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus';
import {getAdminManagerPage,auditData} from '/@/api/response/adminManager.js';
import Audit from './component/audit.vue';

View File

@ -31,14 +31,11 @@ import {reactive, ref} from "vue";
import {addAdmin} from '/@/api/response/administrator.js';
import {ElMessage} from "element-plus";
const adminAddFormRef = ref();
const emit = defineEmits(['callback']);
const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
name: '', //
code: '',//
states: '',//
tableData: [],
},
tableData: [],
//

View File

@ -0,0 +1,144 @@
<template>
<el-dialog title="edit administrator" v-model="state.isShowDialog" width="700px">
<el-form :model="state.ruleForm" size="default" label-width="90px" :rules="rules" ref="adminAddFormRef">
<el-form-item label="name" prop="name">
<el-input v-model="state.ruleForm.name" placeholder="please enter name" clearable style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="email" prop="email">
<el-input v-model="state.ruleForm.email" placeholder="please enter email" clearable style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="account" prop="account">
<el-input v-model="state.ruleForm.account" placeholder="please enter account" clearable style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="phone" prop="phone">
<el-input v-model="state.ruleForm.phone" placeholder="please enter phone" clearable style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="organization" prop="organization">
<el-input v-model="state.ruleForm.organization" placeholder="please enter organization" clearable style="width: 300px"></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="onCancel" size="default">cancel</el-button>
<el-button type="primary" @click="onSubmit" size="default" :loading="state.isLoading">edit</el-button>
</span>
</template>
</el-dialog>
</template>
<script setup>
import {reactive, ref} from "vue";
import {updateAdmin} from '/@/api/response/administrator.js';
import {ElMessage} from "element-plus";
const adminAddFormRef = ref();
const emit = defineEmits(['callback']);
const state = reactive({
isShowDialog: false,
isLoading:false,
ruleForm: {
},
tableData: [],
//
dictData: [],
unitData:[],
standardId: '',
detectionData: []
})
//
let validateEmail = (rule, value, callback) => {
if (!value) {
return callback(new Error("please enter email"));
}
else {
const reg= /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/
if(reg.test(value)){
callback();
}else {
return callback(new Error("The mailbox format is incorrect"));
}
}
};
//
let checkPhone = (rule, value, callback) => {
if (!value) {
return callback(new Error('please enter phone'));
} else {
//
const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
//
const phoneReg = /^\d{3}-\d{8}|\d{4}-\d{7}$/
if (reg.test(value)||phoneReg.test(value)) {
callback();
} else {
return callback(new Error('Please enter the correct contact number'));
}
}
};
//
const rules = reactive({
name: [
{required: true, message: 'please enter name', trigger: 'blur'}
],
email: [
/* {required: true, trigger: 'blur',validator:validateEmail}*/
{required: true, trigger: 'blur',type:'email'}
],
account: [
{required: true, message: 'please enter account', trigger: 'blur'}
],
phone: [
{required: true, trigger: 'blur',validator:checkPhone}
],
organization: [
{required: true, message: 'please enter organization', trigger: 'blur'}
]
})
//
const resetField = () => {
adminAddFormRef.value.resetFields();
}
//
const openDialog = (row) => {
state.isShowDialog = true;
Object.assign(state.ruleForm,row)
};
//
const closeDialog = () => {
state.isShowDialog = false;
//
state.ruleForm.tableData = [];
resetField();
};
//
const onCancel = () => {
closeDialog();
};
//
const onSubmit = () => {
adminAddFormRef.value.validate((valid, fields) => {
if (valid) {
state.isLoading = true;
updateAdmin(state.ruleForm).then(res => {
ElMessage.success("edit successfully");
emit('callback');
}).catch(err => {
//ElMessage.error("Add failure");
}).finally(()=>{
state.isLoading = false;
})
closeDialog();
}
})
};
//
defineExpose({
openDialog,
});
</script>
<style scoped>
</style>

View File

@ -1,6 +1,7 @@
<template>
<div class="system-role-container layout-padding">
<div class="system-role-padding layout-padding-auto layout-padding-view">
<el-config-provider :locale="en">
<div class="system-user-search mb15" style="display: flex;margin-left: 10px;margin-top: 10px;">
<el-input size="default" placeholder="please enter username" style="max-width: 180px" v-model="state.searchName"
clearable></el-input>
@ -34,6 +35,9 @@
<el-table-column prop="name"
label="User name"
show-overflow-tooltip></el-table-column>
<el-table-column prop="account"
label="account"
show-overflow-tooltip></el-table-column>
<el-table-column prop="email"
label="Email"
show-overflow-tooltip></el-table-column>
@ -43,23 +47,11 @@
<el-table-column prop="phone"
label="Contact details"
show-overflow-tooltip></el-table-column>
<!-- <el-table-column prop="vordmId"
label="VoRDM ID"
show-overflow-tooltip></el-table-column>
<el-table-column prop="disasterType"
label="Disaster type"
show-overflow-tooltip></el-table-column>
<el-table-column prop="applicationTime"
label="Application time"
show-overflow-tooltip></el-table-column>
<el-table-column prop="Remark"
label="Remark"
show-overflow-tooltip></el-table-column>-->
<el-table-column prop="Operate"
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<!-- <el-button link type="primary" size="small" @click="handleClick">Detail</el-button>-->
<el-button link type="primary" size="small" @click="editUser(scope.row)">Edit</el-button>
<el-button link type="primary" size="small" @click="deleteUser(scope.row)">Delete</el-button>
</template>
</el-table-column>
@ -75,19 +67,24 @@
layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</el-config-provider>
</div>
<AddAdministrator ref="administratorRef" @callback="getTableData"/>
<EditAdministrator ref="editAdministratorRef" @callback="getTableData"/>
<RoleDialog ref="roleDialogRef"
@refresh="getTableData()" />
</div>
</template>
<script lang="ts" setup name="systemRole">
import en from 'element-plus/dist/locale/en.mjs'
import type { TabsPaneContext } from 'element-plus';
import AddAdministrator from './component/addAdministrator.vue';
import EditAdministrator from './component/editAdministrator.vue';
import {getAdminPage,remove} from '/@/api/response/administrator.js';
const activeName = ref('first');
const administratorRef = ref();
const editAdministratorRef = ref();
const handleClick = (tab: TabsPaneContext, event: Event) => {
console.log(tab, event);
};
@ -134,9 +131,9 @@ const getTableData = () => {
const addUser = () => {
administratorRef.value.openDialog();
};
//
const onOpenEditRole = (type, row) => {
roleDialogRef.value.openDialog(type, row);
// chief
const editUser = (row) => {
editAdministratorRef.value.openDialog(row);
};
//chief
const batchDel = () => {