fix: BUG修改
This commit is contained in:
parent
3483afd1a2
commit
df28a6407a
@ -27,7 +27,6 @@
|
|||||||
:style="{ display: item.hidden == true ? 'none' : '' }"
|
:style="{ display: item.hidden == true ? 'none' : '' }"
|
||||||
style="width: 90%; display: flex; align-items: center"
|
style="width: 90%; display: flex; align-items: center"
|
||||||
:prop="item.prop"
|
:prop="item.prop"
|
||||||
v-if="!item.hidden"
|
|
||||||
>
|
>
|
||||||
<!-- 输入框 -->
|
<!-- 输入框 -->
|
||||||
<el-input
|
<el-input
|
||||||
@ -101,9 +100,7 @@
|
|||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
:style="{ width: item.width + 'px' }"
|
:style="{ width: item.width + 'px' }"
|
||||||
>
|
>
|
||||||
<el-radio :label="option.value" size="large" v-for="option in item.data" @change="emitData">{{
|
<el-radio :label="option.value" size="large" v-for="option in item.data">{{ option.label }}</el-radio>
|
||||||
option.label
|
|
||||||
}}</el-radio>
|
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<!-- 数字输入框 -->
|
<!-- 数字输入框 -->
|
||||||
<el-input-number
|
<el-input-number
|
||||||
@ -274,7 +271,7 @@ const props = defineProps({
|
|||||||
});
|
});
|
||||||
console.log("props", props);
|
console.log("props", props);
|
||||||
// 生成事件对象,数组中就是对象名
|
// 生成事件对象,数组中就是对象名
|
||||||
const emit = defineEmits(["update:visible", "confirm", "changeForm"]);
|
const emit = defineEmits(["update:visible", "confirm"]);
|
||||||
|
|
||||||
// 监听父组件的visible,用来简介控制el-dialog的弹框开关,一般是用于开
|
// 监听父组件的visible,用来简介控制el-dialog的弹框开关,一般是用于开
|
||||||
watch(
|
watch(
|
||||||
@ -297,10 +294,6 @@ watch(
|
|||||||
form = reactive(n);
|
form = reactive(n);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// 单选按钮组切换
|
|
||||||
const emitData = () => {
|
|
||||||
emit("changeForm", form);
|
|
||||||
};
|
|
||||||
// 确定按钮触发
|
// 确定按钮触发
|
||||||
const confirm = async (formEl: FormInstance | undefined) => {
|
const confirm = async (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return;
|
if (!formEl) return;
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 18px;
|
padding: 18px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
|
margin-top: 10px;
|
||||||
.title {
|
.title {
|
||||||
margin: 0 0 15px;
|
margin: 0 0 15px;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="card filter">
|
<div class="card filter">
|
||||||
<h4 class="title sle" v-if="title">{{ title }}</h4>
|
<h4 class="title sle" v-if="title">{{ title }}</h4>
|
||||||
<div style="display: flex; box-sizing: border-box">
|
<!-- <div style="display: flex; box-sizing: border-box">
|
||||||
<el-input style="margin-right: 20px" v-model="filterText" placeholder="请输入" clearable>
|
<el-input style="margin-right: 20px" v-model="filterText" placeholder="请输入" clearable>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon class="el-input__icon"><search /></el-icon>
|
<el-icon class="el-input__icon"><search /></el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<slot name="addButton"></slot>
|
<slot name="addButton"></slot>
|
||||||
</div>
|
</div> -->
|
||||||
<el-scrollbar :style="{ height: title ? `calc(100% - 95px)` : `calc(100% - 56px)` }">
|
<el-scrollbar :style="{ height: title ? `calc(100% - 95px)` : `calc(100% - 56px)` }">
|
||||||
<el-tree
|
<el-tree
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
|
|||||||
@ -18,6 +18,7 @@ export const GlobalStore = defineStore({
|
|||||||
moduleId: "", //模块id
|
moduleId: "", //模块id
|
||||||
menuName: "", // 菜单id
|
menuName: "", // 菜单id
|
||||||
accountType: undefined, //登录账号类型
|
accountType: undefined, //登录账号类型
|
||||||
|
enterpriseType: [], //企业类型
|
||||||
moduleName: "", //登录账号类型
|
moduleName: "", //登录账号类型
|
||||||
// 都是控制退出或者修改密码的时候遮挡视频的问题
|
// 都是控制退出或者修改密码的时候遮挡视频的问题
|
||||||
editPassword: false,
|
editPassword: false,
|
||||||
@ -72,6 +73,9 @@ export const GlobalStore = defineStore({
|
|||||||
setAccountType(accountType: number | undefined) {
|
setAccountType(accountType: number | undefined) {
|
||||||
this.accountType = accountType;
|
this.accountType = accountType;
|
||||||
},
|
},
|
||||||
|
setEnterpriseType(enterpriseType: number[]) {
|
||||||
|
this.enterpriseType = enterpriseType;
|
||||||
|
},
|
||||||
setAccount(account: string | null) {
|
setAccount(account: string | null) {
|
||||||
this.account = account;
|
this.account = account;
|
||||||
},
|
},
|
||||||
@ -116,6 +120,7 @@ export const GlobalStore = defineStore({
|
|||||||
this.token = null;
|
this.token = null;
|
||||||
this.moduleId = null;
|
this.moduleId = null;
|
||||||
this.accountType = undefined;
|
this.accountType = undefined;
|
||||||
|
this.enterpriseType = [];
|
||||||
this.account = null;
|
this.account = null;
|
||||||
this.userInfo = null;
|
this.userInfo = null;
|
||||||
this.projectDateAuth = null;
|
this.projectDateAuth = null;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ export interface GlobalState {
|
|||||||
token: string | null;
|
token: string | null;
|
||||||
userInfo: any | null;
|
userInfo: any | null;
|
||||||
accountType: number | undefined;
|
accountType: number | undefined;
|
||||||
|
enterpriseType: number[];
|
||||||
moduleId: string | null;
|
moduleId: string | null;
|
||||||
menuName: string | null;
|
menuName: string | null;
|
||||||
account: string | null;
|
account: string | null;
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
.el-main {
|
.el-main {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.el-tabs__header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.video-box {
|
.video-box {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|||||||
@ -52,18 +52,44 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
<!-- 新增角色 -->
|
||||||
<DialogForm
|
<el-dialog class="imgDialog" :title="title" width="700px" v-model="visible" show-close>
|
||||||
:title="title"
|
<el-form class="diaForm" :rules="rules" :model="formData" ref="ruleFormRef" label-width="160px">
|
||||||
:formConfig="formConfig"
|
<el-form-item label="角色名称:" prop="roleName">
|
||||||
:formData="formData"
|
<el-input v-model="formData.roleName" placeholder="请输入" />
|
||||||
v-model:visible="visible"
|
</el-form-item>
|
||||||
append-to-body
|
<el-form-item label="角色顺序:" prop="priority">
|
||||||
width="700px"
|
<el-input-number v-model="formData.priority" placeholder="请输入" />
|
||||||
@confirm="saveItem"
|
</el-form-item>
|
||||||
@changeForm="changeForm"
|
<el-form-item label="状态:" prop="state">
|
||||||
>
|
<el-radio-group v-model="formData.state">
|
||||||
</DialogForm>
|
<el-radio :label="1">启用</el-radio>
|
||||||
|
<el-radio :label="0">禁用</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色类型:" prop="roleType" v-if="store.accountType == 2">
|
||||||
|
<el-radio-group v-model="formData.roleType" @change="getSelectData">
|
||||||
|
<el-radio :label="2">政务</el-radio>
|
||||||
|
<el-radio :label="3">企业</el-radio>
|
||||||
|
<el-radio :label="4">项目</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="指定类型:" prop="sn" v-if="formData.roleType != 2">
|
||||||
|
<el-select v-model="formData.sn" clearable placeholder="请选择" style="width: 100%">
|
||||||
|
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注:" prop="roleDesc">
|
||||||
|
<el-input v-model="formData.roleDesc" placeholder="请输入" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div>
|
||||||
|
<el-button class="hzCancelStyle" @click="visible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="saveItem(ruleFormRef, formData)"> 保存 </el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -88,11 +114,29 @@ import {
|
|||||||
} from "@/api/modules/goverment";
|
} from "@/api/modules/goverment";
|
||||||
import DialogForm from "@/components/DialogForm/index.vue";
|
import DialogForm from "@/components/DialogForm/index.vue";
|
||||||
import { getentNamelist, getproNamelist } from "@/api/modules/goverment";
|
import { getentNamelist, getproNamelist } from "@/api/modules/goverment";
|
||||||
|
import type { FormRules, FormInstance } from "element-plus";
|
||||||
// import { getProjectRecordPage } from "@/api/modules/project";
|
// import { getProjectRecordPage } from "@/api/modules/project";
|
||||||
|
|
||||||
import { Delete } from "@element-plus/icons-vue";
|
import { Delete } from "@element-plus/icons-vue";
|
||||||
import { GlobalStore } from "@/stores";
|
import { GlobalStore } from "@/stores";
|
||||||
|
const ruleFormRef = ref();
|
||||||
|
const typeList = ref([]);
|
||||||
|
const rules = reactive<FormRules>({
|
||||||
|
roleName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入角色名称",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
priority: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入角色顺序",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
const treeRef = ref(null);
|
const treeRef = ref(null);
|
||||||
|
|
||||||
const datas = reactive([]);
|
const datas = reactive([]);
|
||||||
@ -109,7 +153,7 @@ const title = ref("");
|
|||||||
const formData = ref({
|
const formData = ref({
|
||||||
roleName: "",
|
roleName: "",
|
||||||
priority: 1,
|
priority: 1,
|
||||||
state: 0,
|
state: 1,
|
||||||
roleType: 2,
|
roleType: 2,
|
||||||
sn: "",
|
sn: "",
|
||||||
roleDesc: ""
|
roleDesc: ""
|
||||||
@ -237,24 +281,23 @@ const dataCallback = (data: any) => {
|
|||||||
|
|
||||||
// 获取下拉数据
|
// 获取下拉数据
|
||||||
const getSelectData = async () => {
|
const getSelectData = async () => {
|
||||||
|
typeList.value.length = 0;
|
||||||
if (formData.value.roleType == 3) {
|
if (formData.value.roleType == 3) {
|
||||||
const res = await getentNamelist({});
|
const res = await getentNamelist({});
|
||||||
formConfig.formItemConfig[4].data = res.result.map(item => {
|
typeList.value = res.result.map(item => {
|
||||||
return {
|
return {
|
||||||
label: item.enterpriseName,
|
label: item.enterpriseName,
|
||||||
value: item.enterpriseSn
|
value: item.enterpriseSn
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log(formConfig.formItemConfig[4].data, "111111");
|
|
||||||
} else if (formData.value.roleType == 4) {
|
} else if (formData.value.roleType == 4) {
|
||||||
const res = await getproNamelist({});
|
const res = await getproNamelist({});
|
||||||
formConfig.formItemConfig[4].data = res.result.map(item => {
|
typeList.value = res.result.map(item => {
|
||||||
return {
|
return {
|
||||||
label: item.projectName,
|
label: item.projectName,
|
||||||
value: item.projectSn
|
value: item.projectSn
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log(formConfig.formItemConfig[4].data, "22222");
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const closeDrawer = done => {
|
const closeDrawer = done => {
|
||||||
@ -309,7 +352,7 @@ const handleAddItem = (index: number, row: any) => {
|
|||||||
formData.value = reactive({
|
formData.value = reactive({
|
||||||
roleName: "",
|
roleName: "",
|
||||||
priority: 1,
|
priority: 1,
|
||||||
state: 0,
|
state: 1,
|
||||||
roleType: 2,
|
roleType: 2,
|
||||||
sn: "",
|
sn: "",
|
||||||
roleDesc: ""
|
roleDesc: ""
|
||||||
@ -317,6 +360,7 @@ const handleAddItem = (index: number, row: any) => {
|
|||||||
} else {
|
} else {
|
||||||
title.value = "编辑角色";
|
title.value = "编辑角色";
|
||||||
formData.value = reactive({ ...row });
|
formData.value = reactive({ ...row });
|
||||||
|
getSelectData();
|
||||||
}
|
}
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
};
|
};
|
||||||
@ -336,29 +380,31 @@ const handleEditItem = async (row: any) => {
|
|||||||
treeRef.value.setCheckedKeys(res.result.map(item => item.authorityId));
|
treeRef.value.setCheckedKeys(res.result.map(item => item.authorityId));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 更新表单数据
|
const saveItem = async (formEl: FormInstance | undefined, form: any) => {
|
||||||
const changeForm = (form: any) => {
|
// 标记表单校验
|
||||||
console.log(form);
|
if (!formEl) return;
|
||||||
formData.value = { ...form };
|
await formEl.validate(async (valid, fields) => {
|
||||||
if (form.roleType == 2) {
|
if (valid) {
|
||||||
formConfig.formItemConfig[4].hidden = true;
|
if (form.roleId) {
|
||||||
} else {
|
// console.log(form.dictCode);
|
||||||
formConfig.formItemConfig[4].hidden = false;
|
const res = await editRole(form);
|
||||||
}
|
proTable.value.getTableList();
|
||||||
getSelectData();
|
ElMessage.success("编辑成功");
|
||||||
};
|
} else {
|
||||||
const saveItem = async (form: any) => {
|
const res = await addRole(form);
|
||||||
if (form.roleId) {
|
ElMessage.success("新增成功");
|
||||||
// console.log(form.dictCode);
|
proTable.value.getTableList();
|
||||||
const res = await editRole(form);
|
}
|
||||||
proTable.value.getTableList();
|
visible.value = false;
|
||||||
ElMessage.success("编辑成功");
|
} else {
|
||||||
} else {
|
console.log("error submit!", fields);
|
||||||
const res = await addRole(form);
|
ElMessage({
|
||||||
ElMessage.success("新增成功");
|
showClose: true,
|
||||||
proTable.value.getTableList();
|
message: "请完善表单信息!",
|
||||||
}
|
type: "error"
|
||||||
visible.value = false;
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 删除用户信息
|
// 删除用户信息
|
||||||
@ -406,5 +452,13 @@ const changeTreeFilter = () => {
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: var(--el-menu-text-color);
|
color: var(--el-menu-text-color);
|
||||||
}
|
}
|
||||||
|
.el-input-number__decrease {
|
||||||
|
border-right-color: var(--el-color-primary);
|
||||||
|
color: var(--el-menu-text-color);
|
||||||
|
}
|
||||||
|
.el-input-number__increase {
|
||||||
|
border-left-color: var(--el-color-primary);
|
||||||
|
color: var(--el-menu-text-color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -79,6 +79,7 @@ const login = (formEl: FormInstance | undefined) => {
|
|||||||
globalStore.setToken(result.token);
|
globalStore.setToken(result.token);
|
||||||
globalStore.setAccount(result.account);
|
globalStore.setAccount(result.account);
|
||||||
globalStore.setAccountType(result.accountType);
|
globalStore.setAccountType(result.accountType);
|
||||||
|
globalStore.setEnterpriseType(result.enterpriseType);
|
||||||
globalStore.setProjectDateAuth(result.projectDateAuth);
|
globalStore.setProjectDateAuth(result.projectDateAuth);
|
||||||
globalStore.setIsManager(result.isManager); //我已知晓
|
globalStore.setIsManager(result.isManager); //我已知晓
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user