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