消息配置

This commit is contained in:
Teo
2025-08-14 10:50:56 +08:00
parent f6c21bf195
commit 062fa5b080
6 changed files with 108 additions and 221 deletions

View File

@ -5,7 +5,7 @@ VITE_APP_TITLE = 新能源项目管理平台
VITE_APP_ENV = 'development'
# 开发环境
VITE_APP_BASE_API = 'http://192.168.110.180:8898'
VITE_APP_BASE_API = 'http://192.168.110.159:8898'
# 无人机接口地址

View File

@ -26,6 +26,9 @@
import { storeToRefs } from 'pinia';
import useNoticeStore from '@/store/modules/notice';
const router = useRouter();
const { proxy } = getCurrentInstance();
const noticeStore = storeToRefs(useNoticeStore());
const { readAll } = useNoticeStore();
@ -50,6 +53,11 @@ const onNewsClick = (item: any) => {
newsList.value[item].read = true;
//并且写入pinia
noticeStore.state.value.notices = newsList.value;
//如果有formPath就前往
console.log('🚀 ~ onNewsClick ~ item.formPath:', item.formPath, newsList.value);
if (newsList.value[item].formPath) {
proxy?.$tab.openPage('/' + newsList.value[item].formPath, '', { id: newsList.value[item].businessId, type: 'view' });
}
};
// 前往通知中心点击

View File

@ -5,11 +5,22 @@ interface NoticeItem {
read: boolean;
message: any;
time: string;
formPath?: string;
businessId?: string;
}
export const useNoticeStore = defineStore('notice', () => {
const state = reactive({
notices: [] as NoticeItem[]
notices: [
{
title: '通知公告',
read: false,
message: '这是一条通知公告',
time: '2023-01-01',
formPath: 'design-management/scheme/indexEdit',
businessId: '1955636050617094146'
}
] as NoticeItem[]
});
const addNotice = (notice: NoticeItem) => {

View File

@ -1,82 +1,4 @@
<template>
<<<<<<< HEAD
<div class="billof-quantities">
<!-- tabPosition="left" -->
<el-tabs type="border-card" @tab-change="handleTabChange">
<el-tab-pane v-for="item, index in work_order_type" :key="item.value" :label="item.label">
<el-card v-if="index < 3" shadow="always">
<el-form :model="state.queryForm" :inline="true">
<el-form-item label="版本号" prop="versions">
<el-select v-model="state.queryForm.versions" placeholder="选择版本号">
<el-option v-for="item in state.options" :key="item.versions" :label="item.versions" :value="item.versions" />
</el-select>
</el-form-item>
<el-form-item label="表名" prop="sheet">
<el-select v-model="state.queryForm.sheet" placeholder="选择表名" @change="handleChange">
<el-option v-for="item in state.sheets" :key="item" :label="item" :value="item" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="openTable(true, index)">一键展开</el-button>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="openTable(false, index)">一键收起</el-button>
</el-form-item>
<el-form-item>
<el-upload ref="uploadRef" class="upload-demo" :http-request="importExcel"
:show-file-list="false">
<template #trigger>
<el-button type="primary">导入excel</el-button>
</template>
</el-upload>
</el-form-item>
</el-form>
</el-card>
<el-card v-if="index == 3" shadow="always">
<el-form :model="state.queryForm" :inline="true">
<el-form-item label="版本号" prop="versions">
<el-select v-model="state.queryForm.versions" placeholder="选择版本号"
@change="handleChangeVersion">
<el-option v-for="item in state.options" :key="item.versions" :label="item.versions"
:value="item.versions" />
</el-select>
</el-form-item>
<el-form-item>
<el-upload ref="uploadRef" class="upload-demo" :http-request="importExcel" style="margin-right: 12px;"
v-if="Object.keys(state.versionsData).length === 0 ||state.versionsData.status=='cancel'"
:show-file-list="false">
<template #trigger>
<el-button type="primary">导入excel</el-button>
</template>
</el-upload>
<el-button v-if="state.versionsData.status=='draft'" type="primary"con="edit" @click="clickApprovalSheet()">审核</el-button>
<el-button v-if="state.versionsData.status=='waiting'||state.versionsData.status=='finish'" icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
</el-form-item>
</el-form>
</el-card>
<el-table v-if="index < 3" :ref="(el) => tableRef[index] = el" :data="state.tableData" v-loading="state.loading.list"
stripe :row-class-name="state.tableData.length === 0 ? 'table-null' : ''"
style="width: 100%; margin-bottom: 20px;height: calc(100vh - 305px);" row-key="id" border
:default-expand-all="state.isOpen">
<el-table-column prop="num" label="编号" />
<el-table-column prop="name" label="工程或费用名称" />
<el-table-column prop="unit" label="单位" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="备注" />
</el-table>
<el-table v-if="index == 3" :data="state.tableData"
style="width: 100%; margin-bottom: 20px;height: calc(100vh - 305px);" row-key="id" border>
<el-table-column prop="num" label="编号" />
<el-table-column prop="name" label="名称" />
<el-table-column prop="specification" label="规格" />
<el-table-column prop="unit" label="单位" />
<el-table-column prop="quantity" label="数量" />
<el-table-column prop="remark" label="备注" />
</el-table>
</el-tab-pane>
</el-tabs>
</div>
=======
<div class="billof-quantities">
<!-- tabPosition="left" -->
<el-tabs type="border-card" @tab-change="handleTabChange">
@ -165,7 +87,6 @@
</el-tab-pane>
</el-tabs>
</div>
>>>>>>> 3158dc84f7a6ef4568e1eeaf33df5b4b2fd1768f
</template>
<script setup name="billofQuantities">
@ -188,35 +109,6 @@ console.log(currentProject.value);
// tableData
// 版本号
const state = reactive({
<<<<<<< HEAD
work_order_type: 0,
// 版本号
version_num: '',
options: [],// 版本号选项
sheets: [], // sheet选项
queryForm: {
projectId: currentProject.value?.id,
versions: '',
sheet: '',
pageSize: 20,
pageNum: 1
},
loading: {
versions: false,
sheets: false,
list: false
},
error: null,
// 前三个
tableData: [],
// 物质设备清单
// tableData_sdsqd: [],
// 展开收起
isOpen: true,
// 版本号
versionsData:{}
})
=======
work_order_type: 0,
// 版本号
version_num: '',
@ -244,7 +136,6 @@ const state = reactive({
// 版本号
versionsData: {}
});
>>>>>>> 3158dc84f7a6ef4568e1eeaf33df5b4b2fd1768f
// tab切换
const handleTabChange = (tab) => {
state.tableData = [];
@ -276,25 +167,6 @@ async function getVersionNums(isSheet = true) {
pageNum: 1
});
<<<<<<< HEAD
const { code, rows } = res || {};
if (code === 200) {
state.options = rows || [];
if (state.options.length > 0) {
state.queryForm.versions = state.options[0].versions;
if (state.work_order_type == 3) {
state.versionsData = state.options[0] || [];
console.log('state.versionsData',state.versionsData);
}
// 等待表名加载完成
console.log(isSheet, state.sheets.length);
if (isSheet) {
await handleSheetName();
} else {
await handleQueryList(isSheet);
}
}
=======
const { code, rows } = res || {};
if (code === 200) {
state.options = rows || [];
@ -304,7 +176,6 @@ async function getVersionNums(isSheet = true) {
console.log(isSheet, state.sheets.length);
if (isSheet) {
await handleSheetName();
>>>>>>> 3158dc84f7a6ef4568e1eeaf33df5b4b2fd1768f
} else {
await handleQueryList(isSheet);
}
@ -355,30 +226,6 @@ async function handleSheetName() {
// 获取列表
async function handleQueryList(isSheet = true) {
<<<<<<< HEAD
if (isSheet && !state.queryForm.sheet) {
console.warn('表名不存在,无法获取列表数据');
return;
}
try {
state.loading.list = true;
state.error = null;
const result = await obtainTheList(state.queryForm);
if (result?.code === 200) {
state.tableData = result.data || [];
} else {
state.error = `获取列表数据失败: 错误码 ${result?.code}`;
console.error(state.error);
}
} catch (err) {
state.error = `获取列表数据时发生错误: ${err.message}`;
console.error(state.error, err);
} finally {
state.loading.list = false;
=======
if (isSheet && !state.queryForm.sheet) {
console.warn('表名不存在,无法获取列表数据');
return;
@ -398,7 +245,6 @@ async function handleQueryList(isSheet = true) {
} else {
state.error = `获取列表数据失败: 错误码 ${result?.code}`;
console.error(state.error);
>>>>>>> 3158dc84f7a6ef4568e1eeaf33df5b4b2fd1768f
}
} catch (err) {
state.error = `获取列表数据时发生错误: ${err.message}`;
@ -409,24 +255,6 @@ async function handleQueryList(isSheet = true) {
}
// 上传excel
function importExcel(options) {
<<<<<<< HEAD
console.log(options);
let formData = new FormData();
formData.append("file", options.file);
state.loading.list = true;
importExcelFile({ workOrderType: state.work_order_type, projectId: currentProject.value?.id }, formData).then(res => {
const { code } = res;
if (code == 200) {
proxy.$modal.msgSuccess(res.msg || '导入成功');
// 更新列表
getVersionNums(false)
} else {
getVersionNums()
proxy.$modal.msgError(res.msg || '导入失败');
}
}).finally(() => {
state.loading.list = false;
=======
console.log(options);
const loading = ElLoading.service({
lock: true,
@ -445,7 +273,6 @@ function importExcel(options) {
} else {
proxy.$modal.msgError(res.msg || '导入失败');
}
>>>>>>> 3158dc84f7a6ef4568e1eeaf33df5b4b2fd1768f
})
.finally(() => {
loading.close();

View File

@ -3,19 +3,31 @@
<div class="max-w-4xl mx-auto">
<!-- 顶部按钮区域 -->
<el-card class="mb-4 rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md">
<approvalButton @submitForm="submitForm" @approvalVerifyOpen="approvalVerifyOpen"
@handleApprovalRecord="handleApprovalRecord" :buttonLoading="buttonLoading" :id="form.versions"
:status="form.status" :pageType="routeParams.type" />
<approvalButton
@submitForm="submitForm"
@approvalVerifyOpen="approvalVerifyOpen"
@handleApprovalRecord="handleApprovalRecord"
:buttonLoading="buttonLoading"
:id="form.versions"
:status="form.status"
:pageType="routeParams.type"
/>
</el-card>
<!-- 表单区域 -->
<el-card
class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
<el-card class="rounded-lg shadow-sm bg-white border border-gray-100 transition-all hover:shadow-md overflow-hidden">
<div class="p-4 bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-gray-100">
<h3 class="text-lg font-semibold text-gray-800">设计原则</h3>
</div>
<div class="p-6">
<el-form ref="leaveFormRef" v-loading="loading" :disabled="routeParams.type === 'view'" :model="form"
:rules="rules" label-width="100px" class="space-y-4">
<el-form
ref="leaveFormRef"
v-loading="loading"
:disabled="routeParams.type === 'view'"
:model="form"
:rules="rules"
label-width="100px"
class="space-y-4"
>
<div class="grid grid-cols-1 gap-4">
<el-row>
<el-col :span="12">
@ -26,8 +38,7 @@
</el-row>
</div>
</el-form>
<el-table :data="tableData"
style="width: 100%; margin-bottom: 20px;height: calc(100vh - 305px);" row-key="id" border>
<el-table :data="tableData" style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)" row-key="id" border>
<el-table-column prop="num" label="编号" />
<el-table-column prop="name" label="名称" />
<el-table-column prop="specification" label="规格" />
@ -41,8 +52,14 @@
<submitVerify ref="submitVerifyRef" :task-variables="taskVariables" @submit-callback="submitCallback" />
<approvalRecord ref="approvalRecordRef"></approvalRecord>
<!-- 流程选择对话框 -->
<el-dialog draggable v-model="dialogVisible.visible" :title="dialogVisible.title" :before-close="handleClose"
width="500" class="rounded-lg shadow-lg">
<el-dialog
draggable
v-model="dialogVisible.visible"
:title="dialogVisible.title"
:before-close="handleClose"
width="500"
class="rounded-lg shadow-lg"
>
<div class="p-4">
<p class="text-gray-600 mb-4">请选择要启动的流程</p>
<el-select v-model="flowCode" placeholder="请选择流程" style="width: 100%">
@ -51,10 +68,12 @@
</div>
<template #footer>
<div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3">
<el-button @click="handleClose"
class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors">取消</el-button>
<el-button type="primary" @click="submitFlow()"
class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors">确认</el-button>
<el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors"
>取消</el-button
>
<el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors"
>确认</el-button
>
</div>
</template>
</el-dialog>
@ -95,8 +114,8 @@ const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
const flowCodeOptions = [
{
value: currentProject.value?.id + '_equipmentList',
label: '物资设备清单审核'
},
label: '工程量清单审核'
}
];
const leaveFormRef = ref<ElFormInstance>();
@ -121,7 +140,7 @@ const initFormData = {
};
const data = reactive({
form: { ...initFormData },
tableData:[],
tableData: [],
rules: {}
});
@ -130,7 +149,7 @@ const handleClose = () => {
flowCode.value = '';
buttonLoading.value = false;
};
const { form, rules,tableData } = toRefs(data);
const { form, rules, tableData } = toRefs(data);
/** 表单重置 */
const reset = () => {
@ -144,11 +163,11 @@ const getInfo = () => {
buttonLoading.value = false;
nextTick(async () => {
const res = await detailsMaterialAndEquipmentApproval(routeParams.value.id);
console.log('res.data',res.data);
console.log('res.data', res.data);
Object.assign(form.value, res.data);
console.log('form',form.value);
console.log('form', form.value);
tableData.value = res.data.auditData;
loading.value = false;
buttonLoading.value = false;
@ -227,8 +246,7 @@ onMounted(() => {
loading.value = false;
if (routeParams.value.type === 'update' || routeParams.value.type === 'view' || routeParams.value.type === 'approval') {
getInfo();
console.log('routeParams.value',routeParams.value);
console.log('routeParams.value', routeParams.value);
}
});
});

View File

@ -10,9 +10,6 @@
<el-form-item label="消息标识" prop="msgKey">
<el-input v-model="queryParams.msgKey" placeholder="请输入消息标识" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="跳转路由" prop="route">
<el-input v-model="queryParams.route" placeholder="请输入跳转路由" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="通知人" prop="userId">
<el-input v-model="queryParams.userId" placeholder="请输入通知人" clearable @keyup.enter="handleQuery" />
</el-form-item>
@ -41,7 +38,7 @@
<el-table-column label="消息名称" align="center" prop="msgName" />
<el-table-column label="消息模板" align="center" prop="msgContent" />
<el-table-column label="消息标识" align="center" prop="msgKey" />
<el-table-column label="跳转路由" align="center" prop="route" />
<!-- <el-table-column label="跳转路由" align="center" prop="route" /> -->
<el-table-column label="通知人" align="center" prop="userId" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
@ -73,9 +70,15 @@
<el-input v-model="form.route" placeholder="请输入跳转路由" />
</el-form-item>
<el-form-item label="通知部门" prop="deptId">
<el-select v-model="form.deptId" placeholder="请选择通知部门" filterable @change="getUser">
<el-option v-for="item in deptList" :key="item.deptId" :label="item.deptName" :value="item.deptId" />
</el-select>
<el-tree-select
v-model="form.deptId"
:data="deptList"
:props="{ value: 'id', label: 'label', children: 'children' }"
value-key="id"
placeholder="请选择归属部门"
check-strictly
@change="handleDeptChange"
/>
</el-form-item>
<el-form-item label="通知人" prop="userId">
<el-select v-model="form.userId" placeholder="请选择通知人" multiple filterable :disabled="!form.deptId">
@ -96,7 +99,8 @@
<script setup name="Config" lang="ts">
import { listConfig, getConfig, delConfig, addConfig, updateConfig, listUsers } from '@/api/message/config';
import { ConfigVO, ConfigQuery, ConfigForm } from '@/api/message/config/types';
import { listUser } from '@/api/system/user';
import { DeptTreeVO } from '@/api/system/dept/types';
import { deptTreeSelect, listUser } from '@/api/system/user';
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -225,6 +229,7 @@ const submitForm = () => {
if (form.value.id) {
await updateConfig(form.value).finally(() => (buttonLoading.value = false));
} else {
form.value.userId = form.value.userId.join(',');
await addConfig(form.value).finally(() => (buttonLoading.value = false));
}
proxy?.$modal.msgSuccess('操作成功');
@ -254,24 +259,42 @@ const handleExport = () => {
);
};
/** 获取用户列表 */
const getDept = async () => {
const res = await listUsers({
pageNum: 1,
pageSize: 1000,
projectId: currentProject.value?.id
});
deptId.value = res.data.deptId;
getListDept();
// /** 获取用户列表 */
// const getDept = async () => {
// const res = await listUsers({
// pageNum: 1,
// pageSize: 1000,
// projectId: currentProject.value?.id
// });
// deptId.value = res.data.deptId;
// getListDept();
// };
/** 查询部门下拉树结构 */
const getDeptTree = async () => {
const res = await deptTreeSelect({ isShow: '1' });
deptList.value = filterDisabledDept(res.data);
};
const getListDept = async () => {
/** 过滤禁用的部门 */
const filterDisabledDept = (deptList: DeptTreeVO[]) => {
return deptList.filter((dept) => {
if (dept.disabled) {
return false;
}
if (dept.children && dept.children.length) {
dept.children = filterDisabledDept(dept.children);
}
return true;
});
};
const handleDeptChange = async (value) => {
const res = await listUser({
pageNum: 1,
pageSize: 1000,
deptId: deptId.value
deptId: value
});
deptList.value = res.rows;
userList.value = res.rows;
};
const getUser = async () => {
const res = await listUser({
@ -284,7 +307,7 @@ const getUser = async () => {
onMounted(() => {
getList();
getDept();
getDeptTree();
});
//监听项目id刷新数据