glj-代码提交

This commit is contained in:
管李杰 2024-07-16 14:13:52 +08:00
parent 726981521c
commit a145a2a489
1 changed files with 38 additions and 14 deletions

View File

@ -42,6 +42,12 @@
<el-table-column type="selection" width="60" @select="selectRow" />
<el-table-column prop="name" label="Name" show-overflow-tooltip></el-table-column>
<el-table-column prop="email" label="E-mail" show-overflow-tooltip></el-table-column>
<el-table-column prop="userStatus" label="role" show-overflow-tooltip>
<template #default="scope">
<el-tag type="info" v-if="scope.row.roleId == '1793193529859244033'">B1</el-tag>
<el-tag type="info" v-if="scope.row.roleId == '1123598816738675203'">B2</el-tag>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="onHandleSizeChange"
@ -69,7 +75,7 @@
<script setup>
import { ElMessage } from 'element-plus';
import { detailByDisasterInfoId, getUserList, submitNew } from '/@/api/disasterInfo/index';
import { detailByDisasterInfoId, getUserList, submitNew, submit } from '/@/api/disasterInfo/index';
import { getAdminPage } from '/@/api/response/administrator.js';
import { ref, reactive, onMounted } from 'vue';
import { useThemeConfig } from '/@/stores/themeConfig';
@ -109,7 +115,7 @@ const state = reactive({
selectData: [],
});
const selectRow = (row) => {
state.data = row;
state.selectData = row;
};
//
const openDialog = (row) => {
@ -117,6 +123,7 @@ const openDialog = (row) => {
state.rowData = row;
state.isShowDialog = true;
getTableDataNew();
state.selectData = [];
};
const save = async () => {
//1
@ -129,16 +136,27 @@ const save = async () => {
ElMessage.error('Please select only one user');
return;
}
let params = {
id: state.rowData.disasterId,
adminId: state.selectData[0].userId,
adminName: state.selectData[0].userName,
allocation: 'YES',
};
console.log(params,"paramsparamsparamsparams");
let res = await submitNew(params).then((da) => {
ElMessage.success('success');
});
if (state.selectData[0].roleId == '1793193529859244033') {
let params = {
id: state.rowData.disasterId,
chiefId: state.selectData[0].userId,
chiefName: state.selectData[0].userName,
allocation: 'YES',
};
let res = await submit(params).then((da) => {
ElMessage.success('success');
});
} else {
let params = {
id: state.rowData.disasterId,
adminId: state.selectData[0].userId,
adminName: state.selectData[0].userName,
allocation: 'YES',
};
let res = await submitNew(params).then((da) => {
ElMessage.success('success');
});
}
emit('callback');
closeDialog();
};
@ -151,10 +169,16 @@ const getTableData = async () => {
let res = await getAdminPage(
state.tableData.param.pageNum,
state.tableData.param.pageSize,
{ name_like: state.tableData.query.name, roleId: '1123598816738675203' },
{ name_like: state.tableData.query.name },
website.value.tenantId
);
state.tableData.data = res.records;
let userData = [];
res.records.forEach((item) => {
if (item.roleId == '1123598816738675203' || item.roleId == '1793193529859244033') {
userData.push(item);
}
});
state.tableData.data = userData;
state.tableData.data.forEach((item) => {
item.userId = item.id;
item.userName = item.name;