1.修改通知消息bug
2.修改富文本编辑器组件
This commit is contained in:
2026-02-11 16:42:30 +08:00
parent a416e9d7df
commit e897357108
7 changed files with 105 additions and 21 deletions
@@ -1,5 +1,5 @@
<template> <template>
<Tinymce v-bind="bindProps" @change="onChange" /> <Tinymce v-bind="bindProps" @change="onChange" @uploadingStatus="changeStatus" />
</template> </template>
<script lang="ts"> <script lang="ts">
@@ -18,7 +18,7 @@
disabled: propTypes.bool.def(false), disabled: propTypes.bool.def(false),
resize: propTypes.bool.def(true), resize: propTypes.bool.def(true),
}, },
emits: ['change', 'update:value'], emits: ['change', 'update:value', 'status', 'update:status'],
setup(props, { emit, attrs }) { setup(props, { emit, attrs }) {
// 合并 props 和 attrs // 合并 props 和 attrs
const bindProps = computed(() => Object.assign({}, props, attrs)); const bindProps = computed(() => Object.assign({}, props, attrs));
@@ -29,9 +29,15 @@
emit('update:value', value); emit('update:value', value);
} }
function changeStatus(flag: boolean) {
emit('status', flag);
emit('update:status', flag);
}
return { return {
bindProps, bindProps,
onChange, onChange,
changeStatus,
}; };
}, },
}); });
@@ -126,8 +126,9 @@
watch( watch(
() => props.apiParams, () => props.apiParams,
() => { (n: any, o: any) => {
if (props.apiParams) { if (n && JSON.stringify(n) !== JSON.stringify(o)) {
console.log('111');
getTreeData1(); getTreeData1();
} }
} }
+3 -1
View File
@@ -123,7 +123,7 @@
components: { ImgUpload }, components: { ImgUpload },
inheritAttrs: false, inheritAttrs: false,
props: tinymceProps, props: tinymceProps,
emits: ['change', 'update:modelValue', 'inited', 'init-error'], emits: ['change', 'update:modelValue', 'inited', 'init-error', 'uploadingStatus'],
setup(props, { emit, attrs }) { setup(props, { emit, attrs }) {
const editorRef = ref<Nullable<Editor>>(null); const editorRef = ref<Nullable<Editor>>(null);
const fullscreen = ref(false); const fullscreen = ref(false);
@@ -347,6 +347,7 @@
} }
editor.execCommand('mceInsertContent', false, getUploadingImgName(name)); editor.execCommand('mceInsertContent', false, getUploadingImgName(name));
const content = editor?.getContent() ?? ''; const content = editor?.getContent() ?? '';
emit('uploadingStatus', true);
setValue(editor, content); setValue(editor, content);
} }
@@ -357,6 +358,7 @@
} }
const content = editor?.getContent() ?? ''; const content = editor?.getContent() ?? '';
const val = content?.replace(getUploadingImgName(name), `<img src="${url}"/>`) ?? ''; const val = content?.replace(getUploadingImgName(name), `<img src="${url}"/>`) ?? '';
emit('uploadingStatus', false);
setValue(editor, val); setValue(editor, val);
} }
@@ -9,11 +9,12 @@
<div style="border-bottom: 1px dashed; margin-bottom: 10px; padding: 0 0 10px; font-weight: 500; display: flex"> <div style="border-bottom: 1px dashed; margin-bottom: 10px; padding: 0 0 10px; font-weight: 500; display: flex">
<div>通知范围</div> <div>通知范围</div>
<div style="flex: 1"> <div style="flex: 1">
{{ {{ dataInfo?.scopeType === 1 ? '指定机构' : '指定员工' }}
({{
dataInfo?.scopeType === 1 dataInfo?.scopeType === 1
? dataInfo?.departScopeList && dataInfo?.departScopeList[0]?.record ? dataInfo?.departScopeList && dataInfo?.departScopeList[0]?.record
: dataInfo?.userScopeList && dataInfo?.userScopeList.map((item: any) => item.record).join(',') : dataInfo?.userScopeList && dataInfo?.userScopeList.map((item: any) => item.record).join(',')
}} }})
</div> </div>
</div> </div>
<div class="information"> <div class="information">
@@ -26,18 +27,21 @@
import BasicModal from '/@/components/Modal/src/BasicModal.vue'; import BasicModal from '/@/components/Modal/src/BasicModal.vue';
import { useModalInner } from '/@/components/Modal'; import { useModalInner } from '/@/components/Modal';
import { ref } from 'vue'; import { ref } from 'vue';
import { preEditorValue } from '/@/utils/editor';
import { useGlobSetting } from '/@/hooks/setting';
const dataInfo = ref({ const dataInfo = ref({
information: '', information: '',
}); });
const globSetting = useGlobSetting();
const [registerModal, {}] = useModalInner((data: any) => { const [registerModal, {}] = useModalInner((data: any) => {
data.content = preEditorValue(data.content, globSetting.domainUrl);
dataInfo.value = data; dataInfo.value = data;
}); });
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.modal-d { .modal-d {
max-height: 65vh; height: 65vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-left: 6px; padding-left: 6px;
@@ -14,16 +14,17 @@
<template v-if="model[field] === 1"> <template v-if="model[field] === 1">
<div>选择机构</div> <div>选择机构</div>
<jlazy-tree-select <jlazy-tree-select
style="width: 100%"
:isHaveFLevel="true" :isHaveFLevel="true"
:multiple="false"
:fieldNamesInfo="{ key: 'resultItem', label: 'title', value: 'resultItem' }" :fieldNamesInfo="{ key: 'resultItem', label: 'title', value: 'resultItem' }"
treeNodeFilterProp="title" treeNodeFilterProp="title"
:api-params="{ primaryKey: 'orgCode', ids: userInfo.orgCode }" :api-params="{ primaryKey: 'orgCode', ids: userInfo.orgCode }"
v-model:value="scopeDept" v-model:value="scopeDept"
:maxTagCount="3"
/> />
</template> </template>
<template v-else> <template v-else>
<div>指定员工</div> <div>选择员工</div>
<a-input v-model:value="model['userScopeListRecord']" readonly placeholder="请选择员工" @click="openPeople" /> <a-input v-model:value="model['userScopeListRecord']" readonly placeholder="请选择员工" @click="openPeople" />
</template> </template>
</div> </div>
@@ -52,6 +53,8 @@
import { addApi, scopeUserListApi } from '/@/views/system/noticeList/noticeList.api'; import { addApi, scopeUserListApi } from '/@/views/system/noticeList/noticeList.api';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import { message } from 'ant-design-vue'; import { message } from 'ant-design-vue';
import { preEditorValue } from '/@/utils/editor';
import { useGlobSetting } from '/@/hooks/setting';
const userInfo = useUserStore().getUserInfo; const userInfo = useUserStore().getUserInfo;
@@ -61,7 +64,8 @@
const emit = defineEmits(['ok']); const emit = defineEmits(['ok']);
const scopeDept = ref<any>(); const globSetting = useGlobSetting();
const scopeDept = ref<any>([]);
const expandedRowKeys = ref<any[]>([]); const expandedRowKeys = ref<any[]>([]);
const auditorTableProps = ref<object>({ const auditorTableProps = ref<object>({
tableProps: { tableProps: {
@@ -126,8 +130,13 @@
}); });
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => { const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
scopeDept.value = [];
expandedRowKeys.value = [];
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
resetFields(); resetFields();
setFieldsValue({
imgStatus: '0',
});
}); });
function onSelectUserOk(e: any) { function onSelectUserOk(e: any) {
@@ -150,15 +159,22 @@
async function handleSubmit() { async function handleSubmit() {
try { try {
const values = await validate(); const values = await validate();
if (!scopeDept.value && values.scopeType === 1) return message.error('请选择机构'); if (values?.imgstatus === '1') return message.error('请等待资源上传');
if (scopeDept.value.length === 0 && values.scopeType === 1) return message.error('请选择机构');
if (expandedRowKeys.value.length === 0 && values.scopeType === 2) return message.error('请指定员工'); if (expandedRowKeys.value.length === 0 && values.scopeType === 2) return message.error('请指定员工');
values.content = preEditorValue(values.content, globSetting.domainUrl);
if (values.scopeType === 1) { if (values.scopeType === 1) {
values['departScopeList'] = [JSON.parse(scopeDept.value)]; values['departScopeList'] = scopeDept.value.map((item: any) => {
} else {
values['userScopeList'] = expandedRowKeys.value.map((item) => {
return { return {
id: JSON.parse(item).userId, scopeId: JSON.parse(item).scopeId,
record: JSON.parse(item).record,
};
});
} else {
values['userScopeList'] = expandedRowKeys.value.map((item: any) => {
return {
scopeId: JSON.parse(item).userId,
record: JSON.parse(item).realName, record: JSON.parse(item).realName,
}; };
}); });
@@ -180,10 +196,14 @@
display: flex; display: flex;
align-items: center; align-items: center;
margin: 10px 0 -5px; margin: 10px 0 -5px;
width: 100%;
> div { > div {
&:nth-child(1) { &:nth-child(1) {
width: 80px; width: 80px;
} }
&:nth-child(2) {
flex: 1;
}
} }
} }
</style> </style>
+14 -2
View File
@@ -11,11 +11,11 @@ export const columns: BasicColumn[] = [
customRender: ({ text }) => { customRender: ({ text }) => {
switch (text) { switch (text) {
case 1: case 1:
return '指定部门'; return '指定机构';
case 2: case 2:
return '指定员工'; return '指定员工';
case 3: case 3:
return '即指定部门又指定员工'; return '即指定机构又指定员工';
default: default:
return '-'; return '-';
} }
@@ -116,8 +116,20 @@ export const schemas: FormSchema[] = [
label: '通知内容', label: '通知内容',
field: 'content', field: 'content',
component: 'JEditor', component: 'JEditor',
componentProps: ({ formModel }) => ({
showImageUpload: true,
'onUpdate:status': (v: any) => {
formModel.imgStatus = v ? '1' : '0';
},
}),
required: true, required: true,
}, },
{
label: '',
field: 'imgStatus',
component: 'Input',
show: false,
},
{ {
label: '', label: '',
field: 'id', field: 'id',
+41 -2
View File
@@ -5,12 +5,26 @@
<div style="font-size: 16px; font-weight: bold"> 公告通知列表 </div> <div style="font-size: 16px; font-weight: bold"> 公告通知列表 </div>
<div class="button-d"> <div class="button-d">
<a-button type="primary" @click="() => openModal(true, {})">新增</a-button> <a-button type="primary" @click="() => openModal(true, {})">新增</a-button>
<a-button type="primary">导出</a-button> <!-- <a-button type="primary">导出</a-button>-->
<a-button type="primary">导出记录</a-button> <!-- <a-button type="primary">导出记录</a-button>-->
<a-button type="danger" @click="deleteBatch">批量删除</a-button> <a-button type="danger" @click="deleteBatch">批量删除</a-button>
</div> </div>
</div> </div>
</template> </template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'scopeType'">
<a-tooltip placement="topLeft">
<template #title>
<span>
<template v-if="record?.scopeType == 1"> 指定机构({{ record?.depart }}) </template>
<template v-if="record?.scopeType == 2"> 指定员工({{ record?.user }}) </template>
</span>
</template>
<div class="no-text-to-long" v-if="record?.scopeType == 1"> 指定机构({{ record?.depart }}) </div>
<div class="no-text-to-long" v-if="record?.scopeType == 2"> 指定员工({{ record?.user }}) </div>
</a-tooltip>
</template>
</template>
<!--操作栏--> <!--操作栏-->
<template #action="{ record }"> <template #action="{ record }">
<TableAction :actions="getTableAction(record)" /> <TableAction :actions="getTableAction(record)" />
@@ -49,6 +63,25 @@
width: 120, width: 120,
fixed: 'right', fixed: 'right',
}, },
afterFetch: (data: any) => {
return data.map((item: any) => {
item['depart'] = (
item?.departScopeList
? item?.departScopeList.map((t: any) => {
return t?.record;
})
: []
).join('、');
item['user'] = (
item?.userScopeList
? item?.userScopeList.map((t: any) => {
return t?.record;
})
: []
).join('、');
return item;
});
},
}, },
}); });
@@ -90,4 +123,10 @@
margin: 5px 10px 0 0; margin: 5px 10px 0 0;
} }
} }
.no-text-to-long {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style> </style>