This commit is contained in:
yyhouc 2023-04-17 09:08:05 +08:00
commit 16badc8908
19 changed files with 326 additions and 226 deletions

View File

@ -15,4 +15,14 @@ export function review(data) {
method: 'post',
data: data,
});
}
/**
* 首页 dashborad
*/
export function statistics(){
return request({
url: '/api/'+moduleName+'/ui/disasterInfo/statistics',
method: 'get'
});
}

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

@ -78,7 +78,7 @@
show-overflow-tooltip></el-table-column>
<el-table-column prop="title"
label="Professional title"
show-overflow-tooltip></el-table-column>
show-overflow-tooltip width="150"></el-table-column>
<el-table-column prop="size"
label="Data size"
show-overflow-tooltip>
@ -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

@ -17,7 +17,7 @@
<div class="flex-auto">
<span class="font30">{{ v.num1 }}</span>
<span class="ml5 font16"
:style="{ color: v.color1 }">{{ v.num2 }}%</span>
:style="{ color: v.color1 }">{{ v.num2 }}</span>
<div class="mt10">{{ v.num3 }}</div>
</div>
<div class="home-card-item-icon flex"
@ -114,7 +114,7 @@ import * as echarts from 'echarts';
import { storeToRefs } from 'pinia';
import { useThemeConfig } from '/@/stores/themeConfig';
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
import {statistics} from '/@/api/disasterInfo/index.js';
//
const homeLineRef = ref();
const homePieRef = ref();
@ -125,6 +125,7 @@ const storesThemeConfig = useThemeConfig();
const { themeConfig } = storeToRefs(storesThemeConfig);
const { isTagsViewCurrenFull } = storeToRefs(storesTagsViewRoutes);
const state = reactive({
global: {
homeChartOne: null,
homeChartTwo: null,
@ -134,8 +135,8 @@ const state = reactive({
},
homeOne: [
{
num1: '125,12',
num2: '-12.32',
num1: '',
num2: '',
num3: 'Number of Disaster Response Applications',
num4: 'fa fa-meetup',
color1: '#FF6462',
@ -143,8 +144,8 @@ const state = reactive({
color3: '--el-color-primary',
},
{
num1: '653,33',
num2: '+42.32',
num1: '',
num2: '',
num3: 'Actual times of disaster response',
num4: 'iconfont icon-ditu',
color1: '#6690F9',
@ -152,8 +153,8 @@ const state = reactive({
color3: '--el-color-success',
},
{
num1: '125,65',
num2: '+17.32',
num1: '',
num2: '',
num3: 'User Visits',
num4: 'iconfont icon-zaosheng',
color1: '#6690F9',
@ -161,8 +162,8 @@ const state = reactive({
color3: '--el-color-warning',
},
{
num1: '520,43',
num2: '-10.01',
num1: '',
num2: '',
num3: 'Data downloads',
num4: 'fa fa-github-alt',
color1: '#FF6462',
@ -235,7 +236,9 @@ const state = reactive({
});
// 线
const initLineChart = () => {
const initLineChart = (xData,data) => {
console.log(xData)
console.log(data)
if (!state.global.dispose.some((b) => b === state.global.homeChartOne)) state.global.homeChartOne.dispose();
state.global.homeChartOne = markRaw(echarts.init(homeLineRef.value, state.charts.theme));
const option = {
@ -247,25 +250,25 @@ const initLineChart = () => {
},
grid: { top: 70, right: 20, bottom: 30, left: 30 },
tooltip: { trigger: 'axis' },
legend: { data: ['预购队列', '最新成交价'], right: 0 },
legend: { data: ['响应量'], right: 0 },
xAxis: {
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
data: xData,
},
yAxis: [
{
type: 'value',
name: '价格',
name: '响应量',
splitLine: { show: true, lineStyle: { type: 'dashed', color: '#f5f5f5' } },
},
],
series: [
{
name: '预购队列',
name: '响应量',
type: 'line',
symbolSize: 6,
symbol: 'circle',
smooth: true,
data: [0, 41.1, 30.4, 65.1, 53.3, 53.3, 53.3, 41.1, 30.4, 65.1, 53.3, 10],
data: data,
lineStyle: { color: '#fe9a8b' },
itemStyle: { color: '#fe9a8b', borderColor: '#fe9a8b' },
areaStyle: {
@ -275,57 +278,21 @@ const initLineChart = () => {
]),
},
},
{
name: '最新成交价',
type: 'line',
symbolSize: 6,
symbol: 'circle',
smooth: true,
data: [0, 24.1, 7.2, 15.5, 42.4, 42.4, 42.4, 24.1, 7.2, 15.5, 42.4, 0],
lineStyle: { color: '#9E87FF' },
itemStyle: { color: '#9E87FF', borderColor: '#9E87FF' },
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: '#9E87FFb3' },
{ offset: 1, color: '#9E87FF03' },
]),
},
emphasis: {
itemStyle: {
color: {
type: 'radial',
x: 0.5,
y: 0.5,
r: 0.5,
colorStops: [
{ offset: 0, color: '#9E87FF' },
{ offset: 0.4, color: '#9E87FF' },
{ offset: 0.5, color: '#fff' },
{ offset: 0.7, color: '#fff' },
{ offset: 0.8, color: '#fff' },
{ offset: 1, color: '#fff' },
],
},
borderColor: '#9E87FF',
borderWidth: 2,
},
},
},
],
};
state.global.homeChartOne.setOption(option);
state.myCharts.push(state.global.homeChartOne);
};
//homePieRef
const initPieChart = () => {
const initPieChart = (data) => {
if (!state.global.dispose.some((b) => b === state.global.homeChartTwo)) state.global.homeChartTwo.dispose();
state.global.homeChartTwo = markRaw(echarts.init(homePieRef.value, state.charts.theme));
var getname = ['房屋及结构物', '专用设备', '通用设备', '文物和陈列品', '图书、档案'];
var getvalue = [34.2, 38.87, 17.88, 9.05, 2.05];
var data = [];
for (var i = 0; i < getname.length; i++) {
data.push({ name: getname[i], value: getvalue[i] });
}
// var getname = ['', '', '', '', ''];
// var getvalue = [34.2, 38.87, 17.88, 9.05, 2.05];
// var data = [];
// for (var i = 0; i < getname.length; i++) {
// data.push({ name: getname[i], value: getvalue[i] });
// }
const colorList = ['#51A3FC', '#36C78B', '#FEC279', '#968AF5', '#E790E8'];
const option = {
backgroundColor: state.charts.bgColor,
@ -387,11 +354,6 @@ const initPieChart = () => {
type: 'pie',
radius: ['82', themeConfig.value.isIsDark ? '50' : '102'],
center: ['50%', '50%'],
itemStyle: {
color: function (params) {
return colorList[params.dataIndex];
},
},
label: { show: true },
labelLine: { show: true },
data: data,
@ -402,15 +364,16 @@ const initPieChart = () => {
state.myCharts.push(state.global.homeChartTwo);
};
//homePieRef2
const initPieChart2 = () => {
const initPieChart2 = (data) => {
console.log("pie2",data)
if (!state.global.dispose.some((b) => b === state.global.homeChartFour)) state.global.homeChartFour.dispose();
state.global.homeChartFour = markRaw(echarts.init(homePieRef2.value, state.charts.theme));
var getname = ['房屋及结构物', '专用设备', '通用设备', '文物和陈列品', '图书、档案'];
var getvalue = [34.2, 38.87, 17.88, 9.05, 2.05];
var data = [];
for (var i = 0; i < getname.length; i++) {
data.push({ name: getname[i], value: getvalue[i] });
}
// var getname = ['', '', '', '', ''];
// var getvalue = [34.2, 38.87, 17.88, 9.05, 2.05];
// var data = [];
// for (var i = 0; i < getname.length; i++) {
// data.push({ name: getname[i], value: getvalue[i] });
// }
const colorList = ['#51A3FC', '#36C78B', '#FEC279', '#968AF5', '#E790E8'];
const option = {
backgroundColor: state.charts.bgColor,
@ -472,11 +435,6 @@ const initPieChart2 = () => {
type: 'pie',
radius: ['82', themeConfig.value.isIsDark ? '50' : '102'],
center: ['50%', '50%'],
itemStyle: {
color: function (params) {
return colorList[params.dataIndex];
},
},
label: { show: true },
labelLine: { show: true },
data: data,
@ -487,9 +445,9 @@ const initPieChart2 = () => {
state.myCharts.push(state.global.homeChartFour);
};
//
const initBarChart = () => {
const initBarChart = (xData,yData) => {
if (!state.global.dispose.some((b) => b === state.global.homeCharThree)) state.global.homeCharThree.dispose();
state.global.homeCharThree = markRaw(echarts.init(homeBarRef.value, state.charts.theme));
state.global.homeCharThree = echarts.init(homeBarRef.value, state.charts.theme);
const option = {
backgroundColor: state.charts.bgColor,
title: {
@ -497,29 +455,19 @@ const initBarChart = () => {
x: 'left',
textStyle: { fontSize: '15', color: state.charts.color },
},
tooltip: { trigger: 'axis' },
legend: { data: ['供温', '回温', '压力值(Mpa)'], right: 0 },
tooltip: { trigger: 'item', formatter: '{c}' },
legend: { data: ['申请量'], top: 0 },
grid: { top: 70, right: 80, bottom: 30, left: 80 },
xAxis: [
{
type: 'category',
data: ['1km', '2km', '3km', '4km', '5km', '6km'],
data: xData,
boundaryGap: true,
axisTick: { show: false },
},
],
yAxis: [
{
name: '供回温度(℃)',
nameLocation: 'middle',
nameTextStyle: { padding: [3, 4, 50, 6] },
splitLine: { show: true, lineStyle: { type: 'dashed', color: '#f5f5f5' } },
axisLine: { show: false },
axisTick: { show: false },
axisLabel: { color: state.charts.color, formatter: '{value} ' },
},
{
name: '压力值(Mpa)',
nameLocation: 'middle',
nameTextStyle: { padding: [50, 4, 5, 6] },
splitLine: { show: false },
@ -530,71 +478,10 @@ const initBarChart = () => {
],
series: [
{
name: '供温',
type: 'line',
smooth: true,
showSymbol: true,
//
symbol: 'path://M150 0 L80 175 L250 75 L50 75 L220 175 Z',
symbolSize: 12,
yAxisIndex: 0,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: 'rgba(250,180,101,0.3)' },
{ offset: 1, color: 'rgba(250,180,101,0)' },
]),
shadowColor: 'rgba(250,180,101,0.2)',
shadowBlur: 20,
},
itemStyle: { color: '#FF8000' },
// data使value
data: [
{ value: 1, stationName: 's1' },
{ value: 3, stationName: 's2' },
{ value: 4, stationName: 's3' },
{ value: 9, stationName: 's4' },
{ value: 3, stationName: 's5' },
{ value: 2, stationName: 's6' },
],
},
{
name: '回温',
type: 'line',
smooth: true,
showSymbol: true,
symbol: 'emptyCircle',
symbolSize: 12,
yAxisIndex: 0,
areaStyle: {
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{ offset: 0, color: 'rgba(199, 237, 250,0.5)' },
{ offset: 1, color: 'rgba(199, 237, 250,0.2)' },
],
false
),
},
itemStyle: {
color: '#3bbc86',
},
data: [
{ value: 31, stationName: 's1' },
{ value: 36, stationName: 's2' },
{ value: 54, stationName: 's3' },
{ value: 24, stationName: 's4' },
{ value: 73, stationName: 's5' },
{ value: 22, stationName: 's6' },
],
},
{
name: '压力值(Mpa)',
name: '申请量',
type: 'bar',
barWidth: 30,
yAxisIndex: 1,
yAxisIndex: 0,
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{ offset: 0, color: 'rgba(108,80,243,0.3)' },
@ -603,14 +490,7 @@ const initBarChart = () => {
//
borderRadius: [30, 30, 0, 0],
},
data: [
{ value: 11, stationName: 's1' },
{ value: 34, stationName: 's2' },
{ value: 54, stationName: 's3' },
{ value: 39, stationName: 's4' },
{ value: 63, stationName: 's5' },
{ value: 24, stationName: 's6' },
],
data: yData,
},
],
};
@ -627,6 +507,81 @@ const initEchartsResizeFun = () => {
}
});
};
/**
* 设置表头
* @param data
*/
const setHeadData = (data) => {
state.homeOne[0].num1 = data.applyCount
state.homeOne[1].num1 = data.actResponseNum
state.homeOne[2].num1 = data.visitCount
state.homeOne[3].num1 = data.downloadCount
}
/**
* 设置发生区域灾害占比
* @param data
*/
const setDisasterArea = (data) => {
let arr = [];
for(let [k , v] of Object.entries(data)){
arr.push({ name: k, value: v});
}
initPieChart(arr);
}
/**
* 设置灾害响应月份分布量
* @param data
*/
const setResponseDisaster = (data) => {
let xData = [];
let yData = [];
data.forEach(item=>{
for(let [k , v] of Object.entries(item)){
xData.push(k);
yData.push(v.value);
}
})
initLineChart(xData,yData);
}
/**
* 设置灾害申请月份分布量
* @param data
*/
const setApplyDisaster = (data) => {
let xData = [];
let yData = [];
data.forEach(item=>{
for(let [k , v] of Object.entries(item)){
xData.push(k);
yData.push(v.value);
}
})
setTimeout(() => {
initBarChart(xData,yData);
}, 1000);
}
/**
* 设置灾种数量占比
* @param data
*/
const setDisasterType = (data) => {
let arr = [];
for(let [k , v] of Object.entries(data)){
arr.push({ name: k, value: v});
}
initPieChart2(arr)
}
//
const getDashBoradData = () => {
statistics().then(res=>{
console.log(res);
setHeadData(res.header);
setDisasterArea(res.country);
setResponseDisaster(res.responseMonth);
setApplyDisaster(res.applyMonth);
setDisasterType(res.disasterNum);
})
}
// echarts resize
const initEchartsResize = () => {
window.addEventListener('resize', initEchartsResizeFun);
@ -634,6 +589,7 @@ const initEchartsResize = () => {
//
onMounted(() => {
initEchartsResize();
getDashBoradData();
});
// keep-alive
onActivated(() => {
@ -655,13 +611,13 @@ watch(
state.charts.bgColor = isIsDark ? 'transparent' : '';
state.charts.color = isIsDark ? '#dadada' : '#303133';
setTimeout(() => {
initLineChart();
//initLineChart();
}, 500);
setTimeout(() => {
initPieChart();
//initPieChart();
}, 700);
setTimeout(() => {
initPieChart2();
//initPieChart2();
}, 700);
setTimeout(() => {
initBarChart();

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">
@ -60,7 +61,8 @@
show-overflow-tooltip></el-table-column>
<el-table-column prop="title"
label="Professional title"
show-overflow-tooltip></el-table-column>
show-overflow-tooltip
width="150"></el-table-column>
<el-table-column prop="size"
label="Data size"
show-overflow-tooltip>
@ -75,7 +77,7 @@
label="Operate"
show-overflow-tooltip>
<template #default="scope">
<el-button size="small" text type="primary" @click="auditData(scope.row)">audit</el-button>
<el-button size="small" text type="primary" @click="auditData(scope.row)">Audit</el-button>
</template>
</el-table-column>
</el-table>
@ -93,6 +95,7 @@
</div>
</el-col>
</el-row>
</el-config-provider>
<RoleDialog ref="roleDialogRef"
@refresh="getTableData()" />
<Audit ref="auditRef" @callback="getTableData"/>
@ -100,6 +103,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 = () => {