yxk-20260509-党委会反馈表单

新增时,自动加上反馈部门和反馈人
This commit is contained in:
ye1023
2026-05-09 15:52:49 +08:00
parent 0a28b35f37
commit cbd048e7d3
3 changed files with 97 additions and 2 deletions
@@ -60,12 +60,15 @@
<script lang="ts" setup>
import { nextTick, reactive, ref } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import { bgPartymatterFeedbackSaveOrUpdate } from '../BgPartymatter.api';
import { useUserStore } from '/@/store/modules/user';
const emit = defineEmits(['success']);
const { createMessage } = useMessage();
const userStore = useUserStore();
const visible = ref(false);
const saving = ref(false);
@@ -101,9 +104,51 @@
function open(mainId: string) {
resetForm(mainId);
void applyCurrentUserFeedbackInfo();
visible.value = true;
}
function getCurrentLoginDepart() {
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
const loginInfo = (userStore.getLoginInfo || {}) as Record<string, any>;
const departs = Array.isArray(loginInfo.departs) ? loginInfo.departs : [];
if (userInfo.orgCode) {
return departs.find((item) => item.orgCode === userInfo.orgCode);
}
return departs.length === 1 ? departs[0] : undefined;
}
async function getCurrentDepartInfo() {
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
const loginDepart = getCurrentLoginDepart();
if (loginDepart) {
return {
id: loginDepart.id || '',
departName: loginDepart.departName || '',
};
}
if (userInfo.orgCode) {
const depart = await defHttp.get({ url: '/sys/sysDepart/getDepartName', params: { orgCode: userInfo.orgCode } });
return {
id: depart?.id || '',
departName: depart?.departName || '',
};
}
return {
id: userInfo.departIds || '',
departName: userInfo.departIds_dictText || userInfo.orgCodeTxt || '',
};
}
async function applyCurrentUserFeedbackInfo() {
const userInfo = (userStore.getUserInfo || {}) as Record<string, any>;
formData.responPersonid = userInfo.id || userInfo.userId || '';
formData.responPersonname = userInfo.realname || '';
const departInfo = await getCurrentDepartInfo();
formData.responDeptid = departInfo.id;
formData.responDeptname = departInfo.departName;
}
function handleCancel() {
visible.value = false;
}
@@ -116,6 +161,7 @@
}
saving.value = true;
try {
await applyCurrentUserFeedbackInfo();
const res = await bgPartymatterFeedbackSaveOrUpdate({ ...formData }, false);
if (res.success) {
createMessage.success(res.message || '保存成功');