123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <template>
- <div class="message-reminder flex flex-col h-full">
- <div class="page-action">
- <div
- v-for="item in tabs"
- :key="item.value"
- :class="[
- 'page-tab',
- {
- 'is-active': params.status === item.value,
- 'is-mark': item.value === 'false' && workStore.counts.notice,
- },
- ]"
- @click="switchTab(item)"
- >{{ item.label }}</div
- >
- </div>
- <SearchForm :fields="fields" :params="params">
- <template #service="{ item, params }">
- <select-service-unit
- v-model="params[item.prop]"
- clearable
- ></select-service-unit>
- </template>
- </SearchForm>
- <div v-loading="loading" class="page-wrap flex-1">
- <MessageList
- :tableData="tableData"
- :pagination="pagination"
- :onChange="onChange"
- ></MessageList>
- </div>
- </div>
- </template>
- <script setup name="MessageReminder">
- import { reactive, computed, ref } from 'vue';
- import useFetchTable from '@/hooks/useFetchTable';
- import { getMyMessages } from '@/api/my-workbenches';
- import { MESSAGE_TYPE } from '@/config/constants';
- import { dictToOptionList } from '@/utils/tool';
- import MessageList from './message-list.vue';
- import { useWorkStore } from '@/store';
- const workStore = useWorkStore();
- const tabs = [
- {
- label: '全部',
- value: 'undefined',
- },
- {
- label: '未读',
- value: 'false',
- },
- {
- label: '已读',
- value: 'true',
- },
- ];
- const params = reactive({
- types: [],
- serviceId: '',
- custom: '',
- status: 'undefined',
- });
- const transParams = computed(() => {
- let types = params.types.join(',');
- if (!types.length && params.status === 'undefined') {
- types = Object.keys(MESSAGE_TYPE).join();
- }
- let status = eval(params.status);
- return { ...params, types, status };
- });
- const {
- loading: loading,
- pagination: pagination,
- tableData: tableData,
- onChange: onChange,
- search: search,
- } = useFetchTable(getMyMessages, {
- params: transParams,
- });
- const switchTab = (tab) => {
- params.status = tab.value;
- search();
- };
- const fields = ref([
- {
- prop: 'types',
- label: '消息类型',
- type: 'multipleSelect',
- labelWidth: 100,
- colSpan: 5,
- options: dictToOptionList(MESSAGE_TYPE),
- attrs: {
- clearable: true,
- },
- },
- {
- prop: 'serviceId',
- label: '服务单元',
- type: 'select',
- labelWidth: 100,
- colSpan: 5,
- cell: 'service',
- },
- {
- prop: 'custom',
- label: '客户名称',
- labelWidth: 100,
- colSpan: 5,
- },
- {
- type: 'buttons',
- colSpan: 3,
- children: [
- {
- type: 'button',
- text: '查询',
- onClick: () => {
- search();
- },
- },
- ],
- },
- ]);
- </script>
|