Commit 179e524e9ddd1a6ffef182566276032b12a34990
Merge branch 'sqy_dev' into 'main'
修改teambitionbug和重写站内通知的逻辑。优化代码 See merge request huang/yun-teng-iot-front!40
Showing
27 changed files
with
235 additions
and
176 deletions
| @@ -56,13 +56,19 @@ export const saveOrEditMessageConfig = (params: MessageConfig, isUpdate: boolean | @@ -56,13 +56,19 @@ export const saveOrEditMessageConfig = (params: MessageConfig, isUpdate: boolean | ||
| 56 | * @param messageType 消息类型 | 56 | * @param messageType 消息类型 |
| 57 | * @param status 状态 | 57 | * @param status 状态 |
| 58 | */ | 58 | */ |
| 59 | -export const setMessageConfigStatus = (id: string, messageType: string, status: number) => | 59 | +export const setMessageConfigStatus = ( |
| 60 | + id: string, | ||
| 61 | + messageType: string, | ||
| 62 | + status: number, | ||
| 63 | + tenantId: string | ||
| 64 | +) => | ||
| 60 | defHttp.put<MessageConfigResultModel>({ | 65 | defHttp.put<MessageConfigResultModel>({ |
| 61 | url: MessageConfigApi.CONFIG_URL, | 66 | url: MessageConfigApi.CONFIG_URL, |
| 62 | data: { | 67 | data: { |
| 63 | - id: id, | ||
| 64 | - messageType: messageType, | ||
| 65 | - status: status, | 68 | + id, |
| 69 | + messageType, | ||
| 70 | + status, | ||
| 71 | + tenantId, | ||
| 66 | }, | 72 | }, |
| 67 | }); | 73 | }); |
| 68 | /** | 74 | /** |
| @@ -47,7 +47,7 @@ export const notifyGetTableApi = (params?: NoticeQueryParam) => { | @@ -47,7 +47,7 @@ export const notifyGetTableApi = (params?: NoticeQueryParam) => { | ||
| 47 | * 新增草稿 | 47 | * 新增草稿 |
| 48 | * @param params pageSize page name | 48 | * @param params pageSize page name |
| 49 | */ | 49 | */ |
| 50 | -export const notifyAddDraftApi = (params: NotifyAddDraftModel) => { | 50 | +export const notifyAddDraftApi = (params) => { |
| 51 | return defHttp.post<NotifyAddDraftModel>({ | 51 | return defHttp.post<NotifyAddDraftModel>({ |
| 52 | url: NotifyManagerApi.NOTICE_ADD_DRAFT_URL, | 52 | url: NotifyManagerApi.NOTICE_ADD_DRAFT_URL, |
| 53 | params, | 53 | params, |
| @@ -58,7 +58,7 @@ export const notifyAddDraftApi = (params: NotifyAddDraftModel) => { | @@ -58,7 +58,7 @@ export const notifyAddDraftApi = (params: NotifyAddDraftModel) => { | ||
| 58 | * 新增通知 | 58 | * 新增通知 |
| 59 | * @param params pageSize page name | 59 | * @param params pageSize page name |
| 60 | */ | 60 | */ |
| 61 | -export const notifyAddLeaseApi = (params: NotifyAddreLeaseModel) => { | 61 | +export const notifyAddLeaseApi = (params) => { |
| 62 | return defHttp.post<NotifyAddreLeaseModel>({ | 62 | return defHttp.post<NotifyAddreLeaseModel>({ |
| 63 | url: NotifyManagerApi.NOTICE_ADD_LEASE_URL, | 63 | url: NotifyManagerApi.NOTICE_ADD_LEASE_URL, |
| 64 | params, | 64 | params, |
| @@ -66,7 +66,9 @@ export const saveOrUpdateOrganization = (params?: OrganizationListItem, isUpdate | @@ -66,7 +66,9 @@ export const saveOrUpdateOrganization = (params?: OrganizationListItem, isUpdate | ||
| 66 | export const delOrganization = (ids: string[]) => | 66 | export const delOrganization = (ids: string[]) => |
| 67 | defHttp.delete({ | 67 | defHttp.delete({ |
| 68 | url: Api.BaseOrganization, | 68 | url: Api.BaseOrganization, |
| 69 | - data: ids, | 69 | + data: { |
| 70 | + ids, | ||
| 71 | + }, | ||
| 70 | }); | 72 | }); |
| 71 | 73 | ||
| 72 | export const getMenuList = (params?: MenuParams) => | 74 | export const getMenuList = (params?: MenuParams) => |
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | <a-button | 8 | <a-button |
| 9 | type="primary" | 9 | type="primary" |
| 10 | color="error" | 10 | color="error" |
| 11 | - @click="handleDeleteOrBatchDelete(null)" | 11 | + @click="handleDeleteOrBatchDelete.bind(null)" |
| 12 | :disabled="hasBatchDelete" | 12 | :disabled="hasBatchDelete" |
| 13 | > | 13 | > |
| 14 | 批量删除 | 14 | 批量删除 |
| @@ -23,8 +23,7 @@ export const columns: BasicColumn[] = [ | @@ -23,8 +23,7 @@ export const columns: BasicColumn[] = [ | ||
| 23 | 23 | ||
| 24 | { | 24 | { |
| 25 | title: '所属组织', | 25 | title: '所属组织', |
| 26 | - dataIndex: 'organizationId', | ||
| 27 | - slots: { customRender: 'organizationId' }, | 26 | + dataIndex: 'organizationDTO.name', |
| 28 | }, | 27 | }, |
| 29 | { | 28 | { |
| 30 | title: '标签', | 29 | title: '标签', |
| @@ -11,9 +11,7 @@ | @@ -11,9 +11,7 @@ | ||
| 11 | {{ record.deviceProfile.name }} | 11 | {{ record.deviceProfile.name }} |
| 12 | </a-button> | 12 | </a-button> |
| 13 | </template> | 13 | </template> |
| 14 | - <template #organizationId="{ record }"> | ||
| 15 | - {{ record.organizationDTO.name }} | ||
| 16 | - </template> | 14 | + |
| 17 | <template #deviceType="{ record }"> | 15 | <template #deviceType="{ record }"> |
| 18 | <Tag color="success" class="ml-2"> | 16 | <Tag color="success" class="ml-2"> |
| 19 | {{ | 17 | {{ |
| @@ -55,7 +55,7 @@ export const columns: BasicColumn[] = [ | @@ -55,7 +55,7 @@ export const columns: BasicColumn[] = [ | ||
| 55 | record.pendingStatus = true; | 55 | record.pendingStatus = true; |
| 56 | const newStatus = checked ? 1 : 0; | 56 | const newStatus = checked ? 1 : 0; |
| 57 | const { createMessage } = useMessage(); | 57 | const { createMessage } = useMessage(); |
| 58 | - setMessageConfigStatus(record.id, record.messageType, newStatus) | 58 | + setMessageConfigStatus(record.id, record.messageType, newStatus, record.tenantId) |
| 59 | .then(() => { | 59 | .then(() => { |
| 60 | record.status = newStatus; | 60 | record.status = newStatus; |
| 61 | createMessage.success(`修改成功`); | 61 | createMessage.success(`修改成功`); |
| @@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
| 62 | title: '操作', | 62 | title: '操作', |
| 63 | dataIndex: 'action', | 63 | dataIndex: 'action', |
| 64 | slots: { customRender: 'action' }, | 64 | slots: { customRender: 'action' }, |
| 65 | - fixed: undefined, | 65 | + fixed: 'right', |
| 66 | }, | 66 | }, |
| 67 | immediate: true, | 67 | immediate: true, |
| 68 | }); | 68 | }); |
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | { | 7 | { |
| 8 | label: '查看', | 8 | label: '查看', |
| 9 | tooltip: '查看', | 9 | tooltip: '查看', |
| 10 | - icon: 'clarity:note-edit-line', | 10 | + icon: 'ant-design:eye-outlined', |
| 11 | onClick: handleView.bind(null, record), | 11 | onClick: handleView.bind(null, record), |
| 12 | }, | 12 | }, |
| 13 | ]" | 13 | ]" |
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | import { columns, searchFormSchema } from './config.d'; | 25 | import { columns, searchFormSchema } from './config.d'; |
| 26 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; | 26 | import { notifyMyGetrPageApi } from '/@/api/stationnotification/stationnotifyApi'; |
| 27 | export default defineComponent({ | 27 | export default defineComponent({ |
| 28 | - name: 'Index', | 28 | + name: 'LoginForm', |
| 29 | components: { BasicTable, NotifyDetailDrawer, TableAction }, | 29 | components: { BasicTable, NotifyDetailDrawer, TableAction }, |
| 30 | setup() { | 30 | setup() { |
| 31 | const [registerDrawer, { openDrawer }] = useDrawer(); | 31 | const [registerDrawer, { openDrawer }] = useDrawer(); |
| 1 | +import { h } from 'vue'; | ||
| 1 | import { BasicColumn, FormSchema } from '/@/components/Table'; | 2 | import { BasicColumn, FormSchema } from '/@/components/Table'; |
| 2 | import { Tinymce } from '/@/components/Tinymce/index'; | 3 | import { Tinymce } from '/@/components/Tinymce/index'; |
| 3 | -import { h, ref } from 'vue'; | ||
| 4 | // import { findDictItemByCode } from '/@/api/system/dict'; | 4 | // import { findDictItemByCode } from '/@/api/system/dict'; |
| 5 | import { getOrganizationList } from '/@/api/system/system'; | 5 | import { getOrganizationList } from '/@/api/system/system'; |
| 6 | import { copyTransFun } from '/@/utils/fnUtils'; | 6 | import { copyTransFun } from '/@/utils/fnUtils'; |
| 7 | import { Tag } from 'ant-design-vue'; | 7 | import { Tag } from 'ant-design-vue'; |
| 8 | 8 | ||
| 9 | -export const selectWhere = ref(null); | ||
| 10 | -export const isDeptId = ref(null); | ||
| 11 | - | ||
| 12 | export enum IsOrgEnum { | 9 | export enum IsOrgEnum { |
| 13 | IS_ORG_ENUM = '1', | 10 | IS_ORG_ENUM = '1', |
| 14 | } | 11 | } |
| 15 | - | ||
| 16 | export const isOrg = (type: string) => { | 12 | export const isOrg = (type: string) => { |
| 17 | return type === IsOrgEnum.IS_ORG_ENUM; | 13 | return type === IsOrgEnum.IS_ORG_ENUM; |
| 18 | }; | 14 | }; |
| @@ -106,8 +102,8 @@ export const formSchema: FormSchema[] = [ | @@ -106,8 +102,8 @@ export const formSchema: FormSchema[] = [ | ||
| 106 | component: 'Input', | 102 | component: 'Input', |
| 107 | colProps: { span: 24 }, | 103 | colProps: { span: 24 }, |
| 108 | label: '内容', | 104 | label: '内容', |
| 105 | + required: true, | ||
| 109 | defaultValue: '', | 106 | defaultValue: '', |
| 110 | - rules: [{ required: true }], | ||
| 111 | render: ({ model, field }) => { | 107 | render: ({ model, field }) => { |
| 112 | return h(Tinymce, { | 108 | return h(Tinymce, { |
| 113 | value: model[field], | 109 | value: model[field], |
| @@ -129,18 +125,6 @@ export const formSchema: FormSchema[] = [ | @@ -129,18 +125,6 @@ export const formSchema: FormSchema[] = [ | ||
| 129 | { label: '全部', value: '0' }, | 125 | { label: '全部', value: '0' }, |
| 130 | { label: '组织', value: '1' }, | 126 | { label: '组织', value: '1' }, |
| 131 | ], | 127 | ], |
| 132 | - onChange: (v) => { | ||
| 133 | - switch (v) { | ||
| 134 | - case '0': | ||
| 135 | - selectWhere.value = v; | ||
| 136 | - break; | ||
| 137 | - case '1': | ||
| 138 | - selectWhere.value = v; | ||
| 139 | - break; | ||
| 140 | - default: | ||
| 141 | - selectWhere.value = 0; | ||
| 142 | - } | ||
| 143 | - }, | ||
| 144 | }, | 128 | }, |
| 145 | }, | 129 | }, |
| 146 | { | 130 | { |
| @@ -148,15 +132,13 @@ export const formSchema: FormSchema[] = [ | @@ -148,15 +132,13 @@ export const formSchema: FormSchema[] = [ | ||
| 148 | label: '所属组织', | 132 | label: '所属组织', |
| 149 | colProps: { span: 13 }, | 133 | colProps: { span: 13 }, |
| 150 | component: 'ApiTreeSelect', | 134 | component: 'ApiTreeSelect', |
| 135 | + required: true, | ||
| 151 | componentProps: { | 136 | componentProps: { |
| 152 | api: async () => { | 137 | api: async () => { |
| 153 | const data = await getOrganizationList(); | 138 | const data = await getOrganizationList(); |
| 154 | copyTransFun(data as any as any[]); | 139 | copyTransFun(data as any as any[]); |
| 155 | return data; | 140 | return data; |
| 156 | }, | 141 | }, |
| 157 | - onChange: (v) => { | ||
| 158 | - isDeptId.value = v; | ||
| 159 | - }, | ||
| 160 | }, | 142 | }, |
| 161 | ifShow: ({ values }) => isOrg(Reflect.get(values, 'receiverType')), | 143 | ifShow: ({ values }) => isOrg(Reflect.get(values, 'receiverType')), |
| 162 | }, | 144 | }, |
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | :actions="[ | 14 | :actions="[ |
| 15 | { | 15 | { |
| 16 | label: '查看', | 16 | label: '查看', |
| 17 | - icon: 'clarity:note-edit-line', | 17 | + icon: 'ant-design:eye-outlined', |
| 18 | onClick: handleView.bind(null, record), | 18 | onClick: handleView.bind(null, record), |
| 19 | ifShow: (_action) => { | 19 | ifShow: (_action) => { |
| 20 | return record.status === '已发布'; | 20 | return record.status === '已发布'; |
| @@ -22,10 +22,10 @@ | @@ -22,10 +22,10 @@ | ||
| 22 | </div> | 22 | </div> |
| 23 | </template> | 23 | </template> |
| 24 | <script lang="ts"> | 24 | <script lang="ts"> |
| 25 | - import { defineComponent, ref, computed, unref, reactive, watch } from 'vue'; | 25 | + import { defineComponent, computed, unref, ref } from 'vue'; |
| 26 | import { Button } from '/@/components/Button'; | 26 | import { Button } from '/@/components/Button'; |
| 27 | import { BasicForm, useForm } from '/@/components/Form'; | 27 | import { BasicForm, useForm } from '/@/components/Form'; |
| 28 | - import { formSchema, selectWhere, isDeptId } from './config.d'; | 28 | + import { formSchema } from './config.d'; |
| 29 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | 29 | import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; |
| 30 | import { | 30 | import { |
| 31 | notifyAddDraftApi, | 31 | notifyAddDraftApi, |
| @@ -37,132 +37,202 @@ | @@ -37,132 +37,202 @@ | ||
| 37 | components: { BasicDrawer, BasicForm, Button }, | 37 | components: { BasicDrawer, BasicForm, Button }, |
| 38 | emits: ['success', 'register'], | 38 | emits: ['success', 'register'], |
| 39 | setup(_, { emit }) { | 39 | setup(_, { emit }) { |
| 40 | + // const isUpdate = ref(true); | ||
| 41 | + // // const pointArray = ref([] as any); | ||
| 42 | + // // const isJudgeWherePoint = ref(); | ||
| 43 | + // // const newArray = ref([]); | ||
| 44 | + // let getId = ref(''); | ||
| 45 | + // // let getOranAndDeptId = ref(null); | ||
| 46 | + // // let getAllData: any = reactive({}); | ||
| 47 | + // // let getAllEditData: any = reactive({}); | ||
| 48 | + // // let postAllEditData: any = reactive({}); | ||
| 49 | + // const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue }] = useForm({ | ||
| 50 | + // labelWidth: 120, | ||
| 51 | + // schemas: formSchema, | ||
| 52 | + // showActionButtonGroup: false, | ||
| 53 | + // }); | ||
| 54 | + // const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
| 55 | + // await resetFields(); | ||
| 56 | + // setDrawerProps({ confirmLoading: false }); | ||
| 57 | + // isUpdate.value = !!data?.isUpdate; | ||
| 58 | + // //编辑 | ||
| 59 | + // if (unref(isUpdate)) { | ||
| 60 | + // getId.value = data.record.id; | ||
| 61 | + // await setFieldsValue({ | ||
| 62 | + // ...data.record, | ||
| 63 | + // receiverType: data.record.receiverType === '全部' ? '0' : '1', | ||
| 64 | + // organizationId: isDeptId.value, | ||
| 65 | + // }); | ||
| 66 | + // } | ||
| 67 | + // }); | ||
| 68 | + // const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); | ||
| 69 | + | ||
| 70 | + // watch(selectWhere, (nV) => { | ||
| 71 | + // isJudgeWherePoint.value = nV; | ||
| 72 | + // }); | ||
| 73 | + // watch(isDeptId, (nV) => { | ||
| 74 | + // getOranAndDeptId.value = nV; | ||
| 75 | + // }); | ||
| 76 | + // // 发布 | ||
| 77 | + // async function handleSend() { | ||
| 78 | + // // 直接新增通知 | ||
| 79 | + // if (!unref(isUpdate)) { | ||
| 80 | + // const values = await validate(); | ||
| 81 | + // Object.assign(getAllData, values); | ||
| 82 | + // switch (unref(isJudgeWherePoint)) { | ||
| 83 | + // case '0': | ||
| 84 | + // pointArray.value = []; | ||
| 85 | + // break; | ||
| 86 | + // case '1': | ||
| 87 | + // if (pointArray.value.length === 0) { | ||
| 88 | + // pointArray.value.push(getOranAndDeptId.value); | ||
| 89 | + // } | ||
| 90 | + // break; | ||
| 91 | + // } | ||
| 92 | + // getAllData.pointId = pointArray.value; | ||
| 93 | + // await notifyAddLeaseApi(getAllData); | ||
| 94 | + | ||
| 95 | + // resetFields(); | ||
| 96 | + // } else { | ||
| 97 | + // const values = await validate(); | ||
| 98 | + // getAllEditData = values; | ||
| 99 | + // getAllEditData.id = unref(getId); | ||
| 100 | + // switch (unref(isJudgeWherePoint)) { | ||
| 101 | + // case '0': | ||
| 102 | + // pointArray.value = []; | ||
| 103 | + // break; | ||
| 104 | + // case '1': | ||
| 105 | + // if (pointArray.value.length === 0) { | ||
| 106 | + // pointArray.value.push(getOranAndDeptId.value); | ||
| 107 | + // } | ||
| 108 | + // break; | ||
| 109 | + // } | ||
| 110 | + // getAllEditData.pointId = pointArray.value; | ||
| 111 | + // Object.assign(postAllEditData, getAllEditData); | ||
| 112 | + // await notifyAddLeaseApi(postAllEditData); | ||
| 113 | + // } | ||
| 114 | + // closeDrawer(); | ||
| 115 | + // createMessage.success('发布成功'); | ||
| 116 | + // emit('success'); | ||
| 117 | + // } | ||
| 118 | + // // 保存草稿 | ||
| 119 | + // async function handleSaveDraft() { | ||
| 120 | + // if (!unref(isUpdate)) { | ||
| 121 | + // const values = await validate(); | ||
| 122 | + // Object.assign(getAllData, values); | ||
| 123 | + // switch (isJudgeWherePoint.value) { | ||
| 124 | + // case '0': | ||
| 125 | + // pointArray.value = []; | ||
| 126 | + // break; | ||
| 127 | + // case '1': | ||
| 128 | + // if (pointArray.value.length === 0) { | ||
| 129 | + // pointArray.value.push(getOranAndDeptId.value); | ||
| 130 | + // } | ||
| 131 | + // break; | ||
| 132 | + // } | ||
| 133 | + // getAllData.pointId = pointArray.value; | ||
| 134 | + // await notifyAddDraftApi(getAllData); | ||
| 135 | + | ||
| 136 | + // resetFields(); | ||
| 137 | + // } else { | ||
| 138 | + // const values = await validate(); | ||
| 139 | + // getAllEditData = values; | ||
| 140 | + // getAllEditData.id = getId.value; | ||
| 141 | + // switch (isJudgeWherePoint.value) { | ||
| 142 | + // case '0': | ||
| 143 | + // pointArray.value = []; | ||
| 144 | + // break; | ||
| 145 | + // case '1': | ||
| 146 | + // if (pointArray.value.length === 0) { | ||
| 147 | + // pointArray.value.push(getOranAndDeptId.value); | ||
| 148 | + // } | ||
| 149 | + // break; | ||
| 150 | + // } | ||
| 151 | + // getAllEditData.pointId = pointArray.value; | ||
| 152 | + // Object.assign(postAllEditData, getAllEditData); | ||
| 153 | + // await notifyAddDraftApi(postAllEditData); | ||
| 154 | + // } | ||
| 155 | + // createMessage.success('保存草稿成功'); | ||
| 156 | + // closeDrawer(); | ||
| 157 | + // emit('success'); | ||
| 158 | + // } | ||
| 159 | + // 取消 | ||
| 40 | const { createMessage } = useMessage(); | 160 | const { createMessage } = useMessage(); |
| 41 | - const isUpdate = ref(true); | ||
| 42 | - const pointArray = ref([] as any); | ||
| 43 | - const isJudgeWherePoint = ref([] as any); | ||
| 44 | - // const newArray = ref([]); | ||
| 45 | - let getId = ref(''); | ||
| 46 | - let getOranAndDeptId = ref(null); | ||
| 47 | - let getAllData: any = reactive({}); | ||
| 48 | - let getAllEditData: any = reactive({}); | ||
| 49 | - let postAllEditData: any = reactive({}); | 161 | + const isUpdate = ref<Boolean>(); |
| 162 | + const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); | ||
| 163 | + const noticeId = ref(''); | ||
| 50 | const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue }] = useForm({ | 164 | const [registerForm, { setFieldsValue, resetFields, validate, getFieldsValue }] = useForm({ |
| 51 | labelWidth: 120, | 165 | labelWidth: 120, |
| 52 | schemas: formSchema, | 166 | schemas: formSchema, |
| 53 | showActionButtonGroup: false, | 167 | showActionButtonGroup: false, |
| 54 | }); | 168 | }); |
| 55 | - const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
| 56 | - await resetFields(); | ||
| 57 | - setDrawerProps({ confirmLoading: false }); | ||
| 58 | - isUpdate.value = !!data?.isUpdate; | 169 | + const [registerDrawer, { closeDrawer }] = useDrawerInner(async (data) => { |
| 170 | + isUpdate.value = data.isUpdate; | ||
| 59 | //编辑 | 171 | //编辑 |
| 60 | if (unref(isUpdate)) { | 172 | if (unref(isUpdate)) { |
| 61 | - getId.value = data.record.id; | 173 | + noticeId.value = data.record.id; |
| 174 | + console.log(data.record); | ||
| 62 | await setFieldsValue({ | 175 | await setFieldsValue({ |
| 63 | ...data.record, | 176 | ...data.record, |
| 64 | receiverType: data.record.receiverType === '全部' ? '0' : '1', | 177 | receiverType: data.record.receiverType === '全部' ? '0' : '1', |
| 65 | }); | 178 | }); |
| 66 | } | 179 | } |
| 67 | }); | 180 | }); |
| 68 | - const getTitle = computed(() => (!unref(isUpdate) ? '新增通知' : '编辑通知')); | ||
| 69 | - const handleCancel = () => { | ||
| 70 | - closeDrawer(); | ||
| 71 | - }; | ||
| 72 | - watch(selectWhere, (nV) => { | ||
| 73 | - isJudgeWherePoint.value = nV; | ||
| 74 | - }); | ||
| 75 | - watch(isDeptId, (nV) => { | ||
| 76 | - getOranAndDeptId.value = nV; | ||
| 77 | - }); | ||
| 78 | - async function handleSend() { | 181 | + // 发布通知 |
| 182 | + const handleSend = async () => { | ||
| 183 | + await validate(); | ||
| 184 | + const field = getFieldsValue(); | ||
| 185 | + const pointId = field.receiverType === '1' ? [field.organizationId] : []; | ||
| 186 | + // 新增情况 | ||
| 79 | if (!unref(isUpdate)) { | 187 | if (!unref(isUpdate)) { |
| 80 | - const values = await validate(); | ||
| 81 | - Object.assign(getAllData, values); | ||
| 82 | - switch (isJudgeWherePoint.value) { | ||
| 83 | - case '0': | ||
| 84 | - pointArray.value = []; | ||
| 85 | - break; | ||
| 86 | - case '1': | ||
| 87 | - if (pointArray.value.length === 0) { | ||
| 88 | - pointArray.value.push(getOranAndDeptId.value); | ||
| 89 | - } | ||
| 90 | - break; | ||
| 91 | - } | ||
| 92 | - getAllData.pointId = pointArray.value; | ||
| 93 | - await notifyAddLeaseApi(getAllData); | ||
| 94 | - createMessage.success('新增成功'); | ||
| 95 | - closeDrawer(); | ||
| 96 | - emit('success'); | ||
| 97 | - resetFields(); | 188 | + const addNotice = { |
| 189 | + ...field, | ||
| 190 | + pointId, | ||
| 191 | + }; | ||
| 192 | + await notifyAddLeaseApi(addNotice); | ||
| 193 | + } else { | ||
| 194 | + const editNotice = { | ||
| 195 | + ...field, | ||
| 196 | + pointId, | ||
| 197 | + id: unref(noticeId), | ||
| 198 | + }; | ||
| 199 | + await notifyAddLeaseApi(editNotice); | ||
| 98 | } | 200 | } |
| 99 | - if (unref(isUpdate)) { | ||
| 100 | - getAllEditData = getFieldsValue(); | ||
| 101 | - getAllEditData.id = getId.value; | ||
| 102 | - switch (isJudgeWherePoint.value) { | ||
| 103 | - case '0': | ||
| 104 | - pointArray.value = []; | ||
| 105 | - break; | ||
| 106 | - case '1': | ||
| 107 | - if (pointArray.value.length === 0) { | ||
| 108 | - pointArray.value.push(getOranAndDeptId.value); | ||
| 109 | - } | ||
| 110 | - break; | ||
| 111 | - } | ||
| 112 | - getAllEditData.pointId = pointArray.value; | ||
| 113 | - Object.assign(postAllEditData, getAllEditData); | ||
| 114 | - await notifyAddLeaseApi(postAllEditData); | ||
| 115 | - createMessage.success('新增成功'); | ||
| 116 | - closeDrawer(); | ||
| 117 | - emit('success'); | ||
| 118 | - } | ||
| 119 | - } | ||
| 120 | - async function handleSaveDraft() { | 201 | + emit('success'); |
| 202 | + closeDrawer(); | ||
| 203 | + createMessage.success('发布成功'); | ||
| 204 | + }; | ||
| 205 | + // 保存草稿 | ||
| 206 | + const handleSaveDraft = async () => { | ||
| 207 | + await validate(); | ||
| 208 | + const field = getFieldsValue(); | ||
| 209 | + const pointId = field.receiverType === '1' ? [field.organizationId] : []; | ||
| 121 | if (!unref(isUpdate)) { | 210 | if (!unref(isUpdate)) { |
| 122 | - const values = await validate(); | ||
| 123 | - Object.assign(getAllData, values); | ||
| 124 | - switch (isJudgeWherePoint.value) { | ||
| 125 | - case '0': | ||
| 126 | - pointArray.value = []; | ||
| 127 | - break; | ||
| 128 | - case '1': | ||
| 129 | - if (pointArray.value.length === 0) { | ||
| 130 | - pointArray.value.push(getOranAndDeptId.value); | ||
| 131 | - } | ||
| 132 | - break; | ||
| 133 | - } | ||
| 134 | - getAllData.pointId = pointArray.value; | ||
| 135 | - await notifyAddDraftApi(getAllData); | ||
| 136 | - createMessage.success('新增成功'); | ||
| 137 | - closeDrawer(); | ||
| 138 | - emit('success'); | ||
| 139 | - resetFields(); | ||
| 140 | - } | ||
| 141 | - if (unref(isUpdate)) { | ||
| 142 | - getAllEditData = getFieldsValue(); | ||
| 143 | - getAllEditData.id = getId.value; | ||
| 144 | - switch (isJudgeWherePoint.value) { | ||
| 145 | - case '0': | ||
| 146 | - pointArray.value = []; | ||
| 147 | - break; | ||
| 148 | - case '1': | ||
| 149 | - if (pointArray.value.length === 0) { | ||
| 150 | - pointArray.value.push(getOranAndDeptId.value); | ||
| 151 | - } | ||
| 152 | - break; | ||
| 153 | - } | ||
| 154 | - getAllEditData.pointId = pointArray.value; | ||
| 155 | - Object.assign(postAllEditData, getAllEditData); | ||
| 156 | - await notifyAddDraftApi(postAllEditData); | ||
| 157 | - createMessage.success('编辑成功'); | ||
| 158 | - closeDrawer(); | ||
| 159 | - emit('success'); | 211 | + const saveDraft = { |
| 212 | + ...field, | ||
| 213 | + pointId, | ||
| 214 | + }; | ||
| 215 | + await notifyAddDraftApi(saveDraft); | ||
| 216 | + } else { | ||
| 217 | + const editDraft = { | ||
| 218 | + ...field, | ||
| 219 | + pointId, | ||
| 220 | + id: unref(noticeId), | ||
| 221 | + }; | ||
| 222 | + await notifyAddDraftApi(editDraft); | ||
| 160 | } | 223 | } |
| 161 | - } | 224 | + emit('success'); |
| 225 | + closeDrawer(); | ||
| 226 | + createMessage.success('保存草稿成功'); | ||
| 227 | + }; | ||
| 228 | + const handleCancel = () => { | ||
| 229 | + resetFields(); | ||
| 230 | + closeDrawer(); | ||
| 231 | + }; | ||
| 162 | return { | 232 | return { |
| 233 | + getTitle, | ||
| 163 | handleSend, | 234 | handleSend, |
| 164 | handleCancel, | 235 | handleCancel, |
| 165 | - getTitle, | ||
| 166 | handleSaveDraft, | 236 | handleSaveDraft, |
| 167 | registerForm, | 237 | registerForm, |
| 168 | registerDrawer, | 238 | registerDrawer, |
| @@ -98,7 +98,7 @@ | @@ -98,7 +98,7 @@ | ||
| 98 | //onKeyStroke('Enter', handleLogin); | 98 | //onKeyStroke('Enter', handleLogin); |
| 99 | 99 | ||
| 100 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); | 100 | const getShow = computed(() => unref(getLoginState) === LoginStateEnum.LOGIN); |
| 101 | - | 101 | + const storage = createLocalStorage(); |
| 102 | async function handleLogin() { | 102 | async function handleLogin() { |
| 103 | const data = await validForm(); | 103 | const data = await validForm(); |
| 104 | if (!data) return; | 104 | if (!data) return; |
| @@ -118,8 +118,15 @@ | @@ -118,8 +118,15 @@ | ||
| 118 | duration: 3, | 118 | duration: 3, |
| 119 | }); | 119 | }); |
| 120 | const res = await getPlatForm(); | 120 | const res = await getPlatForm(); |
| 121 | - const storage = createLocalStorage(); | ||
| 122 | storage.set('platformInfo', res); | 121 | storage.set('platformInfo', res); |
| 122 | + userStore.setPlatInfo(res); | ||
| 123 | + // 设置icon | ||
| 124 | + let link = (document.querySelector("link[rel*='icon']") || | ||
| 125 | + document.createElement('link')) as HTMLLinkElement; | ||
| 126 | + link.type = 'image/x-icon'; | ||
| 127 | + link.rel = 'shortcut icon'; | ||
| 128 | + link.href = res.icon ?? '/public/favicon.ico'; | ||
| 129 | + document.getElementsByTagName('head')[0].appendChild(link); | ||
| 123 | } | 130 | } |
| 124 | } catch (error: any) { | 131 | } catch (error: any) { |
| 125 | createErrorModal({ | 132 | createErrorModal({ |
| @@ -135,15 +142,5 @@ | @@ -135,15 +142,5 @@ | ||
| 135 | } finally { | 142 | } finally { |
| 136 | loading.value = false; | 143 | loading.value = false; |
| 137 | } | 144 | } |
| 138 | - | ||
| 139 | - const res = await getPlatForm(); | ||
| 140 | - userStore.setPlatInfo(res); | ||
| 141 | - // 设置icon | ||
| 142 | - let link = (document.querySelector("link[rel*='icon']") || | ||
| 143 | - document.createElement('link')) as HTMLLinkElement; | ||
| 144 | - link.type = 'image/x-icon'; | ||
| 145 | - link.rel = 'shortcut icon'; | ||
| 146 | - link.href = res.icon ?? '/public/favicon.ico'; | ||
| 147 | - document.getElementsByTagName('head')[0].appendChild(link); | ||
| 148 | } | 145 | } |
| 149 | </script> | 146 | </script> |
| @@ -103,7 +103,7 @@ | @@ -103,7 +103,7 @@ | ||
| 103 | return info; | 103 | return info; |
| 104 | }, | 104 | }, |
| 105 | actionColumn: { | 105 | actionColumn: { |
| 106 | - width: 180, | 106 | + width: 220, |
| 107 | title: '操作', | 107 | title: '操作', |
| 108 | dataIndex: 'action', | 108 | dataIndex: 'action', |
| 109 | slots: { customRender: 'action' }, | 109 | slots: { customRender: 'action' }, |
| @@ -141,8 +141,8 @@ | @@ -141,8 +141,8 @@ | ||
| 141 | } | 141 | } |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | - function handleSelect(deptId = '') { | ||
| 145 | - searchInfo.deptId = deptId; | 144 | + function handleSelect(organization) { |
| 145 | + searchInfo.organizationId = organization; | ||
| 146 | reload(); | 146 | reload(); |
| 147 | } | 147 | } |
| 148 | 148 |
| @@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
| 69 | title: t('routes.common.common.operation'), //操作 | 69 | title: t('routes.common.common.operation'), //操作 |
| 70 | dataIndex: 'action', | 70 | dataIndex: 'action', |
| 71 | slots: { customRender: 'action' }, | 71 | slots: { customRender: 'action' }, |
| 72 | - fixed: undefined, | 72 | + fixed: 'right', |
| 73 | }, | 73 | }, |
| 74 | }); | 74 | }); |
| 75 | /** | 75 | /** |
| @@ -39,7 +39,6 @@ export const formSchema: FormSchema[] = [ | @@ -39,7 +39,6 @@ export const formSchema: FormSchema[] = [ | ||
| 39 | }, | 39 | }, |
| 40 | getPopupContainer: () => document.body, | 40 | getPopupContainer: () => document.body, |
| 41 | }, | 41 | }, |
| 42 | - // required: true, | ||
| 43 | }, | 42 | }, |
| 44 | { | 43 | { |
| 45 | field: 'name', | 44 | field: 'name', |
| @@ -58,4 +57,10 @@ export const formSchema: FormSchema[] = [ | @@ -58,4 +57,10 @@ export const formSchema: FormSchema[] = [ | ||
| 58 | field: 'remark', | 57 | field: 'remark', |
| 59 | component: 'InputTextArea', | 58 | component: 'InputTextArea', |
| 60 | }, | 59 | }, |
| 60 | + { | ||
| 61 | + label: '租户ID', | ||
| 62 | + field: 'tenantId', | ||
| 63 | + component: 'Input', | ||
| 64 | + show: false, | ||
| 65 | + }, | ||
| 61 | ]; | 66 | ]; |
| @@ -111,7 +111,7 @@ | @@ -111,7 +111,7 @@ | ||
| 111 | openTenantAdminFormDrawer(true, { | 111 | openTenantAdminFormDrawer(true, { |
| 112 | isUpdate: true, | 112 | isUpdate: true, |
| 113 | record, | 113 | record, |
| 114 | - tenantCode: tenantId.value, | 114 | + tenantId: tenantId.value, |
| 115 | }); | 115 | }); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| @@ -170,7 +170,7 @@ | @@ -170,7 +170,7 @@ | ||
| 170 | bordered: true, | 170 | bordered: true, |
| 171 | showIndexColumn: false, | 171 | showIndexColumn: false, |
| 172 | searchInfo: { | 172 | searchInfo: { |
| 173 | - tenantId: tenantId, | 173 | + tenantId, |
| 174 | roleType: RoleEnum.ROLE_TENANT_ADMIN, | 174 | roleType: RoleEnum.ROLE_TENANT_ADMIN, |
| 175 | }, | 175 | }, |
| 176 | actionColumn: { | 176 | actionColumn: { |
| @@ -178,7 +178,7 @@ | @@ -178,7 +178,7 @@ | ||
| 178 | title: '操作', | 178 | title: '操作', |
| 179 | dataIndex: 'action', | 179 | dataIndex: 'action', |
| 180 | slots: { customRender: 'action' }, | 180 | slots: { customRender: 'action' }, |
| 181 | - fixed: undefined, | 181 | + fixed: 'right', |
| 182 | }, | 182 | }, |
| 183 | tableSetting: { | 183 | tableSetting: { |
| 184 | redo: true, | 184 | redo: true, |
| @@ -140,7 +140,7 @@ | @@ -140,7 +140,7 @@ | ||
| 140 | title: '操作', | 140 | title: '操作', |
| 141 | dataIndex: 'action', | 141 | dataIndex: 'action', |
| 142 | slots: { customRender: 'action' }, | 142 | slots: { customRender: 'action' }, |
| 143 | - fixed: undefined, | 143 | + fixed: 'right', |
| 144 | }, | 144 | }, |
| 145 | }); | 145 | }); |
| 146 | return { | 146 | return { |