v3.8.1发布,上传前端代码

This commit is contained in:
JEECG
2025-06-25 16:04:02 +08:00
parent 3d414aaec8
commit 0148f45979
120 changed files with 4783 additions and 486 deletions

View File

@ -1,11 +1,12 @@
<template>
<a-card :bordered="false" style="height: 100%">
<a-card :bordered="false" style="height: 100%;" :body-style="{ background: backgroundColor }" >
<a-spin :spinning="loading">
<a-input-search placeholder="按部门名称搜索…" style="margin-bottom: 10px" @search="onSearch" allowClear />
<a-input-search v-if="showSearch" placeholder="按部门名称搜索…" style="margin-bottom: 10px" @search="onSearch" allowClear />
<!--组织机构树-->
<template v-if="treeData.length > 0">
<a-tree
v-if="!treeReloading"
:style="{ background: backgroundColor }"
showLine
:clickRowToExpand="false"
:treeData="treeData"
@ -27,6 +28,19 @@
import { Popconfirm } from 'ant-design-vue';
const prefixCls = inject('prefixCls');
// 定义props
const props = defineProps({
// 是否显示搜索框
showSearch: {
type: Boolean,
default: true,
},
// 背景色
backgroundColor: {
type: String,
default: 'inherit',
},
});
const emit = defineEmits(['select', 'rootTreeData']);
const loading = ref<boolean>(false);

View File

@ -74,6 +74,12 @@ export function useBasicFormSchema() {
placeholder: '请输入备注',
},
},
{
field: 'id',
label: 'ID',
component: 'Input',
show: false,
},
];
return { basicFormSchema };
}

View File

@ -1,63 +1,84 @@
<template>
<div class="bg-white m-4 mr-0 overflow-hidden">
<div v-if="userIdentity === '2'" class="j-table-operator" style="width: 100%">
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="onAddChildDepart">添加下级</a-button>
<!-- <a-button type="primary" preIcon="ant-design:edit-outlined" @click="editDepart">编辑</a-button>-->
<a-button :disabled="!(checkedKeys && checkedKeys.length > 0)" preIcon="ant-design:delete-outlined" @click="onDeleteBatch">删除</a-button>
</div>
<a-spin :spinning="loading">
<template v-if="userIdentity === '2'">
<a-input-search placeholder="按部门名称搜索…" style="margin-bottom: 10px" @search="onSearch" />
<!--组织机构树-->
<BasicTree
v-if="!treeReloading"
title="部门列表"
toolbar
search
showLine
:checkStrictly="true"
:toolbar="false"
:search="false"
:showLine="false"
:clickRowToExpand="false"
:multiple="false"
:checkStrictly="true"
:treeData="treeData"
:checkedKeys="checkedKeys"
:selectedKeys="selectedKeys"
:expandedKeys="expandedKeys"
:autoExpandParent="autoExpandParent"
:beforeRightClick="getRightMenuList"
@select="onSelect"
@expand="onExpand"
@search="onSearch"
@check="onCheck"
/>
</template>
<a-empty v-else description="普通员工无此权限" />
</a-spin>
<DepartFormModal :rootTreeData="treeData" @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { inject, nextTick, ref } from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { BasicTree } from '/@/components/Tree';
import { BasicTree, ContextMenuItem } from '/@/components/Tree';
import { queryMyDepartTreeList, searchByKeywords } from '../depart.user.api';
import DepartFormModal from '@/views/system/depart/components/DepartFormModal.vue';
import { useModal } from '@/components/Modal';
import { deleteBatchDepart } from '@/views/system/depart/depart.api';
const prefixCls = inject('prefixCls');
const emit = defineEmits(['select']);
const { createMessage } = useMessage();
let loading = ref<boolean>(false);
// 负责部门ID
let myDepIds = ref<any[]>([]);
// 部门树列表数据
let treeData = ref<any[]>([]);
// 当前展开的项
let expandedKeys = ref<any[]>([]);
// 当前选中的项
let selectedKeys = ref<any[]>([]);
// 当前选中的项
let selectedNode = ref<any>({});
// 当前选中的项
let checkedKeys = ref<any[]>([]);
// 是否自动展开父级
let autoExpandParent = ref<boolean>(true);
// 用户身份
// 用户身份(1:普通员工 2:上级)
let userIdentity = ref<string>('2');
// 树组件重新加载
let treeReloading = ref<boolean>(false);
// 注册 modal
const [registerModal, { openModal }] = useModal();
// 加载部门信息
function loadDepartTreeData() {
loading.value = true;
treeReloading.value = true;
treeData.value = [];
queryMyDepartTreeList()
.then((res) => {
if (res.success) {
if (Array.isArray(res.result)) {
treeData.value = res.result;
myDepIds.value = res.result.map((item) => item.id);
userIdentity.value = res.message;
autoExpandParentNode();
}
@ -65,7 +86,11 @@
createMessage.warning(res.message);
}
})
.finally(() => (loading.value = false));
.finally(async () => {
await nextTick();
loading.value = false;
treeReloading.value = false;
});
}
loadDepartTreeData();
@ -88,6 +113,47 @@
}
}
// 添加子级部门
function onAddChildDepart() {
if (selectedKeys.value && selectedKeys.value.length === 0) {
createMessage.warning('请先选择一个部门');
return;
}
const record = { parentId: selectedKeys.value[0] };
openModal(true, { isUpdate: false, isChild: true, record });
}
// 编辑部门
function editDepart() {
if (selectedKeys.value && selectedKeys.value.length === 0) {
createMessage.warning('请先选择一个部门');
return;
}
if (myDepIds.value.includes(selectedKeys.value[0])) {
createMessage.warning('不能编辑负责部门');
return;
}
console.log('selectedNode', selectedNode.value);
openModal(true, { isUpdate: false, isChild: true, record: { ...selectedNode.value } });
}
// 删除部门
async function onDeleteBatch() {
const idList = checkedKeys.value;
if (myDepIds.value.includes(idList[0])) {
createMessage.warning('不能删除负责部门');
return;
}
if (idList.length > 0) {
try {
loading.value = true;
await deleteBatchDepart({ ids: idList.join(',') }, true);
await loadDepartTreeData();
} finally {
loading.value = false;
}
}
}
// 重新加载树组件,防止无法默认展开数据
async function reloadTree() {
await nextTick();
@ -101,7 +167,9 @@
*/
function setSelectedKey(key: string, data?: object) {
selectedKeys.value = [key];
checkedKeys.value = [key];
if (data) {
selectedNode.value = { ...data };
emit('select', data);
}
}
@ -133,6 +201,16 @@
// 这样可以防止用户取消选择
setSelectedKey(selectedKeys.value[0]);
}
checkedKeys.value = [selectedKeys.value[0]];
}
// 树选中事件
function onCheck(keys) {
if (keys.checked && keys.checked.length > 0) {
checkedKeys.value = [...keys.checked];
} else {
checkedKeys.value = [];
}
}
// 树展开事件
@ -140,6 +218,38 @@
expandedKeys.value = keys;
autoExpandParent.value = false;
}
//成功回调
async function handleSuccess() {
await loadDepartTreeData();
}
/**
*
* @param node
*/
function getRightMenuList(node: any): ContextMenuItem[] {
return [
{
label: '添加下级',
disabled: myDepIds.value.includes(node.key),
handler: () => {
setSelectedKey(node.key);
onAddChildDepart();
},
icon: 'ant-design:plus-outlined',
},
{
label: '编辑',
disabled: myDepIds.value.includes(node.key),
handler: () => {
setSelectedKey(node.key);
const record = { ...node.dataRef };
openModal(true, { isUpdate: true, record, isChild: true });
},
icon: 'ant-design:edit-outlined',
},
];
}
</script>
<style lang="less" scoped>
/*升级antd3后查询框与树贴的太近样式优化*/

View File

@ -255,6 +255,9 @@ export const formSchema: FormSchema[] = [
label: '菜单图标',
component: 'IconPicker',
ifShow: ({ values }) => !isButton(values.menuType),
componentProps: {
allowClear: true
},
},
{
field: 'sortNo',

View File

@ -2,7 +2,8 @@
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button preIcon="ant-design:user-add-outlined" type="primary" @click="handleAdd">新增</a-button>
<a-button preIcon="ant-design:user-add-outlined" type="primary" @click="handleAdd">+ 默认套餐
</a-button>
<a-button
v-if="selectedRowKeys.length > 0"
preIcon="ant-design:delete-outlined"
@ -25,7 +26,7 @@
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { deleteTenantPack, packList } from '../tenant.api';
import { packColumns, packFormSchema } from '../tenant.data';
import { defalutPackColumns, defaultPackFormSchema } from "../tenant.data";
import TenantPackMenuModal from './TenantPackMenuModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useListPage } from '/@/hooks/system/useListPage';
@ -42,9 +43,9 @@
designScope: 'tenant-template',
tableProps: {
api: packList,
columns: packColumns,
columns: defalutPackColumns,
formConfig: {
schemas: packFormSchema,
schemas: defaultPackFormSchema,
},
beforeFetch: (params) => {
return Object.assign(params, { packType: 'default' });

View File

@ -43,7 +43,7 @@
//update-end---author:wangshuai ---date:20230705 for【QQYUN-5685】2 套餐包增加一个查看:添加底部有没有按钮及表单禁用------------
});
//设置标题
const title = computed(() => (unref(isUpdate) ? '编辑租户套餐' : '新增租户套餐'));
const title = computed(() => (unref(isUpdate) ? '编辑 租户套餐' : '新增 租户套餐'));
//表单提交事件
async function handleSubmit(v) {
const values = await validate();

View File

@ -271,7 +271,33 @@ export const packColumns: BasicColumn[] = [
},
},
{
title: '备注',
title: '备注说明',
dataIndex: 'remarks',
width: 150,
},
];
//套餐包列表
export const defalutPackColumns: BasicColumn[] = [
{
title: '默认套餐名称',
dataIndex: 'packName',
width: 100,
},
{
title: '状态',
dataIndex: 'status',
width: 100,
customRender: ({ text }) => {
if (text === '1') {
return '开启';
} else {
return '关闭';
}
},
},
{
title: '备注说明',
dataIndex: 'remarks',
width: 150,
},
@ -281,7 +307,17 @@ export const packColumns: BasicColumn[] = [
export const packFormSchema: FormSchema[] = [
{
field: 'packName',
label: '套餐包名',
label: '套餐包名',
component: 'JInput',
colProps: { xxl: 8 },
},
];
//套餐包搜索表单
export const defaultPackFormSchema: FormSchema[] = [
{
field: 'packName',
label: '默认套餐名',
component: 'JInput',
colProps: { xxl: 8 },
},
@ -296,7 +332,7 @@ export const packMenuFormSchema: FormSchema[] = [
},
{
field: 'permissionIds',
label: '菜单列表',
label: '授权菜单',
component: 'JTreeSelect',
componentProps: {
dict: 'sys_permission,name,id',
@ -309,7 +345,7 @@ export const packMenuFormSchema: FormSchema[] = [
},
{
field: 'remarks',
label: '描述',
label: '备注说明',
component: 'InputTextArea',
},
{

View File

@ -44,12 +44,12 @@
if (unref(isUpdate)) {
rowId.value = data.record.id;
//租户信息定义成数组
if (data.record.relTenantIds && !Array.isArray(data.record.relTenantIds)) {
/* if (data.record.relTenantIds && !Array.isArray(data.record.relTenantIds)) {
data.record.relTenantIds = data.record.relTenantIds.split(',');
} else {
//【issues/I56C5I】用户管理中连续点两次编辑租户配置就丢失了
//data.record.relTenantIds = [];
}
}*/
//查角色/赋值/try catch 处理,不然编辑有问题
try {

View File

@ -236,10 +236,11 @@ export const formSchema: FormSchema[] = [
{
label: '租户',
field: 'relTenantIds',
component: 'JDictSelectTag',
component: 'JSearchSelect',
componentProps: {
dictCode:"sys_tenant,name,id",
mode: "multiple"
dict:"sys_tenant,name,id",
async: true,
multiple: true
},
},
{

View File

@ -32,6 +32,8 @@
<UserReplacePhoneModal @register="registerModal" @success="initUserDetail" />
<UserReplaceEmailModal @register="registerEmailModal" @success="initUserDetail" />
<UserPasswordModal @register="registerPassModal" @success="initUserDetail" />
<UserPasswordNotBindPhone @register="registerPassNotBindPhoneModal" @success="initUserDetail" />
<UserCancellationModal @register="registerCancelModal" />
</template>
<script lang="ts" setup>
import { onMounted, ref, reactive } from 'vue';
@ -41,6 +43,8 @@
import UserReplacePhoneModal from './commponents/UserPhoneModal.vue';
import UserReplaceEmailModal from './commponents/UserEmailModal.vue';
import UserPasswordModal from './commponents/UserPasswordModal.vue';
import UserPasswordNotBindPhone from './commponents/UserPasswordNotBindPhone.vue';
import UserCancellationModal from './commponents/UserCancellationModal.vue';
import { useModal } from '/@/components/Modal';
import { WechatFilled } from '@ant-design/icons-vue';
import { useDesign } from '/@/hooks/web/useDesign';
@ -52,6 +56,8 @@
const [registerModal, { openModal }] = useModal();
const [registerEmailModal, { openModal: openEmailModal }] = useModal();
const [registerPassModal, { openModal: openPassModal }] = useModal();
const [registerPassNotBindPhoneModal, { openModal: openPassNotBindPhoneModal }] = useModal();
const [registerCancelModal, { openModal: openCancelModal }] = useModal();
const wechatData = reactive<any>({
bindWechat: false,
@ -104,9 +110,17 @@
* 密码修改
*/
function updatePassWord() {
openPassModal(true, {
record: { username: userDetail.value.username },
});
//存在手机号手机号修改密码
if(userDetail.value.phone){
openPassModal(true, {
record: { username: userDetail.value.username },
});
} else {
//没有手机号走直接修改密码弹窗
openPassNotBindPhoneModal(true, {
record: { username: userDetail.value.username },
});
}
}
/**

View File

@ -18,6 +18,8 @@ enum Api {
changePhone = '/sys/user/changePhone',
//用户注销
userLogOff = '/sys/user/userLogOff',
//没有绑定手机号用的修改密码请求地址
updatePasswordNotBindPhone = '/sys/user/updatePasswordNotBindPhone',
}
/**
@ -60,6 +62,14 @@ export const updateUserPassword = (params) => {
return defHttp.get({ url: Api.updateUserPassword, params },{isTransformResponse:false});
}
/**
* 修改密码
* @param params
*/
export const updatePasswordNotBindPhone = (params) => {
return defHttp.put({ url: Api.updatePasswordNotBindPhone, params },{ isTransformResponse:false, joinParamsToUrl: true });
}
/**
* 通过用户id获取租户列表
* @param params

View File

@ -0,0 +1,115 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" title="修改密码" @ok="handleSubmit" destroyOnClose :width="400">
<a-form class="antd-modal-form" ref="formRef" :model="formState" :rules="validatorRules">
<a-form-item name="oldPassword">
<div class="black font-size-13">旧密码</div>
<div class="pass-padding">
<a-input-password placeholder="请输入旧密码" v-model:value="formState.oldPassword" />
</div>
</a-form-item>
<a-form-item name="password">
<span class="black font-size-13">新密码</span>
<div class="pass-padding">
<a-input-password v-model:value="formState.password" placeholder="新密码" autocomplete="new-password" />
</div>
<span class="gray-9e font-size-13">8-20需包含字母和数字</span>
</a-form-item>
</a-form>
</BasicModal>
</template>
<script lang="ts" name="user-pass-word-modal" setup>
import { ref, unref, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { Rule } from '@/components/Form';
import { updatePasswordNotBindPhone } from '../UserSetting.api';
import { useMessage } from '/@/hooks/web/useMessage';
import { useUserStore } from '/@/store/modules/user';
const { createMessage } = useMessage();
//用户名
const username = ref<string>('');
const formRef = ref();
const formState = reactive({
oldPassword: '',
password: '',
});
// 声明Emits
const emit = defineEmits(['success', 'register']);
//表单赋值
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
username.value = data.record.username;
Object.assign(formState, { password: '', oldPassword: '' });
});
const userStore = useUserStore();
const validatorRules: Record<string, Rule[]> = {
oldPassword: [{ required: true, message: '请输入旧密码' }],
password: [
{ required: true, validator: checkPassword },
{ pattern: /^(?=.*[0-9])(?=.*[a-zA-Z])(.{8,20})$/, message: '8-20位需包含字母和数字' },
],
};
//表单提交事件
async function handleSubmit() {
try {
let values = await formRef.value.validateFields();
setModalProps({ confirmLoading: true });
//提交表单
values.username = unref(username);
await updatePasswordNotBindPhone(values).then((res) => {
if (res.success) {
createMessage.info({
content: '密码修改成功请重新登录3s后自动退出登录',
duration: 3,
});
//3s后返回登录页面
setTimeout(() => {
userStore.logout(true);
}, 3000);
//关闭弹窗
closeModal();
} else {
createMessage.warn(res.message);
}
});
} finally {
setModalProps({ confirmLoading: false });
}
}
/**
* 验证新密码是否为空
*/
function checkPassword(_rule: Rule, value: string) {
if (value === '') {
return Promise.reject('请输入新密码');
}
return Promise.resolve();
}
</script>
<style lang="less" scoped>
.black {
color: @text-color;
}
.font-size-13 {
font-size: 13px;
line-height: 15px;
}
.gray-9e {
color: #9e9e9e;
}
.float-left {
float: left;
}
.pass-padding {
padding-top: 10px;
padding-bottom: 10px;
}
.antd-modal-form {
padding: 10px 24px 10px 24px;
}
:deep(.ant-form-item) {
margin-bottom: 10px;
}
</style>