角色新增类型,平台;告警新增字段
parent
21cece2fea
commit
80072c2184
|
@ -9,6 +9,11 @@ export const setRoleDelete = (params) =>
|
|||
export const setRoleAdd = (params) => postRequest("/sys/role/save", params); // 角色管理添加
|
||||
export const setRoleEdit = (params) => postRequest("/sys/role/update", params); // 角色管理修改
|
||||
export const getRoleView = (params) => postRequest("/sys/role/info", params); // 角色管理查看
|
||||
export const getBusServicePlatformListAllName = (params) =>
|
||||
postRequest("busServicePlatform/listAllName", params); // 服务平台管理-所有名称
|
||||
export const getBusCompanyInfoListAllName = (params) =>
|
||||
postRequest("busCompanyInfo/listAllName", params); // 对接企业管理-获取服务平台下的企业名称
|
||||
|
||||
export const getDataDictionaryList = (params) =>
|
||||
postRequest("/sys/dictionaries/listPage", params); // 数据字典列表
|
||||
export const setDataDictionaryDelete = (params) =>
|
||||
|
|
|
@ -37,6 +37,8 @@ const form = ref({
|
|||
handleRemark: "",
|
||||
handleResult: "",
|
||||
handleStatus: "",
|
||||
handleType: "",
|
||||
alarmPlatform: "",
|
||||
});
|
||||
const rules = {
|
||||
alarmReason: [
|
||||
|
@ -52,12 +54,28 @@ const rules = {
|
|||
handleStatus: [
|
||||
{ required: true, message: "处理状态不能为空", trigger: "change" },
|
||||
],
|
||||
handleType: [
|
||||
{ required: true, message: "处理类型不能为空", trigger: "change" },
|
||||
],
|
||||
alarmPlatform: [
|
||||
{ required: true, message: "告警平台不能为空", trigger: "change" },
|
||||
],
|
||||
};
|
||||
const handleStatusOptions = [
|
||||
// { name: "未处理", id: 1 },
|
||||
{ name: "处理成功", id: 2 },
|
||||
{ name: "不需要处理", id: 3 },
|
||||
];
|
||||
const handleTypeOptions = [
|
||||
{ name: "网络原因", id: 1 },
|
||||
{ name: "bug", id: 2 },
|
||||
{ name: "其他原因", id: 3 },
|
||||
];
|
||||
const alarmPlatformOptions = [
|
||||
{ name: "上级平台", id: 1 },
|
||||
{ name: "服务平台", id: 2 },
|
||||
{ name: "企业", id: 3 },
|
||||
];
|
||||
const options = [
|
||||
{ key: "handleBy", label: "处理人" },
|
||||
{ key: "handleRemark", label: "处理备注" },
|
||||
|
@ -68,6 +86,20 @@ const options = [
|
|||
type: "select",
|
||||
options: handleStatusOptions,
|
||||
},
|
||||
{
|
||||
key: "handleType",
|
||||
label: "处理类型",
|
||||
type: "select",
|
||||
valueKey: "name",
|
||||
options: handleTypeOptions,
|
||||
},
|
||||
{
|
||||
key: "alarmPlatform",
|
||||
label: "告警平台",
|
||||
type: "select",
|
||||
valueKey: "name",
|
||||
options: alarmPlatformOptions,
|
||||
},
|
||||
{ key: "alarmReason", label: "告警原因", type: "textarea", span: 24 },
|
||||
];
|
||||
const fnSubmit = debounce(
|
||||
|
|
|
@ -93,6 +93,14 @@ const options = [
|
|||
key: "handleStatus",
|
||||
label: "处理状态",
|
||||
},
|
||||
{
|
||||
key: "handleType",
|
||||
label: "处理类型",
|
||||
},
|
||||
{
|
||||
key: "alarmPlatform",
|
||||
label: "告警平台",
|
||||
},
|
||||
{ key: "alarmReason", label: "告警原因", span: 2 },
|
||||
{
|
||||
key: "receiveData",
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<el-form-item class="mt-30">
|
||||
<verification v-model:verification-pass="verificationPass" />
|
||||
</el-form-item>
|
||||
<el-form-item class="button">
|
||||
<el-form-item class="button mt-50">
|
||||
<el-button native-type="submit"><span>登录</span> </el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -156,7 +156,7 @@ const fnSubmitLogin = async () => {
|
|||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 480px;
|
||||
height: 580px;
|
||||
height: 540px;
|
||||
padding: 42px 35px 94px;
|
||||
background-color: #fff;
|
||||
z-index: 1;
|
||||
|
@ -201,7 +201,6 @@ const fnSubmitLogin = async () => {
|
|||
}
|
||||
|
||||
.button {
|
||||
margin-top: 88px;
|
||||
.el-button {
|
||||
background: #0a7dfe;
|
||||
height: 45px;
|
||||
|
|
|
@ -16,6 +16,45 @@
|
|||
placeholder="请输入备注"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择类型">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-show="form.type === 2 || form.type === 3"
|
||||
label="服务平台"
|
||||
prop="servicePlatformId"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.servicePlatformId"
|
||||
placeholder="请选择服务平台"
|
||||
multiple
|
||||
@change="fnGetCompanyOptions"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in servicePlatformOptions"
|
||||
:key="item.id"
|
||||
:label="item.serviceName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="form.type === 3" label="企业" prop="companyId">
|
||||
<el-select v-model="form.companyId" multiple placeholder="请选择类型">
|
||||
<el-option
|
||||
v-for="item in companyOptions"
|
||||
:key="item.id"
|
||||
:label="`${item.companyName}(${item.servicePlatformName})`"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.parentId !== '0'" label="菜单" prop="menuIdList">
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
|
@ -40,11 +79,13 @@
|
|||
import { debounce } from "throttle-debounce";
|
||||
import useForm from "@/hooks/useForm.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { nextTick, ref, watchEffect } from "vue";
|
||||
import { nextTick, ref, watchEffect, watch } from "vue";
|
||||
import {
|
||||
getRouteList,
|
||||
setRoleAdd,
|
||||
setRoleEdit,
|
||||
getBusServicePlatformListAllName,
|
||||
getBusCompanyInfoListAllName,
|
||||
} from "@/request/system_management.js";
|
||||
|
||||
const props = defineProps({
|
||||
|
@ -64,6 +105,35 @@ const rules = {
|
|||
{ required: true, message: "名称不能为空", trigger: "blur" },
|
||||
{ min: 2, max: 30, message: "长度在2到30个字符", trigger: "blur" },
|
||||
],
|
||||
type: [{ required: true, message: "类型不能为空", trigger: "change" }],
|
||||
};
|
||||
const options = [
|
||||
{ label: "系统角色", value: 1 },
|
||||
{ label: "服务平台角色", value: 2 },
|
||||
{ label: "企业角色", value: 3 },
|
||||
];
|
||||
const servicePlatformOptions = ref([]);
|
||||
const companyOptions = ref([]);
|
||||
watch(
|
||||
() => form.value.type,
|
||||
async (val) => {
|
||||
if (val !== 1) await fnGetServicePlatformOptions();
|
||||
if (val === 3) await fnGetCompanyOptions();
|
||||
}
|
||||
);
|
||||
const fnGetServicePlatformOptions = async () => {
|
||||
if (servicePlatformOptions.value.length === 0) {
|
||||
const { data } = await getBusServicePlatformListAllName();
|
||||
servicePlatformOptions.value = data;
|
||||
}
|
||||
};
|
||||
const fnGetCompanyOptions = async () => {
|
||||
if (form.value.type !== 3 || form.value.servicePlatformId.length === 0)
|
||||
return;
|
||||
const { data } = await getBusCompanyInfoListAllName({
|
||||
servicePlatformIds: form.value.servicePlatformId.join(","),
|
||||
});
|
||||
companyOptions.value = data;
|
||||
};
|
||||
const fnGetData = async () => {
|
||||
const resData = await getRouteList({ parentId: 0 });
|
||||
|
@ -121,11 +191,15 @@ const fnSubmit = debounce(
|
|||
await validate();
|
||||
const checkedKeys = treeRef.value?.getCheckedKeys() || [];
|
||||
const halfCheckedKeys = treeRef.value?.getHalfCheckedKeys() || [];
|
||||
const servicePlatformId = form.value.servicePlatformId.join(",");
|
||||
const companyId = form.value.companyId.join(",");
|
||||
if (props.type === "add") {
|
||||
await setRoleAdd({
|
||||
...form.value,
|
||||
menuIdList: [...checkedKeys, ...halfCheckedKeys],
|
||||
roleId: undefined,
|
||||
servicePlatformId,
|
||||
companyId,
|
||||
});
|
||||
}
|
||||
if (props.type === "edit")
|
||||
|
|
|
@ -83,6 +83,9 @@ const addOrEditDialog = ref({
|
|||
remark: "",
|
||||
corpRoleType: "",
|
||||
menuIdList: [],
|
||||
type: "",
|
||||
companyId: [],
|
||||
servicePlatformId: [],
|
||||
},
|
||||
});
|
||||
const fnDelete = debounce(
|
||||
|
@ -120,8 +123,14 @@ const fnAddOrEdit = async (roleId, type) => {
|
|||
addOrEditDialog.value.type = type;
|
||||
await nextTick();
|
||||
if (type === "edit") {
|
||||
const resData = await getRoleView({ roleId });
|
||||
addOrEditDialog.value.form = resData.role;
|
||||
const { role } = await getRoleView({ roleId });
|
||||
addOrEditDialog.value.form = role;
|
||||
addOrEditDialog.value.form.companyId = role.companyId
|
||||
.split(",")
|
||||
.map(Number);
|
||||
addOrEditDialog.value.form.servicePlatformId = role.servicePlatformId
|
||||
.split(",")
|
||||
.map(Number);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue